[Closed] 3dsmax expressions/scripting
Hi all, I’m fairly new to expressions in 3ds max and scripting… What I would like to know is, how/what do I need to set up to get the following: I’m really wanting to find out what are the best ways to write expressions.(I’m coming from an after effects background)… I’m seeing that some things aren’t easily achievable. For instance, If I wanted to set up a clamp expression in AE, all I would type is clamp(value, param1,param2). Ex. 2 linear(value,0,100,78,90). The expression in ex. 2 allows one to map 78 – 90 over 0-100. Really useful when hooking things up to sliders. I’m aware of how to access the script/wire parameters boxes. I simply don’t know how to transfer this knowledge over to 3ds max, or what functions I’m looking for. Equally is there a possibility of a function or expression in 3DS that would allow me to MIX between values, for instance… If I wanted to rotate objects but have their rotation blended/Mixed according to another objects Orientation. In context If I’d set up three spheres and I wanted each one to rotate half as much as the one next to it or any percentage. followed by clamping the amount that each sphere could rotate. What am I looking for in this case. Scripting or can/should this be handled by an expression?
Really, I am looking forward to getting some insight on the matter…
Thanks all!
I think a lot of it is about learning which tool is best for which job. After Effects is a little more limited in that respect – which isn’t an insult at all, personally I love AE. But for what you describe, there are several ways to do each one, including without any scripting at all. The one with the spheres rotating, for example, is more of a rigging question than a scripting one – though you could define/set the rig and limits using scripting (in the same way you can do more or less anything in scripting, though it’s not always the fastest or most effective way). I think the main difference is that in AE, expressions are a) the only solution to a lot of problems and b) offer greater functionality. Max Scripts do, by and large, only allow you to automate what you could already do in the UI anyway. Now, of course, this automation can mean all the difference between a workflow being effective or not being effective, and chaining these automations with a convenient UI can mean the development of some very powerful tools. But the key to finding a solution in Max is usually to work out the best way to do it in Max, and then work out the best way of actually implementing it. Sometimes it’ll be scripting, sometimes it won’t.
Edit: To clarify, what I mean is that rather than saying “we need to make these spheres rotate less than one another with limits – how do we script that?” One should ask “We need to make these spheres rotate less than one another with limits – what’s the best way to achieve that result? Rigging? Wire parameters? A whacky system of dummys, levers and pullys? Ok. Now, what’s the best way of implementing that?”
to do a clamp inside an expression you want to make use of the min and max functionality. Inside the expression controller you can click the function list button and it will show you what functions are available inside the expression controller system.