示例#1
0
    def attrRemoveClicked(self):
        col = lib_state.get_active_collection()
        if col is None:
            return

        sel = lib_maya_utils.get_scene_selection()
        ui_nodes = lib_uiquery.get_selected_ui_nodes(
            self.attribute_treeView,
            self.attribute_filterModel
        )
        attr_list = lib_uiquery.convert_ui_nodes_to_nodes(ui_nodes, 'data')
        lib_attr.remove_attr_from_collection(attr_list, col)

        # Remove Callbacks
        callback_manager = self.getCallbackManager()
        if callback_manager is not None:
            lib_attr.remove_callbacks_from_attributes(
                attr_list,
                callback_manager
            )

        self.updateAttributeModel()
        self.updateSolveValidState()

        # Restore selection.
        lib_maya_utils.set_scene_selection(sel)
        return
示例#2
0
    def removeClicked(self):
        """
        Remove the selected nodes or node attributes from the output
        attributes data model.
        """
        col = lib_state.get_active_collection()
        if col is None:
            return

        sel = lib_maya_utils.get_scene_selection()
        ui_nodes = lib_uiquery.get_selected_ui_nodes(self.treeView,
                                                     self.filterModel)
        attr_list = lib_uiquery.convert_ui_nodes_to_nodes(ui_nodes, 'data')
        lib_attr.remove_attr_from_collection(attr_list, col)

        # Remove Callbacks
        callback_manager = self.callback_manager
        if callback_manager is not None:
            lib_attr.remove_callbacks_from_attributes(attr_list,
                                                      callback_manager)

        self.dataChanged.emit()
        self.viewUpdated.emit()

        # Restore selection.
        lib_maya_utils.set_scene_selection(sel)
        return
示例#3
0
    def objectRemoveClicked(self):
        col = lib_state.get_active_collection()
        if col is None:
            return

        sel = lib_maya_utils.get_scene_selection()
        ui_nodes = lib_uiquery.get_selected_ui_nodes(
            self.object_treeView,
            self.object_filterModel
        )
        nodes = lib_uiquery.convert_ui_nodes_to_nodes(ui_nodes, 'marker')
        lib_marker.remove_markers_from_collection(nodes, col)

        # Remove Callbacks
        callback_manager = self.getCallbackManager()
        if callback_manager is not None:
            lib_marker.remove_callbacks_from_markers(
                nodes,
                callback_manager
            )

        self.updateObjectToggleButtons()
        self.updateObjectModel()
        self.updateSolveValidState()

        # Restore selection.
        lib_maya_utils.set_scene_selection(sel)
        return
    def removeClicked(self):
        col = lib_state.get_active_collection()
        if col is None:
            return

        sel = lib_maya_utils.get_scene_selection()
        ui_nodes = lib_uiquery.get_selected_ui_nodes(
            self.treeView,
            self.filterModel
        )
        nodes = lib_uiquery.convert_ui_nodes_to_nodes(ui_nodes, 'marker')
        lib_marker.remove_markers_from_collection(nodes, col)

        # Remove Callbacks
        callback_manager = self.callback_manager
        if callback_manager is not None:
            lib_marker.remove_callbacks_from_markers(
                nodes,
                callback_manager
            )

        self.dataChanged.emit()
        self.viewUpdated.emit()

        # Restore selection.
        lib_maya_utils.set_scene_selection(sel)
        return
示例#5
0
def _get_selected_maya_nodes(cls_obj):
    tree_view = cls_obj
    filter_model = cls_obj.model()
    ui_nodes = lib_uiquery.get_selected_ui_nodes(
        tree_view,
        filter_model,
    )
    uuid_list = lib_uiquery.convert_ui_nodes_to_nodes(ui_nodes, 'uuid')
    nodes = lib_maya_utils.get_node_names_from_uuids(uuid_list)
    return nodes
    def removeClicked(self):
        """
        Remove the selected nodes or node attributes from the output
        attributes data model.
        """
        try:
            mmapi.set_solver_running(True)  # disable selection callback.

            s = time.time()
            col = lib_state.get_active_collection()
            if col is None:
                return
            e = time.time()
            LOG.debug("attribute removeClicked1: t=%s", e - s)

            s = time.time()
            sel = lib_maya_utils.get_scene_selection()
            ui_nodes = lib_uiquery.get_selected_ui_nodes(
                self.treeView, self.filterModel)
            node_list = lib_uiquery.convert_ui_nodes_to_nodes(ui_nodes, 'data')
            e = time.time()
            LOG.debug("attribute removeClicked2: t=%s", e - s)

            s = time.time()
            attr_list = _convertNodeListToAttrList(node_list)
            lib_attr.remove_attr_from_collection(attr_list, col)

            e = time.time()
            LOG.debug("attribute removeClicked3: t=%s", e - s)

            # Remove Callbacks
            s = time.time()
            callback_manager = self.callback_manager
            if callback_manager is not None:
                lib_attr.remove_callbacks_from_attributes(
                    attr_list, callback_manager)
            e = time.time()
            LOG.debug("attribute removeClicked4: t=%s", e - s)
        finally:
            mmapi.set_solver_running(False)  # enable selection callback

        s = time.time()
        self.dataChanged.emit()
        self.viewUpdated.emit()
        e = time.time()
        LOG.debug("attribute removeClicked5: t=%s", e - s)

        # Restore selection.
        s = time.time()
        lib_maya_utils.set_scene_selection(sel)
        e = time.time()
        LOG.debug("attribute removeClicked5: t=%s", e - s)
        return
def _get_selected_attrs(cls_obj):
    tree_view = cls_obj
    filter_model = cls_obj.model()
    ui_nodes = lib_uiquery.get_selected_ui_nodes(
        tree_view,
        filter_model,
    )
    attr_ui_nodes = [x for x in ui_nodes if isinstance(x, attr_nodes.AttrNode)]
    attr_list = lib_uiquery.convert_ui_nodes_to_nodes(attr_ui_nodes, 'data')
    # maya_ui_nodes = [x for x in ui_nodes if isinstance(x, attr_nodes.MayaNode)]
    # for maya_ui_node in maya_ui_nodes:
    #     # Maya nodes will contain all the attributes added into the UI
    #     # in the 'data' key name on the data of the MayaNode.
    #     attr_list += maya_ui_node.data().get('data')
    return attr_list
示例#8
0
    def objectRemoveClicked(self):
        col = lib_state.get_active_collection()
        if col is None:
            return
        ui_nodes = lib_uiquery.get_selected_ui_nodes(
            self.object_treeView,
            self.object_filterModel
        )
        nodes = lib_uiquery.convert_ui_nodes_to_nodes(ui_nodes, 'marker')
        lib_marker.remove_markers_from_collection(nodes, col)

        # Remove Callbacks
        callback_manager = self.getCallbackManager()
        if callback_manager is not None:
            lib_marker.remove_callbacks_from_markers(
                nodes,
                callback_manager
            )

        self.updateObjectModel()
        self.updateSolveValidState()
        self.setStatusLine(const.STATUS_READY)
        return