Merge pull request #74907 from YuriSizov/4.0-cherrypicks

Cherry-picks for the 4.0 branch (future 4.0.1) - 3rd batch
This commit is contained in:
Yuri Sizov 2023-03-14 16:00:02 +01:00 committed by GitHub
commit fc7adaab7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
44 changed files with 268 additions and 123 deletions

View File

@ -91,9 +91,12 @@ String JSON::_stringify(const Variant &p_var, const String &p_indent, int p_cur_
case Variant::PACKED_FLOAT64_ARRAY:
case Variant::PACKED_STRING_ARRAY:
case Variant::ARRAY: {
Array a = p_var;
if (a.size() == 0) {
return "[]";
}
String s = "[";
s += end_statement;
Array a = p_var;
ERR_FAIL_COND_V_MSG(p_markers.has(a.id()), "\"[...]\"", "Converting circular structure to JSON.");
p_markers.insert(a.id());

View File

@ -634,6 +634,7 @@
- [code]OS.shell_open("https://godotengine.org")[/code] opens the default web browser on the official Godot website.
- [code]OS.shell_open("mailto:example@example.com")[/code] opens the default email client with the "To" field set to [code]example@example.com[/code]. See [url=https://datatracker.ietf.org/doc/html/rfc2368]RFC 2368 - The [code]mailto[/code] URL scheme[/url] for a list of fields that can be added.
Use [method ProjectSettings.globalize_path] to convert a [code]res://[/code] or [code]user://[/code] path into a system path for use with this method.
[b]Note:[/b] Use [method String.uri_encode] to encode characters within URLs in a URL-safe, portable way. This is especially required for line breaks. Otherwise, [method shell_open] may not work correctly in a project exported to the Web platform.
[b]Note:[/b] This method is implemented on Android, iOS, Web, Linux, macOS and Windows.
</description>
</method>

View File

@ -970,7 +970,7 @@
<method name="uri_decode" qualifiers="const">
<return type="String" />
<description>
Decodes the string from its URL-encoded format. This method is meant to properly decode the parameters in a URL when receiving an HTTP request.
Decodes the string from its URL-encoded format. This method is meant to properly decode the parameters in a URL when receiving an HTTP request. See also [method uri_encode].
[codeblocks]
[gdscript]
var url = "$DOCS_URL/?highlight=Godot%20Engine%3%docs"
@ -986,7 +986,7 @@
<method name="uri_encode" qualifiers="const">
<return type="String" />
<description>
Encodes the string to URL-friendly format. This method is meant to properly encode the parameters in a URL when sending an HTTP request.
Encodes the string to URL-friendly format. This method is meant to properly encode the parameters in a URL when sending an HTTP request. See also [method uri_decode].
[codeblocks]
[gdscript]
var prefix = "$DOCS_URL/?highlight="

View File

@ -530,7 +530,7 @@
[b]Note:[/b] Fullscreen mode is not exclusive full screen on Windows and Linux.
</member>
<member name="mouse_passthrough" type="bool" setter="set_flag" getter="get_flag" default="false">
If [code]true[/code], all mouse event as passed to the underlying window of the same application. See also [member mouse_passthrough_polygon].
If [code]true[/code], all mouse events will be passed to the underlying window of the same application. See also [member mouse_passthrough_polygon].
[b]Note:[/b] This property is implemented on Linux (X11), macOS and Windows.
</member>
<member name="mouse_passthrough_polygon" type="PackedVector2Array" setter="set_mouse_passthrough_polygon" getter="get_mouse_passthrough_polygon" default="PackedVector2Array()">

View File

@ -396,6 +396,7 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
Item *ci = p_item_list;
Item *canvas_group_owner = nullptr;
bool skip_item = false;
state.last_item_index = 0;
@ -464,6 +465,7 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
Rect2i group_rect = ci->canvas_group_owner->global_rect_cache;
texture_storage->render_target_copy_to_back_buffer(p_to_render_target, group_rect, false);
if (ci->canvas_group_owner->canvas_group->mode == RS::CANVAS_GROUP_MODE_CLIP_AND_DRAW) {
ci->canvas_group_owner->use_canvas_group = false;
items[item_count++] = ci->canvas_group_owner;
}
} else if (!backbuffer_cleared) {
@ -478,9 +480,8 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
ci->canvas_group_owner = nullptr; //must be cleared
}
if (!backbuffer_cleared && canvas_group_owner == nullptr && ci->canvas_group != nullptr && !backbuffer_copy) {
texture_storage->render_target_clear_back_buffer(p_to_render_target, Rect2i(), Color(0, 0, 0, 0));
backbuffer_cleared = true;
if (canvas_group_owner == nullptr && ci->canvas_group != nullptr && ci->canvas_group->mode != RS::CANVAS_GROUP_MODE_CLIP_AND_DRAW) {
skip_item = true;
}
if (ci == canvas_group_owner) {
@ -498,6 +499,11 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
canvas_group_owner = nullptr;
// Backbuffer is dirty now and needs to be re-cleared if another CanvasGroup needs it.
backbuffer_cleared = false;
// Tell the renderer to paint this as a canvas group
ci->use_canvas_group = true;
} else {
ci->use_canvas_group = false;
}
if (backbuffer_copy) {
@ -513,9 +519,9 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
texture_storage->render_target_copy_to_back_buffer(p_to_render_target, back_buffer_rect, backbuffer_gen_mipmaps);
backbuffer_copy = false;
backbuffer_gen_mipmaps = false;
material_screen_texture_cached = true; // After a backbuffer copy, screen texture makes no further copies.
material_screen_texture_mipmaps_cached = backbuffer_gen_mipmaps;
backbuffer_gen_mipmaps = false;
}
if (backbuffer_gen_mipmaps) {
@ -526,14 +532,18 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
}
// just add all items for now
items[item_count++] = ci;
if (skip_item) {
skip_item = false;
} else {
items[item_count++] = ci;
}
if (!ci->next || item_count == MAX_RENDER_ITEMS - 1) {
if (update_skeletons) {
mesh_storage->update_mesh_instances();
update_skeletons = false;
}
_render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list, r_sdf_used);
_render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list, r_sdf_used, canvas_group_owner != nullptr);
//then reset
item_count = 0;
}
@ -586,11 +596,9 @@ void RasterizerCanvasGLES3::_render_items(RID p_to_render_target, int p_item_cou
}
RID material = ci->material_owner == nullptr ? ci->material : ci->material_owner->material;
if (ci->canvas_group != nullptr) {
if (ci->use_canvas_group) {
if (ci->canvas_group->mode == RS::CANVAS_GROUP_MODE_CLIP_AND_DRAW) {
if (!p_to_backbuffer) {
material = default_clip_children_material;
}
material = default_clip_children_material;
} else {
if (material.is_null()) {
if (ci->canvas_group->mode == RS::CANVAS_GROUP_MODE_CLIP_ONLY) {

View File

@ -327,6 +327,7 @@ void MeshStorage::mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface)
} else {
mesh->aabb.merge_with(p_surface.aabb);
}
mesh->skeleton_aabb_version = 0;
s->material = p_surface.material;
@ -541,12 +542,12 @@ AABB MeshStorage::mesh_get_aabb(RID p_mesh, RID p_skeleton) {
Transform3D mtx;
mtx.basis.rows[0].x = dataptr[0];
mtx.basis.rows[1].x = dataptr[1];
mtx.basis.rows[0][0] = dataptr[0];
mtx.basis.rows[0][1] = dataptr[1];
mtx.origin.x = dataptr[3];
mtx.basis.rows[0].y = dataptr[4];
mtx.basis.rows[1].y = dataptr[5];
mtx.basis.rows[1][0] = dataptr[4];
mtx.basis.rows[1][1] = dataptr[5];
mtx.origin.y = dataptr[7];
AABB baabb = mtx.xform(skbones[j]);
@ -1438,12 +1439,12 @@ void MeshStorage::_multimesh_re_create_aabb(MultiMesh *multimesh, const float *p
t.origin.z = data[11];
} else {
t.basis.rows[0].x = data[0];
t.basis.rows[1].x = data[1];
t.basis.rows[0][0] = data[0];
t.basis.rows[0][1] = data[1];
t.origin.x = data[3];
t.basis.rows[0].y = data[4];
t.basis.rows[1].y = data[5];
t.basis.rows[1][0] = data[4];
t.basis.rows[1][1] = data[5];
t.origin.y = data[7];
}

View File

@ -2530,7 +2530,7 @@ Error RenderingDeviceVulkan::_texture_update(RID p_texture, uint32_t p_layer, co
for (uint32_t z = 0; z < depth; z++) { // For 3D textures, depth may be > 0.
const uint8_t *read_ptr = read_ptr_mipmap + image_size * z / depth;
const uint8_t *read_ptr = read_ptr_mipmap + (image_size / depth) * z;
for (uint32_t y = 0; y < height; y += region_size) {
for (uint32_t x = 0; x < width; x += region_size) {

View File

@ -509,6 +509,11 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
String tooltip = oe.warning ? TTR("Warning:") : TTR("Error:");
TreeItem *error = error_tree->create_item(r);
if (oe.warning) {
error->set_meta("_is_warning", true);
} else {
error->set_meta("_is_error", true);
}
error->set_collapsed(true);
error->set_icon(0, get_theme_icon(oe.warning ? SNAME("Warning") : SNAME("Error"), SNAME("EditorIcons")));
@ -798,6 +803,8 @@ void ScriptEditorDebugger::_notification(int p_what) {
[[fallthrough]];
}
case NOTIFICATION_THEME_CHANGED: {
tabs->add_theme_style_override("panel", get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles")));
skip_breakpoints->set_icon(get_theme_icon(skip_breakpoints_value ? SNAME("DebugSkipBreakpointsOn") : SNAME("DebugSkipBreakpointsOff"), SNAME("EditorIcons")));
copy->set_icon(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons")));
step->set_icon(get_theme_icon(SNAME("DebugStep"), SNAME("EditorIcons")));
@ -809,6 +816,24 @@ void ScriptEditorDebugger::_notification(int p_what) {
search->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
reason->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
TreeItem *error_root = error_tree->get_root();
if (error_root) {
TreeItem *error = error_root->get_first_child();
while (error) {
if (error->has_meta("_is_warning")) {
error->set_icon(0, get_theme_icon(SNAME("Warning"), SNAME("EditorIcons")));
error->set_custom_color(0, get_theme_color(SNAME("warning_color"), SNAME("Editor")));
error->set_custom_color(1, get_theme_color(SNAME("warning_color"), SNAME("Editor")));
} else if (error->has_meta("_is_error")) {
error->set_icon(0, get_theme_icon(SNAME("Error"), SNAME("EditorIcons")));
error->set_custom_color(0, get_theme_color(SNAME("error_color"), SNAME("Editor")));
error->set_custom_color(1, get_theme_color(SNAME("error_color"), SNAME("Editor")));
}
error = error->get_next();
}
}
} break;
case NOTIFICATION_PROCESS: {
@ -871,21 +896,6 @@ void ScriptEditorDebugger::_notification(int p_what) {
break;
};
} break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
if (tabs->has_theme_stylebox_override("panel")) {
tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles")));
}
copy->set_icon(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons")));
step->set_icon(get_theme_icon(SNAME("DebugStep"), SNAME("EditorIcons")));
next->set_icon(get_theme_icon(SNAME("DebugNext"), SNAME("EditorIcons")));
dobreak->set_icon(get_theme_icon(SNAME("Pause"), SNAME("EditorIcons")));
docontinue->set_icon(get_theme_icon(SNAME("DebugContinue"), SNAME("EditorIcons")));
vmem_refresh->set_icon(get_theme_icon(SNAME("Reload"), SNAME("EditorIcons")));
vmem_export->set_icon(get_theme_icon(SNAME("Save"), SNAME("EditorIcons")));
search->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
} break;
}
}
@ -1557,9 +1567,9 @@ void ScriptEditorDebugger::_item_menu_id_pressed(int p_option) {
String type;
if (ti->get_icon(0) == get_theme_icon(SNAME("Warning"), SNAME("EditorIcons"))) {
if (ti->has_meta("_is_warning")) {
type = "W ";
} else if (ti->get_icon(0) == get_theme_icon(SNAME("Error"), SNAME("EditorIcons"))) {
} else if (ti->has_meta("_is_error")) {
type = "E ";
}
@ -1700,10 +1710,8 @@ void ScriptEditorDebugger::toggle_profiler(const String &p_profiler, bool p_enab
ScriptEditorDebugger::ScriptEditorDebugger() {
tabs = memnew(TabContainer);
tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles")));
tabs->connect("tab_changed", callable_mp(this, &ScriptEditorDebugger::_tab_changed));
add_child(tabs);
tabs->connect("tab_changed", callable_mp(this, &ScriptEditorDebugger::_tab_changed));
InspectorDock::get_inspector_singleton()->connect("object_id_selected", callable_mp(this, &ScriptEditorDebugger::_remote_object_selected));

View File

@ -1687,11 +1687,11 @@ void EditorInspectorArray::_panel_gui_input(Ref<InputEvent> p_event, int p_index
void EditorInspectorArray::_move_element(int p_element_index, int p_to_pos) {
String action_name;
if (p_element_index < 0) {
action_name = vformat("Add element to property array with prefix %s.", array_element_prefix);
action_name = vformat(TTR("Add element to property array with prefix %s."), array_element_prefix);
} else if (p_to_pos < 0) {
action_name = vformat("Remove element %d from property array with prefix %s.", p_element_index, array_element_prefix);
action_name = vformat(TTR("Remove element %d from property array with prefix %s."), p_element_index, array_element_prefix);
} else {
action_name = vformat("Move element %d to position %d in property array with prefix %s.", p_element_index, p_to_pos, array_element_prefix);
action_name = vformat(TTR("Move element %d to position %d in property array with prefix %s."), p_element_index, p_to_pos, array_element_prefix);
}
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(action_name);
@ -1838,7 +1838,7 @@ void EditorInspectorArray::_move_element(int p_element_index, int p_to_pos) {
void EditorInspectorArray::_clear_array() {
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(vformat("Clear property array with prefix %s.", array_element_prefix));
undo_redo->create_action(vformat(TTR("Clear property array with prefix %s."), array_element_prefix));
if (mode == MODE_USE_MOVE_ARRAY_ELEMENT_FUNCTION) {
for (int i = count - 1; i >= 0; i--) {
// Call the function.
@ -1891,7 +1891,7 @@ void EditorInspectorArray::_resize_array(int p_size) {
}
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(vformat("Resize property array with prefix %s.", array_element_prefix));
undo_redo->create_action(vformat(TTR("Resize property array with prefix %s."), array_element_prefix));
if (p_size > count) {
if (mode == MODE_USE_MOVE_ARRAY_ELEMENT_FUNCTION) {
for (int i = count; i < p_size; i++) {

View File

@ -4750,8 +4750,8 @@ void EditorNode::_dock_floating_close_request(Control *p_control) {
p_control->get_parent()->remove_child(p_control);
dock_slot[window_slot]->add_child(p_control);
dock_slot[window_slot]->move_child(p_control, MIN((int)window->get_meta("dock_index"), dock_slot[window_slot]->get_tab_count()));
dock_slot[window_slot]->set_current_tab(window->get_meta("dock_index"));
dock_slot[window_slot]->move_child(p_control, MIN((int)window->get_meta("dock_index"), dock_slot[window_slot]->get_tab_count() - 1));
dock_slot[window_slot]->set_current_tab(dock_slot[window_slot]->get_tab_idx_from_control(p_control));
dock_slot[window_slot]->set_tab_title(dock_slot[window_slot]->get_tab_idx_from_control(p_control), TTRGET(p_control->get_name()));
window->queue_free();
@ -4772,7 +4772,7 @@ void EditorNode::_dock_make_float() {
Size2 dock_size = dock->get_size() + borders * 2;
Point2 dock_screen_pos = dock->get_global_position() + get_tree()->get_root()->get_position() - borders;
int dock_index = dock->get_index();
int dock_index = dock->get_index(false);
dock_slot[dock_popup_selected_idx]->remove_child(dock);
Window *window = memnew(Window);
@ -6494,13 +6494,15 @@ void EditorNode::_bottom_panel_raise_toggled(bool p_pressed) {
}
void EditorNode::_update_renderer_color() {
if (renderer->get_text() == "Forward+") {
String rendering_method = renderer->get_selected_metadata();
if (rendering_method == "forward_plus") {
renderer->add_theme_color_override("font_color", Color::hex(0x5d8c3fff));
}
if (renderer->get_text() == "Mobile") {
if (rendering_method == "mobile") {
renderer->add_theme_color_override("font_color", Color::hex(0xa5557dff));
}
if (renderer->get_text() == "Compatibility") {
if (rendering_method == "gl_compatibility") {
renderer->add_theme_color_override("font_color", Color::hex(0x5586a4ff));
}
}

View File

@ -1210,7 +1210,7 @@ void EditorPropertyLayers::_button_pressed() {
void EditorPropertyLayers::_menu_pressed(int p_menu) {
if (p_menu == grid->layer_count) {
ProjectSettingsEditor::get_singleton()->popup_project_settings();
ProjectSettingsEditor::get_singleton()->popup_project_settings(true);
ProjectSettingsEditor::get_singleton()->set_general_page(basename);
} else {
if (grid->value & (1 << p_menu)) {

View File

@ -30,6 +30,8 @@
#include "fbx_importer_manager.h"
#include "core/config/project_settings.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "scene/gui/link_button.h"
@ -47,9 +49,19 @@ void FBXImporterManager::show_dialog(bool p_exclusive) {
fbx_path->set_text(fbx2gltf_path);
_validate_path(fbx2gltf_path);
set_flag(Window::FLAG_BORDERLESS, p_exclusive); // Avoid closing accidentally .
// If exclusive, we're importing a FBX file, there's no exit.
is_importing = p_exclusive;
set_flag(Window::FLAG_BORDERLESS, p_exclusive); // Avoid closing accidentally.
set_close_on_escape(!p_exclusive);
if (is_importing) {
get_cancel_button()->set_text(TTR("Disable FBX & Restart"));
get_cancel_button()->set_tooltip_text(TTR("Canceling this dialog will disable the FBX importer.\nYou can re-enable it in the Project Settings under Filesystem > Import > FBX > Enabled.\n\nThe editor will restart as importers are registered when the editor starts."));
} else {
get_cancel_button()->set_text(TTR("Cancel"));
get_cancel_button()->set_tooltip_text("");
}
popup_centered();
}
@ -96,6 +108,17 @@ void FBXImporterManager::_path_confirmed() {
EditorSettings::get_singleton()->save();
}
void FBXImporterManager::_cancel_setup() {
if (!is_importing) {
return; // No worry.
}
// No escape.
ProjectSettings::get_singleton()->set("filesystem/import/fbx/enabled", false);
ProjectSettings::get_singleton()->save();
EditorNode::get_singleton()->save_all_scenes();
EditorNode::get_singleton()->restart_editor();
}
void FBXImporterManager::_browse_install() {
if (fbx_path->get_text() != String()) {
browse_dialog->set_current_file(fbx_path->get_text());
@ -140,6 +163,7 @@ FBXImporterManager::FBXImporterManager() {
fbx_path->connect("text_changed", callable_mp(this, &FBXImporterManager::_validate_path));
get_ok_button()->set_text(TTR("Confirm Path"));
get_cancel_button()->connect("pressed", callable_mp(this, &FBXImporterManager::_cancel_setup));
browse_dialog = memnew(EditorFileDialog);
browse_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM);

View File

@ -38,6 +38,8 @@
class FBXImporterManager : public ConfirmationDialog {
GDCLASS(FBXImporterManager, ConfirmationDialog)
bool is_importing = false;
Label *message = nullptr;
LineEdit *fbx_path = nullptr;
Button *fbx_path_browse = nullptr;
@ -47,6 +49,7 @@ class FBXImporterManager : public ConfirmationDialog {
void _validate_path(const String &p_path);
void _select_file(const String &p_path);
void _path_confirmed();
void _cancel_setup();
void _browse_install();
void _link_clicked();

View File

@ -1398,7 +1398,7 @@ void EditorAssetLibrary::_asset_open() {
}
void EditorAssetLibrary::_manage_plugins() {
ProjectSettingsEditor::get_singleton()->popup_project_settings();
ProjectSettingsEditor::get_singleton()->popup_project_settings(true);
ProjectSettingsEditor::get_singleton()->set_plugins_page();
}

View File

@ -4556,6 +4556,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
undo_redo->add_do_method(root, "remove_meta", "_edit_vertical_guides_");
undo_redo->add_undo_method(root, "set_meta", "_edit_vertical_guides_", vguides);
}
undo_redo->add_do_method(viewport, "queue_redraw");
undo_redo->add_undo_method(viewport, "queue_redraw");
undo_redo->commit_action();
}

View File

@ -3693,6 +3693,7 @@ void Node3DEditorViewport::update_transform_gizmo_view() {
return;
}
bool show_gizmo = spatial_editor->is_gizmo_visible() && !_edit.instant;
for (int i = 0; i < 3; i++) {
Transform3D axis_angle;
if (xform.basis.get_column(i).normalized().dot(xform.basis.get_column((i + 1) % 3).normalized()) < 1.0) {
@ -3701,15 +3702,15 @@ void Node3DEditorViewport::update_transform_gizmo_view() {
axis_angle.basis.scale(scale);
axis_angle.origin = xform.origin;
RenderingServer::get_singleton()->instance_set_transform(move_gizmo_instance[i], axis_angle);
RenderingServer::get_singleton()->instance_set_visible(move_gizmo_instance[i], spatial_editor->is_gizmo_visible() && (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT || spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_MOVE));
RenderingServer::get_singleton()->instance_set_visible(move_gizmo_instance[i], show_gizmo && (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT || spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_MOVE));
RenderingServer::get_singleton()->instance_set_transform(move_plane_gizmo_instance[i], axis_angle);
RenderingServer::get_singleton()->instance_set_visible(move_plane_gizmo_instance[i], spatial_editor->is_gizmo_visible() && (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT || spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_MOVE));
RenderingServer::get_singleton()->instance_set_visible(move_plane_gizmo_instance[i], show_gizmo && (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT || spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_MOVE));
RenderingServer::get_singleton()->instance_set_transform(rotate_gizmo_instance[i], axis_angle);
RenderingServer::get_singleton()->instance_set_visible(rotate_gizmo_instance[i], spatial_editor->is_gizmo_visible() && (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT || spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_ROTATE));
RenderingServer::get_singleton()->instance_set_visible(rotate_gizmo_instance[i], show_gizmo && (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT || spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_ROTATE));
RenderingServer::get_singleton()->instance_set_transform(scale_gizmo_instance[i], axis_angle);
RenderingServer::get_singleton()->instance_set_visible(scale_gizmo_instance[i], spatial_editor->is_gizmo_visible() && (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SCALE));
RenderingServer::get_singleton()->instance_set_visible(scale_gizmo_instance[i], show_gizmo && (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SCALE));
RenderingServer::get_singleton()->instance_set_transform(scale_plane_gizmo_instance[i], axis_angle);
RenderingServer::get_singleton()->instance_set_visible(scale_plane_gizmo_instance[i], spatial_editor->is_gizmo_visible() && (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SCALE));
RenderingServer::get_singleton()->instance_set_visible(scale_plane_gizmo_instance[i], show_gizmo && (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SCALE));
RenderingServer::get_singleton()->instance_set_transform(axis_gizmo_instance[i], xform);
}
@ -4477,6 +4478,7 @@ void Node3DEditorViewport::begin_transform(TransformMode p_mode, bool instant) {
_compute_edit(_edit.mouse_pos);
_edit.instant = instant;
_edit.snap = spatial_editor->is_snap_enabled();
update_transform_gizmo_view();
}
}
@ -4858,9 +4860,9 @@ void Node3DEditorViewport::update_transform(Point2 p_mousepos, bool p_shift) {
void Node3DEditorViewport::finish_transform() {
spatial_editor->set_local_coords_enabled(_edit.original_local);
spatial_editor->update_transform_gizmo();
_edit.mode = TRANSFORM_NONE;
_edit.instant = false;
spatial_editor->update_transform_gizmo();
surface->queue_redraw();
}

View File

@ -1233,7 +1233,7 @@ TileDataDefaultEditor::TileDataDefaultEditor() {
picker_button = memnew(Button);
picker_button->set_flat(true);
picker_button->set_toggle_mode(true);
picker_button->set_shortcut(ED_SHORTCUT("tiles_editor/picker", "Picker", Key::P));
picker_button->set_shortcut(ED_SHORTCUT("tiles_editor/picker", TTR("Picker"), Key::P));
toolbar->add_child(picker_button);
}
@ -2720,7 +2720,7 @@ TileDataTerrainsEditor::TileDataTerrainsEditor() {
picker_button = memnew(Button);
picker_button->set_flat(true);
picker_button->set_toggle_mode(true);
picker_button->set_shortcut(ED_SHORTCUT("tiles_editor/picker", "Picker", Key::P));
picker_button->set_shortcut(ED_SHORTCUT("tiles_editor/picker", TTR("Picker"), Key::P));
toolbar->add_child(picker_button);
// Setup

View File

@ -2561,7 +2561,7 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() {
tools_settings_erase_button = memnew(Button);
tools_settings_erase_button->set_flat(true);
tools_settings_erase_button->set_toggle_mode(true);
tools_settings_erase_button->set_shortcut(ED_SHORTCUT("tiles_editor/eraser", "Eraser", Key::E));
tools_settings_erase_button->set_shortcut(ED_SHORTCUT("tiles_editor/eraser", TTR("Eraser"), Key::E));
tools_settings_erase_button->set_shortcut_context(this);
tool_settings->add_child(tools_settings_erase_button);

View File

@ -45,7 +45,7 @@ void ProjectSettingsEditor::connect_filesystem_dock_signals(FileSystemDock *p_fs
localization_editor->connect_filesystem_dock_signals(p_fs_dock);
}
void ProjectSettingsEditor::popup_project_settings() {
void ProjectSettingsEditor::popup_project_settings(bool p_clear_filter) {
// Restore valid window bounds or pop up at default size.
Rect2 saved_size = EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "project_settings", Rect2());
if (saved_size != Rect2()) {
@ -62,6 +62,10 @@ void ProjectSettingsEditor::popup_project_settings() {
autoload_settings->update_autoload();
plugin_settings->update_plugins();
import_defaults_editor->clear();
if (p_clear_filter) {
search_box->clear();
}
}
void ProjectSettingsEditor::queue_save() {

View File

@ -116,7 +116,7 @@ protected:
public:
static ProjectSettingsEditor *get_singleton() { return singleton; }
void popup_project_settings();
void popup_project_settings(bool p_clear_filter = false);
void set_plugins_page();
void set_general_page(const String &p_category);
void update_plugins();

View File

@ -1096,6 +1096,7 @@ const char *RenamesMap3To4::gdscript_properties_renames[][2] = {
{ "margin_top", "offset_top" }, // Control -- Breaks NinePatchRect, StyleBox.
{ "mid_height", "height" }, // CapsuleMesh
{ "neighbor_dist", "neighbor_distance" }, // NavigationAgent2D, NavigationAgent3D
{ "octaves", "fractal_octaves" }, // OpenSimplexNoise -> FastNoiseLite
{ "offset_h", "drag_horizontal_offset" }, // Camera2D
{ "offset_v", "drag_vertical_offset" }, // Camera2D
{ "off_disabled", "unchecked_disabled" }, // Theme
@ -1189,6 +1190,7 @@ const char *RenamesMap3To4::csharp_properties_renames[][2] = {
{ "MarginTop", "OffsetTop" }, // Control -- Breaks NinePatchRect, StyleBox.
{ "MidHeight", "Height" }, // CapsuleMesh
{ "NeighborDist", "NeighborDistance" }, // NavigationAgent2D, NavigationAgent3D
{ "Octaves", "FractalOctaves" }, // OpenSimplexNoise -> FastNoiseLite
{ "OffsetH", "DragHorizontalOffset" }, // Camera2D
{ "OffsetV", "DragVerticalOffset" }, // Camera2D
{ "OffDisabled", "UncheckedDisabled" }, // Theme
@ -1525,6 +1527,7 @@ const char *RenamesMap3To4::class_renames[][2] = {
{ "NetworkedMultiplayerPeer", "MultiplayerPeer" },
{ "Occluder", "OccluderInstance3D" },
{ "OmniLight", "OmniLight3D" },
{ "OpenSimplexNoise", "FastNoiseLite" },
{ "PHashTranslation", "OptimizedTranslation" },
{ "PacketPeerGDNative", "PacketPeerExtension" },
{ "PanoramaSky", "Sky" },

View File

@ -1956,7 +1956,7 @@ static bool _guess_identifier_type(GDScriptParser::CompletionContext &p_context,
GDScriptParser::CompletionContext c = p_context;
c.current_line = type_test->operand->start_line;
c.current_suite = suite;
if ((!id_type.is_set() || id_type.is_variant()) && type_test->test_datatype.is_hard_type()) {
if (type_test->test_datatype.is_hard_type()) {
id_type = type_test->test_datatype;
if (last_assign_line < c.current_line) {
// Override last assignment.

View File

@ -1521,7 +1521,7 @@ GDScriptParser::SuiteNode *GDScriptParser::parse_suite(const String &p_context,
int error_count = 0;
do {
if (!multiline && previous.type == GDScriptTokenizer::Token::SEMICOLON && check(GDScriptTokenizer::Token::NEWLINE)) {
if (is_at_end() || (!multiline && previous.type == GDScriptTokenizer::Token::SEMICOLON && check(GDScriptTokenizer::Token::NEWLINE))) {
break;
}
Node *statement = parse_statement();

View File

@ -143,8 +143,8 @@ void initialize_gltf_module(ModuleInitializationLevel p_level) {
EditorPlugins::add_by_type<SceneExporterGLTFPlugin>();
// Project settings defined here so doctool finds them.
GLOBAL_DEF_RST("filesystem/import/blender/enabled", true);
GLOBAL_DEF_RST("filesystem/import/fbx/enabled", true);
GLOBAL_DEF_RST_BASIC("filesystem/import/blender/enabled", true);
GLOBAL_DEF_RST_BASIC("filesystem/import/fbx/enabled", true);
GDREGISTER_CLASS(EditorSceneFormatImporterBlend);
GDREGISTER_CLASS(EditorSceneFormatImporterFBX);
// Can't (a priori) run external app on these platforms.

View File

@ -39,7 +39,7 @@
#import <CoreMotion/CoreMotion.h>
static const int max_touches = 8;
static const int max_touches = 32;
static const float earth_gravity = 9.80665;
@interface GodotView () {

View File

@ -2917,7 +2917,7 @@ BitField<MouseButtonMask> DisplayServerX11::_get_mouse_button_state(MouseButton
}
void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event, LocalVector<XEvent> &p_events, uint32_t &p_event_index, bool p_echo) {
WindowData wd = windows[p_window];
WindowData &wd = windows[p_window];
// X11 functions don't know what const is
XKeyEvent *xkeyevent = p_event;
@ -4850,7 +4850,7 @@ DisplayServer *DisplayServerX11::create_func(const String &p_rendering_driver, W
vformat("Your video card drivers seem not to support the required Vulkan version.\n\n"
"If possible, consider updating your video card drivers or using the OpenGL 3 driver.\n\n"
"You can enable the OpenGL 3 driver by starting the engine from the\n"
"command line with the command:\n'%s --rendering-driver opengl3'\n\n"
"command line with the command:\n\n \"%s\" --rendering-driver opengl3\n\n"
"If you recently updated your video card drivers, try rebooting.",
executable_name),
"Unable to initialize Vulkan video driver");
@ -4873,7 +4873,9 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, V
#ifdef GLES3_ENABLED
if (gl_manager) {
visualInfo = gl_manager->get_vi(x11_display);
Error err;
visualInfo = gl_manager->get_vi(x11_display, err);
ERR_FAIL_COND_V_MSG(err != OK, INVALID_WINDOW_ID, "Can't acquire visual info from display.");
vi_selected = true;
}
#endif

View File

@ -83,8 +83,13 @@ int GLManager_X11::_find_or_create_display(Display *p_x11_display) {
d.context = memnew(GLManager_X11_Private);
d.context->glx_context = nullptr;
//Error err = _create_context(d);
_create_context(d);
Error err = _create_context(d);
if (err != OK) {
_displays.remove_at(new_display_id);
return -1;
}
return new_display_id;
}
@ -191,8 +196,14 @@ Error GLManager_X11::_create_context(GLDisplay &gl_display) {
return OK;
}
XVisualInfo GLManager_X11::get_vi(Display *p_display) {
return _displays[_find_or_create_display(p_display)].x_vi;
XVisualInfo GLManager_X11::get_vi(Display *p_display, Error &r_error) {
int display_id = _find_or_create_display(p_display);
if (display_id < 0) {
r_error = FAILED;
return XVisualInfo();
}
r_error = OK;
return _displays[display_id].x_vi;
}
Error GLManager_X11::window_create(DisplayServer::WindowID p_window_id, ::Window p_window, Display *p_display, int p_width, int p_height) {
@ -211,6 +222,10 @@ Error GLManager_X11::window_create(DisplayServer::WindowID p_window_id, ::Window
win.x11_window = p_window;
win.gldisplay_id = _find_or_create_display(p_display);
if (win.gldisplay_id == -1) {
return FAILED;
}
// the display could be invalid .. check NYI
GLDisplay &gl_display = _displays[win.gldisplay_id];
::Display *x11_display = gl_display.x11_display;

View File

@ -114,7 +114,7 @@ private:
Error _create_context(GLDisplay &gl_display);
public:
XVisualInfo get_vi(Display *p_display);
XVisualInfo get_vi(Display *p_display, Error &r_error);
Error window_create(DisplayServer::WindowID p_window_id, ::Window p_window, Display *p_display, int p_width, int p_height);
void window_destroy(DisplayServer::WindowID p_window_id);
void window_resize(DisplayServer::WindowID p_window_id, int p_width, int p_height);

View File

@ -85,8 +85,8 @@ void KeyMappingX11::initialize() {
xkeysym_map[XK_Begin] = Key::CLEAR;
xkeysym_map[XK_Insert] = Key::INSERT;
xkeysym_map[XK_Delete] = Key::KEY_DELETE;
//xkeysym_map[XK_KP_Equal]
//xkeysym_map[XK_KP_Separator]
xkeysym_map[XK_KP_Equal] = Key::EQUAL;
xkeysym_map[XK_KP_Separator] = Key::COMMA;
xkeysym_map[XK_KP_Decimal] = Key::KP_PERIOD;
xkeysym_map[XK_KP_Delete] = Key::KP_PERIOD;
xkeysym_map[XK_KP_Multiply] = Key::KP_MULTIPLY;
@ -220,7 +220,7 @@ void KeyMappingX11::initialize() {
scancode_map[0x22] = Key::BRACKETLEFT;
scancode_map[0x23] = Key::BRACKETRIGHT;
scancode_map[0x24] = Key::ENTER;
scancode_map[0x25] = Key::CTRL;
scancode_map[0x25] = Key::CTRL; // Left
scancode_map[0x26] = Key::A;
scancode_map[0x27] = Key::S;
scancode_map[0x28] = Key::D;
@ -233,7 +233,7 @@ void KeyMappingX11::initialize() {
scancode_map[0x2F] = Key::SEMICOLON;
scancode_map[0x30] = Key::APOSTROPHE;
scancode_map[0x31] = Key::QUOTELEFT;
scancode_map[0x32] = Key::SHIFT;
scancode_map[0x32] = Key::SHIFT; // Left
scancode_map[0x33] = Key::BACKSLASH;
scancode_map[0x34] = Key::Z;
scancode_map[0x35] = Key::X;
@ -245,9 +245,9 @@ void KeyMappingX11::initialize() {
scancode_map[0x3B] = Key::COMMA;
scancode_map[0x3C] = Key::PERIOD;
scancode_map[0x3D] = Key::SLASH;
scancode_map[0x3E] = Key::SHIFT;
scancode_map[0x3E] = Key::SHIFT; // Right
scancode_map[0x3F] = Key::KP_MULTIPLY;
scancode_map[0x40] = Key::ALT;
scancode_map[0x40] = Key::ALT; // Left
scancode_map[0x41] = Key::SPACE;
scancode_map[0x42] = Key::CAPSLOCK;
scancode_map[0x43] = Key::F1;
@ -275,14 +275,23 @@ void KeyMappingX11::initialize() {
scancode_map[0x59] = Key::KP_3;
scancode_map[0x5A] = Key::KP_0;
scancode_map[0x5B] = Key::KP_PERIOD;
//scancode_map[0x5C]
//scancode_map[0x5D] // Zenkaku Hankaku
scancode_map[0x5E] = Key::SECTION;
scancode_map[0x5F] = Key::F11;
scancode_map[0x60] = Key::F12;
//scancode_map[0x61] // Romaji
//scancode_map[0x62] // Katakana
//scancode_map[0x63] // Hiragana
//scancode_map[0x64] // Henkan
//scancode_map[0x65] // Hiragana Katakana
//scancode_map[0x66] // Muhenkan
scancode_map[0x67] = Key::COMMA; // KP_Separator
scancode_map[0x68] = Key::KP_ENTER;
scancode_map[0x69] = Key::CTRL;
scancode_map[0x69] = Key::CTRL; // Right
scancode_map[0x6A] = Key::KP_DIVIDE;
scancode_map[0x6B] = Key::PRINT;
scancode_map[0x6C] = Key::ALT;
scancode_map[0x6C] = Key::ALT; // Right
scancode_map[0x6D] = Key::ENTER;
scancode_map[0x6E] = Key::HOME;
scancode_map[0x6F] = Key::UP;
@ -294,13 +303,28 @@ void KeyMappingX11::initialize() {
scancode_map[0x75] = Key::PAGEDOWN;
scancode_map[0x76] = Key::INSERT;
scancode_map[0x77] = Key::KEY_DELETE;
//scancode_map[0x78] // Macro
scancode_map[0x79] = Key::VOLUMEMUTE;
scancode_map[0x7A] = Key::VOLUMEDOWN;
scancode_map[0x7B] = Key::VOLUMEUP;
//scancode_map[0x7C] // Power
scancode_map[0x7D] = Key::EQUAL; // KP_Equal
//scancode_map[0x7E] // KP_PlusMinus
scancode_map[0x7F] = Key::PAUSE;
scancode_map[0x85] = Key::META;
scancode_map[0x86] = Key::META;
scancode_map[0x80] = Key::LAUNCH0;
scancode_map[0x81] = Key::COMMA; // KP_Comma
//scancode_map[0x82] // Hangul
//scancode_map[0x83] // Hangul_Hanja
scancode_map[0x84] = Key::YEN;
scancode_map[0x85] = Key::META; // Left
scancode_map[0x86] = Key::META; // Right
scancode_map[0x87] = Key::MENU;
scancode_map[0xA6] = Key::BACK; // On Chromebooks
scancode_map[0xA7] = Key::FORWARD; // On Chromebooks
scancode_map[0xB5] = Key::REFRESH; // On Chromebooks
scancode_map[0xBF] = Key::F13;
scancode_map[0xC0] = Key::F14;
scancode_map[0xC1] = Key::F15;

View File

@ -3617,15 +3617,15 @@ DisplayServer *DisplayServerMacOS::create_func(const String &p_rendering_driver,
if (p_rendering_driver == "vulkan") {
String executable_command;
if (OS::get_singleton()->get_bundle_resource_dir() == OS::get_singleton()->get_executable_path().get_base_dir()) {
executable_command = vformat("%s --rendering-driver opengl3", OS::get_singleton()->get_executable_path());
executable_command = vformat("\"%s\" --rendering-driver opengl3", OS::get_singleton()->get_executable_path());
} else {
executable_command = vformat("open %s --args --rendering-driver opengl3", OS::get_singleton()->get_bundle_resource_dir().path_join("../..").simplify_path());
executable_command = vformat("open \"%s\" --args --rendering-driver opengl3", OS::get_singleton()->get_bundle_resource_dir().path_join("../..").simplify_path());
}
OS::get_singleton()->alert(
vformat("Your video card drivers seem not to support the required Vulkan version.\n\n"
"If possible, consider updating your macOS version or using the OpenGL 3 driver.\n\n"
"You can enable the OpenGL 3 driver by starting the engine from the\n"
"command line with the command:\n'%s'",
"command line with the command:\n\n %s",
executable_command),
"Unable to initialize Vulkan video driver");
} else {

View File

@ -4312,7 +4312,7 @@ DisplayServer *DisplayServerWindows::create_func(const String &p_rendering_drive
vformat("Your video card drivers seem not to support the required Vulkan version.\n\n"
"If possible, consider updating your video card drivers or using the OpenGL 3 driver.\n\n"
"You can enable the OpenGL 3 driver by starting the engine from the\n"
"command line with the command:\n'%s --rendering-driver opengl3'\n\n"
"command line with the command:\n\n \"%s\" --rendering-driver opengl3\n\n"
"If you have recently updated your video card drivers, try rebooting.",
executable_name),
"Unable to initialize Vulkan video driver");

View File

@ -315,7 +315,7 @@ void KeyMappingWindows::initialize() {
scansym_map[0x51] = Key::KP_3;
scansym_map[0x52] = Key::KP_0;
scansym_map[0x53] = Key::KP_PERIOD;
scansym_map[0x57] = Key::SECTION;
scansym_map[0x56] = Key::SECTION;
scansym_map[0x57] = Key::F11;
scansym_map[0x58] = Key::F12;
scansym_map[0x5B] = Key::META;

View File

@ -1207,7 +1207,7 @@ void CPUParticles3D::_update_particle_data_buffer() {
ptr[10] = t.basis.rows[2][2];
ptr[11] = t.origin.z;
} else {
memset(ptr, 0, sizeof(Transform3D));
memset(ptr, 0, sizeof(float) * 12);
}
Color c = r[idx].color;

View File

@ -117,8 +117,10 @@ void MeshInstance3D::set_mesh(const Ref<Mesh> &p_mesh) {
mesh = p_mesh;
if (mesh.is_valid()) {
mesh->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &MeshInstance3D::_mesh_changed));
// If mesh is a PrimitiveMesh, calling get_rid on it can trigger a changed callback
// so do this before connecting _mesh_changed.
set_base(mesh->get_rid());
mesh->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &MeshInstance3D::_mesh_changed));
_mesh_changed();
} else {
blend_shape_tracks.clear();

View File

@ -243,11 +243,12 @@ void LinkButton::_notification(int p_what) {
if (do_underline) {
int underline_spacing = theme_cache.underline_spacing + text_buf->get_line_underline_position();
int y = text_buf->get_line_ascent() + underline_spacing;
int underline_thickness = MAX(1, text_buf->get_line_underline_thickness());
if (is_layout_rtl()) {
draw_line(Vector2(size.width - width, y), Vector2(size.width, y), color, text_buf->get_line_underline_thickness());
draw_line(Vector2(size.width - width, y), Vector2(size.width, y), color, underline_thickness);
} else {
draw_line(Vector2(0, y), Vector2(width, y), color, text_buf->get_line_underline_thickness());
draw_line(Vector2(0, y), Vector2(width, y), color, underline_thickness);
}
}
} break;

View File

@ -666,7 +666,7 @@ void MenuBar::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_menu_popup", "menu"), &MenuBar::get_menu_popup);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "flat"), "set_flat", "is_flat");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "start_index"), "set_start_index", "get_start_index");
ADD_PROPERTY(PropertyInfo(Variant::INT, "start_index"), "set_start_index", "get_start_index");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "switch_on_hover"), "set_switch_on_hover", "is_switch_on_hover");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "prefer_global_menu"), "set_prefer_global_menu", "is_prefer_global_menu");

View File

@ -269,7 +269,7 @@ uniform vec4 sky_top_color : source_color = vec4(0.385, 0.454, 0.55, 1.0);
uniform vec4 sky_horizon_color : source_color = vec4(0.646, 0.656, 0.67, 1.0);
uniform float sky_curve : hint_range(0, 1) = 0.15;
uniform float sky_energy = 1.0; // In Lux.
uniform sampler2D sky_cover : source_color, hint_default_black;
uniform sampler2D sky_cover : filter_linear, source_color, hint_default_black;
uniform vec4 sky_cover_modulate : source_color = vec4(1.0, 1.0, 1.0, 1.0);
uniform vec4 ground_bottom_color : source_color = vec4(0.2, 0.169, 0.133, 1.0);
uniform vec4 ground_horizon_color : source_color = vec4(0.646, 0.656, 0.67, 1.0);
@ -676,7 +676,7 @@ uniform float sun_disk_scale : hint_range(0, 360) = 1.0;
uniform vec4 ground_color : source_color = vec4(0.1, 0.07, 0.034, 1.0);
uniform float exposure : hint_range(0, 128) = 1.0;
uniform sampler2D night_sky : source_color, hint_default_black;
uniform sampler2D night_sky : filter_linear, source_color, hint_default_black;
const vec3 UP = vec3( 0.0, 1.0, 0.0 );

View File

@ -158,8 +158,8 @@ void register_server_types() {
GDREGISTER_NATIVE_STRUCT(PhysicsServer3DExtensionRayResult, "Vector3 position;Vector3 normal;RID rid;ObjectID collider_id;Object *collider;int shape");
GDREGISTER_NATIVE_STRUCT(PhysicsServer3DExtensionShapeResult, "RID rid;ObjectID collider_id;Object *collider;int shape");
GDREGISTER_NATIVE_STRUCT(PhysicsServer3DExtensionShapeRestInfo, "Vector3 point;Vector3 normal;RID rid;ObjectID collider_id;int shape;Vector3 linear_velocity");
GDREGISTER_NATIVE_STRUCT(PhysicsServer3DExtensionMotionCollision, "Vector3 position;Vector3 normal;Vector3 collider_velocity;real_t depth;int local_shape;ObjectID collider_id;RID collider;int collider_shape");
GDREGISTER_NATIVE_STRUCT(PhysicsServer3DExtensionMotionResult, "Vector3 travel;Vector3 remainder;real_t collision_safe_fraction;real_t collision_unsafe_fraction;PhysicsServer3DExtensionMotionCollision collisions[32];int collision_count");
GDREGISTER_NATIVE_STRUCT(PhysicsServer3DExtensionMotionCollision, "Vector3 position;Vector3 normal;Vector3 collider_velocity;Vector3 collider_angular_velocity;real_t depth;int local_shape;ObjectID collider_id;RID collider;int collider_shape");
GDREGISTER_NATIVE_STRUCT(PhysicsServer3DExtensionMotionResult, "Vector3 travel;Vector3 remainder;real_t collision_depth;real_t collision_safe_fraction;real_t collision_unsafe_fraction;PhysicsServer3DExtensionMotionCollision collisions[32];int collision_count");
GDREGISTER_ABSTRACT_CLASS(NavigationServer2D);
GDREGISTER_ABSTRACT_CLASS(NavigationServer3D);

View File

@ -321,6 +321,7 @@ public:
};
CanvasGroup *canvas_group = nullptr;
bool use_canvas_group = false;
int light_mask;
int z_final;

View File

@ -1110,11 +1110,9 @@ void RendererCanvasRenderRD::_render_items(RID p_to_render_target, int p_item_co
RID material = ci->material_owner == nullptr ? ci->material : ci->material_owner->material;
if (ci->canvas_group != nullptr) {
if (ci->use_canvas_group) {
if (ci->canvas_group->mode == RS::CANVAS_GROUP_MODE_CLIP_AND_DRAW) {
if (!p_to_backbuffer) {
material = default_clip_children_material;
}
material = default_clip_children_material;
} else {
if (material.is_null()) {
if (ci->canvas_group->mode == RS::CANVAS_GROUP_MODE_CLIP_ONLY) {
@ -1381,6 +1379,7 @@ void RendererCanvasRenderRD::canvas_render_items(RID p_to_render_target, Item *p
bool backbuffer_gen_mipmaps = false;
Item *canvas_group_owner = nullptr;
bool skip_item = false;
bool update_skeletons = false;
bool time_used = false;
@ -1453,6 +1452,7 @@ void RendererCanvasRenderRD::canvas_render_items(RID p_to_render_target, Item *p
Rect2i group_rect = ci->canvas_group_owner->global_rect_cache;
texture_storage->render_target_copy_to_back_buffer(p_to_render_target, group_rect, false);
if (ci->canvas_group_owner->canvas_group->mode == RS::CANVAS_GROUP_MODE_CLIP_AND_DRAW) {
ci->canvas_group_owner->use_canvas_group = false;
items[item_count++] = ci->canvas_group_owner;
}
} else if (!backbuffer_cleared) {
@ -1467,9 +1467,8 @@ void RendererCanvasRenderRD::canvas_render_items(RID p_to_render_target, Item *p
ci->canvas_group_owner = nullptr; //must be cleared
}
if (!backbuffer_cleared && canvas_group_owner == nullptr && ci->canvas_group != nullptr && !backbuffer_copy) {
texture_storage->render_target_clear_back_buffer(p_to_render_target, Rect2i(), Color(0, 0, 0, 0));
backbuffer_cleared = true;
if (canvas_group_owner == nullptr && ci->canvas_group != nullptr && ci->canvas_group->mode != RS::CANVAS_GROUP_MODE_CLIP_AND_DRAW) {
skip_item = true;
}
if (ci == canvas_group_owner) {
@ -1488,6 +1487,11 @@ void RendererCanvasRenderRD::canvas_render_items(RID p_to_render_target, Item *p
canvas_group_owner = nullptr;
// Backbuffer is dirty now and needs to be re-cleared if another CanvasGroup needs it.
backbuffer_cleared = false;
// Tell the renderer to paint this as a canvas group
ci->use_canvas_group = true;
} else {
ci->use_canvas_group = false;
}
if (backbuffer_copy) {
@ -1503,9 +1507,9 @@ void RendererCanvasRenderRD::canvas_render_items(RID p_to_render_target, Item *p
texture_storage->render_target_copy_to_back_buffer(p_to_render_target, back_buffer_rect, backbuffer_gen_mipmaps);
backbuffer_copy = false;
backbuffer_gen_mipmaps = false;
material_screen_texture_cached = true; // After a backbuffer copy, screen texture makes no further copies.
material_screen_texture_mipmaps_cached = backbuffer_gen_mipmaps;
backbuffer_gen_mipmaps = false;
}
if (backbuffer_gen_mipmaps) {
@ -1515,7 +1519,11 @@ void RendererCanvasRenderRD::canvas_render_items(RID p_to_render_target, Item *p
material_screen_texture_mipmaps_cached = true;
}
items[item_count++] = ci;
if (skip_item) {
skip_item = false;
} else {
items[item_count++] = ci;
}
if (!ci->next || item_count == MAX_RENDER_ITEMS - 1) {
if (update_skeletons) {
@ -1523,7 +1531,7 @@ void RendererCanvasRenderRD::canvas_render_items(RID p_to_render_target, Item *p
update_skeletons = false;
}
_render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list, r_sdf_used, false);
_render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list, r_sdf_used, canvas_group_owner != nullptr);
//then reset
item_count = 0;
}

View File

@ -438,6 +438,7 @@ void MeshStorage::mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface)
} else {
mesh->aabb.merge_with(p_surface.aabb);
}
mesh->skeleton_aabb_version = 0;
s->material = p_surface.material;
@ -634,12 +635,12 @@ AABB MeshStorage::mesh_get_aabb(RID p_mesh, RID p_skeleton) {
Transform3D mtx;
mtx.basis.rows[0].x = dataptr[0];
mtx.basis.rows[1].x = dataptr[1];
mtx.basis.rows[0][0] = dataptr[0];
mtx.basis.rows[0][1] = dataptr[1];
mtx.origin.x = dataptr[3];
mtx.basis.rows[0].y = dataptr[4];
mtx.basis.rows[1].y = dataptr[5];
mtx.basis.rows[1][0] = dataptr[4];
mtx.basis.rows[1][1] = dataptr[5];
mtx.origin.y = dataptr[7];
AABB baabb = mtx.xform(skbones[j]);
@ -1501,12 +1502,12 @@ void MeshStorage::_multimesh_re_create_aabb(MultiMesh *multimesh, const float *p
t.origin.z = data[11];
} else {
t.basis.rows[0].x = data[0];
t.basis.rows[1].x = data[1];
t.basis.rows[0][0] = data[0];
t.basis.rows[0][1] = data[1];
t.origin.x = data[3];
t.basis.rows[0].y = data[4];
t.basis.rows[1].y = data[5];
t.basis.rows[1][0] = data[4];
t.basis.rows[1][1] = data[5];
t.origin.y = data[7];
}

View File

@ -653,6 +653,7 @@ void RendererSceneCull::instance_set_base(RID p_instance, RID p_base) {
geom->geometry_instance->set_use_baked_light(instance->baked_light);
geom->geometry_instance->set_use_dynamic_gi(instance->dynamic_gi);
geom->geometry_instance->set_use_lightmap(RID(), instance->lightmap_uv_scale, instance->lightmap_slice_index);
geom->geometry_instance->set_instance_shader_uniforms_offset(instance->instance_allocated_shader_uniforms_offset);
geom->geometry_instance->set_cast_double_sided_shadows(instance->cast_shadows == RS::SHADOW_CASTING_SETTING_DOUBLE_SIDED);
if (instance->lightmap_sh.size() == 9) {
geom->geometry_instance->set_lightmap_capture(instance->lightmap_sh.ptr());

View File

@ -0,0 +1,26 @@
From 29d492b60c84ca784ea0943efc7d2e6e0f3bdaac Mon Sep 17 00:00:00 2001
From: Adam Sawicki <adam.sawicki@amd.com>
Date: Thu, 19 Jan 2023 13:19:55 +0100
Subject: [PATCH] Added missing #include <cstdio>
For snprintf, for compatibility with GCC 13.
Fixes #312 - thanks @marxin !
---
thirdparty/vulkan/vk_mem_alloc.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/thirdparty/vulkan/vk_mem_alloc.h b/thirdparty/vulkan/vk_mem_alloc.h
index b787c36..0fe459b 100644
--- a/thirdparty/vulkan/vk_mem_alloc.h
+++ b/thirdparty/vulkan/vk_mem_alloc.h
@@ -2614,6 +2614,10 @@ VMA_CALL_PRE void VMA_CALL_POST vmaFreeStatsString(
#include <bit> // For std::popcount
#endif
+#if VMA_STATS_STRING_ENABLED
+ #include <cstdio> // For snprintf
+#endif
+
/*******************************************************************************
CONFIGURATION SECTION

View File

@ -2582,6 +2582,10 @@ VMA_CALL_PRE void VMA_CALL_POST vmaFreeStatsString(
#include <bit> // For std::popcount
#endif
#if VMA_STATS_STRING_ENABLED
#include <cstdio> // For snprintf
#endif
/*******************************************************************************
CONFIGURATION SECTION