Updated
This commit is contained in:
		
							
								
								
									
										2
									
								
								Scripts/Animation/MotionCapHelper/.gitattributes
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								Scripts/Animation/MotionCapHelper/.gitattributes
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
# Auto detect text files and perform LF normalization
 | 
			
		||||
* text=auto
 | 
			
		||||
							
								
								
									
										17
									
								
								Scripts/Animation/MotionCapHelper/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								Scripts/Animation/MotionCapHelper/README.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
# MotionCapHelper
 | 
			
		||||
 maya simple plugin for animator
 | 
			
		||||
 | 
			
		||||
# main feature:主要功能
 | 
			
		||||
animation curve smooth:平滑动画曲线
 | 
			
		||||
frame align:在参考物体的帧时间k选择物体的帧,并删除其他帧。(对齐帧)
 | 
			
		||||
regular expression:根据正则表达式过滤物体名,并创建(多个)显示层
 | 
			
		||||
animation rebuild:删除范围内外帧,偏移选中物体帧,手动提取关键帧,快速烘焙动画到另一个物体,fk转换ik,钉住世界位置,快速烘焙父子约束效果。
 | 
			
		||||
 | 
			
		||||
都是非常简单的功能,其中平滑曲线的代码来自https://blog.csdn.net/lulongfei172006/article/details/51493273/
 | 
			
		||||
 | 
			
		||||
# support maya version:支持版本
 | 
			
		||||
maya 2018+
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||

 | 
			
		||||
							
								
								
									
										21
									
								
								Scripts/Animation/MotionCapHelper/bin/LICENSE
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								Scripts/Animation/MotionCapHelper/bin/LICENSE
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
MIT License
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2023 yxnhyxnh
 | 
			
		||||
 | 
			
		||||
Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
in the Software without restriction, including without limitation the rights
 | 
			
		||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
furnished to do so, subject to the following conditions:
 | 
			
		||||
 | 
			
		||||
The above copyright notice and this permission notice shall be included in all
 | 
			
		||||
copies or substantial portions of the Software.
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
			
		||||
SOFTWARE.
 | 
			
		||||
							
								
								
									
										0
									
								
								Scripts/Animation/MotionCapHelper/bin/__inti__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								Scripts/Animation/MotionCapHelper/bin/__inti__.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										218
									
								
								Scripts/Animation/MotionCapHelper/bin/mocaphelper.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										218
									
								
								Scripts/Animation/MotionCapHelper/bin/mocaphelper.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,218 @@
 | 
			
		||||
# -*- coding: utf-8 -*-
 | 
			
		||||
'''
 | 
			
		||||
this plugin is created for use with autodesk maya 2018+.
 | 
			
		||||
(because it import pyside2 module,and i don't know in which version maya would update this.)
 | 
			
		||||
 | 
			
		||||
'''
 | 
			
		||||
 | 
			
		||||
import sys
 | 
			
		||||
 | 
			
		||||
import maya.api.OpenMaya as om
 | 
			
		||||
import mocaphelperui
 | 
			
		||||
import mocaphelpersaccore
 | 
			
		||||
import mocaphelperfacore
 | 
			
		||||
import mocaphelperutility
 | 
			
		||||
 | 
			
		||||
from Qt import QtWidgets
 | 
			
		||||
 | 
			
		||||
from Qt import QtCore
 | 
			
		||||
 | 
			
		||||
version = 1.44
 | 
			
		||||
ui = None
 | 
			
		||||
 | 
			
		||||
translator = QtCore.QTranslator()
 | 
			
		||||
 | 
			
		||||
def maya_useNewAPI():
 | 
			
		||||
	"""
 | 
			
		||||
	The presence of this function tells Maya that the plugin produces, and
 | 
			
		||||
	expects to be passed, objects created using the Maya Python API 2.0.
 | 
			
		||||
	"""
 | 
			
		||||
	pass
 | 
			
		||||
 | 
			
		||||
# Initialize the plug-in
 | 
			
		||||
def initializePlugin(plugin):
 | 
			
		||||
	pluginFn = om.MFnPlugin(plugin)
 | 
			
		||||
	try:
 | 
			
		||||
		pluginFn.registerCommand(
 | 
			
		||||
			mocaphelpersaccore.SmoothAnimCurve.kPluginCmdName, mocaphelpersaccore.SmoothAnimCurve.cmdCreator,mocaphelpersaccore.syntaxCreator
 | 
			
		||||
		)
 | 
			
		||||
 | 
			
		||||
	except:
 | 
			
		||||
		sys.stderr.write(
 | 
			
		||||
			"Failed to register command: %s\n" % mocaphelpersaccore.SmoothAnimCurve.kPluginCmdName
 | 
			
		||||
		)
 | 
			
		||||
		raise
 | 
			
		||||
 | 
			
		||||
	try:
 | 
			
		||||
		pluginFn.registerCommand(
 | 
			
		||||
			openui.kPluginCmdName, openui.cmdCreator,openuiSyntaxCreator
 | 
			
		||||
		)
 | 
			
		||||
	except:
 | 
			
		||||
		sys.stderr.write(
 | 
			
		||||
			"Failed to register command: %s\n" % openui.kPluginCmdName
 | 
			
		||||
		)
 | 
			
		||||
		raise
 | 
			
		||||
 | 
			
		||||
	try:
 | 
			
		||||
		pluginFn.registerCommand(
 | 
			
		||||
			mocaphelperfacore.FrameAlign.kPluginCmdName, mocaphelperfacore.FrameAlign.cmdCreator,mocaphelperfacore.syntaxCreator
 | 
			
		||||
		)
 | 
			
		||||
	except:
 | 
			
		||||
		sys.stderr.write(
 | 
			
		||||
			"Failed to register command: %s\n" % mocaphelperfacore.FrameAlign.kPluginCmdName
 | 
			
		||||
		)
 | 
			
		||||
		raise
 | 
			
		||||
 | 
			
		||||
	try:
 | 
			
		||||
		pluginFn.registerCommand(
 | 
			
		||||
			Eval.kPluginCmdName, Eval.cmdCreator,evalSyntaxCreator
 | 
			
		||||
		)
 | 
			
		||||
	except:
 | 
			
		||||
		sys.stderr.write(
 | 
			
		||||
			"Failed to register command: %s\n" % Eval.kPluginCmdName
 | 
			
		||||
		)
 | 
			
		||||
		raise
 | 
			
		||||
 | 
			
		||||
# Uninitialize the plug-in
 | 
			
		||||
def uninitializePlugin(plugin):
 | 
			
		||||
	pluginFn = om.MFnPlugin(plugin)
 | 
			
		||||
	try:
 | 
			
		||||
		pluginFn.deregisterCommand(mocaphelpersaccore.SmoothAnimCurve.kPluginCmdName)
 | 
			
		||||
	except:
 | 
			
		||||
		sys.stderr.write(
 | 
			
		||||
			"Failed to unregister command: %s\n" % mocaphelpersaccore.SmoothAnimCurve.kPluginCmdName
 | 
			
		||||
		)
 | 
			
		||||
		raise
 | 
			
		||||
	try:
 | 
			
		||||
		pluginFn.deregisterCommand(openui.kPluginCmdName)
 | 
			
		||||
	except:
 | 
			
		||||
		sys.stderr.write(
 | 
			
		||||
			"Failed to unregister command: %s\n" % openui.kPluginCmdName
 | 
			
		||||
		)
 | 
			
		||||
		raise
 | 
			
		||||
 | 
			
		||||
	try:
 | 
			
		||||
		pluginFn.deregisterCommand(mocaphelperfacore.FrameAlign.kPluginCmdName)
 | 
			
		||||
	except:
 | 
			
		||||
		sys.stderr.write(
 | 
			
		||||
			"Failed to unregister command: %s\n" % mocaphelperfacore.FrameAlign.kPluginCmdName
 | 
			
		||||
		)
 | 
			
		||||
		raise
 | 
			
		||||
 | 
			
		||||
	try:
 | 
			
		||||
		pluginFn.deregisterCommand(Eval.kPluginCmdName)
 | 
			
		||||
	except:
 | 
			
		||||
		sys.stderr.write(
 | 
			
		||||
			"Failed to unregister command: %s\n" % Eval.kPluginCmdName
 | 
			
		||||
		)
 | 
			
		||||
		raise
 | 
			
		||||
 | 
			
		||||
# command
 | 
			
		||||
 | 
			
		||||
class openui(om.MPxCommand):
 | 
			
		||||
 | 
			
		||||
	kPluginCmdName = "moCapHelper_showUi"
 | 
			
		||||
 | 
			
		||||
	uiLanguageFlagShortName = "lan"
 | 
			
		||||
	uiLanguageFlagLongName = "language"
 | 
			
		||||
	lang = None
 | 
			
		||||
	def __init__(self):
 | 
			
		||||
		om.MPxCommand.__init__(self)
 | 
			
		||||
 | 
			
		||||
	@staticmethod
 | 
			
		||||
	def cmdCreator():
 | 
			
		||||
		return openui()
 | 
			
		||||
 | 
			
		||||
	def parseArguments(self,args):
 | 
			
		||||
		argdata = om.MArgParser(self.syntax(),args)
 | 
			
		||||
 | 
			
		||||
		if argdata.isFlagSet( self.uiLanguageFlagShortName ):
 | 
			
		||||
			self.lang = argdata.flagArgumentString(self.uiLanguageFlagShortName,0)
 | 
			
		||||
		else:
 | 
			
		||||
			self.lang = None
 | 
			
		||||
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
	def doIt(self, args):
 | 
			
		||||
		self.parseArguments(args)
 | 
			
		||||
		global ui
 | 
			
		||||
		if ui != None:
 | 
			
		||||
			print("saved ui ref:",ui)
 | 
			
		||||
			print("closing ui:--------",ui.destroy(True,True))
 | 
			
		||||
 | 
			
		||||
		
 | 
			
		||||
		app = QtWidgets.QApplication.instance()
 | 
			
		||||
 | 
			
		||||
		app.installTranslator(translator)
 | 
			
		||||
		dir = mocaphelperutility.getDir()
 | 
			
		||||
		# translate:
 | 
			
		||||
		if self.lang == "CN":
 | 
			
		||||
			
 | 
			
		||||
 | 
			
		||||
			
 | 
			
		||||
			translator.load("ui_CN",dir)
 | 
			
		||||
			ui = mocaphelperui.MoCapHelperUI()
 | 
			
		||||
			ui.setWindowTitle('动补助手 v'+str(version))
 | 
			
		||||
			# print(translator.filePath())
 | 
			
		||||
			# print(translator.translate())
 | 
			
		||||
 | 
			
		||||
			# mocaphelperui.translateUi(ui.ui,ui.ui)
 | 
			
		||||
		else:
 | 
			
		||||
			translator.load("")
 | 
			
		||||
			ui = mocaphelperui.MoCapHelperUI()
 | 
			
		||||
 | 
			
		||||
		ui.show()
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
def openuiSyntaxCreator():
 | 
			
		||||
 | 
			
		||||
    syntax = om.MSyntax()
 | 
			
		||||
    
 | 
			
		||||
    syntax.addFlag( openui.uiLanguageFlagShortName, openui.uiLanguageFlagLongName, om.MSyntax.kString )
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
    return syntax
 | 
			
		||||
 | 
			
		||||
class Eval(om.MPxCommand):
 | 
			
		||||
 | 
			
		||||
	kPluginCmdName = "moCapHelper_eval"
 | 
			
		||||
 | 
			
		||||
	strFlagShortName = "s"
 | 
			
		||||
	strFlagLongName = "string"
 | 
			
		||||
	cmd = ""
 | 
			
		||||
 | 
			
		||||
	def __init__(self):
 | 
			
		||||
		om.MPxCommand.__init__(self)
 | 
			
		||||
 | 
			
		||||
	def parseArguments(self,args):
 | 
			
		||||
		argdata = om.MArgParser(self.syntax(),args)
 | 
			
		||||
 | 
			
		||||
		if argdata.isFlagSet( self.strFlagShortName ):
 | 
			
		||||
			self.cmd = argdata.flagArgumentString(self.strFlagShortName,0)
 | 
			
		||||
		else:
 | 
			
		||||
			raise Exception("no str input")
 | 
			
		||||
 | 
			
		||||
	@staticmethod
 | 
			
		||||
	def cmdCreator():
 | 
			
		||||
		
 | 
			
		||||
		return Eval()
 | 
			
		||||
 | 
			
		||||
	def doIt(self, args):
 | 
			
		||||
		self.parseArguments(args)
 | 
			
		||||
		print(self.cmd)
 | 
			
		||||
		global ui
 | 
			
		||||
		if ui != None:
 | 
			
		||||
			exec(self.cmd)
 | 
			
		||||
		else:
 | 
			
		||||
			raise Exception("please create ui first.")
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
def evalSyntaxCreator():
 | 
			
		||||
 | 
			
		||||
    syntax = om.MSyntax()
 | 
			
		||||
    
 | 
			
		||||
    syntax.addFlag( Eval.strFlagShortName, Eval.strFlagLongName, om.MSyntax.kString )
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
    return syntax
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										210
									
								
								Scripts/Animation/MotionCapHelper/bin/mocaphelperarbcore.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										210
									
								
								Scripts/Animation/MotionCapHelper/bin/mocaphelperarbcore.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,210 @@
 | 
			
		||||
# -*- coding: utf-8 -*-
 | 
			
		||||
import maya.cmds as cmds
 | 
			
		||||
import maya.mel as mel
 | 
			
		||||
 | 
			
		||||
import mocaphelperutility
 | 
			
		||||
import math
 | 
			
		||||
 | 
			
		||||
def createLoc(strname,cd = (0,0,0),rot = (0,0,0),roo = "xyz"):
 | 
			
		||||
    locname = cmds.spaceLocator(name = strname)
 | 
			
		||||
    mocaphelperutility.setWorldPos(locname,cd)
 | 
			
		||||
    mocaphelperutility.setWorldRot(locname,rot,roo)
 | 
			
		||||
    return locname
 | 
			
		||||
 | 
			
		||||
def reposition(objA,objB):
 | 
			
		||||
    tempp = mocaphelperutility.getWorldPos(objB)
 | 
			
		||||
    tempr = mocaphelperutility.getWorldRot(objB)
 | 
			
		||||
    temproo = mocaphelperutility.getRotOrder(objB)
 | 
			
		||||
    mocaphelperutility.setWorldPos(objA,tempp)
 | 
			
		||||
    mocaphelperutility.setWorldRot(objA,tempr,temproo)
 | 
			
		||||
 | 
			
		||||
def checkConstraint(obj):
 | 
			
		||||
    parent = cmds.parentConstraint(obj, targetList = True ,q = True ) 
 | 
			
		||||
    point = cmds.pointConstraint(obj, targetList = True ,q = True ) 
 | 
			
		||||
    orient = cmds.orientConstraint(obj, targetList = True ,q = True ) 
 | 
			
		||||
    if parent == None and point == None and orient == None:
 | 
			
		||||
        return False
 | 
			
		||||
    else:
 | 
			
		||||
        conslist = [parent,point,orient]
 | 
			
		||||
        return conslist
 | 
			
		||||
    
 | 
			
		||||
def deleteAllConstraint(obj):
 | 
			
		||||
    cmds.delete(obj,cn=True)
 | 
			
		||||
 | 
			
		||||
def createPointConstraint(ctrlobj,targetobj,maintainoffset = False):
 | 
			
		||||
    name = cmds.pointConstraint(ctrlobj,targetobj,mo = maintainoffset)
 | 
			
		||||
    return name
 | 
			
		||||
 | 
			
		||||
def createOrientConstraint(ctrlobj,targetobj,maintainoffset = False):
 | 
			
		||||
    name = cmds.orientConstraint(ctrlobj,targetobj,mo = maintainoffset)
 | 
			
		||||
    return name
 | 
			
		||||
 | 
			
		||||
def createParentConstraint(ctrlobj,targetobj,maintainoffset = False):
 | 
			
		||||
    name = cmds.parentConstraint(ctrlobj,targetobj,mo = maintainoffset)
 | 
			
		||||
    return name
 | 
			
		||||
'''
 | 
			
		||||
def deletePointConstraint(ctrlobj,targetobj):
 | 
			
		||||
    cmds.pointConstraint(ctrlobj,targetobj,remove = True)
 | 
			
		||||
 | 
			
		||||
def deleteParentConstraint(ctrlobj,targetobj):
 | 
			
		||||
    cmds.parentConstraint(ctrlobj,targetobj,remove = True)
 | 
			
		||||
 | 
			
		||||
def deleteOrientConstraint(ctrlobj,targetobj):
 | 
			
		||||
    cmds.orientConstraint(ctrlobj,targetobj,remove = True)
 | 
			
		||||
'''
 | 
			
		||||
