PDA

View Full Version : MEL driven translations: best practice?


robitabu
11-11-2011, 07:04 PM
I'm asking for hints.

Scenario: I have a few MEL vector type variables and a few shape nodes whose translation nodes values have to be driven by those vectors' values (which change because of some calculations I do in MEL). I.e. the vectors change and their values drive the shapes' positions.

I'm not doing animation here, so I don't have a scene update and will not use Driven Keys or Expression (if avoidable).

I'm asking for suggestions, any hint on a usable approach?

NaughtyNathan
11-11-2011, 09:06 PM
are these vectors just variables? then how do they change/update? if you manually trigger an update of these variables, why can't you then also update the shape positions at the same time?
if the vectors are node attributes you can just connectAttr them together.
and you've already said it's not an animation so you can't use an expression..?

I can't see how your situation is something other than one of these three things? Could you elaborate further?

:nathaN

robitabu
11-11-2011, 09:42 PM
are these vectors just variables? then how do they change/update? if you manually trigger an update of these variables, why can't you then also update the shape positions at the same time?

Well Nathan, my situation is mostly the first one you described. Vector variables, a few MEL lines calculate new values of those variables, finally the transform nodes have to change accordingly and the geometry will assume new position in space.

Yes, I could manually feed the newly calculated values to the shapes' transform nodes with xform -translation ... But it feels to me like being messy ... I'll try to explain, the scene may vary, nodes will change (it's not a single specific scene I'll be dealing with) in number and nodes' naming ...

if the vectors are node attributes you can just connectAttr them together.
... maybe it would be cleaner if I make use of an intermediate node, which has vector attributes (as many as I need), whose values get updated with the new vectors' values (that could be easily generalized in MEL) and than a connectAttr could propagate the changes to the transform nodes in the scene. That would help hiding the scene geometry to the MEL script and separate the MEL logics from the scene complexity.
I will still be manually updating the intermediate node of course. That's already something I can start investigating :-)

You see, I'm trying to make MEL take care of a few logic problems, and reflect the results only to the scene nodes in the most elegant (and possibly manageable) way.

and you've already said it's not an animation so you can't use an expression...
And I don't even WANT to.

CGTalk Moderation
11-11-2011, 09:42 PM
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.