Edit palette Stoner points dynamically

Hey,

I’ve dug a bit into the component, but I’m not sure how the scripts interact together with the different operators. I’d like to be able to move different keypoints from the Stoner with input values. I’ve never used scripts within TD but I’m experienced with Python.
If anyone has any experience with this component or could lead me towards tools that would allow me to achieve a similar result, that would be appreciated a lot.

Thanks !

Hey @MaelFayolle, welcome to the forum.

if you go into stoner/project you’ll find all the the DATs which contain the values you have set for the current project.You can change these values directly using Python, and then you’ll see that reflected in the stoner interface and output.

For a simple start, when using only basic 4-point corner-pin (stoner set to “Keystone”) you’ll only need to change the 4 rows in the stoner/project/keyOffSet DAT.

When you go to grid warping you’ll need to edit values in the other DATs: pointOffset and uvOffset.
Also Mapping mode, Warping mode, and number of rows and cols can be set in the stoner/project/settings DAT

For more documentation on how to access any operator (in this case a Table DAT) using Python, click the python blue/yellow question mark in its parameter Window.
image

That will bring you directly to it’s Python class documentation page:

Thanks for your detailed answer.
My concern was more about the grid warp mode. When you move a keypoint with a handle, it also moves other points within the grid to warp effectively. I would have liked to keep this behavior and thus not having to rewrite everything to compute warping offsets of the “hidden” points inside the grid.

Maël

ah yes. Hmm well as stoner does not have an API afaik, it’s perhaps easiest to just simulate keyboard presses using something like the pyinput package.
See docs here pynput Package Documentation — pynput 1.7.6 documentation
Use tab to select different grid points, arrow keys to move them, hold control for greater accuracy.
See stoner/ui/controls/keyboardin1_script DAT for other keys which control stoner

That would be tedious to do so as I would need to move multiple handles at the same time and keep track of their position.
I’ll keep digging and see if I can adapt the component without too much hassle. Thanks!

EDIT: Is there a way to know where are operators referenced in other scripts ? That would make everything easier to understand when stumbling accros premade components