def bake(objs,mintime,maxtime,type = "all"):
 | 
			
		||||
    # if smartbake == True:
 | 
			
		||||
    if type == "all":
 | 
			
		||||
        cmds.bakeResults(objs,t =(mintime,maxtime),simulation = True)
 | 
			
		||||
    else:
 | 
			
		||||
        if type == "parent":
 | 
			
		||||
            atb = ["tx","ty","tz","sx","sy","sz","rx","ry","rz"]
 | 
			
		||||
 | 
			
		||||
        elif type == "point":
 | 
			
		||||
            atb = ["tx","ty","tz"]
 | 
			
		||||
 | 
			
		||||
        elif type == "orient":
 | 
			
		||||
            atb = ["rx","ry","rz"]
 | 
			
		||||
 | 
			
		||||
        elif type == "onlyscale":
 | 
			
		||||
            atb = ["sx","sy","sz"]
 | 
			
		||||
 | 
			
		||||
        else:
 | 
			
		||||
            raise Exception("bake error:type unidentified:",type)
 | 
			
		||||
        cmds.bakeResults(objs,t =(mintime,maxtime),at = atb)
 | 
			
		||||
 | 
			
		||||
def smartbake(objs,mintime,maxtime,type = "all"):
 | 
			
		||||
    if type == "all":
 | 
			
		||||
        cmds.bakeResults(objs,t =(mintime,maxtime),smart = True,simulation = True)
 | 
			
		||||
    else:
 | 
			
		||||
        if type == "parent":
 | 
			
		||||
            atb = ["tx","ty","tz","sx","sy","sz","rx","ry","rz"]
 | 
			
		||||
 | 
			
		||||
        elif type == "point":
 | 
			
		||||
            atb = ["tx","ty","tz"]
 | 
			
		||||
 | 
			
		||||
        elif type == "orient":
 | 
			
		||||
            atb = ["rx","ry","rz"]
 | 
			
		||||
 | 
			
		||||
        elif type == "onlyscale":
 | 
			
		||||
            atb = ["sx","sy","sz"]
 | 
			
		||||
 | 
			
		||||
        else:
 | 
			
		||||
            raise Exception("bake error:type unidentified")
 | 
			
		||||
        cmds.bakeResults(objs,t =(mintime,maxtime),smart = True,at = atb)
 | 
			
		||||
 | 
			
		||||
def deleteInrange(objs,start,end):
 | 
			
		||||
    if cmds.keyframe(objs,q = True) == None :
 | 
			
		||||
        raise Exception("ref has no keys!")
 | 
			
		||||
    else:
 | 
			
		||||
        mocaphelperutility.cutKey(objs,start+0.01,end-0.01)
 | 
			
		||||
        # mocaphelperutility.autoKetTangent(objs,start,start)
 | 
			
		||||
        # mocaphelperutility.autoKetTangent(objs,end,end)
 | 
			
		||||
 | 
			
		||||
def deleteOutrange(objs,start,end):
 | 
			
		||||
    if cmds.keyframe(objs,q = True) == None :
 | 
			
		||||
        raise Exception("ref has no keys!")
 | 
			
		||||
    
 | 
			
		||||
    framelist = set(cmds.keyframe(objs,q = True))
 | 
			
		||||
    minframe = min(framelist)
 | 
			
		||||
    maxframe = max(framelist)
 | 
			
		||||
    if minframe < start:
 | 
			
		||||
        mocaphelperutility.cutKey(objs,minframe,start-0.01)
 | 
			
		||||
        # mocaphelperutility.autoKetTangent(objs,start,start)
 | 
			
		||||
    if maxframe > end:
 | 
			
		||||
        mocaphelperutility.cutKey(objs,end+0.01,maxframe)
 | 
			
		||||
        # mocaphelperutility.autoKetTangent(objs,end,end)
 | 
			
		||||
 | 
			
		||||
def offsetFrame(objs,offset):
 | 
			
		||||
    cmds.keyframe(objs,e = True,tc = float(offset),o = "over",relative = True)
 | 
			
		||||
 | 
			
		||||
def stickyDelete(ui):
 | 
			
		||||
    objs = mocaphelperutility.getSelectedNodes()
 | 
			
		||||
    fromframe = eval(ui.ui.arb_fromEdit.text())
 | 
			
		||||
    curframe = mocaphelperutility.getCurrentFrame()
 | 
			
		||||
    if fromframe != curframe:
 | 
			
		||||
        mocaphelperutility.cutKey(objs,fromframe,curframe,True)
 | 
			
		||||
        mocaphelperutility.autoKetTangent(objs,fromframe,curframe)
 | 
			
		||||
        ui.ui.arb_fromEdit.setText(str(curframe))
 | 
			
		||||
        ui.ui.arb_toEdit.setText(str(curframe))
 | 
			
		||||
    else:
 | 
			
		||||
        raise Exception("from == curframe")
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
def bakeAtoB(A,B,start,end,type,maintainoffset = False,smart = False):
 | 
			
		||||
    print("type == ",type)
 | 
			
		||||
    if type == "parent" or type == "all":
 | 
			
		||||
        cons = createParentConstraint(A,B,maintainoffset)
 | 
			
		||||
    elif type == "point":
 | 
			
		||||
        cons = createPointConstraint(A,B,maintainoffset)
 | 
			
		||||
    elif type == "orient":
 | 
			
		||||
        cons = createOrientConstraint(A,B,maintainoffset)
 | 
			
		||||
    elif type == "onlyscale":
 | 
			
		||||
        cons = createParentConstraint(A,B,maintainoffset)
 | 
			
		||||
 | 
			
		||||
    if smart:
 | 
			
		||||
        smartbake(B,start,end,type)
 | 
			
		||||
    else:
 | 
			
		||||
        bake(B,start,end,type)
 | 
			
		||||
        
 | 
			
		||||
    mocaphelperutility.deleteObj(cons)
 | 
			
		||||
 | 
			
		||||
def pinCurPos(objs,mintime,maxtime):
 | 
			
		||||
    min = mintime
 | 
			
		||||
    max = maxtime
 | 
			
		||||
    if min > max:
 | 
			
		||||
            min = maxtime
 | 
			
		||||
            max = mintime
 | 
			
		||||
    if min == max:
 | 
			
		||||
        raise Exception("min == max.")
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
    cdlist = []
 | 
			
		||||
    # cmds.currentTime(min)
 | 
			
		||||
    for obj in objs:
 | 
			
		||||
 | 
			
		||||
        pos = mocaphelperutility.getWorldPos(obj)
 | 
			
		||||
        rot = mocaphelperutility.getWorldRot(obj)
 | 
			
		||||
        cdlist.append([pos,rot])
 | 
			
		||||
    for i in range(int(math.floor(min)),int(math.ceil(max)+1)):
 | 
			
		||||
 | 
			
		||||
        cmds.currentTime(float(i))
 | 
			
		||||
        cmds.setKeyframe(objs,at = ["tx","ty","tz","rx","ry","rz"])
 | 
			
		||||
        for i in range(len(objs)):
 | 
			
		||||
            pos = cdlist[i][0]
 | 
			
		||||
            rot = cdlist[i][1]
 | 
			
		||||
            cmds.xform(objs[i],ws = True,translation = pos,rotation = rot)
 | 
			
		||||
 | 
			
		||||
def pinParentPos(objs,mintime,maxtime):
 | 
			
		||||
 | 
			
		||||
    leng = len(objs)
 | 
			
		||||
    if leng <= 1:
 | 
			
		||||
        raise Exception("not enough obj selected,at least 2.")
 | 
			
		||||
    min = mintime
 | 
			
		||||
    max = maxtime
 | 
			
		||||
    if min > max:
 | 
			
		||||
            min = maxtime
 | 
			
		||||
            max = mintime
 | 
			
		||||
    if min == max:
 | 
			
		||||
        raise Exception("min == max.")
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    # cmds.currentTime(min)
 | 
			
		||||
    consobj = objs[:-1]
 | 
			
		||||
    beconsobj = objs[-1]
 | 
			
		||||
 | 
			
		||||
    pos = mocaphelperutility.getWorldPos(beconsobj)
 | 
			
		||||
    rot = mocaphelperutility.getWorldRot(beconsobj)
 | 
			
		||||
    roo = mocaphelperutility.getRotOrder(beconsobj)
 | 
			
		||||
    loc = createLoc("mocaphelper_arb_pinparent_temp_loc",pos,rot,roo)[0]
 | 
			
		||||
    createParentConstraint(consobj,loc,True)
 | 
			
		||||
    bake(loc,min,max,type="parent")
 | 
			
		||||
 | 
			
		||||
    for i in range(int(math.floor(min)),int(math.ceil(max)+1)):
 | 
			
		||||
 | 
			
		||||
        cmds.currentTime(float(i))
 | 
			
		||||
        cmds.setKeyframe(beconsobj,at = ["tx","ty","tz","rx","ry","rz"])
 | 
			
		||||
        reposition(beconsobj,loc)
 | 
			
		||||
 | 
			
		||||
    mocaphelperutility.deleteObj(loc)
 | 
			
		||||
    mocaphelperutility.selectNodes(beconsobj)
 | 
			
		||||
							
								
								
									
										93
									
								
								Scripts/Animation/MotionCapHelper/bin/mocaphelperfacore.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										93
									
								
								Scripts/Animation/MotionCapHelper/bin/mocaphelperfacore.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,93 @@
 | 
			
		||||
import maya.api.OpenMaya as om
 | 
			
		||||
import maya.api.OpenMayaAnim as omani
 | 
			
		||||
import maya.cmds as cmds
 | 
			
		||||
 | 
			
		||||
import maya.mel as mel
 | 
			
		||||
 | 
			
		||||
import mocaphelperutility
 | 
			
		||||
 | 
			
		||||
refobjsShortFlagName = "-ref"
 | 
			
		||||
refobjsLongFlagName = "-refobjs"
 | 
			
		||||
 | 
			
		||||
def syntaxCreator():
 | 
			
		||||
 | 
			
		||||
    syntax = om.MSyntax()
 | 
			
		||||
    
 | 
			
		||||
    syntax.addFlag( refobjsShortFlagName, refobjsLongFlagName, om.MSyntax.kString )
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
    return syntax
 | 
			
		||||
    
 | 
			
		||||
class FrameAlign(om.MPxCommand):
 | 
			
		||||
    kPluginCmdName = "moCapHelper_frameAlign"
 | 
			
		||||
 | 
			
		||||
    ref = ""
 | 
			
		||||
    animcruvechanage = None
 | 
			
		||||
 | 
			
		||||
    def __init__(self):
 | 
			
		||||
        om.MPxCommand.__init__(self)
 | 
			
		||||
 | 
			
		||||
    @staticmethod
 | 
			
		||||
    def cmdCreator():
 | 
			
		||||
        return FrameAlign()
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
    def parseArguments(self,args):
 | 
			
		||||
 | 
			
		||||
        argdata = om.MArgParser(self.syntax(),args)
 | 
			
		||||
 | 
			
		||||
        if argdata.isFlagSet( refobjsShortFlagName ):
 | 
			
		||||
            self.ref = argdata.flagArgumentString(refobjsShortFlagName,0)
 | 
			
		||||
        else:
 | 
			
		||||
            raise Exception("No refence argument!")
 | 
			
		||||
    
 | 
			
		||||
    def isUndoable(self):
 | 
			
		||||
        return True
 | 
			
		||||
 | 
			
		||||
    def doIt(self,args):
 | 
			
		||||
        self.animcruvechanage = omani.MAnimCurveChange()
 | 
			
		||||
        self.parseArguments(args)
 | 
			
		||||
        # start = cmds.playbackOptions( q=True,min=True )
 | 
			
		||||
        # end  = cmds.playbackOptions( q=True,max=True )
 | 
			
		||||
        if mocaphelperutility.objExist(self.ref) == False:
 | 
			
		||||
            raise Exception("ref obj does not exist!")
 | 
			
		||||
        selectedobjs = mocaphelperutility.getSelectedNodes()
 | 
			
		||||
        print(self.ref)
 | 
			
		||||
        if cmds.keyframe(self.ref,q = True) == None :
 | 
			
		||||
            raise Exception("ref has no keys!")
 | 
			
		||||
        else:
 | 
			
		||||
            framelist = set(cmds.keyframe(self.ref,q = True))
 | 
			
		||||
        for frame in framelist:
 | 
			
		||||
            cmds.setKeyframe(selectedobjs,t = (frame,frame),rk= True,hierarchy = "none",i = True,itt = "auto")
 | 
			
		||||
        
 | 
			
		||||
        for obj in selectedobjs:
 | 
			
		||||
            objframelist = set(cmds.keyframe(obj,q = True))
 | 
			
		||||
            for objframe in objframelist:
 | 
			
		||||
                if objframe in framelist:
 | 
			
		||||
                    continue
 | 
			
		||||
                else:
 | 
			
		||||
                    mocaphelperutility.cutKey(obj,objframe,objframe)
 | 
			
		||||
 | 
			
		||||
    def undoIt(self):
 | 
			
		||||
        if self.animcruvechanage != None :
 | 
			
		||||
            self.animcruvechanage.undoIt()
 | 
			
		||||
            print("undo success") 
 | 
			
		||||
        else:
 | 
			
		||||
            print("undo failed:self.animcruvechanage == None") 
 | 
			
		||||
 | 
			
		||||
    def redoIt(self):
 | 
			
		||||
        if self.animcruvechanage != None :
 | 
			
		||||
            self.animcruvechanage.redoIt()
 | 
			
		||||
            print("redo success") 
 | 
			
		||||
        else:
 | 
			
		||||
            print("redo failed:self.animcruvechanage == None") 
 | 
			
		||||
 | 
			
		||||
# def cutlist(sourcelist,splitlist):
 | 
			
		||||
#     backindex = 0
 | 
			
		||||
#     forwardindex = 0
 | 
			
		||||
#     for i in len(sourcelist):
 | 
			
		||||
#         if sourcelist[i] in splitlist:
 | 
			
		||||
 | 
			
		||||
# def fastRecord(obj):
 | 
			
		||||
#     pos = mocaphelperutility.getWorldPos(obj)
 | 
			
		||||
#     loc = mocaphelperarbcore.createLoc("mocaphelper_fa_temp_loc")
 | 
			
		||||
							
								
								
									
										43
									
								
								Scripts/Animation/MotionCapHelper/bin/mocaphelperpbcore.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								Scripts/Animation/MotionCapHelper/bin/mocaphelperpbcore.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
			
		||||
import datetime
 | 
			
		||||
import getpass
 | 
			
		||||
import glob
 | 
			
		||||
import os
 | 
			
		||||
import shutil
 | 
			
		||||
import subprocess
 | 
			
		||||
 | 
			
		||||
import maya.cmds as cmds
 | 
			
		||||
import maya.mel as mel
 | 
			
		||||
 | 
			
		||||
PREV_DIR_ENV = "Mocaphelper_Playblast_Path"
 | 
			
		||||
 | 
			
		||||
def get_prev_path():
 | 
			
		||||
    if cmds.optionVar(exists=PREV_DIR_ENV):
 | 
			
		||||
        return cmds.optionVar(q=PREV_DIR_ENV)
 | 
			
		||||
    else:
 | 
			
		||||
        return None
 | 
			
		||||
 | 
			
		||||
def set_prev_path(dir_path):
 | 
			
		||||
    cmds.optionVar(sv=(PREV_DIR_ENV, dir_path))
 | 
			
		||||
 | 
			
		||||
def getMagicMaskNode():
 | 
			
		||||
    magic_mask_nodes = cmds.ls(type='magicMask')
 | 
			
		||||
    if magic_mask_nodes == None:
 | 
			
		||||
        return None
 | 
			
		||||
    else:
 | 
			
		||||
        return magic_mask_nodes[0]
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
def resetHUD():
 | 
			
		||||
    mel.eval('source "initHUD";')
 | 
			
		||||
 | 
			
		||||
