def _load_stage_order(self): """ Loads the order of all stages from the stages.yaml configuration file """ orders = load_yaml_file("/$$rpconfig/stages.yaml") if "global_stage_order" not in orders: self.error("Could not load stage order, root key does not exist!") return self._stage_order = orders["global_stage_order"]
def load_daytime_overrides(self, override_path): """ Loads an override file for the daytime settings, which contains values to override the settings with """ overrides = load_yaml_file(override_path) if not overrides: self.warn("Failed to load daytime overrides") return for plugin_id, settings in iteritems(overrides["control_points"] or {}): for setting_id, control_points in iteritems(settings): if setting_id not in self.day_settings[plugin_id]: self.warn("Unkown daytime override:", plugin_id, ":", setting_id) continue self.day_settings[plugin_id][setting_id].set_control_points(control_points)
def load_daytime_overrides(self, override_path): """ Loads an override file for the daytime settings, which contains values to override the settings with """ overrides = load_yaml_file(override_path) if not overrides: self.warn("Failed to load daytime overrides") return for plugin_id, settings in iteritems(overrides["control_points"] or {}): for setting_id, control_points in iteritems(settings): if setting_id not in self.day_settings[plugin_id]: self.warn("Unkown daytime override:", plugin_id, ":", setting_id) continue self.day_settings[plugin_id][setting_id].set_control_points( control_points)
def load_setting_overrides(self, override_path): """ Loads an override file for the settings, which contains values to override the settings with """ overrides = load_yaml_file(override_path) if not overrides: self.warn("Failed to load overrides") return self.enabled_plugins = set(overrides["enabled"] or []) for plugin_id, pluginsettings in iteritems(overrides["overrides"] or {}): if plugin_id not in self.settings: self.warn("Unkown plugin in plugin config:", plugin_id) continue for setting_id, setting_val in iteritems(pluginsettings or {}): if setting_id not in self.settings[plugin_id]: self.warn("Unkown override:", plugin_id, ":", setting_id) continue self.settings[plugin_id][setting_id].set_value(setting_val)
def do_load(self, filename): """ Internal method to load the effect from the given filename, do not use this directly, instead use load(). """ self.filename = filename self.effect_name = self._convert_filename_to_name(filename) self.effect_hash = self._generate_hash(filename, self._options) # Load the YAML file parsed_yaml = load_yaml_file(filename) or {} self._parse_content(parsed_yaml) # Construct a shader object for each pass for pass_id in self._PASSES: vertex_src = self._generated_shader_paths["vertex-" + pass_id] fragment_src = self._generated_shader_paths["fragment-" + pass_id] self._shader_objs[pass_id] = RPLoader.load_shader(vertex_src, fragment_src) return True
def load_setting_overrides(self, override_path): """ Loads an override file for the settings, which contains values to override the settings with """ overrides = load_yaml_file(override_path) if not overrides: self.warn("Failed to load overrides") return self.enabled_plugins = set(overrides["enabled"] or []) for plugin_id, pluginsettings in iteritems(overrides["overrides"] or {}): if plugin_id not in self.settings: self.warn("Unkown plugin in plugin config:", plugin_id) continue for setting_id, setting_val in iteritems(pluginsettings or {}): if setting_id not in self.settings[plugin_id]: self.warn("Unkown override:", plugin_id, ":", setting_id) continue self.settings[plugin_id][setting_id].set_value(setting_val)
def do_load(self, filename): """ Internal method to load the effect from the given filename, do not use this directly, instead use load(). """ self.filename = filename self.effect_name = self._convert_filename_to_name(filename) self.effect_hash = self._generate_hash(filename, self._options) # Load the YAML file parsed_yaml = load_yaml_file(filename) or {} self._parse_content(parsed_yaml) # Construct a shader object for each pass for pass_id in self._PASSES: vertex_src = self._generated_shader_paths["vertex-" + pass_id] fragment_src = self._generated_shader_paths["fragment-" + pass_id] self._shader_objs[pass_id] = RPLoader.load_shader( vertex_src, fragment_src) return True
def load_plugin_settings(self, plugin_id, plugin_pth): """ Internal method to load all settings of a plugin, given its plugin id and path to the plugin base directory """ config_file = join(plugin_pth, "config.yaml") config = load_yaml_file(config_file) # When you don't specify anything in the settings, instead of # returning an empty dictionary, pyyaml returns None config["settings"] = config["settings"] or [] config["daytime_settings"] = config["daytime_settings"] or [] settings = collections.OrderedDict( [(k, make_setting_from_data(v)) for k, v in config["settings"]]) self.settings[plugin_id] = settings if self.requires_daytime_settings: daysettings = collections.OrderedDict( [(k, make_daysetting_from_data(v)) for k, v in config["daytime_settings"]]) self.day_settings[plugin_id] = daysettings
def _populate_content(self): """ Populates the windows content """ self._content_node.node().remove_all_children() # Reload config each time the window is opened so its easy to add new # render modes config = load_yaml_file("/$$rpconfig/debugging.yaml") debugger_content = self._content_node.attach_new_node("RenderModes") debugger_content.set_z(-20) debugger_content.set_x(20) render_modes = [("Default", "", False, "", False)] # Read modes from configuration for mode in config["render_modes"]: data = [mode["name"], mode["key"]] data.append(mode.get("cxx_only", False)) data.append(mode.get("requires", "")) data.append(mode.get("special", False)) render_modes.append(data) collection = CheckboxCollection() max_column_height = 9 for idx, (mode, mode_id, requires_cxx, requires_plugin, special) in enumerate(render_modes): offs_y = (idx % max_column_height) * 24 + 35 offs_x = (idx // max_column_height) * 220 enabled = True if requires_cxx and not NATIVE_CXX_LOADED: enabled = False if requires_plugin: if not self._pipeline.plugin_mgr.is_plugin_enabled(requires_plugin): enabled = False box = LabeledCheckbox( parent=debugger_content, x=offs_x, y=offs_y, text=mode.upper(), text_color=Vec3(0.4), radio=True, chb_checked=(mode_id == self._selected_mode), chb_callback=partial(self._set_render_mode, mode_id, special), text_size=14, expand_width=230, enabled=enabled) collection.add(box.checkbox)
def load_plugin_settings(self, plugin_id, plugin_pth): """ Internal method to load all settings of a plugin, given its plugin id and path to the plugin base directory """ config_file = join(plugin_pth, "config.yaml") config = load_yaml_file(config_file) # When you don't specify anything in the settings, instead of # returning an empty dictionary, pyyaml returns None config["settings"] = config["settings"] or [] config["daytime_settings"] = config["daytime_settings"] or [] settings = collections.OrderedDict([(k, make_setting_from_data(v)) for k, v in config["settings"]]) self.settings[plugin_id] = settings if self.requires_daytime_settings: daysettings = collections.OrderedDict([ (k, make_daysetting_from_data(v)) for k, v in config["daytime_settings"] ]) self.day_settings[plugin_id] = daysettings
def load_plugin_settings(self, plugin_id, plugin_pth): """ Internal method to load all settings of a plugin, given its plugin id and path to the plugin base directory """ config_file = join(plugin_pth, "config.yaml") config = load_yaml_file(config_file) # When you don't specify anything in the settings, instead of # returning an empty dictionary, pyyaml returns None config["settings"] = config["settings"] or [] config["daytime_settings"] = config["daytime_settings"] or [] if isinstance(config["settings"], dict) or isinstance(config["daytime_settings"], dict) or \ (config["settings"] and len(config["settings"][0]) != 2) or \ (config["daytime_settings"] and len(config["daytime_settings"][0]) != 2): self.error("Malformed config for plugin", plugin_id, "- did you miss '!!omap' ?") settings = collections.OrderedDict( [(k, make_setting_from_data(v)) for k, v in config["settings"]]) self.settings[plugin_id] = settings if self.requires_daytime_settings: daysettings = collections.OrderedDict( [(k, make_daysetting_from_data(v)) for k, v in config["daytime_settings"]]) self.day_settings[plugin_id] = daysettings
def _load_config(self): """ Loads the tasks distribution configuration """ config = load_yaml_file("/$$rpconfig/task-scheduler.yaml")["frame_cycles"] for frame_name, tasks in config: self._tasks.append(tasks)
def _load_config(self): """ Loads the tasks distribution configuration """ config = load_yaml_file( "/$$rp/config/task-scheduler.yaml")["frame_cycles"] for frame_name, tasks in config: # pylint: disable=unused-variable self._tasks.append(tasks)
def _load_config(self): """ Loads the gui configuration from config/debugging.yaml """ self._config = load_yaml_file("/$$rpconfig/debugging.yaml")