当前位置: 首页>>代码示例>>Python>>正文


Python core.undoInfo函数代码示例

本文整理汇总了Python中pymel.core.undoInfo函数的典型用法代码示例。如果您正苦于以下问题:Python undoInfo函数的具体用法?Python undoInfo怎么用?Python undoInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了undoInfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Connect

def Connect(src, dst):

    pm.undoInfo(openChunk=True)

    alembics = src
    if not isinstance(src, list):
        alembics = pm.ls(src, dagObjects=True, type='transform')

    targets = dst
    if not isinstance(dst, list):
        targets = pm.ls(dst, dagObjects=True, type='transform')

    attrs = ['translate', 'rotate', 'scale', 'visibility']
    for node in targets:
        for abc in alembics:
            if node.longName().split(':')[-1] == abc.longName().split(':')[-1]:
                for attr in attrs:
                    pm.connectAttr('%s.%s' % (abc, attr),
                                   '%s.%s' % (node, attr),
                                   force=True)

                # securing primary shape is connected
                pm.connectAttr('%s.worldMesh[0]' % abc.getShape(),
                               '%s.inMesh' % node.getShape(),
                               force=True)

    pm.undoInfo(closeChunk=True)
开发者ID:mkolar,项目名称:Tapp,代码行数:27,代码来源:utils.py

示例2: __enter__

 def __enter__(self):
     try:
         pm.undoInfo(openChunk=1)
     except TypeError:
         # Legacy support for before undo chunking existed
         pm.undoInfo(stateWithoutFlush=0)  # turn undo off
     return self
开发者ID:assumptionsoup,项目名称:guppy_animation_tools,代码行数:7,代码来源:__init__.py

示例3: rtb_shrink_wrap_verts

def rtb_shrink_wrap_verts(highresListDropdown, *args, **kwargs):
  ''' '''
  global defaultString
  high = highresListDropdown.getValue()

  if not high == defaultString:

    pm.undoInfo(openChunk=True)

    live = pm.PyNode(high.replace('_high', '_live'))
    liveShape = live.getShape()
    sel = pm.ls(sl=True)
    if sel:
      verts = geometry.getVertsFromSelection(sel)
      if verts and verts[0].nodeType() == 'mesh':
        try:
          geometry.shrinkWrap(verts, liveShape, prefix+'_progress_control')
        except:
          pm.warning('You Should Not See This Error!')
          pm.progressBar(prefix+'_progress_control', edit=True, endProgress=True)
      else:
        pm.warning('No verts to shrink wrap!')
      pm.select(sel, r=True)
      pm.hilite(pm.PyNode(sel[0].split('.')[0]).getParent(), r=True)
      type = geometry.getMeshSelectionType(sel)
      geometry.switchSelectType(type)

      pm.undoInfo(closeChunk=True)

  else:
    pm.warning('Select a mesh from the dropdown list')
开发者ID:kotchin,项目名称:mayaSettings,代码行数:31,代码来源:lcRetopoBasic.py

示例4: zero_out_bend

def zero_out_bend(**kwargs):
    """
    Zero out all the bend joint
    Here we assume it already has a optimised rotate order
        - joint_list: (list) List of joint to zero out te bend
        - axis: (str) Which axis is the joint bending
        - rotate_order: (str) What is the current rotate order
    @return the rotate order
    """
    joint_list = libUtilities.pyList(kwargs.get("joint_list") or get_joint_children(pm.selected()[0]))
    libUtilities.freeze_rotation(joint_list)
    libUtilities.freeze_scale(joint_list)
    rotate_order = kwargs.get("rotate_order") or joint_list[0].rotateOrder.get(asString=True)
    target_axis = kwargs.get("axis", rotate_order[0])
    new_rotate_order = None
    if target_axis != rotate_order[0]:
        new_rotate_order = "{}{}{}".format(target_axis, rotate_order[0], rotate_order[2])
    pm.undoInfo(openChunk=True)
    for joint in joint_list:
        for rotate_axis in rotate_order:
            if rotate_axis != target_axis:
                joint.attr("jointOrient{}".format(rotate_axis.upper())).set(0)
        if new_rotate_order:
            joint.rotateOrder.set(new_rotate_order)
    pm.undoInfo(closeChunk=True)
    return new_rotate_order
开发者ID:pritishd,项目名称:PKD_Tools,代码行数:26,代码来源:libJoint.py

