Page 1 of 1

Rotate placement node by 90degree

PostPosted: Sat Jan 04, 2020 12:20 pm
by oscartung
Hi I'm new to Lua Scripting, I'm trying to create a script where it would rotate the placement node along the Y axis by 90 degree everytime I press a shortcut key.
Can anyone please give help on how I might do that thank you.

Re: Rotate placement node by 90degree

PostPosted: Sat Jan 04, 2020 6:01 pm
by grimm
You can add a shortcut key to the beginning of your script with a directive in a comment like so...

Code: Select all
-- @shortcut       ctrl + t


In this example I'm setting the shortcut to CTRL-t.

Some other thoughts on your script would be..

1) You need to check and see if a node is selected, if not, I would exit the script silently.
2) Check if the selected node is a placement node, if not, exit silently.
3) If a node is selected and it's a placement node then add 90 to the Y axis. You will need to look at the API to see how to do that.

I think exiting silently from the script will make the workflow nicer, otherwise you will have to deal with a popup every time you accidentally press the shortcut key.

Jason

Re: Rotate placement node by 90degree

PostPosted: Tue Dec 19, 2023 3:30 am
by alicebobby
Other ideas regarding your script include.

1) Please make sure that a node is selected; if not, I would silently end the script.
2) Verify whether the chosen node is a placement node; if not, quietly close the window.

3) The Y axis should be extended by 90 if a placement node is chosen. To find out how to accomplish it, you'll need to examine the API.

The workflow will be nicer, in my opinion, if the script exits silently. If not, you'll have to deal with a popup every time you mistakenly hit the shortcut key.

Alice  retro bowl college