本文整理汇总了Python中Red9_CoreUtils.prioritizeNodeList方法的典型用法代码示例。如果您正苦于以下问题:Python Red9_CoreUtils.prioritizeNodeList方法的具体用法?Python Red9_CoreUtils.prioritizeNodeList怎么用?Python Red9_CoreUtils.prioritizeNodeList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Red9_CoreUtils
的用法示例。
在下文中一共展示了Red9_CoreUtils.prioritizeNodeList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: poseLoad
# 需要导入模块: import Red9_CoreUtils [as 别名]
# 或者: from Red9_CoreUtils import prioritizeNodeList [as 别名]
def poseLoad(self, nodes, filepath=None, useFilter=True, relativePose=False, relativeRots='projected',
relativeTrans='projected', maintainSpaces=False, percent=None):
'''
Entry point for the generic PoseLoad.
:param nodes: if given load the data to only these. If given and filter=True
this is the rootNode for the filter.
:param filepath: posefile to load - if not given the pose is loaded from a
cached instance on this class.
:param useFilter: If the pose has an active Filter_Settings block and this
is True then use the filter on the destination hierarchy.
:param relativePose: kick in the posePointCloud to align the loaded pose
relatively to the selected node.
:param relativeRots: 'projected' or 'absolute' - how to calculate the offset.
:param relativeTrans: 'projected' or 'absolute' - how to calculate the offset.
:param maintainSpaces: this preserves any parentSwitching mismatches between
the stored pose and the current rig settings, current spaces are maintained.
This only checks those nodes in the snapList and only runs under relative mode.
'''
if relativePose and not cmds.ls(sl=True):
raise StandardError('Nothing selected to align Relative Pose too')
if not type(nodes)==list:
nodes=[nodes] # cast to list for consistency
#push args to object - means that any poseHandler.py file has access to them
self.relativePose = relativePose
self.relativeRots = relativeRots
self.relativeTrans = relativeTrans
self.PosePointCloud = None
self.filepath = filepath
self.useFilter = useFilter # used in the getNodes call
self.maintainSpaces = maintainSpaces
nodesToLoad = self._poseLoad_buildcache(nodes)
if not self.matchedPairs:
raise StandardError('No Matching Nodes found in the PoseFile!')
else:
if self.relativePose:
if self.prioritySnapOnly:
#we've already filtered the hierarchy, may as well just filter the results for speed
nodesToLoad=r9Core.prioritizeNodeList(nodesToLoad, self.settings.filterPriority, regex=True, prioritysOnly=True)
nodesToLoad.reverse()
#setup the PosePointCloud -------------------------------------------------
reference=cmds.ls(sl=True,l=True)[0]
self.PosePointCloud=PosePointCloud(nodesToLoad)
self.PosePointCloud.buildOffsetCloud(reference, raw=True)
resetCache=[cmds.getAttr('%s.translate' % self.PosePointCloud.posePointRoot),
cmds.getAttr('%s.rotate' % self.PosePointCloud.posePointRoot)]
if self.maintainSpaces:
if self.metaRig:
parentSpaceCache=self.getMaintainedAttrs(nodesToLoad, self.metaRig.parentSwitchAttr)
elif 'parentSpaces' in self.settings.rigData:
parentSpaceCache=self.getMaintainedAttrs(nodesToLoad, self.settings.rigData['parentSpaces'])
self._applyPose(percent)
if self.relativePose:
#snap the poseCloud to the new xform of the referenced node, snap the cloud
#to the pose, reset the clouds parent to the cached xform and then snap the
#nodes back to the cloud
r9Anim.AnimFunctions.snap([reference,self.PosePointCloud.posePointRoot])
if self.relativeRots=='projected':
if self.mayaUpAxis=='y':
cmds.setAttr('%s.rx' % self.PosePointCloud.posePointRoot,0)
cmds.setAttr('%s.rz' % self.PosePointCloud.posePointRoot,0)
elif self.mayaUpAxis=='z': # fucking Z!!!!!!
cmds.setAttr('%s.rx' % self.PosePointCloud.posePointRoot,0)
cmds.setAttr('%s.ry' % self.PosePointCloud.posePointRoot,0)
self.PosePointCloud._snapPosePntstoNodes()
if not self.relativeTrans=='projected':
cmds.setAttr('%s.translate' % self.PosePointCloud.posePointRoot,
resetCache[0][0][0],
resetCache[0][0][1],
resetCache[0][0][2])
if not self.relativeRots=='projected':
cmds.setAttr('%s.rotate' % self.PosePointCloud.posePointRoot,
resetCache[1][0][0],
resetCache[1][0][1],
resetCache[1][0][2])
if self.relativeRots=='projected':
if self.mayaUpAxis=='y':
cmds.setAttr('%s.ry' % self.PosePointCloud.posePointRoot,resetCache[1][0][1])
elif self.mayaUpAxis=='z': # fucking Z!!!!!!
cmds.setAttr('%s.rz' % self.PosePointCloud.posePointRoot,resetCache[1][0][2])
if self.relativeTrans=='projected':
if self.mayaUpAxis=='y':
cmds.setAttr('%s.tx' % self.PosePointCloud.posePointRoot,resetCache[0][0][0])
cmds.setAttr('%s.tz' % self.PosePointCloud.posePointRoot,resetCache[0][0][2])
elif self.mayaUpAxis=='z': # fucking Z!!!!!!
cmds.setAttr('%s.tx' % self.PosePointCloud.posePointRoot,resetCache[0][0][0])
cmds.setAttr('%s.ty' % self.PosePointCloud.posePointRoot,resetCache[0][0][1])
#.........这里部分代码省略.........