Any way to query keyframe -tickDrawSpecial?

Any way to query keyframe -tickDrawSpecial?

Anonymous
Not applicable
914 Views
3 Replies
Message 1 of 4

Any way to query keyframe -tickDrawSpecial?

Anonymous
Not applicable

Hey all

 

This is a real head scratcher, is there any way to query the state of "keyframe -tickDrawSpecial" I've tried just -q but I dont get the results I expect at all.

 

thanks

0 Likes
915 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

The “-tickDrawSpecial” flag is NOT queryable. It will work only in create/edit mode. Please check the following link for confirmation.

http://help.autodesk.com/cloudhelp/2015/ENU/Maya-Tech-Docs/Commands/keyframe.html

 

So, If you want to set the “-tickDrawSpecial” falg. You can do the following.

To set: keyframe  -e –tickDrawSpecial 1; // no-op if it is already set

To unset: keyframe  -e –tickDrawSpecial 0;//no-op if it is already unset

0 Likes
Message 3 of 4

Anonymous
Not applicable

Thanks, I thought not, thats a bit strange.

 

I was just using a workflow for the following

 

I have a lot of dense basked mocap data on a character set

 

I go through and mark key poses on keyframes in the animation using my own script to set the -tickdrawspecial on my chosen poses

 

I wanted to then have a script that would go through and delete all keys except those with tickdrawspecial enabled, I guess this is impossible, I don't suppose you could suggest an alterante soltuion? (I could just make a list of frames as I go I guess)

 

I'm not as clever as you guys 🙂

 

thanks so much for your help.

0 Likes
Message 4 of 4

sibleon
Participant
Participant

Very old topic, but still ranks high in search.

 

I recently came across a method for querying the tickDrawSpecial state of keys. The gist of it is, that every animation curve has an attribute with the state of each key by index.

 

Given an object, you can iterate all animation curves at the current time like this, and see if ANY curve has the tick draw special attribute set to true.

import maya.cmds as cmds

for obj in cmds.ls(sl=True):
    foundspecial = False
    animcurves = cmds.listConnections(obj, type='animCurve')
    time = cmds.currentTime(q=True)
    
    if animcurves is not None:
        for animCurve in animcurves:
            if foundspecial:
                break
                
            indices = cmds.keyframe(animCurve, q=True, time=[(time, time)], indexValue=True)
            
            if indices is not None:
                for index in indices:
                    if cmds.getAttr('%s.keyTickDrawSpecial[%d]' % (animCurve, index)):
                        foundspecial = True
                        break
    
    if foundspecial:
        print('Found special tick at frame %.1f for %s' % (time, obj))
    else:
        print('Did not find special tick at frame %.1f for "%s"' % (time, obj))