Beispiel #1
0
 def test_noop_if_namespace_already_exists(self):
     pm.namespace(set=':')
     ns_foo = self.create_namespace('foo')
     namespaceutils.add_namespace_to_root('foo')
     expected = [ns_foo]
     result = pm.listNamespaces(recursive=True)
     self.assertListEqual(expected, result)
Beispiel #2
0
def duplicate_skinned_mesh_and_skeleton(skinned_mesh, dup_namespace=None, copy_skinning=True, bind_method=bind_mesh_to_joints, dup_parent=None):
    skin_cluster = get_skincluster(skinned_mesh)
    source_influences = skin_cluster.influenceObjects()
    source_skeleton_root = skelutils.get_root_joint_from_child(source_influences[0])
    if dup_namespace:
        nsutils.add_namespace_to_root(dup_namespace)
    dup_root = skelutils.duplicate_skeleton(source_skeleton_root, dup_namespace=dup_namespace, dup_parent=dup_parent)
    dup_skel = skelutils.get_hierarchy_from_root(dup_root, joints_only=True)
    dup_mesh, dup_cluster = duplicate_skinned_mesh_to_influences(skinned_mesh, dup_skel,
                                                                 copy_skinning=copy_skinning, bind_method=bind_method, dup_namespace=dup_namespace, dup_parent=dup_parent)
    return dup_mesh, dup_root, dup_cluster
Beispiel #3
0
 def test_not_root_with_leading_colon(self):
     pm.namespace(set=':')
     ns_bar = self.create_namespace('bar')
     pm.namespace(set=':bar')
     ns = namespaceutils.add_namespace_to_root(':foo')
     expected = [':bar', ':foo']
     result = [str(x) for x in pm.listNamespaces(recursive=True)]
     self.assertListEqual(expected, result)
Beispiel #4
0
 def test_root_current_namespace(self):
     pm.namespace(set=':')
     ns = namespaceutils.add_namespace_to_root('foo')
     expected = [ns]
     result = pm.listNamespaces(recursive=True)
     self.assertListEqual(expected, result)