當前位置: 首頁>>代碼示例>>Python>>正文


Python cmds.polyCube方法代碼示例

本文整理匯總了Python中maya.cmds.polyCube方法的典型用法代碼示例。如果您正苦於以下問題:Python cmds.polyCube方法的具體用法?Python cmds.polyCube怎麽用?Python cmds.polyCube使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在maya.cmds的用法示例。


在下文中一共展示了cmds.polyCube方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setUp

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyCube [as 別名]
def setUp(self):
        self.group = cmds.createNode("transform", name="skeleton_grp")
        cmds.select(cl=True)
        j1 = cmds.joint(p=(0, 10, 0))
        cmds.joint(p=(1, 9, 0))
        cmds.joint(p=(2, 8, 0))
        j = cmds.joint(p=(3, 9, 0))
        cmds.joint(p=(4, 6, 0))
        cmds.joint(p=(5, 5, 0))
        cmds.joint(p=(6, 3, 0))
        self.cube = cmds.polyCube()[0]
        cmds.parent(self.cube, j)
        cmds.parent(j1, self.group)

        cmds.joint(j1, e=True, oj="xyz", secondaryAxisOrient="yup", ch=True, zso=True)
        self.translates = [
            cmds.getAttr("{0}.t".format(x))[0] for x in cmds.ls(type="joint")
        ]
        self.rotates = [
            cmds.getAttr("{0}.r".format(x))[0] for x in cmds.ls(type="joint")
        ]
        self.orients = [
            cmds.getAttr("{0}.jo".format(x))[0] for x in cmds.ls(type="joint")
        ] 
開發者ID:chadmv,項目名稱:cmt,代碼行數:26,代碼來源:test_skeleton.py

示例2: doit

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyCube [as 別名]
def doit(cage_tgt=None):
    if not cage_tgt:
        cage_tgt = cmds.ls(sl=True, o=True)
    cage = cage_tgt[0]
    tgt = cage_tgt[1:]

    cmds.loadPlugin('greenCageDeformer.py', qt=True)
    deformer = cmds.deformer(tgt, type='greenCageDeformer')[0]

    freezer = cmds.createNode('transformGeometry')
    cmds.connectAttr(cage + '.o', freezer + '.ig')
    cmds.connectAttr(cage + '.wm', freezer + '.txf')
    cmds.connectAttr(freezer + '.og', deformer + '.bc')
    cmds.disconnectAttr(freezer + '.og', deformer + '.bc')
    cmds.delete(freezer)

    cmds.connectAttr(cage + '.w', deformer + '.ic')
    cmds.dgeval(cmds.listConnections(deformer + '.og', s=False, d=True, sh=True, p=True))


#doit([cmds.polyCube(w=2.5, d=2.5, h=2.5)[0], cmds.polySphere()[0]]) 
開發者ID:ryusas,項目名稱:maya_greenCageDeformer,代碼行數:23,代碼來源:createGreenCageDeformer.py

示例3: polyCube

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyCube [as 別名]
def polyCube():
    cmds.polyCube() 
開發者ID:minoue,項目名稱:rush,代碼行數:4,代碼來源:Create.py

示例4: create_cube

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyCube [as 別名]
def create_cube(*args, **kwargs):
    print "create my cube"
    cmds.polyCube() 
開發者ID:theodox,項目名稱:mGui,代碼行數:5,代碼來源:formExamples.py

示例5: test_cmds_accessor_get

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyCube [as 別名]
def test_cmds_accessor_get(self):
        cmds.file(new=True, f=True)
        test_obj, _ = cmds.polyCube()
        cmds.xform(test_obj, rotation=(10, 10, 10))
        ac = bindings.CmdsAccessor(test_obj, 'r')
        assert ac.pull() == [(10, 10, 10)] 
開發者ID:theodox,項目名稱:mGui,代碼行數:8,代碼來源:test_Bindings.py

示例6: test_py_accessor_get

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyCube [as 別名]
def test_py_accessor_get(self):
        cmds.file(new=True, f=True)
        test_obj, _ = cmds.polyCube()
        pynode = pm.PyNode(test_obj)
        ac = bindings.PyNodeAccessor(pynode, 'rx')
        assert ac.pull() == 0 
開發者ID:theodox,項目名稱:mGui,代碼行數:8,代碼來源:test_Bindings.py

示例7: test_pynode_accessor

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyCube [as 別名]
def test_pynode_accessor(self):
        cmds.file(new=True, f=True)
        cube, shape = pm.polyCube()
        ac = bindings.get_accessor(cube, 'rx')
        assert isinstance(ac, bindings.PyNodeAccessor)
        ac2 = bindings.get_accessor(shape, 'width')
        assert isinstance(ac2, bindings.PyNodeAccessor) 
開發者ID:theodox,項目名稱:mGui,代碼行數:9,代碼來源:test_Bindings.py

示例8: test_pynode_accessor_excepts_for_nonexistent_attrib

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyCube [as 別名]
def test_pynode_accessor_excepts_for_nonexistent_attrib(self):
        cmds.file(new=True, f=True)
        cube, _ = pm.polyCube()
        self.assertRaises(bindings.BindingError, lambda: bindings.get_accessor(cube, 'xyz')) 
