Beispiel #1
0
def import_skinning(skinned_mesh, skinweights_path, copy_weights_method=None, go_to_bindpose=True):
    with selutils.preserve_selection():
        copy_weights_method = copy_weights_method or skinutils.copy_weights
        new_nodes = pm.importFile(skinweights_path, loadReferenceDepth='none',
                                  namespace=NAMESPACE_SKINCOPY_IMPORT, returnNewNodes=True)
        source_skinmesh = _get_skinned_mesh_from_import(new_nodes, skinweights_path, skinned_mesh.nodeName())
        if go_to_bindpose:
            bind_pose = skinutils.get_bind_pose_from_skinned_mesh(skinned_mesh)
            pm.dagPose(bind_pose, restore=True, g=True)
        copy_weights_method(source_skinmesh, skinned_mesh)
        import_namespace = nsutils.get_namespace_as_pynode(NAMESPACE_SKINCOPY_IMPORT)
        import_namespace.remove()
        # evaluate all nodes
        pm.mel.eval('doEnableNodeItems true all;')
Beispiel #2
0
 def test_returns_first_nested_alphabetical_if_same_depth(self):
     pm.namespace(add=':foo:bar:spam:eggs')
     pm.namespace(add=':goo:car:spam:eggs')
     expected = pm.Namespace(':foo:bar:spam')
     result = namespaceutils.get_namespace_as_pynode('spam')
     self.assertEqual(expected, result)
Beispiel #3
0
 def test_returns_first_nested(self):
     pm.namespace(add=':foo:bar:spam:eggs:spam')
     expected = pm.Namespace(':foo:bar:spam')
     result = namespaceutils.get_namespace_as_pynode('spam')
     self.assertEqual(expected, result)
Beispiel #4
0
 def test_simple(self):
     pm.namespace(add='foo')
     expected = pm.Namespace('foo')
     result = namespaceutils.get_namespace_as_pynode('foo')
     self.assertEqual(expected, result)