diff options
| -rw-r--r-- | doc/classes/Callable.xml | 2 | ||||
| -rw-r--r-- | doc/classes/ProjectSettings.xml | 2 | ||||
| -rw-r--r-- | methods.py | 3 | ||||
| -rw-r--r-- | modules/csg/doc_classes/CSGMesh3D.xml | 3 | ||||
| -rw-r--r-- | modules/gdscript/gdscript_analyzer.cpp | 3 | ||||
| -rw-r--r-- | modules/gdscript/gdscript_lambda_callable.cpp | 4 | ||||
| -rw-r--r-- | modules/gdscript/gdscript_lambda_callable.h | 1 | ||||
| -rw-r--r-- | modules/gdscript/gdscript_rpc_callable.cpp | 4 | ||||
| -rw-r--r-- | modules/gdscript/gdscript_rpc_callable.h | 1 | ||||
| -rw-r--r-- | modules/gdscript/tests/scripts/analyzer/features/inner_class_access_from_inside.gd | 21 | ||||
| -rw-r--r-- | modules/gdscript/tests/scripts/analyzer/features/inner_class_access_from_inside.out | 5 | ||||
| -rw-r--r-- | modules/mono/godotsharp_dirs.cpp | 4 | ||||
| -rw-r--r-- | platform/android/export/export_plugin.cpp | 13 | ||||
| -rw-r--r-- | scene/2d/camera_2d.cpp | 77 | ||||
| -rw-r--r-- | scene/2d/camera_2d.h | 1 | ||||
| -rw-r--r-- | scene/gui/dialogs.cpp | 3 | ||||
| -rw-r--r-- | scene/gui/popup.cpp | 3 |
17 files changed, 99 insertions, 51 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]"<anonymous lambda>"[/code]. </description> </method> <method name="get_object" qualifiers="const"> diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 3eb1959a44..1be69052e4 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -298,7 +298,7 @@ [b]Note:[/b] Changing this value can help on platforms or with third-party tools where hidden directory patterns are disallowed. Only modify this setting if you know that your environment requires it, as changing the default can impact compatibility with some external tools or plugins which expect the default [code].godot[/code] folder. </member> <member name="application/config/version" type="String" setter="" getter="" default=""""> - The project's human-readable version identifier. This should always be set to a non-empty string, as some exporters rely on this value being defined. + The project's human-readable version identifier. This is used by exporters if the version identifier isn't overridden there. If [member application/config/version] is an empty string and the version identifier isn't overridden in an exporter, the exporter will use [code]1.0.0[/code] as a version identifier. </member> <member name="application/config/windows_native_icon" type="String" setter="" getter="" default=""""> Icon set in [code].ico[/code] format used on Windows to set the game's icon. This is done automatically on start by calling [method DisplayServer.set_native_icon]. 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_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index cb04913620..ad4528747b 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -3469,6 +3469,9 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod for (GDScriptParser::ClassNode *script_class : script_classes) { if (p_base == nullptr && script_class->identifier && script_class->identifier->name == name) { reduce_identifier_from_base_set_class(p_identifier, script_class->get_datatype()); + if (script_class->outer != nullptr) { + p_identifier->source = GDScriptParser::IdentifierNode::MEMBER_CLASS; + } return; } 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/gdscript/tests/scripts/analyzer/features/inner_class_access_from_inside.gd b/modules/gdscript/tests/scripts/analyzer/features/inner_class_access_from_inside.gd new file mode 100644 index 0000000000..51c589b8e0 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/inner_class_access_from_inside.gd @@ -0,0 +1,21 @@ +# GH-80508 + +class A: + func a(): + return A.new() + func b(): + return B.new() + +class B: + func a(): + return A.new() + func b(): + return B.new() + +func test(): + var a := A.new() + var b := B.new() + print(a.a() is A) + print(a.b() is B) + print(b.a() is A) + print(b.b() is B) diff --git a/modules/gdscript/tests/scripts/analyzer/features/inner_class_access_from_inside.out b/modules/gdscript/tests/scripts/analyzer/features/inner_class_access_from_inside.out new file mode 100644 index 0000000000..f9783e4362 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/inner_class_access_from_inside.out @@ -0,0 +1,5 @@ +GDTEST_OK +true +true +true +true 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(); diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 4f94f0d9f2..6e75be268d 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -38,8 +38,7 @@ // AcceptDialog void AcceptDialog::_input_from_window(const Ref<InputEvent> &p_event) { - Ref<InputEventKey> key = p_event; - if (close_on_escape && key.is_valid() && key->is_action_pressed(SNAME("ui_cancel"), false, true)) { + if (close_on_escape && p_event->is_action_pressed(SNAME("ui_cancel"), false, true)) { _cancel_pressed(); } } diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index c0a2dc81d0..6915f3d242 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -35,8 +35,7 @@ #include "scene/gui/panel.h" void Popup::_input_from_window(const Ref<InputEvent> &p_event) { - Ref<InputEventKey> key = p_event; - if (get_flag(FLAG_POPUP) && key.is_valid() && key->is_action_pressed(SNAME("ui_cancel"), false, true)) { + if (get_flag(FLAG_POPUP) && p_event->is_action_pressed(SNAME("ui_cancel"), false, true)) { _close_pressed(); } } |
