Page 1 of 1
how do you create a custom action to set a layergroup to a certain opacity value?
Posted: 10 Mar 2021, 10:44
by Peter Wassink
i found this thread:
viewtopic.php?f=34&t=8300&p=74149&hilit ... ity#p74149
it helped me to find the command to set a layer to a certain opacity:
"tv_LayerDensity 80" i've put it in an action and it works great for the active layer
Now i want to make a button that sets all layers of a certain colorgroup to this opacity.
how can i do this?
the scripting in the above thread goes a bit over my head...
Re: how do you create a custom action to set a layergroup to a certain opacity value?
Posted: 10 Mar 2021, 17:50
by Svengali
Peter,
I think this script does what you want with a nicety or two? The same loop-thru-construct could apply other useful processes to all layers.
Code: Select all
Param none
ScriptName = "SetOpacityByGroupColor"
tv_LayerCurrentID
OriginalID = result
tv_ReqNum 0 0 12 "enter groupcolor (0-12)"
GroupColor = result
IF CMP(GroupColor,"Cancel")
EXIT
END
tv_ReqNum 80 1 100 "enter LayerDensity for GroupColor "GroupColor" "
LayerDensity = result
IF CMP(LayerDensity,"Cancel")
EXIT
END
LayerNumber = 0
ExitFlag = 1
While ExitFlag == 1
tv_LayerGetID LayerNumber
LayerID = result
IF CMP(LayerID, "none")
ExitFlag = 0
ELSE
tv_LayerSet LayerID
tv_LayerColor GET LayerID
ColorIndex = result
IF ColorIndex == GroupColor
tv_LayerDensity LayerDensity
ELSE
tv_LayerDensity 100
END
LayerNumber = LayerNumber + 1
END
END
tv_LayerSet OriginalID
tv_warn "Density for All Layers of GroupColor " GroupColor " has been set to" LayerDensity
sven
Re: how do you create a custom action to set a layergroup to a certain opacity value?
Posted: 11 Mar 2021, 08:57
by Peter Wassink
Thank you very much Sven!
It works perfectly.
and it was very easy to adjust the script so it just sets a preselected group to a preset opacity this is awesome!
makes me think i should be getting into scripting a bit more