Update SceneTree debug colors when settings changed

This commit is contained in:
Haoyu Qiu 2022-03-28 10:49:13 +08:00
parent d8e460cd57
commit 37d4306c2e
2 changed files with 11 additions and 0 deletions

View file

@ -5563,6 +5563,14 @@ void EditorNode::_resource_loaded(RES p_resource, const String &p_path) {
singleton->editor_folding.load_resource_folding(p_resource, p_path); singleton->editor_folding.load_resource_folding(p_resource, p_path);
} }
void EditorNode::_project_settings_changed() {
SceneTree *tree = get_tree();
tree->set_debug_collisions_color(GLOBAL_GET("debug/shapes/collision/shape_color"));
tree->set_debug_collision_contact_color(GLOBAL_GET("debug/shapes/collision/contact_color"));
tree->set_debug_navigation_color(GLOBAL_GET("debug/shapes/navigation/geometry_color"));
tree->set_debug_navigation_disabled_color(GLOBAL_GET("debug/shapes/navigation/disabled_geometry_color"));
}
void EditorNode::_feature_profile_changed() { void EditorNode::_feature_profile_changed() {
Ref<EditorFeatureProfile> profile = feature_profile_manager->get_current_profile(); Ref<EditorFeatureProfile> profile = feature_profile_manager->get_current_profile();
TabContainer *import_tabs = cast_to<TabContainer>(import_dock->get_parent()); TabContainer *import_tabs = cast_to<TabContainer>(import_dock->get_parent());
@ -5694,6 +5702,7 @@ void EditorNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("_reload_modified_scenes"), &EditorNode::_reload_modified_scenes); ClassDB::bind_method(D_METHOD("_reload_modified_scenes"), &EditorNode::_reload_modified_scenes);
ClassDB::bind_method(D_METHOD("_reload_project_settings"), &EditorNode::_reload_project_settings); ClassDB::bind_method(D_METHOD("_reload_project_settings"), &EditorNode::_reload_project_settings);
ClassDB::bind_method(D_METHOD("_resave_scenes"), &EditorNode::_resave_scenes); ClassDB::bind_method(D_METHOD("_resave_scenes"), &EditorNode::_resave_scenes);
ClassDB::bind_method(D_METHOD("_project_settings_changed"), &EditorNode::_project_settings_changed);
ClassDB::bind_method(D_METHOD("_feature_profile_changed"), &EditorNode::_feature_profile_changed); ClassDB::bind_method(D_METHOD("_feature_profile_changed"), &EditorNode::_feature_profile_changed);
ClassDB::bind_method("_screenshot", &EditorNode::_screenshot); ClassDB::bind_method("_screenshot", &EditorNode::_screenshot);
@ -6276,6 +6285,7 @@ EditorNode::EditorNode() {
project_settings = memnew(ProjectSettingsEditor(&editor_data)); project_settings = memnew(ProjectSettingsEditor(&editor_data));
gui_base->add_child(project_settings); gui_base->add_child(project_settings);
ProjectSettings::get_singleton()->connect("project_settings_changed", this, "_project_settings_changed");
run_settings_dialog = memnew(RunSettingsDialog); run_settings_dialog = memnew(RunSettingsDialog);
gui_base->add_child(run_settings_dialog); gui_base->add_child(run_settings_dialog);

View file

@ -663,6 +663,7 @@ private:
void _reload_project_settings(); void _reload_project_settings();
void _resave_scenes(String p_str); void _resave_scenes(String p_str);
void _project_settings_changed();
void _feature_profile_changed(); void _feature_profile_changed();
bool _is_class_editor_disabled_by_feature_profile(const StringName &p_class); bool _is_class_editor_disabled_by_feature_profile(const StringName &p_class);
Ref<ImageTexture> _load_custom_class_icon(const String &p_path) const; Ref<ImageTexture> _load_custom_class_icon(const String &p_path) const;