Getting blendParent name upon constraint and keyframes checking



I am trying to script some animation-related tool and I am encountering into some issues in which I think there may be a better way to process them as I am pretty much hard-coding them into my current too/ doing it in a roundabout manner.

  1. What is the best way that I can script such that if an object that has static keyframes (keyframed at different frames, but the values remains the same ) and removing all keyframes (akin to break connections)?

Currently what I have done is: Select the objects > iterating all the attributes and its values (eg. {"object01" : {"translateX": 3, "translateY":10}, ..} ) and storing them into a nested dicts >
then comparing the values between keys… It somewhat worked in my cause but it does not seems to be ideal?

Looking for a better way to handle this…

  1. When doing a parentConstraint, the attribute - blendParent is always created. However is there a command that allows me to grab the blendParent name as soon as the constraint is done?

In my current code, I am hardcoding it to find blendParent1 but there are times where blendParent3 is created instead in some of the objects in which I have hard-coded them as well…

Any ideas for this?

Many thanks in advance for any replies!


For the first one, the delete command has a staticChannels flag that will delete any static keyframes.

For the second one, you’d probably just have to do a listAttr find all of the attributes that start with blendParent and then behave accordingly.
If you’re looking for the newest blendParent then you might be able to assume that it will be the one with the highest number, but I’ve got a feeling Maya will mess with you at some point based on that assumption.
You might need to capture all the blendParent attributes before and after, and compare.


Thanks, will check out the delete command for the static channels.

But for my point 2, say in the event, if getting the name of the blendParent is too complex… Is it possible to query for the constrained channels based on selections?


You can use listConnections on the constraint, and do some comparisons based on selected objects.