示例#1
0
	def on_xfer( self, *a ):
		mapping = api.resolveMapping( self.UI_mapping.getMapping() )
		theSrcs = []
		theTgts = []

		#perform the hierarchy sort
		idx = 0 if self.sortBySrcs else 1
		toSort = [ (len(list(api.iterParents( srcAndTgt[ idx ] ))), srcAndTgt) for srcAndTgt in mapping.iteritems() if cmd.objExists( srcAndTgt[ idx ] ) ]
		toSort.sort()
		for idx, (src, tgt) in toSort:
				theSrcs.append( src )
				theTgts.append( tgt )

		offset = ''
		isDupe = self.isTraceMode( self.RAD_dupe )
		isCopy = self.isTraceMode( self.RAD_copy )
		isTraced = self.isTraceMode( self.RAD_trace )

		instance = cmd.checkBox( self.UI_check1, q=True, v=True )
		traceKeys = cmd.checkBox( self.UI_keysOnly, q=True, v=True )
		matchRo = cmd.checkBox( self.UI_check2, q=True, v=True )
		startTime = cmd.textField( self.UI_start, q=True, tx=True )
		endTime = cmd.textField( self.UI_end, q=True, tx=True )
		world = cmd.checkBox( self.UI_check3, q=True, v=True )  #this is also "process trace cmds"
		nocreate = cmd.checkBox( self.UI_check4, q=True, v=True )

		if startTime.isdigit():
			startTime = int( startTime )
		else:
			if startTime == '!': startTime = cmd.playbackOptions( q=True, min=True )
			elif startTime == '.': startTime = cmd.currentTime( q=True )
			elif startTime == '$': startTime = cmd.playbackOptions( q=True, animationStartTime=True )

		if endTime.isdigit():
			endTime = int( endTime )
		else:
			if endTime == '!': endTime = cmd.playbackOptions( q=True, max=True )
			elif endTime == '.': endTime = cmd.currentTime( q=True )
			elif endTime == '$': endTime = cmd.playbackOptions( q=True, animationEndTime=True )

		withinRange = cmd.checkBox( self.UI_withinRange, q=True, v=True )

		if withinRange:
			traceKeys = 2

		if isCopy:
			offset = "*"

		api.mel.zooXferAnimUtils()
		if self._clipPreset is not None:
			print self._clipPreset.asClip()
			#convert to mapping as expected by animLib...  this is messy!
			animLibMapping = {}
			for src, tgts in mapping.iteritems():
				animLibMapping[ src ] = tgts[ 0 ]

			self._clipPreset.asClip().apply( animLibMapping )
		elif isDupe:
			api.melecho.zooXferBatch( "-mode 0 -instance %d -matchRo %d" % (instance, matchRo), theSrcs, theTgts )
		elif isCopy:
			api.melecho.zooXferBatch( "-mode 1 -range %s %s -matchRo %d" % (startTime, endTime, matchRo), theSrcs, theTgts )
		elif isTraced:
			api.melecho.zooXferBatch( "-mode 2 -keys %d -postCmds %d -matchRo %d -sortByHeirarchy 0 -range %s %s" % (traceKeys, world, matchRo, startTime, endTime), theSrcs, theTgts )
示例#2
0
	def on_xfer( self, *a ):
		mapping = api.resolveMapping( self.UI_mapping.getMapping() )
		theSrcs = []
		theTgts = []

		#perform the hierarchy sort
		idx = 0 if self.sortBySrcs else 1
		toSort = [ (len(list(api.iterParents( srcAndTgt[ idx ] ))), srcAndTgt) for srcAndTgt in mapping.iteritems() if cmd.objExists( srcAndTgt[ idx ] ) ]
		toSort.sort()
		for idx, (src, tgt) in toSort:
			theSrcs.append( src )
			theTgts.append( tgt )

		offset = ''
		isDupe = self.isTraceMode( self.RAD_dupe )
		isCopy = self.isTraceMode( self.RAD_copy )
		isTraced = self.isTraceMode( self.RAD_trace )

		instance = cmd.checkBox( self.UI_check1, q=True, v=True )
		traceKeys = cmd.checkBox( self.UI_keysOnly, q=True, v=True )
		matchRo = cmd.checkBox( self.UI_check2, q=True, v=True )
		startTime = cmd.textField( self.UI_start, q=True, tx=True )
		endTime = cmd.textField( self.UI_end, q=True, tx=True )
		world = cmd.checkBox( self.UI_check3, q=True, v=True )  #this is also "process trace cmds"
		nocreate = cmd.checkBox( self.UI_check4, q=True, v=True )

		if startTime.isdigit():
			startTime = int( startTime )
		else:
			if startTime == '!': startTime = cmd.playbackOptions( q=True, min=True )
			elif startTime == '.': startTime = cmd.currentTime( q=True )
			elif startTime == '$': startTime = cmd.playbackOptions( q=True, animationStartTime=True )

		if endTime.isdigit():
			endTime = int( endTime )
		else:
			if endTime == '!': endTime = cmd.playbackOptions( q=True, max=True )
			elif endTime == '.': endTime = cmd.currentTime( q=True )
			elif endTime == '$': endTime = cmd.playbackOptions( q=True, animationEndTime=True )

		withinRange = cmd.checkBox( self.UI_withinRange, q=True, v=True )

		if withinRange:
			traceKeys = 2

		if isCopy:
			offset = "*"

		api.mel.zooXferAnimUtils()
		if self._clipPreset is not None:
			print self._clipPreset.asClip()
			#convert to mapping as expected by animLib...  this is messy!
			animLibMapping = {}
			for src, tgts in mapping.iteritems():
				animLibMapping[ src ] = tgts[ 0 ]

			self._clipPreset.asClip().apply( animLibMapping )
		elif isDupe:
			api.melecho.zooXferBatch( "-mode 0 -instance %d -matchRo %d" % (instance, matchRo), theSrcs, theTgts )
		elif isCopy:
			api.melecho.zooXferBatch( "-mode 1 -range %s %s -matchRo %d" % (startTime, endTime, matchRo), theSrcs, theTgts )
		elif isTraced:
			api.melecho.zooXferBatch( "-mode 2 -keys %d -postCmds %d -matchRo %d -sortByHeirarchy 0 -range %s %s" % (traceKeys, world, matchRo, startTime, endTime), theSrcs, theTgts )