開發者ID:theodox,項目名稱:mGui,代碼行數:6,代碼來源:test_Bindings.py

示例9: test_bind_to_cmds_string

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyCube [as 別名]
def test_bind_to_cmds_string(self):
        ex = self.Example('cube', 45)
        cmds.file(new=True, f=True)
        cmds.polyCube()
        tester = ex & 'val' > bindings.bind() > ('pCube1', 'tx')
        tester()
        assert cmds.getAttr('pCube1.tx') == 45
        tester2 = ex & 'val' > bindings.bind() > 'pCube1.ty'
        tester2()
        assert cmds.getAttr('pCube1.ty') == 45 
開發者ID:theodox,項目名稱:mGui,代碼行數:12,代碼來源:test_Bindings.py

示例10: test_bind_to_pyAttr

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyCube [as 別名]
def test_bind_to_pyAttr(self):
        ex = self.Example('cube', 45)
        cmds.file(new=True, f=True)
        cube, shape = pm.polyCube()
        tester = ex & 'val' > bindings.bind() > cube.tx
        tester()
        assert cmds.getAttr('pCube1.tx') == 45 
開發者ID:theodox,項目名稱:mGui,代碼行數:9,代碼來源:test_Bindings.py

示例11: test_bind_to_pyNode

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyCube [as 別名]
def test_bind_to_pyNode(self):
        ex = self.Example('cube', 45)
        cmds.file(new=True, f=True)
        cube, shape = pm.polyCube()
        tester = ex & 'val' > bindings.bind() > (cube, 'tx')
        tester()
        assert cmds.getAttr('pCube1.tx') == 45 
開發者ID:theodox,項目名稱:mGui,代碼行數:9,代碼來源:test_Bindings.py

示例12: test_get_blendshape_on_new_shape

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyCube [as 別名]
def test_get_blendshape_on_new_shape(self):
        shape = cmds.polyCube()[0]
        blendshape = bs.get_or_create_blendshape_node(shape)
        self.assertTrue(cmds.objExists(blendshape))
        blendshapes = cmds.ls(type="blendShape")
        self.assertEqual(len(blendshapes), 1)
        self.assertEqual(blendshapes[0], blendshape)

        blendshape = bs.get_or_create_blendshape_node(shape)
        blendshapes = cmds.ls(type="blendShape")
        self.assertEqual(len(blendshapes), 1)
        self.assertEqual(blendshapes[0], blendshape) 
開發者ID:chadmv,項目名稱:cmt,代碼行數:14,代碼來源:test_cmt_blendshape.py

示例13: test_get_blendshape_on_existing_blendshape

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyCube [as 別名]
def test_get_blendshape_on_existing_blendshape(self):
        shape = cmds.polyCube()[0]
        blendshape = cmds.blendShape(shape)[0]
        existing_blendshape = bs.get_or_create_blendshape_node(shape)
        self.assertEqual(blendshape, existing_blendshape) 
開發者ID:chadmv,項目名稱:cmt,代碼行數:7,代碼來源:test_cmt_blendshape.py

示例14: setUp

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyCube [as 別名]
def setUp(self):
        self.joint1 = cmds.joint(p=(-0.5, -0.5, 0))
        self.joint2 = cmds.joint(p=(0, 0.0, 0))
        self.joint3 = cmds.joint(p=(0.5, 0.5, 0))
        self.shape = cmds.polyCube()[0]
        cmds.delete(self.shape, ch=True)
        self.skin = cmds.skinCluster(self.joint1, self.joint2, self.joint3, self.shape)[
            0
        ]
        self.expected = {
            "bindMethod": 1,
            "blendWeights": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
            "dropoffRate": 4.0,
            "heatmapFalloff": 0.0,
            "maintainMaxInfluences": False,
            "maxInfluences": 2,
            "name": u"skinCluster1",
            "normalizeWeights": 1,
            "shape": u"pCube1",
            "skinningMethod": 0,
            "useComponents": False,
            "weightDistribution": 0,
            "weights": {
                "joint1": [0.9, 0.5, 0.5, 0.0, 0.5, 0.0, 0.9, 0.5],
                "joint2": [
                    0.10000000000000002,
                    0.5,
                    0.5,
                    0.5,
                    0.5,
                    0.5,
                    0.10000000000000002,
                    0.5,
                ],
                "joint3": [0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0],
            },
        } 
開發者ID:chadmv,項目名稱:cmt,代碼行數:39,代碼來源:test_cmt_skinio.py

示例15: test

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyCube [as 別名]
def test():
    cmds.file(new=True, force=True)
    with CreatedNodesContext() as cnc:
        cubes = cmds.polyCube()
        cmds.polySphere()
        cmds.spaceLocator()
        cmds.delete(cubes)
        print "Created the following nodes:\n\t%s" % ('\n\t'.join(cnc.nodes())) 
開發者ID:dgovil,項目名稱:AdvancedPythonForMaya,代碼行數:10,代碼來源:createdNodesContext.py


注:本文中的maya.cmds.polyCube方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。