Hello
Static Channels are related to when you set a single keyframe on an object
when you want to delete it you can do it with the menu you want.but if you want to detect a static channel on an animation curve of an object you can use this code:
from maya import cmds
sels = cmds.ls(sl=True)
keyCount = 0
for each in sels:
attrs = cmds.listAttr(each, k=True)
for at in attrs:
keyCount = cmds.keyframe((each + '.' + at), q=True, kc=True)
if keyCount == 1:
tempValue = cmds.getAttr(each + '.' + at)
cmds.cutKey((each + '.' + at), cl=True)
cmds.setAttr((each + '.' + at), tempValue)
main snippet is this keyCount = cmds.keyframe('object.attr', q=True, kc=True)
that return count of your keyframes on an object.
good luck
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/f8ad0153-0b12-4878-a117-7d8ab95be25a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/5530DCE7.7010001%40gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CADvbQw%2BAi%3DdpEy5M6pnUGyHFtET%3DtsZiryZG43F1Q0f16Wz8GA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/5530E6C0.7050704%40gmail.com.
Test this on single and multiple static channels. it work on camera and its shape’s keys of attributes:
from maya import cmds
def detect_static_channel():
sels = cmds.ls(sl=True)
objs = []
for each in sels:
obj_shape = cmds.ls(shapes=True)[0]
objs.append(each)
objs.append(obj_shape)
for o in objs:
attrs = cmds.listAttr(o, k=True)
for at in attrs:
key_count = cmds.keyframe((o + '.' + at), q=True, kc=True)
if key_count >= 1:
values = cmds.keyframe((o + '.' + at), q=True, vc=True)
value = cmds.keyframe((o + '.' + at), q=True, vc=True)[0]
if all(item == value for item in values) == True:
temp_value = cmds.getAttr(o + '.' + at)
cmds.cutKey((o + '.' + at), cl=True)
cmds.setAttr((o + '.' + at), temp_value)
detect_static_channel()
Good luck
:)
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CADvbQwJ3--EoP4atUFVi8ysqDUCk4PsGtmQ%3DX%2BcRTOOgS6WK%3DQ%40mail.gmail.com.
I get what you’re after, and I don’t have an answer for you, but this..
playback can be slow in lighting scenes
..can be solved by either isolating the item or disabling viewport refresh before playing.
In case of heavy constraints, it’ll still be slow, but in those cases there might not be any other way around it anyway. Playing it through might even be the safest thing to do if you are actually looking to also detect motion coming in from constraints, scriptJobs and direct connections in addition to keys.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/5530F948.6000301%40gmail.com.
I get what you’re after, and I don’t have an answer for you, but this..
playback can be slow in lighting scenes
..can be solved by either isolating the item or disabling viewport refresh before playing.
In case of heavy constraints, it’ll still be slow, but in those cases there might not be any other way around it anyway. Playing it through might even be the safest thing to do if you are actually looking to also detect motion coming in from constraints, scriptJobs and direct connections in addition to keys.