Copy link to clipboard
Copied
I want to get the position of the mouse when the user clicks in the comp window. I can get the mouse position using OS calls, but I want the relative position, exactly like PF_Param_POINT does it when you press that target button next to the parameter value.
I though about geting the size and position of the comp and then calculate the mouse position using the OS mouse calls, but I don't know how to get the position and size of the comp.
Another option would be to add a hidden PF_Param_POINT, and force the activation of the pick tool from the parameter, but I didn't find a way to activate it without user input.
Any ideas?
take a look at the "CCU" SDK sample project. it shows hot to get the mouse click location in the comp window coordinates, and how to convert those into layer source coordinates.
Copy link to clipboard
Copied
I don't think there's any chance of doing that since the viewer has it's own life and you don't know anything about how the panel is set up in the API.
Mylenium
Copy link to clipboard
Copied
take a look at the "CCU" SDK sample project. it shows hot to get the mouse click location in the comp window coordinates, and how to convert those into layer source coordinates.
Copy link to clipboard
Copied
Thank you Shachar, this is exactly what I want.
Copy link to clipboard
Copied
What is "CCU" SDK
Copy link to clipboard
Copied
Same question. How did you solve it?
Copy link to clipboard
Copied
the mouse coordinates are part of the data passed to the plugin on a ui event call. take a look at the "CCU" sample project, it's implemented there. no solution required, just copy paste from there.
Copy link to clipboard
Copied
I'm curious if this is only available during custom UI event callbacks. Is it possible to get layer coordiantes as comp space coordinates at other times during an Effect process if your effect does not have a custom UI? (without bringing AEGP in the mix because apparently that's not ideal?)
Copy link to clipboard
Copied
mixing an effect is possible and not problematic in most cases. however, that won't solve this issue.
indeed, the mouse data and conversion callbacks are only available during ui event calls. however, you could emulate that stuff.
the mouse position can be gotten directly directly via the operating system. you can also create a layer-to-comp matrix (and vice versa) using an AEGP call to get the layer and camera matrices. it's a bit of a hassle to set up, but by all means possible.
the one "unknown" there would be the offset between the screen mouse point and the AE window of interest... PF_ConvertLocalToGlobal only works during ui events...
Copy link to clipboard
Copied
em....What is "CCU" sample?
Copy link to clipboard
Copied
The AE SDK is shipped with many sample projects. these projects demonstrate the propper usage of almost all API callbacks. they are also good starting points for various plug-in developments, as well as a good place to grab code from.
here's the list of said sample projects in the docs:
https://ae-plugins.docsforadobe.dev/intro/sample-projects.html
the "CCU" sample project demonstrates a custom comp ui, and along the way shows how to get mouse coordinates in layer space.
Copy link to clipboard
Copied
Thank you so much!