def removeHUD():
 | 
			
		||||
    default_hud_list = cmds.headsUpDisplay(lh=True)
 | 
			
		||||
    if default_hud_list:
 | 
			
		||||
        for default_hud in default_hud_list:
 | 
			
		||||
            cmds.headsUpDisplay(default_hud, rem=True)
 | 
			
		||||
 | 
			
		||||
    # cmds.setAttr('%s.displayFilmGate' % main_cam, 0)
 | 
			
		||||
    # cmds.setAttr('%s.displayResolution' % main_cam, 0)
 | 
			
		||||
 | 
			
		||||
def moCapHelper_Playblast(cam,filepath,offscreen):
 | 
			
		||||
    pass
 | 
			
		||||
							
								
								
									
										160
									
								
								Scripts/Animation/MotionCapHelper/bin/mocaphelperrecore.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										160
									
								
								Scripts/Animation/MotionCapHelper/bin/mocaphelperrecore.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,160 @@
 | 
			
		||||
import maya.api.OpenMaya as om
 | 
			
		||||
import maya.cmds as cmds
 | 
			
		||||
import maya.mel as mel
 | 
			
		||||
 | 
			
		||||
import re
 | 
			
		||||
 | 
			
		||||
import mocaphelperutility
 | 
			
		||||
 | 
			
		||||
def retestlist(strlist,exp,casecheck = False):
 | 
			
		||||
    matchlist = []
 | 
			
		||||
    pyVersion = mocaphelperutility.getPythonVersion()
 | 
			
		||||
    if pyVersion < 3:
 | 
			
		||||
 | 
			
		||||
        if (type(exp)== unicode ):
 | 
			
		||||
            raw_exp = repr(exp)[2:-1]
 | 
			
		||||
        elif (type(exp)== str ):
 | 
			
		||||
            raw_exp = exp
 | 
			
		||||
        else:
 | 
			
		||||
            raise Exception("unidentified string format input!")
 | 
			
		||||
        
 | 
			
		||||
    else:
 | 
			
		||||
        raw_exp = exp
 | 
			
		||||
 | 
			
		||||
    print("convert---"+exp+"---to---"+raw_exp)
 | 
			
		||||
    for longname in strlist:
 | 
			
		||||
        shortname = longname2shortname(longname)[0]
 | 
			
		||||
        print("checking:---exp---"+raw_exp+"---objname---"+shortname)
 | 
			
		||||
        if casecheck == False:
 | 
			
		||||
            if re.search(raw_exp,shortname,re.I) != None:
 | 
			
		||||
                matchlist.append(longname)
 | 
			
		||||
                print("succeed")
 | 
			
		||||
            else:
 | 
			
		||||
                print("failed")
 | 
			
		||||
                continue
 | 
			
		||||
        else:
 | 
			
		||||
            if re.search(raw_exp,shortname) != None:
 | 
			
		||||
                matchlist.append(longname)
 | 
			
		||||
                print("succeed")
 | 
			
		||||
            else:
 | 
			
		||||
                print("failed")
 | 
			
		||||
                continue
 | 
			
		||||
    
 | 
			
		||||
    if len(matchlist) == 0:
 | 
			
		||||
        print("no obj match expression!")
 | 
			
		||||
        return None
 | 
			
		||||
    else:
 | 
			
		||||
        return matchlist
 | 
			
		||||
 | 
			
		||||
def expCreateDisplayLayer(exp,name,prefix = "",casecheck = False,childcheck = True,nodetype = "all"):
 | 
			
		||||
    selected = mocaphelperutility.getSelectedNodes()
 | 
			
		||||
    if childcheck:
 | 
			
		||||
 | 
			
		||||
        untestlist = mocaphelperutility.getChildNodes(selected,nodetype=nodetype)
 | 
			
		||||
    else:
 | 
			
		||||
        untestlist = selected
 | 
			
		||||
    combinelist = []
 | 
			
		||||
    #check for multiple exp exist
 | 
			
		||||
    if exp.find(";") != -1 or name.find(";") != -1:
 | 
			
		||||
        splitedexplist = exp.split(";")
 | 
			
		||||
        splitednamelist = name.split(";")
 | 
			
		||||
        if len(splitedexplist) != len(splitednamelist):
 | 
			
		||||
            raise Exception("name and exp count not match!")
 | 
			
		||||
        else:
 | 
			
		||||
            for i in range(len(splitedexplist)):
 | 
			
		||||
                combinelist.append([splitedexplist[i],splitednamelist[i]])
 | 
			
		||||
    else:
 | 
			
		||||
        combinelist =[[exp,name]]
 | 
			
		||||
 | 
			
		||||
    for combine in combinelist:
 | 
			
		||||
 | 
			
		||||
        matchlist = retestlist(untestlist,combine[0],casecheck)
 | 
			
		||||
        print("matchlist:",matchlist)
 | 
			
		||||
 | 
			
		||||
        createDisplayLayer(prefix+combine[1],matchlist)
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
def createDisplayLayer(name,objlist):
 | 
			
		||||
    cmds.createDisplayLayer(n= name,nr = True,empty = True)
 | 
			
		||||
    cmds.editDisplayLayerMembers(name,objlist,nr = True)
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
def extractLayerInfo(ui):
 | 
			
		||||
    name = cmds.editDisplayLayerGlobals( query=True, cdl=True )
 | 
			
		||||
    members =cmds.editDisplayLayerMembers( name, query=True )
 | 
			
		||||
    exp = ""
 | 
			
		||||
    for member in members:
 | 
			
		||||
        noPrefixMember = deleteRigPrefix(member)
 | 
			
		||||
        if noPrefixMember[1] == True:
 | 
			
		||||
            exp = exp+"."+ noPrefixMember[0] +"|"
 | 
			
		||||
        else:
 | 
			
		||||
            exp = exp+ noPrefixMember[0] +"|"
 | 
			
		||||
    # remove last "|",cause it will match all name str.
 | 
			
		||||
    exp = exp[0:-1]
 | 
			
		||||
    ui.ui.re_layerNameEdit.setText(name)
 | 
			
		||||
    ui.ui.re_expEdit.setText(exp)
 | 
			
		||||
    return 
 | 
			
		||||
 | 
			
		||||
def selMainCtrl():
 | 
			
		||||
# main name:
 | 
			
		||||
# ".MainExtra2" ".wenchangtai" ".Main_all"
 | 
			
		||||
    curves = cmds.ls(type = "dagNode")
 | 
			
		||||
    curves = mocaphelperutility.filterCertainTypeInList(curves,type = "nurbsCurve")
 | 
			
		||||
    matchlist = []
 | 
			
		||||
    a = retestlist(curves,".MainExtra2$|.wenchangtai$|.Main_all$")
 | 
			
		||||
    if a != None:
 | 
			
		||||
        matchlist += a
 | 
			
		||||
    cmds.select(cl = True)
 | 
			
		||||
    cmds.select(matchlist)
 | 
			
		||||
 | 
			
		||||
def longname2shortname(name):
 | 
			
		||||
    id = name.rfind("|")
 | 
			
		||||
    if id == -1:
 | 
			
		||||
        return name,False
 | 
			
		||||
    else:
 | 
			
		||||
        return name[id+1:],True
 | 
			
		||||
    
 | 
			
		||||
def deleteRigPrefix(name):
 | 
			
		||||
    id = name.rfind(":")
 | 
			
		||||
    if id == -1:
 | 
			
		||||
        return name,False
 | 
			
		||||
    else:
 | 
			
		||||
        return name[id:],True
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
def presetfileRebuild(filepath,backupfilepath):
 | 
			
		||||
    backupstr = presetFileRead(backupfilepath)
 | 
			
		||||
    presetFileWrite(filepath,backupstr)
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
def rawStrBuild(rawstr):
 | 
			
		||||
    split = rawstr.split("\n")
 | 
			
		||||
    newlist = []
 | 
			
		||||
    for i in range(int(len(split)/2)):
 | 
			
		||||
        name = split[2*i]
 | 
			
		||||
        exp = split[2*i+1]
 | 
			
		||||
        newlist.append([name,exp])
 | 
			
		||||
    if len(newlist) == 0:
 | 
			
		||||
        raise Exception("split list is empty!")
 | 
			
		||||
    else:
 | 
			
		||||
        return newlist
 | 
			
		||||
    
 | 
			
		||||
def strAppend(oristr,line1,line2):
 | 
			
		||||
    newstr = oristr+"\n"+str(line1)+"\n"+str(line2)
 | 
			
		||||
    return newstr
 | 
			
		||||
 | 
			
		||||
def presetFileRead(filepath):
 | 
			
		||||
    file = open(filepath,mode ="r+")
 | 
			
		||||
    file.seek(0,0)
 | 
			
		||||
    raw = file.read()
 | 
			
		||||
    file.close()
 | 
			
		||||
    return raw
 | 
			
		||||
 | 
			
		||||
def presetFileWrite(filepath,str):
 | 
			
		||||
    print("writing file:\n"+str)
 | 
			
		||||
    file = open(filepath,mode ="w+")
 | 
			
		||||
    file.seek(0,0)
 | 
			
		||||
    file.write(str)
 | 
			
		||||
    file.close()
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										265
									
								
								Scripts/Animation/MotionCapHelper/bin/mocaphelpersaccore.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										265
									
								
								Scripts/Animation/MotionCapHelper/bin/mocaphelpersaccore.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,265 @@
 | 
			
		||||
import maya.api.OpenMaya as om
 | 
			
		||||
import maya.api.OpenMayaAnim as omani
 | 
			
		||||
import maya.cmds as cmds
 | 
			
		||||
 | 
			
		||||
import maya.mel as mel
 | 
			
		||||
import math
 | 
			
		||||
 | 
			
		||||
# selectionList = om.MGlobal.getActiveSelectionList()
 | 
			
		||||
# iterator = om.MItSelectionList( selectionList, om.MFn.kDagNode )
 | 
			
		||||
methodShortFlagName = "-m"
 | 
			
		||||
methodLongFlagName = "-method"
 | 
			
		||||
iterShortFlagName = "-i"
 | 
			
		||||
iterLongFlagName = "-iteration"
 | 
			
		||||
intensityShortFlagName = "-in"
 | 
			
		||||
intensityLongFlagName = "-intensity"
 | 
			
		||||
seltypeShortFlagName = "-sel"
 | 
			
		||||
seltypeLongFlagName = "-selecttype"
 | 
			
		||||
useTimeShortFlagName = "-u"
 | 
			
		||||
useTimeLongFlagName = "-usetime"
 | 
			
		||||
timeUnitShortFlagName = "-tu"
 | 
			
		||||
timeUnitLongFlagName = "-timeunit"
 | 
			
		||||
 | 
			
		||||
