Update SceneTree debug colors when settings changed - timothyqiu
37d4306c2e
This commit is contained in:
Relintai 2022-07-25 18:55:29 +02:00
parent ac5e352088
commit eb99e955d9
2 changed files with 18 additions and 6 deletions

View File

@ -5461,6 +5461,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::_bind_methods() { void EditorNode::_bind_methods() {
GLOBAL_DEF("editor/scene/scene_naming", SCENE_NAME_CASING_AUTO); GLOBAL_DEF("editor/scene/scene_naming", SCENE_NAME_CASING_AUTO);
ProjectSettings::get_singleton()->set_custom_property_info("editor/scene/scene_naming", PropertyInfo(Variant::INT, "editor/scene/scene_naming", PROPERTY_HINT_ENUM, "Auto,PascalCase,snake_case")); ProjectSettings::get_singleton()->set_custom_property_info("editor/scene/scene_naming", PropertyInfo(Variant::INT, "editor/scene/scene_naming", PROPERTY_HINT_ENUM, "Auto,PascalCase,snake_case"));
@ -5552,6 +5560,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("_screenshot", &EditorNode::_screenshot); ClassDB::bind_method("_screenshot", &EditorNode::_screenshot);
ClassDB::bind_method("_request_screenshot", &EditorNode::_request_screenshot); ClassDB::bind_method("_request_screenshot", &EditorNode::_request_screenshot);
@ -6117,6 +6126,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

@ -33,34 +33,34 @@
#include "core/object.h" #include "core/object.h"
#include "scene/main/node.h" #include "scene/main/node.h"
#include "editor/editor_folding.h"
#include "editor/editor_run.h"
#include "editor/inspector_dock.h" #include "editor/inspector_dock.h"
#include "editor/scene_tree_dock.h" #include "editor/scene_tree_dock.h"
#include "editor/editor_run.h"
#include "editor/editor_folding.h"
#include "scene/gui/split_container.h"
#include "scene/gui/menu_button.h" #include "scene/gui/menu_button.h"
#include "scene/gui/split_container.h"
#include "editor/editor_data.h"
#include "core/dictionary.h" #include "core/dictionary.h"
#include "core/error_list.h" #include "core/error_list.h"
#include "core/list.h" #include "core/list.h"
#include "core/map.h" #include "core/map.h"
#include "core/math/rect2.h" #include "core/math/rect2.h"
#include "core/node_path.h" #include "core/node_path.h"
#include "core/safe_refcount.h"
#include "core/os/mutex.h" #include "core/os/mutex.h"
#include "core/os/os.h" #include "core/os/os.h"
#include "core/os/thread.h" #include "core/os/thread.h"
#include "core/print_string.h" #include "core/print_string.h"
#include "core/reference.h" #include "core/reference.h"
#include "core/resource.h" #include "core/resource.h"
#include "core/safe_refcount.h"
#include "core/set.h" #include "core/set.h"
#include "core/string_name.h" #include "core/string_name.h"
#include "core/typedefs.h" #include "core/typedefs.h"
#include "core/ustring.h" #include "core/ustring.h"
#include "core/variant.h" #include "core/variant.h"
#include "core/vector.h" #include "core/vector.h"
#include "editor/editor_data.h"
#include "scene/gui/control.h" #include "scene/gui/control.h"
#include "scene/resources/texture.h" #include "scene/resources/texture.h"
@ -89,7 +89,8 @@ class Tree;
class UndoRedo; class UndoRedo;
class VBoxContainer; class VBoxContainer;
class Viewport; class Viewport;
template <class T> class PoolVector; template <class T>
class PoolVector;
typedef void (*EditorNodeInitCallback)(); typedef void (*EditorNodeInitCallback)();
typedef void (*EditorPluginInitializeCallback)(); typedef void (*EditorPluginInitializeCallback)();
@ -703,6 +704,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();
Ref<ImageTexture> _load_custom_class_icon(const String &p_path) const; Ref<ImageTexture> _load_custom_class_icon(const String &p_path) const;
static String _to_absolute_plugin_path(const String &p_path); static String _to_absolute_plugin_path(const String &p_path);