def cycle_viewport_presets(): cache = path.get_config_yaml(VIEWPORT_PRESET_YAML) presets = database._parse_yaml(cache).keys() current_viewport_preset = database.read_cache('current_viewport_preset') logger.info(presets) l = len(presets) i = 0 if current_viewport_preset in presets: for k in range(l): i = k logger.info("presets[%s] %s" % (i, presets[i])) if current_viewport_preset == presets[i]: logger.info("%s is a match" % i) break else: i = 0 i += 1 if i >= l: i = 0 database.save_cache('current_viewport_preset', presets[i], yaml_file=CACHE_YAML) maya_scene.apply_viewport_preset(cache, presets[i])
def apply_preset(self, preset_name=None): preset_file = path.get_config_yaml(VIEWPORT_YAML) if not preset_name: preset_name = self.ui.ui_viewportpreset_comboBox.currentText() maya_scene.apply_viewport_preset(preset_file, preset_name)
def apply_viewport_preset(preset_name): cache = path.get_config_yaml(VIEWPORT_PRESET_YAML) maya_scene.apply_viewport_preset(cache, preset_name)
def apply_preset_to_all(self, preset_name=None): preset_file = path.get_config_yaml(VIEWPORT_YAML) if not preset_name: preset_name = self.ui.ui_viewportpreset_comboBox.currentText() panels = maya_scene.get_all_modelPanels() maya_scene.apply_viewport_preset(preset_file, preset_name, panels)