def syntaxCreator():
 | 
			
		||||
 | 
			
		||||
    syntax = om.MSyntax()
 | 
			
		||||
    
 | 
			
		||||
    syntax.addFlag( methodShortFlagName, methodLongFlagName, om.MSyntax.kString )
 | 
			
		||||
    syntax.addFlag( iterShortFlagName, iterLongFlagName, om.MSyntax.kLong )
 | 
			
		||||
    syntax.addFlag( intensityShortFlagName, intensityLongFlagName, om.MSyntax.kDouble )
 | 
			
		||||
    syntax.addFlag( seltypeShortFlagName, seltypeLongFlagName, om.MSyntax.kLong )
 | 
			
		||||
    syntax.addFlag( useTimeShortFlagName, useTimeLongFlagName, om.MSyntax.kBoolean )
 | 
			
		||||
    syntax.addFlag( timeUnitShortFlagName, timeUnitLongFlagName, om.MSyntax.kDouble )
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
    return syntax
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
class SmoothAnimCurve(om.MPxCommand):
 | 
			
		||||
    kPluginCmdName = "moCapHelper_smoothAniCurve"
 | 
			
		||||
    method = 0
 | 
			
		||||
    iteration = 1
 | 
			
		||||
    intensity = 1.0
 | 
			
		||||
    seltype = 0
 | 
			
		||||
    useTime = True
 | 
			
		||||
    timeUnit = 5.0
 | 
			
		||||
 | 
			
		||||
    animcruvechanage = None
 | 
			
		||||
 | 
			
		||||
    def __init__(self):
 | 
			
		||||
        om.MPxCommand.__init__(self)
 | 
			
		||||
 | 
			
		||||
    def parseArguments(self,args):
 | 
			
		||||
 | 
			
		||||
        argdata = om.MArgParser(self.syntax(),args)
 | 
			
		||||
 | 
			
		||||
        if argdata.isFlagSet( methodShortFlagName ):
 | 
			
		||||
            if argdata.flagArgumentString(methodShortFlagName,0) == "3linear":
 | 
			
		||||
                self.method = 0
 | 
			
		||||
            elif argdata.flagArgumentString(methodShortFlagName,0) == "3bell":
 | 
			
		||||
                self.method = 1
 | 
			
		||||
            elif argdata.flagArgumentString(methodShortFlagName,0) == "3ham":
 | 
			
		||||
                self.method = 2
 | 
			
		||||
            elif argdata.flagArgumentString(methodShortFlagName,0) == "5quad":
 | 
			
		||||
                self.method = 10
 | 
			
		||||
            elif argdata.flagArgumentString(methodShortFlagName,0) == "5bell":
 | 
			
		||||
                self.method = 11
 | 
			
		||||
            elif argdata.flagArgumentString(methodShortFlagName,0) == "5ham":
 | 
			
		||||
                self.method = 12
 | 
			
		||||
            else:
 | 
			
		||||
                raise Exception("input method argument is not vaild!"+str(argdata.flagArgumentString(methodShortFlagName,0)))
 | 
			
		||||
        else:
 | 
			
		||||
            raise Exception("no input method argument")
 | 
			
		||||
        
 | 
			
		||||
        if argdata.isFlagSet( iterShortFlagName ):
 | 
			
		||||
            if argdata.flagArgumentInt(iterShortFlagName,0) <= 100:
 | 
			
		||||
                self.iteration = argdata.flagArgumentInt(iterShortFlagName,0)
 | 
			
		||||
            else:
 | 
			
		||||
                raise Exception("iteration is bigger than 100,little bit too high,right?")
 | 
			
		||||
        
 | 
			
		||||
        if argdata.isFlagSet( intensityShortFlagName ):
 | 
			
		||||
            self.intensity = argdata.flagArgumentFloat(intensityShortFlagName,0)
 | 
			
		||||
 | 
			
		||||
        if argdata.isFlagSet( seltypeShortFlagName ):
 | 
			
		||||
            self.seltype = argdata.flagArgumentInt(seltypeShortFlagName,0)
 | 
			
		||||
 | 
			
		||||
        if argdata.isFlagSet( useTimeShortFlagName ):
 | 
			
		||||
            self.useTime = argdata.flagArgumentBool(useTimeShortFlagName,0)
 | 
			
		||||
 | 
			
		||||
        if argdata.isFlagSet( timeUnitShortFlagName ):
 | 
			
		||||
            self.timeUnit = argdata.flagArgumentFloat(timeUnitShortFlagName,0)
 | 
			
		||||
 | 
			
		||||
    @staticmethod
 | 
			
		||||
    def cmdCreator():
 | 
			
		||||
        return SmoothAnimCurve()
 | 
			
		||||
    
 | 
			
		||||
    def doIt(self, args):
 | 
			
		||||
 | 
			
		||||
        self.animcruvechanage = omani.MAnimCurveChange()
 | 
			
		||||
        self.parseArguments(args)
 | 
			
		||||
 | 
			
		||||
        animcurves = self.getanimcurves()
 | 
			
		||||
 | 
			
		||||
        for iter in range(self.iteration):
 | 
			
		||||
 | 
			
		||||
            for cv in animcurves:
 | 
			
		||||
                keylist = self.getkeylist(cv)
 | 
			
		||||
                templist = self.smoothkeylistvalue(cv,keylist)
 | 
			
		||||
                print(templist)
 | 
			
		||||
                mslist = om.MGlobal.getSelectionListByName(repr(cv)[2:-1])
 | 
			
		||||
                mit = om.MItSelectionList(mslist)
 | 
			
		||||
                mobj = mit.getDependNode()
 | 
			
		||||
                manimcurve = omani.MFnAnimCurve(mobj)
 | 
			
		||||
                curveisangular = False
 | 
			
		||||
                if manimcurve.animCurveType == manimcurve.kAnimCurveTA or manimcurve.animCurveType == manimcurve.kAnimCurveUA :
 | 
			
		||||
                    curveisangular = True
 | 
			
		||||
                for i in templist:
 | 
			
		||||
                    if curveisangular:
 | 
			
		||||
                        value = math.radians(i[1])
 | 
			
		||||
                    else:
 | 
			
		||||
                        value = i[1]
 | 
			
		||||
                    manimcurve.setValue(i[0],value,self.animcruvechanage)
 | 
			
		||||
                    pass
 | 
			
		||||
 | 
			
		||||
        print("using smoothanimcurve cmd with argument:\nselect type:",self.seltype,"\niteration:",self.iteration,"\nintensity:",self.intensity,"\nusetime:",self.useTime,"\ntimeunit:",self.timeUnit,"\nmethod:",self.method)
 | 
			
		||||
 | 
			
		||||
    def undoIt(self):
 | 
			
		||||
        if self.animcruvechanage != None :
 | 
			
		||||
            self.animcruvechanage.undoIt()
 | 
			
		||||
            print("undo success") 
 | 
			
		||||
        else:
 | 
			
		||||
            print("undo failed:self.animcruvechanage == None") 
 | 
			
		||||
 | 
			
		||||
    def redoIt(self):
 | 
			
		||||
        if self.animcruvechanage != None :
 | 
			
		||||
            self.animcruvechanage.redoIt()
 | 
			
		||||
            print("redo success") 
 | 
			
		||||
        else:
 | 
			
		||||
            print("redo failed:self.animcruvechanage == None") 
 | 
			
		||||
 | 
			
		||||
    def isUndoable(self):
 | 
			
		||||
        return True
 | 
			
		||||
 | 
			
		||||
    def getanimcurves(self):
 | 
			
		||||
        selectflag = cmds.animCurveEditor("graphEditor1GraphEd",query = True,areCurvesSelected = True)
 | 
			
		||||
        showncurves = cmds.animCurveEditor("graphEditor1GraphEd",query = True,curvesShown  = True)
 | 
			
		||||
        selectedcurves = cmds.keyframe(q = True,s = True,name = True)
 | 
			
		||||
        isoflag = 0
 | 
			
		||||
        if showncurves == None:
 | 
			
		||||
            raise Exception("plugin can't find any curve in graph editor,no curve shown or selected.")
 | 
			
		||||
        else:
 | 
			
		||||
            isoflag = len(showncurves) != len(selectedcurves)
 | 
			
		||||
 | 
			
		||||
        if selectflag:
 | 
			
		||||
            return selectedcurves
 | 
			
		||||
        if isoflag:
 | 
			
		||||
            self.seltype == 0
 | 
			
		||||
            return showncurves
 | 
			
		||||
        else:
 | 
			
		||||
            raise Exception("plugin can't find any curve in graph editor,no curve shown or selected.")
 | 
			
		||||
        
 | 
			
		||||
        # if selectflag:
 | 
			
		||||
        #     return selectedcurves
 | 
			
		||||
        # else:
 | 
			
		||||
        #     return showncurves
 | 
			
		||||
        # print(showncurves)
 | 
			
		||||
        # print("----------------")
 | 
			
		||||
        # print(selectedcurves)
 | 
			
		||||
 | 
			
		||||
    def getkeylist(self,animcurve):
 | 
			
		||||
        numkeys = cmds.keyframe(animcurve,q = True,keyframeCount = True)
 | 
			
		||||
        keylist = []
 | 
			
		||||
        #seltype == 0 :all keys on curves
 | 
			
		||||
        if self.seltype == 0:
 | 
			
		||||
            for i in range(numkeys):
 | 
			
		||||
                keylist.append([i,0.0])
 | 
			
		||||
        #seltype == 1 :selected keys only
 | 
			
		||||
        elif self.seltype == 1:
 | 
			
		||||
            numselkeyindexlist = cmds.keyframe(animcurve,sl = True,q=True,indexValue = True)
 | 
			
		||||
            for index in numselkeyindexlist:
 | 
			
		||||
                keylist.append([int(index),0.0])
 | 
			
		||||
        return keylist
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
    def smoothkeylistvalue(self,curve,keylist):
 | 
			
		||||
        flag5pt = False
 | 
			
		||||
        compareint = 0
 | 
			
		||||
        if self.method>=9:
 | 
			
		||||
            compareint = 1
 | 
			
		||||
            flag5pt = True
 | 
			
		||||
        numkeys = cmds.keyframe(curve,q = True,keyframeCount = True)
 | 
			
		||||
        for key in keylist:
 | 
			
		||||
            time = getkeytime(curve,key[0])
 | 
			
		||||
            value = getkeyvalue(curve,time)
 | 
			
		||||
 | 
			
		||||
            if key[0] <=compareint or numkeys-key[0]<=compareint+1:
 | 
			
		||||
                
 | 
			
		||||
                key[1] = value
 | 
			
		||||
            
 | 
			
		||||
            else:
 | 
			
		||||
                pretime2 = 0
 | 
			
		||||
                prevalue2 = 0
 | 
			
		||||
                nexttime2 = 0 
 | 
			
		||||
                nextvalue2 = 0
 | 
			
		||||
 | 
			
		||||
                pretime = getkeytime(curve,key[0]-1)
 | 
			
		||||
                nexttime = getkeytime(curve,key[0]+1)
 | 
			
		||||
 | 
			
		||||
                if self.useTime:
 | 
			
		||||
                    pretime = time - self.timeUnit
 | 
			
		||||
                    nexttime = time + self.timeUnit
 | 
			
		||||
                else:
 | 
			
		||||
                    pass
 | 
			
		||||
 | 
			
		||||
                prevalue = getkeyvalue(curve,pretime)
 | 
			
		||||
                nextvalue = getkeyvalue(curve,nexttime)
 | 
			
		||||
 | 
			
		||||
                
 | 
			
		||||
 | 
			
		||||
                if flag5pt:
 | 
			
		||||
                    pretime2 = getkeytime(curve,key[0]-2)
 | 
			
		||||
                    nexttime2 = getkeytime(curve,key[0]+2)
 | 
			
		||||
 | 
			
		||||
                    if self.useTime:
 | 
			
		||||
                        pretime2 = time - self.timeUnit*2
 | 
			
		||||
                        nexttime2 = time + self.timeUnit*2
 | 
			
		||||
                    else:
 | 
			
		||||
                        pass
 | 
			
		||||
 | 
			
		||||
                    prevalue2 = getkeyvalue(curve,pretime2)
 | 
			
		||||
                    nextvalue2 = getkeyvalue(curve,nexttime2)
 | 
			
		||||
 | 
			
		||||
                if self.method == 0:
 | 
			
		||||
                    tempvalue = value+prevalue+nextvalue
 | 
			
		||||
                    key[1] = lerp(value,tempvalue/3,self.intensity)
 | 
			
		||||
                elif self.method == 1:
 | 
			
		||||
                    tempvalue = 0.576*value+0.212*prevalue+0.212*nextvalue
 | 
			
		||||
                    key[1] = lerp(value,tempvalue,self.intensity)
 | 
			
		||||
                elif self.method == 2:
 | 
			
		||||
                    tempvalue = 0.86*value+0.07*prevalue+0.07*nextvalue
 | 
			
		||||
                    key[1] = lerp(value,tempvalue,self.intensity)
 | 
			
		||||
                elif self.method == 10:
 | 
			
		||||
                    tempvalue = 12*prevalue+nextvalue-3*prevalue2+nextvalue2+17*value
 | 
			
		||||
                    key[1] = lerp(value,tempvalue/35,self.intensity)
 | 
			
		||||
                elif self.method == 11:
 | 
			
		||||
                    tempvalue = 0.11*(prevalue2+nextvalue2)+0.24*(prevalue+nextvalue)+0.3*(value)
 | 
			
		||||
                    key[1] = lerp(value,tempvalue,self.intensity)
 | 
			
		||||
                elif self.method == 12:
 | 
			
		||||
                    tempvalue = 0.04*(prevalue2+nextvalue2)+0.24*(prevalue+nextvalue)+0.44*(value)
 | 
			
		||||
                    key[1] = lerp(value,tempvalue,self.intensity)
 | 
			
		||||
                else:
 | 
			
		||||
                    raise Exception("method error while using smoothkeylistvalue()")
 | 
			
		||||
 | 
			
		||||
        return keylist
 | 
			
		||||
 | 
			
		||||
def getkeytime(curve,id):
 | 
			
		||||
    time = cmds.keyframe(curve,index=(id,id),q=True)[0]
 | 
			
		||||
    return time
 | 
			
		||||
def getkeyvalue(curve,time):
 | 
			
		||||
    value = cmds.keyframe(curve,t = (time,time),ev = True , q = True )[0]
 | 
			
		||||
    return value
 | 
			
		||||
def lerp(originvalue,newvalue,intensity):
 | 
			
		||||
    temp = newvalue-originvalue
 | 
			
		||||
    return originvalue+temp*intensity
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										634
									
								
								Scripts/Animation/MotionCapHelper/bin/mocaphelperui.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										634
									
								
								Scripts/Animation/MotionCapHelper/bin/mocaphelperui.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,634 @@
 | 
			
		||||
# coding=utf-8
 | 
			
		||||
# -*- coding: utf-8 -*-
 | 
			
		||||
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
from mocaphelper import version
 | 
			
		||||
import mocaphelperutility
 | 
			
		||||
import mocaphelperrecore
 | 
			
		||||
import mocaphelperarbcore
 | 
			
		||||
 | 
			
		||||
from maya import cmds
 | 
			
		||||
from maya import mel
 | 
			
		||||
from maya import OpenMayaUI as omui 
 | 
			
		||||
 | 
			
		||||
from Qt.QtCore import * 
 | 
			
		||||
from Qt.QtGui import *
 | 
			
		||||
from Qt.QtWidgets import *
 | 
			
		||||
# from Qt.QtUiTools import *
 | 
			
		||||
from Qt.QtCompat import wrapInstance, loadUi
 | 
			
		||||
 | 
			
		||||
mayaMainWindowPtr = omui.MQtUtil.mainWindow() 
 | 
			
		||||
pyVersion = mocaphelperutility.getPythonVersion()
 | 
			
		||||
if pyVersion < 3:
 | 
			
		||||
    mayaMainWindow = wrapInstance(long(mayaMainWindowPtr), QWidget) 
 | 
			
		||||
else:
 | 
			
		||||
    mayaMainWindow = wrapInstance(int(mayaMainWindowPtr), QWidget) 
 | 
			
		||||
 | 
			
		||||
