Distance Constraint

49 views
Skip to first unread message

Rémi Deletrain

unread,
May 20, 2019, 3:18:38 AM5/20/19
to Python Programming for Autodesk Maya
Hi everyone,

I try to create a distanceConstraint node. For this moment I used MPxNode.
The node works fine but I have problem when I reload my node... I d'ont know how I store output and reload it...
Anyone have solution ? MPxConstraint node make this ?

DistanceConstraint.gif


Michael Boon

unread,
May 23, 2019, 10:56:22 PM5/23/19
to Python Programming for Autodesk Maya
What do you mean by "output" - what data are you having trouble storing?
Things like the "Source" and "Distance" in your screenshot, I think Maya will store automatically, assuming you are using attributes (eg MFnNumericAttribute.create) for them.
I have never created a constraint node though.

Rémi Deletrain

unread,
May 24, 2019, 3:23:25 AM5/24/19
to Python Programming for Autodesk Maya
Hi Michael,

Normaly picture is a GIF. I think Google get just first frame au GIF...

I try to store output value "outTranslate" for use it when i load my scene.
I set "outTranslate" attribute to storable and in line 116 of my script I get attribute value for initialize one variable. I not sure this solution is really good beacause cause an error in first compute.
# RuntimeError: maximum recursion depth exceeded in cmp //


distanceConstraint.ma
distanceConstraint.py

Cedric Bazillou

unread,
May 24, 2019, 4:37:03 PM5/24/19
to Python Programming for Autodesk Maya
you should not read an output attribute that you write somewhere else in the same node( at least most of time, once you get more experience with attributeAffects internal attributes etc you can have some fun)
Are you not missing a second matrix attribute to do the distance clamping? ( it will solve   self._mv_last_anchor , self._mv_point design issue)

Rémi Deletrain

unread,
May 27, 2019, 3:38:26 AM5/27/19
to Python Programming for Autodesk Maya
Hi Cedric,

Yes I know that you should not read an output attribute in a copute.
For this moment I don't found solution and it's for show the desired result.

A second matrix ? For write the last position of constrained node ?
Reply all
Reply to author
Forward
0 new messages