blob: 9ae2ea2e8c6965f980eef5aec73d6c810f7b1052 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# -*- coding: utf-8 -*-
"""
:author:
Jeremy Ernst
:description:
This module contains the class for the root component class, which serves as the master control and root joint of
the rig and skeleton. Every asset will always have a root component.
"""
import artv2.components.base_components.base_component as base
import artv2.utilities.component_utilities as component_utils
import artv2.utilities.error_utilities as errors
class Root(base.ART_Component):
"""
The root rig component class serves as the master control and root joint of the rig and skeleton. Every asset
will always have a root component.
"""
nice_name = "Root"
category = "Primitives"
base_name = "master"
has_sides = False
can_overwrite_names = True
joint_mover_file = "resources\\rigging_guides\\root.ma"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def _add_metadata(self, network_node, prefix, suffix):
super(Root, self)._add_metadata(network_node, prefix, suffix)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def delete(self):
"""
Overridden method from base class that checks if this component has any children before it can be deleted.
Other components, when deleted, have any dependencies reparented to the root. So if the root is deleted, it must
have no dependencies (children).
"""
created_joint = self.joint_mover.get_created_joints()
issues = component_utils.check_for_children(created_joint[0])
if issues:
self.logger.warning("{0}.delete: This component has children and cannot be deleted.".format(
self.__class__.__name__))
errors.raise_error("This component has children and cannot be deleted.")
else:
super(Root, self).delete()
|