Page 1 of 1

Generic switch node

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

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

switch.lua
(13.25 KiB) Downloaded 437 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

Re: Generic switch node

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

Kind regards
Filipe

Re: Generic switch node

PostPosted: Fri Nov 06, 2020 12:06 pm
by andw
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?

Re: Generic switch node

PostPosted: Fri Nov 06, 2020 2:43 pm
by whersmy
Sweet! :D

Re: Generic switch node

PostPosted: Sat Nov 07, 2020 7:36 pm
by jobigoud
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.

Re: Generic switch node

PostPosted: Sat Nov 07, 2020 8:06 pm
by andw
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.

Re: Generic switch node

PostPosted: Wed Aug 03, 2022 9:56 pm
by Delizade
Hello,
How can I use this script in C4D Octane node editor?

Re: Generic switch node

PostPosted: Thu Aug 04, 2022 7:18 am
by bepeg4d
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