diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/line_2d.cpp | 1 | ||||
-rw-r--r-- | scene/gui/color_picker.cpp | 11 | ||||
-rw-r--r-- | scene/gui/label.cpp | 1 | ||||
-rw-r--r-- | scene/main/node.cpp | 17 | ||||
-rw-r--r-- | scene/main/node.h | 1 | ||||
-rw-r--r-- | scene/resources/packed_scene.cpp | 6 |
6 files changed, 32 insertions, 5 deletions
diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp index 2959ea1a36..37eb45c21d 100644 --- a/scene/2d/line_2d.cpp +++ b/scene/2d/line_2d.cpp @@ -116,6 +116,7 @@ Vector<Vector2> Line2D::get_points() const { } void Line2D::set_point_position(int i, Vector2 p_pos) { + ERR_FAIL_INDEX(i, _points.size()); _points.set(i, p_pos); update(); } diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index b82c078a2d..e8586b72e9 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -166,10 +166,13 @@ void ColorPicker::_value_changed(double) { } if (hsv_mode_enabled) { - color.set_hsv(scroll[0]->get_value() / 360.0, - scroll[1]->get_value() / 100.0, - scroll[2]->get_value() / 100.0, - scroll[3]->get_value() / 255.0); + h = scroll[0]->get_value() / 360.0; + s = scroll[1]->get_value() / 100.0; + v = scroll[2]->get_value() / 100.0; + color.set_hsv(h, s, v, scroll[3]->get_value() / 255.0); + + last_hsv = color; + } else { for (int i = 0; i < 4; i++) { color.components[i] = scroll[i]->get_value() / (raw_mode_enabled ? 1.0 : 255.0); diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 2997a6ebe9..b98caf3562 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -566,6 +566,7 @@ float Label::get_percent_visible() const { } void Label::set_lines_skipped(int p_lines) { + ERR_FAIL_COND(p_lines < 0); lines_skipped = p_lines; _update_visible(); update(); diff --git a/scene/main/node.cpp b/scene/main/node.cpp index f6a0f5a6c0..f0c562260f 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1966,6 +1966,23 @@ bool Node::is_editable_instance(const Node *p_node) const { return p_node->data.editable_instance; } +Node *Node::get_deepest_editable_node(Node *p_start_node) const { + ERR_FAIL_NULL_V(p_start_node, nullptr); + ERR_FAIL_COND_V(!is_a_parent_of(p_start_node), nullptr); + + Node const *iterated_item = p_start_node; + Node *node = p_start_node; + + while (iterated_item->get_owner() && iterated_item->get_owner() != this) { + if (!is_editable_instance(iterated_item->get_owner())) + node = iterated_item->get_owner(); + + iterated_item = iterated_item->get_owner(); + } + + return node; +} + void Node::set_scene_instance_state(const Ref<SceneState> &p_state) { data.instance_state = p_state; } diff --git a/scene/main/node.h b/scene/main/node.h index b3979993e0..249a0ff86e 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -330,6 +330,7 @@ public: void set_editable_instance(Node *p_node, bool p_editable); bool is_editable_instance(const Node *p_node) const; + Node *get_deepest_editable_node(Node *p_start_node) const; /* NOTIFICATIONS */ diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index beb365d44e..5d351f51f7 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -469,6 +469,11 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map p_node->get_property_list(&plist); StringName type = p_node->get_class(); + Ref<Script> script = p_node->get_script(); + if (script.is_valid()) { + script->update_exports(); + } + for (List<PropertyInfo>::Element *E = plist.front(); E; E = E->next()) { if (!(E->get().usage & PROPERTY_USAGE_STORAGE)) { continue; @@ -484,7 +489,6 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map isdefault = bool(Variant::evaluate(Variant::OP_EQUAL, value, default_value)); } - Ref<Script> script = p_node->get_script(); if (!isdefault && script.is_valid() && script->get_property_default_value(name, default_value)) { isdefault = bool(Variant::evaluate(Variant::OP_EQUAL, value, default_value)); } |