def populateModel(self, model): valid = uiutils.isValidQtObject(model) if valid is False: return col = lib_state.get_active_collection() attr_list = [] show_anm = const.ATTRIBUTE_TOGGLE_ANIMATED_DEFAULT_VALUE show_stc = const.ATTRIBUTE_TOGGLE_STATIC_DEFAULT_VALUE show_lck = const.ATTRIBUTE_TOGGLE_LOCKED_DEFAULT_VALUE if col is not None: attr_list = lib_attr.get_attributes_from_collection(col) show_anm = lib_col.get_attribute_toggle_animated_from_collection( col) show_stc = lib_col.get_attribute_toggle_static_from_collection(col) show_lck = lib_col.get_attribute_toggle_locked_from_collection(col) def update_func(): if uiutils.isValidQtObject(self) is False: return self.dataChanged.emit() return # Add Callbacks # # When querying attributes, we must make sure they have a Maya # callback attached to the node to update the UI. callback_manager = self.callback_manager if callback_manager is not None: lib_attr.add_callbacks_to_attributes(attr_list, update_func, callback_manager) root = convert_to_ui.attributesToUINodes(col, attr_list, show_anm, show_stc, show_lck) model.setRootNode(root) return
def populateModel(self, model, col): s = time.time() valid = uiutils.isValidQtObject(model) if valid is False: return attr_list = [] show_anm = const.ATTRIBUTE_TOGGLE_ANIMATED_DEFAULT_VALUE show_stc = const.ATTRIBUTE_TOGGLE_STATIC_DEFAULT_VALUE show_lck = const.ATTRIBUTE_TOGGLE_LOCKED_DEFAULT_VALUE if col is not None: attr_list = lib_attr.get_attributes_from_collection(col) show_anm = lib_col.get_attribute_toggle_animated_from_collection( col) show_stc = lib_col.get_attribute_toggle_static_from_collection(col) show_lck = lib_col.get_attribute_toggle_locked_from_collection(col) # Add Callbacks # # When querying attributes, we must make sure they have a Maya # callback attached to the node to update the UI. callback_manager = self.callback_manager if callback_manager is not None: lib_attr.add_callbacks_to_attributes( attr_list, callback_manager, ) root = convert_to_ui.attributesToUINodes(col, attr_list, show_anm, show_stc, show_lck) model.setRootNode(root) e = time.time() LOG.debug('populateModel: %r', e - s) return
def toggleStaticClicked(self): col = lib_state.get_active_collection() if col is None: LOG.warning('No active collection to set.') return value = lib_col.get_attribute_toggle_static_from_collection(col) value = not value lib_col.set_attribute_toggle_static_on_collection(col, value) self.dataChanged.emit() return
def updateAttributeToggleButtons(self): col = lib_state.get_active_collection() if col is None: return show_anm = lib_col.get_attribute_toggle_animated_from_collection(col) show_stc = lib_col.get_attribute_toggle_static_from_collection(col) show_lck = lib_col.get_attribute_toggle_locked_from_collection(col) self.attributeToggleAnimated_toolButton.setChecked(show_anm) self.attributeToggleStatic_toolButton.setChecked(show_stc) self.attributeToggleLocked_toolButton.setChecked(show_lck) return
def attributeToggleStaticClicked(self): col = lib_state.get_active_collection() if col is None: LOG.warning('No active collection to set.') return value = lib_col.get_attribute_toggle_static_from_collection(col) value = not value lib_col.set_attribute_toggle_static_on_collection(col, value) self.updateAttributeModel() self.updateSolveValidState() return
def updateToggleButtons(self): is_running = mmapi.is_solver_running() if is_running is True: return col = lib_state.get_active_collection() if col is None: return show_anm = lib_col.get_attribute_toggle_animated_from_collection(col) show_stc = lib_col.get_attribute_toggle_static_from_collection(col) show_lck = lib_col.get_attribute_toggle_locked_from_collection(col) self.toggleAnimated_toolButton.setChecked(show_anm) self.toggleStatic_toolButton.setChecked(show_stc) self.toggleLocked_toolButton.setChecked(show_lck) return