# -*- 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()