class MoCapHelperUI(QWidget):
 | 
			
		||||
    #sac:
 | 
			
		||||
    sac_iteration = 1
 | 
			
		||||
    sac_intensity = 1.0
 | 
			
		||||
    sac_useTime = True
 | 
			
		||||
    sac_method = "3linear"
 | 
			
		||||
    sac_selType = "curves"
 | 
			
		||||
    sac_timeUnit = 5.0
 | 
			
		||||
 | 
			
		||||
    #fa:
 | 
			
		||||
    fa_refobjs = None
 | 
			
		||||
 | 
			
		||||
    #re:
 | 
			
		||||
    re_exp = ""
 | 
			
		||||
    re_name = ""
 | 
			
		||||
    re_caseCheck = False
 | 
			
		||||
    re_prefix = ""
 | 
			
		||||
 | 
			
		||||
    #arb:
 | 
			
		||||
    arb_fromtime = 10.0
 | 
			
		||||
    arb_totime = 11.0
 | 
			
		||||
    def __init__(self, *args, **kwargs):
 | 
			
		||||
 | 
			
		||||
        super(MoCapHelperUI, self).__init__(*args, **kwargs)
 | 
			
		||||
        self.setParent(mayaMainWindow)
 | 
			
		||||
        self.setWindowFlags(Qt.Window)
 | 
			
		||||
        self.setObjectName('mocaphelperui')
 | 
			
		||||
        self.setWindowTitle('moCapHelper v'+str(version))
 | 
			
		||||
        self.loadUI()
 | 
			
		||||
        self.initSac()
 | 
			
		||||
        self.initFa()
 | 
			
		||||
        self.initre()
 | 
			
		||||
        self.intiArb()
 | 
			
		||||
        self.re_exp = self.ui.re_expEdit.text()
 | 
			
		||||
        # self.arb_syncRange()
 | 
			
		||||
 | 
			
		||||
    def loadUI(self):
 | 
			
		||||
        # loader = QUiLoader()
 | 
			
		||||
        currentDir = os.path.dirname(__file__)
 | 
			
		||||
        # file = QFile(currentDir+"/mocaphelperui.ui")
 | 
			
		||||
        # file.open(QFile.ReadOnly)
 | 
			
		||||
        try:
 | 
			
		||||
            self.ui = loadUi(currentDir+"/mocaphelperui.ui")
 | 
			
		||||
            # self.ui = loader.load(file, parentWidget=self) 
 | 
			
		||||
        finally:
 | 
			
		||||
            # file.close()
 | 
			
		||||
            pass
 | 
			
		||||
 | 
			
		||||
        layout = QVBoxLayout()
 | 
			
		||||
        layout.addWidget(self.ui)
 | 
			
		||||
        layout.setContentsMargins(0, 0, 0, 0)
 | 
			
		||||
        layout.setSpacing(0)
 | 
			
		||||
        self.setLayout(layout)
 | 
			
		||||
 | 
			
		||||
    #sac:
 | 
			
		||||
    def initSac(self):
 | 
			
		||||
 | 
			
		||||
        self.ui.sac_itEdit.textEdited.connect(self.on_sac_itEditEdited)
 | 
			
		||||
        self.ui.sac_inEdit.textEdited.connect(self.on_sac_inEditEdited)
 | 
			
		||||
        self.ui.sac_utCheckBox.stateChanged.connect(self.on_sac_utCheckBoxChanged)
 | 
			
		||||
        self.ui.sac_tuEdit.textEdited.connect(self.on_sac_tuEditEdited)
 | 
			
		||||
        self.ui.sac_selTypeComboBox.activated[str].connect(self.on_sac_selTypeComboBoxChanged)
 | 
			
		||||
        self.ui.sac_smoothMethodComboBox.activated[str].connect(self.on_sac_smoothMethodComboBoxChanged)
 | 
			
		||||
        self.ui.sac_cmdButton.clicked.connect(self.on_sac_cmdButtonClicked)
 | 
			
		||||
 | 
			
		||||
    def on_sac_itEditEdited(self):
 | 
			
		||||
        self.sac_iteration = int(eval(self.ui.sac_itEdit.text()))
 | 
			
		||||
    
 | 
			
		||||
    def on_sac_inEditEdited(self):
 | 
			
		||||
        self.sac_intensity = float(eval(self.ui.sac_inEdit.text()))
 | 
			
		||||
 | 
			
		||||
    def on_sac_utCheckBoxChanged(self):
 | 
			
		||||
        self.sac_useTime = self.ui.sac_utCheckBox.isChecked()
 | 
			
		||||
 | 
			
		||||
    def on_sac_tuEditEdited(self):
 | 
			
		||||
        self.sac_timeUnit = float(eval(self.ui.sac_tuEdit.text()))
 | 
			
		||||
 | 
			
		||||
    def on_sac_selTypeComboBoxChanged(self, text):
 | 
			
		||||
        self.sac_selType = text
 | 
			
		||||
    
 | 
			
		||||
    def on_sac_smoothMethodComboBoxChanged(self, text):
 | 
			
		||||
        self.sac_method = text
 | 
			
		||||
 | 
			
		||||
    def on_sac_cmdButtonClicked(self):
 | 
			
		||||
        seltype = 0
 | 
			
		||||
 | 
			
		||||
        if self.sac_selType == 'selected keys' :
 | 
			
		||||
            seltype = 1
 | 
			
		||||
 | 
			
		||||
        cmds.moCapHelper_smoothAniCurve( method = self.sac_method , i = self.sac_iteration , intensity = self.sac_intensity , sel = seltype , u = self.sac_useTime , tu = self.sac_timeUnit )
 | 
			
		||||
 | 
			
		||||
    #fa:
 | 
			
		||||
    def initFa(self):
 | 
			
		||||
 | 
			
		||||
        self.ui.fa_assignButton.clicked.connect(self.on_fa_assignButtonClicked)
 | 
			
		||||
        self.ui.fa_cmdButton.clicked.connect(self.on_fa_cmdButtonClicked)
 | 
			
		||||
        self.ui.fa_fastRecordButton.clicked.connect(self.on_fa_fastRecordButtonClicked)
 | 
			
		||||
 | 
			
		||||
    def on_fa_assignButtonClicked(self):
 | 
			
		||||
        curnode = mocaphelperutility.getSelectedNodes()[0]
 | 
			
		||||
        self.ui.fa_refEdit.setText(curnode)
 | 
			
		||||
 | 
			
		||||
    def on_fa_cmdButtonClicked(self):
 | 
			
		||||
        if self.ui.fa_refEdit.text() =="":
 | 
			
		||||
            raise Exception("no ref obj in ui!")
 | 
			
		||||
        else:
 | 
			
		||||
            #cmds.moCapHelper_frameAlign(ref = self.fa_refobjs)
 | 
			
		||||
            mel.eval("moCapHelper_frameAlign -ref "+self.ui.fa_refEdit.text())
 | 
			
		||||
 | 
			
		||||
    def on_fa_fastRecordButtonClicked(self):
 | 
			
		||||
        obj = mocaphelperutility.getSelectedNodes()[0]
 | 
			
		||||
        loc = mocaphelperarbcore.createLoc("mocaphelper_fa_temp_loc")[0]
 | 
			
		||||
        cmds.setKeyframe(loc,at = ["tx"])
 | 
			
		||||
        self.ui.fa_refEdit.setText(obj)
 | 
			
		||||
        mocaphelperutility.selectNodes(loc)
 | 
			
		||||
        self.on_fa_cmdButtonClicked()
 | 
			
		||||
        self.ui.fa_refEdit.setText(loc)
 | 
			
		||||
 | 
			
		||||
    #re:
 | 
			
		||||
    def initre(self):
 | 
			
		||||
        currentDir = os.path.dirname(__file__)
 | 
			
		||||
        self.re_presetFilePath = currentDir+"\\re_exp_preset.txt"
 | 
			
		||||
        self.re_backupPresetFilePath = currentDir+"\\re_exp_preset_backup.txt"
 | 
			
		||||
        if os.path.exists(self.re_presetFilePath) == False:
 | 
			
		||||
            mocaphelperrecore.presetfileRebuild(self.re_presetFilePath,self.re_backupPresetFilePath)
 | 
			
		||||
 | 
			
		||||
        self.ui.re_expPresetComboBox.currentIndexChanged.connect(self.on_re_expPresetComboBoxChanged)
 | 
			
		||||
        self.re_reloadPreset()
 | 
			
		||||
 | 
			
		||||
        self.ui.re_reloadButton.clicked.connect(self.on_re_reloadButtonClicked)
 | 
			
		||||
        self.ui.re_openFileButton.clicked.connect(self.on_re_openFileButtonClicked)
 | 
			
		||||
        self.ui.re_assignButton.clicked.connect(self.on_re_assignButtonClicked)
 | 
			
		||||
        self.ui.re_recordButton.clicked.connect(self.on_re_recordButtonClicked)
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        self.ui.re_layerNameEdit.setText("layername")
 | 
			
		||||
        self.ui.re_prefixEdit.textChanged.connect(self.on_re_layerPrefixEditEdited)
 | 
			
		||||
        self.ui.re_prefixEdit.textEdited.connect(self.on_re_layerPrefixEditEdited)
 | 
			
		||||
        self.ui.re_layerNameEdit.textChanged.connect(self.on_re_layerNameEditEdited)
 | 
			
		||||
        self.ui.re_layerNameEdit.textEdited.connect(self.on_re_layerNameEditEdited)
 | 
			
		||||
 | 
			
		||||
        self.ui.re_expEdit.textChanged.connect(self.on_re_expEditEdited)
 | 
			
		||||
        self.ui.re_expEdit.textEdited.connect(self.on_re_expEditEdited)
 | 
			
		||||
        self.ui.re_selectMainCtrlButton.clicked.connect(self.on_re_selectMainCtrlButtonClicked)
 | 
			
		||||
        self.ui.re_selectChildButton.clicked.connect(self.on_re_selectChildButtonClicked)
 | 
			
		||||
        self.ui.re_selectChildCtrlButton.clicked.connect(self.on_re_selectChildCtrlButtonClicked)
 | 
			
		||||
        self.ui.re_selectVisChildCtrlButton.clicked.connect(self.on_re_selectVisChildCtrlButtonClicked)
 | 
			
		||||
        self.ui.re_expSelectButton.clicked.connect(self.on_re_expSelectButtonClicked)
 | 
			
		||||
        self.ui.re_expCreateLayerButton.clicked.connect(self.on_re_expcreateLayerButtonClicked)
 | 
			
		||||
        self.ui.re_selectedCreateLayerButton.clicked.connect(self.on_re_selcreateLayerButtonClicked)
 | 
			
		||||
        self.ui.re_caseCheckCheckBox.stateChanged.connect(self.on_re_caseCheckCheckBoxChanged)
 | 
			
		||||
        self.ui.re_extractLayerInfoButton.clicked.connect(self.on_re_extractLayerInfoButtonClicked)
 | 
			
		||||
 | 
			
		||||
    def on_re_layerPrefixEditEdited(self):
 | 
			
		||||
        self.re_prefix = self.ui.re_prefixEdit.text()
 | 
			
		||||
 | 
			
		||||
    def on_re_layerNameEditEdited(self):
 | 
			
		||||
        self.re_name = self.ui.re_layerNameEdit.text()
 | 
			
		||||
 | 
			
		||||
    def on_re_expEditEdited(self):
 | 
			
		||||
        self.re_exp = self.ui.re_expEdit.text()
 | 
			
		||||
 | 
			
		||||
    def on_re_selectChildButtonClicked(self):
 | 
			
		||||
        selectednodes = mocaphelperutility.getSelectedNodes()
 | 
			
		||||
        children = mocaphelperutility.getChildNodes(selectednodes,nodetype="all")
 | 
			
		||||
        mocaphelperutility.selectNodes(children)
 | 
			
		||||
        print("objs selected: ",children)
 | 
			
		||||
 | 
			
		||||
    def on_re_selectChildCtrlButtonClicked(self):
 | 
			
		||||
        selectednodes = mocaphelperutility.getSelectedNodes()
 | 
			
		||||
        children = mocaphelperutility.getChildNodes(selectednodes,nodetype="nurbsCurve")
 | 
			
		||||
        mocaphelperutility.selectNodes(children)
 | 
			
		||||
        print("objs selected: ",children)
 | 
			
		||||
 | 
			
		||||
    def on_re_selectVisChildCtrlButtonClicked(self):
 | 
			
		||||
        selectednodes = mocaphelperutility.getSelectedNodes()
 | 
			
		||||
        children = mocaphelperutility.getChildNodes(selectednodes,nodetype="nurbsCurve")
 | 
			
		||||
        mocaphelperutility.selectNodes(children,visible=True)
 | 
			
		||||
        print("objs selected: ",children)
 | 
			
		||||
 | 
			
		||||
    def on_re_selectMainCtrlButtonClicked(self):
 | 
			
		||||
        mocaphelperrecore.selMainCtrl()
 | 
			
		||||
 | 
			
		||||
    def on_re_expSelectButtonClicked(self):
 | 
			
		||||
        actOnType = getReActOnType(self)
 | 
			
		||||
        childcheck = self.ui.re_childCheckBox.isChecked()
 | 
			
		||||
        seltednodes = mocaphelperutility.getSelectedNodes()
 | 
			
		||||
        if childcheck:
 | 
			
		||||
            ctrls = mocaphelperutility.getChildNodes(seltednodes,nodetype=actOnType)
 | 
			
		||||
        else:
 | 
			
		||||
            ctrls = seltednodes
 | 
			
		||||
        matchlist = mocaphelperrecore.retestlist(ctrls,self.re_exp,self.re_caseCheck)
 | 
			
		||||
        mocaphelperutility.selectNodes(matchlist)
 | 
			
		||||
        print("objs selected: ",matchlist)
 | 
			
		||||
 | 
			
		||||
    def on_re_selcreateLayerButtonClicked(self):
 | 
			
		||||
        sel = mocaphelperutility.getSelectedNodes()
 | 
			
		||||
        mocaphelperrecore.createDisplayLayer(self.re_prefix+self.re_name,sel)
 | 
			
		||||
 | 
			
		||||
    def on_re_expcreateLayerButtonClicked(self):
 | 
			
		||||
        actOnType = getReActOnType(self)
 | 
			
		||||
        childcheck = self.ui.re_childCheckBox.isChecked()
 | 
			
		||||
        mocaphelperutility.openUndoChunk()
 | 
			
		||||
        try:
 | 
			
		||||
 | 
			
		||||
            mocaphelperrecore.expCreateDisplayLayer(self.re_exp,self.re_name,self.re_prefix,self.re_caseCheck,childcheck = childcheck ,nodetype = actOnType)
 | 
			
		||||
        finally:
 | 
			
		||||
            mocaphelperutility.closeUndoChunk()
 | 
			
		||||
    def on_re_extractLayerInfoButtonClicked(self):
 | 
			
		||||
        mocaphelperrecore.extractLayerInfo(self)
 | 
			
		||||
 | 
			
		||||
    def on_re_caseCheckCheckBoxChanged(self):
 | 
			
		||||
        self.re_caseCheck = self.ui.re_caseCheckCheckBox.isChecked()
 | 
			
		||||
 | 
			
		||||
    def on_re_expPresetComboBoxChanged(self):
 | 
			
		||||
        pass
 | 
			
		||||
 | 
			
		||||
    def on_re_assignButtonClicked(self):
 | 
			
		||||
        index = self.ui.re_expPresetComboBox.currentIndex()
 | 
			
		||||
        self.ui.re_layerNameEdit.setText(self.re_itemlist[index][0])
 | 
			
		||||
        self.ui.re_expEdit.setText(self.re_itemlist[index][1])
 | 
			
		||||
 | 
			
		||||
    def on_re_recordButtonClicked(self):
 | 
			
		||||
        self.re_rawstr = mocaphelperrecore.strAppend(self.re_rawstr,self.re_name,self.re_exp)
 | 
			
		||||
        self.re_itemlist = mocaphelperrecore.rawStrBuild(self.re_rawstr)
 | 
			
		||||
        mocaphelperrecore.presetfileRebuild(self.re_presetFilePath,self.re_backupPresetFilePath)
 | 
			
		||||
        mocaphelperrecore.presetFileWrite(self.re_presetFilePath,self.re_rawstr)
 | 
			
		||||
        self.re_reloadPreset()
 | 
			
		||||
 | 
			
		||||
    def on_re_openFileButtonClicked(self):
 | 
			
		||||
        os.startfile(self.re_presetFilePath)
 | 
			
		||||
 | 
			
		||||
    def on_re_reloadButtonClicked(self):
 | 
			
		||||
        self.re_reloadPreset()
 | 
			
		||||
 | 
			
		||||
    def re_expPresetComboBoxRebuild(self):
 | 
			
		||||
        self.ui.re_expPresetComboBox.clear()
 | 
			
		||||
        for item in self.re_itemlist:
 | 
			
		||||
            convertedstr = "\""+item[0]+"\"\""+item[1]+"\""
 | 
			
		||||
            self.ui.re_expPresetComboBox.addItem( convertedstr )
 | 
			
		||||
        self.ui.re_expPresetComboBox.setCurrentIndex(0)
 | 
			
		||||
 | 
			
		||||
    def re_reloadPreset(self):
 | 
			
		||||
        if os.path.exists(self.re_presetFilePath) == False:
 | 
			
		||||
            mocaphelperrecore.presetfileRebuild(self.re_presetFilePath,self.re_backupPresetFilePath)
 | 
			
		||||
        self.re_rawstr =  mocaphelperrecore.presetFileRead(self.re_presetFilePath)
 | 
			
		||||
        self.re_itemlist = mocaphelperrecore.rawStrBuild(self.re_rawstr)
 | 
			
		||||
        self.re_expPresetComboBoxRebuild()
 | 
			
		||||
 | 
			
		||||
    # arb:
 | 
			
		||||
    def intiArb(self):
 | 
			
		||||
        # timerange
 | 
			
		||||
        self.ui.arb_setFromButton.clicked.connect(self.arb_setFrom)
 | 
			
		||||
        self.ui.arb_setToButton.clicked.connect(self.arb_setTo)
 | 
			
		||||
        self.ui.arb_syncRangeButton.clicked.connect(self.arb_syncRange)
 | 
			
		||||
        self.ui.arb_delInRangeButton.clicked.connect(self.on_arb_delInRangeButtonClicked)
 | 
			
		||||
        self.ui.arb_delOutRangeButton.clicked.connect(self.on_arb_delOutRangeButtonClicked)
 | 
			
		||||
        self.ui.arb_offsetFrameButton.clicked.connect(self.on_arb_offsetFrameButtonClicked)
 | 
			
		||||
        self.ui.arb_stickyDelButton.clicked.connect(self.on_arb_stickyDelButtonClicked)
 | 
			
		||||
 | 
			
		||||
        self.ui.arb_fromEdit.textChanged.connect(self.on_arb_fromEditEdited)
 | 
			
		||||
        self.ui.arb_fromEdit.textEdited.connect(self.on_arb_fromEditEdited)
 | 
			
		||||
 | 
			
		||||
        self.ui.arb_toEdit.textChanged.connect(self.on_arb_toEditEdited)
 | 
			
		||||
        self.ui.arb_toEdit.textEdited.connect(self.on_arb_toEditEdited)
 | 
			
		||||
        # basic
 | 
			
		||||
        self.ui.arb_createLocButton.clicked.connect(self.on_arb_createLocButtonClicked)
 | 
			
		||||
        self.ui.arb_rePosButton.clicked.connect(self.on_arb_rePosButtonClicked)
 | 
			
		||||
        self.ui.arb_pointConstraintButton.clicked.connect(self.on_arb_pointConstraintButtonClicked)
 | 
			
		||||
        self.ui.arb_orientConstraintButton.clicked.connect(self.on_arb_orientConstraintButtonClicked)
 | 
			
		||||
        self.ui.arb_parentConstraintButton.clicked.connect(self.on_arb_parentConstraintButtonClicked)
 | 
			
		||||
        self.ui.arb_delConstraintButton.clicked.connect(self.on_arb_delConstraintButtonClicked)
 | 
			
		||||
        self.ui.arb_bakeButton.clicked.connect(self.on_arb_bakeButtonClicked)
 | 
			
		||||
        # simplebake
 | 
			
		||||
        self.ui.arb_simpleBakeAAssignButton.clicked.connect(self.on_arb_simpleBakeAAssignButtonClicked)
 | 
			
		||||
        self.ui.arb_simpleBakeBAssignButton.clicked.connect(self.on_arb_simpleBakeBAssignButtonClicked)
 | 
			
		||||
 | 
			
		||||
        self.ui.arb_simpleBakeToLocButton.clicked.connect(self.on_arb_simpleBakeToLocButtonClicked)
 | 
			
		||||
        self.ui.arb_simpleBakeAToBButton.clicked.connect(self.on_arb_simpleBakeAToBButtonClicked)
 | 
			
		||||
        self.ui.arb_simpleBakeBToAButton.clicked.connect(self.on_arb_simpleBakeBToAButtonClicked)
 | 
			
		||||
        # fk2ik
 | 
			
		||||
 | 
			
		||||
        self.ui.arb_fk2ikEndCtrlAssignButton.clicked.connect(self.on_arb_fk2ikEndCtrlAssignButtonClicked)
 | 
			
		||||
        self.ui.arb_fk2ikCtrlRefAssignButton.clicked.connect(self.on_arb_fk2ikCtrlRefAssignButtonClicked)
 | 
			
		||||
        self.ui.arb_fk2ikTwistAssignButton.clicked.connect(self.on_arb_fk2ikTwistAssignButtonClicked)
 | 
			
		||||
        self.ui.arb_fk2ikTwistRefAssignButton.clicked.connect(self.on_arb_fk2ikTwistRefAssignButtonClicked)
 | 
			
		||||
        self.ui.arb_fk2ikConvertButton.clicked.connect(self.on_arb_fk2ikConvertButtonClicked)
 | 
			
		||||
 | 
			
		||||
        # pinpos
 | 
			
		||||
        self.ui.arb_pinPosPinCurButton.clicked.connect(self.on_arb_pinPosPinCurButtonClicked)
 | 
			
		||||
        self.ui.arb_pinPosPinParentButton.clicked.connect(self.on_arb_pinPosPinParentButtonClicked)
 | 
			
		||||
 | 
			
		||||
        self.arb_syncRange()
 | 
			
		||||
        
 | 
			
		||||
    def on_arb_fromEditEdited(self):
 | 
			
		||||
        print("setfrom:",eval(self.ui.arb_fromEdit.text()))
 | 
			
		||||
        self.arb_fromtime = float(eval(self.ui.arb_fromEdit.text()))
 | 
			
		||||
 | 
			
		||||
    def on_arb_toEditEdited(self):
 | 
			
		||||
        print("setto:",eval(self.ui.arb_toEdit.text()))
 | 
			
		||||
        self.arb_totime = float(eval(self.ui.arb_toEdit.text()))
 | 
			
		||||
        # print("setto:",self.ui.arb_toEdit.text(),self.arb_totime)
 | 
			
		||||
 | 
			
		||||
    def arb_syncRange(self):
 | 
			
		||||
        timerange = mocaphelperutility.getTimeRange()
 | 
			
		||||
        print("syncrangeresult:",timerange)
 | 
			
		||||
        self.ui.arb_fromEdit.setText(str(timerange[0]))
 | 
			
		||||
        self.ui.arb_toEdit.setText(str(timerange[1]))
 | 
			
		||||
 | 
			
		||||
    def arb_setFrom(self):
 | 
			
		||||
        time = mocaphelperutility.getCurrentFrame()
 | 
			
		||||
        self.ui.arb_fromEdit.setText(str(time))
 | 
			
		||||
 | 
			
		||||
    def arb_setTo(self):
 | 
			
		||||
        time = mocaphelperutility.getCurrentFrame()
 | 
			
		||||
        self.ui.arb_toEdit.setText(str(time))
 | 
			
		||||
 | 
			
		||||
    def on_arb_delInRangeButtonClicked(self):
 | 
			
		||||
        objs = mocaphelperutility.getSelectedNodes()
 | 
			
		||||
        print("delete inrange",self.arb_fromtime,self.arb_totime)
 | 
			
		||||
        mocaphelperarbcore.deleteInrange(objs,self.arb_fromtime,self.arb_totime)
 | 
			
		||||
 | 
			
		||||
    def on_arb_delOutRangeButtonClicked(self):
 | 
			
		||||
        if self.arb_fromtime>self.arb_totime:
 | 
			
		||||
            raise Exception("fromtime > totime")
 | 
			
		||||
        else:
 | 
			
		||||
            objs = mocaphelperutility.getSelectedNodes()
 | 
			
		||||
            print("delete outrange",self.arb_fromtime,self.arb_totime)
 | 
			
		||||
            mocaphelperarbcore.deleteOutrange(objs,self.arb_fromtime,self.arb_totime)
 | 
			
		||||
 | 
			
		||||
    def on_arb_offsetFrameButtonClicked(self):
 | 
			
		||||
        if self.arb_fromtime==self.arb_totime:
 | 
			
		||||
            raise Exception("fromtime == totime")
 | 
			
		||||
        else:
 | 
			
		||||
            offsettime = self.arb_totime-self.arb_fromtime 
 | 
			
		||||
            objs = mocaphelperutility.getSelectedNodes()
 | 
			
		||||
            mocaphelperarbcore.offsetFrame(objs,offsettime)
 | 
			
		||||
 | 
			
		||||
    def on_arb_stickyDelButtonClicked(self):
 | 
			
		||||
        mocaphelperarbcore.stickyDelete(self)
 | 
			
		||||
    
 | 
			
		||||
    def on_arb_createLocButtonClicked(self):
 | 
			
		||||
        objs = mocaphelperutility.getSelectedNodes()
 | 
			
		||||
        if len(objs) == 0:
 | 
			
		||||
            cmds.warning("No nodes selected")
 | 
			
		||||
            return
 | 
			
		||||
        pos = mocaphelperutility.getWorldPos(objs[0])
 | 
			
		||||
        rot = mocaphelperutility.getWorldRot(objs[0])
 | 
			
		||||
        roo = mocaphelperutility.getRotOrder(objs[0])
 | 
			
		||||
        mocaphelperarbcore.createLoc("c_loc_"+objs[0],pos,rot,roo)
 | 
			
		||||
 | 
			
		||||
    def on_arb_rePosButtonClicked(self):
 | 
			
		||||
        objs = mocaphelperutility.getSelectedNodes()
 | 
			
		||||
        if len(objs) == 0:
 | 
			
		||||
            cmds.warning("No nodes selected")
 | 
			
		||||
            return
 | 
			
		||||
        mocaphelperarbcore.reposition(objs[0],objs[1])
 | 
			
		||||
 | 
			
		||||
    def on_arb_pointConstraintButtonClicked(self):
 | 
			
		||||
        objs = mocaphelperutility.getSelectedNodes()
 | 
			
		||||
        ctrlobj = objs[:-1]
 | 
			
		||||
        targetobj = objs[-1]
 | 
			
		||||
        mocaphelperarbcore.createPointConstraint(ctrlobj,targetobj,maintainoffset=self.ui.arb_maintainOffsetCheckBox.isChecked())
 | 
			
		||||
 | 
			
		||||
    def on_arb_orientConstraintButtonClicked(self):
 | 
			
		||||
        objs = mocaphelperutility.getSelectedNodes()
 | 
			
		||||
        ctrlobj = objs[:-1]
 | 
			
		||||
        targetobj = objs[-1]
 | 
			
		||||
        mocaphelperarbcore.createOrientConstraint(ctrlobj,targetobj,maintainoffset=self.ui.arb_maintainOffsetCheckBox.isChecked())
 | 
			
		||||
 | 
			
		||||
    def on_arb_parentConstraintButtonClicked(self):
 | 
			
		||||
        objs = mocaphelperutility.getSelectedNodes()
 | 
			
		||||
        ctrlobj = objs[:-1]
 | 
			
		||||
        targetobj = objs[-1]
 | 
			
		||||
        mocaphelperarbcore.createParentConstraint(ctrlobj,targetobj,maintainoffset=self.ui.arb_maintainOffsetCheckBox.isChecked())
 | 
			
		||||
 | 
			
		||||
    def on_arb_delConstraintButtonClicked(self):
 | 
			
		||||
        objs = mocaphelperutility.getSelectedNodes()
 | 
			
		||||
        mocaphelperarbcore.deleteAllConstraint(objs)
 | 
			
		||||
        # for obj in objs:
 | 
			
		||||
        #     check = mocaphelperarbcore.checkConstraint(obj)
 | 
			
		||||
        #     if check != False:
 | 
			
		||||
        #         if check[0] != None:
 | 
			
		||||
        #             mocaphelperarbcore.deleteParentConstraint(check[0],obj)
 | 
			
		||||
        #         elif check[1] != None :
 | 
			
		||||
        #             mocaphelperarbcore.deletePointConstraint(check[1],obj)
 | 
			
		||||
        #         elif check[2] != None :
 | 
			
		||||
        #             mocaphelperarbcore.deleteOrientConstraint(check[2],obj)
 | 
			
		||||
        #         else:
 | 
			
		||||
        #             raise Exception("delconstraint error: constraint list out of range!")
 | 
			
		||||
        #     else:
 | 
			
		||||
        #         point = cmds.listRelatives(obj,children = True,type = "pointConstraint")
 | 
			
		||||
        #         orient = cmds.listRelatives(obj,children = True,type = "orientConstraint")
 | 
			
		||||
 | 
			
		||||
    def on_arb_bakeButtonClicked(self):
 | 
			
		||||
        mintime = self.arb_fromtime
 | 
			
		||||
        maxtime = self.arb_totime
 | 
			
		||||
        objs = mocaphelperutility.getSelectedNodes()
 | 
			
		||||
        singleobj = objs[0]
 | 
			
		||||
        check = mocaphelperarbcore.checkConstraint(singleobj)
 | 
			
		||||
        smartbake = self.ui.arb_smartBakeCheckBox.isChecked()
 | 
			
		||||
        if len(objs) == 1 and self.ui.arb_onlyBakeConstraintCheckBox.isChecked() and check != False:
 | 
			
		||||
            type = "all"
 | 
			
		||||
            if check[0] != None:
 | 
			
		||||
                type = "parent"
 | 
			
		||||
            elif check[1] != None :
 | 
			
		||||
                type = "point"
 | 
			
		||||
            elif check[2] != None :
 | 
			
		||||
                type = "orient"    
 | 
			
		||||
        else:
 | 
			
		||||
            type = "parent"
 | 
			
		||||
        
 | 
			
		||||
        if smartbake:
 | 
			
		||||
            mocaphelperarbcore.smartbake(objs,mintime,maxtime,type)
 | 
			
		||||
        else:
 | 
			
		||||
            mocaphelperarbcore.bake(objs,mintime,maxtime,type)
 | 
			
		||||
 | 
			
		||||
    def on_arb_simpleBakeAAssignButtonClicked(self):
 | 
			
		||||
        obj = mocaphelperutility.getSelectedNodes()[0]
 | 
			
		||||
        self.ui.arb_simpleBakeAEdit.setText(obj)
 | 
			
		||||
 | 
			
		||||
    def on_arb_simpleBakeBAssignButtonClicked(self):
 | 
			
		||||
        obj = mocaphelperutility.getSelectedNodes()[0]
 | 
			
		||||
        self.ui.arb_simpleBakeBEdit.setText(obj)
 | 
			
		||||
 | 
			
		||||
    def on_arb_simpleBakeToLocButtonClicked(self):
 | 
			
		||||
        mintime = self.arb_fromtime
 | 
			
		||||
        maxtime = self.arb_totime
 | 
			
		||||
        targetA = self.ui.arb_simpleBakeAEdit.text()
 | 
			
		||||
        mocaphelperutility.openUndoChunk()
 | 
			
		||||
        try:
 | 
			
		||||
            
 | 
			
		||||
            # obj = mocaphelperutility.getSelectedNodes()[0]
 | 
			
		||||
            locA = mocaphelperarbcore.createLoc(targetA +"_loc")
 | 
			
		||||
            mocaphelperarbcore.createParentConstraint(targetA,locA,False)
 | 
			
		||||
            mocaphelperarbcore.bake(locA,mintime,maxtime,"all")
 | 
			
		||||
            mocaphelperarbcore.deleteAllConstraint(locA)
 | 
			
		||||
            self.ui.arb_simpleBakeBEdit.setText(locA[0])
 | 
			
		||||
 | 
			
		||||
        finally:
 | 
			
		||||
            mocaphelperutility.closeUndoChunk()
 | 
			
		||||
 | 
			
		||||
    def on_arb_simpleBakeAToBButtonClicked(self):
 | 
			
		||||
        targetA = self.ui.arb_simpleBakeAEdit.text()
 | 
			
		||||
        targetB = self.ui.arb_simpleBakeBEdit.text()
 | 
			
		||||
        maintainoffset=self.ui.arb_maintainOffsetCheckBox.isChecked()
 | 
			
		||||
        mocaphelperutility.openUndoChunk()
 | 
			
		||||
        try:
 | 
			
		||||
            check = mocaphelperarbcore.checkConstraint(targetB)
 | 
			
		||||
            if check != False:
 | 
			
		||||
                raise Exception("obj B has constraint already!")
 | 
			
		||||
            else:
 | 
			
		||||
                mintime = self.arb_fromtime
 | 
			
		||||
                maxtime = self.arb_totime
 | 
			
		||||
                type = getArbType(self)
 | 
			
		||||
                mocaphelperarbcore.bakeAtoB(targetA,targetB,mintime,maxtime,type,maintainoffset,smart = self.ui.arb_smartBakeCheckBox.isChecked())
 | 
			
		||||
 | 
			
		||||
        finally:
 | 
			
		||||
            mocaphelperutility.closeUndoChunk()
 | 
			
		||||
 | 
			
		||||
    def on_arb_simpleBakeBToAButtonClicked(self):
 | 
			
		||||
        targetA = self.ui.arb_simpleBakeAEdit.text()
 | 
			
		||||
        targetB = self.ui.arb_simpleBakeBEdit.text()
 | 
			
		||||
        maintainoffset=self.ui.arb_maintainOffsetCheckBox.isChecked()
 | 
			
		||||
        mocaphelperutility.openUndoChunk()
 | 
			
		||||
        try:
 | 
			
		||||
            check = mocaphelperarbcore.checkConstraint(targetA)
 | 
			
		||||
            if check != False:
 | 
			
		||||
                raise Exception("obj A has constraint already!")
 | 
			
		||||
            else:
 | 
			
		||||
                mintime = self.arb_fromtime
 | 
			
		||||
                maxtime = self.arb_totime
 | 
			
		||||
                type = getArbType(self)
 | 
			
		||||
                mocaphelperarbcore.bakeAtoB(targetB,targetA,mintime,maxtime,type,maintainoffset,smart = self.ui.arb_smartBakeCheckBox.isChecked())
 | 
			
		||||
        finally:
 | 
			
		||||
            mocaphelperutility.closeUndoChunk()
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
    def on_arb_fk2ikEndCtrlAssignButtonClicked(self):
 | 
			
		||||
        obj = mocaphelperutility.getSelectedNodes()[0]
 | 
			
		||||
        self.ui.arb_fk2ikEndCtrlEdit.setText(obj)
 | 
			
		||||
 | 
			
		||||
    def on_arb_fk2ikCtrlRefAssignButtonClicked(self):
 | 
			
		||||
        obj = mocaphelperutility.getSelectedNodes()[0]
 | 
			
		||||
        self.ui.arb_fk2ikCtrlRefEdit.setText(obj)
 | 
			
		||||
 | 
			
		||||
    def on_arb_fk2ikTwistAssignButtonClicked(self):
 | 
			
		||||
        obj = mocaphelperutility.getSelectedNodes()[0]
 | 
			
		||||
        self.ui.arb_fk2ikTwistEdit.setText(obj)
 | 
			
		||||
 | 
			
		||||
    def on_arb_fk2ikTwistRefAssignButtonClicked(self):
 | 
			
		||||
        obj = mocaphelperutility.getSelectedNodes()[0]
 | 
			
		||||
        self.ui.arb_fk2ikTwistRefEdit.setText(obj)
 | 
			
		||||
 | 
			
		||||
    def on_arb_fk2ikConvertButtonClicked(self):
 | 
			
		||||
        mintime = self.arb_fromtime
 | 
			
		||||
        maxtime = self.arb_totime
 | 
			
		||||
        maintainoffset=self.ui.arb_maintainOffsetCheckBox.isChecked()
 | 
			
		||||
        smartbake = self.ui.arb_smartBakeCheckBox.isChecked()
 | 
			
		||||
        endctrl = self.ui.arb_fk2ikEndCtrlEdit.text()
 | 
			
		||||
        ctrlref = self.ui.arb_fk2ikCtrlRefEdit.text()
 | 
			
		||||
        twist = self.ui.arb_fk2ikTwistEdit.text()
 | 
			
		||||
        twistref = self.ui.arb_fk2ikTwistRefEdit.text()
 | 
			
		||||
        mocaphelperutility.openUndoChunk()
 | 
			
		||||
        try:
 | 
			
		||||
            if mocaphelperutility.objExist(endctrl) == False:
 | 
			
		||||
                endctrl = ""
 | 
			
		||||
            if mocaphelperutility.objExist(ctrlref) == False:
 | 
			
		||||
                ctrlref = ""
 | 
			
		||||
            if mocaphelperutility.objExist(twist) == False:
 | 
			
		||||
                twist = ""
 | 
			
		||||
            if mocaphelperutility.objExist(twistref) == False:
 | 
			
		||||
                twistref = ""
 | 
			
		||||
 | 
			
		||||
            check = mocaphelperarbcore.checkConstraint(endctrl)
 | 
			
		||||
            if check != False:
 | 
			
		||||
                raise Exception("endctrl has constraint already!")
 | 
			
		||||
            if mocaphelperutility.objExist(twist) == True:
 | 
			
		||||
                check = mocaphelperarbcore.checkConstraint(twist)
 | 
			
		||||
            if check != False:
 | 
			
		||||
                raise Exception("twist has constraint already!")
 | 
			
		||||
 | 
			
		||||
            if endctrl== "" or ctrlref =="":
 | 
			
		||||
                raise Exception("endctrl or ctrlref not set or not exist")
 | 
			
		||||
            else:
 | 
			
		||||
                if twist == "" or twistref == "":
 | 
			
		||||
 | 
			
		||||
                    mocaphelperarbcore.bakeAtoB(ctrlref,endctrl,mintime,maxtime,"parent",maintainoffset,smartbake)
 | 
			
		||||
                else:
 | 
			
		||||
                    mocaphelperarbcore.bakeAtoB(ctrlref,endctrl,mintime,maxtime,"parent",maintainoffset,smartbake)
 | 
			
		||||
 | 
			
		||||
                    twistpos = mocaphelperutility.getWorldPos(twist)
 | 
			
		||||
                    twistrot = mocaphelperutility.getWorldRot(twist)
 | 
			
		||||
                    twistroo = mocaphelperutility.getRotOrder(twist)
 | 
			
		||||
                    twistloc = mocaphelperarbcore.createLoc("temp_twist_loc",twistpos,twistrot,twistroo)
 | 
			
		||||
                    cons1 = mocaphelperarbcore.createParentConstraint(twistref,twistloc,True)
 | 
			
		||||
                    cons2 = mocaphelperarbcore.createPointConstraint(twistloc,twist,False)
 | 
			
		||||
                    if smartbake:
 | 
			
		||||
                        mocaphelperarbcore.smartbake(twist,mintime,maxtime,"point")
 | 
			
		||||
                    else:
 | 
			
		||||
                        mocaphelperarbcore.bake(twist,mintime,maxtime,"point")
 | 
			
		||||
                        
 | 
			
		||||
                    mocaphelperutility.deleteObj(cons1)
 | 
			
		||||
                    mocaphelperutility.deleteObj(cons2)
 | 
			
		||||
                    mocaphelperutility.deleteObj(twistloc)
 | 
			
		||||
 | 
			
		||||
        finally:
 | 
			
		||||
            mocaphelperutility.closeUndoChunk()
 | 
			
		||||
 | 
			
		||||
    def on_arb_pinPosPinCurButtonClicked(self):
 | 
			
		||||
        mintime = self.arb_fromtime
 | 
			
		||||
        maxtime = self.arb_totime
 | 
			
		||||
        mocaphelperutility.openUndoChunk()
 | 
			
		||||
        try:
 | 
			
		||||
 | 
			
		||||
            objs = mocaphelperutility.getSelectedNodes()
 | 
			
		||||
            mocaphelperarbcore.pinCurPos(objs,mintime,maxtime)
 | 
			
		||||
        finally:
 | 
			
		||||
            mocaphelperutility.closeUndoChunk()
 | 
			
		||||
 | 
			
		||||
    def on_arb_pinPosPinParentButtonClicked(self):
 | 
			
		||||
        mintime = self.arb_fromtime
 | 
			
		||||
        maxtime = self.arb_totime
 | 
			
		||||
        mocaphelperutility.openUndoChunk()
 | 
			
		||||
        try:
 | 
			
		||||
            objs = mocaphelperutility.getSelectedNodes()
 | 
			
		||||
            mocaphelperarbcore.pinParentPos(objs,mintime,maxtime)
 | 
			
		||||
        finally:
 | 
			
		||||
            mocaphelperutility.closeUndoChunk()
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
def getArbType(obj):
 | 
			
		||||
    index = obj.ui.arb_simpleBakeTypeComboBox.currentIndex()
 | 
			
		||||
    # type = mocaphelperutility.unicodeToStr(type)
 | 
			
		||||
    # enList = ["all","parent","point","orient","onlyscale"]
 | 
			
		||||
    # cnList = ["平移旋转","平移","旋转","所有属性"]
 | 
			
		||||
    type = None
 | 
			
		||||
    if index == 0:
 | 
			
		||||
        type = "all"
 | 
			
		||||
 | 
			
		||||
    elif index == 1:
 | 
			
		||||
        type = "parent"
 | 
			
		||||
 | 
			
		||||
    elif index == 2:
 | 
			
		||||
        type = "point"
 | 
			
		||||
 | 
			
		||||
    elif index == 3:
 | 
			
		||||
        type = "orient"
 | 
			
		||||
 | 
			
		||||
    else:
 | 
			
		||||
        raise Exception("id out of range")
 | 
			
		||||
    print("index is now:",index,".type is now:",type)
 | 
			
		||||
 | 
			
		||||
    return type
 | 
			
		||||
 | 
			
		||||
