Ejemplo n.º 1
0
 def test_layout(self):
     sub_rig = nt.SubRig(meta_data=None,
                         top_node=None,
                         layout_joints='test layout',
                         parent=None)
     sub_rig.build()
     self.assertEquals(sub_rig.layout_joints, 'test layout')
Ejemplo n.º 2
0
 def test_top_node(self):
     top_node = nt.Transform.build()
     sub_rig = nt.SubRig(meta_data=None,
                         top_node=top_node,
                         layout=None,
                         parent=None)
     sub_rig.build()
     self.assertEquals(sub_rig.root, top_node)
Ejemplo n.º 3
0
 def test_all_children_exist(self):
     sub_rig = nt.SubRig(meta_data={'meta': 'data'},
                         top_node=None,
                         layout=None,
                         parent=None)
     sub_rig.build()
     for node in sub_rig._flat_hierarchy():
         self.assertTrue(node.exists())
         self.assertTrue(isinstance(node, nt.Transform))
Ejemplo n.º 4
0
 def test_register_previously_created_with_meta_data(self):
     self.sub_rig = nt.SubRig()
     self.sub_rig.build()
     b = nt.Joint.build(meta_data={'name': 'bob'})
     self.sub_rig.register_node('test', hierarchy_id=b)
     self.assertDictEqual(b.meta_data, {'name': 'bob', 'type': 'joint'})
     self.assertDictEqual(b.name_tokens, {
         cfg.NAME: 'untitled',
         cfg.TYPE: cfg.JOINT_TYPE
     })
Ejemplo n.º 5
0
 def test_build_with_sub_rig_previous_name_tokens(self):
     self.sub_rig = nt.SubRig()
     self.sub_rig.build(name_tokens={'name': 'silvia'})
     self.sub_rig.build_node(nt.Joint, hierarchy_id='test')
     self.assertDictEqual(
         self.sub_rig.joint.test.name_tokens, {
             'name': 'silvia',
             cfg.SUB_RIG_TOKEN: cfg.SUB_RIG_TOKEN,
             cfg.TYPE: cfg.JOINT_TYPE
         })
Ejemplo n.º 6
0
 def test_register_previously_created_add_name_tokens(self):
     self.sub_rig = nt.SubRig()
     self.sub_rig.build()
     b = nt.Joint.build(name_tokens={'name': 'silvia'})
     self.sub_rig.register_node(b, hierarchy_id='test')
     self.assertDictEqual(
         b.name_tokens, {
             'name': 'silvia',
             cfg.SUB_RIG_TOKEN: cfg.SUB_RIG_TOKEN,
             cfg.TYPE: cfg.JOINT_TYPE
         })
Ejemplo n.º 7
0
 def test_register_previously_created_with_name_tokens(self):
     self.sub_rig = nt.SubRig()
     self.sub_rig.build()
     b = nt.Joint.build(name_tokens={'name': 'bob'})
     self.sub_rig.register_node('test', hierarchy_id=b)
     # This test will override the previous name because it now should inherit the new sub rig tokens.
     self.assertDictEqual(
         b.name_tokens, {
             cfg.NAME: 'bob',
             cfg.SUB_RIG_TOKEN: cfg.SUB_RIG_TOKEN,
             cfg.TYPE: cfg.JOINT_TYPE
         })
     self.assertDictEqual(b.meta_data, {})
Ejemplo n.º 8
0
 def test_register_previously_created_with_meta_data_overwrite(self):
     self.sub_rig = nt.SubRig()
     self.sub_rig.build()
     b = nt.Joint.build(meta_data={'name': 'silvia'})
     self.sub_rig.register_node('test', hierarchy_id=b)
     self.assertDictEqual(b.meta_data, {
         'name': 'silvia',
         cfg.SUB_RIG_TOKEN: cfg.SUB_RIG_TOKEN
     })
     self.assertDictEqual(b.name_tokens, {
         cfg.NAME: 'untitled',
         cfg.TYPE: cfg.JOINT_TYPE
     })
Ejemplo n.º 9
0
 def test_build_add_name_tokens(self):
     self.sub_rig = nt.SubRig()
     self.sub_rig.build()
     self.sub_rig.build_node(nt.Joint,
                             hierarchy_id='test',
                             name_tokens={'name': 'silvia'},
                             meta_data=None)
     self.assertDictEqual(
         self.sub_rig.joint.test.name_tokens, {
             cfg.NAME: 'silvia',
             cfg.SUB_RIG_TOKEN: cfg.SUB_RIG_TOKEN,
             cfg.TYPE: cfg.JOINT_TYPE
         })
Ejemplo n.º 10
0
 def test_register_previously_created_with_name_tokens_overwrite(self):
     self.sub_rig = nt.SubRig()
     self.sub_rig.build()
     b = nt.Joint.build(name_tokens={
         'name': 'silvia',
         cfg.SUB_RIG_TOKEN: 'muggle'
     })
     self.sub_rig.register_node(b, hierarchy_id='test')
     self.assertDictEqual(
         b.name_tokens, {
             'name': 'silvia',
             cfg.SUB_RIG_TOKEN: 'muggle',
             cfg.TYPE: cfg.JOINT_TYPE
         })
     self.assertDictEqual(b.meta_data, {})
Ejemplo n.º 11
0
 def build_dependencies(cls):
     cls.test_rig = nt.SubRig([])
     cls.test_rig.build()
Ejemplo n.º 12
0
 def test_parent(self):
     parent = nt.Transform.build()
     sub_rig = nt.SubRig(meta_data=None, top_node=None, layout=None)
     sub_rig.build(parent=parent)
     self.assertEquals(sub_rig.root.getParent(), parent)
Ejemplo n.º 13
0
 def test_default(self):
     nt.SubRig().build()