The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   AppleScripting Omni Apps (http://forums.omnigroup.com/forumdisplay.php?f=46)
-   -   Shadow workaround? (http://forums.omnigroup.com/showthread.php?t=27693)

azaroth42 2013-01-06 04:29 PM

Shadow workaround?
 
[B]Bug:[/B] Can't reset shadow to immediately beneath object

[B]Workaround:[/B] Create different layers and put the graphics in the right layer such that the shadow is cast on the layer.
eg:

[CODE]set middleLayer to make new layer at end of layers with properties {name:"middleLayer"}
set imageShape to make new shape at end of graphics of middleLayer with properties {draws shadow:true, size:{218, 150}, origin:{25, 28}, thickness:1, shadow vector:{3, -3}}
-- Can't set image directly in a layer
tell imageShape to set {image} to {"/path/to/image.jpg"}

set backLayer to make new layer at end of layers with properties {name:"backLayer"}
set backShape to make new shape at beginning of graphics of backLayer with properties {draws shadow:false, size:{270, 198}, origin:{0, 0}, thickness:0, fill:"linear blend", fill color:{0.576, 0.576, 0.576}, gradient color:{0.18, 0.18, 0.18}, gradient angle:90, gradient center:{-1, -1}}
[/CODE]

And now the shadow from the image appears on the background shape.

[B]Issues:[/B] You can't put the graphics into a group to manipulate them further, and similar cross-layer issues, but at least they [I]look[/I] correct.

Thoughts?

Andrew 2013-01-07 05:25 PM

I think you might be overlooking the Shadow inspector. There you can control whether objects' shadows fall on lower layers (the default) or on all lower objects, including those on lower layers. (If you're wondering why there is a distinction: in many cases people want to compose something out of multiple shapes, and having their shadows interplay prevents the desired composition.) Hopefully I'm correctly interpreting the issue you're trying to work around.

azaroth42 2013-01-07 06:21 PM

Yes, the inspector can be used to do it manually, but the shadow settings can't be set from Applescript (hence the post in this forum, rather than Omnigraffle General). Unless I've missed it, and if so, please let me know the property name to set shadow placement :)

Many thanks for the response.

Ken Case 2013-01-08 07:11 AM

[QUOTE=azaroth42;119029]Yes, the inspector can be used to do it manually, but the shadow settings can't be set from Applescript (hence the post in this forum, rather than Omnigraffle General). Unless I've missed it, and if so, please let me know the property name to set shadow placement :)

Many thanks for the response.[/QUOTE]

The property is called "shadow vector". I quickly found this by dragging a circle onto the canvas, setting the shadow offset to {+17, +17}, then using Edit->Copy As->AppleScript and pasting the results into a text file which I searched for "17":

[CODE]tell application "OmniGraffle Professional"
tell canvas of front window
make new shape at end of graphics with properties {name: "Circle", textSize: {0.800000, 0.700000}, size: {133.000000, 107.000000}, origin: {128.000000, 236.000000}, textPosition: {0.100000, 0.150000}, [B]shadow vector: {17.000000, 17.000000[/B]}}
end tell
end tell[/CODE]

Hope that helps!

azaroth42 2013-01-08 07:22 AM

[QUOTE=Ken Case;119054]The property is called "shadow vector". [/QUOTE]

Hi Ken,

Thanks for the response! I'm obviously not being very clear about the issue. What I'm trying to do is, as per Andrew's manual suggestion, reset the shadow to be drawn on the object directly beneath the shadowed object.

The difference between the buttons in the UI:
* Shadow immediately beneath this object [this is what I want]
* Shadow behind all other objects in the same layer [but this is the default]

Sorry for the confusion.

Ken Case 2013-01-09 12:55 PM

[QUOTE=azaroth42;119058]What I'm trying to do is, as per Andrew's manual suggestion, reset the shadow to be drawn on the object directly beneath the shadowed object.[/QUOTE]

My apologies, I clearly wasn't reading carefully enough!

The bad news is that I looked into this in more depth and you're right: there's currently no good way to set that property from AppleScript. The only workarounds that come to mind are to copy your shape from one which already has the property set, or to use UI scripting to script the Inspector.

The good news is that an upcoming release of OmniGraffle will add a new "shadow beneath" scripting property to shapes.


All times are GMT -8. The time now is 07:55 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.