summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/linux_builds.yml41
-rw-r--r--.gitignore3
-rw-r--r--editor/groups_editor.cpp100
-rw-r--r--editor/groups_editor.h14
-rw-r--r--main/main.cpp4
-rwxr-xr-xmisc/scripts/compare_extension_api.py11
-rw-r--r--scene/2d/collision_object_2d.cpp4
-rw-r--r--scene/2d/mesh_instance_2d.cpp4
-rw-r--r--scene/2d/mesh_instance_2d.h1
-rw-r--r--scene/3d/collision_object_3d.cpp4
-rw-r--r--scene/3d/soft_dynamic_body_3d.cpp82
-rw-r--r--scene/3d/soft_dynamic_body_3d.h15
-rw-r--r--scene/gui/tab_bar.cpp5
-rw-r--r--scene/main/viewport.cpp9
-rw-r--r--servers/physics_2d/godot_body_2d.cpp12
-rw-r--r--servers/physics_2d/godot_body_2d.h5
-rw-r--r--servers/physics_3d/godot_body_3d.cpp17
-rw-r--r--servers/physics_3d/godot_body_3d.h4
-rw-r--r--servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp4
-rw-r--r--servers/rendering/renderer_rd/renderer_storage_rd.cpp6
20 files changed, 232 insertions, 113 deletions
diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml
index 018839b817..f6d11e2efe 100644
--- a/.github/workflows/linux_builds.yml
+++ b/.github/workflows/linux_builds.yml
@@ -34,6 +34,7 @@ jobs:
tests: true
sconsflags: use_asan=yes use_ubsan=yes
proj-test: true
+ godot-cpp-test: true
bin: "./bin/godot.linuxbsd.tools.64s"
# Skip 2GiB artifact speeding up action.
artifact: false
@@ -126,6 +127,46 @@ jobs:
VK_ICD_FILENAMES=$(pwd)/vk_swiftshader_icd.json DRI_PRIME=0 xvfb-run ${{ matrix.bin }} 40 --audio-driver Dummy --path test_project 2>&1 | tee sanitizers_log.txt || true
misc/scripts/check_ci_log.py sanitizers_log.txt
+ # Checkout godot-cpp
+ - name: Checkout godot-cpp
+ if: ${{ matrix.godot-cpp-test }}
+ uses: actions/checkout@v2
+ with:
+ repository: godotengine/godot-cpp
+ submodules: 'recursive'
+ path: 'godot-cpp'
+
+ # Check extension API
+ - name: Check for extension api updates
+ if: ${{ matrix.godot-cpp-test }}
+ run: |
+ echo "Running --dump-extension-api to create extensions api."
+ VK_ICD_FILENAMES=$(pwd)/vk_swiftshader_icd.json DRI_PRIME=0 xvfb-run ${{ matrix.bin }} --audio-driver Dummy --dump-extension-api 2>&1 > /dev/null || true
+ misc/scripts/compare_extension_api.py godot-cpp/godot-headers/extension_api.json extension_api.json
+
+ # Copy new extension API files into place
+ - name: Copy new extension API files into place
+ if: ${{ matrix.godot-cpp-test }}
+ run: |
+ cp -f extension_api.json godot-cpp/godot-headers/
+ cp -f core/extension/gdnative_interface.h godot-cpp/godot-headers/godot/
+
+ # Build godot-cpp library
+ - name: Build godot-cpp library
+ if: ${{ matrix.godot-cpp-test }}
+ run: |
+ cd godot-cpp
+ scons target=${{ matrix.target }} generate_bindings=yes -j2
+ cd ..
+
+ # Build godot-cpp test extension
+ - name: Build godot-cpp test extension
+ if: ${{ matrix.godot-cpp-test }}
+ run: |
+ cd godot-cpp/test
+ scons target=${{ matrix.target }} -j2
+ cd ../..
+
- name: Prepare artifact
if: ${{ matrix.artifact }}
run: |
diff --git a/.gitignore b/.gitignore
index 5b3414fe7e..5a8f6aec40 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,9 @@
# Documentation generated by doxygen or from classes.xml
doc/_build/
+# Extension API dump
+extension_api.json
+
# Javascript specific
*.bc
diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp
index 113306fc8a..f01c7f50f7 100644
--- a/editor/groups_editor.cpp
+++ b/editor/groups_editor.cpp
@@ -204,7 +204,8 @@ void GroupDialog::_add_group(String p_name) {
TreeItem *new_group = groups->create_item(groups_root);
new_group->set_text(0, name);
- new_group->add_button(0, groups->get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), 0);
+ new_group->add_button(0, groups->get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), DELETE_GROUP);
+ new_group->add_button(0, groups->get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons")), COPY_GROUP);
new_group->set_editable(0, true);
new_group->select(0);
groups->ensure_cursor_is_visible();
@@ -297,43 +298,50 @@ void GroupDialog::_load_groups(Node *p_current) {
}
}
-void GroupDialog::_delete_group_pressed(Object *p_item, int p_column, int p_id) {
+void GroupDialog::_modify_group_pressed(Object *p_item, int p_column, int p_id) {
TreeItem *ti = Object::cast_to<TreeItem>(p_item);
if (!ti) {
return;
}
- String name = ti->get_text(0);
+ switch (p_id) {
+ case DELETE_GROUP: {
+ String name = ti->get_text(0);
- undo_redo->create_action(TTR("Delete Group"));
+ undo_redo->create_action(TTR("Delete Group"));
- List<Node *> nodes;
- scene_tree->get_nodes_in_group(name, &nodes);
- bool removed_all = true;
- for (Node *E : nodes) {
- if (_can_edit(E, name)) {
- undo_redo->add_do_method(E, "remove_from_group", name);
- undo_redo->add_undo_method(E, "add_to_group", name, true);
- } else {
- removed_all = false;
- }
- }
+ List<Node *> nodes;
+ scene_tree->get_nodes_in_group(name, &nodes);
+ bool removed_all = true;
+ for (Node *E : nodes) {
+ if (_can_edit(E, name)) {
+ undo_redo->add_do_method(E, "remove_from_group", name);
+ undo_redo->add_undo_method(E, "add_to_group", name, true);
+ } else {
+ removed_all = false;
+ }
+ }
- if (removed_all) {
- undo_redo->add_do_method(this, "_delete_group_item", name);
- undo_redo->add_undo_method(this, "_add_group", name);
- }
+ if (removed_all) {
+ undo_redo->add_do_method(this, "_delete_group_item", name);
+ undo_redo->add_undo_method(this, "_add_group", name);
+ }
- undo_redo->add_do_method(this, "_group_selected");
- undo_redo->add_undo_method(this, "_group_selected");
- undo_redo->add_do_method(this, "emit_signal", "group_edited");
- undo_redo->add_undo_method(this, "emit_signal", "group_edited");
+ undo_redo->add_do_method(this, "_group_selected");
+ undo_redo->add_undo_method(this, "_group_selected");
+ undo_redo->add_do_method(this, "emit_signal", "group_edited");
+ undo_redo->add_undo_method(this, "emit_signal", "group_edited");
- // To force redraw of scene tree.
- undo_redo->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(), "update_tree");
- undo_redo->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(), "update_tree");
+ // To force redraw of scene tree.
+ undo_redo->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(), "update_tree");
+ undo_redo->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(), "update_tree");
- undo_redo->commit_action();
+ undo_redo->commit_action();
+ } break;
+ case COPY_GROUP: {
+ DisplayServer::get_singleton()->clipboard_set(ti->get_text(p_column));
+ } break;
+ }
}
void GroupDialog::_delete_group_item(const String &p_name) {
@@ -437,7 +445,7 @@ GroupDialog::GroupDialog() {
groups->set_v_size_flags(Control::SIZE_EXPAND_FILL);
groups->add_theme_constant_override("draw_guides", 1);
groups->connect("item_selected", callable_mp(this, &GroupDialog::_group_selected));
- groups->connect("button_pressed", callable_mp(this, &GroupDialog::_delete_group_pressed));
+ groups->connect("button_pressed", callable_mp(this, &GroupDialog::_modify_group_pressed));
groups->connect("item_edited", callable_mp(this, &GroupDialog::_group_renamed));
HBoxContainer *chbc = memnew(HBoxContainer);
@@ -582,7 +590,7 @@ void GroupsEditor::_add_group(const String &p_group) {
group_name->clear();
}
-void GroupsEditor::_remove_group(Object *p_item, int p_column, int p_id) {
+void GroupsEditor::_modify_group(Object *p_item, int p_column, int p_id) {
if (!node) {
return;
}
@@ -591,21 +599,26 @@ void GroupsEditor::_remove_group(Object *p_item, int p_column, int p_id) {
if (!ti) {
return;
}
+ switch (p_id) {
+ case DELETE_GROUP: {
+ String name = ti->get_text(0);
+ undo_redo->create_action(TTR("Remove from Group"));
- String name = ti->get_text(0);
-
- undo_redo->create_action(TTR("Remove from Group"));
-
- undo_redo->add_do_method(node, "remove_from_group", name);
- undo_redo->add_undo_method(node, "add_to_group", name, true);
- undo_redo->add_do_method(this, "update_tree");
- undo_redo->add_undo_method(this, "update_tree");
+ undo_redo->add_do_method(node, "remove_from_group", name);
+ undo_redo->add_undo_method(node, "add_to_group", name, true);
+ undo_redo->add_do_method(this, "update_tree");
+ undo_redo->add_undo_method(this, "update_tree");
- // To force redraw of scene tree.
- undo_redo->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(), "update_tree");
- undo_redo->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(), "update_tree");
+ // To force redraw of scene tree.
+ undo_redo->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(), "update_tree");
+ undo_redo->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(), "update_tree");
- undo_redo->commit_action();
+ undo_redo->commit_action();
+ } break;
+ case COPY_GROUP: {
+ DisplayServer::get_singleton()->clipboard_set(ti->get_text(p_column));
+ } break;
+ }
}
struct _GroupInfoComparator {
@@ -653,7 +666,8 @@ void GroupsEditor::update_tree() {
TreeItem *item = tree->create_item(root);
item->set_text(0, gi.name);
if (can_be_deleted) {
- item->add_button(0, get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), 0);
+ item->add_button(0, get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), DELETE_GROUP);
+ item->add_button(0, get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons")), COPY_GROUP);
} else {
item->set_selectable(0, false);
}
@@ -706,7 +720,7 @@ GroupsEditor::GroupsEditor() {
tree->set_hide_root(true);
tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
vbc->add_child(tree);
- tree->connect("button_pressed", callable_mp(this, &GroupsEditor::_remove_group));
+ tree->connect("button_pressed", callable_mp(this, &GroupsEditor::_modify_group));
tree->add_theme_constant_override("draw_guides", 1);
add_theme_constant_override("separation", 3 * EDSCALE);
}
diff --git a/editor/groups_editor.h b/editor/groups_editor.h
index 69f746801f..3cdc691528 100644
--- a/editor/groups_editor.h
+++ b/editor/groups_editor.h
@@ -82,7 +82,7 @@ class GroupDialog : public AcceptDialog {
void _rename_group_item(const String &p_old_name, const String &p_new_name);
void _add_group(String p_name);
- void _delete_group_pressed(Object *p_item, int p_column, int p_id);
+ void _modify_group_pressed(Object *p_item, int p_column, int p_id);
void _delete_group_item(const String &p_name);
bool _can_edit(Node *p_node, String p_group);
@@ -95,6 +95,11 @@ protected:
static void _bind_methods();
public:
+ enum ModifyButton {
+ DELETE_GROUP,
+ COPY_GROUP,
+ };
+
void edit();
void set_undo_redo(UndoRedo *p_undoredo) { undo_redo = p_undoredo; }
@@ -116,7 +121,7 @@ class GroupsEditor : public VBoxContainer {
void update_tree();
void _add_group(const String &p_group = "");
- void _remove_group(Object *p_item, int p_column, int p_id);
+ void _modify_group(Object *p_item, int p_column, int p_id);
void _close();
void _show_group_dialog();
@@ -125,6 +130,11 @@ protected:
static void _bind_methods();
public:
+ enum ModifyButton {
+ DELETE_GROUP,
+ COPY_GROUP,
+ };
+
void set_undo_redo(UndoRedo *p_undoredo) { undo_redo = p_undoredo; }
void set_current(Node *p_node);
diff --git a/main/main.cpp b/main/main.cpp
index 2a9446d4ed..f0bc51c10f 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -918,6 +918,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
cmdline_tool = true;
dump_extension_api = true;
print_line("Dumping Extension API");
+ // Hack. Not needed but otherwise we end up detecting that this should
+ // run the project instead of a cmdline tool.
+ // Needs full refactoring to fix properly.
+ main_args.push_back(I->get());
} else if (I->get() == "--export" || I->get() == "--export-debug" ||
I->get() == "--export-pack") { // Export project
// Actually handling is done in start().
diff --git a/misc/scripts/compare_extension_api.py b/misc/scripts/compare_extension_api.py
new file mode 100755
index 0000000000..f96db4278c
--- /dev/null
+++ b/misc/scripts/compare_extension_api.py
@@ -0,0 +1,11 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import sys
+
+# TODO:
+# Add a process that compares the original godot-cpp/godot-headers/extension_api.json with the new extension_api.json (both passed as arguments) and reports any API calls that have been removed.
+# If we only have additions or no changes to the file, we pass
+# For now we deem this too early because the API isn't stable enough yet.
+
+sys.exit(0)
diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp
index 6916f832d0..28facd09ce 100644
--- a/scene/2d/collision_object_2d.cpp
+++ b/scene/2d/collision_object_2d.cpp
@@ -454,7 +454,7 @@ void CollisionObject2D::shape_owner_clear_shapes(uint32_t p_owner) {
}
uint32_t CollisionObject2D::shape_find_owner(int p_shape_index) const {
- ERR_FAIL_INDEX_V(p_shape_index, total_subshapes, 0);
+ ERR_FAIL_INDEX_V(p_shape_index, total_subshapes, UINT32_MAX);
for (const KeyValue<uint32_t, ShapeData> &E : shapes) {
for (int i = 0; i < E.value.shapes.size(); i++) {
@@ -465,7 +465,7 @@ uint32_t CollisionObject2D::shape_find_owner(int p_shape_index) const {
}
//in theory it should be unreachable
- return 0;
+ ERR_FAIL_V_MSG(UINT32_MAX, "Can't find owner for shape index " + itos(p_shape_index) + ".");
}
void CollisionObject2D::set_pickable(bool p_enabled) {
diff --git a/scene/2d/mesh_instance_2d.cpp b/scene/2d/mesh_instance_2d.cpp
index 15008390b7..58bff97da9 100644
--- a/scene/2d/mesh_instance_2d.cpp
+++ b/scene/2d/mesh_instance_2d.cpp
@@ -96,6 +96,10 @@ Rect2 MeshInstance2D::_edit_get_rect() const {
return Node2D::_edit_get_rect();
}
+
+bool MeshInstance2D::_edit_use_rect() const {
+ return mesh.is_valid();
+}
#endif
MeshInstance2D::MeshInstance2D() {
diff --git a/scene/2d/mesh_instance_2d.h b/scene/2d/mesh_instance_2d.h
index adfda4cf7f..f94d53da7d 100644
--- a/scene/2d/mesh_instance_2d.h
+++ b/scene/2d/mesh_instance_2d.h
@@ -48,6 +48,7 @@ protected:
public:
#ifdef TOOLS_ENABLED
virtual Rect2 _edit_get_rect() const override;
+ virtual bool _edit_use_rect() const override;
#endif
void set_mesh(const Ref<Mesh> &p_mesh);
diff --git a/scene/3d/collision_object_3d.cpp b/scene/3d/collision_object_3d.cpp
index 814ed5c2a7..fd891a5e13 100644
--- a/scene/3d/collision_object_3d.cpp
+++ b/scene/3d/collision_object_3d.cpp
@@ -648,7 +648,7 @@ void CollisionObject3D::shape_owner_clear_shapes(uint32_t p_owner) {
}
uint32_t CollisionObject3D::shape_find_owner(int p_shape_index) const {
- ERR_FAIL_INDEX_V(p_shape_index, total_subshapes, 0);
+ ERR_FAIL_INDEX_V(p_shape_index, total_subshapes, UINT32_MAX);
for (const KeyValue<uint32_t, ShapeData> &E : shapes) {
for (int i = 0; i < E.value.shapes.size(); i++) {
@@ -659,7 +659,7 @@ uint32_t CollisionObject3D::shape_find_owner(int p_shape_index) const {
}
//in theory it should be unreachable
- return 0;
+ ERR_FAIL_V_MSG(UINT32_MAX, "Can't find owner for shape index " + itos(p_shape_index) + ".");
}
CollisionObject3D::CollisionObject3D(RID p_rid, bool p_area) {
diff --git a/scene/3d/soft_dynamic_body_3d.cpp b/scene/3d/soft_dynamic_body_3d.cpp
index 9fceb21790..43292d42f1 100644
--- a/scene/3d/soft_dynamic_body_3d.cpp
+++ b/scene/3d/soft_dynamic_body_3d.cpp
@@ -250,7 +250,7 @@ void SoftDynamicBody3D::_notification(int p_what) {
RID space = get_world_3d()->get_space();
PhysicsServer3D::get_singleton()->soft_body_set_space(physics_rid, space);
- prepare_physics_server();
+ _prepare_physics_server();
} break;
case NOTIFICATION_READY: {
@@ -284,13 +284,13 @@ void SoftDynamicBody3D::_notification(int p_what) {
case NOTIFICATION_DISABLED: {
if (is_inside_tree() && (disable_mode == DISABLE_MODE_REMOVE)) {
- prepare_physics_server();
+ _prepare_physics_server();
}
} break;
case NOTIFICATION_ENABLED: {
if (is_inside_tree() && (disable_mode == DISABLE_MODE_REMOVE)) {
- prepare_physics_server();
+ _prepare_physics_server();
}
} break;
@@ -378,7 +378,7 @@ void SoftDynamicBody3D::_bind_methods() {
TypedArray<String> SoftDynamicBody3D::get_configuration_warnings() const {
TypedArray<String> warnings = Node::get_configuration_warnings();
- if (get_mesh().is_null()) {
+ if (mesh.is_null()) {
warnings.push_back(TTR("This body will be ignored until you set a mesh."));
}
@@ -407,11 +407,17 @@ void SoftDynamicBody3D::_update_physics_server() {
}
void SoftDynamicBody3D::_draw_soft_mesh() {
- if (get_mesh().is_null()) {
+ if (mesh.is_null()) {
return;
}
- const RID mesh_rid = get_mesh()->get_rid();
+ RID mesh_rid = mesh->get_rid();
+ if (owned_mesh != mesh_rid) {
+ _become_mesh_owner();
+ mesh_rid = mesh->get_rid();
+ 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);
@@ -430,11 +436,11 @@ void SoftDynamicBody3D::_draw_soft_mesh() {
rendering_server_handler.commit_changes();
}
-void SoftDynamicBody3D::prepare_physics_server() {
+void SoftDynamicBody3D::_prepare_physics_server() {
#ifdef TOOLS_ENABLED
if (Engine::get_singleton()->is_editor_hint()) {
- if (get_mesh().is_valid()) {
- PhysicsServer3D::get_singleton()->soft_body_set_mesh(physics_rid, get_mesh()->get_rid());
+ if (mesh.is_valid()) {
+ PhysicsServer3D::get_singleton()->soft_body_set_mesh(physics_rid, mesh->get_rid());
} else {
PhysicsServer3D::get_singleton()->soft_body_set_mesh(physics_rid, RID());
}
@@ -443,9 +449,13 @@ void SoftDynamicBody3D::prepare_physics_server() {
}
#endif
- if (get_mesh().is_valid() && (is_enabled() || (disable_mode != DISABLE_MODE_REMOVE))) {
- become_mesh_owner();
- PhysicsServer3D::get_singleton()->soft_body_set_mesh(physics_rid, get_mesh()->get_rid());
+ if (mesh.is_valid() && (is_enabled() || (disable_mode != DISABLE_MODE_REMOVE))) {
+ RID mesh_rid = mesh->get_rid();
+ if (owned_mesh != mesh_rid) {
+ _become_mesh_owner();
+ mesh_rid = mesh->get_rid();
+ }
+ PhysicsServer3D::get_singleton()->soft_body_set_mesh(physics_rid, mesh_rid);
RS::get_singleton()->connect("frame_pre_draw", callable_mp(this, &SoftDynamicBody3D::_draw_soft_mesh));
} else {
PhysicsServer3D::get_singleton()->soft_body_set_mesh(physics_rid, RID());
@@ -455,38 +465,32 @@ void SoftDynamicBody3D::prepare_physics_server() {
}
}
-void SoftDynamicBody3D::become_mesh_owner() {
- if (mesh.is_null()) {
- return;
- }
-
- if (!mesh_owner) {
- mesh_owner = true;
+void SoftDynamicBody3D::_become_mesh_owner() {
+ Vector<Ref<Material>> copy_materials;
+ copy_materials.append_array(surface_override_materials);
- Vector<Ref<Material>> copy_materials;
- copy_materials.append_array(surface_override_materials);
+ ERR_FAIL_COND(!mesh->get_surface_count());
- ERR_FAIL_COND(!mesh->get_surface_count());
+ // Get current mesh array and create new mesh array with necessary flag for SoftDynamicBody
+ Array surface_arrays = mesh->surface_get_arrays(0);
+ Array surface_blend_arrays = mesh->surface_get_blend_shape_arrays(0);
+ Dictionary surface_lods = mesh->surface_get_lods(0);
+ uint32_t surface_format = mesh->surface_get_format(0);
- // Get current mesh array and create new mesh array with necessary flag for SoftDynamicBody
- Array surface_arrays = mesh->surface_get_arrays(0);
- Array surface_blend_arrays = mesh->surface_get_blend_shape_arrays(0);
- Dictionary surface_lods = mesh->surface_get_lods(0);
- uint32_t surface_format = mesh->surface_get_format(0);
+ surface_format |= Mesh::ARRAY_FLAG_USE_DYNAMIC_UPDATE;
- surface_format |= Mesh::ARRAY_FLAG_USE_DYNAMIC_UPDATE;
+ Ref<ArrayMesh> soft_mesh;
+ soft_mesh.instantiate();
+ soft_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, surface_arrays, surface_blend_arrays, surface_lods, surface_format);
+ soft_mesh->surface_set_material(0, mesh->surface_get_material(0));
- Ref<ArrayMesh> soft_mesh;
- soft_mesh.instantiate();
- soft_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, surface_arrays, surface_blend_arrays, surface_lods, surface_format);
- soft_mesh->surface_set_material(0, mesh->surface_get_material(0));
+ set_mesh(soft_mesh);
- set_mesh(soft_mesh);
-
- for (int i = copy_materials.size() - 1; 0 <= i; --i) {
- set_surface_override_material(i, copy_materials[i]);
- }
+ for (int i = copy_materials.size() - 1; 0 <= i; --i) {
+ set_surface_override_material(i, copy_materials[i]);
}
+
+ owned_mesh = soft_mesh->get_rid();
}
void SoftDynamicBody3D::set_collision_mask(uint32_t p_mask) {
@@ -551,13 +555,13 @@ void SoftDynamicBody3D::set_disable_mode(DisableMode p_mode) {
bool inside_tree = is_inside_tree();
if (inside_tree && (disable_mode == DISABLE_MODE_REMOVE)) {
- prepare_physics_server();
+ _prepare_physics_server();
}
disable_mode = p_mode;
if (inside_tree && (disable_mode == DISABLE_MODE_REMOVE)) {
- prepare_physics_server();
+ _prepare_physics_server();
}
}
diff --git a/scene/3d/soft_dynamic_body_3d.h b/scene/3d/soft_dynamic_body_3d.h
index 5e7fbfe29e..57e116aa05 100644
--- a/scene/3d/soft_dynamic_body_3d.h
+++ b/scene/3d/soft_dynamic_body_3d.h
@@ -90,7 +90,7 @@ private:
DisableMode disable_mode = DISABLE_MODE_REMOVE;
- bool mesh_owner = false;
+ RID owned_mesh;
uint32_t collision_mask = 1;
uint32_t collision_layer = 1;
NodePath parent_collision_ignore;
@@ -106,6 +106,12 @@ private:
void _update_pickable();
+ void _update_physics_server();
+ void _draw_soft_mesh();
+
+ void _prepare_physics_server();
+ void _become_mesh_owner();
+
protected:
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;
@@ -120,14 +126,7 @@ protected:
TypedArray<String> get_configuration_warnings() const override;
-protected:
- void _update_physics_server();
- void _draw_soft_mesh();
-
public:
- void prepare_physics_server();
- void become_mesh_owner();
-
RID get_physics_rid() const { return physics_rid; }
void set_collision_mask(uint32_t p_mask);
diff --git a/scene/gui/tab_bar.cpp b/scene/gui/tab_bar.cpp
index 7c7e3b0547..78b58c773a 100644
--- a/scene/gui/tab_bar.cpp
+++ b/scene/gui/tab_bar.cpp
@@ -222,6 +222,11 @@ void TabBar::gui_input(const Ref<InputEvent> &p_event) {
}
}
+ if (max_drawn_tab <= 0) {
+ // Return early if there are no actual tabs to handle input for.
+ return;
+ }
+
int found = -1;
for (int i = offset; i <= max_drawn_tab; i++) {
if (tabs[i].rb_rect.has_point(pos)) {
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 0e62e6e30a..3280190250 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -2192,7 +2192,10 @@ void Viewport::_drop_physics_mouseover(bool p_paused_only) {
if (physics_object_over.is_valid()) {
CollisionObject3D *co = Object::cast_to<CollisionObject3D>(ObjectDB::get_instance(physics_object_over));
if (co) {
- if (!(p_paused_only && co->can_process())) {
+ if (!co->is_inside_tree()) {
+ physics_object_over = ObjectID();
+ physics_object_capture = ObjectID();
+ } else if (!(p_paused_only && co->can_process())) {
co->_mouse_exit();
physics_object_over = ObjectID();
physics_object_capture = ObjectID();
@@ -2213,7 +2216,7 @@ void Viewport::_cleanup_mouseover_colliders(bool p_clean_all_frames, bool p_paus
Object *o = ObjectDB::get_instance(E->key());
if (o) {
CollisionObject2D *co = Object::cast_to<CollisionObject2D>(o);
- if (co) {
+ if (co && co->is_inside_tree()) {
if (p_clean_all_frames && p_paused_only && co->can_process()) {
continue;
}
@@ -2239,7 +2242,7 @@ void Viewport::_cleanup_mouseover_colliders(bool p_clean_all_frames, bool p_paus
Object *o = ObjectDB::get_instance(E->key().first);
if (o) {
CollisionObject2D *co = Object::cast_to<CollisionObject2D>(o);
- if (co) {
+ if (co && co->is_inside_tree()) {
if (p_clean_all_frames && p_paused_only && co->can_process()) {
continue;
}
diff --git a/servers/physics_2d/godot_body_2d.cpp b/servers/physics_2d/godot_body_2d.cpp
index b0885a1f7b..68f114a34a 100644
--- a/servers/physics_2d/godot_body_2d.cpp
+++ b/servers/physics_2d/godot_body_2d.cpp
@@ -119,6 +119,8 @@ void GodotBody2D::update_mass_properties() {
} break;
}
+
+ _update_transform_dependent();
}
void GodotBody2D::reset_mass_properties() {
@@ -179,7 +181,8 @@ void GodotBody2D::set_param(PhysicsServer2D::BodyParameter p_param, const Varian
} break;
case PhysicsServer2D::BODY_PARAM_CENTER_OF_MASS: {
calculate_center_of_mass = false;
- center_of_mass = p_value;
+ center_of_mass_local = p_value;
+ _update_transform_dependent();
} break;
case PhysicsServer2D::BODY_PARAM_GRAVITY_SCALE: {
gravity_scale = p_value;
@@ -301,6 +304,7 @@ void GodotBody2D::set_state(PhysicsServer2D::BodyState p_state, const Variant &p
}
_set_transform(t);
_set_inv_transform(get_transform().inverse());
+ _update_transform_dependent();
}
wakeup();
@@ -400,6 +404,10 @@ void GodotBody2D::_compute_area_gravity_and_damping(const GodotArea2D *p_area) {
area_angular_damp += p_area->get_angular_damp();
}
+void GodotBody2D::_update_transform_dependent() {
+ center_of_mass = get_transform().basis_xform(center_of_mass_local);
+}
+
void GodotBody2D::integrate_forces(real_t p_step) {
if (mode == PhysicsServer2D::BODY_MODE_STATIC) {
return;
@@ -568,6 +576,8 @@ void GodotBody2D::integrate_velocities(real_t p_step) {
if (continuous_cd_mode != PhysicsServer2D::CCD_MODE_DISABLED) {
new_transform = get_transform();
}
+
+ _update_transform_dependent();
}
void GodotBody2D::wakeup_neighbours() {
diff --git a/servers/physics_2d/godot_body_2d.h b/servers/physics_2d/godot_body_2d.h
index c4f3578f1b..5fce362fa7 100644
--- a/servers/physics_2d/godot_body_2d.h
+++ b/servers/physics_2d/godot_body_2d.h
@@ -66,6 +66,7 @@ class GodotBody2D : public GodotCollisionObject2D {
real_t inertia = 0.0;
real_t _inv_inertia = 0.0;
+ Vector2 center_of_mass_local;
Vector2 center_of_mass;
bool calculate_inertia = true;
@@ -139,7 +140,9 @@ class GodotBody2D : public GodotCollisionObject2D {
uint64_t island_step = 0;
- _FORCE_INLINE_ void _compute_area_gravity_and_damping(const GodotArea2D *p_area);
+ void _compute_area_gravity_and_damping(const GodotArea2D *p_area);
+
+ void _update_transform_dependent();
friend class GodotPhysicsDirectBodyState2D; // i give up, too many functions to expose
diff --git a/servers/physics_3d/godot_body_3d.cpp b/servers/physics_3d/godot_body_3d.cpp
index 6df6a0c45b..0564c4d452 100644
--- a/servers/physics_3d/godot_body_3d.cpp
+++ b/servers/physics_3d/godot_body_3d.cpp
@@ -40,7 +40,7 @@ void GodotBody3D::_mass_properties_changed() {
}
}
-void GodotBody3D::_update_transform_dependant() {
+void GodotBody3D::_update_transform_dependent() {
center_of_mass = get_transform().basis.xform(center_of_mass_local);
principal_inertia_axes = get_transform().basis * principal_inertia_axes_local;
@@ -161,7 +161,7 @@ void GodotBody3D::update_mass_properties() {
} break;
}
- _update_transform_dependant();
+ _update_transform_dependent();
}
void GodotBody3D::reset_mass_properties() {
@@ -217,14 +217,14 @@ void GodotBody3D::set_param(PhysicsServer3D::BodyParameter p_param, const Varian
if (mode == PhysicsServer3D::BODY_MODE_DYNAMIC) {
principal_inertia_axes_local = Basis();
_inv_inertia = inertia.inverse();
- _update_transform_dependant();
+ _update_transform_dependent();
}
}
} break;
case PhysicsServer3D::BODY_PARAM_CENTER_OF_MASS: {
calculate_center_of_mass = false;
center_of_mass_local = p_value;
- _update_transform_dependant();
+ _update_transform_dependent();
} break;
case PhysicsServer3D::BODY_PARAM_GRAVITY_SCALE: {
gravity_scale = p_value;
@@ -295,7 +295,7 @@ void GodotBody3D::set_mode(PhysicsServer3D::BodyMode p_mode) {
if (mode == PhysicsServer3D::BODY_MODE_KINEMATIC && prev != mode) {
first_time_kinematic = true;
}
- _update_transform_dependant();
+ _update_transform_dependent();
} break;
case PhysicsServer3D::BODY_MODE_DYNAMIC: {
@@ -303,7 +303,7 @@ void GodotBody3D::set_mode(PhysicsServer3D::BodyMode p_mode) {
if (!calculate_inertia) {
principal_inertia_axes_local = Basis();
_inv_inertia = inertia.inverse();
- _update_transform_dependant();
+ _update_transform_dependent();
}
_mass_properties_changed();
_set_static(false);
@@ -314,7 +314,7 @@ void GodotBody3D::set_mode(PhysicsServer3D::BodyMode p_mode) {
_inv_mass = mass > 0 ? (1.0 / mass) : 0;
_inv_inertia = Vector3();
angular_velocity = Vector3();
- _update_transform_dependant();
+ _update_transform_dependent();
_set_static(false);
set_active(true);
}
@@ -355,6 +355,7 @@ void GodotBody3D::set_state(PhysicsServer3D::BodyState p_state, const Variant &p
}
_set_transform(t);
_set_inv_transform(get_transform().inverse());
+ _update_transform_dependent();
}
wakeup();
@@ -651,7 +652,7 @@ void GodotBody3D::integrate_velocities(real_t p_step) {
_set_transform(transform);
_set_inv_transform(get_transform().inverse());
- _update_transform_dependant();
+ _update_transform_dependent();
}
void GodotBody3D::wakeup_neighbours() {
diff --git a/servers/physics_3d/godot_body_3d.h b/servers/physics_3d/godot_body_3d.h
index 1151a22c96..5acdab9d13 100644
--- a/servers/physics_3d/godot_body_3d.h
+++ b/servers/physics_3d/godot_body_3d.h
@@ -135,9 +135,9 @@ class GodotBody3D : public GodotCollisionObject3D {
uint64_t island_step = 0;
- _FORCE_INLINE_ void _compute_area_gravity_and_damping(const GodotArea3D *p_area);
+ void _compute_area_gravity_and_damping(const GodotArea3D *p_area);
- _FORCE_INLINE_ void _update_transform_dependant();
+ void _update_transform_dependent();
friend class GodotPhysicsDirectBodyState3D; // i give up, too many functions to expose
diff --git a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
index a1c3481ed6..d05cfdc386 100644
--- a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
+++ b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
@@ -657,6 +657,10 @@ void SceneShaderForwardClustered::init(RendererStorageRD *p_storage, const Strin
actions.render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_BLINN\n";
}
+ actions.custom_samplers["SCREEN_TEXTURE"] = "material_samplers[3]"; // linear filter with mipmaps
+ actions.custom_samplers["DEPTH_TEXTURE"] = "material_samplers[3]";
+ actions.custom_samplers["NORMAL_ROUGHNESS_TEXTURE"] = "material_samplers[1]"; // linear filter
+
actions.render_mode_defines["specular_blinn"] = "#define SPECULAR_BLINN\n";
actions.render_mode_defines["specular_phong"] = "#define SPECULAR_PHONG\n";
actions.render_mode_defines["specular_toon"] = "#define SPECULAR_TOON\n";
diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.cpp b/servers/rendering/renderer_rd/renderer_storage_rd.cpp
index a7bfea455d..3e68a2b622 100644
--- a/servers/rendering/renderer_rd/renderer_storage_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_storage_rd.cpp
@@ -2672,9 +2672,11 @@ void RendererStorageRD::MaterialData::update_textures(const Map<StringName, Vari
if (uniform_array_size > 0) {
if (textures.size() < uniform_array_size) {
const Map<StringName, RID>::Element *W = p_default_textures.find(uniform_name);
- if (W) {
- for (int j = textures.size(); j < uniform_array_size; j++) {
+ for (int j = textures.size(); j < uniform_array_size; j++) {
+ if (W) {
textures.push_back(W->get());
+ } else {
+ textures.push_back(RID());
}
}
}