re-enabling parent constraints after baking

SimpsonJonR
Explorer
Explorer

re-enabling parent constraints after baking

SimpsonJonR
Explorer
Explorer

I have an engine model rigged with FK and parent constraints which needs to be rendered via Backburner across multiple PC's.  The only way to get the internal components to render without shaking/jittering/popping into position (the render nodes handling different frame ranges) is to bake the position/rotation of the geometries, which works fine.  I need to go back and render an earlier frame range, prior to the range where I baked the geometry....and now all the parent constraints seem to be broken, even after deleting the geometry's baked keyframes.  The bones and locators all animating as the should, but the geometries are no longer influenced by them....I see nothing obvious in any of the parent constraint attributes/channels...what am I missing?  Thanks in advance!

0 Likes
Reply
556 Views
2 Replies
Replies (2)

hamsterHamster
Advisor
Advisor

This will work with some constraints, however it is very limited, as I am not too familiar with MEL syntax.

Limitations are:

- works for a single object;

- restores xyz connections, partial, like xz not supported;

- works on either animCurves (e.g. bakes), which it will disconnect, or free inputs, if constraint available.

 

sel = maya.mel.eval('ls -sl')
query = list(maya.mel.eval('connectionInfo -dfs '+ sel[0] +'.pim'))
for q in query:
    c = q[:q.find(".")]
    c_list = ("parent", "point", "orient", "aim", "scale", "poleVector")  # supported constraint types
    for ct in c_list:
        if c.find(ct)>=0:
            if ct == "parent" or ct == "point":
                for i in "xyz":
                    act = maya.mel.eval('connectionInfo -id '+ sel[0] +'.t'+ i)
                    if (act != False):
                        maya.mel.eval('disconnectAttr '+ sel[0] +'_translate'+ i.upper() +'.o '+ sel[0] +'.t'+ i) 
                        maya.mel.eval('connectAttr '+ c +'.ct'+ i +' '+ sel[0] +'.t'+ i)
            if ct == "parent" or ct == "orient" or ct=="aim":
                for i in "xyz":
                    act = maya.mel.eval('connectionInfo -id '+ sel[0] +'.r'+ i)
                    if (act != False):
                        maya.mel.eval('disconnectAttr '+ sel[0] +'_rotate'+ i.upper() +'.o '+ sel[0] +'.r'+ i)
                        maya.mel.eval('connectAttr '+ c +'.cr'+ i +' '+ sel[0] +'.r'+ i)
            if ct == "scale":
                for i in "xyz":
                    act = maya.mel.eval('connectionInfo -id '+ sel[0] +'.s'+ i)
                    if (act != False):
                        maya.mel.eval('disconnectAttr '+ sel[0] +'_scale'+ i.upper() +'.o '+ sel[0] +'.s'+ i) 
                        maya.mel.eval('connectAttr '+ c +'.cs'+ i +' '+ sel[0] +'.s' + i)
            if ct == "poleVector":
                for i in "xyz":
                    act = maya.mel.eval('connectionInfo -id '+ sel[0] +'.pv'+ i)
                    if (act != False):
                        maya.mel.eval('disconnectAttr '+ sel[0] +'_poleVector'+ i.upper() +'.o '+ sel[0] +'.pv'+ i) 
                    maya.mel.eval('connectAttr '+ c +'.ct.ct'+ i +' '+ sel[0] +'.pv' + i)

 

 Raw, untested... Use at your own risk. Drag to your Shelf as Python button.


,,,_°(O__O)°_,,,
Maya2019.1 @ Windows10 & GeForce GTX1080Ti

If the post was helpful, click the
 ACCEPT SOLUTION  button, so others might find it much more easily.

0 Likes

hamsterHamster
Advisor
Advisor

Added this feature to the Maya Ideas subforum. You are welcome to vote.

https://forums.autodesk.com/t5/maya-ideas/reconnect-baked-constraints/idi-p/10147259


,,,_°(O__O)°_,,,
Maya2019.1 @ Windows10 & GeForce GTX1080Ti

If the post was helpful, click the
 ACCEPT SOLUTION  button, so others might find it much more easily.