Rotate placement node by 90degree

Forums: Rotate placement node by 90degree
Forum for OctaneRender Lua scripting examples, discussion and support.

Rotate placement node by 90degree

Postby oscartung » Sat Jan 04, 2020 12:20 pm

oscartung Sat Jan 04, 2020 12:20 pm
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.
oscartung
Licensed Customer
Licensed Customer
 
Posts: 64
Joined: Wed May 21, 2014 5:33 pm

Re: Rotate placement node by 90degree

Postby grimm » Sat Jan 04, 2020 6:01 pm

grimm Sat Jan 04, 2020 6:01 pm
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
Linux Mint 20 x64 | Nvidia GTX 980 4GB (displays) RTX 2070 8GB| Intel I7 5820K 3.8 Ghz | 32Gb Memory | Nvidia Driver 460.56
User avatar
grimm
Licensed Customer
Licensed Customer
 
Posts: 1321
Joined: Wed Jan 27, 2010 8:11 pm
Location: Spokane, Washington, USA

Re: Rotate placement node by 90degree

Postby alicebobby » Tue Dec 19, 2023 3:30 am

alicebobby Tue Dec 19, 2023 3:30 am
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 
alicebobby
 
Posts: 3
Joined: Tue Dec 19, 2023 3:24 am

Return to Lua Scripting


Who is online

Users browsing this forum: No registered users and 4 guests

Tue Apr 16, 2024 8:43 am [ UTC ]