Copy link to clipboard
Copied
Hi all again,
Is there a way to add a button with similar usage to the Point Controller effect to a ScriptUI palette?
I wish to allow the user to select a point in the comp's viewer and get the X, Y values back after interaction -- similar to the Target Icon in most point controllers of most effects.
I saw you can do this with Pseudo Effects... no way to do it using ScriptUI? Or another method?
I tried adding a Point Controller effect to a layer using script and somehow invoking a button press on the Target Icon of the effect - no success here.
Any Ideas?
Thanks a lot
Roy.
Copy link to clipboard
Copied
I think adding a point controller effect and let the script read its value is the only option you have, if you want to have a visual representation of the point in the comp viewer. Of course, this does not give you live update notifications, when the user moves the controller, but it is the best you can do.
Copy link to clipboard
Copied
Thanks a lot for the quick reply!
Love your work by the way
Use your scripts and tips all the time.
Adding a Point control effect is the option I was considering - but my script has its own ScriptUi pallete and I wanted to avoid having the user move out of my script's ui to the effect control panel to click the Target button.
That is why I thought maybe I can add a button in my UI to call a button click on the Point Control effect's Target button.
I don't require results in real time - just the final selected location.
I've been searching a lot these last few days and I saw in some forum (forgot where) that you can invoke a mouse click or key press on an effect's property using an array of properties. Is this only availabe using the C++ SDK or through extended script as well? Or was I dreaming. I'm still learning this thing. I'm fluent in JS but less in the AE scripting environment.
Thanks again,
Roy
Copy link to clipboard
Copied
OK, how does this sound to you guys:
The very impressive UI for the script Duik Tools from
http://rainboxprod.coop/en/tools/
Gave me this crazy idea:
Have a scriptui icon button in my script's palette with an icon similar to the point controller's target button.
When this icon button is clicked the script locks all of the comp's layers and creates a new shape layer with a target shape similar to the target gizmo of the point controller. The user then should move this shape layer to a desired position and click an OK button. The script will then harvest the shape layer's position and delete it. All locked layers will return to previous state. There will also be a cancel button. Can this be done or am I wasting my time?
Copy link to clipboard
Copied
You should be able to use shape layers pretty much the same way as point controllers. It is a bit more work, but gives you more control about how the controller looks like. Make sure to turn the shape layer into a guide layer such that it is never rendered accidentally.
Copy link to clipboard
Copied
Thanks again for your assistance.
I have started down this path and created the button that will create a guide shape layer in the shape of a target icon -
But it seems difficult to get the right shape with code -- is there an easy way to create shape layers with code or convert existing shape layers to code?
I know of
compCode - aescripts + aeplugins - aescripts.com
which I guess will do the trick but it's 100$ too much for me right now.
Thanks
Roy
Copy link to clipboard
Copied
I managed to implement a button that creates of a shape layer in a target shape - I then collect the shape layer's location after the user clicks an OK button.
This works great - if the user is careful
Because once the guide target shape layer is created, my script disables all other buttons in my ScriptUI panel except an OK and Cancel Buttons. This means that if the user creates this target shape layer but then disregards the correct workflow and just continues to work on his project then my script's panel just hangs there waiting for a cancel/OK click and can be stuck in that state if the user forgets about the target layer and can't undo anymore because of various reasons. The user will eventually need to close the panel and rerun the script to make it work again.
So a couple of questions here -
1. Can I hide all layers controls from the Comp Viewer via script? (similar to pressing CTRL+SHIFT+H) Is this setting read/write-able?
2. What kind of error control is best to implement for such a workflow? I thought of a few things like popping an alert each time the user clicks the create target button that explains the procedure but that still doesn't guarantee the user will follow it...
How about listening to key/mouse events and making sure that the user only moves the target shape layer and nothing else until he clicks ok/cancel? Crazy huh?
Thanks
Roy
Copy link to clipboard
Copied
Found out which command toggle layer controls from a script:
app.executeCommand(2435);
OR this:
app.executeCommand(app.findMenuCommandId("Show Layer Controls"));
This thread was very enlightening:
List of reference names for executeCommand();
BUT! This command toggles the layer controls... anyway to know if they are currently visible or hidden? I wander...
Copy link to clipboard
Copied
"Show Layer Controls" is not a global pref, every comp has its own "Show Layer Controls" setting, and that setting is not exposed to scripting.
Copy link to clipboard
Copied
I've tried to implement an addEvenetListener to mouse clicks and keyboard presses on the global window level but couldn't figure it out.
I did manage to add event listeners to my own script's interface but not to the entire After Effects software window.
This code didn't work:
Window.addEventListener('click', function (e) { catchTheEvent(e) });
function catchTheEvent(the_event) {
alert('click ');
}
It didn't give an error when running but the function catchTheEvent isn't fired.
app.addEventListener gives an error.
Couldn't find any help on the web...
Thanks for all the support guys! Really appreciate it.
Roy.
Copy link to clipboard
Copied
What you are trying to do is not possible.
The only events reported by after effects are errors (app.onError) and the ones related to the render queue. Nothing else.
Xavier
Copy link to clipboard
Copied
Thank a lot! You just saved me from spending all night looking for an answer ![]()
The fake point controller using a shape layer works really nice. I guess the user will just have to be attentive.
Thanks a lot again.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more