OpenMaya command that checks if attribute has animation?

14 views
Skip to first unread message

kiteh

unread,
Dec 3, 2019, 8:12:58 PM12/3/19
to Python Programming for Autodesk Maya
Hi all, I need some help with getting animation curves using OpenMaya.

I have 3 cases in which nodes in scene will be generated:
  • Manual keyed
  • By constrains
  • Use of anim layers
In my code, I was able to get the first scenario working. And so I thought it will work for the other 2 but turns out it is not.
Here is my code: https://pastebin.com/raw/YKupFfsW and I have attached a scene file for use.

In the code, if you un-comment `scenario1` and comment `scenario2`, I will get the following error:
# Error: (kInvalidParameter): Object is incompatible with this method
# Traceback (most recent call last):
#   File "<maya console>", line 66, in <module>
#   File "<maya console>", line 27, in rotation_check
# RuntimeError: (kInvalidParameter): Object is incompatible with this method # 

Whereas if you comment out `scenario1` and uncomment `scenario2`, a different error will be spawn if the specified node inputted is either ["test_animLayer"] or ["test_constrained"]:
# Error: (kFailure): Object does not exist
# Traceback (most recent call last):
#   File "<maya console>", line 61, in <module>
#   File "<maya console>", line 42, in rotation_check
# RuntimeError: (kFailure): Object does not exist # 


1. My question here would be, why does the error between scenario differs (so much) at different line? I would have expected them to error out at line 27 in scenario 1, since "test_animLayer" and "test_constrained" are in the seelction...

2. Given in the above cases, is there an OpenMaya command that I can use to effectively determine either of the cases has an animation curve?


rotational_test.ma
Reply all
Reply to author
Forward
0 new messages