Beispiel #1
0
 def test_same_ns_as_current(self):
     pm.namespace(set=':')
     ns = self.create_namespace(':foo')
     pm.namespace(set=ns)
     with namespaceutils.preserve_namespace(ns):
         test_cube = self.create_cube()
     self.assertEqual(ns, test_cube.parentNamespace())
     self.assertEqual(ns, self.pm.namespaceInfo(currentNamespace=True))
Beispiel #2
0
 def test_return_to_root(self):
     pm.namespace(set=':')
     ns = self.create_namespace(':foo')
     with namespaceutils.preserve_namespace():
         pm.namespace(set=':foo')
         test_cube = self.create_cube()
     self.assertEqual(ns, test_cube.parentNamespace())
     self.assertEqual(':', self.pm.namespaceInfo(currentNamespace=True))
Beispiel #3
0
def duplicate_triangulate_mesh(skinned_mesh, dup_namespace=None, dup_parent=None):
    dup_namespace = dup_namespace or pm.namespaceInfo(currentNamespace=True)
    with nsutils.preserve_namespace(dup_namespace):
        dup_skinned_mesh_tri = nsutils.duplicate_to_namespace(
            skinned_mesh, dup_namespace=dup_namespace, dup_parent=dup_parent)[0]
        pm.polyTriangulate(dup_skinned_mesh_tri, ch=True)
        pm.delete(dup_skinned_mesh_tri, constructionHistory=True)
        dup_skin_cluster = bind_mesh_like_mesh(skinned_mesh, dup_skinned_mesh_tri)
        copy_weights(skinned_mesh, dup_skinned_mesh_tri)
    return dup_skinned_mesh_tri, dup_skin_cluster
Beispiel #4
0
def duplicate_skinned_mesh_to_influences(skinned_mesh, influences, copy_skinning=True, bind_method=bind_mesh_to_joints, dup_namespace=None, dup_parent=None):
    dup_namespace = dup_namespace or pm.namespaceInfo(currentNamespace=True)
    with nsutils.preserve_namespace(dup_namespace):
        skinned_mesh_duplicate = nsutils.duplicate_to_namespace(
            skinned_mesh, dup_namespace=dup_namespace, dup_parent=dup_parent)[0]
        skincluster_duplicate = bind_method(skinned_mesh_duplicate, influences)

    if copy_skinning:
        copy_weights(skinned_mesh, skinned_mesh_duplicate)
        # copy_weights_vert_order(skinned_mesh, skinned_mesh_duplicate)
    return skinned_mesh_duplicate, skincluster_duplicate