Ejemplo n.º 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
Ejemplo n.º 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
    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