• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python core.undoInfo函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: setTorsoSize

 def setTorsoSize(self, value):
     pm.undoInfo(openChunk=True)
     if value > 10.0:
         value = value / 100.0
         self.torsoSize_spinBox.setValue(value)
     else:
         self.torsoSize_slider.setValue(value*100)
         
     self.setJointScale(self.spine, value, self.torsoSize)
     self.setJointScale(self.chest, value, self.torsoSize)
     self.setJointScale(self.neck, value, self.torsoSize)
     
     self.torsoSize = value
     self.RebuildMesh()
     pm.undoInfo(closeChunk=True)
开发者ID:jsvanden,项目名称:UnityHumanoid,代码行数:15,代码来源:UnityHumanoid.py


示例17: InitRig

 def InitRig(self):
     pm.undoInfo(openChunk=True)
 
     self.legHeight_slider.blockSignals(True)
     self.legHeight_spinBox.blockSignals(True)
     self.legHeight = 1
     self.legHeight_slider.setValue(100) 
     self.legHeight_spinBox.setValue(1.0)
     self.legHeight_slider.blockSignals(False)
     self.legHeight_spinBox.blockSignals(False)
     
     self.headSize_slider.blockSignals(True)
     self.headSize_spinBox.blockSignals(True)
     self.headSize = 1
     self.headSize_slider.setValue(100)
     self.headSize_spinBox.setValue(1.0)
     self.headSize_slider.blockSignals(False)
     self.headSize_spinBox.blockSignals(False)
     
     self.torsoSize_slider.blockSignals(True)
     self.torsoSize_spinBox.blockSignals(True)
     self.torsoSize = 1
     self.torsoSize_slider.setValue(100)
     self.torsoSize_spinBox.setValue(1.0)
     self.torsoSize_slider.blockSignals(False)
     self.torsoSize_spinBox.blockSignals(False)
     
     self.l_armLength_slider.blockSignals(True)
     self.l_armLength_spinBox.blockSignals(True)
     self.l_armLength = 1
     self.l_armLength_slider.setValue(100) 
     self.l_armLength_spinBox.setValue(1.0)
     self.l_armLength_slider.blockSignals(False)
     self.l_armLength_spinBox.blockSignals(False)
     
     self.r_armLength_slider.blockSignals(True)
     self.r_armLength_spinBox.blockSignals(True)
     self.r_armLength = 1
     self.r_armLength_slider.setValue(100) 
     self.r_armLength_spinBox.setValue(1.0)
     self.r_armLength_slider.blockSignals(False)
     self.r_armLength_spinBox.blockSignals(False)
     
     self.enableRigEdit(True)
     self.InitializeRig();
     
     pm.undoInfo(closeChunk=True)
开发者ID:jsvanden,项目名称:UnityHumanoid,代码行数:47,代码来源:UnityHumanoid.py


示例18: Connect

def Connect(alembicRoot, targetRoot, connectShapes=True):

    pm.undoInfo(openChunk=True)

    alembics = pm.ls(alembicRoot, dagObjects=True, long=True)
    targets = pm.ls(targetRoot, dagObjects=True, long=True)
    for node in targets:
        for abc in alembics:
            if node.split(':')[-1] == abc.split(':')[-1]:

                #get connection attributes
                data = getConnectedAttr(abc, connectShapes)

                #connects any animated node
                if data:
                    for attr in data:
                        try:
                            pm.connectAttr(data[attr],
                                             '%s.%s' % (node, attr),
                                             force=True)
                            CopyTransform(abc, node)
                        except:
                            pass
                #connects any static node
                else:
                    try:
                        #copy transform and blendshape to ensure placement
                        CopyTransform(abc, node)
                        Blendshape(abc, node)

                    except:
                        pass

                #adding user defined attrs to all shapes
                if node.nodeType() == 'mesh':
                    shapes = node.getParent().getShapes()
                    for shp in shapes:
                        for attr in node.listAttr(userDefined=True):
                            attrType = pm.getAttr(attr, type=True)
                            try:
                                shp.addAttr(attr.split('.')[-1],
                                               attributeType=attrType,
                                               defaultValue=attr.get())
                            except:
                                pass

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


示例19: inner

 def inner(*args, **kwargs):
     err = None
     pmc.undoInfo(openChunk=True)
     try:
         res = func(*args, **kwargs)
     except Exception as err:
         raise
     finally:
         pmc.undoInfo(closeChunk=True) # Close undo!
         if err: # Did we error out?
             pmc.undo()
             e_type, e_name, e_trace = sys.exc_info() # Last error
             pmc.confirmDialog(
                 t="Uh oh... %s" % e_type.__name__,
                 m=str(e_name)
                 )
     return res
开发者ID:internetimagery,项目名称:OutOfControlRig,代码行数:17,代码来源:__init__.py


示例20: setHeadSize

 def setHeadSize(self, value):
     pm.undoInfo(openChunk=True)
     self.progressBar.setValue(100)
     if value > 10.0:
         value = value / 100.0
         self.headSize_spinBox.setValue(value)
     else:
         self.headSize_slider.setValue(value*100)
     
     mc.select(self.headMesh)
     mc.delete()
     
     self.setJointScale(self.headTop, value, self.headSize)
     self.headMesh = createSphere("char_headMesh", self.head, self.headTop)
     self.headSize = value
     self.progressBar.setValue(0)
     pm.undoInfo(closeChunk=True)
开发者ID:jsvanden,项目名称:UnityHumanoid,代码行数:17,代码来源:UnityHumanoid.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python core.warning函数代码示例发布时间:2022-05-27
下一篇:
Python core.textScrollList函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap