diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/path_2d.cpp | 3 | ||||
-rw-r--r-- | scene/2d/physics_body_2d.cpp | 6 | ||||
-rw-r--r-- | scene/3d/path.cpp | 3 | ||||
-rw-r--r-- | scene/3d/physics_body.cpp | 5 | ||||
-rw-r--r-- | scene/gui/split_container.cpp | 8 | ||||
-rw-r--r-- | scene/resources/material.cpp | 13 | ||||
-rw-r--r-- | scene/resources/resource_format_text.cpp | 8 |
7 files changed, 42 insertions, 4 deletions
diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index 271e132002..fec861ad2f 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -170,6 +170,9 @@ void PathFollow2D::_update_transform() { return; float path_length = c->get_baked_length(); + if (path_length == 0) { + return; + } float bounded_offset = offset; if (loop) bounded_offset = Math::fposmod(bounded_offset, path_length); diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index ce80bc508e..eeabe15b08 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -1341,6 +1341,12 @@ Vector2 KinematicBody2D::move_and_slide_with_snap(const Vector2 &p_linear_veloci on_floor = true; on_floor_body = col.collider_rid; floor_velocity = col.collider_vel; + if (p_stop_on_slope) { + // move and collide may stray the object a bit because of pre un-stucking, + // so only ensure that motion happens on floor direction in this case. + col.travel = p_floor_direction * p_floor_direction.dot(col.travel); + } + } else { apply = false; } diff --git a/scene/3d/path.cpp b/scene/3d/path.cpp index 9005b6b566..190967d76c 100644 --- a/scene/3d/path.cpp +++ b/scene/3d/path.cpp @@ -107,6 +107,9 @@ void PathFollow::_update_transform() { } float bl = c->get_baked_length(); + if (bl == 0.0) { + return; + } float bi = c->get_bake_interval(); float o = offset; float o_next = offset + bi; diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index f85b51af08..ab1eed0859 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -1288,6 +1288,11 @@ Vector3 KinematicBody::move_and_slide_with_snap(const Vector3 &p_linear_velocity on_floor = true; on_floor_body = col.collider_rid; floor_velocity = col.collider_vel; + if (p_stop_on_slope) { + // move and collide may stray the object a bit because of pre un-stucking, + // so only ensure that motion happens on floor direction in this case. + col.travel = p_floor_direction * p_floor_direction.dot(col.travel); + } } else { apply = false; //snapped with floor direction, but did not snap to a floor, do not snap. } diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp index e947216a3a..e5d1844d39 100644 --- a/scene/gui/split_container.cpp +++ b/scene/gui/split_container.cpp @@ -167,14 +167,15 @@ void SplitContainer::_notification(int p_what) { case NOTIFICATION_MOUSE_EXIT: { mouse_inside = false; - update(); + if (get_constant("autohide")) + update(); } break; case NOTIFICATION_DRAW: { if (!_getch(0) || !_getch(1)) return; - if (collapsed || (!mouse_inside && get_constant("autohide"))) + if (collapsed || (!dragging && !mouse_inside && get_constant("autohide"))) return; if (dragger_visibility != DRAGGER_VISIBLE) @@ -248,7 +249,8 @@ void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) { if (mouse_inside != mouse_inside_state) { mouse_inside = mouse_inside_state; - update(); + if (get_constant("autohide")) + update(); } if (!dragging) diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 190dc707c4..9a52e9a6bb 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -113,6 +113,9 @@ bool ShaderMaterial::_set(const StringName &p_name, const Variant &p_value) { if (n.find("param/") == 0) { //backwards compatibility pr = n.substr(6, n.length()); } + if (n.find("shader_param/") == 0) { //backwards compatibility + pr = n.replace_first("shader_param/", ""); + } } if (pr) { VisualServer::get_singleton()->material_set_param(_get_material(), pr, p_value); @@ -128,6 +131,16 @@ bool ShaderMaterial::_get(const StringName &p_name, Variant &r_ret) const { if (shader.is_valid()) { StringName pr = shader->remap_param(p_name); + if (!pr) { + String n = p_name; + if (n.find("param/") == 0) { //backwards compatibility + pr = n.substr(6, n.length()); + } + if (n.find("shader_param/") == 0) { //backwards compatibility + pr = n.replace_first("shader_param/", ""); + } + } + if (pr) { r_ret = VisualServer::get_singleton()->material_get_param(_get_material(), pr); return true; diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index 9ef6b9b474..44899bf9fc 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -1361,7 +1361,9 @@ String ResourceFormatSaverTextInstance::_write_resource(const RES &res) { if (internal_resources.has(res)) { return "SubResource( " + itos(internal_resources[res]) + " )"; } else if (res->get_path().length() && res->get_path().find("::") == -1) { - + if (res->get_path() == local_path) { //circular reference attempt + return "null"; + } //external resource String path = relative_paths ? local_path.path_to_file(res->get_path()) : res->get_path(); return "Resource( \"" + path + "\" )"; @@ -1386,6 +1388,10 @@ void ResourceFormatSaverTextInstance::_find_resources(const Variant &p_variant, return; if (!p_main && (!bundle_resources) && res->get_path().length() && res->get_path().find("::") == -1) { + if (res->get_path() == local_path) { + ERR_PRINTS("Circular reference to resource being saved found: '"+local_path+"' will be null next time it's loaded."); + return; + } int index = external_resources.size(); external_resources[res] = index; return; |