Example #1
0
    def test_convert_valid_maya_name__case_mid_name(self):
        """
        Incrementing numbers in the middle of a node name.
        """
        name1 = 'my_node_01_MKR'
        node1 = maya.cmds.createNode('transform', name=name1)

        name2 = api_naming.find_valid_maya_node_name(name1)
        node2 = maya.cmds.createNode('transform', name=name2)
        self.assertEqual(name2, 'my_node_02_MKR')
        self.assertEqual(node2, name2)

        name3 = api_naming.find_valid_maya_node_name(name2)
        node3 = maya.cmds.createNode('transform', name=name3)
        self.assertEqual(name3, 'my_node_03_MKR')
        self.assertEqual(node3, name3)
        return
Example #2
0
    def test_convert_valid_maya_name__case_two_numbers(self):
        """
        There are two numbers, only the last one should be incremented.
        """
        name1 = 'my_node_001_001'
        node1 = maya.cmds.createNode('transform', name=name1)

        name2 = api_naming.find_valid_maya_node_name(name1)
        node2 = maya.cmds.createNode('transform', name=name2)
        self.assertEqual(name2, 'my_node_001_002')
        self.assertEqual(node2, name2)
Example #3
0
    def test_convert_valid_maya_name__case_no_number(self):
        """
        There is no number in the node name, it should
        """
        name1 = 'my_node'
        node1 = maya.cmds.createNode('transform', name=name1)
        self.assertTrue(maya.cmds.objExists(node1))
        self.assertEqual(node1, 'my_node')

        name2 = api_naming.find_valid_maya_node_name(name1)
        node2 = maya.cmds.createNode('transform', name=name2)
        self.assertEqual(name2, 'my_node_001')
        self.assertEqual(node2, name2)