Here's a quick Pro-Tip for users who want to use wire parameters to connect layer attributes in 3D Max. If you found this page, it is probably because your frustrated that this isn't easy by default. Let me at least show you a clever work around. I'll keep this short.
I had to make a fireplace configurator and control all the configurations with layers and a control node. Here's how I did it.
To breeze through this process, I am assuming you already have objects your already working with and you basically know max quite well. If you don't have objects, just make some real quick like I did to grasp the gist of what is possible.
Step 1: Organize your objects into layers in which you would like a controller to control the visibility of. I made spheres, teapots, cylinders, and rings.
Step 2: Create a controller node. Point object is fine, i called mine CTRL
Step 3: Go to Animation/Parameter Editor... to open the attribute maker tool.
Step 4: Add an Array Attribute Drop Down List, just call it isVisible. Then add an item for each layer.
Step 5: Select the CTRL, Add this custom attribute to it.
Step 6: Add a second float parameter to the CTRL that will be used as a script holder. We will just call it isVisibleScript. This is required.
If you try to link this parameter to another object instead of to itself, it will not fire the calls properly. This will result in no errors, but nothing will happen as far as seeing updates in the scene, here in lies the annoyance ... and the desire for me to figure out this work around. Note that you won't ever need to touch the isVisibleScript parameter.
Step 7: Open the Wire Parameter Dialogue. Since you can't directly wire anything to layers, you instead wire this object to itself, with isVisibleScript parameter. Weird right? It'll make sense in the next few bits.
Step 8: Load CTRL on the left AND the right. Do a one-way connection from isVisible to isVisibleScript and press Connect.
Step 9: Here's the trick... we use maxscript to add code in between the call to this essentially useless value, keeping the isVisible code as the last bit. See code in image below.
laycyl = layermanager.getLayerFromName "cyl"
laysph = layermanager.getLayerFromName "sph"
laytea = layermanager.getLayerFromName "tea"
laytou = layermanager.getLayerFromName "tou"
if isVisible == 1 then (
laycyl.on = 1
laysph.on = 0
laytea.on = 0
laytou.on = 0
) else if isVisible == 2 then (
laycyl.on = 0
laysph.on = 1
laytea.on = 0
laytou.on = 0
) else if isVisible == 3 then (
laycyl.on = 0
laysph.on = 0
laytea.on = 1
laytou.on = 0
) else if isVisible == 4 then (
laycyl.on = 0
laysph.on = 0
laytea.on = 0
laytou.on = 1
)
isVisible
If you are still reading, you can probably see there are a ton of ways to utilize this. The drop down layer visibility toggle menu idea was very helpful for my fireplace scene, so that's what this simple example scene mimics. For me it hid multiple phoenix nodes automatically so they don't calculate ... which is the only way i could get to work since phoenix nodes don't have visibility and aren't wire parameter-able.
Here's the simple scene to examine and learn from.
File: scriptedLayersExample_max2021.zip
That's all. Happy coding.
No Comments.