Skip to main content
Known Participant
September 20, 2016
Question

Point Controller using ScriptUI

  • September 20, 2016
  • 3 replies
  • 1920 views

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.

This topic has been closed for replies.

3 replies

Known Participant
September 30, 2016

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.

UQg
Brainiac
September 30, 2016

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

Known Participant
October 1, 2016

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.

Known Participant
September 21, 2016

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?

Mathias Moehl
Adobe Expert
September 22, 2016

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.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Known Participant
September 23, 2016

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

Mathias Moehl
Adobe Expert
September 20, 2016

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.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Known Participant
September 20, 2016

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