Copy link to clipboard
Copied
Does anybody have any action manager code to ensure that the move tool option to align to canvas has been activated and is not left on selection? I know the code to select the move tool, but not the alignment option for canvas as shown below.
It seems that the state of this option can only be obtained by setting a notifier on the align event and reading the handle after the user has done alignment at least once. Moreover, I did not find a way to force it - if I try to execute the align command with d.putBoolean(s2t( 'alignToCanvas'), true), then we will get an error if the selection-based alignment mode is selected (the same if we write the command into an action).
However, if you just need to understand which mode is currently acti
...Copy link to clipboard
Copied
It seems that the state of this option can only be obtained by setting a notifier on the align event and reading the handle after the user has done alignment at least once. Moreover, I did not find a way to force it - if I try to execute the align command with d.putBoolean(s2t( 'alignToCanvas'), true), then we will get an error if the selection-based alignment mode is selected (the same if we write the command into an action).
However, if you just need to understand which mode is currently active, then you can wrap it in try...catch and determine the active mode this way (you need to make sure that a selection is not created, since there will be no error if it exists).
You can also set a notifier on the align event and read the descriptor that will be passed to the script (it will explicitly indicate the active align mode). However, this method is less preferable, since we can get data about the event only after the user performs manual alignment.
Copy link to clipboard
Copied
Thank you jazz-y!
I was hoping for a magic answer. Oh well...
I have had to resort to placing a select all before the align to canvas code, then a deselect after the code. This is far from ideal, however, at least it avoids the error and achieves the same end result if the GUI is set to selection.
Thank you for looking into this for me.