summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/node.cpp42
-rw-r--r--scene/main/node.h1
-rw-r--r--scene/main/scene_tree.cpp54
-rw-r--r--scene/main/scene_tree.h17
-rw-r--r--scene/main/window.cpp16
5 files changed, 109 insertions, 21 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index a30eb036db..b4701637a4 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -384,11 +384,7 @@ void Node::_move_child(Node *p_child, int p_pos, bool p_ignore_end) {
for (int i = motion_from; i <= motion_to; i++) {
data.children[i]->notification(NOTIFICATION_MOVED_IN_PARENT);
}
- for (const KeyValue<StringName, GroupData> &E : p_child->data.grouped) {
- if (E.value.group) {
- E.value.group->changed = true;
- }
- }
+ p_child->_propagate_groups_dirty();
data.blocked--;
}
@@ -408,6 +404,18 @@ void Node::raise() {
}
}
+void Node::_propagate_groups_dirty() {
+ for (const KeyValue<StringName, GroupData> &E : data.grouped) {
+ if (E.value.group) {
+ E.value.group->changed = true;
+ }
+ }
+
+ for (int i = 0; i < data.children.size(); i++) {
+ data.children[i]->_propagate_groups_dirty();
+ }
+}
+
void Node::add_child_notify(Node *p_child) {
// to be used when not wanted
}
@@ -431,9 +439,9 @@ void Node::set_physics_process(bool p_process) {
data.physics_process = p_process;
if (data.physics_process) {
- add_to_group("physics_process", false);
+ add_to_group(SNAME("_physics_process"), false);
} else {
- remove_from_group("physics_process");
+ remove_from_group(SNAME("_physics_process"));
}
}
@@ -449,9 +457,9 @@ void Node::set_physics_process_internal(bool p_process_internal) {
data.physics_process_internal = p_process_internal;
if (data.physics_process_internal) {
- add_to_group("physics_process_internal", false);
+ add_to_group(SNAME("_physics_process_internal"), false);
} else {
- remove_from_group("physics_process_internal");
+ remove_from_group(SNAME("_physics_process_internal"));
}
}
@@ -762,9 +770,9 @@ void Node::set_process(bool p_process) {
data.process = p_process;
if (data.process) {
- add_to_group("process", false);
+ add_to_group(SNAME("_process"), false);
} else {
- remove_from_group("process");
+ remove_from_group(SNAME("_process"));
}
}
@@ -780,9 +788,9 @@ void Node::set_process_internal(bool p_process_internal) {
data.process_internal = p_process_internal;
if (data.process_internal) {
- add_to_group("process_internal", false);
+ add_to_group(SNAME("_process_internal"), false);
} else {
- remove_from_group("process_internal");
+ remove_from_group(SNAME("_process_internal"));
}
}
@@ -799,19 +807,19 @@ void Node::set_process_priority(int p_priority) {
}
if (is_processing()) {
- data.tree->make_group_changed("process");
+ data.tree->make_group_changed(SNAME("_process"));
}
if (is_processing_internal()) {
- data.tree->make_group_changed("process_internal");
+ data.tree->make_group_changed(SNAME("_process_internal"));
}
if (is_physics_processing()) {
- data.tree->make_group_changed("physics_process");
+ data.tree->make_group_changed(SNAME("_physics_process"));
}
if (is_physics_processing_internal()) {
- data.tree->make_group_changed("physics_process_internal");
+ data.tree->make_group_changed(SNAME("_physics_process_internal"));
}
}
diff --git a/scene/main/node.h b/scene/main/node.h
index 5b7bc0a587..3c4727f11c 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -174,6 +174,7 @@ private:
void _propagate_after_exit_tree();
void _print_orphan_nodes();
void _propagate_process_owner(Node *p_owner, int p_pause_notification, int p_enabled_notification);
+ void _propagate_groups_dirty();
Array _get_node_and_resource(const NodePath &p_path);
void _duplicate_signals(const Node *p_original, Node *p_copy) const;
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index dd77877c7d..a76c00efcb 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -412,9 +412,9 @@ bool SceneTree::physics_process(double p_time) {
emit_signal(SNAME("physics_frame"));
- _notify_group_pause(SNAME("physics_process_internal"), Node::NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
+ _notify_group_pause(SNAME("_physics_process_internal"), Node::NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
call_group(SNAME("_picking_viewports"), SNAME("_process_picking"));
- _notify_group_pause(SNAME("physics_process"), Node::NOTIFICATION_PHYSICS_PROCESS);
+ _notify_group_pause(SNAME("_physics_process"), Node::NOTIFICATION_PHYSICS_PROCESS);
_flush_ugc();
MessageQueue::get_singleton()->flush(); //small little hack
@@ -449,8 +449,8 @@ bool SceneTree::process(double p_time) {
flush_transform_notifications();
- _notify_group_pause(SNAME("process_internal"), Node::NOTIFICATION_INTERNAL_PROCESS);
- _notify_group_pause(SNAME("process"), Node::NOTIFICATION_PROCESS);
+ _notify_group_pause(SNAME("_process_internal"), Node::NOTIFICATION_INTERNAL_PROCESS);
+ _notify_group_pause(SNAME("_process"), Node::NOTIFICATION_PROCESS);
_flush_ugc();
MessageQueue::get_singleton()->flush(); //small little hack
@@ -659,6 +659,14 @@ bool SceneTree::is_debugging_collisions_hint() const {
return debug_collisions_hint;
}
+void SceneTree::set_debug_paths_hint(bool p_enabled) {
+ debug_paths_hint = p_enabled;
+}
+
+bool SceneTree::is_debugging_paths_hint() const {
+ return debug_paths_hint;
+}
+
void SceneTree::set_debug_navigation_hint(bool p_enabled) {
debug_navigation_hint = p_enabled;
}
@@ -684,6 +692,22 @@ Color SceneTree::get_debug_collision_contact_color() const {
return debug_collision_contact_color;
}
+void SceneTree::set_debug_paths_color(const Color &p_color) {
+ debug_paths_color = p_color;
+}
+
+Color SceneTree::get_debug_paths_color() const {
+ return debug_paths_color;
+}
+
+void SceneTree::set_debug_paths_width(float p_width) {
+ debug_paths_width = p_width;
+}
+
+float SceneTree::get_debug_paths_width() const {
+ return debug_paths_width;
+}
+
void SceneTree::set_debug_navigation_color(const Color &p_color) {
debug_navigation_color = p_color;
}
@@ -700,6 +724,23 @@ Color SceneTree::get_debug_navigation_disabled_color() const {
return debug_navigation_disabled_color;
}
+Ref<Material> SceneTree::get_debug_paths_material() {
+ if (debug_paths_material.is_valid()) {
+ return debug_paths_material;
+ }
+
+ Ref<StandardMaterial3D> _debug_material = Ref<StandardMaterial3D>(memnew(StandardMaterial3D));
+ _debug_material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);
+ _debug_material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA);
+ _debug_material->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true);
+ _debug_material->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
+ _debug_material->set_albedo(get_debug_paths_color());
+
+ debug_paths_material = _debug_material;
+
+ return debug_paths_material;
+}
+
Ref<Material> SceneTree::get_debug_navigation_material() {
if (navigation_material.is_valid()) {
return navigation_material;
@@ -1207,6 +1248,8 @@ void SceneTree::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_debug_collisions_hint", "enable"), &SceneTree::set_debug_collisions_hint);
ClassDB::bind_method(D_METHOD("is_debugging_collisions_hint"), &SceneTree::is_debugging_collisions_hint);
+ ClassDB::bind_method(D_METHOD("set_debug_paths_hint", "enable"), &SceneTree::set_debug_paths_hint);
+ ClassDB::bind_method(D_METHOD("is_debugging_paths_hint"), &SceneTree::is_debugging_paths_hint);
ClassDB::bind_method(D_METHOD("set_debug_navigation_hint", "enable"), &SceneTree::set_debug_navigation_hint);
ClassDB::bind_method(D_METHOD("is_debugging_navigation_hint"), &SceneTree::is_debugging_navigation_hint);
@@ -1268,6 +1311,7 @@ void SceneTree::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "auto_accept_quit"), "set_auto_accept_quit", "is_auto_accept_quit");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "quit_on_go_back"), "set_quit_on_go_back", "is_quit_on_go_back");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_collisions_hint"), "set_debug_collisions_hint", "is_debugging_collisions_hint");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_paths_hint"), "set_debug_paths_hint", "is_debugging_paths_hint");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_navigation_hint"), "set_debug_navigation_hint", "is_debugging_navigation_hint");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "paused"), "set_pause", "is_paused");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "edited_scene_root", PROPERTY_HINT_RESOURCE_TYPE, "Node", PROPERTY_USAGE_NONE), "set_edited_scene_root", "get_edited_scene_root");
@@ -1344,6 +1388,8 @@ SceneTree::SceneTree() {
}
debug_collisions_color = GLOBAL_DEF("debug/shapes/collision/shape_color", Color(0.0, 0.6, 0.7, 0.42));
debug_collision_contact_color = GLOBAL_DEF("debug/shapes/collision/contact_color", Color(1.0, 0.2, 0.1, 0.8));
+ debug_paths_color = GLOBAL_DEF("debug/shapes/paths/geometry_color", Color(0.1, 1.0, 0.7, 0.4));
+ debug_paths_width = GLOBAL_DEF("debug/shapes/paths/geometry_width", 2.0);
debug_navigation_color = GLOBAL_DEF("debug/shapes/navigation/geometry_color", Color(0.1, 1.0, 0.7, 0.4));
debug_navigation_disabled_color = GLOBAL_DEF("debug/shapes/navigation/disabled_geometry_color", Color(1.0, 0.7, 0.1, 0.4));
collision_debug_contacts = GLOBAL_DEF("debug/shapes/collision/max_contacts_displayed", 10000);
diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h
index 67a17a69f2..a34aa8e2cd 100644
--- a/scene/main/scene_tree.h
+++ b/scene/main/scene_tree.h
@@ -97,6 +97,7 @@ private:
#ifdef DEBUG_ENABLED
bool debug_collisions_hint = false;
+ bool debug_paths_hint = false;
bool debug_navigation_hint = false;
#endif
bool paused = false;
@@ -146,9 +147,12 @@ private:
Color debug_collisions_color;
Color debug_collision_contact_color;
+ Color debug_paths_color;
+ float debug_paths_width = 1.0f;
Color debug_navigation_color;
Color debug_navigation_disabled_color;
Ref<ArrayMesh> debug_contact_mesh;
+ Ref<Material> debug_paths_material;
Ref<Material> navigation_material;
Ref<Material> navigation_disabled_material;
Ref<Material> collision_material;
@@ -297,12 +301,18 @@ public:
void set_debug_collisions_hint(bool p_enabled);
bool is_debugging_collisions_hint() const;
+ void set_debug_paths_hint(bool p_enabled);
+ bool is_debugging_paths_hint() const;
+
void set_debug_navigation_hint(bool p_enabled);
bool is_debugging_navigation_hint() const;
#else
void set_debug_collisions_hint(bool p_enabled) {}
bool is_debugging_collisions_hint() const { return false; }
+ void set_debug_paths_hint(bool p_enabled) {}
+ bool is_debugging_paths_hint() const { return false; }
+
void set_debug_navigation_hint(bool p_enabled) {}
bool is_debugging_navigation_hint() const { return false; }
#endif
@@ -313,12 +323,19 @@ public:
void set_debug_collision_contact_color(const Color &p_color);
Color get_debug_collision_contact_color() const;
+ void set_debug_paths_color(const Color &p_color);
+ Color get_debug_paths_color() const;
+
+ void set_debug_paths_width(float p_width);
+ float get_debug_paths_width() const;
+
void set_debug_navigation_color(const Color &p_color);
Color get_debug_navigation_color() const;
void set_debug_navigation_disabled_color(const Color &p_color);
Color get_debug_navigation_disabled_color() const;
+ Ref<Material> get_debug_paths_material();
Ref<Material> get_debug_navigation_material();
Ref<Material> get_debug_navigation_disabled_material();
Ref<Material> get_debug_collision_material();
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index 69fb5fdf07..73e8f537d9 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -822,6 +822,22 @@ void Window::_notification(int p_what) {
emit_signal(SceneStringNames::get_singleton()->visibility_changed);
RS::get_singleton()->viewport_set_active(get_viewport_rid(), true);
}
+
+ if (theme.is_null()) {
+ Control *parent_c = cast_to<Control>(get_parent());
+ if (parent_c && (parent_c->data.theme_owner || parent_c->data.theme_owner_window)) {
+ theme_owner = parent_c->data.theme_owner;
+ theme_owner_window = parent_c->data.theme_owner_window;
+ notification(NOTIFICATION_THEME_CHANGED);
+ } else {
+ Window *parent_w = cast_to<Window>(get_parent());
+ if (parent_w && (parent_w->theme_owner || parent_w->theme_owner_window)) {
+ theme_owner = parent_w->theme_owner;
+ theme_owner_window = parent_w->theme_owner_window;
+ notification(NOTIFICATION_THEME_CHANGED);
+ }
+ }
+ }
} break;
case NOTIFICATION_READY: {