Accessing attribute holder in wire parameter expressions


#1

Hi,

I’m very new to wire parameters but comfortable with Maxscript. I’m having difficulty finding proper documentation on expressions and searching hasn’t yielded the hints that I need.

Backstory:
I’ve created a basic rig to animate an aircraft using dummy helpers that I’ll eventually adapt to actual aircraft models. The central helper has an attribute holder and I’d like to animate the flight control surfaces by connecting those values through wire parameters.

As a test, dividing by 200 (arbitrary amount) limits the rotation of that looks good for this proxy model. I’d like to use the max_aileron attribute to be my scale (and repeat for the remaining min/max surfaces) so I can avoid hard coding these numbers in. I omitted degtorad(***) for sake of simplicity at this time.

Question:

What is the syntax to use another attribute in my expression? This should be simple I imagine, however I am having one heck of a time finding my solution.

aileron/max_aileron returns undefined.

Thoughts? Thanks for the help. :slight_smile:


#2

Yes, in fact it is simple: you can’t do that in wire parameters.

For such things you need to use either expression or script controllers. If you can get away with expression controllers, use that, as they are much faster than script ones.


#3

Yep wire parameters are deceptively over simplified. I used to like using them but theyre very limited and also very tricky to debug further down the line.

I do pretty much everything these days via a combination of list controllers and expressions. Expressions can initially seem a little daunting, but once you get used to them they are incredibly poweful.


#4

Fantastic, thanks guys. I came across expression controllers last night and had a suspicion that was the route. Back to the books I go. :slight_smile:

Cheers.


#5

In the Parameter Wiring Dialog:
Expression for hlp_ail_L’s X_Rotation:

aileron / ($dummy_airplane_attributes[4][1].custAttributes[1].maxAileron)

Obviously there are more flexible ways to do it, but I just wanted to show it’s not impossible to do with wires.


#6

Wow, this is certainly new. Didn’t know you could mix in maxscript like syntax in wires. Thanks!

Though I’ve noticed it only properly updates when the primary attribute (aileron, in this case) is changed, either through being animated or adjusted by hand. That is, if you change value of maxAileron, you either have to go change aileron too, or drag the time slider to see the change (which will only work if aileron is animated). It’s a possible annoyance.

Still, this is kind of cool.


#7

Oh, you want it to update too? :stuck_out_tongue:

The weak referencing of the Script and Expression controllers or just using RefTargMonitor or NodeTransformMonitor is the only way I can think of to get updating, neither of which I could get to work in a Wire Controller. It might be possible but I can’t figure it out. But other than that you can do all kinds of things in the wire expression field like defining and executing functions, or executing functions stored in CA’s on another node, etc. It makes wires a little more flexible, but not as flexible as Expression or Script Controllers as far as I can tell.


#8

Hey, I’ve found a rather quick workaround solution to the updating problem just now. The trick is to set the primary param to itself in a wire in the secondary param.

Say you have a $Box001, whose position.x should be param1*param2 (in custom attributes).

  1. Wire param1 --> position.x with:
Param1*$Box001.modifiers[#attribute_holder].custom_attributes.param2
  1. Wire param2 --> (some track you won’t use, in this case i wired to the same box’s width segs.) with:
$Box001.modifiers[#attribute_holder].custom_attributes.param1 += 0
1 --just to return a value for the width segments in this case

Or you could put the param2 bezier_float track into a float list and wire it to its own weight in the list (returning a 1.0 value at the end, obviously), to keep it all in one place.
It looks dirty, but it works. If anyone knows of an elegant solution, please tell.


#9

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.