def getReActOnType(obj):
 | 
			
		||||
    index = obj.ui.re_actTypeComboBox.currentIndex()
 | 
			
		||||
 | 
			
		||||
    type = None
 | 
			
		||||
    if index == 0:
 | 
			
		||||
        type = "all"
 | 
			
		||||
 | 
			
		||||
    elif index == 1:
 | 
			
		||||
        type = "nurbsCurve"
 | 
			
		||||
 | 
			
		||||
    print("index is now:",index,".type is now:",type)
 | 
			
		||||
    return type
 | 
			
		||||
							
								
								
									
										1512
									
								
								Scripts/Animation/MotionCapHelper/bin/mocaphelperui.ui
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1512
									
								
								Scripts/Animation/MotionCapHelper/bin/mocaphelperui.ui
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										136
									
								
								Scripts/Animation/MotionCapHelper/bin/mocaphelperutility.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										136
									
								
								Scripts/Animation/MotionCapHelper/bin/mocaphelperutility.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,136 @@
 | 
			
		||||
import maya.api.OpenMaya as om
 | 
			
		||||
import maya.cmds as cmds
 | 
			
		||||
import maya.mel as mel
 | 
			
		||||
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
from sys import version as sysver
 | 
			
		||||
 | 
			
		||||
def getPythonVersion():
 | 
			
		||||
    return int(sysver[0])
 | 
			
		||||
 | 
			
		||||
