Default Value for Mux

Discussion of Genome, the extensible geometry modifier for 3ds Max
Posts: 21
Joined: Sat Feb 08, 2014 1:31 pm

Default Value for Mux

Postby pfunkifized » Thu Jan 04, 2018 5:29 pm

I had to recently reassign a bunch of face mat ID's and I thought Mux would be nice to use instead of creating a bunch of IsEqual conditions. The ID's are not in order from 1-20 so I needed to make 200 inputs in order to expose all the matID's I needed ( yes this is a messed up range but XMesh and TP sometimes does this for us ). What's frustrating is that in order for Mux to work at all, every input needs to be connected which would be a huge pain to set up. Could we have a Default value on the node or some way to ignore inputs that aren't connected?

User avatar
Posts: 6144
Joined: Tue Nov 15, 2005 10:26 am
Location: Vancouver, Canada

Re: Default Value for Mux

Postby Bobo » Thu Jan 04, 2018 6:43 pm

Makes sense, I have logged a Wish against it.

In the meantime, you could use a MAXScript FOR loop to connect all sockets to a default value of 1 or something like that.

Let's say that you have a Genome (or Krakatoa Magma) modifier on top of an object's modifier stack.
You can get to the modifier by selecting the object in the scene and saying

Code: Select all

theMod = $.modifiers[1] --get the top modifier, or use the #name of the modifier instead

Then you can grab the MagmaHolder of that modifier:

Code: Select all

magmaNode= theMod.MagmaHolder

Now you have access to all nodes and their properties inside that modifier. But you can also create new ones, and connect them as needed. For example,

Code: Select all

--create the Input Integer with value of 1
theInput = magmaNode.createNode "InputValue"
magmaNode.setNumNodeInputs theInput 0
magmaNode.setNumNodeOutputs theInput 1
magmaNode.setNodeProperty theInput "forceInteger" true
ctrl=bezier_float(); ctrl.value = 1
magmaNode.setNodeProperty theInput "controller" ctrl
--create the Mux operator and connect the input to all 200 sockets
theMux = magmaNode.createNode "Mux"
magmaNode.setNumNodeInputs theMux 201 --set to 200+1 sockets
for i = 0 to 199 do magmaNode.setNodeInput theMux i theInput 1 --connect the first 200

That, or you could select the two nodes side by side, and hit SPACEBAR 200 times to connect the Input Value to each unconnected input socket of the Mux. Or hold SPACEBAR pressed for about a minute...

Not sure which approach would be faster :mrgreen:
Borislav "Bobo" Petrov
Product Specialist
Thinkbox Software Inc.

Posts: 21
Joined: Sat Feb 08, 2014 1:31 pm

Re: Default Value for Mux

Postby pfunkifized » Thu Jan 04, 2018 8:37 pm

Awesome, thanks Bobo!

Return to “Thinkbox Software - Genome”

Who is online

Users browsing this forum: No registered users and 1 guest