0
votes

I'm a newbie in maxscript and newbie in programming at all.

But I'm trying to find out is there a way to wire: 1) custom Variables and object parameters in real time 2) Structure properties and object parameters 3) "Two ways" connectivity between an amount of objects and custom Variables.

As far as I know, I'm able only to connect objects.pos objects.transform and so on. with Script controller. Or to wire two parameters which I could get in a scene.

But I'm trying to change my custom variables on the fly. In order to use structs with its properties.

1

1 Answers

0
votes

Using script controller, you can get (and in some cases set) anything that's accessible from global scope. That said, there's a reason nobody does that - those variables and struct instances have to exist before the scripted controller first fires, which usually means right after opening the scene, merging an object using that controller etc. You can work around the first case by making the variables persistent. This works well enough when they hold a reference to some of the objects available by default but will fail with custom struct unless you make sure their definitions are evaluated beforehands - so now you have one more file to distribute with the .max file together with the instructions on where to put it.

Instead, use custom attributes. They make it easy to store almost anything, from ints, floats, colors, maps, materials to objects and referenceTargets. You can also use locals (limited to the current session lifetime), functions and structs inside them (struct instances' lifetime is once again limited to current session only).

What to attach them to and how to access them depends on the task at hand, there's no universal solution. If you have a particular scenario in mind, make that a new question and try to be as specific as possible.