示例5: setLegHeight

    def setLegHeight(self, value):
        pm.undoInfo(openChunk=True)
        
        if value > 10.0:
            value = value / 100.0
            self.legHeight_spinBox.setValue(value)
        else:
            self.legHeight_slider.setValue(value*100)
        
        self.setJointScale(self.hips, value, self.legHeight)
        self.setJointScale(self.l_upperLeg, value, self.legHeight)
        self.setJointScale(self.l_lowerLeg, value, self.legHeight)
        self.setJointScale(self.l_foot, value, self.legHeight)
        self.setJointScale(self.l_toes, value, self.legHeight)
        self.setJointScale(self.l_toeEnd, value, self.legHeight)
        self.setJointScale(self.r_upperLeg, value, self.legHeight)
        self.setJointScale(self.r_lowerLeg, value, self.legHeight)
        self.setJointScale(self.r_foot, value, self.legHeight)
        self.setJointScale(self.r_toes, value, self.legHeight)
        self.setJointScale(self.r_toeEnd, value, self.legHeight)

        self.legHeight = value
        self.RebuildMesh()
        
        pm.undoInfo(closeChunk=True)
开发者ID:jsvanden,项目名称:UnityHumanoid,代码行数:25,代码来源:UnityHumanoid.py

示例6: wrapper

 def wrapper(*args, **kwargs):
     pm.undoInfo(openChunk=True)
     try:
         ret = func(*args, **kwargs)
     finally:
         pm.undoInfo(closeChunk=True)
     return ret
开发者ID:utsdab,项目名称:usr,代码行数:7,代码来源:generic.py

示例7: overrideAttrRun

    def overrideAttrRun(self, mode):

        items = self.weightListWidget.selectedItems()
        
        if pm.editRenderLayerGlobals(q=1, crl=1) == 'defaultRenderLayer':
            return 0

        attrList = []
        
        pm.undoInfo(ock=1)        
        
        for x in items:
            attrList.append(x.text())
        
        for x in self.objectList:
            for y in attrList:
                try:
                    if mode:
                        pm.editRenderLayerAdjustment(x.attr(y))
                    else:
                        overrideList = pm.editRenderLayerAdjustment(q=1)
                        if x.attr(y).name() in overrideList:
                            pm.editRenderLayerAdjustment(x.attr(y), remove=1)
                except:
                    print x                
        
        pm.undoInfo(cck=1)
开发者ID:jiwonchoe,项目名称:mayaPy,代码行数:27,代码来源:FoDoRi.py

示例8: _ctrlDBL

    def _ctrlDBL(self, controls):
        
        pmc.undoInfo(openChunk=True)
        
        if controls == []:
            controls = pmc.ls(sl=True)

        for control in controls:
            control_roo = pmc.xform(control, q=True, roo=True)
            control_mtx = pmc.xform(control, q=True, m=True, ws=True)
            control_parent = pmc.listRelatives(control, p=True)
            pmc.select(cl=True)
            
            locdbl_parent = pmc.spaceLocator(n='locDBL_parent_' + control)
            locdbl_offset = pmc.spaceLocator(n='locDBL_offset_' + control)

            pmc.xform(locdbl_parent, ws=True, m=control_mtx)
            pmc.xform(locdbl_offset, ws=True, m=control_mtx)
                
            pmc.parent(locdbl_offset, locdbl_parent)
            pmc.parent(locdbl_parent, control_parent)
            pmc.parent(control, locdbl_offset)
            
            if control_roo == 'xyz':
                pmc.xform(locdbl_offset, roo='zyx')
            if control_roo == 'yzx':
                pmc.xform(locdbl_offset, roo='xzy')        
            if control_roo == 'zxy':
                pmc.xform(locdbl_offset, roo='yxz')        
            if control_roo == 'xzy':
                pmc.xform(locdbl_offset, roo='yzx')
            if control_roo == 'yxz':
                pmc.xform(locdbl_offset, roo='zxy')            
            if control_roo == 'zyx':
                pmc.xform(locdbl_offset, roo='xyz')
                            
            md_trns = pmc.createNode('multiplyDivide', n='mdTRNS_locDBL_' + control)
            md_rot = pmc.createNode('multiplyDivide', n='mdROT_locDBL_' + control)
            md_scl = pmc.createNode('multiplyDivide', n='mdSCL_locDBL_' + control)
            
            pmc.setAttr(md_trns + '.input1', [-1,-1,-1])
            pmc.setAttr(md_rot.input1, [-1,-1,-1])
            pmc.setAttr(md_scl.input1, [ 1, 1, 1])
            pmc.setAttr(md_scl.operation, 2)

            
            pmc.connectAttr(control + '.translate', md_trns + '.input2')
            pmc.connectAttr(control + '.rotate', md_rot + '.input2')
            pmc.connectAttr(control + '.scale', md_scl + '.input2')
            
            pmc.connectAttr(md_trns + '.output', locdbl_offset + '.translate')
            pmc.connectAttr(md_rot + '.output', locdbl_offset + '.rotate')
            pmc.connectAttr(md_scl + '.output', locdbl_offset + '.scale')
            
            pmc.setAttr(locdbl_parent + 'Shape.visibility', 0)
            pmc.setAttr(locdbl_offset + 'Shape.visibility', 0)
            
        pmc.undoInfo(closeChunk=True)
