Generic switch node

Forums: Generic switch node
Forum for OctaneRender Lua scripting examples, discussion and support.

Generic switch node

Postby jobigoud » Wed Feb 26, 2020 2:33 pm

jobigoud Wed Feb 26, 2020 2:33 pm
Hi,

This is a script node for Octane Standalone implementing a generic "Switch" functionality.

switch.lua
(13.25 KiB) Downloaded 414 times


This node lets you create a selector between multiple variants. You can have several cameras or several geometries or several materials, etc. and change the one that is actually used in the scene by setting the "Selected option" variable. This avoids constantly disconnecting and reconnecting nodes when you need to go back and forth between various options.

Usage: set the type and number of options and plug your variants in the option list. If you need more than 32 options you can also daisy chain them indefinitely.

Installation: if you save the file in your script directory it will appear in the Nodegraph editor context menu under Other > Switch. Alternatively you can add it to any scene the normal way: Nodegraph menu Other > Scripted graph, then in the Node inspector "Load script from file", and point it to where you saved the lua script.

Let us know if you have any feedback or suggestions!
Thanks

switch.png
Last edited by jobigoud on Sat Nov 07, 2020 2:21 pm, edited 1 time in total.
User avatar
jobigoud
OctaneRender Team
OctaneRender Team
 
Posts: 230
Joined: Sat Aug 15, 2015 1:28 pm

Re: Generic switch node

Postby manalokos » Fri Feb 28, 2020 6:13 pm

manalokos Fri Feb 28, 2020 6:13 pm
Great!! Thank you!

Kind regards
Filipe
manalokos
Licensed Customer
Licensed Customer
 
Posts: 438
Joined: Fri Nov 18, 2011 4:43 pm

Re: Generic switch node

Postby andw » Fri Nov 06, 2020 12:06 pm

andw Fri Nov 06, 2020 12:06 pm
Very useful, many thanks! Now I can switch LUTs without losing sight of rendered image :)
A couple of UI/UX suggestions:
1. Is it possible to limit "Selected option" maximum value to selected "Number of options", not the maxCount=32 constant?
2. Can the "Selected option" control be implemented as dropdown selector (like for enums), for selecting value using up/down arrow keys?
AMD R7-2700/64Gb/RTX2080Ti 11Gb + RTX2080 8Gb/Win10 Pro x64/nV driver 451.67/Poser10, DS4.12, Blender2.79, Octane 4.05 Standalone
> Using RAM Disk with Octane <
andw
Licensed Customer
Licensed Customer
 
Posts: 46
Joined: Wed Aug 22, 2012 5:42 am

Re: Generic switch node

Postby whersmy » Fri Nov 06, 2020 2:43 pm

whersmy Fri Nov 06, 2020 2:43 pm
Sweet! :D
Octane 2022.1.1 nv535.98
mac pro g5| pentium g2030 iGPU| maximus extreme V| 2x gtx590 - 8gb - SSD - win7-x64- 1500W Silverstone|
x201t - gtx580 - egpu ec
Dell G5 - 16GB - dgpu GTX1060 - TB3 egpu @ 1060 / RTX 4090

Octane Render experiments
User avatar
whersmy
Licensed Customer
Licensed Customer
 
Posts: 723
Joined: Thu Aug 30, 2012 7:40 am

Re: Generic switch node

Postby jobigoud » Sat Nov 07, 2020 7:36 pm

jobigoud Sat Nov 07, 2020 7:36 pm
andw wrote:Very useful, many thanks! Now I can switch LUTs without losing sight of rendered image :)
A couple of UI/UX suggestions:
1. Is it possible to limit "Selected option" maximum value to selected "Number of options", not the maxCount=32 constant?
2. Can the "Selected option" control be implemented as dropdown selector (like for enums), for selecting value using up/down arrow keys?


Good ideas! I made a change and updated the script in the OP.
There is a weird behavior where the number of entries in the drop down may not update correctly at first. You have to click on a Render target at least once and after that it works normally.
User avatar
jobigoud
OctaneRender Team
OctaneRender Team
 
Posts: 230
Joined: Sat Aug 15, 2015 1:28 pm

Re: Generic switch node

Postby andw » Sat Nov 07, 2020 8:06 pm

andw Sat Nov 07, 2020 8:06 pm
jobigoud wrote:Good ideas! I made a change and updated the script in the OP.


Nice! :)
All works as expected. The only thing we lost is selecting option with mouse wheel. But it isn't useful (IMHO).
There is also one more issue: when scene file, containing these switch nodes is opened, their UI (in Node inspector) doesn't initialized properly, need to click "Reload script file" button:
s2.jpg

May be some issues because of 4.05 version.
AMD R7-2700/64Gb/RTX2080Ti 11Gb + RTX2080 8Gb/Win10 Pro x64/nV driver 451.67/Poser10, DS4.12, Blender2.79, Octane 4.05 Standalone
> Using RAM Disk with Octane <
andw
Licensed Customer
Licensed Customer
 
Posts: 46
Joined: Wed Aug 22, 2012 5:42 am

Re: Generic switch node

Postby Delizade » Wed Aug 03, 2022 9:56 pm

Delizade Wed Aug 03, 2022 9:56 pm
Hello,
How can I use this script in C4D Octane node editor?
Windows 10 (3090Ti) | MacBook Pro (M3 Max)
Delizade
Licensed Customer
Licensed Customer
 
Posts: 146
Joined: Thu Oct 18, 2018 10:38 pm
Location: Istanbul

Re: Generic switch node

Postby bepeg4d » Thu Aug 04, 2022 7:18 am

bepeg4d Thu Aug 04, 2022 7:18 am
Delizade wrote:Hello,
How can I use this script in C4D Octane node editor?


You need to use C4D X-Presso for doing the same in c4doctane plugin.

ciao,
Beppe
User avatar
bepeg4d
Octane Guru
Octane Guru
 
Posts: 9940
Joined: Wed Jun 02, 2010 6:02 am
Location: Italy

Return to Lua Scripting


Who is online

Users browsing this forum: No registered users and 2 guests

Thu Mar 28, 2024 4:46 pm [ UTC ]