summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/3d/soft_dynamic_body_3d.cpp14
-rw-r--r--scene/3d/soft_dynamic_body_3d.h4
-rw-r--r--scene/3d/voxelizer.cpp2
-rw-r--r--scene/gui/flow_container.cpp9
-rw-r--r--scene/gui/popup_menu.cpp4
-rw-r--r--scene/main/canvas_item.cpp7
6 files changed, 23 insertions, 17 deletions
diff --git a/scene/3d/soft_dynamic_body_3d.cpp b/scene/3d/soft_dynamic_body_3d.cpp
index 8ee777bcbf..eafb74f203 100644
--- a/scene/3d/soft_dynamic_body_3d.cpp
+++ b/scene/3d/soft_dynamic_body_3d.cpp
@@ -417,8 +417,8 @@ void SoftDynamicBody3D::_draw_soft_mesh() {
PhysicsServer3D::get_singleton()->soft_body_set_mesh(physics_rid, mesh_rid);
}
- if (!rendering_server_handler.is_ready(mesh_rid)) {
- rendering_server_handler.prepare(mesh_rid, 0);
+ if (!rendering_server_handler->is_ready(mesh_rid)) {
+ rendering_server_handler->prepare(mesh_rid, 0);
/// Necessary in order to render the mesh correctly (Soft body nodes are in global space)
simulation_started = true;
@@ -428,11 +428,11 @@ void SoftDynamicBody3D::_draw_soft_mesh() {
_update_physics_server();
- rendering_server_handler.open();
- PhysicsServer3D::get_singleton()->soft_body_update_rendering_server(physics_rid, &rendering_server_handler);
- rendering_server_handler.close();
+ rendering_server_handler->open();
+ PhysicsServer3D::get_singleton()->soft_body_update_rendering_server(physics_rid, rendering_server_handler);
+ rendering_server_handler->close();
- rendering_server_handler.commit_changes();
+ rendering_server_handler->commit_changes();
}
void SoftDynamicBody3D::_prepare_physics_server() {
@@ -688,10 +688,12 @@ bool SoftDynamicBody3D::is_ray_pickable() const {
SoftDynamicBody3D::SoftDynamicBody3D() :
physics_rid(PhysicsServer3D::get_singleton()->soft_body_create()) {
+ rendering_server_handler = memnew(SoftDynamicBodyRenderingServerHandler);
PhysicsServer3D::get_singleton()->body_attach_object_instance_id(physics_rid, get_instance_id());
}
SoftDynamicBody3D::~SoftDynamicBody3D() {
+ memdelete(rendering_server_handler);
PhysicsServer3D::get_singleton()->free(physics_rid);
}
diff --git a/scene/3d/soft_dynamic_body_3d.h b/scene/3d/soft_dynamic_body_3d.h
index c30ec701c7..e11e5c73df 100644
--- a/scene/3d/soft_dynamic_body_3d.h
+++ b/scene/3d/soft_dynamic_body_3d.h
@@ -36,7 +36,7 @@
class SoftDynamicBody3D;
-class SoftDynamicBodyRenderingServerHandler : public RenderingServerHandler {
+class SoftDynamicBodyRenderingServerHandler : public PhysicsServer3DRenderingServerHandler {
friend class SoftDynamicBody3D;
RID mesh;
@@ -84,7 +84,7 @@ public:
};
private:
- SoftDynamicBodyRenderingServerHandler rendering_server_handler;
+ SoftDynamicBodyRenderingServerHandler *rendering_server_handler = nullptr;
RID physics_rid;
diff --git a/scene/3d/voxelizer.cpp b/scene/3d/voxelizer.cpp
index f56e3caa4b..bda3868fbb 100644
--- a/scene/3d/voxelizer.cpp
+++ b/scene/3d/voxelizer.cpp
@@ -872,7 +872,7 @@ Vector<uint8_t> Voxelizer::get_sdf_3d_image() const {
if (d == 0) {
w[i] = 0;
} else {
- w[i] = MIN(d, 254) + 1;
+ w[i] = MIN(d, 254u) + 1;
}
}
}
diff --git a/scene/gui/flow_container.cpp b/scene/gui/flow_container.cpp
index 3bd21f96b2..40aca555db 100644
--- a/scene/gui/flow_container.cpp
+++ b/scene/gui/flow_container.cpp
@@ -39,6 +39,11 @@ struct _LineData {
};
void FlowContainer::_resort() {
+ // Avoid resorting if invisible.
+ if (!is_visible_in_tree()) {
+ return;
+ }
+
int separation_horizontal = get_theme_constant(SNAME("hseparation"));
int separation_vertical = get_theme_constant(SNAME("vseparation"));
@@ -58,7 +63,7 @@ void FlowContainer::_resort() {
// First pass for line wrapping and minimum size calculation.
for (int i = 0; i < get_child_count(); i++) {
Control *child = Object::cast_to<Control>(get_child(i));
- if (!child || !child->is_visible_in_tree()) {
+ if (!child || !child->is_visible()) {
continue;
}
if (child->is_set_as_top_level()) {
@@ -128,7 +133,7 @@ void FlowContainer::_resort() {
for (int i = 0; i < get_child_count(); i++) {
Control *child = Object::cast_to<Control>(get_child(i));
- if (!child || !child->is_visible_in_tree()) {
+ if (!child || !child->is_visible()) {
continue;
}
if (child->is_set_as_top_level()) {
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 4220066b20..9fc1fb072c 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -1003,8 +1003,12 @@ void PopupMenu::set_item_text(int p_idx, const String &p_text) {
p_idx += get_item_count();
}
ERR_FAIL_INDEX(p_idx, items.size());
+ if (items[p_idx].text == p_text) {
+ return;
+ }
items.write[p_idx].text = p_text;
items.write[p_idx].xl_text = atr(p_text);
+ items.write[p_idx].dirty = true;
_shape_item(p_idx);
control->update();
diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp
index 1d263ba858..ec0821557b 100644
--- a/scene/main/canvas_item.cpp
+++ b/scene/main/canvas_item.cpp
@@ -995,12 +995,7 @@ Transform2D CanvasItem::get_viewport_transform() const {
ERR_FAIL_COND_V(!is_inside_tree(), Transform2D());
if (canvas_layer) {
- if (get_viewport()) {
- return get_viewport()->get_final_transform() * canvas_layer->get_transform();
- } else {
- return canvas_layer->get_transform();
- }
-
+ return get_viewport()->get_final_transform() * canvas_layer->get_transform();
} else {
return get_viewport()->get_final_transform() * get_viewport()->get_canvas_transform();
}