def selectNodes(nodelist,visible = False):
 | 
			
		||||
    cmds.select(cl=True)
 | 
			
		||||
    if visible == True:
 | 
			
		||||
        cmds.select(nodelist,vis = True)
 | 
			
		||||
    else:
 | 
			
		||||
        cmds.select(nodelist)
 | 
			
		||||
 | 
			
		||||
def addSelectNodes(nodelist):
 | 
			
		||||
    for node in nodelist:
 | 
			
		||||
        cmds.select(node,add = True)
 | 
			
		||||
 | 
			
		||||
def orderSelectNodes(nodelist):
 | 
			
		||||
    cmds.select(cl=True)
 | 
			
		||||
    for node in nodelist:
 | 
			
		||||
        cmds.select(node,add = True)
 | 
			
		||||
 | 
			
		||||
def getSelectedNodes(nodetype = "all",longname = True):
 | 
			
		||||
    selectednodes = cmds.ls(selection = True,type = "dagNode",long = longname)
 | 
			
		||||
    if nodetype != "all":
 | 
			
		||||
        selectednodes = filterCertainTypeInList(selectednodes,nodetype)
 | 
			
		||||
    return selectednodes
 | 
			
		||||
 | 
			
		||||
def getChildNodes(parents,nodetype = "all",combine = True):
 | 
			
		||||
    list = []
 | 
			
		||||
 | 
			
		||||
    for parent in parents:
 | 
			
		||||
        childlist = cmds.listRelatives(parent, ad=True, type = "transform",fullPath = True)
 | 
			
		||||
 | 
			
		||||
        if childlist == None:
 | 
			
		||||
            continue
 | 
			
		||||
        else:
 | 
			
		||||
            if nodetype == "all":
 | 
			
		||||
                list += childlist
 | 
			
		||||
 | 
			
		||||
            else:
 | 
			
		||||
                list += filterCertainTypeInList(childlist,nodetype)
 | 
			
		||||
        
 | 
			
		||||
    if list != None:
 | 
			
		||||
        if combine == True:
 | 
			
		||||
            return list+parents
 | 
			
		||||
        else:
 | 
			
		||||
            return list
 | 
			
		||||
    else:
 | 
			
		||||
        raise Exception("error when getting child")
 | 
			
		||||
 | 
			
		||||
def filterCertainTypeInList(list,type = "nurbsCurve"):
 | 
			
		||||
    matchlist = []
 | 
			
		||||
    for node in list:
 | 
			
		||||
        if getShapeType(node) == type:
 | 
			
		||||
            matchlist.append(node)
 | 
			
		||||
        
 | 
			
		||||
    return matchlist
 | 
			
		||||
 | 
			
		||||
def getShapeType( node = "" ):
 | 
			
		||||
    shape = cmds.listRelatives(node,shapes = True,fullPath = True)
 | 
			
		||||
    if shape != None:
 | 
			
		||||
        shape = shape[0]
 | 
			
		||||
        return cmds.nodeType(shape)
 | 
			
		||||
    else:
 | 
			
		||||
        return None
 | 
			
		||||
 | 
			
		||||
def objExist(obj):
 | 
			
		||||
    if len(cmds.ls(obj)) == 0:
 | 
			
		||||
        return False
 | 
			
		||||
    else:
 | 
			
		||||
        return True
 | 
			
		||||
    
 | 
			
		||||
def getCurrentFrame():
 | 
			
		||||
    return cmds.currentTime(q = True)
 | 
			
		||||
 | 
			
		||||
def getTimeRange(local = False):
 | 
			
		||||
    #local means time slider range in maya time line
 | 
			
		||||
    if local == True:
 | 
			
		||||
        return cmds.playbackOptions(q = True,min = True),cmds.playbackOptions(q = True,max = True)
 | 
			
		||||
    else:
 | 
			
		||||
        return cmds.playbackOptions(q = True,ast = True),cmds.playbackOptions(q = True,aet = True)
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
def getWorldPos(obj):
 | 
			
		||||
    return cmds.xform(obj,q = True,ws = True,t = True)
 | 
			
		||||
 | 
			
		||||
def getWorldRot(obj):
 | 
			
		||||
    return cmds.xform(obj,q = True,ws = True,ro = True)
 | 
			
		||||
 | 
			
		||||
def getRotOrder(obj):
 | 
			
		||||
    return cmds.xform(obj,q = True,roo = True)
 | 
			
		||||
 | 
			
		||||
def setWorldPos(obj,cd = (0.0,0.0,0.0)):
 | 
			
		||||
    cmds.xform(obj,ws = True,t = cd)
 | 
			
		||||
 | 
			
		||||
def setWorldRot(obj,rot = (0.0,0.0,0.0),targetRotOrder = "xyz"):
 | 
			
		||||
    originOrder = cmds.xform(obj,q = True,roo = True)
 | 
			
		||||
    if originOrder == targetRotOrder:
 | 
			
		||||
        cmds.xform(obj,ws = True,ro = rot)
 | 
			
		||||
    else:
 | 
			
		||||
        if targetRotOrder in ['xyz', 'yzx','zxy','xzy','yxz','zyx']:
 | 
			
		||||
            cmds.xform(obj,ws = True,ro = rot,roo = targetRotOrder)
 | 
			
		||||
            cmds.xform(obj,ws = True,roo = originOrder)
 | 
			
		||||
        else:
 | 
			
		||||
            raise Exception("rot order does not exist.")
 | 
			
		||||
 | 
			
		||||
def cutKey(objlist,mintime,maxtime,insertside = False):
 | 
			
		||||
    if insertside:
 | 
			
		||||
        cmds.cutKey(objlist,t =(mintime,maxtime),cl = True,option = "curve")
 | 
			
		||||
    else:
 | 
			
		||||
        cmds.cutKey(objlist,t =(mintime,maxtime),cl = True)
 | 
			
		||||
 | 
			
		||||
def autoKetTangent(objs,mintime,maxtime):
 | 
			
		||||
    cmds.keyTangent(objs,e = True,itt="auto", ott="auto", t=(mintime,maxtime))
 | 
			
		||||
 | 
			
		||||
def deleteObj(obj):
 | 
			
		||||
    cmds.delete(obj)
 | 
			
		||||
 | 
			
		||||
def unicodeToStr(str):
 | 
			
		||||
    return repr(str)[2:-1]
 | 
			
		||||
 | 
			
		||||
def getDir():
 | 
			
		||||
    dir = os.path.dirname(__file__)
 | 
			
		||||
    return dir
 | 
			
		||||
 | 
			
		||||
def openUndoChunk():
 | 
			
		||||
    return cmds.undoInfo(openChunk=True)
 | 
			
		||||
 | 
			
		||||
def closeUndoChunk():
 | 
			
		||||
    return cmds.undoInfo(closeChunk=True)
 | 
			
		||||
							
								
								
									
										13
									
								
								Scripts/Animation/MotionCapHelper/bin/re_exp_preset.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								Scripts/Animation/MotionCapHelper/bin/re_exp_preset.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
torso
 | 
			
		||||
.ctrl.torso.
 | 
			
		||||
torso
 | 
			
		||||
.torso.ctrl.
 | 
			
		||||
l_arm
 | 
			
		||||
.ctrl.l.arm.
 | 
			
		||||
l_hand;l_arm
 | 
			
		||||
.:FKIndexFinger2_L|.:FKIndexFinger1_L|.:FKIndexFinger3_L|.:FKMiddleFinger1_L|.:FKMiddleFinger2_L|.:FKMiddleFinger3_L|.:FKRingFinger1_L|.:FKPinkyFinger1_L|.:FKPinkyFinger2_L|.:FKPinkyFinger3_L|.:FKThumbFinger2_L|.:FKThumbFinger3_L|.:FKThumbFinger1_L;.:FKElbow_L|.:FKWrist_L|.:FKShoulder_L
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
.
 | 
			
		||||
 | 
			
		||||
.
 | 
			
		||||
@@ -0,0 +1,8 @@
 | 
			
		||||
torso
 | 
			
		||||
.ctrl.torso.
 | 
			
		||||
torso
 | 
			
		||||
.torso.ctrl.
 | 
			
		||||
l_arm
 | 
			
		||||
.ctrl.l.arm.
 | 
			
		||||
r_arm
 | 
			
		||||
.l.arm.ctrl.
 | 
			
		||||
							
								
								
									
										500
									
								
								Scripts/Animation/MotionCapHelper/bin/ui.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										500
									
								
								Scripts/Animation/MotionCapHelper/bin/ui.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,500 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<!DOCTYPE TS>
 | 
			
		||||
<TS version="2.1" language="zh_CN" sourcelanguage="en">
 | 
			
		||||
