[Closed] More Newbie Questions
Say you have an object with a slider attribute attached to it with a range of 0 to 100. Say you wire another object’s… X_Rotation to that slider.
When you move the slider, the other object spins on it’s X-axis. That’s cool.
But what if you only want to effect the second objects rotation if the slider is over 50?
Between 51-100, the slider spins the other object. Between 1 and 50, it doesn’t effect the wired object at all.
I know you have to changethe wire expression. Unfortunately, I have no idea how to apply an “If” statement to the expression dialogue. Every time I try it, I get intimidating amounts of error messages, and then Max crashes.
The documentation on this is extremely sparse. How do you apply functions to a wire expression? I am very confused.
Firstly, it would make life a lot eaiser if you post what code you had been trying – does help some times to pick up logic problems…
Secondly, it’s not all that hard, but can be a little tricky…The idea here is you want to return 1 of 2 values. Either you want to return the 2nd objects x_rotation OR the spinners value.
-- Get the objects current x rotation...
result = $box02.rotation.x
-- Check the state of the spinner...
if Param1 >= 50 and Param1 <= 100 do result = Param1
-- Expressions return the last value evaluated...technically, not required for this example here, but
-- any one else reading the code will know what is been returned.
result
- We get the state of the objects rotation.
- We check the state of the spinner value.
- We return the result.
This also could have been written:
if Param1 >= 50 and Param1 <= 100 then result = Param1
else result = $box02.rotation.x
This is more optimised version and in theory should run faster…
Hope it helps
Shane
RustedKnight -> Have I mentioned you’re awesome? You’re awesome. Thank you very much.
My question wasn’t refering to a specific piece of code I was writing, it was simply a general question. I have been mentally making an object in my head. It’s a telescoping rod, similar to a police baton.
I want to control the telescoping with a single spinner. This is fairly simple, but as the pole telescopes out, there are blades along the edge of the baton that extend. The blades should only protrude once the baton has fully extended. I needed a way to place… constraints on the actions of a wired parameter.
Now I can. Thank you very much.
I have yet another question, and this one is highly specific and unfortunately theoretical.
I am planning on creating a face rig for a series of models. It will run off boxes constrained to string objects. The boxes position on the string will be controlled by sliders, and the boxes movement will be skinned to the face.
Now building the basic rig is simply a matter of finding the time, but I (of course) want to do more. I want to add a set of expression controls to the face. This would be relatively easy if I wanted a set of expressions that can be controlled by sliders. I intend on doing this through setting up multiple position controllers on the boxes, and then using sliders to control the weights.
This is fairly simple, but the complex part comes in when I want to be able to add NEW sliders dynamically. I’m fairly sure I can figure out how to store the data (in a structured array), but I can’t figure out how to add a slider (or, in fact, ANY kind of variable) based on user-created data. Basically I want to be able to do something like what the Parameter Editor does. Unfortunately, the actions of the parameter editor aren’t echoed to the MaxScript listener, and I can’t find the code for it in my Max directory.
For example, if a user typed “VariableX” into an editbox, and pressed a button, I want to be able to add a spinner named VariableX to a rollout. Does anyone know have any idea how to do something like this?
Simple answer: Yes it can be done and no it’s not ALL that difficult. In essence, you have to “redeclear” the custom attribute.
Unfourtantly, I’m stuck on another problem right now and don’t have much time to go into it.
Paul Neale (PEN) has a great example on his Rigging DVD series from CGAcadamy. If you can afford it, I would most highly recommend you get a copy! It will answer you question and lots more!
Also check out http://paulneale.com/tutorials.htm , it has some good articles.
Sorry for the lack of help at this time, if I can, I will look at it later when I have more time.
Shane
Thanks rustyknight.
I actually went back through the help files with a fine toothed comb and I found the method in one of the excellent HowTo tutorials created by Bobo.
For the anonymous readers out there, if you’re interested in learning how to do something like this check out the “How To … Enhance the Morpher Modifier With Floating Controls” tutorial. It uses the ‘execute’ command, but it does precisely what I wanted.
Aaaaaand I’m back, like a bad old penny.
Here’s my problem. I’m trying to create hand control rig attached to a modifier. I want to have the rigging controls imbedded in the rollout, but I’m having trouble writing the wiring parameter.
It’s easy for simple transforms. Wiring two X_Rotation values together looks like this:
paramWire.connect $[3][2][1] target[3][2][1] "X_Rotation"
The problem I’m having here is how do you rig to a custom attribute contained in a Modifier?
Technically, it should be something like:
paramWire.connect $[4][#Hand_Controls][#NameOfParameter] target[3][2][1] "NameOfParameter"
…But it’s not working. I keep getting this error:
“>> MAXScript Rollout Handler Exception: – No ““get”” function for undefined <<”
It’s kinda driving me nuts. I know I have the syntax wrong somewhere, but I’ve been smashing my head against this for a few hours and I just can’t figure it out. Anyone know how to do this?
It’s driving me kinda crazy.
Okay, I’m a little confused…I think I know what you’re trying to do, but I’m not sure, SOO, I’m going to tell you what I did and you can tell me if on track or not.
Basically, I created two boxes. I add an attribute holder modifer to each and I added a custom attribute to each (I cheated and used the Parameter Editor).
I then wired box2 to box1 as such…
paramWire.connect $.modifiers[#Attribute_Holder].Custom_Attributes[#Param1] $Box01.modifiers[#Attribute_Holder].Custom_Attributes[#Param2] "Param1"
This seems odd to me, because I’m basically connecting one control to another, which makes the slave control useless, you can only change it’s value via the master control…but that’s me…
Now to be fair. The modifer’s are called “Attribute Holder”, the attribute controls are contained in a rollout called “Custom Attributes” and their values are called “Param”
I hope that’s what you mean.
You might also want to do some reading on subAnims “Indexed Access to Animateable Properties in 3ds Max Objects”…that will explain why I’ve used “#” instead of indexes…
Thank you again RustyKnight. I managed to figure it out. I was very tired when I was working on that one, and I ended up sort of thinking in circles.
I have (yet another) question. I’m creating my own bone objects to use in a rig, as I am finding the current bone objects very limiting. I’m making them just generic boxes to start off with, and I’m trying to basically make a mesh from code.
That’s pretty easy actually, but I can’t figure out how to make quads in an editable mesh. I know it’s possible, the create polygon tool is right there the rollout, but I can’t figure out how they did it. All the editable mesh methods refer to only a single triangle plane.
Any help here would be exceptionally awesome.
Now you’re wondering into territory I have little experience in, but I would suggest that you look at “Editable Poly” instead.
Ah, too bad.
Unfortunately, while the tutorial in the reference document has been useful, it deals strictly with a 2D object that is composed of traingles. I want to create a 3D object that is composed of quads. This… probably isn’t that hard, I just can’t find the syntax anywhere.
Does anyone know where the code for the box primitive is? If I could look at that, I could figure it out for myself. Again, irritatingly, I can’t find that code anywhere. Does anyone have any idea where that might be (or if it’s even in a viewable location inside the program)?
I know this is stupid – but – a quad is simply two triangles, could you not write a method that took 4 points and created two triangles??
Shane
Correction, a quad is two triangles that LACKS an edge bissecting them.
That was my problem.
I did figure out how to do it. It was surprisingly easy (as most things are in maxscript) once I figured it out.
Thanks again.
Techniqually yes and techniqually no – but this is not the place to go into that argument
That was my problem.
I did figure out how to do it. It was surprisingly easy (as most things are in maxscript) once I figured it out.
Thanks again.
Well, don’t keep it to yourself, do tell