Generic switch node

Forum for OctaneRender Lua scripting examples, discussion and support.
Post Reply
User avatar
jobigoud
OctaneRender Team
Posts: 243
Joined: Sat Aug 15, 2015 1:28 pm

Hi,

This is a script node for Octane Standalone implementing a generic "Switch" functionality.
switch.lua
(13.25 KiB) Downloaded 539 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.
manalokos
Licensed Customer
Posts: 439
Joined: Fri Nov 18, 2011 4:43 pm

Great!! Thank you!

Kind regards
Filipe
andw
Licensed Customer
Posts: 46
Joined: Wed Aug 22, 2012 5:42 am

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 <
User avatar
whersmy
Licensed Customer
Posts: 723
Joined: Thu Aug 30, 2012 7:40 am

Sweet! :D
Octane 2022.1.1 nv535.98

x201t - gtx580 - egpu ec
Dell G5 - 16GB - dgpu GTX1060 - TB3 egpu @ 1060 / RTX 4090

Octane Render experiments - ♩ ♪ ♫ ♬
User avatar
jobigoud
OctaneRender Team
Posts: 243
Joined: Sat Aug 15, 2015 1:28 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.
andw
Licensed Customer
Posts: 46
Joined: Wed Aug 22, 2012 5:42 am

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 <
User avatar
Delizade
Licensed Customer
Posts: 180
Joined: Thu Oct 18, 2018 10:38 pm
Location: Istanbul

Hello,
How can I use this script in C4D Octane node editor?
User avatar
bepeg4d
Octane Guru
Posts: 10298
Joined: Wed Jun 02, 2010 6:02 am
Location: Italy
Contact:

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
Post Reply

Return to “Lua Scripting”