开发者ID:scorza,项目名称:variableFK,代码行数:58,代码来源:vfk_UI.py

示例9: wrapper

 def wrapper(*args, **kwargs):
     pmc.undoInfo(openChunk=True)
     try:
         result = func(*args, **kwargs)
     except:
         vp.vPrint('Error', 1)
     finally:
         pmc.undoInfo(closeChunk=True)
         return result
开发者ID:loichuss,项目名称:maya,代码行数:9,代码来源:decorator.py

示例10: lcObj_exportObjs

def lcObj_exportObjs(*args, **kwargs):
  ''' Export .obj files from selected geometry, either as one combined file or as individual files per object.  Will recognize and convert poly smooth preview to geometry for export '''
  global prefix
  path = pm.textField(prefix+'_textField_export_path', query=True, text=True)
  objPrefix = pm.textField(prefix+'_textField_prefix', query=True, text=True)
  if objPrefix:
    objPrefix+='_'

  if path:

    sel = pm.ls(sl=True)

    if sel:
      sel = geometry.filterForGeometry(sel)
      print sel

      #undo is the easiest way to work on geometry temporarily
      pm.undoInfo(openChunk=True)

      if pm.checkBox(prefix+'_checkBox_use_smooth', query=True, v=True):
        for obj in sel:
          pm.select(obj)
          #find the objects currently displayed as smooth and create converted poly copies
          if pm.displaySmoothness(q=True, polygonObject=True)[0] == 3:
            pm.mel.performSmoothMeshPreviewToPolygon()

      if pm.checkBox(prefix+'_checkBox_export_indi', query=True, v=True):
        #export objects individually
        for obj in sel:
          pm.select(obj)
          name = str(obj)
          exportString = path+'/'+objPrefix+name+'.obj'
          pm.exportSelected(exportString, force=True, options='groups=1;ptgroups=1;materials=0;smoothing=1;normals=1', type='OBJexport', pr=True, es=True)

      else:
        #export as one object
        pm.select(sel)
        name = ''
        while name == '':
          dialog = pm.promptDialog(title='OBJ Name', message='Enter Name:', button=['OK', 'Cancel'], defaultButton='OK', cancelButton='Cancel', dismissString='Cancel')
          if dialog == 'OK':
            name = pm.promptDialog(query=True, text=True)
            if name:
              exportString = path+'/'+objPrefix+name+'.obj'
              pm.exportSelected(exportString, force=True, options='groups=1;ptgroups=1;materials=0;smoothing=1;normals=1', type='OBJexport', pr=True, es=True)
            else:
              pm.warning("You didn't type a name for your obj")
          if dialog == 'Cancel':
            break

      pm.undoInfo(closeChunk=True)
      pm.undo()
      pm.select(clear=True)

  else:
    pm.warning('Did you specify a path?')
开发者ID:kotchin,项目名称:mayaSettings,代码行数:56,代码来源:lcObjTools.py

示例11: set

    def set(self, cc=False):
        if not cc and not self.undoState:
            self.undoState = True
            pm.undoInfo(openChunk=True)

        for i in self.obj():
            getattr(i, self.name.lower()).set(self.attr_.getValue())

        if cc and self.undoState:
            pm.undoInfo(closeChunk=True)
            self.undoState = False
开发者ID:cmcpasserby,项目名称:pbRenderableCurve,代码行数:11,代码来源:pbRenderableCurve.py

示例12: switch

