This class is a way for plugins to append additional settings, not defined by/for the main program itself.
Each plugin needs to register as either a 'setting_definitions_appender' or 'backend_plugin'.
Any implementation also needs to fill 'self.definition_file_paths' with a list of files with setting definitions.
Each file should be a json list of setting categories, either matching existing names, or be a new category.
Each category and setting has the same json structure as the main settings otherwise.
It's also possible to set the 'self.appender_type', if there are many kinds of plugins to implement this,
in order to prevent name-clashes.
Lastly, if setting-definitions are to be made on the fly by the plugin, override 'getAdditionalSettingDefinitions',
instead of providing the files. This should then return a dict, as if parsed by json.
Dict[str, Any] UM.Settings.AdditionalSettingDefinitionsAppender.AdditionalSettingDefinitionsAppender._prependIdToSettings |
( |
| self, |
|
|
Dict[str, Any] | settings ) |
|
protected |
This takes the whole (extra) settings-map as defined by the provider, and returns a tag-renamed version.
Note that this function also translates the (label and description of the) settings, if a catalog is present.
Additional (appended) settings will need to be prepended with (an) extra identifier(s)/namespaces to not collide.
This is done for when there are multiple additional settings appenders that might not know about each other.
This includes any formulas, which will also be included in the renaming process.
Appended settings may not be the same as 'baseline' (so any 'non-appended' settings) settings.
(But may of course clash between different providers and versions, that's the whole point of this function...)
Furthermore, it's assumed that formulas within the appended settings will only use settings either;
- as defined within the baseline, or;
- any other settings defined _by the provider itself_.
For each key that is renamed, this results in a mapping <key> -> _<provider_type>__<id*>__<version>__<key>
where '<id*>' is the version of the provider, but converted from using points to using underscores.
Example: 'tapdance_factor' might become '_plugin__dancingprinter__1_2_99__tapdance_factor'
Also note that all the tag_... parameters will be forced to lower-case.
:param tag_type: Type of the additional settings appender, for example; "PLUGIN".
:param tag_id: ID of the provider. Should be unique.
:param tag_version: Version of the provider. Points will be replaced by underscores.
:param settings: The settings as originally provided.
:returns: Remapped settings, where each settings-name is properly tagged/'namespaced'.