<context>
 | 
			
		||||
    <name>moCapHelper</name>
 | 
			
		||||
    <message>
 | 
			
		||||
        <source>Form</source>
 | 
			
		||||
        <translation type="vanished">形状</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="81"/>
 | 
			
		||||
        <source>SAC/FA/RE</source>
 | 
			
		||||
        <oldsource>SAC/FA/DLC</oldsource>
 | 
			
		||||
        <translation>平滑曲线/对齐帧/正则</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="130"/>
 | 
			
		||||
        <source>smoothAnim</source>
 | 
			
		||||
        <translation>平滑曲线</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="151"/>
 | 
			
		||||
        <source>iteration:</source>
 | 
			
		||||
        <translation>迭代次数:</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="158"/>
 | 
			
		||||
        <source>1</source>
 | 
			
		||||
        <translation></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="165"/>
 | 
			
		||||
        <source>intensity:</source>
 | 
			
		||||
        <translation>单次强度:</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="172"/>
 | 
			
		||||
        <source>1.0</source>
 | 
			
		||||
        <translation></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="179"/>
 | 
			
		||||
        <source>use time unit</source>
 | 
			
		||||
        <translation>使用时间单位</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="189"/>
 | 
			
		||||
        <source>timeunit:</source>
 | 
			
		||||
        <translation>时间单位:</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="196"/>
 | 
			
		||||
        <source>5.0</source>
 | 
			
		||||
        <translation></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="203"/>
 | 
			
		||||
        <source>perform on:</source>
 | 
			
		||||
        <translation>作用于:</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="211"/>
 | 
			
		||||
        <source>curves</source>
 | 
			
		||||
        <translation></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="216"/>
 | 
			
		||||
        <source>selected keys</source>
 | 
			
		||||
        <translation></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="224"/>
 | 
			
		||||
        <source>smooth method:</source>
 | 
			
		||||
        <translation>平滑方法:</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="235"/>
 | 
			
		||||
        <source>3linear</source>
 | 
			
		||||
        <translation></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="240"/>
 | 
			
		||||
        <source>3bell</source>
 | 
			
		||||
        <translation></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="245"/>
 | 
			
		||||
        <source>3ham</source>
 | 
			
		||||
        <translation></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="250"/>
 | 
			
		||||
        <source>5quad</source>
 | 
			
		||||
        <translation></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="255"/>
 | 
			
		||||
        <source>5bell</source>
 | 
			
		||||
        <translation></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="260"/>
 | 
			
		||||
        <source>5ham</source>
 | 
			
		||||
        <translation></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="271"/>
 | 
			
		||||
        <source>smooth</source>
 | 
			
		||||
        <translation>平滑</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="288"/>
 | 
			
		||||
        <source>frameAlign</source>
 | 
			
		||||
        <translation>对齐帧</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="314"/>
 | 
			
		||||
        <source>fast record selected</source>
 | 
			
		||||
        <translation>快速记录选择物体的帧信息</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="328"/>
 | 
			
		||||
        <source>ref obj:</source>
 | 
			
		||||
        <translation>参考物体:</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="345"/>
 | 
			
		||||
        <source>assign obj</source>
 | 
			
		||||
        <translation>指定</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="359"/>
 | 
			
		||||
        <source>align selection</source>
 | 
			
		||||
        <translation>对齐选择</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <source>layerCreate</source>
 | 
			
		||||
        <translation type="vanished">创建显示层</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="425"/>
 | 
			
		||||
        <source>preset:</source>
 | 
			
		||||
        <translation>预设:</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="435"/>
 | 
			
		||||
        <source>open file</source>
 | 
			
		||||
        <translation>打开文件</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="445"/>
 | 
			
		||||
        <source>record</source>
 | 
			
		||||
        <translation>记录当前</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="455"/>
 | 
			
		||||
        <source>reload</source>
 | 
			
		||||
        <translation>重载文件</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="490"/>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1081"/>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1112"/>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1223"/>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1254"/>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1309"/>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1334"/>
 | 
			
		||||
        <source>assign</source>
 | 
			
		||||
        <translation>指定</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="504"/>
 | 
			
		||||
        <source>case check</source>
 | 
			
		||||
        <translation>大小写检测</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="546"/>
 | 
			
		||||
        <source>prefix:</source>
 | 
			
		||||
        <translation>前缀:</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <source>layer name:</source>
 | 
			
		||||
        <translation type="vanished">层名字:</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="592"/>
 | 
			
		||||
        <source>default</source>
 | 
			
		||||
        <translation></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="624"/>
 | 
			
		||||
        <source>expression:</source>
 | 
			
		||||
        <translation>正则表达式:</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="631"/>
 | 
			
		||||
        <source>.</source>
 | 
			
		||||
        <translation></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="693"/>
 | 
			
		||||
        <source>utility</source>
 | 
			
		||||
        <translation>工具</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <source>select child ctrls</source>
 | 
			
		||||
        <translation type="vanished">选择子控制器</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="831"/>
 | 
			
		||||
        <source>selected create layer</source>
 | 
			
		||||
        <translation>依据选集创建层</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="755"/>
 | 
			
		||||
        <source>expression</source>
 | 
			
		||||
        <translation>表达式工具</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="779"/>
 | 
			
		||||
        <source>exp select</source>
 | 
			
		||||
        <translation>表达式选择</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="821"/>
 | 
			
		||||
        <source>exp create layer</source>
 | 
			
		||||
        <translation>表达式创建层</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="789"/>
 | 
			
		||||
        <source>extract layer info</source>
 | 
			
		||||
        <translation>提取当前层信息</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="847"/>
 | 
			
		||||
        <source>ARB</source>
 | 
			
		||||
        <translation>动画重建</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <source>animRebuild</source>
 | 
			
		||||
        <translation type="vanished">动画重建</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="944"/>
 | 
			
		||||
        <source>basic</source>
 | 
			
		||||
        <translation>基础工具</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="965"/>
 | 
			
		||||
        <source>orient constraint</source>
 | 
			
		||||
        <translation>旋转约束</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1003"/>
 | 
			
		||||
        <source>delete constraint</source>
 | 
			
		||||
        <translation>删除约束</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="989"/>
 | 
			
		||||
        <source>parent constraint</source>
 | 
			
		||||
        <translation>父子约束</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1010"/>
 | 
			
		||||
        <source>bake key</source>
 | 
			
		||||
        <translation>烘焙帧</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="996"/>
 | 
			
		||||
        <source>create locator</source>
 | 
			
		||||
        <translation>创建定位器</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="912"/>
 | 
			
		||||
        <source>maintain offset</source>
 | 
			
		||||
        <translation>保持偏移</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="922"/>
 | 
			
		||||
        <source>smart bake</source>
 | 
			
		||||
        <translation>智能烘焙(慎用)</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1017"/>
 | 
			
		||||
        <source>point constraint</source>
 | 
			
		||||
        <translation>点约束</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="972"/>
 | 
			
		||||
        <source>reposition</source>
 | 
			
		||||
        <translation>重新定位</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1024"/>
 | 
			
		||||
        <source>only bake constraint</source>
 | 
			
		||||
        <translation>尝试仅烘焙约束的通道</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1038"/>
 | 
			
		||||
        <source>simpleBake</source>
 | 
			
		||||
        <translation>简易烘焙</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1067"/>
 | 
			
		||||
        <source>target A:</source>
 | 
			
		||||
        <translation>目标A:</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1098"/>
 | 
			
		||||
        <source>target B:</source>
 | 
			
		||||
        <translation>目标B:</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="671"/>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1133"/>
 | 
			
		||||
        <source>all</source>
 | 
			
		||||
        <translation>所有属性</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1123"/>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1138"/>
 | 
			
		||||
        <source>parent</source>
 | 
			
		||||
        <translation>平移旋转</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="22"/>
 | 
			
		||||
        <source>uiwindow</source>
 | 
			
		||||
        <translation>窗口</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="378"/>
 | 
			
		||||
        <source>regularExp</source>
 | 
			
		||||
        <translation>正则表达式</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="511"/>
 | 
			
		||||
        <source>children check</source>
 | 
			
		||||
        <translation>检查子级</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="585"/>
 | 
			
		||||
        <source>name:</source>
 | 
			
		||||
        <translation>名称:</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="648"/>
 | 
			
		||||
        <source>act on :</source>
 | 
			
		||||
        <translation>作用于:</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="676"/>
 | 
			
		||||
        <source>ctrl(nurbs)</source>
 | 
			
		||||
        <translation>控制器(nurbs曲线)</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="717"/>
 | 
			
		||||
        <source>select child</source>
 | 
			
		||||
        <translation>选择子级</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="727"/>
 | 
			
		||||
        <source>select main ctrls</source>
 | 
			
		||||
        <translation>选择大圈</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="737"/>
 | 
			
		||||
        <source>select child ctrl</source>
 | 
			
		||||
        <translation>选择子控制器</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="747"/>
 | 
			
		||||
        <source>select visible child ctrl</source>
 | 
			
		||||
        <translation>选择可见子控制器</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="797"/>
 | 
			
		||||
        <source>layercreate</source>
 | 
			
		||||
        <translation>创建显示层</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1143"/>
 | 
			
		||||
        <source>point</source>
 | 
			
		||||
        <translation>平移</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1148"/>
 | 
			
		||||
        <source>orient</source>
 | 
			
		||||
        <translation>旋转</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1156"/>
 | 
			
		||||
        <source>bake A into B</source>
 | 
			
		||||
        <translation>烘焙A到B</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1163"/>
 | 
			
		||||
        <source>bake B into A</source>
 | 
			
		||||
        <translation>烘焙B到A</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1172"/>
 | 
			
		||||
        <source>bake A into new locator</source>
 | 
			
		||||
        <translation>将A烘焙到空定位器</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1180"/>
 | 
			
		||||
        <source>fk2ik</source>
 | 
			
		||||
        <translation>fk转ik</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1209"/>
 | 
			
		||||
        <source>endctrl:</source>
 | 
			
		||||
        <translation>末端:</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1240"/>
 | 
			
		||||
        <source>ctrlref:</source>
 | 
			
		||||
        <translation>末端参考:</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1283"/>
 | 
			
		||||
        <source>twist:</source>
 | 
			
		||||
        <translation>方向:</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1320"/>
 | 
			
		||||
        <source>twistref:</source>
 | 
			
		||||
        <translation>方向参考:</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1343"/>
 | 
			
		||||
        <source>convert it !</source>
 | 
			
		||||
        <translation>转换!</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1351"/>
 | 
			
		||||
        <source>pinPos</source>
 | 
			
		||||
        <translation>钉位</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1357"/>
 | 
			
		||||
        <source>pin to current position</source>
 | 
			
		||||
        <translation>钉在当前帧位置</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1364"/>
 | 
			
		||||
        <source>parent to first obj position</source>
 | 
			
		||||
        <translation>快速烘焙父子约束效果</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1403"/>
 | 
			
		||||
        <source>set from</source>
 | 
			
		||||
        <translation>设置:从</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1410"/>
 | 
			
		||||
        <source>sync range</source>
 | 
			
		||||
        <translation>同步范围</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1417"/>
 | 
			
		||||
        <source>set to</source>
 | 
			
		||||
        <translation>设置:到</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1431"/>
 | 
			
		||||
        <source>from:</source>
 | 
			
		||||
        <translation>从:</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1441"/>
 | 
			
		||||
        <source>to:</source>
 | 
			
		||||
        <translation>到:</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1458"/>
 | 
			
		||||
        <source>delete inrange</source>
 | 
			
		||||
        <translation>删除范围内</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1465"/>
 | 
			
		||||
        <source>delete outrange</source>
 | 
			
		||||
        <translation>删除范围外</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1479"/>
 | 
			
		||||
        <source>offset frame</source>
 | 
			
		||||
        <translation>偏移帧</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="mocaphelperui.ui" line="1492"/>
 | 
			
		||||
        <source>sticky delete</source>
 | 
			
		||||
        <translation>提取帧</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <source>language</source>
 | 
			
		||||
        <translation type="vanished">改变语言</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
</context>
 | 
			
		||||
</TS>
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								Scripts/Animation/MotionCapHelper/bin/ui_CN.qm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Scripts/Animation/MotionCapHelper/bin/ui_CN.qm
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										23
									
								
								Scripts/Animation/MotionCapHelper/bin/安装__install.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								Scripts/Animation/MotionCapHelper/bin/安装__install.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
安装:
 | 
			
		||||
将这个文件夹的目录添加到到对应版本的maya.env文件中的MAYA_PLUG_IN_PATH这一行。
 | 
			
		||||
例子:
 | 
			
		||||
MAYA_PLUG_IN_PATH =C:\Users\(你的用户名)\Documents\maya\2018\plug-ins\MotionCapHelper
 | 
			
		||||
 | 
			
		||||
启动maya,在maya里打开插件管理器,如果出现了这个插件的名字mocaphelper.py就说明安装
 | 
			
		||||
顺利,只要勾选这一个文件的加载就好,不需要勾选其他的比如mocaphelperrecore.py等等文件
 | 
			
		||||
 | 
			
		||||
勾选后maya会载入插件,之后使用mel或者python的moCapHelper_showUi -lan "CN"指令打开插件的中文界面
 | 
			
		||||
或者moCapHelper_showUi打开英文界面(更推荐一点,因为懒得更新汉化)
 | 
			
		||||
可以把这个指令新建一个工具架的工具,方面后面调用
 | 
			
		||||
 | 
			
		||||
Installation:
 | 
			
		||||
Add the directory of this folder to the <MAYA_PLUG_IN_PATH> in the corresponding version of the maya.env file.
 | 
			
		||||
Example:
 | 
			
		||||
MAYA_PLUG_IN_PATH =C:\Users\<username>\Documents\maya\2018\plug-ins\MotionCapHelper
 | 
			
		||||
 | 
			
		||||
Start Maya, open the plugin manager in Maya, you should see a list of mocaphelper.py/mocaphelperui.py.....
 | 
			
		||||
 just check the load state of "mocaphelper.py" file only, no need to check any other files such as mocaphelperrecore.py....
 | 
			
		||||
 | 
			
		||||
After checking this box, maya will load the plug-in, and then you can use "moCapHelper_showUi" command in mel or python to open the interface of this plug-in.
 | 
			
		||||
 | 
			
		||||
You can create a new shelf tool with this command.
 | 
			
		||||
@@ -0,0 +1,12 @@
 | 
			
		||||
'''
 | 
			
		||||
this is an example of how you set hotkey or use scripts to drive this plugin's cmds.
 | 
			
		||||
if you know python and pyside2,go see codes and .ui file to find what you need.
 | 
			
		||||
the most simple usage is to drive a qt pushbutton.(which is exactly what you did when you hit a button in plugin ui.)
 | 
			
		||||
and you might need QLineEdit.setText() to set str in those text field.
 | 
			
		||||
anyway,go check qt wiki :https://doc.qt.io/qtforpython-5/PySide2/QtWidgets/QWidget.html#qwidget
 | 
			
		||||
have fun scripting.
 | 
			
		||||
'''
 | 
			
		||||
 | 
			
		||||
import maya.cmds as cmds
 | 
			
		||||
 | 
			
		||||
cmds.moCapHelper_eval(s ="ui.arb_stickyDelButton.click()" )
 | 
			
		||||
@@ -0,0 +1,15 @@
 | 
			
		||||
import maya.cmds as cmds
 | 
			
		||||
import maya.mel as mel
 | 
			
		||||
 | 
			
		||||
curlayer = cmds.editDisplayLayerGlobals( query=True, cdl=True )
 | 
			
		||||
if curlayer =="defaultLayer" :
 | 
			
		||||
    raise Exception("using default layer!")
 | 
			
		||||
else:
 | 
			
		||||
    slist = cmds.editDisplayLayerMembers(curlayer,query=True )
 | 
			
		||||
    print(slist)
 | 
			
		||||
    cmds.select( clear=True )
 | 
			
		||||
    cmds.select(slist, visible=True )
 | 
			
		||||
 | 
			
		||||
    mel.eval("syncChannelBoxFcurveEd;")
 | 
			
		||||
    mel.eval("syncChannelBoxFcurveEd;")
 | 
			
		||||
    mel.eval("syncChannelBoxFcurveEd;")
 | 
			
		||||
@@ -0,0 +1,47 @@
 | 
			
		||||
import maya.cmds as cmds
 | 
			
		||||
objs = cmds.ls(selection = True,type = "dagNode",long = True)
 | 
			
		||||
 | 
			
		||||
selectobjflag = True
 | 
			
		||||
selectmultiobjflag = False
 | 
			
		||||
if len(objs) == 0:
 | 
			
		||||
    selectobjflag = False
 | 
			
		||||
else:
 | 
			
		||||
    if len(objs) != 1:
 | 
			
		||||
        selectmultiobjflag = True
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
if objs == None:
 | 
			
		||||
    selectobjflag = False
 | 
			
		||||
 | 
			
		||||
curves = cmds.keyframe(query = True , selected = True , name  = True)
 | 
			
		||||
print(type(curves))
 | 
			
		||||
selectkeyflag = True
 | 
			
		||||
if curves == None:
 | 
			
		||||
    selectkeyflag = False
 | 
			
		||||
 | 
			
		||||
if selectobjflag:
 | 
			
		||||
    if selectkeyflag:
 | 
			
		||||
        nodes = set()
 | 
			
		||||
        for cv in curves:
 | 
			
		||||
            node = cmds.listConnections(cv)[0]
 | 
			
		||||
            nodes.add(node)
 | 
			
		||||
        cmds.select(clear = True)
 | 
			
		||||
        cmds.select(nodes)
 | 
			
		||||
        print("TRACE BACK OBJS FROM KEY: " + str(nodes))
 | 
			
		||||
    else:
 | 
			
		||||
        obj = cmds.ls(objs[0])[0]
 | 
			
		||||
        
 | 
			
		||||
        layer = cmds.ls(cmds.listConnections(obj,t = "displayLayer"))
 | 
			
		||||
        if len(layer) == 0:
 | 
			
		||||
            print("this obj has no layer,or you have selected multiple objs.")
 | 
			
		||||
        elif cmds.editDisplayLayerGlobals(cdl = True,q = True) == "defaultLayer":
 | 
			
		||||
            print("no display layer selected,trace back won\'t work.")
 | 
			
		||||
        else:
 | 
			
		||||
            cmds.editDisplayLayerGlobals(cdl = layer[0])
 | 
			
		||||
            
 | 
			
		||||
            if selectmultiobjflag:
 | 
			
		||||
                print("TRACE BACK LAYER FROM OBJ: " + layer[0] + "BUT WITH MULTIPLE OBJS SELECTED,SO RESULE IS UNEXPECTED.")
 | 
			
		||||
            else:
 | 
			
		||||
                print("TRACE BACK LAYER FROM OBJ: " + layer[0] )
 | 
			
		||||
else :
 | 
			
		||||
    print("no objs selected!")
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								Scripts/Animation/MotionCapHelper/preview.PNG
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Scripts/Animation/MotionCapHelper/preview.PNG
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 15 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								Scripts/Animation/MotionCapHelper/preview1.PNG
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Scripts/Animation/MotionCapHelper/preview1.PNG
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 12 KiB  | 
		Reference in New Issue
	
	Block a user