Fear not for I found a workaround.

I made a clip of the entire timeline and then duplicated it and resetting 
the start & end points for each clip

char = cmds.character(name='char_')
fullMin, fullMax = setAndReturnMinMax()
fullClip = cmds.clip(char, sc=1, name='clipFull',startTime=fullMin, 
endTime=fullMax)
fullClipName = fullClip[0]+'Source'

for clipName in propClipData:
 # Extract all the info we need
 timeRange = propClipData[clipName]['key_range']
 minKey = int(timeRange.split(':')[0])
 maxKey = int(timeRange.split(':')[1])
 # Duplicate the clip
 dupeClip = cmds.clip(char, name=fullClipName, d=1, sc=1, newName=clipName)
 cmds.setAttr(dupeClip+'.startFrame', minKey)
 cmds.setAttr(dupeClip+'.sourceStart', minKey)
 cmds.setAttr(dupeClip+'.sourceEnd', maxKey)
 cmds.clip(char, name=dupeClip+'Source', newName=clipName)
cmds.clip(char, rm=1, name=fullClipName) # remove the full clip leaving only 
our proper clips


On Friday, 27 May 2016 11:21:23 UTC+2, Benjam901 wrote:
>
> Hello all,
>
> I am having a bit of trouble with creating multiple clips and applying 
> them to a character set.
>
> What I am trying to achieve is to have multiple clips on one character set 
> for animated props. 
> The user would create their clips in the tool I have set up and then 
> exporting the prop would create a character set for the prop in question.
> I then create clips using the start and end times the user has provided.
>
> Problem I am having is when the user has more than one clip I need to 
> leave the keys on the timeline so I can extract them again I do this using:
>
> def createCharSet(ns='', selectObj='vh'):
>  '''create character set'''
>  char_name='char_'+ns
>  cmds.select(str(selectObj),hi=1)
>  char = cmds.character(name=char_name)
>  return char
>
> char_name= createCharSet(ns='test', selectObj='animated_prop')
> cmds.clip(char_name, sc=1, name='clip_test',startTime=0,endTime=85, lo=1)
> cmds.clip(char_name, sc=1, name='clip_test2',startTime=95,endTime=136, 
> lo=1)
>
>
> Using the lo=1 flag I get to keep the keys and make as many clips as I 
> want....except using this flag offsets my animation in very weird ways and 
> I am confused as to why this is happening. 
> I have tried setting other flags such as allRelative, allAbsolute etc. to 
> 0 but to no avail.
>
> am I missing a flag or 2 that is helping me achieve this?
>
> Cheers,
>
> Ben
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/b7929304-1067-4808-89b8-33b35b65db71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to