# -*- coding: utf-8 -*- """ :author: Jeremy Ernst :description: This module contains the class that provides the main user interface that is used to build up an asset with different rig components. """ import os from functools import partial import maya.cmds as cmds import pymel.core as pm import artv2.utilities.interface_utilities as interface_utils import artv2.utilities.component_utilities as component_utils import artv2.utilities.rigging_utilities as rigging_utils import artv2.utilities.general_utilities as utils import artv2.tools.system.logger.output_logger as logger from artv2.tools.rigging.rig_builder.installed_components_widget import InstalledComponentsWidget from artv2.tools.rigging.rig_builder.available_components_widget import AvailableComponentsWidget from artv2.tools.rigging.rig_builder.component_context_menu import ComponentContextMenu from artv2.third_party.Qt import QtWidgets, QtCore, QtGui import artv2.components.base_components.template as template # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # class RigBuilderUI(interface_utils.ARTv2Window): """ This class provides the main user interface that is used to build up an asset with different rig components. It is invoked from the ART v2 menu on Maya's main menu bar. :param parent: Parent for this widget, which will be Maya's main window. .. figure:: /images/rig_builder.png :width: 495px :align: center :height: 659px :figclass: align-center the rig builder interface. """ SETTINGS_NAME = "RigBuilderWIN" WINDOW_NAME = "artv2_rig_builder_window" # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def __init__(self, parent=None): super(RigBuilderUI, self).__init__(400, 600, "Rig Builder", parent) self.logger = logger.OutputLogger(self.__class__.__name__) # define some attributes the class (or other classes) will need to be able to access self.toggle_offset = None self.toggle_global = None self.toggle_lra = None self.component_list = None self.settings_layout = None # build the interface and set states self._build_interface() self.set_states() # select the first item in the list widget first_item = self.component_list.item(0) first_item.setSelected(True) self.component_list.itemClicked.emit(first_item) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def _build_interface(self): menu_bar = self.menuBar() menu_bar.addMenu("Settings") self.toolbar = self.addToolBar("Tools") self.main_widget = QtWidgets.QStackedWidget() self.setCentralWidget(self.main_widget) self._build_rigging_widget() self._build_deformation_widget() # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def _add_setup_tool_buttons(self, toolbar): toolbar.clear() load_template = toolbar.addAction("Load Template") load_template.setToolTip("Load a template") icon = QtGui.QIcon(QtGui.QPixmap(os.path.join(self.icon_path, "general", "load.png"))) load_template.setIcon(icon) load_template.triggered.connect(self._load_template) save_template = toolbar.addAction("Save Template") save_template.setToolTip("Save a template") icon = QtGui.QIcon(QtGui.QPixmap(os.path.join(self.icon_path, "general", "save.png"))) save_template.setIcon(icon) save_template.triggered.connect(self._save_template) toolbar.addSeparator() self.toggle_global = toolbar.addAction("G") self.toggle_global.setToolTip("Toggle Global Mover Visibility") self.toggle_global.setCheckable(True) icon = QtGui.QIcon(QtGui.QPixmap(os.path.join(self.icon_path, "general", "mover_global.png"))) self.toggle_global.setIcon(icon) self.toggle_global.toggled.connect(self._toggle_global_visibility) self.toggle_offset = toolbar.addAction("O") self.toggle_offset.setToolTip("Toggle Offset Mover Visibility") self.toggle_offset.setCheckable(True) icon = QtGui.QIcon(QtGui.QPixmap(os.path.join(self.icon_path, "general", "mover_offset.png"))) self.toggle_offset.setIcon(icon) self.toggle_offset.toggled.connect(self._toggle_offset_visibility) self.toggle_lra = toolbar.addAction("LRA") self.toggle_lra.setToolTip("Toggle Local Rotation Axis Visibility") self.toggle_lra.setCheckable(True) icon = QtGui.QIcon(QtGui.QPixmap(os.path.join(self.icon_path, "general", "lra.png"))) self.toggle_lra.setIcon(icon) self.toggle_lra.toggled.connect(self._toggle_lra_visibility) toolbar.addSeparator() bone_counter = toolbar.addAction("Count") bone_counter.setToolTip("Launch the bone count tool to view current bone count and set targets.") icon = QtGui.QIcon(QtGui.QPixmap(os.path.join(self.icon_path, "general", "count.png"))) bone_counter.setIcon(icon) bone_counter.triggered.connect(self._launch_bone_counter) group_mirror = toolbar.addAction("Group Mirror") group_mirror.setToolTip("Create mirrors of multiple components at once.") icon = QtGui.QIcon(QtGui.QPixmap(os.path.join(self.icon_path, "general", "mirror.png"))) group_mirror.setIcon(icon) group_mirror.triggered.connect(self._launch_group_mirror) group_reset = toolbar.addAction("Group Reset") group_reset.setToolTip("Reset settings or transformations of multiple components at once.") icon = QtGui.QIcon(QtGui.QPixmap(os.path.join(self.icon_path, "general", "reset.png"))) group_reset.setIcon(icon) group_reset.triggered.connect(self._launch_group_reset) group_mirror_xforms = toolbar.addAction("Group Mirror XForms") group_mirror_xforms.setToolTip("Mirror transformations of multiple components at once.") icon = QtGui.QIcon(QtGui.QPixmap(os.path.join(self.icon_path, "general", "mirror_transforms.png"))) group_mirror_xforms.setIcon(icon) group_mirror_xforms.triggered.connect(self._launch_group_mirror_xforms) group_bake_offsets = toolbar.addAction("Group Mirror XForms") group_bake_offsets.setToolTip("Bake offsets on multiple components at once.") icon = QtGui.QIcon(QtGui.QPixmap(os.path.join(self.icon_path, "general", "bake_offsets.png"))) group_bake_offsets.setIcon(icon) group_bake_offsets.triggered.connect(self._launch_group_bake_offsets) pose_manager = toolbar.addAction("Pose Manager") pose_manager.setToolTip("Open the pose manager for creating and setting bindposes.") icon = QtGui.QIcon(QtGui.QPixmap(os.path.join(self.icon_path, "general", "pose_manager.png"))) pose_manager.setIcon(icon) pose_manager.triggered.connect(self._launch_pose_manager) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def _build_rigging_widget(self): rig_widget = QtWidgets.QWidget() self.main_widget.addWidget(rig_widget) main_layout = QtWidgets.QVBoxLayout(rig_widget) splitter = QtWidgets.QSplitter(orientation=QtCore.Qt.Horizontal) main_layout.addWidget(splitter) # left column left_column_widget = QtWidgets.QWidget() left_column_layout = QtWidgets.QVBoxLayout(left_column_widget) add_component_button = QtWidgets.QPushButton("Add Component") add_component_button.setMinimumHeight(interface_utils.scale_by_dpi(40)) add_component_button.setMaximumHeight(interface_utils.scale_by_dpi(40)) add_component_button.setStyleSheet(self.style_sheet) component_menu = AvailableComponentsWidget(add_component_button) component_menu.component_added.connect(self.update_list) add_component_button.setMenu(component_menu) left_column_layout.addWidget(add_component_button) search_bar = QtWidgets.QLineEdit() search_bar.setPlaceholderText("Search..") left_column_layout.addWidget(search_bar) self.component_list = InstalledComponentsWidget(self) self.component_list.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.component_list.customContextMenuRequested.connect(self._item_menu_request) left_column_layout.addWidget(self.component_list) splitter.addWidget(left_column_widget) # right column right_column_widget = QtWidgets.QWidget() right_column_widget.setMinimumWidth(interface_utils.scale_by_dpi(250)) right_column_widget.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) right_column_layout = QtWidgets.QVBoxLayout(right_column_widget) self.settings_layout = QtWidgets.QVBoxLayout() right_column_layout.addLayout(self.settings_layout) build_button = QtWidgets.QPushButton("Build Skeleton") build_button.setMinimumHeight(interface_utils.scale_by_dpi(40)) build_button.setMaximumHeight(interface_utils.scale_by_dpi(40)) build_button.clicked.connect(self._build_skeleton) right_column_layout.addWidget(build_button) splitter.addWidget(right_column_widget) completer = QtWidgets.QCompleter(self.component_list.get_items().keys()) completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) search_bar.setCompleter(completer) search_bar.returnPressed.connect(partial(self.component_list.filter_list, search_bar)) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def _build_deformation_widget(self): deformation_widget = QtWidgets.QWidget() self.main_widget.addWidget(deformation_widget) main_layout = QtWidgets.QVBoxLayout(deformation_widget) spacer = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) main_layout.addSpacerItem(spacer) button = QtWidgets.QPushButton("Edit Components") button.clicked.connect(self._edit_components) main_layout.addWidget(button) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def _item_menu_request(self, point): item = self.component_list.itemAt(point) if item is not None: node_name = item.data(QtCore.Qt.UserRole) menu = ComponentContextMenu(node_name, self.component_list, point, self) menu.component_added.connect(self.update_list) parent_position = self.component_list.mapToGlobal(QtCore.QPoint(0, 0)) menu.move(parent_position + point) menu.exec_() # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def _build_skeleton(self): self.logger.interface("{0}._build_skeleton: Building skeleton.".format(self.__class__.__name__)) skeleton = rigging_utils.build_skeleton() asset = component_utils.get_rig_asset_node() utils.set_attribute(asset, "has_skeleton", True) skeleton.asset.connect(asset.skeleton_hierarchy) components = component_utils.return_all_components() for each in components: inst = component_utils.get_component_instance(each) inst.joint_mover.toggle_visibility(False) del inst self.main_widget.setCurrentIndex(1) self.toolbar.clear() # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def _edit_components(self): self.logger.interface("{0}._edit_components: Removing skeleton to edit components." "".format(self.__class__.__name__)) asset = component_utils.get_rig_asset_node() utils.set_attribute(asset, "has_skeleton", False) root = asset.skeleton_hierarchy.connections()[0] root.unlock() joints = root.listRelatives(ad=True) for joint in joints: joint.unlock() pm.delete(root) components = component_utils.return_all_components() for each in components: inst = component_utils.get_component_instance(each) inst.joint_mover.toggle_visibility(True) del inst self.main_widget.setCurrentIndex(0) self._add_setup_tool_buttons(self.toolbar) self.update_list() # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # @staticmethod def _toggle_global_visibility(*args): state = args[0] asset = component_utils.get_rig_asset_node() utils.set_attribute(asset, "global_mover_visibility", state) components = component_utils.return_all_components() for each in components: inst = component_utils.get_component_instance(each) inst.joint_mover.toggle_global_visibility(state) del inst # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # @staticmethod def _toggle_offset_visibility(*args): state = args[0] asset = component_utils.get_rig_asset_node() utils.set_attribute(asset, "offset_mover_visibility", state) components = component_utils.return_all_components() for each in components: inst = component_utils.get_component_instance(each) inst.joint_mover.toggle_offset_visibility(state) del inst # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # @staticmethod def _toggle_lra_visibility(*args): state = args[0] asset = component_utils.get_rig_asset_node() utils.set_attribute(asset, "lra_visibility", state) rigging_utils.toggle_local_axis(state) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def _launch_bone_counter(self): self.logger.interface("{0}._launch_bone_counter: Launching bone counter interface." "".format(self.__class__.__name__)) import artv2.tools.rigging.bone_counter_ui as bone_counter bone_counter.show_window() # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def _launch_group_mirror(self): self.logger.interface("{0}._launch_group_mirror: Launching group mirror interface." "".format(self.__class__.__name__)) import artv2.tools.rigging.group_mirror_ui as group_mirror group_mirror.show_window(self) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def _launch_group_reset(self): self.logger.interface("{0}._launch_group_reset: Launching group reset interface." "".format(self.__class__.__name__)) import artv2.tools.rigging.group_reset_ui as group_reset group_reset.show_window(self) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def _launch_group_mirror_xforms(self): self.logger.interface("{0}._launch_group_mirror_xforms: Launching group mirror transforms interface." "".format(self.__class__.__name__)) import artv2.tools.rigging.group_mirror_xforms_ui as group_mirror_xforms group_mirror_xforms.show_window(self) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def _launch_group_bake_offsets(self): self.logger.interface("{0}._launch_group_bake_offsets: Launching group bake offsets interface." "".format(self.__class__.__name__)) import artv2.tools.rigging.group_bake_offsets_ui as group_bake group_bake.show_window(self) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def _launch_pose_manager(self): self.logger.interface("{0}._launch_pose_manager: Launching pose manager interface." "".format(self.__class__.__name__)) import artv2.tools.rigging.pose_manager_ui as pose pose.show_window(self) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def _load_template(self): self.logger.interface("{0}._load_template: Launching load template interface.".format(self.__class__.__name__)) template_path = os.path.join(self.tools_path, "resources", "templates") path = QtWidgets.QFileDialog.getOpenFileName(self, "Load Template", template_path) if os.path.exists(path[0]): import artv2.tools.rigging.load_template_ui as load_template load_template.show_window(self, utils.path_unify(path[0])) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def _save_template(self): self.logger.interface("{0}._save_template: Saving template.".format(self.__class__.__name__)) template_path = os.path.join(self.tools_path, "resources", "templates") if not os.path.exists(template_path): os.makedirs(template_path) path = QtWidgets.QFileDialog.getSaveFileName(self, "Save Template", template_path, "*.json") if os.path.exists(os.path.dirname(path[0])): template_instance = template.Template(utils.path_unify(path[0])) template_instance.save_template() # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def set_states(self): """ Sets the state of the UI and of some of the widgets in the UI. For example, depending on the state of the asset, the UI will either display component settings and creation widgets, deformation widgets, or build widgets. Also, depending on the state of the asset, other buttons may be toggled on or off. """ asset = component_utils.get_rig_asset_node() if asset.has_skeleton.get(): self.main_widget.setCurrentIndex(1) self.toolbar.clear() else: self.main_widget.setCurrentIndex(0) self._add_setup_tool_buttons(self.toolbar) asset = component_utils.get_rig_asset_node() global_visibility = asset.global_mover_visibility.get() offset_visibility = asset.offset_mover_visibility.get() lra_visibility = asset.lra_visibility.get() self.toggle_global.setChecked(global_visibility) self.toggle_global.toggled.emit(global_visibility) self.toggle_offset.setChecked(offset_visibility) self.toggle_offset.toggled.emit(offset_visibility) self.toggle_lra.setChecked(lra_visibility) self.toggle_lra.toggled.emit(lra_visibility) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def update_list(self): """ Updates the installed components list and then refreshes the state of the UI. """ self.component_list.refresh_list() self.set_states() # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def create_new_asset(): """ Creates a new rig asset and root component if one does not exist. :return: returns True if the user decided to create a new asset. False if not. """ message_box = interface_utils.ConfirmWidget("Do you want to create a new rig asset?", "", "Rig Builder") status = message_box.exec_() if status == QtWidgets.QMessageBox.Yes: import artv2.components.base_components.rig_asset as rig_asset import artv2.components.root as root rig_asset.RigAsset() root.Root() utils.frame_selected() return True return False # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # def show_window(): """ Shows the RigBuilderUI instance, and if no asset exists in the scene at time of launch, then also will create a new rig asset and root component. """ if cmds.window("artv2_rig_builder_window", exists=True): cmds.deleteUI("artv2_rig_builder_window") assets = component_utils.get_all_rig_asset_nodes() if not assets: status = create_new_asset() if status: _gui = RigBuilderUI(interface_utils.get_maya_window()) _gui.show() else: _gui = RigBuilderUI(interface_utils.get_maya_window()) _gui.show()