def switch(space, timeRange=False, start=0, end=0):

    #undo enable
    pm.undoInfo(openChunk=True)

    sel = pm.ls(selection=True)

    for node in sel:
        cnt = getConnectedNodes(node, 'control')[0]

        controls = []
        for obj in getConnectedNodes(cnt, 'message'):

            #IK switch
            if space == 'IK':
                if obj.space.get() == space:
                    if timeRange:
                        for count in xrange(start, end):
                            pm.currentTime(count)
                            switch = getConnectedNodes(obj, 'switch')[0]
                            Snap(obj, switch)

                            cnt.blend.set(1)
                    else:
                        switch = getConnectedNodes(obj, 'switch')[0]
                        Snap(obj, switch)

                        cnt.blend.set(1)

            #FK control finding
            if space == 'FK':
                if obj.space.get() == space:
                    controls.append(obj)

        #FK switch
        controls.sort(key=lambda x: x.chain.get())
        if timeRange:
            for count in xrange(start, end):
                pm.currentTime(count)
                for obj in controls:
                    switch = getConnectedNodes(obj, 'switch')[0]
                    Snap(obj, switch)

                    cnt.blend.set(0)
        else:
            for obj in controls:
                switch = getConnectedNodes(obj, 'switch')[0]
                Snap(obj, switch)

                cnt.blend.set(0)

    pm.undoInfo(closeChunk=True)
开发者ID:leandropim,项目名称:Tapp,代码行数:52,代码来源:utils.py

示例13: create_ui

    def create_ui(self):
        pmc.undoInfo(openChunk=True)

        self.setWindowTitle('VFK Rig Creator')
        self.setWindowFlags(qc.Qt.Tool)
        self.setMinimumSize(300, 400)
        self.setMaximumWidth(300)
        
        self.create_controls()
        self.create_layout()
        self.create_connections()

        pmc.undoInfo(closeChunk=True)
开发者ID:scorza,项目名称:variableFK,代码行数:13,代码来源:vfk_UI.py

示例14: set

    def set(self, cc=False):
        if not cc and not self.undoState:
            self.undoState = True
            pm.undoInfo(openChunk=True)

        try:
            getattr(self.ceObj.wire[0], self.name).set(self.attr.getValue())
        except:
            AttributeError('{0} node does no longer exist'.format(self.ceObj.wire[0]))

        if cc and self.undoState:
            pm.undoInfo(closeChunk=True)
            self.undoState = False
开发者ID:cmcpasserby,项目名称:curvyEdges,代码行数:13,代码来源:curvyEdges.py

示例15: RebuildMesh

 def RebuildMesh(self):
     pm.undoInfo(openChunk=True)
     mc.select(self.hipsMesh, self.spineMesh, self.chestMesh, self.headMesh, self.l_upperArmMesh,
     self.l_lowerArmMesh, self.l_thumbMesh_a, self.l_thumbMesh_b, self.l_thumbMesh_c, self.l_indexMesh_a,
     self.l_indexMesh_b, self.l_indexMesh_c, self.l_middleMesh_a, self.l_middleMesh_b, self.l_middleMesh_c,
     self.l_ringMesh_a, self.l_ringMesh_b, self.l_ringMesh_c, self.l_pinkieMesh_a, self.l_pinkieMesh_b,
     self.l_pinkieMesh_c, self.r_upperArmMesh, self.r_lowerArmMesh, self.r_thumbMesh_a, self.r_thumbMesh_b,
     self.r_thumbMesh_c, self.r_indexMesh_a, self.r_indexMesh_b, self.r_indexMesh_c, self.r_middleMesh_a,
     self.r_middleMesh_b, self.r_middleMesh_c, self.r_ringMesh_a, self.r_ringMesh_b, self.r_ringMesh_c,
     self.r_pinkieMesh_a, self.r_pinkieMesh_b, self.r_pinkieMesh_c, self.l_upperLegMesh, self.l_lowerLegMesh,
     self.l_footMesh, self.l_toesMesh, self.r_upperLegMesh, self.r_lowerLegMesh, self.r_footMesh, self.r_toesMesh)
     mc.delete()
     self.BuildMesh()
     pm.undoInfo(closeChunk=True)
开发者ID:jsvanden,项目名称:UnityHumanoid,代码行数:14,代码来源:UnityHumanoid.py


注:本文中的pymel.core.undoInfo函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。