Accessing attribute holder in wire parameter expressions

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  02 February 2014
Accessing attribute holder values in wire parameter expressions

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.
__________________
http://www.cgwings.com
3D Aviation Art

Last edited by Tylerb59 : 02 February 2014 at 05:09 AM.
 
  02 February 2014
Originally Posted by Tylerb59: 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.
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.
 
  02 February 2014
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.
__________________
Matt Rennie
Sr. Character Rigger
Rockstar North
 
  02 February 2014
Fantastic, thanks guys. I came across expression controllers last night and had a suspicion that was the route. Back to the books I go.

Cheers.
__________________
http://www.cgwings.com
3D Aviation Art
 
  02 February 2014
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.
 
  02 February 2014
Originally Posted by Pacermike: 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.

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.
 
  02 February 2014
Oh, you want it to update too?

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.
 
  02 February 2014
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

2. 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.

Last edited by Zhalktis : 02 February 2014 at 10:02 AM.
 
  02 February 2014
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 12:44 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.