diff options
Diffstat (limited to 'scene/main')
-rw-r--r-- | scene/main/canvas_layer.cpp | 2 | ||||
-rw-r--r-- | scene/main/canvas_layer.h | 5 | ||||
-rw-r--r-- | scene/main/http_request.cpp | 2 | ||||
-rw-r--r-- | scene/main/node.cpp | 35 | ||||
-rw-r--r-- | scene/main/node.h | 6 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 10 | ||||
-rw-r--r-- | scene/main/window.cpp | 3 |
7 files changed, 24 insertions, 39 deletions
diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp index d9b29daf26..85d7edd64b 100644 --- a/scene/main/canvas_layer.cpp +++ b/scene/main/canvas_layer.cpp @@ -258,13 +258,11 @@ void CanvasLayer::_update_follow_viewport(bool p_force_exit) { } } -#ifdef TOOLS_ENABLED void CanvasLayer::_validate_property(PropertyInfo &property) const { if (!follow_viewport && property.name == "follow_viewport_scale") { property.usage = PROPERTY_USAGE_NOEDITOR; } } -#endif void CanvasLayer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_layer", "layer"), &CanvasLayer::set_layer); diff --git a/scene/main/canvas_layer.h b/scene/main/canvas_layer.h index b20b291367..899039340a 100644 --- a/scene/main/canvas_layer.h +++ b/scene/main/canvas_layer.h @@ -61,13 +61,10 @@ class CanvasLayer : public Node { void _update_locrotscale(); void _update_follow_viewport(bool p_force_exit = false); -#ifdef TOOLS_ENABLED - void _validate_property(PropertyInfo &property) const override; -#endif - protected: void _notification(int p_what); static void _bind_methods(); + void _validate_property(PropertyInfo &property) const override; public: void set_layer(int p_xform); diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp index 71c372aec2..e4ed5c6e6c 100644 --- a/scene/main/http_request.cpp +++ b/scene/main/http_request.cpp @@ -335,7 +335,7 @@ bool HTTPRequest::_update_connection() { call_deferred("_request_done", RESULT_CHUNKED_BODY_SIZE_MISMATCH, response_code, response_headers, PackedByteArray()); return true; - // Request migh have been done + // Request might have been done } else { // Did not request yet, do request diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 9d8c7981e6..933f67db68 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -428,7 +428,7 @@ void Node::set_process_mode(ProcessMode p_mode) { _propagate_process_owner(data.process_owner, pause_notification); #ifdef TOOLS_ENABLED // This is required for the editor to update the visibility of disabled nodes - // Its very expensive during runtime to change, so editor-only + // It's very expensive during runtime to change, so editor-only if (Engine::get_singleton()->is_editor_hint()) { get_tree()->emit_signal("tree_process_mode_changed"); } @@ -1021,22 +1021,8 @@ void Node::_set_name_nocheck(const StringName &p_name) { data.name = p_name; } -String Node::invalid_character = ". : @ / \""; - -bool Node::_validate_node_name(String &p_name) { - String name = p_name; - Vector<String> chars = Node::invalid_character.split(" "); - for (int i = 0; i < chars.size(); i++) { - name = name.replace(chars[i], ""); - } - bool is_valid = name == p_name; - p_name = name; - return is_valid; -} - void Node::set_name(const String &p_name) { - String name = p_name; - _validate_node_name(name); + String name = p_name.validate_node_name(); ERR_FAIL_COND(name == ""); data.name = name; @@ -1144,7 +1130,7 @@ String increase_numeric_string(const String &s) { void Node::_generate_serial_child_name(const Node *p_child, StringName &name) const { if (name == StringName()) { - //no name and a new nade is needed, create one. + //no name and a new name is needed, create one. name = p_child->get_class(); // Adjust casing according to project setting. The current type name is expected to be in PascalCase. @@ -1170,7 +1156,7 @@ void Node::_generate_serial_child_name(const Node *p_child, StringName &name) co bool exists = false; for (int i = 0; i < cc; i++) { - if (children_ptr[i] == p_child) { //exclude self in renaming if its already a child + if (children_ptr[i] == p_child) { //exclude self in renaming if it's already a child continue; } if (children_ptr[i]->data.name == name) { @@ -1959,7 +1945,7 @@ void Node::set_editable_instance(Node *p_node, bool p_editable) { if (!p_editable) { p_node->data.editable_instance = false; // Avoid this flag being needlessly saved; - // also give more visual feedback if editable children is re-enabled + // also give more visual feedback if editable children are re-enabled set_display_folded(false); } else { p_node->data.editable_instance = true; @@ -2065,19 +2051,26 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const // Since nodes in the instanced hierarchy won't be duplicated explicitly, we need to make an inventory // of all the nodes in the tree of the instanced scene in order to transfer the values of the properties + Vector<const Node *> instance_roots; + instance_roots.push_back(this); + for (List<const Node *>::Element *N = node_tree.front(); N; N = N->next()) { for (int i = 0; i < N->get()->get_child_count(); ++i) { Node *descendant = N->get()->get_child(i); // Skip nodes not really belonging to the instanced hierarchy; they'll be processed normally later // but remember non-instanced nodes that are hidden below instanced ones - if (descendant->data.owner != this) { - if (descendant->get_parent() && descendant->get_parent() != this && descendant->get_parent()->data.owner == this && descendant->data.owner != descendant->get_parent()) { + if (!instance_roots.has(descendant->get_owner())) { + if (descendant->get_parent() && descendant->get_parent() != this && descendant->data.owner != descendant->get_parent()) { hidden_roots.push_back(descendant); } continue; } node_tree.push_back(descendant); + + if (descendant->get_filename() != "" && instance_roots.has(descendant->get_owner())) { + instance_roots.push_back(descendant); + } } } } diff --git a/scene/main/node.h b/scene/main/node.h index d47d271a10..b1e51d2aee 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -190,12 +190,6 @@ private: _FORCE_INLINE_ bool _can_process(bool p_paused) const; -#ifdef TOOLS_ENABLED - friend class SceneTreeEditor; -#endif - static String invalid_character; - static bool _validate_node_name(String &p_name); - protected: void _block() { data.blocked++; } void _unblock() { data.blocked--; } diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 40b85e6d7b..e4cda4b96f 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1163,7 +1163,7 @@ void Viewport::set_world_2d(const Ref<World2D> &p_world_2d) { if (p_world_2d.is_valid()) { world_2d = p_world_2d; } else { - WARN_PRINT("Invalid world_3d"); + WARN_PRINT("Invalid world_2d"); world_2d = Ref<World2D>(memnew(World2D)); } @@ -2201,7 +2201,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { embedder = this; viewport_pos = mpos; } else { - //not an embeder, but may be a subwindow of an embedder + //not an embedder, but may be a subwindow of an embedder Window *w = Object::cast_to<Window>(this); if (w) { if (w->is_embedded()) { @@ -2393,7 +2393,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { //keyboard focus //if (from && p_event->is_pressed() && !p_event->get_alt() && !p_event->get_metakey() && !p_event->key->get_command()) { Ref<InputEventKey> k = p_event; - //need to check for mods, otherwise any combination of alt/ctrl/shift+<up/down/left/righ/etc> is handled here when it shouldn't be. + //need to check for mods, otherwise any combination of alt/ctrl/shift+<up/down/left/right/etc> is handled here when it shouldn't be. bool mods = k.is_valid() && (k->get_control() || k->get_alt() || k->get_shift() || k->get_metakey()); if (from && p_event->is_pressed()) { @@ -2672,7 +2672,7 @@ void Viewport::_post_gui_grab_click_focus() { Ref<InputEventMouseButton> mb; mb.instance(); - //send unclic + //send unclick mb->set_position(click); mb->set_button_index(i + 1); @@ -2690,7 +2690,7 @@ void Viewport::_post_gui_grab_click_focus() { Ref<InputEventMouseButton> mb; mb.instance(); - //send clic + //send click mb->set_position(click); mb->set_button_index(i + 1); diff --git a/scene/main/window.cpp b/scene/main/window.cpp index e40e990cf7..d697a1a5dd 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -826,6 +826,9 @@ bool Window::is_using_font_oversampling() const { } DisplayServer::WindowID Window::get_window_id() const { + if (embedder) { + return parent->get_window_id(); + } return window_id; } |