summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/classes/Callable.xml2
-rw-r--r--methods.py3
-rw-r--r--modules/csg/doc_classes/CSGMesh3D.xml3
-rw-r--r--modules/gdscript/gdscript_lambda_callable.cpp4
-rw-r--r--modules/gdscript/gdscript_lambda_callable.h1
-rw-r--r--modules/gdscript/gdscript_rpc_callable.cpp4
-rw-r--r--modules/gdscript/gdscript_rpc_callable.h1
-rw-r--r--modules/mono/godotsharp_dirs.cpp4
-rw-r--r--platform/android/export/export_plugin.cpp13
-rw-r--r--scene/2d/camera_2d.cpp77
-rw-r--r--scene/2d/camera_2d.h1
11 files changed, 67 insertions, 46 deletions
diff --git a/doc/classes/Callable.xml b/doc/classes/Callable.xml
index c7b2d6df94..b903e98319 100644
--- a/doc/classes/Callable.xml
+++ b/doc/classes/Callable.xml
@@ -138,7 +138,7 @@
<method name="get_method" qualifiers="const">
<return type="StringName" />
<description>
- Returns the name of the method represented by this [Callable]. If the callable is a lambda function, returns the function's name.
+ Returns the name of the method represented by this [Callable]. If the callable is a GDScript lambda function, returns the function's name or [code]"&lt;anonymous lambda&gt;"[/code].
</description>
</method>
<method name="get_object" qualifiers="const">
diff --git a/methods.py b/methods.py
index 571a3f739e..7c1781d699 100644
--- a/methods.py
+++ b/methods.py
@@ -868,6 +868,9 @@ def generate_vs_project(env, num_jobs, project_name="godot"):
if env["custom_modules"]:
common_build_postfix.append("custom_modules=%s" % env["custom_modules"])
+ if env["windows_subsystem"] == "console":
+ common_build_postfix.append("windows_subsystem=console")
+
if env["precision"] == "double":
common_build_postfix.append("precision=double")
diff --git a/modules/csg/doc_classes/CSGMesh3D.xml b/modules/csg/doc_classes/CSGMesh3D.xml
index 9a0f121e19..96d89ff486 100644
--- a/modules/csg/doc_classes/CSGMesh3D.xml
+++ b/modules/csg/doc_classes/CSGMesh3D.xml
@@ -16,7 +16,8 @@
</member>
<member name="mesh" type="Mesh" setter="set_mesh" getter="get_mesh">
The [Mesh] resource to use as a CSG shape.
- [b]Note:[/b] When using an [ArrayMesh], avoid meshes with vertex normals unless a flat shader is required. By default, CSGMesh will ignore the mesh's vertex normals and use a smooth shader calculated using the faces' normals. If a flat shader is required, ensure that all faces' vertex normals are parallel.
+ [b]Note:[/b] When using an [ArrayMesh], all vertex attributes except [constant Mesh.ARRAY_VERTEX], [constant Mesh.ARRAY_NORMAL] and [constant Mesh.ARRAY_TEX_UV] are left unused. Only [constant Mesh.ARRAY_VERTEX] and [constant Mesh.ARRAY_TEX_UV] will be passed to the GPU.
+ [constant Mesh.ARRAY_NORMAL] is only used to determine which faces require the use of flat shading. By default, CSGMesh will ignore the mesh's vertex normals, recalculate them for each vertex and use a smooth shader. If a flat shader is required for a face, ensure that all vertex normals of the face are approximately equal.
</member>
</members>
</class>
diff --git a/modules/gdscript/gdscript_lambda_callable.cpp b/modules/gdscript/gdscript_lambda_callable.cpp
index 9e14e43a58..3b89f077bd 100644
--- a/modules/gdscript/gdscript_lambda_callable.cpp
+++ b/modules/gdscript/gdscript_lambda_callable.cpp
@@ -67,6 +67,10 @@ ObjectID GDScriptLambdaCallable::get_object() const {
return script->get_instance_id();
}
+StringName GDScriptLambdaCallable::get_method() const {
+ return function->get_name();
+}
+
void GDScriptLambdaCallable::call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const {
int captures_amount = captures.size();
diff --git a/modules/gdscript/gdscript_lambda_callable.h b/modules/gdscript/gdscript_lambda_callable.h
index 33bdf6dfc1..1c7a18fb9d 100644
--- a/modules/gdscript/gdscript_lambda_callable.h
+++ b/modules/gdscript/gdscript_lambda_callable.h
@@ -56,6 +56,7 @@ public:
CompareEqualFunc get_compare_equal_func() const override;
CompareLessFunc get_compare_less_func() const override;
ObjectID get_object() const override;
+ StringName get_method() const override;
void call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const override;
GDScriptLambdaCallable(Ref<GDScript> p_script, GDScriptFunction *p_function, const Vector<Variant> &p_captures);
diff --git a/modules/gdscript/gdscript_rpc_callable.cpp b/modules/gdscript/gdscript_rpc_callable.cpp
index a4dd8a8d3c..265e624b6c 100644
--- a/modules/gdscript/gdscript_rpc_callable.cpp
+++ b/modules/gdscript/gdscript_rpc_callable.cpp
@@ -63,6 +63,10 @@ ObjectID GDScriptRPCCallable::get_object() const {
return object->get_instance_id();
}
+StringName GDScriptRPCCallable::get_method() const {
+ return method;
+}
+
void GDScriptRPCCallable::call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const {
r_return_value = object->callp(method, p_arguments, p_argcount, r_call_error);
}
diff --git a/modules/gdscript/gdscript_rpc_callable.h b/modules/gdscript/gdscript_rpc_callable.h
index c1007b18b0..66052157be 100644
--- a/modules/gdscript/gdscript_rpc_callable.h
+++ b/modules/gdscript/gdscript_rpc_callable.h
@@ -51,6 +51,7 @@ public:
CompareEqualFunc get_compare_equal_func() const override;
CompareLessFunc get_compare_less_func() const override;
ObjectID get_object() const override;
+ StringName get_method() const override;
void call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const override;
Error rpc(int p_peer_id, const Variant **p_arguments, int p_argcount, Callable::CallError &r_call_error) const override;
diff --git a/modules/mono/godotsharp_dirs.cpp b/modules/mono/godotsharp_dirs.cpp
index 00ef4ccdde..c84ecf4ceb 100644
--- a/modules/mono/godotsharp_dirs.cpp
+++ b/modules/mono/godotsharp_dirs.cpp
@@ -33,10 +33,6 @@
#include "mono_gd/gd_mono.h"
#include "utils/path_utils.h"
-#ifdef ANDROID_ENABLED
-#include "mono_gd/support/android_support.h"
-#endif
-
#include "core/config/project_settings.h"
#include "core/io/dir_access.h"
#include "core/os/os.h"
diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp
index 9e46085b2a..6f0341d75c 100644
--- a/platform/android/export/export_plugin.cpp
+++ b/platform/android/export/export_plugin.cpp
@@ -2225,17 +2225,15 @@ String EditorExportPlatformAndroid::get_apksigner_path(int p_target_sdk, bool p_
}
bool EditorExportPlatformAndroid::has_valid_export_configuration(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates, bool p_debug) const {
-#ifdef MODULE_MONO_ENABLED
- // Don't check for additional errors, as this particular error cannot be resolved.
- r_error += TTR("Exporting to Android is currently not supported in Godot 4 when using C#/.NET. Use Godot 3 to target Android with C#/Mono instead.") + "\n";
- r_error += TTR("If this project does not use C#, use a non-C# editor build to export the project.") + "\n";
- return false;
-#else
-
String err;
bool valid = false;
const bool gradle_build_enabled = p_preset->get("gradle_build/use_gradle_build");
+#ifdef MODULE_MONO_ENABLED
+ // Android export is still a work in progress, keep a message as a warning.
+ err += TTR("Exporting to Android when using C#/.NET is experimental.") + "\n";
+#endif
+
// Look for export templates (first official, and if defined custom templates).
if (!gradle_build_enabled) {
@@ -2365,7 +2363,6 @@ bool EditorExportPlatformAndroid::has_valid_export_configuration(const Ref<Edito
}
return valid;
-#endif // !MODULE_MONO_ENABLED
}
bool EditorExportPlatformAndroid::has_valid_project_configuration(const Ref<EditorExportPreset> &p_preset, String &r_error) const {
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index e7003ab98b..78987738a5 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -33,20 +33,21 @@
#include "core/config/project_settings.h"
#include "scene/main/window.h"
+bool Camera2D::_is_editing_in_editor() const {
+#ifdef TOOLS_ENABLED
+ return is_part_of_edited_scene();
+#else
+ return false;
+#endif // TOOLS_ENABLED
+}
+
void Camera2D::_update_scroll() {
- if (!is_inside_tree()) {
+ if (!is_inside_tree() || !viewport) {
return;
}
- if (Engine::get_singleton()->is_editor_hint()) {
+ if (_is_editing_in_editor()) {
queue_redraw();
- // Only set viewport transform when not bound to the main viewport.
- if (get_tree()->get_edited_scene_root() && get_viewport() == get_tree()->get_edited_scene_root()->get_viewport()) {
- return;
- }
- }
-
- if (!viewport) {
return;
}
@@ -65,7 +66,7 @@ void Camera2D::_update_scroll() {
}
void Camera2D::_update_process_callback() {
- if (Engine::get_singleton()->is_editor_hint()) {
+ if (_is_editing_in_editor()) {
set_process_internal(false);
set_physics_process_internal(false);
} else if (process_callback == CAMERA2D_PROCESS_IDLE) {
@@ -106,7 +107,7 @@ Transform2D Camera2D::get_camera_transform() {
if (!first) {
if (anchor_mode == ANCHOR_MODE_DRAG_CENTER) {
- if (drag_horizontal_enabled && !Engine::get_singleton()->is_editor_hint() && !drag_horizontal_offset_changed) {
+ if (drag_horizontal_enabled && !_is_editing_in_editor() && !drag_horizontal_offset_changed) {
camera_pos.x = MIN(camera_pos.x, (new_camera_pos.x + screen_size.x * 0.5 * zoom_scale.x * drag_margin[SIDE_LEFT]));
camera_pos.x = MAX(camera_pos.x, (new_camera_pos.x - screen_size.x * 0.5 * zoom_scale.x * drag_margin[SIDE_RIGHT]));
} else {
@@ -119,7 +120,7 @@ Transform2D Camera2D::get_camera_transform() {
drag_horizontal_offset_changed = false;
}
- if (drag_vertical_enabled && !Engine::get_singleton()->is_editor_hint() && !drag_vertical_offset_changed) {
+ if (drag_vertical_enabled && !_is_editing_in_editor() && !drag_vertical_offset_changed) {
camera_pos.y = MIN(camera_pos.y, (new_camera_pos.y + screen_size.y * 0.5 * zoom_scale.y * drag_margin[SIDE_TOP]));
camera_pos.y = MAX(camera_pos.y, (new_camera_pos.y - screen_size.y * 0.5 * zoom_scale.y * drag_margin[SIDE_BOTTOM]));
@@ -158,7 +159,7 @@ Transform2D Camera2D::get_camera_transform() {
}
}
- if (position_smoothing_enabled && !Engine::get_singleton()->is_editor_hint()) {
+ if (position_smoothing_enabled && !_is_editing_in_editor()) {
real_t c = position_smoothing_speed * (process_callback == CAMERA2D_PROCESS_PHYSICS ? get_physics_process_delta_time() : get_process_delta_time());
smoothed_camera_pos = ((camera_pos - smoothed_camera_pos) * c) + smoothed_camera_pos;
ret_camera_pos = smoothed_camera_pos;
@@ -175,7 +176,7 @@ Transform2D Camera2D::get_camera_transform() {
Point2 screen_offset = (anchor_mode == ANCHOR_MODE_DRAG_CENTER ? (screen_size * 0.5 * zoom_scale) : Point2());
if (!ignore_rotation) {
- if (rotation_smoothing_enabled && !Engine::get_singleton()->is_editor_hint()) {
+ if (rotation_smoothing_enabled && !_is_editing_in_editor()) {
real_t step = rotation_smoothing_speed * (process_callback == CAMERA2D_PROCESS_PHYSICS ? get_physics_process_delta_time() : get_process_delta_time());
camera_angle = Math::lerp_angle(camera_angle, get_global_rotation(), step);
} else {
@@ -250,7 +251,7 @@ void Camera2D::_notification(int p_what) {
add_to_group(group_name);
add_to_group(canvas_group_name);
- if (!Engine::get_singleton()->is_editor_hint() && enabled && !viewport->get_camera_2d()) {
+ if (!_is_editing_in_editor() && enabled && !viewport->get_camera_2d()) {
make_current();
}
@@ -272,7 +273,7 @@ void Camera2D::_notification(int p_what) {
#ifdef TOOLS_ENABLED
case NOTIFICATION_DRAW: {
- if (!is_inside_tree() || !Engine::get_singleton()->is_editor_hint()) {
+ if (!is_inside_tree() || !_is_editing_in_editor()) {
break;
}
@@ -398,7 +399,11 @@ void Camera2D::set_process_callback(Camera2DProcessCallback p_mode) {
void Camera2D::set_enabled(bool p_enabled) {
enabled = p_enabled;
- if (enabled && is_inside_tree() && !viewport->get_camera_2d()) {
+ if (!is_inside_tree()) {
+ return;
+ }
+
+ if (enabled && !viewport->get_camera_2d()) {
make_current();
} else if (!enabled && is_current()) {
clear_current();
@@ -414,27 +419,27 @@ Camera2D::Camera2DProcessCallback Camera2D::get_process_callback() const {
}
void Camera2D::_make_current(Object *p_which) {
- if (!viewport || (custom_viewport && !ObjectDB::get_instance(custom_viewport_id))) {
+ if (!is_inside_tree() || !viewport) {
return;
}
+ if (custom_viewport && !ObjectDB::get_instance(custom_viewport_id)) {
+ return;
+ }
+
+ queue_redraw();
+
if (p_which == this) {
- if (is_inside_tree()) {
- viewport->_camera_2d_set(this);
- queue_redraw();
- }
+ viewport->_camera_2d_set(this);
} else {
- if (is_inside_tree()) {
- if (viewport->get_camera_2d() == this) {
- viewport->_camera_2d_set(nullptr);
- }
- queue_redraw();
+ if (viewport->get_camera_2d() == this) {
+ viewport->_camera_2d_set(nullptr);
}
}
}
void Camera2D::_update_process_internal_for_smoothing() {
- bool is_not_in_scene_or_editor = !(is_inside_tree() && Engine::get_singleton()->is_editor_hint());
+ bool is_not_in_scene_or_editor = !(is_inside_tree() && _is_editing_in_editor());
bool is_any_smoothing_valid = position_smoothing_speed > 0 || rotation_smoothing_speed > 0;
bool enable = is_any_smoothing_valid && is_not_in_scene_or_editor;
@@ -453,13 +458,22 @@ void Camera2D::make_current() {
void Camera2D::clear_current() {
ERR_FAIL_COND(!is_current());
- if (viewport && !(custom_viewport && !ObjectDB::get_instance(custom_viewport_id)) && viewport->is_inside_tree()) {
+
+ if (!viewport || !viewport->is_inside_tree()) {
+ return;
+ }
+
+ if (!custom_viewport || ObjectDB::get_instance(custom_viewport_id)) {
viewport->assign_next_enabled_camera_2d(group_name);
}
}
bool Camera2D::is_current() const {
- if (viewport && !(custom_viewport && !ObjectDB::get_instance(custom_viewport_id))) {
+ if (!viewport) {
+ return false;
+ }
+
+ if (!custom_viewport || ObjectDB::get_instance(custom_viewport_id)) {
return viewport->get_camera_2d() == this;
}
return false;
@@ -567,8 +581,7 @@ Point2 Camera2D::get_camera_screen_center() const {
}
Size2 Camera2D::_get_camera_screen_size() const {
- // special case if the camera2D is in the root viewport
- if (Engine::get_singleton()->is_editor_hint() && get_viewport()->get_parent_viewport() == get_tree()->get_root()) {
+ if (_is_editing_in_editor()) {
return Size2(GLOBAL_GET("display/window/size/viewport_width"), GLOBAL_GET("display/window/size/viewport_height"));
}
return get_viewport_rect().size;
diff --git a/scene/2d/camera_2d.h b/scene/2d/camera_2d.h
index 808529b0fb..5693d05ee5 100644
--- a/scene/2d/camera_2d.h
+++ b/scene/2d/camera_2d.h
@@ -85,6 +85,7 @@ protected:
bool drag_vertical_offset_changed = false;
Point2 camera_screen_center;
+ bool _is_editing_in_editor() const;
void _update_process_callback();
void _update_scroll();