ConfigEditorBase ​
Inherits: ResourceEditor < Control
Inherited by: DynamicMusicEditor, EnvironmentConfigEditor, SkyConfigEditor, SoundAlbumEditor, SunConfigEditor, TimeConfigEditor, WeaponProfileEditor, WeatherEditor, WeatherTableEditor
The base of the editors of the world configs (Time, Sun, Sky, Environment, Weather), built like the other editors of the toolkit: a scene with the list of the configs on the left (the shared EditorFileList with its New button) and the settings on the right in a container for each group. The scene is hand built; the fields in it are the field components (ConfigField: number, toggle, option, colour, vector) placed in the containers, each with the name of the property it shows. This script opens a config in all of them, saves every change, and does what the lists of all the editors do (new, duplicate, delete).
Description ​
The default config of a kind is always there and cannot be deleted. An editor script extends this class, says its resource type and default id (_configure_for_resource_type), and overrides _update_visibility for the groups and fields that only apply sometimes (a sun with a day night cycle has no Static Sun container).
Variables ​
int | default_id | 0 |
Methods ​
void | setup_managers( p_resource_manager: ResourceManager, p_dialog_manager: DialogManager ) |
Array[ConfigField] | get_fields() |
ConfigField | get_field( property: StringName ) |
void | select_default() |
void | set_fields_visible( properties: Array, shown: bool ) |
void | set_group_visible( node_name: String, shown: bool ) |
bool | is_default( resource: Resource ) |
Resource | duplicate_config( resource: Resource ) |
bool | delete_config( resource: Resource ) |
Signals ​
config_changed( config: Resource ) ​
A setting of the open config changed (the config has it already and is saved)
Variable descriptions ​
int default_id = 0 ​
The id of the default config of this kind (it cannot be deleted); 0 = none
Method descriptions ​
void setup_managers( p_resource_manager: ResourceManager, p_dialog_manager: DialogManager ) ​
Overrides this function of ResourceEditor.
Array[ConfigField] get_fields() ​
All the field components in the scene
ConfigField get_field( property: StringName ) ​
The field of a property (null when the scene has none)
void select_default() ​
Opens the default config of this kind
void set_fields_visible( properties: Array, shown: bool ) ​
Shows or hides the fields of some properties (a field that does not apply is hidden)
void set_group_visible( node_name: String, shown: bool ) ​
Shows or hides a group container by the name of its node in the scene (the unique name, "StaticSunGroup")
bool is_default( resource: Resource ) ​
Is this the default config (it stays)?
Resource duplicate_config( resource: Resource ) ​
Makes a copy of a config under a new id and opens it
bool delete_config( resource: Resource ) ​
Deletes a config (never the default) and opens the default