diff --git a/.coderabbit.yaml b/.coderabbit.yaml new file mode 100644 index 00000000000..1ee17fc261b --- /dev/null +++ b/.coderabbit.yaml @@ -0,0 +1,18 @@ +# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json +language: "en-US" +early_access: false +reviews: + profile: "chill" + request_changes_workflow: false + high_level_summary: true + poem: false + review_status: true + collapse_walkthrough: false + auto_apply_labels: true + auto_review: + enabled: true + drafts: false + base_branches: + - "dev" +chat: + auto_reply: true diff --git a/.envrc b/.envrc new file mode 100644 index 00000000000..3550a30f2de --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index bdf4c8d57fe..a1052a519e9 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,5 +1,5 @@ - org.redotengine.Redot + org.godotengine.Redot CC0-1.0 MIT Redot Engine Multi-platform 2D and 3D game engine with a feature-rich editor - org.redotengine.Redot.desktop + org.godotengine.Redot.desktop

Redot is forked from Godot which is an advanced, feature-packed, multi-platform 2D and 3D game diff --git a/misc/dist/macos/editor_info_plist.template b/misc/dist/macos/editor_info_plist.template index 11e0762a70c..772abf05544 100644 --- a/misc/dist/macos/editor_info_plist.template +++ b/misc/dist/macos/editor_info_plist.template @@ -13,7 +13,7 @@ CFBundleIconName RedotLG CFBundleIdentifier - org.redotengine.redot + org.godotengine.redot CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType diff --git a/misc/dist/macos_tools.app/Contents/Info.plist b/misc/dist/macos_tools.app/Contents/Info.plist index 0b22ba7c436..b91c0ccb9fc 100644 --- a/misc/dist/macos_tools.app/Contents/Info.plist +++ b/misc/dist/macos_tools.app/Contents/Info.plist @@ -13,7 +13,7 @@ CFBundleIconName RedotLG CFBundleIdentifier - org.redotengine.redot + org.godotengine.redot CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType diff --git a/misc/extension_api_validation/4.3-stable.expected b/misc/extension_api_validation/4.3-stable.expected new file mode 100644 index 00000000000..18f2fb81757 --- /dev/null +++ b/misc/extension_api_validation/4.3-stable.expected @@ -0,0 +1,111 @@ +This file contains the expected output of --validate-extension-api when run against the extension_api.json of the +4.3-stable tag (the basename of this file). + +Only lines that start with "Validate extension JSON:" matter, everything else is considered a comment and ignored. They +should instead be used to justify these changes and describe how users should work around these changes. + +Add new entries at the end of the file. + +## Changes between 4.3-stable and 4.4-stable + +GH-95374 +-------- +Validate extension JSON: Error: Field 'classes/ShapeCast2D/properties/collision_result': getter changed value in new API, from "_get_collision_result" to &"get_collision_result". +Validate extension JSON: Error: Field 'classes/ShapeCast3D/properties/collision_result': getter changed value in new API, from "_get_collision_result" to &"get_collision_result". + +These getters have been renamed to expose them. GDExtension language bindings couldn't have exposed these properties before. + + +GH-90993 +-------- +Validate extension JSON: Error: Field 'classes/RenderingDevice/methods/draw_list_begin/arguments': size changed value in new API, from 9 to 10. +Validate extension JSON: Error: Field 'classes/RenderingDevice/methods/draw_list_begin/arguments/9': type changed value in new API, from "Array" to "int". +Validate extension JSON: Error: Field 'classes/RenderingDevice/methods/draw_list_begin/arguments/9': default_value changed value in new API, from "Array[RID]([])" to "0". +Validate extension JSON: Error: Field 'classes/RenderingDevice/methods/draw_list_begin/arguments/9': type changed value in new API, from "typedarray::RID" to "int". + +draw_list_begin added a new optional debug argument called breadcrumb. +There used to be an Array argument as arg #9 initially, then changed to typedarray::RID in 4.1, and finally removed in 4.3. +Since we're adding a new one at the same location, we need to silence those warnings for 4.1 and 4.3. + + +GH-95126 +-------- +Validate extension JSON: Error: Field 'classes/Shader/methods/get_default_texture_parameter/return_value': type changed value in new API, from "Texture2D" to "Texture". +Validate extension JSON: Error: Field 'classes/Shader/methods/set_default_texture_parameter/arguments/1': type changed value in new API, from "Texture2D" to "Texture". +Validate extension JSON: Error: Field 'classes/VisualShaderNodeCubemap/methods/get_cube_map/return_value': type changed value in new API, from "Cubemap" to "TextureLayered". +Validate extension JSON: Error: Field 'classes/VisualShaderNodeCubemap/methods/set_cube_map/arguments/0': type changed value in new API, from "Cubemap" to "TextureLayered". +Validate extension JSON: Error: Field 'classes/VisualShaderNodeCubemap/properties/cube_map': type changed value in new API, from "Cubemap" to "Cubemap,CompressedCubemap,PlaceholderCubemap,TextureCubemapRD". +Validate extension JSON: Error: Field 'classes/VisualShaderNodeTexture2DArray/methods/get_texture_array/return_value': type changed value in new API, from "Texture2DArray" to "TextureLayered". +Validate extension JSON: Error: Field 'classes/VisualShaderNodeTexture2DArray/methods/set_texture_array/arguments/0': type changed value in new API, from "Texture2DArray" to "TextureLayered". +Validate extension JSON: Error: Field 'classes/VisualShaderNodeTexture2DArray/properties/texture_array': type changed value in new API, from "Texture2DArray" to "Texture2DArray,CompressedTexture2DArray,PlaceholderTexture2DArray,Texture2DArrayRD". + +Allow setting a cubemap as default parameter to shader. +Compatibility methods registered. + + +GH-93605 +-------- +Validate extension JSON: JSON file: Field was added in a way that breaks compatibility 'classes/Semaphore/methods/post': arguments + +Optional arguments added. Compatibility methods registered. + + +GH-95212 +-------- +Validate extension JSON: Error: Field 'classes/RegEx/methods/compile/arguments': size changed value in new API, from 1 to 2. +Validate extension JSON: Error: Field 'classes/RegEx/methods/create_from_string/arguments': size changed value in new API, from 1 to 2. + +Add optional argument to control error printing on compilation fail. Compatibility methods registered. + + +GH-95375 +-------- +Validate extension JSON: Error: Field 'classes/AudioStreamPlayer/properties/playing': setter changed value in new API, from "_set_playing" to &"set_playing". +Validate extension JSON: Error: Field 'classes/AudioStreamPlayer2D/properties/playing': setter changed value in new API, from "_set_playing" to &"set_playing". +Validate extension JSON: Error: Field 'classes/AudioStreamPlayer3D/properties/playing': setter changed value in new API, from "_set_playing" to &"set_playing". + +These setters have been renamed to expose them. GDExtension language bindings couldn't have exposed these properties before. + + +GH-94322 +-------- +Validate extension JSON: Error: Field 'classes/EditorInterface/methods/popup_node_selector/arguments': size changed value in new API, from 2 to 3. +Validate extension JSON: Error: Field 'classes/EditorInterface/methods/popup_property_selector/arguments': size changed value in new API, from 3 to 4. + +Added optional argument to popup_property_selector and popup_node_selector to specify the current value. + + +GH-94434 +-------- +Validate extension JSON: Error: Field 'classes/OS/methods/execute_with_pipe/arguments': size changed value in new API, from 2 to 3. + +Optional argument added. Compatibility method registered. + + +GH-94684 +-------- +Validate extension JSON: Error: Field 'classes/SoftBody3D/methods/set_point_pinned/arguments': size changed value in new API, from 3 to 4. + +Optional argument added to allow for adding pin point at specific index. Compatibility method registered. + + +GH-97281 +-------- +Validate extension JSON: Error: Field 'classes/InputMap/methods/add_action/arguments/1': default_value changed value in new API, from "0.5" to "0.2". + +Default deadzone value was changed. No adjustments should be necessary. +Compatibility method registered. + + +GH-Redot-764 +-------- +Validate extension JSON: Error: Field 'classes/ConfigFile/methods/load/arguments': size changed value in new API, from 1 to 2. +Validate extension JSON: Error: Field 'classes/ConfigFile/methods/load_encrypted/arguments': size changed value in new API, from 2 to 3. +Validate extension JSON: Error: Field 'classes/ConfigFile/methods/load_encrypted_pass/arguments': size changed value in new API, from 2 to 3. +Validate extension JSON: Error: Field 'classes/ConfigFile/methods/parse/arguments': size changed value in new API, from 1 to 2. +Validate extension JSON: Error: Field 'classes/ConfigFile/methods/save/arguments': size changed value in new API, from 1 to 2. +Validate extension JSON: Error: Field 'classes/ConfigFile/methods/save_encrypted/arguments': size changed value in new API, from 2 to 3. +Validate extension JSON: Error: Field 'classes/ConfigFile/methods/save_encrypted_pass/arguments': size changed value in new API, from 2 to 3. +Validate extension JSON: JSON file: Field was added in a way that breaks compatibility 'classes/ConfigFile/methods/encode_to_text': arguments + +Added optional argument. Compatibility method registered. Behavior compatibility broken for security and consistency with binary serialization. Object encoding/decoding is now disabled by default. Can be disabled by Project Setting. diff --git a/modules/gdscript/editor/script_templates/CharacterBody2D/jump_and_run_movement.gd b/modules/gdscript/editor/script_templates/CharacterBody2D/jump_and_run_movement.gd new file mode 100644 index 00000000000..f3aafb4407b --- /dev/null +++ b/modules/gdscript/editor/script_templates/CharacterBody2D/jump_and_run_movement.gd @@ -0,0 +1,42 @@ +extends CharacterBody2D +class_name CharacterBody2DJumpAndRun + +const WALKING_SPEED:float = 300.0 +const JUMP_VELOCITY:float = -400.0 + +var doulbe_jump:bool = false + +func _ready() -> void: + # ground and walls create different collision types see is_on_floor(). + motion_mode = CharacterBody2D.MOTION_MODE_GROUNDED + +func _physics_process(delta: float) -> void: + if not is_on_floor(): + # Add the gravity\falling if in air: + velocity += get_gravity() * delta + else: + # when landed reset the double jump + doulbe_jump = true + + # Handle (double) jump: + if Input.is_action_just_pressed("ui_accept")\ + || Input.is_action_just_pressed("ui_up"): + # first jump + if is_on_floor(): + velocity.y = JUMP_VELOCITY + # second jump + elif doulbe_jump: + doulbe_jump = false + velocity.y = JUMP_VELOCITY + # can't jump more + + # Get the input direction and handle the movement/deceleration. + # As good practice, you should replace UI actions with custom gameplay actions. + # see Project > Project Settings ... > Input Map > Show Build In Actions. + var direction := Input.get_axis("ui_left", "ui_right") + if direction: + velocity.x = direction * WALKING_SPEED + else: + velocity.x = move_toward(velocity.x, 0, WALKING_SPEED) + + move_and_slide() diff --git a/modules/gdscript/editor/script_templates/CharacterBody2D/tank_movement.gd b/modules/gdscript/editor/script_templates/CharacterBody2D/tank_movement.gd new file mode 100644 index 00000000000..7d647093cf2 --- /dev/null +++ b/modules/gdscript/editor/script_templates/CharacterBody2D/tank_movement.gd @@ -0,0 +1,31 @@ +extends CharacterBody2D +class_name CharacterBody2DTopDownTank + +const DRIVE_SPEED:float = 120.0 +const TURN_SPEED:float = 2.0 + +func _ready() -> void: + # top down mode all collisions are walls + motion_mode = CharacterBody2D.MOTION_MODE_FLOATING + +func _physics_process(delta: float) -> void: + # Get the input direction and handle the movement/deceleration. + # As good practice, you should replace UI actions with custom gameplay actions. + # see Project > Project Settings ... > Input Map > Show Build In Actions. + # arrow keys up and down move the "tank" and left and right turns it. + var movement := Input.get_axis("ui_up", "ui_down") + var turning := Input.get_axis("ui_left", "ui_right") + # if the movement keys are pressed apply the drive speed + # into the facting direction "transform.y" if your tank looks up by default + # change it to transform.x id the default facing is left. + # you can invert all of this by multiplying with -1.0 if you face in the opposide direction + if movement: + velocity = transform.y * movement * DRIVE_SPEED + else: + velocity.x = move_toward(velocity.x, 0, 10.0) + velocity.y = move_toward(velocity.y, 0, 10.0) + + if turning: + rotation += turning * TURN_SPEED * delta + + move_and_slide() diff --git a/modules/gdscript/editor/script_templates/CharacterBody2D/top_down_8dir_movement.gd b/modules/gdscript/editor/script_templates/CharacterBody2D/top_down_8dir_movement.gd new file mode 100644 index 00000000000..ba26f77030f --- /dev/null +++ b/modules/gdscript/editor/script_templates/CharacterBody2D/top_down_8dir_movement.gd @@ -0,0 +1,20 @@ +extends CharacterBody2D +class_name CharacterBody2DTopDown + +const WALK_SPEED:float = 300.0 + +func _ready() -> void: + # top down mode all collisions are walls + motion_mode = CharacterBody2D.MOTION_MODE_FLOATING + +func _physics_process(delta: float) -> void: + # Get the input direction and handle the movement/deceleration. + # As good practice, you should replace UI actions with custom gameplay actions. + var direction := Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down") + if direction: + velocity = direction * WALK_SPEED + else: + # quick stopping + velocity = Vector2(0.0, 0.0) + + move_and_slide() diff --git a/modules/gdscript/editor/script_templates/CharacterBody3D/character_body_3d_FPS.gd b/modules/gdscript/editor/script_templates/CharacterBody3D/character_body_3d_FPS.gd new file mode 100644 index 00000000000..f1f4221d194 --- /dev/null +++ b/modules/gdscript/editor/script_templates/CharacterBody3D/character_body_3d_FPS.gd @@ -0,0 +1,85 @@ +extends CharacterBody3D +class_name CharacterBody3DFps + +const WALKING_SPEED:float = 5.0 +const JUMP_VELOCITY:float = 4.5 + +# this is a first person style example please add a Camera3D +# to your CharacterBody3D to activate the mouse look +@onready var camera_3d:Camera3D = $Camera3D + +# used to set a point to rotate to +var rotation_target:Vector3 = Vector3(0.0, 0.0, 0.0) +var mouse_sensitivity:float = 700.0 +var doulbe_jump:bool = false + +# this method will be run once the scene is loaded: +func _ready() -> void: + # catches the mouse inside the window + # is used to avoid to click outside of the window + # and to measure the distance the mouse traveled per delta + if camera_3d != null: + Input.mouse_mode = Input.MOUSE_MODE_CAPTURED + +# this method runs every circle in the main loop: +func _physics_process(delta: float) -> void: + if not is_on_floor(): + # Add the gravity\falling if in air: + velocity += get_gravity() * delta + else: + # when landed reset the double jump + doulbe_jump = true + + # Handle (double) jump: + if Input.is_action_just_pressed("ui_accept"): + # first jump + if is_on_floor(): + velocity.y = JUMP_VELOCITY + # second jump + elif doulbe_jump: + doulbe_jump = false + velocity.y = JUMP_VELOCITY + # can't jump more + + + # Get the input direction and handle the movement/deceleration. + # As good practice, you should replace UI actions with custom gameplay actions. + # see Project > Project Settings ... > Input Map > Show Build In Actions. + # The function return a vector normed to length of 1.0 on basis of the four actions given. + var input_dir := Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down") + # the moevement will be multiplied by the basis to adjust to scaling of the player. + var direction := (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized() + + if direction: + # move player into the dirextion + velocity.x = direction.x * WALKING_SPEED + velocity.z = direction.z * WALKING_SPEED + else: + # deceleration stop player slowly + velocity.x = move_toward(velocity.x, 0, WALKING_SPEED) + velocity.z = move_toward(velocity.z, 0, WALKING_SPEED) + + # moves player on basis of velocity and let him bump into other objects. + move_and_slide() + + # if there is a Camera3D node under the CharacterBody3D node + # it will be used to turn the player and the camera with the mouse + if camera_3d != null: + # Rotation of the camera: + camera_3d.rotation.z = lerp_angle(camera_3d.rotation.z, -rotation_target.x * 30 * delta, delta * 5) + camera_3d.rotation.x = lerp_angle(camera_3d.rotation.x, rotation_target.x, delta * 30) + # Rotation of the player: + rotation.y = lerp_angle(rotation.y, rotation_target.y, delta * 30) + + +func _input(event: InputEvent) -> void: + # saves the rotation on the relative movement of the mouse. + # if there is no camera function will be stopped early + if camera_3d == null: + return + + if event is InputEventMouseMotion: + rotation_target.y -= event.relative.x / mouse_sensitivity + rotation_target.x -= event.relative.y / mouse_sensitivity + # limit view in up and down direction: + rotation_target.x = clamp(rotation_target.x, deg_to_rad(-90), deg_to_rad(90)) diff --git a/modules/gdscript/gdscript_vm.cpp b/modules/gdscript/gdscript_vm.cpp index 2954a3c1f76..9873e9f4007 100644 --- a/modules/gdscript/gdscript_vm.cpp +++ b/modules/gdscript/gdscript_vm.cpp @@ -653,7 +653,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a memnew_placement(&stack[ADDR_STACK_SELF], Variant); script = _script; } - memnew_placement(&stack[ADDR_STACK_CLASS], Variant(script)); + memnew_placement(&stack[ADDR_STACK_CLASS], Variant(script, true)); memnew_placement(&stack[ADDR_STACK_NIL], Variant); String err_text; diff --git a/modules/gdscript/tests/scripts/runtime/features/metatypes.gd b/modules/gdscript/tests/scripts/runtime/features/metatypes.gd index d6847768e67..1c7ac599718 100644 --- a/modules/gdscript/tests/scripts/runtime/features/metatypes.gd +++ b/modules/gdscript/tests/scripts/runtime/features/metatypes.gd @@ -11,7 +11,7 @@ var test_class := MyClass var test_enum := MyEnum func check_gdscript_native_class(value: Variant) -> void: - print(var_to_str(value).get_slice(",", 0).trim_prefix("Object(")) + print(var_to_str_with_objects(value).get_slice(",", 0).trim_prefix("Object(")) func check_gdscript(value: GDScript) -> void: print(value.get_class()) diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index a0878239ac3..a796a89a2a1 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -4065,7 +4065,7 @@ void GLTFDocument::_parse_image_save_image(Ref p_state, const Vector< if (FileAccess::exists(file_path + ".import")) { Ref config; config.instantiate(); - config->load(file_path + ".import"); + config->load(file_path + ".import", true); if (config->has_section_key("remap", "generator_parameters")) { generator_parameters = (Dictionary)config->get_value("remap", "generator_parameters"); } diff --git a/modules/godot_physics_2d/godot_collision_solver_2d_sat.cpp b/modules/godot_physics_2d/godot_collision_solver_2d_sat.cpp index dadf3df3f0a..9ee7c6bcfe1 100644 --- a/modules/godot_physics_2d/godot_collision_solver_2d_sat.cpp +++ b/modules/godot_physics_2d/godot_collision_solver_2d_sat.cpp @@ -479,11 +479,15 @@ static void _collision_segment_rectangle(const GodotShape2D *p_a, const Transfor return; } - if (!separator.test_axis(p_transform_b.columns[0].normalized())) { + const Vector2 rect_fn = p_transform_b.columns[0].normalized(); + + if (!separator.test_axis(rect_fn)) { return; } - if (!separator.test_axis(p_transform_b.columns[1].normalized())) { + const Vector2 nd_rect_fn = Vector2(-rect_fn[1], rect_fn[0]); + + if (!separator.test_axis(nd_rect_fn)) { return; } @@ -652,11 +656,14 @@ static void _collision_circle_rectangle(const GodotShape2D *p_a, const Transform const Vector2 *axis = &p_transform_b.columns[0]; //const Vector2& half_extents = rectangle_B->get_half_extents(); - if (!separator.test_axis(axis[0].normalized())) { + const Vector2 rect_fn = axis[0].normalized(); + if (!separator.test_axis(rect_fn)) { return; } - if (!separator.test_axis(axis[1].normalized())) { + const Vector2 nd_rect_fn = Vector2(-rect_fn[1], rect_fn[0]); + + if (!separator.test_axis(nd_rect_fn)) { return; } @@ -770,21 +777,31 @@ static void _collision_rectangle_rectangle(const GodotShape2D *p_a, const Transf return; } + //It's the same normal for both axis tests, + //but the second one is just inverted and has the x as inverse. + const Vector2 rect_fn = p_transform_a.columns[0].normalized(); + //box faces A - if (!separator.test_axis(p_transform_a.columns[0].normalized())) { + if (!separator.test_axis(rect_fn)) { return; } - if (!separator.test_axis(p_transform_a.columns[1].normalized())) { + const Vector2 nd_rect_fn = Vector2(-rect_fn[1], rect_fn[0]); + + if (!separator.test_axis(nd_rect_fn)) { return; } + const Vector2 rect_fn2 = p_transform_b.columns[0].normalized(); + //box faces B - if (!separator.test_axis(p_transform_b.columns[0].normalized())) { + if (!separator.test_axis(rect_fn2)) { return; } - if (!separator.test_axis(p_transform_b.columns[1].normalized())) { + const Vector2 nd_rect_fn2 = Vector2(-rect_fn2[1], rect_fn2[0]); + + if (!separator.test_axis(nd_rect_fn2)) { return; } @@ -844,12 +861,18 @@ static void _collision_rectangle_capsule(const GodotShape2D *p_a, const Transfor return; } + //It's the same normal for both axis tests, + //but the second one is just inverted and has the x as inverse. + const Vector2 rect_fn = p_transform_a.columns[0].normalized(); + //box faces - if (!separator.test_axis(p_transform_a.columns[0].normalized())) { + if (!separator.test_axis(rect_fn)) { return; } - if (!separator.test_axis(p_transform_a.columns[1].normalized())) { + const Vector2 nd_rect_fn = Vector2(-rect_fn[1], rect_fn[0]); + + if (!separator.test_axis(nd_rect_fn)) { return; } @@ -922,12 +945,18 @@ static void _collision_rectangle_convex_polygon(const GodotShape2D *p_a, const T return; } + //It's the same normal for both axis tests, + //but the second one is just inverted and has the x as inverse. + const Vector2 rect_fn = p_transform_a.columns[0].normalized(); + //box faces - if (!separator.test_axis(p_transform_a.columns[0].normalized())) { + if (!separator.test_axis(rect_fn)) { return; } - if (!separator.test_axis(p_transform_a.columns[1].normalized())) { + const Vector2 nd_rect_fn = Vector2(-rect_fn[1], rect_fn[0]); + + if (!separator.test_axis(nd_rect_fn)) { return; } diff --git a/modules/godot_physics_3d/godot_physics_server_3d.cpp b/modules/godot_physics_3d/godot_physics_server_3d.cpp index 51c143b6e37..0f00acb4ef7 100644 --- a/modules/godot_physics_3d/godot_physics_server_3d.cpp +++ b/modules/godot_physics_3d/godot_physics_server_3d.cpp @@ -349,8 +349,9 @@ ObjectID GodotPhysicsServer3D::area_get_object_instance_id(RID p_area) const { } void GodotPhysicsServer3D::area_set_param(RID p_area, AreaParameter p_param, const Variant &p_value) { - if (space_owner.owns(p_area)) { - GodotSpace3D *space = space_owner.get_or_null(p_area); + // caching prevents multiple lookups. + GodotSpace3D *space = space_owner.get_or_null(p_area); + if (space) { p_area = space->get_default_area()->get_self(); } GodotArea3D *area = area_owner.get_or_null(p_area); diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs index b6073c5cfc9..dfd8bd066f5 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs @@ -605,7 +605,8 @@ public static void Seed(ulong seed) ///

/// Converts a formatted string that was returned by - /// to the original value. + /// to the equivalent value, without decoding objects. + /// Note: If you need object deserialization, see . /// /// /// @@ -619,7 +620,23 @@ public static void Seed(ulong seed) public static Variant StrToVar(string str) { using var godotStr = Marshaling.ConvertStringToNative(str); - NativeFuncs.godotsharp_str_to_var(godotStr, out godot_variant ret); + NativeFuncs.godotsharp_str_to_var(godotStr, godot_bool.False, out godot_variant ret); + return Variant.CreateTakingOwnershipOfDisposableValue(ret); + } + + /// + /// Converts a formatted string that was returned by + /// to the equivalent value. Decoding objects is allowed. + /// Warning: Deserialized object can contain code which gets executed. Do not use this + /// option if the serialized object comes from untrusted sources to avoid potential security + /// threats (remote code execution). + /// + /// String that will be converted to Variant. + /// The decoded Variant. + public static Variant StrToVarWithObjects(string str) + { + using var godotStr = Marshaling.ConvertStringToNative(str); + NativeFuncs.godotsharp_str_to_var(godotStr, godot_bool.True, out godot_variant ret); return Variant.CreateTakingOwnershipOfDisposableValue(ret); } @@ -652,7 +669,8 @@ public static byte[] VarToBytesWithObjects(Variant var) /// /// Converts a to a formatted string that - /// can later be parsed using . + /// can later be parsed using , without encoding objects. + /// Note: If you need object serialization, see . /// /// /// @@ -669,7 +687,21 @@ public static byte[] VarToBytesWithObjects(Variant var) /// The encoded as a string. public static string VarToStr(Variant var) { - NativeFuncs.godotsharp_var_to_str((godot_variant)var.NativeVar, out godot_string ret); + NativeFuncs.godotsharp_var_to_str((godot_variant)var.NativeVar, godot_bool.False, out godot_string ret); + using (ret) + return Marshaling.ConvertStringToManaged(ret); + } + + /// + /// Converts a to a formatted string that + /// can later be parsed using . + /// Encoding objects is allowed (and can potentially include executable code). + /// + /// Variant that will be converted to string. + /// The encoded as a string. + public static string VarToStrWithObjects(Variant var) + { + NativeFuncs.godotsharp_var_to_str((godot_variant)var.NativeVar, godot_bool.True, out godot_string ret); using (ret) return Marshaling.ConvertStringToManaged(ret); } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs index 25b343c8ef9..c8c63f2f817 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs @@ -545,6 +545,9 @@ public static partial void godotsharp_node_path_get_subname(scoped in godot_node public static partial int godotsharp_node_path_get_subname_count(in godot_node_path p_self); + public static partial void godotsharp_node_path_slice(scoped in godot_node_path p_self, int p_begin, int p_end, + out godot_node_path r_result); + public static partial godot_bool godotsharp_node_path_is_absolute(in godot_node_path p_self); public static partial godot_bool godotsharp_node_path_equals(in godot_node_path p_self, in godot_node_path p_other); @@ -594,12 +597,12 @@ internal static partial void godotsharp_convert(scoped in godot_variant p_what, internal static partial void godotsharp_weakref(IntPtr p_obj, out godot_ref r_weak_ref); - internal static partial void godotsharp_str_to_var(scoped in godot_string p_str, out godot_variant r_ret); + internal static partial void godotsharp_str_to_var(scoped in godot_string p_str, godot_bool p_allow_objects, out godot_variant r_ret); internal static partial void godotsharp_var_to_bytes(scoped in godot_variant p_what, godot_bool p_full_objects, out godot_packed_byte_array r_bytes); - internal static partial void godotsharp_var_to_str(scoped in godot_variant p_var, out godot_string r_ret); + internal static partial void godotsharp_var_to_str(scoped in godot_variant p_var, godot_bool p_full_objects, out godot_string r_ret); internal static partial void godotsharp_err_print_error(in godot_string p_function, in godot_string p_file, int p_line, in godot_string p_error, in godot_string p_message = default, godot_bool p_editor_notify = godot_bool.False, godot_error_handler_type p_type = godot_error_handler_type.ERR_HANDLER_ERROR); diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NodePath.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NodePath.cs index 0af640533d0..08f1380ccc1 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NodePath.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NodePath.cs @@ -274,6 +274,31 @@ public int GetSubNameCount() return NativeFuncs.godotsharp_node_path_get_subname_count(self); } + /// + /// Returns the slice of the NodePath, from begin (inclusive) to end (exclusive), as a + /// new NodePath.
+ /// The absolute value of begin and end will be clamped to the sum of + /// GetNameCount and + /// GetSubNameCount, so the default value for end makes it + /// slice to the end of the NodePath by default (i.e. path.Slice(1) is a shorthand for + /// path.Slice(1, path.GetNameCount() + path.GetSubNameCount())).
+ /// If either begin or end are negative, they will be relative to the end of the NodePath + /// (i.e. path.Slice(0, -2) is shorthand for + /// path.Slice(0, path.GetNameCount() + path.GetSubNameCount() - 2)). + ///
+ /// The index of the name or subname at which to start the slice. + /// The index (exclusive) of the name or subname at which to end the slice. + /// A slice of the NodePath bounded by begin and end. + public NodePath Slice(int begin, int end = Int32.MaxValue) + { + var self = (godot_node_path)NativeValue; + + NativeFuncs.godotsharp_node_path_slice(self, begin, end, out godot_node_path slicedNodePath); + + using (slicedNodePath) + return new NodePath(slicedNodePath); + } + /// /// Returns if the node path is absolute (as opposed to relative), /// which means that it starts with a slash character (/). Absolute node paths can diff --git a/modules/mono/glue/runtime_interop.cpp b/modules/mono/glue/runtime_interop.cpp index 6b7513df6df..d2821b9af03 100644 --- a/modules/mono/glue/runtime_interop.cpp +++ b/modules/mono/glue/runtime_interop.cpp @@ -1385,6 +1385,10 @@ int32_t godotsharp_node_path_get_subname_count(const NodePath *p_self) { return p_self->get_subname_count(); } +void godotsharp_node_path_slice(const NodePath *p_self, int32_t p_begin, int32_t p_end, NodePath *r_result) { + memnew_placement(r_result, NodePath(p_self->slice(p_begin, p_end))); +} + bool godotsharp_node_path_is_absolute(const NodePath *p_self) { return p_self->is_absolute(); } @@ -1489,21 +1493,21 @@ void godotsharp_err_print_error(const godot_string *p_function, const godot_stri p_editor_notify, p_type); } -void godotsharp_var_to_str(const godot_variant *p_var, godot_string *r_ret) { +void godotsharp_var_to_str(const godot_variant *p_var, bool p_full_objects, godot_string *r_ret) { const Variant &var = *reinterpret_cast(p_var); String &vars = *memnew_placement(r_ret, String); - VariantWriter::write_to_string(var, vars); + VariantWriter::write_to_string(var, vars, nullptr, nullptr, /*p_compat*/ false, p_full_objects); } -void godotsharp_str_to_var(const godot_string *p_str, godot_variant *r_ret) { +void godotsharp_str_to_var(const godot_string *p_str, bool p_allow_objects, godot_variant *r_ret) { Variant ret; VariantParser::StreamString ss; ss.s = *reinterpret_cast(p_str); String errs; - int line; - Error err = VariantParser::parse(&ss, ret, errs, line); + int line = 1; + Error err = VariantParser::parse(&ss, ret, errs, line, nullptr, p_allow_objects); if (err != OK) { String err_str = "Parse error at line " + itos(line) + ": " + errs + "."; ERR_PRINT(err_str); @@ -1771,6 +1775,7 @@ static const void *unmanaged_callbacks[]{ (void *)godotsharp_node_path_get_name_count, (void *)godotsharp_node_path_get_subname, (void *)godotsharp_node_path_get_subname_count, + (void *)godotsharp_node_path_slice, (void *)godotsharp_node_path_is_absolute, (void *)godotsharp_node_path_equals, (void *)godotsharp_node_path_hash, diff --git a/modules/text_server_adv/gdextension_build/SConstruct b/modules/text_server_adv/gdextension_build/SConstruct index 24725d80daa..915ca0e4620 100644 --- a/modules/text_server_adv/gdextension_build/SConstruct +++ b/modules/text_server_adv/gdextension_build/SConstruct @@ -749,7 +749,7 @@ if env["platform"] == "macos": methods.write_macos_plist( f"./bin/libtextserver_advanced.macos.{env['target']}.framework", f"libtextserver_advanced.macos.{env['target']}", - "org.redotengine.textserver_advanced", + "org.godotengine.textserver_advanced", "ICU / HarfBuzz / Graphite Text Server", ) library = env.SharedLibrary( diff --git a/modules/text_server_fb/gdextension_build/SConstruct b/modules/text_server_fb/gdextension_build/SConstruct index 3f1e5603ddb..5a0adef7c5a 100644 --- a/modules/text_server_fb/gdextension_build/SConstruct +++ b/modules/text_server_fb/gdextension_build/SConstruct @@ -293,7 +293,7 @@ if env["platform"] == "macos": methods.write_macos_plist( f"./bin/libtextserver_fallback.macos.{env['target']}.framework", f"libtextserver_fallback.macos.{env['target']}", - "org.redotengine.textserver_fallback", + "org.godotengine.textserver_fallback", "Fallback Text Server", ) library = env.SharedLibrary( diff --git a/platform/android/api/api.cpp b/platform/android/api/api.cpp index eec2ae7630a..686f6140b91 100644 --- a/platform/android/api/api.cpp +++ b/platform/android/api/api.cpp @@ -44,7 +44,7 @@ static JavaClassWrapper *java_class_wrapper = nullptr; void register_android_api() { #if !defined(ANDROID_ENABLED) // On Android platforms, the `java_class_wrapper` instantiation occurs in - // `platform/android/java_godot_lib_jni.cpp#Java_org_redotengine_godot_GodotLib_setup` + // `platform/android/java_godot_lib_jni.cpp#Java_org_godotengine_godot_GodotLib_setup` java_class_wrapper = memnew(JavaClassWrapper); #endif GDREGISTER_CLASS(JNISingleton); diff --git a/platform/android/dialog_utils_jni.cpp b/platform/android/dialog_utils_jni.cpp index 0ea4b57aaef..b6e0e218184 100644 --- a/platform/android/dialog_utils_jni.cpp +++ b/platform/android/dialog_utils_jni.cpp @@ -37,14 +37,14 @@ extern "C" { -JNIEXPORT void JNICALL Java_org_redotengine_godot_utils_DialogUtils_dialogCallback(JNIEnv *env, jclass clazz, jint p_button_index) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_DialogUtils_dialogCallback(JNIEnv *env, jclass clazz, jint p_button_index) { DisplayServerAndroid *ds = (DisplayServerAndroid *)DisplayServer::get_singleton(); if (ds) { ds->emit_dialog_callback(p_button_index); } } -JNIEXPORT void JNICALL Java_org_redotengine_godot_utils_DialogUtils_inputDialogCallback(JNIEnv *env, jclass clazz, jstring p_text) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_DialogUtils_inputDialogCallback(JNIEnv *env, jclass clazz, jstring p_text) { DisplayServerAndroid *ds = (DisplayServerAndroid *)DisplayServer::get_singleton(); if (ds) { String text = jstring_to_string(p_text, env); diff --git a/platform/android/dialog_utils_jni.h b/platform/android/dialog_utils_jni.h index 056c9b68423..c38c4895180 100644 --- a/platform/android/dialog_utils_jni.h +++ b/platform/android/dialog_utils_jni.h @@ -35,6 +35,6 @@ #include extern "C" { -JNIEXPORT void JNICALL Java_org_redotengine_godot_utils_DialogUtils_dialogCallback(JNIEnv *env, jclass clazz, jint p_button_index); -JNIEXPORT void JNICALL Java_org_redotengine_godot_utils_DialogUtils_inputDialogCallback(JNIEnv *env, jclass clazz, jstring p_text); +JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_DialogUtils_dialogCallback(JNIEnv *env, jclass clazz, jint p_button_index); +JNIEXPORT void JNICALL Java_org_godotengine_godot_utils_DialogUtils_inputDialogCallback(JNIEnv *env, jclass clazz, jstring p_text); } diff --git a/platform/android/editor/editor_utils_jni.cpp b/platform/android/editor/editor_utils_jni.cpp index 07e3fa047cf..ab729033d84 100644 --- a/platform/android/editor/editor_utils_jni.cpp +++ b/platform/android/editor/editor_utils_jni.cpp @@ -42,7 +42,7 @@ #endif extern "C" { -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_EditorUtils_runScene(JNIEnv *p_env, jclass, jstring p_scene, jobjectArray p_scene_args) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_EditorUtils_runScene(JNIEnv *p_env, jclass, jstring p_scene, jobjectArray p_scene_args) { #ifdef TOOLS_ENABLED Vector scene_args; jint length = p_env->GetArrayLength(p_scene_args); diff --git a/platform/android/editor/editor_utils_jni.h b/platform/android/editor/editor_utils_jni.h index ed3998a0799..a3d5cf453c5 100644 --- a/platform/android/editor/editor_utils_jni.h +++ b/platform/android/editor/editor_utils_jni.h @@ -35,5 +35,5 @@ #include extern "C" { -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_EditorUtils_runScene(JNIEnv *p_env, jclass, jstring p_scene, jobjectArray p_scene_args); +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_EditorUtils_runScene(JNIEnv *p_env, jclass, jstring p_scene, jobjectArray p_scene_args); } diff --git a/platform/android/editor/game_menu_utils_jni.cpp b/platform/android/editor/game_menu_utils_jni.cpp index ec346a79646..941af337ae9 100644 --- a/platform/android/editor/game_menu_utils_jni.cpp +++ b/platform/android/editor/game_menu_utils_jni.cpp @@ -47,7 +47,7 @@ static GameViewPlugin *_get_game_view_plugin() { extern "C" { -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_setSuspend(JNIEnv *env, jclass clazz, jboolean enabled) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_GameMenuUtils_setSuspend(JNIEnv *env, jclass clazz, jboolean enabled) { #ifdef TOOLS_ENABLED GameViewPlugin *game_view_plugin = _get_game_view_plugin(); if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) { @@ -56,7 +56,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_set #endif } -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_nextFrame(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_GameMenuUtils_nextFrame(JNIEnv *env, jclass clazz) { #ifdef TOOLS_ENABLED GameViewPlugin *game_view_plugin = _get_game_view_plugin(); if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) { @@ -65,7 +65,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_nex #endif } -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_setNodeType(JNIEnv *env, jclass clazz, jint type) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_GameMenuUtils_setNodeType(JNIEnv *env, jclass clazz, jint type) { #ifdef TOOLS_ENABLED GameViewPlugin *game_view_plugin = _get_game_view_plugin(); if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) { @@ -74,7 +74,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_set #endif } -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_setSelectMode(JNIEnv *env, jclass clazz, jint mode) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_GameMenuUtils_setSelectMode(JNIEnv *env, jclass clazz, jint mode) { #ifdef TOOLS_ENABLED GameViewPlugin *game_view_plugin = _get_game_view_plugin(); if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) { @@ -83,7 +83,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_set #endif } -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_setSelectionVisible(JNIEnv *env, jclass clazz, jboolean visible) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_GameMenuUtils_setSelectionVisible(JNIEnv *env, jclass clazz, jboolean visible) { #ifdef TOOLS_ENABLED GameViewPlugin *game_view_plugin = _get_game_view_plugin(); if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) { @@ -92,7 +92,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_set #endif } -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_setCameraOverride(JNIEnv *env, jclass clazz, jboolean enabled) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_GameMenuUtils_setCameraOverride(JNIEnv *env, jclass clazz, jboolean enabled) { #ifdef TOOLS_ENABLED GameViewPlugin *game_view_plugin = _get_game_view_plugin(); if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) { @@ -101,7 +101,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_set #endif } -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_setCameraManipulateMode(JNIEnv *env, jclass clazz, jint mode) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_GameMenuUtils_setCameraManipulateMode(JNIEnv *env, jclass clazz, jint mode) { #ifdef TOOLS_ENABLED GameViewPlugin *game_view_plugin = _get_game_view_plugin(); if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) { @@ -110,7 +110,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_set #endif } -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_resetCamera2DPosition(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_GameMenuUtils_resetCamera2DPosition(JNIEnv *env, jclass clazz) { #ifdef TOOLS_ENABLED GameViewPlugin *game_view_plugin = _get_game_view_plugin(); if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) { @@ -119,7 +119,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_res #endif } -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_resetCamera3DPosition(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_GameMenuUtils_resetCamera3DPosition(JNIEnv *env, jclass clazz) { #ifdef TOOLS_ENABLED GameViewPlugin *game_view_plugin = _get_game_view_plugin(); if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) { @@ -128,7 +128,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_res #endif } -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_playMainScene(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_GameMenuUtils_playMainScene(JNIEnv *env, jclass clazz) { #ifdef TOOLS_ENABLED if (EditorInterface::get_singleton()) { EditorInterface::get_singleton()->play_main_scene(); @@ -136,7 +136,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_pla #endif } -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_setDebugMuteAudio(JNIEnv *env, jclass clazz, jboolean enabled) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_GameMenuUtils_setDebugMuteAudio(JNIEnv *env, jclass clazz, jboolean enabled) { #ifdef TOOLS_ENABLED GameViewPlugin *game_view_plugin = _get_game_view_plugin(); if (game_view_plugin != nullptr && game_view_plugin->get_debugger().is_valid()) { diff --git a/platform/android/editor/game_menu_utils_jni.h b/platform/android/editor/game_menu_utils_jni.h index c94211c8add..b6f0f6b47cd 100644 --- a/platform/android/editor/game_menu_utils_jni.h +++ b/platform/android/editor/game_menu_utils_jni.h @@ -35,15 +35,15 @@ #include extern "C" { -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_setSuspend(JNIEnv *env, jclass clazz, jboolean enabled); -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_nextFrame(JNIEnv *env, jclass clazz); -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_setNodeType(JNIEnv *env, jclass clazz, jint type); -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_setSelectMode(JNIEnv *env, jclass clazz, jint mode); -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_setSelectionVisible(JNIEnv *env, jclass clazz, jboolean visible); -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_setCameraOverride(JNIEnv *env, jclass clazz, jboolean enabled); -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_setCameraManipulateMode(JNIEnv *env, jclass clazz, jint mode); -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_resetCamera2DPosition(JNIEnv *env, jclass clazz); -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_resetCamera3DPosition(JNIEnv *env, jclass clazz); -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_playMainScene(JNIEnv *env, jclass clazz); -JNIEXPORT void JNICALL Java_org_redotengine_godot_editor_utils_GameMenuUtils_setDebugMuteAudio(JNIEnv *env, jclass clazz, jboolean enabled); +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_GameMenuUtils_setSuspend(JNIEnv *env, jclass clazz, jboolean enabled); +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_GameMenuUtils_nextFrame(JNIEnv *env, jclass clazz); +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_GameMenuUtils_setNodeType(JNIEnv *env, jclass clazz, jint type); +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_GameMenuUtils_setSelectMode(JNIEnv *env, jclass clazz, jint mode); +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_GameMenuUtils_setSelectionVisible(JNIEnv *env, jclass clazz, jboolean visible); +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_GameMenuUtils_setCameraOverride(JNIEnv *env, jclass clazz, jboolean enabled); +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_GameMenuUtils_setCameraManipulateMode(JNIEnv *env, jclass clazz, jint mode); +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_GameMenuUtils_resetCamera2DPosition(JNIEnv *env, jclass clazz); +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_GameMenuUtils_resetCamera3DPosition(JNIEnv *env, jclass clazz); +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_GameMenuUtils_playMainScene(JNIEnv *env, jclass clazz); +JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_GameMenuUtils_setDebugMuteAudio(JNIEnv *env, jclass clazz, jboolean enabled); } diff --git a/platform/android/java/app/src/com/godot/game/GodotApp.java b/platform/android/java/app/src/com/godot/game/GodotApp.java index 9bd5e7ef9bf..1e4627bea0c 100644 --- a/platform/android/java/app/src/com/godot/game/GodotApp.java +++ b/platform/android/java/app/src/com/godot/game/GodotApp.java @@ -32,14 +32,16 @@ package com.godot.game; +import org.godotengine.godot.Godot; +import org.godotengine.godot.GodotActivity; + import android.os.Bundle; import android.util.Log; import androidx.activity.EdgeToEdge; import androidx.core.splashscreen.SplashScreen; -import org.redotengine.godot.Godot; -import org.redotengine.godot.GodotActivity; +import com.godot.game.BuildConfig; /** * Template activity for Godot Android builds. diff --git a/platform/android/java/editor/build.gradle b/platform/android/java/editor/build.gradle index f33b47b3cf3..528bd09e97e 100644 --- a/platform/android/java/editor/build.gradle +++ b/platform/android/java/editor/build.gradle @@ -74,11 +74,11 @@ android { buildToolsVersion versions.buildTools ndkVersion versions.ndkVersion - namespace = "org.redotengine.editor" + namespace = "org.godotengine.editor" defaultConfig { // The 'applicationId' suffix allows to install Redot 3.x(v3) and 4.x(v4) on the same device - applicationId "org.redotengine.editor.v4" + applicationId "org.godotengine.editor.v4" versionCode generateVersionCode() versionName generateVersionName() minSdkVersion versions.minSdk diff --git a/platform/android/java/editor/src/android/java/org/godotengine/editor/GodotEditor.kt b/platform/android/java/editor/src/android/java/org/godotengine/editor/GodotEditor.kt index bb2e815ba8a..1e4f5d1aa2a 100644 --- a/platform/android/java/editor/src/android/java/org/godotengine/editor/GodotEditor.kt +++ b/platform/android/java/editor/src/android/java/org/godotengine/editor/GodotEditor.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.editor +package org.godotengine.editor /** * Primary window of the Godot Editor. diff --git a/platform/android/java/editor/src/horizonos/java/org/godotengine/editor/GodotEditor.kt b/platform/android/java/editor/src/horizonos/java/org/godotengine/editor/GodotEditor.kt index 1085a31ea30..8e219d7d1ff 100644 --- a/platform/android/java/editor/src/horizonos/java/org/godotengine/editor/GodotEditor.kt +++ b/platform/android/java/editor/src/horizonos/java/org/godotengine/editor/GodotEditor.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.editor +package org.godotengine.editor /** * Primary window of the Godot Editor. diff --git a/platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotEditor.kt b/platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotEditor.kt index a7511e22ff1..1de886efe88 100644 --- a/platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotEditor.kt +++ b/platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotEditor.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.editor +package org.godotengine.editor import android.Manifest import android.app.ActivityManager @@ -55,26 +55,26 @@ import androidx.core.content.edit import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen import androidx.core.view.isVisible import androidx.window.layout.WindowMetricsCalculator -import org.redotengine.editor.embed.EmbeddedGodotGame -import org.redotengine.editor.embed.GameMenuFragment -import org.redotengine.editor.utils.signApk -import org.redotengine.editor.utils.verifyApk -import org.redotengine.godot.BuildConfig -import org.redotengine.godot.GodotActivity -import org.redotengine.godot.GodotLib -import org.redotengine.godot.editor.utils.EditorUtils -import org.redotengine.godot.editor.utils.GameMenuUtils -import org.redotengine.godot.editor.utils.GameMenuUtils.GameEmbedMode -import org.redotengine.godot.editor.utils.GameMenuUtils.fetchGameEmbedMode -import org.redotengine.godot.error.Error -import org.redotengine.godot.utils.DialogUtils -import org.redotengine.godot.utils.PermissionsUtil -import org.redotengine.godot.utils.ProcessPhoenix -import org.redotengine.godot.utils.isNativeXRDevice -import org.redotengine.godot.xr.HybridMode -import org.redotengine.godot.xr.getHybridAppLaunchMode -import org.redotengine.godot.xr.HYBRID_APP_PANEL_CATEGORY -import org.redotengine.godot.xr.HYBRID_APP_IMMERSIVE_CATEGORY +import org.godotengine.editor.embed.EmbeddedGodotGame +import org.godotengine.editor.embed.GameMenuFragment +import org.godotengine.editor.utils.signApk +import org.godotengine.editor.utils.verifyApk +import org.godotengine.godot.BuildConfig +import org.godotengine.godot.GodotActivity +import org.godotengine.godot.GodotLib +import org.godotengine.godot.editor.utils.EditorUtils +import org.godotengine.godot.editor.utils.GameMenuUtils +import org.godotengine.godot.editor.utils.GameMenuUtils.GameEmbedMode +import org.godotengine.godot.editor.utils.GameMenuUtils.fetchGameEmbedMode +import org.godotengine.godot.error.Error +import org.godotengine.godot.utils.DialogUtils +import org.godotengine.godot.utils.PermissionsUtil +import org.godotengine.godot.utils.ProcessPhoenix +import org.godotengine.godot.utils.isNativeXRDevice +import org.godotengine.godot.xr.HybridMode +import org.godotengine.godot.xr.getHybridAppLaunchMode +import org.godotengine.godot.xr.HYBRID_APP_PANEL_CATEGORY +import org.godotengine.godot.xr.HYBRID_APP_IMMERSIVE_CATEGORY import kotlin.math.min /** diff --git a/platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotGame.kt b/platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotGame.kt index 506e986b8e4..696ffe8be80 100644 --- a/platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotGame.kt +++ b/platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotGame.kt @@ -30,18 +30,18 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.editor +package org.godotengine.editor import android.Manifest import android.util.Log import androidx.annotation.CallSuper -import org.redotengine.godot.Godot -import org.redotengine.godot.GodotLib -import org.redotengine.godot.editor.utils.GameMenuUtils -import org.redotengine.godot.utils.PermissionsUtil -import org.redotengine.godot.utils.ProcessPhoenix -import org.redotengine.godot.xr.HYBRID_APP_FEATURE -import org.redotengine.godot.xr.isHybridAppEnabled +import org.godotengine.godot.Godot +import org.godotengine.godot.GodotLib +import org.godotengine.godot.editor.utils.GameMenuUtils +import org.godotengine.godot.utils.PermissionsUtil +import org.godotengine.godot.utils.ProcessPhoenix +import org.godotengine.godot.xr.HYBRID_APP_FEATURE +import org.godotengine.godot.xr.isHybridAppEnabled /** * Base class for the Godot play windows. diff --git a/platform/android/java/editor/src/main/java/org/godotengine/editor/EditorMessageDispatcher.kt b/platform/android/java/editor/src/main/java/org/godotengine/editor/EditorMessageDispatcher.kt index 19f0bf686b2..52fe4fee121 100644 --- a/platform/android/java/editor/src/main/java/org/godotengine/editor/EditorMessageDispatcher.kt +++ b/platform/android/java/editor/src/main/java/org/godotengine/editor/EditorMessageDispatcher.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.editor +package org.godotengine.editor import android.annotation.SuppressLint import android.content.Intent diff --git a/platform/android/java/editor/src/main/java/org/godotengine/editor/EditorWindowInfo.kt b/platform/android/java/editor/src/main/java/org/godotengine/editor/EditorWindowInfo.kt index 5ff93d6b9ae..0c2f9aeef31 100644 --- a/platform/android/java/editor/src/main/java/org/godotengine/editor/EditorWindowInfo.kt +++ b/platform/android/java/editor/src/main/java/org/godotengine/editor/EditorWindowInfo.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.editor +package org.godotengine.editor /** * Specifies the policy for launches. diff --git a/platform/android/java/editor/src/main/java/org/godotengine/editor/GodotGame.kt b/platform/android/java/editor/src/main/java/org/godotengine/editor/GodotGame.kt index 46e1077c9bf..e2524aba57b 100644 --- a/platform/android/java/editor/src/main/java/org/godotengine/editor/GodotGame.kt +++ b/platform/android/java/editor/src/main/java/org/godotengine/editor/GodotGame.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.editor +package org.godotengine.editor import android.app.PictureInPictureParams import android.content.pm.PackageManager @@ -41,15 +41,15 @@ import android.util.Log import android.view.View import androidx.annotation.CallSuper import androidx.core.view.isVisible -import org.redotengine.editor.embed.GameMenuFragment -import org.redotengine.godot.GodotLib -import org.redotengine.godot.editor.utils.GameMenuUtils -import org.redotengine.godot.utils.ProcessPhoenix -import org.redotengine.godot.utils.isHorizonOSDevice -import org.redotengine.godot.utils.isNativeXRDevice -import org.redotengine.godot.xr.HYBRID_APP_PANEL_FEATURE -import org.redotengine.godot.xr.XRMode -import org.redotengine.godot.xr.isHybridAppEnabled +import org.godotengine.editor.embed.GameMenuFragment +import org.godotengine.godot.GodotLib +import org.godotengine.godot.editor.utils.GameMenuUtils +import org.godotengine.godot.utils.ProcessPhoenix +import org.godotengine.godot.utils.isHorizonOSDevice +import org.godotengine.godot.utils.isNativeXRDevice +import org.godotengine.godot.xr.HYBRID_APP_PANEL_FEATURE +import org.godotengine.godot.xr.XRMode +import org.godotengine.godot.xr.isHybridAppEnabled /** * Drives the 'run project' window of the Godot Editor. diff --git a/platform/android/java/editor/src/main/java/org/godotengine/editor/GodotXRGame.kt b/platform/android/java/editor/src/main/java/org/godotengine/editor/GodotXRGame.kt index 52d978e145f..442c94b2f39 100644 --- a/platform/android/java/editor/src/main/java/org/godotengine/editor/GodotXRGame.kt +++ b/platform/android/java/editor/src/main/java/org/godotengine/editor/GodotXRGame.kt @@ -30,10 +30,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.editor +package org.godotengine.editor -import org.redotengine.godot.GodotLib -import org.redotengine.godot.xr.XRMode +import org.godotengine.godot.GodotLib +import org.godotengine.godot.xr.XRMode /** * Provide support for running XR apps / games from the editor window. diff --git a/platform/android/java/editor/src/main/java/org/godotengine/editor/embed/EmbeddedGodotGame.kt b/platform/android/java/editor/src/main/java/org/godotengine/editor/embed/EmbeddedGodotGame.kt index f8ab56414c8..74601d93552 100644 --- a/platform/android/java/editor/src/main/java/org/godotengine/editor/embed/EmbeddedGodotGame.kt +++ b/platform/android/java/editor/src/main/java/org/godotengine/editor/embed/EmbeddedGodotGame.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.editor.embed +package org.godotengine.editor.embed import android.content.pm.ActivityInfo import android.os.Bundle @@ -40,9 +40,9 @@ import android.view.WindowManager import android.view.WindowManager.LayoutParams.FLAG_DIM_BEHIND import android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL import android.view.WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH -import org.redotengine.editor.GodotGame -import org.redotengine.editor.R -import org.redotengine.godot.editor.utils.GameMenuUtils +import org.godotengine.editor.GodotGame +import org.godotengine.editor.R +import org.godotengine.godot.utils.GameMenuUtils /** * Host the Godot game from the editor when the embedded mode is enabled. diff --git a/platform/android/java/editor/src/main/java/org/godotengine/editor/embed/GameMenuFragment.kt b/platform/android/java/editor/src/main/java/org/godotengine/editor/embed/GameMenuFragment.kt index ce810c09da2..0ba3b7c3847 100644 --- a/platform/android/java/editor/src/main/java/org/godotengine/editor/embed/GameMenuFragment.kt +++ b/platform/android/java/editor/src/main/java/org/godotengine/editor/embed/GameMenuFragment.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.editor.embed +package org.godotengine.editor.embed import android.content.Context import android.os.Build @@ -45,10 +45,10 @@ import android.widget.RadioButton import androidx.core.content.edit import androidx.core.view.isVisible import androidx.fragment.app.Fragment -import org.redotengine.editor.BaseGodotEditor -import org.redotengine.editor.BaseGodotEditor.Companion.SNACKBAR_SHOW_DURATION_MS -import org.redotengine.editor.R -import org.redotengine.godot.utils.DialogUtils +import org.godotengine.editor.BaseGodotEditor +import org.godotengine.editor.BaseGodotEditor.Companion.SNACKBAR_SHOW_DURATION_MS +import org.godotengine.editor.R +import org.godotengine.godot.utils.DialogUtils /** * Implements the game menu interface for the Android editor. diff --git a/platform/android/java/editor/src/main/java/org/godotengine/editor/utils/ApkSignerUtil.kt b/platform/android/java/editor/src/main/java/org/godotengine/editor/utils/ApkSignerUtil.kt index 88551763147..8c11f256bce 100644 --- a/platform/android/java/editor/src/main/java/org/godotengine/editor/utils/ApkSignerUtil.kt +++ b/platform/android/java/editor/src/main/java/org/godotengine/editor/utils/ApkSignerUtil.kt @@ -32,14 +32,14 @@ @file:JvmName("ApkSignerUtil") -package org.redotengine.editor.utils +package org.godotengine.editor.utils import android.util.Log import com.android.apksig.ApkSigner import com.android.apksig.ApkVerifier import org.bouncycastle.jce.provider.BouncyCastleProvider -import org.redotengine.godot.error.Error -import org.redotengine.godot.io.file.FileAccessHandler +import org.godotengine.godot.error.Error +import org.godotengine.godot.io.file.FileAccessHandler import java.io.File import java.security.KeyStore import java.security.PrivateKey diff --git a/platform/android/java/editor/src/picoos/java/org/godotengine/editor/GodotEditor.kt b/platform/android/java/editor/src/picoos/java/org/godotengine/editor/GodotEditor.kt index f622e6c5e3f..0c3e4e06e30 100644 --- a/platform/android/java/editor/src/picoos/java/org/godotengine/editor/GodotEditor.kt +++ b/platform/android/java/editor/src/picoos/java/org/godotengine/editor/GodotEditor.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.editor +package org.godotengine.editor /** * Primary window of the Godot Editor. diff --git a/platform/android/java/lib/AndroidManifest.xml b/platform/android/java/lib/AndroidManifest.xml index bb24e6249e2..8240843876b 100644 --- a/platform/android/java/lib/AndroidManifest.xml +++ b/platform/android/java/lib/AndroidManifest.xml @@ -7,7 +7,7 @@ diff --git a/platform/android/java/lib/build.gradle b/platform/android/java/lib/build.gradle index 73934e98932..472a9296086 100644 --- a/platform/android/java/lib/build.gradle +++ b/platform/android/java/lib/build.gradle @@ -31,7 +31,7 @@ android { manifestPlaceholders = [godotLibraryVersion: getGodotLibraryVersionName()] } - namespace = "org.redotengine.godot" + namespace = "org.godotengine.godot" compileOptions { sourceCompatibility versions.javaVersion diff --git a/platform/android/java/lib/patches/com.google.android.vending.expansion.downloader.patch b/platform/android/java/lib/patches/com.google.android.vending.expansion.downloader.patch index 16c2f50b568..49cc41e817f 100644 --- a/platform/android/java/lib/patches/com.google.android.vending.expansion.downloader.patch +++ b/platform/android/java/lib/patches/com.google.android.vending.expansion.downloader.patch @@ -175,7 +175,7 @@ index e4b1b0f1c..36cd6aacf 100644 -import com.android.vending.expansion.downloader.R; +// -- GODOT start -- +//import com.android.vending.expansion.downloader.R; -+import org.redotengine.godot.R; ++import org.godotengine.godot.R; +// -- GODOT end -- import java.io.File; @@ -250,7 +250,7 @@ index f1536e80e..4b214b22d 100644 -import com.android.vending.expansion.downloader.R; +// -- GODOT start -- +//import com.android.vending.expansion.downloader.R; -+import org.redotengine.godot.R; ++import org.godotengine.godot.R; +// -- GODOT end -- + import com.google.android.vending.expansion.downloader.DownloadProgressInfo; diff --git a/platform/android/java/lib/patches/com.google.android.vending.licensing.patch b/platform/android/java/lib/patches/com.google.android.vending.licensing.patch index bd000670a67..4adb81d9519 100644 --- a/platform/android/java/lib/patches/com.google.android.vending.licensing.patch +++ b/platform/android/java/lib/patches/com.google.android.vending.licensing.patch @@ -21,7 +21,7 @@ index a0d2779af..a8bf65f9c 100644 */ +// -- GODOT start -- -import org.redotengine.godot.BuildConfig; +import org.godotengine.godot.BuildConfig; +// -- GODOT end -- + /** diff --git a/platform/android/java/lib/src/com/google/android/vending/expansion/downloader/Helpers.java b/platform/android/java/lib/src/com/google/android/vending/expansion/downloader/Helpers.java index 6abdf5220c2..9ceac341587 100644 --- a/platform/android/java/lib/src/com/google/android/vending/expansion/downloader/Helpers.java +++ b/platform/android/java/lib/src/com/google/android/vending/expansion/downloader/Helpers.java @@ -26,7 +26,7 @@ // -- GODOT start -- //import com.android.vending.expansion.downloader.R; -import org.redotengine.godot.R; +import org.godotengine.godot.R; // -- GODOT end -- import java.io.File; diff --git a/platform/android/java/lib/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java b/platform/android/java/lib/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java index 7f75eb1aa2a..d481c222042 100644 --- a/platform/android/java/lib/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java +++ b/platform/android/java/lib/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java @@ -18,7 +18,7 @@ // -- GODOT start -- //import com.android.vending.expansion.downloader.R; -import org.redotengine.godot.R; +import org.godotengine.godot.R; // -- GODOT end -- import com.google.android.vending.expansion.downloader.DownloadProgressInfo; diff --git a/platform/android/java/lib/src/com/google/android/vending/licensing/util/Base64.java b/platform/android/java/lib/src/com/google/android/vending/licensing/util/Base64.java index 2e349b5ef8d..79efca9621d 100644 --- a/platform/android/java/lib/src/com/google/android/vending/licensing/util/Base64.java +++ b/platform/android/java/lib/src/com/google/android/vending/licensing/util/Base64.java @@ -32,7 +32,7 @@ */ // -- GODOT start -- -import org.redotengine.godot.BuildConfig; +import org.godotengine.godot.BuildConfig; // -- GODOT end -- /** diff --git a/platform/android/java/lib/src/org/godotengine/godot/Dictionary.java b/platform/android/java/lib/src/org/godotengine/godot/Dictionary.java index 2fbf92e44ea..78e39eec410 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/Dictionary.java +++ b/platform/android/java/lib/src/org/godotengine/godot/Dictionary.java @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot; +package org.godotengine.godot; import java.util.HashMap; import java.util.Set; diff --git a/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java b/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java index 6df884e99b9..6c6bb129b92 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java +++ b/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot; +package org.godotengine.godot; /** * Base abstract activity for Android apps intending to use Godot as the primary screen. diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.kt b/platform/android/java/lib/src/org/godotengine/godot/Godot.kt index fe5364decad..fb44d83fdeb 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/Godot.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot +package org.godotengine.godot import android.annotation.SuppressLint import android.app.Activity @@ -58,26 +58,26 @@ import androidx.core.view.WindowInsetsAnimationCompat import androidx.core.view.WindowInsetsCompat import androidx.core.view.WindowInsetsControllerCompat import com.google.android.vending.expansion.downloader.* -import org.redotengine.godot.error.Error -import org.redotengine.godot.input.GodotEditText -import org.redotengine.godot.input.GodotInputHandler -import org.redotengine.godot.io.FilePicker -import org.redotengine.godot.io.directory.DirectoryAccessHandler -import org.redotengine.godot.io.file.FileAccessHandler -import org.redotengine.godot.plugin.AndroidRuntimePlugin -import org.redotengine.godot.plugin.GodotPlugin -import org.redotengine.godot.plugin.GodotPluginRegistry -import org.redotengine.godot.tts.GodotTTS -import org.redotengine.godot.utils.DialogUtils -import org.redotengine.godot.utils.GodotNetUtils -import org.redotengine.godot.utils.PermissionsUtil -import org.redotengine.godot.utils.PermissionsUtil.requestPermission -import org.redotengine.godot.utils.beginBenchmarkMeasure -import org.redotengine.godot.utils.benchmarkFile -import org.redotengine.godot.utils.dumpBenchmark -import org.redotengine.godot.utils.endBenchmarkMeasure -import org.redotengine.godot.utils.useBenchmark -import org.redotengine.godot.xr.XRMode +import org.godotengine.godot.error.Error +import org.godotengine.godot.input.GodotEditText +import org.godotengine.godot.input.GodotInputHandler +import org.godotengine.godot.io.FilePicker +import org.godotengine.godot.io.directory.DirectoryAccessHandler +import org.godotengine.godot.io.file.FileAccessHandler +import org.godotengine.godot.plugin.AndroidRuntimePlugin +import org.godotengine.godot.plugin.GodotPlugin +import org.godotengine.godot.plugin.GodotPluginRegistry +import org.godotengine.godot.tts.GodotTTS +import org.godotengine.godot.utils.DialogUtils +import org.godotengine.godot.utils.GodotNetUtils +import org.godotengine.godot.utils.PermissionsUtil +import org.godotengine.godot.utils.PermissionsUtil.requestPermission +import org.godotengine.godot.utils.beginBenchmarkMeasure +import org.godotengine.godot.utils.benchmarkFile +import org.godotengine.godot.utils.dumpBenchmark +import org.godotengine.godot.utils.endBenchmarkMeasure +import org.godotengine.godot.utils.useBenchmark +import org.godotengine.godot.xr.XRMode import java.io.File import java.io.FileInputStream import java.io.InputStream diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotActivity.kt b/platform/android/java/lib/src/org/godotengine/godot/GodotActivity.kt index 35f59025614..24f8cf9d6db 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotActivity.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotActivity.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot +package org.godotengine.godot import android.app.Activity import android.content.ComponentName @@ -41,9 +41,9 @@ import android.util.Log import androidx.annotation.CallSuper import androidx.annotation.LayoutRes import androidx.fragment.app.FragmentActivity -import org.redotengine.godot.utils.CommandLineFileParser -import org.redotengine.godot.utils.PermissionsUtil -import org.redotengine.godot.utils.ProcessPhoenix +import org.godotengine.godot.utils.CommandLineFileParser +import org.godotengine.godot.utils.PermissionsUtil +import org.godotengine.godot.utils.ProcessPhoenix /** * Base abstract activity for Android apps intending to use Godot as the primary screen. diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java b/platform/android/java/lib/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java index 748fb517499..bd2c8e0dced 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot; +package org.godotengine.godot; import android.content.BroadcastReceiver; import android.content.Context; diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotDownloaderService.java b/platform/android/java/lib/src/org/godotengine/godot/GodotDownloaderService.java index 357c758de1b..b8612532b75 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotDownloaderService.java +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotDownloaderService.java @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot; +package org.godotengine.godot; import android.content.Context; import android.content.SharedPreferences; diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotFragment.java b/platform/android/java/lib/src/org/godotengine/godot/GodotFragment.java index 30d26643413..8897053baa3 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotFragment.java +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotFragment.java @@ -30,7 +30,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot; +package org.godotengine.godot; + +import org.godotengine.godot.error.Error; +import org.godotengine.godot.plugin.GodotPlugin; +import org.godotengine.godot.utils.BenchmarkUtils; import android.app.Activity; import android.app.PendingIntent; @@ -69,10 +73,6 @@ import java.util.Locale; import java.util.Set; -import org.redotengine.godot.error.Error; -import org.redotengine.godot.plugin.GodotPlugin; -import org.redotengine.godot.utils.BenchmarkUtils; - /** * Base fragment for Android apps intending to use Godot for part of the app's UI. */ diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotGLRenderView.java b/platform/android/java/lib/src/org/godotengine/godot/GodotGLRenderView.java index 78149708b1b..ec6170a40fc 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotGLRenderView.java +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotGLRenderView.java @@ -30,7 +30,18 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot; +package org.godotengine.godot; + +import org.godotengine.godot.gl.GLSurfaceView; +import org.godotengine.godot.gl.GodotRenderer; +import org.godotengine.godot.input.GodotInputHandler; +import org.godotengine.godot.xr.XRMode; +import org.godotengine.godot.xr.ovr.OvrConfigChooser; +import org.godotengine.godot.xr.ovr.OvrContextFactory; +import org.godotengine.godot.xr.ovr.OvrWindowSurfaceFactory; +import org.godotengine.godot.xr.regular.RegularConfigChooser; +import org.godotengine.godot.xr.regular.RegularContextFactory; +import org.godotengine.godot.xr.regular.RegularFallbackConfigChooser; import android.annotation.SuppressLint; import android.content.res.AssetManager; @@ -48,17 +59,6 @@ import java.io.InputStream; -import org.redotengine.godot.gl.GLSurfaceView; -import org.redotengine.godot.gl.GodotRenderer; -import org.redotengine.godot.input.GodotInputHandler; -import org.redotengine.godot.xr.XRMode; -import org.redotengine.godot.xr.ovr.OvrConfigChooser; -import org.redotengine.godot.xr.ovr.OvrContextFactory; -import org.redotengine.godot.xr.ovr.OvrWindowSurfaceFactory; -import org.redotengine.godot.xr.regular.RegularConfigChooser; -import org.redotengine.godot.xr.regular.RegularContextFactory; -import org.redotengine.godot.xr.regular.RegularFallbackConfigChooser; - /** * A simple GLSurfaceView sub-class that demonstrate how to perform * OpenGL ES 2.0 rendering into a GL Surface. Note the following important diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotHost.java b/platform/android/java/lib/src/org/godotengine/godot/GodotHost.java index d17ce8b6144..4053a9e89ce 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotHost.java +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotHost.java @@ -30,7 +30,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot; +package org.godotengine.godot; + +import org.godotengine.godot.error.Error; +import org.godotengine.godot.plugin.GodotPlugin; import android.app.Activity; @@ -41,9 +44,6 @@ import java.util.List; import java.util.Set; -import org.redotengine.godot.error.Error; -import org.redotengine.godot.plugin.GodotPlugin; - /** * Denotate a component (e.g: Activity, Fragment) that hosts the {@link Godot} engine. */ diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java b/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java index 72b22579628..b375aa49ef7 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java @@ -30,7 +30,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot; +package org.godotengine.godot; + +import org.godotengine.godot.error.Error; +import org.godotengine.godot.input.GodotEditText; import android.app.Activity; import android.content.Context; @@ -59,9 +62,6 @@ import java.util.List; import java.util.Locale; -import org.redotengine.godot.error.Error; -import org.redotengine.godot.input.GodotEditText; - // Wrapper for native library public class GodotIO { diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java b/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java index 2ceb8672028..0987fe24a6b 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java @@ -30,7 +30,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot; +package org.godotengine.godot; + +import org.godotengine.godot.gl.GodotRenderer; +import org.godotengine.godot.io.directory.DirectoryAccessHandler; +import org.godotengine.godot.io.file.FileAccessHandler; +import org.godotengine.godot.tts.GodotTTS; +import org.godotengine.godot.utils.GodotNetUtils; +import org.godotengine.godot.variant.Callable; import android.app.Activity; import android.content.res.AssetManager; @@ -39,13 +46,6 @@ import javax.microedition.khronos.opengles.GL10; -import org.redotengine.godot.gl.GodotRenderer; -import org.redotengine.godot.io.directory.DirectoryAccessHandler; -import org.redotengine.godot.io.file.FileAccessHandler; -import org.redotengine.godot.tts.GodotTTS; -import org.redotengine.godot.utils.GodotNetUtils; -import org.redotengine.godot.variant.Callable; - /** * Wrapper for native library */ @@ -83,7 +83,7 @@ public static native boolean initialize( * @param p_surface * @param p_width * @param p_height - * @see org.redotengine.godot.gl.GLSurfaceView.Renderer#onSurfaceChanged(GL10, int, int) + * @see org.godotengine.godot.gl.GLSurfaceView.Renderer#onSurfaceChanged(GL10, int, int) */ public static native void resize(Surface p_surface, int p_width, int p_height); @@ -100,7 +100,7 @@ public static native boolean initialize( /** * Invoked on the GL thread to draw the current frame. - * @see org.redotengine.godot.gl.GLSurfaceView.Renderer#onDrawFrame(GL10) + * @see org.godotengine.godot.gl.GLSurfaceView.Renderer#onDrawFrame(GL10) */ public static native boolean step(); diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotRenderView.java b/platform/android/java/lib/src/org/godotengine/godot/GodotRenderView.java index 201ffb2fc89..f97efa48cfc 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotRenderView.java +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotRenderView.java @@ -30,12 +30,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot; +package org.godotengine.godot; -import android.view.SurfaceView; +import org.godotengine.godot.input.GodotInputHandler; +import org.godotengine.godot.utils.DeviceUtils; -import org.redotengine.godot.input.GodotInputHandler; -import org.redotengine.godot.utils.DeviceUtils; +import android.view.SurfaceView; public interface GodotRenderView { SurfaceView getView(); diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotVulkanRenderView.java b/platform/android/java/lib/src/org/godotengine/godot/GodotVulkanRenderView.java index 732c054791b..0fe2c7d5c6d 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotVulkanRenderView.java +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotVulkanRenderView.java @@ -30,7 +30,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot; +package org.godotengine.godot; + +import org.godotengine.godot.input.GodotInputHandler; +import org.godotengine.godot.vulkan.VkRenderer; +import org.godotengine.godot.vulkan.VkSurfaceView; import android.annotation.SuppressLint; import android.content.res.AssetManager; @@ -48,10 +52,6 @@ import java.io.InputStream; -import org.redotengine.godot.input.GodotInputHandler; -import org.redotengine.godot.vulkan.VkRenderer; -import org.redotengine.godot.vulkan.VkSurfaceView; - class GodotVulkanRenderView extends VkSurfaceView implements GodotRenderView { private final Godot godot; private final GodotInputHandler mInputHandler; diff --git a/platform/android/java/lib/src/org/godotengine/godot/editor/utils/EditorUtils.kt b/platform/android/java/lib/src/org/godotengine/godot/editor/utils/EditorUtils.kt index a118c7f5b82..509fdcd30e3 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/editor/utils/EditorUtils.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/editor/utils/EditorUtils.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.editor.utils +package org.godotengine.godot.editor.utils /** * Utility class for accessing and using editor specific capabilities. diff --git a/platform/android/java/lib/src/org/godotengine/godot/editor/utils/GameMenuUtils.kt b/platform/android/java/lib/src/org/godotengine/godot/editor/utils/GameMenuUtils.kt index 70cb7372e61..3f696ae78c4 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/editor/utils/GameMenuUtils.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/editor/utils/GameMenuUtils.kt @@ -30,10 +30,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.editor.utils +package org.godotengine.godot.editor.utils import android.util.Log -import org.redotengine.godot.GodotLib +import org.godotengine.godot.GodotLib /** * Utility class for accessing and using game menu APIs. diff --git a/platform/android/java/lib/src/org/godotengine/godot/error/Error.kt b/platform/android/java/lib/src/org/godotengine/godot/error/Error.kt index a0f65954cda..f6777263133 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/error/Error.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/error/Error.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.error +package org.godotengine.godot.error /** * Godot error list. diff --git a/platform/android/java/lib/src/org/godotengine/godot/gl/EGLLogWrapper.java b/platform/android/java/lib/src/org/godotengine/godot/gl/EGLLogWrapper.java index b82b72bdc8c..af16cfce744 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/gl/EGLLogWrapper.java +++ b/platform/android/java/lib/src/org/godotengine/godot/gl/EGLLogWrapper.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.redotengine.godot.gl; +package org.godotengine.godot.gl; import android.opengl.GLDebugHelper; import android.opengl.GLException; diff --git a/platform/android/java/lib/src/org/godotengine/godot/gl/GLSurfaceView.java b/platform/android/java/lib/src/org/godotengine/godot/gl/GLSurfaceView.java index 9001ff6fec4..6a4e9da699e 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/gl/GLSurfaceView.java +++ b/platform/android/java/lib/src/org/godotengine/godot/gl/GLSurfaceView.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.redotengine.godot.gl; +package org.godotengine.godot.gl; import android.content.Context; import android.opengl.EGL14; diff --git a/platform/android/java/lib/src/org/godotengine/godot/gl/GodotRenderer.java b/platform/android/java/lib/src/org/godotengine/godot/gl/GodotRenderer.java index a696c3596ff..b40ffa026fa 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/gl/GodotRenderer.java +++ b/platform/android/java/lib/src/org/godotengine/godot/gl/GodotRenderer.java @@ -30,17 +30,17 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.gl; +package org.godotengine.godot.gl; + +import org.godotengine.godot.GodotLib; +import org.godotengine.godot.plugin.GodotPlugin; +import org.godotengine.godot.plugin.GodotPluginRegistry; import android.util.Log; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.opengles.GL10; -import org.redotengine.godot.GodotLib; -import org.redotengine.godot.plugin.GodotPlugin; -import org.redotengine.godot.plugin.GodotPluginRegistry; - /** * Godot's GL renderer implementation. */ diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/GodotEditText.java b/platform/android/java/lib/src/org/godotengine/godot/input/GodotEditText.java index 10f03a47e0e..9224d58911d 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/input/GodotEditText.java +++ b/platform/android/java/lib/src/org/godotengine/godot/input/GodotEditText.java @@ -30,7 +30,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.input; +package org.godotengine.godot.input; + +import org.godotengine.godot.*; import android.content.Context; import android.content.res.Configuration; @@ -50,8 +52,6 @@ import java.lang.ref.WeakReference; import java.util.Locale; -import org.redotengine.godot.*; - public class GodotEditText extends EditText { // =========================================================== // Constants diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.kt b/platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.kt index 061a3435199..6a207936d77 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/input/GodotGestureHandler.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.input +package org.godotengine.godot.input import android.os.Build import android.view.GestureDetector.SimpleOnGestureListener @@ -38,7 +38,7 @@ import android.view.InputDevice import android.view.MotionEvent import android.view.ScaleGestureDetector import android.view.ScaleGestureDetector.OnScaleGestureListener -import org.redotengine.godot.GodotLib +import org.godotengine.godot.GodotLib /** * Handles regular and scale gesture input related events for the [GodotView] view. diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java b/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java index b012c274d38..74efe9e2866 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java +++ b/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java @@ -30,9 +30,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.input; +package org.godotengine.godot.input; -import static org.redotengine.godot.utils.GLUtils.DEBUG; +import static org.godotengine.godot.utils.GLUtils.DEBUG; + +import org.godotengine.godot.Godot; +import org.godotengine.godot.GodotLib; +import org.godotengine.godot.GodotRenderView; import android.content.Context; import android.content.res.Configuration; @@ -59,10 +63,6 @@ import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; -import org.redotengine.godot.Godot; -import org.redotengine.godot.GodotLib; -import org.redotengine.godot.GodotRenderView; - /** * Handles input related events for the {@link GodotRenderView} view. */ diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/GodotTextInputWrapper.java b/platform/android/java/lib/src/org/godotengine/godot/input/GodotTextInputWrapper.java index 16fa4542506..48dbf37eaaf 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/input/GodotTextInputWrapper.java +++ b/platform/android/java/lib/src/org/godotengine/godot/input/GodotTextInputWrapper.java @@ -30,7 +30,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.input; +package org.godotengine.godot.input; + +import org.godotengine.godot.*; import android.content.Context; import android.text.Editable; @@ -41,8 +43,6 @@ import android.widget.TextView; import android.widget.TextView.OnEditorActionListener; -import org.redotengine.godot.*; - public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListener { // =========================================================== // Constants diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/InputEventRunnable.java b/platform/android/java/lib/src/org/godotengine/godot/input/InputEventRunnable.java index d178f3ea87b..a67cdd4b645 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/input/InputEventRunnable.java +++ b/platform/android/java/lib/src/org/godotengine/godot/input/InputEventRunnable.java @@ -30,7 +30,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.input; +package org.godotengine.godot.input; + +import org.godotengine.godot.GodotLib; import android.hardware.Sensor; import android.util.Log; @@ -43,8 +45,6 @@ import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.atomic.AtomicInteger; -import org.redotengine.godot.GodotLib; - /** * Used to dispatch input events. * diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/Joystick.java b/platform/android/java/lib/src/org/godotengine/godot/input/Joystick.java index 528c6d55eb3..891aae035d0 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/input/Joystick.java +++ b/platform/android/java/lib/src/org/godotengine/godot/input/Joystick.java @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.input; +package org.godotengine.godot.input; import android.util.SparseArray; diff --git a/platform/android/java/lib/src/org/godotengine/godot/io/FilePicker.kt b/platform/android/java/lib/src/org/godotengine/godot/io/FilePicker.kt index 2d3c7b174a3..18ba0d7bec9 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/io/FilePicker.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/io/FilePicker.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.io +package org.godotengine.godot.io import android.app.Activity import android.content.Context @@ -41,8 +41,8 @@ import android.provider.DocumentsContract import android.util.Log import android.webkit.MimeTypeMap import androidx.annotation.RequiresApi -import org.redotengine.godot.GodotLib -import org.redotengine.godot.io.file.MediaStoreData +import org.godotengine.godot.GodotLib +import org.godotengine.godot.io.file.MediaStoreData /** * Utility class for managing file selection and file picker activities. diff --git a/platform/android/java/lib/src/org/godotengine/godot/io/StorageScope.kt b/platform/android/java/lib/src/org/godotengine/godot/io/StorageScope.kt index ea01b27982c..b5a60b0c162 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/io/StorageScope.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/io/StorageScope.kt @@ -30,13 +30,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.io +package org.godotengine.godot.io import android.content.Context import android.os.Build import android.os.Environment import java.io.File -import org.redotengine.godot.GodotLib +import org.godotengine.godot.GodotLib /** * Represents the different storage scopes. diff --git a/platform/android/java/lib/src/org/godotengine/godot/io/directory/AssetsDirectoryAccess.kt b/platform/android/java/lib/src/org/godotengine/godot/io/directory/AssetsDirectoryAccess.kt index 2caf2226b11..1b353429512 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/io/directory/AssetsDirectoryAccess.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/io/directory/AssetsDirectoryAccess.kt @@ -30,15 +30,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.io.directory +package org.godotengine.godot.io.directory import android.content.Context import android.util.Log import android.util.SparseArray -import org.redotengine.godot.io.StorageScope -import org.redotengine.godot.io.directory.DirectoryAccessHandler.Companion.INVALID_DIR_ID -import org.redotengine.godot.io.directory.DirectoryAccessHandler.Companion.STARTING_DIR_ID -import org.redotengine.godot.io.file.AssetData +import org.godotengine.godot.io.StorageScope +import org.godotengine.godot.io.directory.DirectoryAccessHandler.Companion.INVALID_DIR_ID +import org.godotengine.godot.io.directory.DirectoryAccessHandler.Companion.STARTING_DIR_ID +import org.godotengine.godot.io.file.AssetData import java.io.File import java.io.IOException diff --git a/platform/android/java/lib/src/org/godotengine/godot/io/directory/DirectoryAccessHandler.kt b/platform/android/java/lib/src/org/godotengine/godot/io/directory/DirectoryAccessHandler.kt index 0ab654da0b2..82c55e71dfb 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/io/directory/DirectoryAccessHandler.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/io/directory/DirectoryAccessHandler.kt @@ -30,13 +30,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.io.directory +package org.godotengine.godot.io.directory import android.content.Context import android.util.Log -import org.redotengine.godot.Godot -import org.redotengine.godot.io.StorageScope -import org.redotengine.godot.io.directory.DirectoryAccessHandler.AccessType.ACCESS_RESOURCES +import org.godotengine.godot.Godot +import org.godotengine.godot.io.StorageScope +import org.godotengine.godot.io.directory.DirectoryAccessHandler.AccessType.ACCESS_RESOURCES import java.util.concurrent.locks.ReentrantLock import kotlin.concurrent.withLock diff --git a/platform/android/java/lib/src/org/godotengine/godot/io/directory/FilesystemDirectoryAccess.kt b/platform/android/java/lib/src/org/godotengine/godot/io/directory/FilesystemDirectoryAccess.kt index 2a208602243..a880283a448 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/io/directory/FilesystemDirectoryAccess.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/io/directory/FilesystemDirectoryAccess.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.io.directory +package org.godotengine.godot.io.directory import android.annotation.SuppressLint import android.content.Context @@ -38,10 +38,10 @@ import android.os.Build import android.os.storage.StorageManager import android.util.Log import android.util.SparseArray -import org.redotengine.godot.io.StorageScope -import org.redotengine.godot.io.directory.DirectoryAccessHandler.Companion.INVALID_DIR_ID -import org.redotengine.godot.io.directory.DirectoryAccessHandler.Companion.STARTING_DIR_ID -import org.redotengine.godot.io.file.FileAccessHandler +import org.godotengine.godot.io.StorageScope +import org.godotengine.godot.io.directory.DirectoryAccessHandler.Companion.INVALID_DIR_ID +import org.godotengine.godot.io.directory.DirectoryAccessHandler.Companion.STARTING_DIR_ID +import org.godotengine.godot.io.file.FileAccessHandler import java.io.File /** diff --git a/platform/android/java/lib/src/org/godotengine/godot/io/file/AssetData.kt b/platform/android/java/lib/src/org/godotengine/godot/io/file/AssetData.kt index 67a141c9ff6..ead23242a6b 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/io/file/AssetData.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/io/file/AssetData.kt @@ -30,13 +30,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.io.file +package org.godotengine.godot.io.file import android.content.Context import android.content.res.AssetManager import android.util.Log -import org.redotengine.godot.error.Error -import org.redotengine.godot.io.directory.AssetsDirectoryAccess +import org.godotengine.godot.error.Error +import org.godotengine.godot.io.directory.AssetsDirectoryAccess import java.io.IOException import java.io.InputStream import java.lang.UnsupportedOperationException diff --git a/platform/android/java/lib/src/org/godotengine/godot/io/file/DataAccess.kt b/platform/android/java/lib/src/org/godotengine/godot/io/file/DataAccess.kt index 04d087bd919..65ead6a053b 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/io/file/DataAccess.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/io/file/DataAccess.kt @@ -30,13 +30,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.io.file +package org.godotengine.godot.io.file import android.content.Context import android.os.Build import android.util.Log -import org.redotengine.godot.error.Error -import org.redotengine.godot.io.StorageScope +import org.godotengine.godot.error.Error +import org.godotengine.godot.io.StorageScope import java.io.FileNotFoundException import java.io.IOException import java.io.InputStream diff --git a/platform/android/java/lib/src/org/godotengine/godot/io/file/FileAccessFlags.kt b/platform/android/java/lib/src/org/godotengine/godot/io/file/FileAccessFlags.kt index ba0a23c65e4..69bed828beb 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/io/file/FileAccessFlags.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/io/file/FileAccessFlags.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.io.file +package org.godotengine.godot.io.file /** * Android representation of Godot native access flags. diff --git a/platform/android/java/lib/src/org/godotengine/godot/io/file/FileAccessHandler.kt b/platform/android/java/lib/src/org/godotengine/godot/io/file/FileAccessHandler.kt index 53aa7982d45..9d3c8f1e684 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/io/file/FileAccessHandler.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/io/file/FileAccessHandler.kt @@ -30,13 +30,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.io.file +package org.godotengine.godot.io.file import android.content.Context import android.util.Log import android.util.SparseArray -import org.redotengine.godot.error.Error -import org.redotengine.godot.io.StorageScope +import org.godotengine.godot.error.Error +import org.godotengine.godot.io.StorageScope import java.io.FileNotFoundException import java.io.InputStream import java.lang.UnsupportedOperationException diff --git a/platform/android/java/lib/src/org/godotengine/godot/io/file/FileData.kt b/platform/android/java/lib/src/org/godotengine/godot/io/file/FileData.kt index 06981d6f2ec..eea1a905e3e 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/io/file/FileData.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/io/file/FileData.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.io.file +package org.godotengine.godot.io.file import android.os.* import java.io.File diff --git a/platform/android/java/lib/src/org/godotengine/godot/io/file/MediaStoreData.kt b/platform/android/java/lib/src/org/godotengine/godot/io/file/MediaStoreData.kt index c2602a70e72..1948a8a3207 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/io/file/MediaStoreData.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/io/file/MediaStoreData.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.io.file +package org.godotengine.godot.io.file import android.content.ContentUris import android.content.ContentValues diff --git a/platform/android/java/lib/src/org/godotengine/godot/plugin/AndroidRuntimePlugin.kt b/platform/android/java/lib/src/org/godotengine/godot/plugin/AndroidRuntimePlugin.kt index 131caaf4413..687f0d0659c 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/plugin/AndroidRuntimePlugin.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/plugin/AndroidRuntimePlugin.kt @@ -30,10 +30,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.plugin +package org.godotengine.godot.plugin -import org.redotengine.godot.Godot -import org.redotengine.godot.variant.Callable +import org.godotengine.godot.Godot +import org.godotengine.godot.variant.Callable /** * Built-in Godot Android plugin used to provide access to the Android runtime capabilities. diff --git a/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java b/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java index c55abdf9367..b4dc97ecfb4 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java +++ b/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java @@ -30,7 +30,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.plugin; +package org.godotengine.godot.plugin; + +import org.godotengine.godot.BuildConfig; +import org.godotengine.godot.Godot; import android.app.Activity; import android.content.Context; @@ -54,9 +57,6 @@ import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.opengles.GL10; -import org.redotengine.godot.BuildConfig; -import org.redotengine.godot.Godot; - /** * Base class for Godot Android plugins. *

@@ -65,7 +65,7 @@ * - The plugin must have a dependency on the Godot Android library: `implementation "org.godotengine:godot:"` *

* - The plugin must include a tag in its Android manifest with the following format: - * + * *

* Where: *

@@ -175,7 +175,7 @@ public final void onRegisterPluginWithGodotNative() { /** * Invoked once during the initialization process after creation of the - * {@link org.redotengine.godot.GodotRenderView} view. + * {@link org.godotengine.godot.GodotRenderView} view. *

* The plugin can return a non-null {@link View} layout which will be added to the Godot view * hierarchy. diff --git a/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPluginRegistry.java b/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPluginRegistry.java index 8b9194f1a5e..35edb92ed66 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPluginRegistry.java +++ b/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPluginRegistry.java @@ -30,7 +30,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.plugin; +package org.godotengine.godot.plugin; + +import org.godotengine.godot.Godot; import android.content.Context; import android.content.pm.ApplicationInfo; @@ -47,8 +49,6 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import org.redotengine.godot.Godot; - /** * Registry used to load and access the registered Godot Android plugins. */ @@ -67,11 +67,11 @@ public final class GodotPluginRegistry { * Prefix used for version 1 of the Godot plugin, mostly compatible with Godot 3.x * Although there isn't any REDOT prior version 4.2, someone may refit old-styled plugins. */ - private static final String REDOT_PLUGIN_V1_NAME_PREFIX = "org.redotengine.plugin.v1."; + private static final String REDOT_PLUGIN_V1_NAME_PREFIX = "org.godotengine.plugin.v1."; /** * Prefix used for version 2 of the Redot plugin, compatible with Redot 4.2+ */ - private static final String REDOT_PLUGIN_V2_NAME_PREFIX = "org.redotengine.plugin.v2."; + private static final String REDOT_PLUGIN_V2_NAME_PREFIX = "org.godotengine.plugin.v2."; private static GodotPluginRegistry instance; private final ConcurrentHashMap registry; diff --git a/platform/android/java/lib/src/org/godotengine/godot/plugin/SignalInfo.java b/platform/android/java/lib/src/org/godotengine/godot/plugin/SignalInfo.java index 03e21f576ad..d5878a41193 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/plugin/SignalInfo.java +++ b/platform/android/java/lib/src/org/godotengine/godot/plugin/SignalInfo.java @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.plugin; +package org.godotengine.godot.plugin; import android.text.TextUtils; diff --git a/platform/android/java/lib/src/org/godotengine/godot/plugin/UsedByGodot.java b/platform/android/java/lib/src/org/godotengine/godot/plugin/UsedByGodot.java index 3e2047ad551..e679860468a 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/plugin/UsedByGodot.java +++ b/platform/android/java/lib/src/org/godotengine/godot/plugin/UsedByGodot.java @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.plugin; +package org.godotengine.godot.plugin; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/platform/android/java/lib/src/org/godotengine/godot/service/GodotService.kt b/platform/android/java/lib/src/org/godotengine/godot/service/GodotService.kt index b97d891a47b..29c8d98abf6 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/service/GodotService.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/service/GodotService.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.service +package org.godotengine.godot.service import android.app.Service import android.content.Intent @@ -50,9 +50,9 @@ import android.widget.FrameLayout import androidx.annotation.CallSuper import androidx.annotation.RequiresApi import androidx.core.os.bundleOf -import org.redotengine.godot.Godot -import org.redotengine.godot.GodotHost -import org.redotengine.godot.R +import org.godotengine.godot.Godot +import org.godotengine.godot.GodotHost +import org.godotengine.godot.R import java.lang.ref.WeakReference /** diff --git a/platform/android/java/lib/src/org/godotengine/godot/service/RemoteGodotFragment.kt b/platform/android/java/lib/src/org/godotengine/godot/service/RemoteGodotFragment.kt index 571df8da52d..0e6bfc19319 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/service/RemoteGodotFragment.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/service/RemoteGodotFragment.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.service +package org.godotengine.godot.service import android.content.ComponentName import android.content.Context @@ -51,10 +51,10 @@ import android.view.View import android.view.ViewGroup import androidx.annotation.RequiresApi import androidx.fragment.app.Fragment -import org.redotengine.godot.GodotHost -import org.redotengine.godot.R -import org.redotengine.godot.service.GodotService.EngineStatus.* -import org.redotengine.godot.service.GodotService.EngineError.* +import org.godotengine.godot.GodotHost +import org.godotengine.godot.R +import org.godotengine.godot.service.GodotService.EngineStatus.* +import org.godotengine.godot.service.GodotService.EngineError.* import java.lang.ref.WeakReference /** diff --git a/platform/android/java/lib/src/org/godotengine/godot/tts/GodotTTS.java b/platform/android/java/lib/src/org/godotengine/godot/tts/GodotTTS.java index 7bb62397fa4..23a71f0ff9e 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/tts/GodotTTS.java +++ b/platform/android/java/lib/src/org/godotengine/godot/tts/GodotTTS.java @@ -30,7 +30,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.tts; +package org.godotengine.godot.tts; + +import org.godotengine.godot.GodotLib; import android.app.Activity; import android.content.Context; @@ -45,8 +47,6 @@ import java.util.LinkedList; import java.util.Set; -import org.redotengine.godot.GodotLib; - /** * Wrapper for Android Text to Speech API and custom utterance query implementation. *

diff --git a/platform/android/java/lib/src/org/godotengine/godot/tts/GodotUtterance.java b/platform/android/java/lib/src/org/godotengine/godot/tts/GodotUtterance.java index 0ba9d354aba..b89f983056d 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/tts/GodotUtterance.java +++ b/platform/android/java/lib/src/org/godotengine/godot/tts/GodotUtterance.java @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.tts; +package org.godotengine.godot.tts; /** * A speech request for GodotTTS. diff --git a/platform/android/java/lib/src/org/godotengine/godot/utils/BenchmarkUtils.kt b/platform/android/java/lib/src/org/godotengine/godot/utils/BenchmarkUtils.kt index 20ab247ca8f..61e40ca6c66 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/utils/BenchmarkUtils.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/utils/BenchmarkUtils.kt @@ -32,16 +32,16 @@ @file:JvmName("BenchmarkUtils") -package org.redotengine.godot.utils +package org.godotengine.godot.utils import android.os.Build import android.os.SystemClock import android.os.Trace import android.util.Log -import org.redotengine.godot.BuildConfig -import org.redotengine.godot.error.Error -import org.redotengine.godot.io.file.FileAccessFlags -import org.redotengine.godot.io.file.FileAccessHandler +import org.godotengine.godot.BuildConfig +import org.godotengine.godot.error.Error +import org.godotengine.godot.io.file.FileAccessFlags +import org.godotengine.godot.io.file.FileAccessHandler import org.json.JSONObject import java.nio.ByteBuffer import java.util.Collections diff --git a/platform/android/java/lib/src/org/godotengine/godot/utils/CommandLineFileParser.kt b/platform/android/java/lib/src/org/godotengine/godot/utils/CommandLineFileParser.kt index a524720b0dc..118ea3f1fe6 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/utils/CommandLineFileParser.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/utils/CommandLineFileParser.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.utils +package org.godotengine.godot.utils import java.io.InputStream import java.nio.charset.StandardCharsets diff --git a/platform/android/java/lib/src/org/godotengine/godot/utils/Crypt.java b/platform/android/java/lib/src/org/godotengine/godot/utils/Crypt.java index 57250ce1704..3ff220dd77e 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/utils/Crypt.java +++ b/platform/android/java/lib/src/org/godotengine/godot/utils/Crypt.java @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.utils; +package org.godotengine.godot.utils; import java.security.MessageDigest; import java.util.Random; diff --git a/platform/android/java/lib/src/org/godotengine/godot/utils/DeviceUtils.kt b/platform/android/java/lib/src/org/godotengine/godot/utils/DeviceUtils.kt index 32c0e067587..c455e4b60e6 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/utils/DeviceUtils.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/utils/DeviceUtils.kt @@ -35,7 +35,7 @@ */ @file:JvmName("DeviceUtils") -package org.redotengine.godot.utils +package org.godotengine.godot.utils import android.content.Context import android.os.Build diff --git a/platform/android/java/lib/src/org/godotengine/godot/utils/DialogUtils.kt b/platform/android/java/lib/src/org/godotengine/godot/utils/DialogUtils.kt index fc2f0beb985..91d63131a78 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/utils/DialogUtils.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/utils/DialogUtils.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.utils +package org.godotengine.godot.utils import android.app.Activity import android.app.AlertDialog @@ -48,7 +48,7 @@ import android.widget.LinearLayout import android.widget.PopupWindow import android.widget.TextView -import org.redotengine.godot.R +import org.godotengine.godot.R import kotlin.math.abs /** diff --git a/platform/android/java/lib/src/org/godotengine/godot/utils/GLUtils.java b/platform/android/java/lib/src/org/godotengine/godot/utils/GLUtils.java index af95a198344..815dedc7e46 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/utils/GLUtils.java +++ b/platform/android/java/lib/src/org/godotengine/godot/utils/GLUtils.java @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.utils; +package org.godotengine.godot.utils; import android.util.Log; diff --git a/platform/android/java/lib/src/org/godotengine/godot/utils/GodotNetUtils.java b/platform/android/java/lib/src/org/godotengine/godot/utils/GodotNetUtils.java index 779b0c46ef5..e5df219a3e8 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/utils/GodotNetUtils.java +++ b/platform/android/java/lib/src/org/godotengine/godot/utils/GodotNetUtils.java @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.utils; +package org.godotengine.godot.utils; import android.app.Activity; import android.content.Context; diff --git a/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java b/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java index 040fd0483aa..6851fec8c63 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java +++ b/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.utils; +package org.godotengine.godot.utils; import android.Manifest; import android.app.Activity; diff --git a/platform/android/java/lib/src/org/godotengine/godot/utils/ProcessPhoenix.java b/platform/android/java/lib/src/org/godotengine/godot/utils/ProcessPhoenix.java index f9a53177ea3..d9afdf90b13 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/utils/ProcessPhoenix.java +++ b/platform/android/java/lib/src/org/godotengine/godot/utils/ProcessPhoenix.java @@ -20,7 +20,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.redotengine.godot.utils; +package org.godotengine.godot.utils; import android.app.Activity; import android.app.ActivityManager; diff --git a/platform/android/java/lib/src/org/godotengine/godot/variant/Callable.kt b/platform/android/java/lib/src/org/godotengine/godot/variant/Callable.kt index 8b5d591ca65..177a7670764 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/variant/Callable.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/variant/Callable.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.variant +package org.godotengine.godot.variant import androidx.annotation.Keep diff --git a/platform/android/java/lib/src/org/godotengine/godot/vulkan/VkRenderer.kt b/platform/android/java/lib/src/org/godotengine/godot/vulkan/VkRenderer.kt index 3d06ebf90b9..04e64b21a2d 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/vulkan/VkRenderer.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/vulkan/VkRenderer.kt @@ -31,12 +31,12 @@ /**************************************************************************/ @file:JvmName("VkRenderer") -package org.redotengine.godot.vulkan +package org.godotengine.godot.vulkan import android.util.Log import android.view.Surface -import org.redotengine.godot.GodotLib -import org.redotengine.godot.plugin.GodotPluginRegistry +import org.godotengine.godot.GodotLib +import org.godotengine.godot.plugin.GodotPluginRegistry /** * Responsible to setting up and driving the Vulkan rendering logic. diff --git a/platform/android/java/lib/src/org/godotengine/godot/vulkan/VkSurfaceView.kt b/platform/android/java/lib/src/org/godotengine/godot/vulkan/VkSurfaceView.kt index c24b5ac8482..3bfe2a313a2 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/vulkan/VkSurfaceView.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/vulkan/VkSurfaceView.kt @@ -31,7 +31,7 @@ /**************************************************************************/ @file:JvmName("VkSurfaceView") -package org.redotengine.godot.vulkan +package org.godotengine.godot.vulkan import android.content.Context import android.view.SurfaceHolder diff --git a/platform/android/java/lib/src/org/godotengine/godot/vulkan/VkThread.kt b/platform/android/java/lib/src/org/godotengine/godot/vulkan/VkThread.kt index 36d59721617..783fc707dac 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/vulkan/VkThread.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/vulkan/VkThread.kt @@ -31,7 +31,7 @@ /**************************************************************************/ @file:JvmName("VkThread") -package org.redotengine.godot.vulkan +package org.godotengine.godot.vulkan import android.util.Log import java.util.concurrent.locks.ReentrantLock diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/HybridAppUtils.kt b/platform/android/java/lib/src/org/godotengine/godot/xr/HybridAppUtils.kt index a3e3646e375..8b42441f3f5 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/xr/HybridAppUtils.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/xr/HybridAppUtils.kt @@ -35,10 +35,10 @@ */ @file:JvmName("HybridAppUtils") -package org.redotengine.godot.xr +package org.godotengine.godot.xr import android.util.Log -import org.redotengine.godot.GodotLib +import org.godotengine.godot.GodotLib private const val TAG = "HybridAppUtils" diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/XRMode.java b/platform/android/java/lib/src/org/godotengine/godot/xr/XRMode.java index 09c35e8aeeb..3e08c6e952b 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/xr/XRMode.java +++ b/platform/android/java/lib/src/org/godotengine/godot/xr/XRMode.java @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.xr; +package org.godotengine.godot.xr; /** * Godot available XR modes. diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrConfigChooser.java b/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrConfigChooser.java index 91e32b7476e..bb57e0643ff 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrConfigChooser.java +++ b/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrConfigChooser.java @@ -30,7 +30,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.xr.ovr; +package org.godotengine.godot.xr.ovr; + +import org.godotengine.godot.gl.GLSurfaceView; import android.opengl.EGLExt; @@ -38,8 +40,6 @@ import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.egl.EGLDisplay; -import org.redotengine.godot.gl.GLSurfaceView; - /** * EGL config chooser for the Oculus Mobile VR SDK. */ diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrContextFactory.java b/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrContextFactory.java index e6a0df2cc1d..4c55a66ef32 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrContextFactory.java +++ b/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrContextFactory.java @@ -30,7 +30,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.xr.ovr; +package org.godotengine.godot.xr.ovr; + +import org.godotengine.godot.gl.GLSurfaceView; import android.opengl.EGL14; @@ -39,8 +41,6 @@ import javax.microedition.khronos.egl.EGLContext; import javax.microedition.khronos.egl.EGLDisplay; -import org.redotengine.godot.gl.GLSurfaceView; - /** * EGL Context factory for the Oculus mobile VR SDK. */ diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrWindowSurfaceFactory.java b/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrWindowSurfaceFactory.java index 4fe9d06ebda..00d31f44d85 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrWindowSurfaceFactory.java +++ b/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrWindowSurfaceFactory.java @@ -30,15 +30,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.xr.ovr; +package org.godotengine.godot.xr.ovr; + +import org.godotengine.godot.gl.GLSurfaceView; import javax.microedition.khronos.egl.EGL10; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.egl.EGLDisplay; import javax.microedition.khronos.egl.EGLSurface; -import org.redotengine.godot.gl.GLSurfaceView; - /** * EGL window surface factory for the Oculus mobile VR SDK. */ diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularConfigChooser.java b/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularConfigChooser.java index c95e25708c8..76b6eed3378 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularConfigChooser.java +++ b/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularConfigChooser.java @@ -30,15 +30,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.xr.regular; +package org.godotengine.godot.xr.regular; + +import org.godotengine.godot.gl.GLSurfaceView; +import org.godotengine.godot.utils.GLUtils; import javax.microedition.khronos.egl.EGL10; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.egl.EGLDisplay; -import org.redotengine.godot.gl.GLSurfaceView; -import org.redotengine.godot.utils.GLUtils; - /** * Used to select the egl config for pancake games. */ diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularContextFactory.java b/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularContextFactory.java index 2ec2a7a1be1..110616a9bbf 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularContextFactory.java +++ b/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularContextFactory.java @@ -30,7 +30,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.xr.regular; +package org.godotengine.godot.xr.regular; + +import org.godotengine.godot.gl.GLSurfaceView; +import org.godotengine.godot.utils.GLUtils; import android.util.Log; @@ -39,9 +42,6 @@ import javax.microedition.khronos.egl.EGLContext; import javax.microedition.khronos.egl.EGLDisplay; -import org.redotengine.godot.gl.GLSurfaceView; -import org.redotengine.godot.utils.GLUtils; - /** * Factory used to setup the opengl context for pancake games. */ diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularFallbackConfigChooser.java b/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularFallbackConfigChooser.java index f789c726bad..1a2e68cf0f1 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularFallbackConfigChooser.java +++ b/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularFallbackConfigChooser.java @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.xr.regular; +package org.godotengine.godot.xr.regular; import android.util.Log; diff --git a/platform/android/java/lib/srcTest/java/org/godotengine/godot/utils/CommandLineFileParserTest.kt b/platform/android/java/lib/srcTest/java/org/godotengine/godot/utils/CommandLineFileParserTest.kt index f9e858edef1..a4be4d2a069 100644 --- a/platform/android/java/lib/srcTest/java/org/godotengine/godot/utils/CommandLineFileParserTest.kt +++ b/platform/android/java/lib/srcTest/java/org/godotengine/godot/utils/CommandLineFileParserTest.kt @@ -30,7 +30,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -package org.redotengine.godot.utils +package org.godotengine.godot.utils import org.junit.Test import org.junit.runner.RunWith diff --git a/platform/android/java/nativeSrcsConfigs/build.gradle b/platform/android/java/nativeSrcsConfigs/build.gradle index bb9df54f697..a7282411810 100644 --- a/platform/android/java/nativeSrcsConfigs/build.gradle +++ b/platform/android/java/nativeSrcsConfigs/build.gradle @@ -9,7 +9,7 @@ android { buildToolsVersion versions.buildTools ndkVersion versions.ndkVersion - namespace = "org.redotengine.godot" + namespace = "org.godotengine.godot" defaultConfig { minSdkVersion versions.minSdk diff --git a/platform/android/java_class_wrapper.cpp b/platform/android/java_class_wrapper.cpp index e837827600f..ae05f255b48 100644 --- a/platform/android/java_class_wrapper.cpp +++ b/platform/android/java_class_wrapper.cpp @@ -975,7 +975,7 @@ bool JavaClassWrapper::_get_type_sig(JNIEnv *env, jobject obj, uint32_t &sig, St } else if (str_type == "java.lang.CharSequence") { t |= JavaClass::ARG_TYPE_CHARSEQUENCE; strsig += "Ljava/lang/CharSequence;"; - } else if (str_type == "org.redotengine.godot.variant.Callable") { + } else if (str_type == "org.godotengine.godot.variant.Callable") { t |= JavaClass::ARG_TYPE_CALLABLE; strsig += "Lorg/godotengine/godot/variant/Callable;"; } else if (str_type == "java.lang.Boolean") { @@ -1080,7 +1080,7 @@ bool JavaClass::_convert_object_to_variant(JNIEnv *env, jobject obj, Variant &va if (java_class_wrapped.is_valid()) { String cn = java_class_wrapped->get_java_class_name(); - if (cn == "org.redotengine.godot.Dictionary" || cn == "java.util.HashMap") { + if (cn == "org.godotengine.godot.Dictionary" || cn == "java.util.HashMap") { var = _jobject_to_variant(env, obj); } else { Ref ret = Ref(memnew(JavaObject(java_class_wrapped, obj))); @@ -1444,7 +1444,7 @@ bool JavaClass::_convert_object_to_variant(JNIEnv *env, jobject obj, Variant &va if (java_class_wrapped.is_valid()) { String cn = java_class_wrapped->get_java_class_name(); - if (cn == "org.redotengine.godot.Dictionary" || cn == "java.util.HashMap") { + if (cn == "org.godotengine.godot.Dictionary" || cn == "java.util.HashMap") { ret[i] = _jobject_to_variant(env, obj); } else { Ref java_obj_wrapped = Ref(memnew(JavaObject(java_class_wrapped, obj))); diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp index 9cc1f621a71..2d477af4af0 100644 --- a/platform/android/java_godot_lib_jni.cpp +++ b/platform/android/java_godot_lib_jni.cpp @@ -138,13 +138,13 @@ static void _terminate(JNIEnv *env, bool p_restart = false) { extern "C" { -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_setVirtualKeyboardHeight(JNIEnv *env, jclass clazz, jint p_height) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setVirtualKeyboardHeight(JNIEnv *env, jclass clazz, jint p_height) { if (godot_io_java) { godot_io_java->set_vk_height(p_height); } } -JNIEXPORT jboolean JNICALL Java_org_redotengine_godot_GodotLib_initialize(JNIEnv *env, jclass clazz, jobject p_godot_instance, jobject p_asset_manager, jobject p_godot_io, jobject p_net_utils, jobject p_directory_access_handler, jobject p_file_access_handler, jboolean p_use_apk_expansion) { +JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *env, jclass clazz, jobject p_godot_instance, jobject p_asset_manager, jobject p_godot_io, jobject p_net_utils, jobject p_directory_access_handler, jobject p_file_access_handler, jboolean p_use_apk_expansion) { JavaVM *jvm; env->GetJavaVM(&jvm); @@ -165,11 +165,11 @@ JNIEXPORT jboolean JNICALL Java_org_redotengine_godot_GodotLib_initialize(JNIEnv return true; } -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_ondestroy(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_ondestroy(JNIEnv *env, jclass clazz) { _terminate(env, false); } -JNIEXPORT jboolean JNICALL Java_org_redotengine_godot_GodotLib_setup(JNIEnv *env, jclass clazz, jobjectArray p_cmdline, jobject p_godot_tts) { +JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jclass clazz, jobjectArray p_cmdline, jobject p_godot_tts) { setup_android_thread(); const char **cmdline = nullptr; @@ -216,7 +216,7 @@ JNIEXPORT jboolean JNICALL Java_org_redotengine_godot_GodotLib_setup(JNIEnv *env return true; } -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_resize(JNIEnv *env, jclass clazz, jobject p_surface, jint p_width, jint p_height) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_resize(JNIEnv *env, jclass clazz, jobject p_surface, jint p_width, jint p_height) { if (os_android) { os_android->set_display_size(Size2i(p_width, p_height)); @@ -232,7 +232,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_resize(JNIEnv *env, j } } -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_newcontext(JNIEnv *env, jclass clazz, jobject p_surface) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_newcontext(JNIEnv *env, jclass clazz, jobject p_surface) { if (os_android) { if (step.get() == STEP_SETUP) { // During startup @@ -247,7 +247,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_newcontext(JNIEnv *en } } -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_back(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_back(JNIEnv *env, jclass clazz) { if (step.get() <= STEP_SETUP) { return; } @@ -257,11 +257,11 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_back(JNIEnv *env, jcl } } -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_ttsCallback(JNIEnv *env, jclass clazz, jint event, jint id, jint pos) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_ttsCallback(JNIEnv *env, jclass clazz, jint event, jint id, jint pos) { TTS_Android::_java_utterance_callback(event, id, pos); } -JNIEXPORT jboolean JNICALL Java_org_redotengine_godot_GodotLib_step(JNIEnv *env, jclass clazz) { +JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, jclass clazz) { if (step.get() == STEP_TERMINATED) { return true; } @@ -319,7 +319,7 @@ JNIEXPORT jboolean JNICALL Java_org_redotengine_godot_GodotLib_step(JNIEnv *env, } // Called on the UI thread -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_dispatchMouseEvent(JNIEnv *env, jclass clazz, jint p_event_type, jint p_button_mask, jfloat p_x, jfloat p_y, jfloat p_delta_x, jfloat p_delta_y, jboolean p_double_click, jboolean p_source_mouse_relative, jfloat p_pressure, jfloat p_tilt_x, jfloat p_tilt_y) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_dispatchMouseEvent(JNIEnv *env, jclass clazz, jint p_event_type, jint p_button_mask, jfloat p_x, jfloat p_y, jfloat p_delta_x, jfloat p_delta_y, jboolean p_double_click, jboolean p_source_mouse_relative, jfloat p_pressure, jfloat p_tilt_x, jfloat p_tilt_y) { if (step.get() <= STEP_SETUP) { return; } @@ -328,7 +328,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_dispatchMouseEvent(JN } // Called on the UI thread -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_dispatchTouchEvent(JNIEnv *env, jclass clazz, jint ev, jint pointer, jint pointer_count, jfloatArray position, jboolean p_double_tap) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_dispatchTouchEvent(JNIEnv *env, jclass clazz, jint ev, jint pointer, jint pointer_count, jfloatArray position, jboolean p_double_tap) { if (step.get() <= STEP_SETUP) { return; } @@ -349,7 +349,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_dispatchTouchEvent(JN } // Called on the UI thread -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_magnify(JNIEnv *env, jclass clazz, jfloat p_x, jfloat p_y, jfloat p_factor) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_magnify(JNIEnv *env, jclass clazz, jfloat p_x, jfloat p_y, jfloat p_factor) { if (step.get() <= STEP_SETUP) { return; } @@ -357,7 +357,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_magnify(JNIEnv *env, } // Called on the UI thread -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_pan(JNIEnv *env, jclass clazz, jfloat p_x, jfloat p_y, jfloat p_delta_x, jfloat p_delta_y) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_pan(JNIEnv *env, jclass clazz, jfloat p_x, jfloat p_y, jfloat p_delta_x, jfloat p_delta_y) { if (step.get() <= STEP_SETUP) { return; } @@ -365,7 +365,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_pan(JNIEnv *env, jcla } // Called on the UI thread -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_joybutton(JNIEnv *env, jclass clazz, jint p_device, jint p_button, jboolean p_pressed) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joybutton(JNIEnv *env, jclass clazz, jint p_device, jint p_button, jboolean p_pressed) { if (step.get() <= STEP_SETUP) { return; } @@ -380,7 +380,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_joybutton(JNIEnv *env } // Called on the UI thread -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_joyaxis(JNIEnv *env, jclass clazz, jint p_device, jint p_axis, jfloat p_value) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyaxis(JNIEnv *env, jclass clazz, jint p_device, jint p_axis, jfloat p_value) { if (step.get() <= STEP_SETUP) { return; } @@ -395,7 +395,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_joyaxis(JNIEnv *env, } // Called on the UI thread -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_joyhat(JNIEnv *env, jclass clazz, jint p_device, jint p_hat_x, jint p_hat_y) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyhat(JNIEnv *env, jclass clazz, jint p_device, jint p_hat_x, jint p_hat_y) { if (step.get() <= STEP_SETUP) { return; } @@ -424,7 +424,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_joyhat(JNIEnv *env, j } // Called on the UI thread -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_joyconnectionchanged(JNIEnv *env, jclass clazz, jint p_device, jboolean p_connected, jstring p_name) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyconnectionchanged(JNIEnv *env, jclass clazz, jint p_device, jboolean p_connected, jstring p_name) { if (os_android) { String name = jstring_to_string(p_name, env); Input::get_singleton()->joy_connection_changed(p_device, p_connected, name); @@ -432,30 +432,30 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_joyconnectionchanged( } // Called on the UI thread -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_key(JNIEnv *env, jclass clazz, jint p_physical_keycode, jint p_unicode, jint p_key_label, jboolean p_pressed, jboolean p_echo) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_key(JNIEnv *env, jclass clazz, jint p_physical_keycode, jint p_unicode, jint p_key_label, jboolean p_pressed, jboolean p_echo) { if (step.get() <= STEP_SETUP) { return; } input_handler->process_key_event(p_physical_keycode, p_unicode, p_key_label, p_pressed, p_echo); } -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_accelerometer(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_accelerometer(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z) { accelerometer = Vector3(x, y, z); } -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_gravity(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_gravity(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z) { gravity = Vector3(x, y, z); } -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_magnetometer(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_magnetometer(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z) { magnetometer = Vector3(x, y, z); } -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_gyroscope(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_gyroscope(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z) { gyroscope = Vector3(x, y, z); } -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_focusin(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusin(JNIEnv *env, jclass clazz) { if (step.get() <= STEP_SETUP) { return; } @@ -463,7 +463,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_focusin(JNIEnv *env, os_android->main_loop_focusin(); } -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_focusout(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusout(JNIEnv *env, jclass clazz) { if (step.get() <= STEP_SETUP) { return; } @@ -471,7 +471,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_focusout(JNIEnv *env, os_android->main_loop_focusout(); } -JNIEXPORT jstring JNICALL Java_org_redotengine_godot_GodotLib_getGlobal(JNIEnv *env, jclass clazz, jstring path) { +JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getGlobal(JNIEnv *env, jclass clazz, jstring path) { String js = jstring_to_string(path, env); Variant setting_with_override = GLOBAL_GET(js); @@ -479,7 +479,7 @@ JNIEXPORT jstring JNICALL Java_org_redotengine_godot_GodotLib_getGlobal(JNIEnv * return env->NewStringUTF(setting_value.utf8().get_data()); } -JNIEXPORT jobjectArray JNICALL Java_org_redotengine_godot_GodotLib_getRendererInfo(JNIEnv *env, jclass clazz) { +JNIEXPORT jobjectArray JNICALL Java_org_godotengine_godot_GodotLib_getRendererInfo(JNIEnv *env, jclass clazz) { String rendering_driver = RenderingServer::get_singleton()->get_current_rendering_driver_name(); String rendering_method = RenderingServer::get_singleton()->get_current_rendering_method(); @@ -490,7 +490,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_redotengine_godot_GodotLib_getRendererIn return result; } -JNIEXPORT jstring JNICALL Java_org_redotengine_godot_GodotLib_getEditorSetting(JNIEnv *env, jclass clazz, jstring p_setting_key) { +JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getEditorSetting(JNIEnv *env, jclass clazz, jstring p_setting_key) { String editor_setting_value = ""; #ifdef TOOLS_ENABLED String godot_setting_key = jstring_to_string(p_setting_key, env); @@ -503,7 +503,7 @@ JNIEXPORT jstring JNICALL Java_org_redotengine_godot_GodotLib_getEditorSetting(J return env->NewStringUTF(editor_setting_value.utf8().get_data()); } -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_setEditorSetting(JNIEnv *env, jclass clazz, jstring p_key, jobject p_data) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setEditorSetting(JNIEnv *env, jclass clazz, jstring p_key, jobject p_data) { #ifdef TOOLS_ENABLED if (EditorSettings::get_singleton() != nullptr) { String key = jstring_to_string(p_key, env); @@ -515,7 +515,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_setEditorSetting(JNIE #endif } -JNIEXPORT jobject JNICALL Java_org_redotengine_godot_GodotLib_getEditorProjectMetadata(JNIEnv *env, jclass clazz, jstring p_section, jstring p_key, jobject p_default_value) { +JNIEXPORT jobject JNICALL Java_org_godotengine_godot_GodotLib_getEditorProjectMetadata(JNIEnv *env, jclass clazz, jstring p_section, jstring p_key, jobject p_default_value) { jvalret result; #ifdef TOOLS_ENABLED @@ -533,7 +533,7 @@ JNIEXPORT jobject JNICALL Java_org_redotengine_godot_GodotLib_getEditorProjectMe return result.obj; } -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_setEditorProjectMetadata(JNIEnv *env, jclass clazz, jstring p_section, jstring p_key, jobject p_data) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setEditorProjectMetadata(JNIEnv *env, jclass clazz, jstring p_section, jstring p_key, jobject p_data) { #ifdef TOOLS_ENABLED if (EditorSettings::get_singleton() != nullptr) { String section = jstring_to_string(p_section, env); @@ -546,21 +546,21 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_setEditorProjectMetad #endif } -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_onNightModeChanged(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onNightModeChanged(JNIEnv *env, jclass clazz) { DisplayServerAndroid *ds = (DisplayServerAndroid *)DisplayServer::get_singleton(); if (ds) { ds->emit_system_theme_changed(); } } -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_hardwareKeyboardConnected(JNIEnv *env, jclass clazz, jboolean p_connected) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_hardwareKeyboardConnected(JNIEnv *env, jclass clazz, jboolean p_connected) { DisplayServerAndroid *ds = (DisplayServerAndroid *)DisplayServer::get_singleton(); if (ds) { ds->emit_hardware_keyboard_connection_changed(p_connected); } } -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_filePickerCallback(JNIEnv *env, jclass clazz, jboolean p_ok, jobjectArray p_selected_paths) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_filePickerCallback(JNIEnv *env, jclass clazz, jboolean p_ok, jobjectArray p_selected_paths) { DisplayServerAndroid *ds = (DisplayServerAndroid *)DisplayServer::get_singleton(); if (ds) { Vector selected_paths; @@ -576,7 +576,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_filePickerCallback(JN } } -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_requestPermissionResult(JNIEnv *env, jclass clazz, jstring p_permission, jboolean p_result) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_requestPermissionResult(JNIEnv *env, jclass clazz, jstring p_permission, jboolean p_result) { String permission = jstring_to_string(p_permission, env); if (permission == "android.permission.RECORD_AUDIO" && p_result) { AudioDriver::get_singleton()->input_start(); @@ -587,7 +587,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_requestPermissionResu } } -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_onRendererResumed(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onRendererResumed(JNIEnv *env, jclass clazz) { if (step.get() <= STEP_SETUP) { return; } @@ -599,7 +599,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_onRendererResumed(JNI } } -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_onRendererPaused(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onRendererPaused(JNIEnv *env, jclass clazz) { if (step.get() <= STEP_SETUP) { return; } @@ -609,7 +609,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_onRendererPaused(JNIE } } -JNIEXPORT jboolean JNICALL Java_org_redotengine_godot_GodotLib_shouldDispatchInputToRenderThread(JNIEnv *env, jclass clazz) { +JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_shouldDispatchInputToRenderThread(JNIEnv *env, jclass clazz) { Input *input = Input::get_singleton(); if (input) { return !input->is_agile_input_event_flushing(); @@ -617,11 +617,11 @@ JNIEXPORT jboolean JNICALL Java_org_redotengine_godot_GodotLib_shouldDispatchInp return false; } -JNIEXPORT jstring JNICALL Java_org_redotengine_godot_GodotLib_getProjectResourceDir(JNIEnv *env, jclass clazz) { +JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getProjectResourceDir(JNIEnv *env, jclass clazz) { const String resource_dir = OS::get_singleton()->get_resource_dir(); return env->NewStringUTF(resource_dir.utf8().get_data()); } -JNIEXPORT jboolean JNICALL Java_org_redotengine_godot_GodotLib_isEditorHint(JNIEnv *env, jclass clazz) { +JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_isEditorHint(JNIEnv *env, jclass clazz) { Engine *engine = Engine::get_singleton(); if (engine) { return engine->is_editor_hint(); @@ -629,7 +629,7 @@ JNIEXPORT jboolean JNICALL Java_org_redotengine_godot_GodotLib_isEditorHint(JNIE return false; } -JNIEXPORT jboolean JNICALL Java_org_redotengine_godot_GodotLib_isProjectManagerHint(JNIEnv *env, jclass clazz) { +JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_isProjectManagerHint(JNIEnv *env, jclass clazz) { Engine *engine = Engine::get_singleton(); if (engine) { return engine->is_project_manager_hint(); diff --git a/platform/android/java_godot_lib_jni.h b/platform/android/java_godot_lib_jni.h index 6478f2149ec..b91e990cbbb 100644 --- a/platform/android/java_godot_lib_jni.h +++ b/platform/android/java_godot_lib_jni.h @@ -38,44 +38,44 @@ // These functions can be called from within JAVA and are the means by which our JAVA implementation calls back into our C++ code. // See java/src/org/godotengine/godot/GodotLib.java for the JAVA side of this (yes that's why we have the long names) extern "C" { -JNIEXPORT jboolean JNICALL Java_org_redotengine_godot_GodotLib_initialize(JNIEnv *env, jclass clazz, jobject p_godot_instance, jobject p_asset_manager, jobject p_godot_io, jobject p_net_utils, jobject p_directory_access_handler, jobject p_file_access_handler, jboolean p_use_apk_expansion); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_ondestroy(JNIEnv *env, jclass clazz); -JNIEXPORT jboolean JNICALL Java_org_redotengine_godot_GodotLib_setup(JNIEnv *env, jclass clazz, jobjectArray p_cmdline, jobject p_godot_tts); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_resize(JNIEnv *env, jclass clazz, jobject p_surface, jint p_width, jint p_height); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_newcontext(JNIEnv *env, jclass clazz, jobject p_surface); -JNIEXPORT jboolean JNICALL Java_org_redotengine_godot_GodotLib_step(JNIEnv *env, jclass clazz); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_ttsCallback(JNIEnv *env, jclass clazz, jint event, jint id, jint pos); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_back(JNIEnv *env, jclass clazz); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_dispatchMouseEvent(JNIEnv *env, jclass clazz, jint p_event_type, jint p_button_mask, jfloat p_x, jfloat p_y, jfloat p_delta_x, jfloat p_delta_y, jboolean p_double_click, jboolean p_source_mouse_relative, jfloat p_pressure, jfloat p_tilt_x, jfloat p_tilt_y); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_dispatchTouchEvent(JNIEnv *env, jclass clazz, jint ev, jint pointer, jint pointer_count, jfloatArray positions, jboolean p_double_tap); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_magnify(JNIEnv *env, jclass clazz, jfloat p_x, jfloat p_y, jfloat p_factor); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_pan(JNIEnv *env, jclass clazz, jfloat p_x, jfloat p_y, jfloat p_delta_x, jfloat p_delta_y); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_key(JNIEnv *env, jclass clazz, jint p_physical_keycode, jint p_unicode, jint p_key_label, jboolean p_pressed, jboolean p_echo); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_joybutton(JNIEnv *env, jclass clazz, jint p_device, jint p_button, jboolean p_pressed); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_joyaxis(JNIEnv *env, jclass clazz, jint p_device, jint p_axis, jfloat p_value); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_joyhat(JNIEnv *env, jclass clazz, jint p_device, jint p_hat_x, jint p_hat_y); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_joyconnectionchanged(JNIEnv *env, jclass clazz, jint p_device, jboolean p_connected, jstring p_name); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_accelerometer(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_gravity(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_magnetometer(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_gyroscope(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_focusin(JNIEnv *env, jclass clazz); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_focusout(JNIEnv *env, jclass clazz); -JNIEXPORT jstring JNICALL Java_org_redotengine_godot_GodotLib_getGlobal(JNIEnv *env, jclass clazz, jstring path); -JNIEXPORT jobjectArray JNICALL Java_org_redotengine_godot_GodotLib_getRendererInfo(JNIEnv *env, jclass clazz); -JNIEXPORT jstring JNICALL Java_org_redotengine_godot_GodotLib_getEditorSetting(JNIEnv *env, jclass clazz, jstring p_setting_key); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_setEditorSetting(JNIEnv *env, jclass clazz, jstring p_key, jobject p_data); -JNIEXPORT jobject JNICALL Java_org_redotengine_godot_GodotLib_getEditorProjectMetadata(JNIEnv *env, jclass clazz, jstring p_section, jstring p_key, jobject p_default_value); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_setEditorProjectMetadata(JNIEnv *env, jclass clazz, jstring p_section, jstring p_key, jobject p_data); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_setVirtualKeyboardHeight(JNIEnv *env, jclass clazz, jint p_height); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_requestPermissionResult(JNIEnv *env, jclass clazz, jstring p_permission, jboolean p_result); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_onNightModeChanged(JNIEnv *env, jclass clazz); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_hardwareKeyboardConnected(JNIEnv *env, jclass clazz, jboolean p_connected); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_filePickerCallback(JNIEnv *env, jclass clazz, jboolean p_ok, jobjectArray p_selected_paths); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_onRendererResumed(JNIEnv *env, jclass clazz); -JNIEXPORT void JNICALL Java_org_redotengine_godot_GodotLib_onRendererPaused(JNIEnv *env, jclass clazz); -JNIEXPORT jboolean JNICALL Java_org_redotengine_godot_GodotLib_shouldDispatchInputToRenderThread(JNIEnv *env, jclass clazz); -JNIEXPORT jstring JNICALL Java_org_redotengine_godot_GodotLib_getProjectResourceDir(JNIEnv *env, jclass clazz); -JNIEXPORT jboolean JNICALL Java_org_redotengine_godot_GodotLib_isEditorHint(JNIEnv *env, jclass clazz); -JNIEXPORT jboolean JNICALL Java_org_redotengine_godot_GodotLib_isProjectManagerHint(JNIEnv *env, jclass clazz); +JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *env, jclass clazz, jobject p_godot_instance, jobject p_asset_manager, jobject p_godot_io, jobject p_net_utils, jobject p_directory_access_handler, jobject p_file_access_handler, jboolean p_use_apk_expansion); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_ondestroy(JNIEnv *env, jclass clazz); +JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jclass clazz, jobjectArray p_cmdline, jobject p_godot_tts); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_resize(JNIEnv *env, jclass clazz, jobject p_surface, jint p_width, jint p_height); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_newcontext(JNIEnv *env, jclass clazz, jobject p_surface); +JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, jclass clazz); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_ttsCallback(JNIEnv *env, jclass clazz, jint event, jint id, jint pos); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_back(JNIEnv *env, jclass clazz); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_dispatchMouseEvent(JNIEnv *env, jclass clazz, jint p_event_type, jint p_button_mask, jfloat p_x, jfloat p_y, jfloat p_delta_x, jfloat p_delta_y, jboolean p_double_click, jboolean p_source_mouse_relative, jfloat p_pressure, jfloat p_tilt_x, jfloat p_tilt_y); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_dispatchTouchEvent(JNIEnv *env, jclass clazz, jint ev, jint pointer, jint pointer_count, jfloatArray positions, jboolean p_double_tap); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_magnify(JNIEnv *env, jclass clazz, jfloat p_x, jfloat p_y, jfloat p_factor); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_pan(JNIEnv *env, jclass clazz, jfloat p_x, jfloat p_y, jfloat p_delta_x, jfloat p_delta_y); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_key(JNIEnv *env, jclass clazz, jint p_physical_keycode, jint p_unicode, jint p_key_label, jboolean p_pressed, jboolean p_echo); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joybutton(JNIEnv *env, jclass clazz, jint p_device, jint p_button, jboolean p_pressed); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyaxis(JNIEnv *env, jclass clazz, jint p_device, jint p_axis, jfloat p_value); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyhat(JNIEnv *env, jclass clazz, jint p_device, jint p_hat_x, jint p_hat_y); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyconnectionchanged(JNIEnv *env, jclass clazz, jint p_device, jboolean p_connected, jstring p_name); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_accelerometer(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_gravity(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_magnetometer(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_gyroscope(JNIEnv *env, jclass clazz, jfloat x, jfloat y, jfloat z); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusin(JNIEnv *env, jclass clazz); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusout(JNIEnv *env, jclass clazz); +JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getGlobal(JNIEnv *env, jclass clazz, jstring path); +JNIEXPORT jobjectArray JNICALL Java_org_godotengine_godot_GodotLib_getRendererInfo(JNIEnv *env, jclass clazz); +JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getEditorSetting(JNIEnv *env, jclass clazz, jstring p_setting_key); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setEditorSetting(JNIEnv *env, jclass clazz, jstring p_key, jobject p_data); +JNIEXPORT jobject JNICALL Java_org_godotengine_godot_GodotLib_getEditorProjectMetadata(JNIEnv *env, jclass clazz, jstring p_section, jstring p_key, jobject p_default_value); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setEditorProjectMetadata(JNIEnv *env, jclass clazz, jstring p_section, jstring p_key, jobject p_data); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setVirtualKeyboardHeight(JNIEnv *env, jclass clazz, jint p_height); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_requestPermissionResult(JNIEnv *env, jclass clazz, jstring p_permission, jboolean p_result); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onNightModeChanged(JNIEnv *env, jclass clazz); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_hardwareKeyboardConnected(JNIEnv *env, jclass clazz, jboolean p_connected); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_filePickerCallback(JNIEnv *env, jclass clazz, jboolean p_ok, jobjectArray p_selected_paths); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onRendererResumed(JNIEnv *env, jclass clazz); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onRendererPaused(JNIEnv *env, jclass clazz); +JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_shouldDispatchInputToRenderThread(JNIEnv *env, jclass clazz); +JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getProjectResourceDir(JNIEnv *env, jclass clazz); +JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_isEditorHint(JNIEnv *env, jclass clazz); +JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_isProjectManagerHint(JNIEnv *env, jclass clazz); } diff --git a/platform/android/java_godot_wrapper.cpp b/platform/android/java_godot_wrapper.cpp index cf6111d88e2..1d63a9ad544 100644 --- a/platform/android/java_godot_wrapper.cpp +++ b/platform/android/java_godot_wrapper.cpp @@ -43,7 +43,7 @@ GodotJavaWrapper::GodotJavaWrapper(JNIEnv *p_env, jobject p_godot_instance) { godot_instance = p_env->NewGlobalRef(p_godot_instance); // get info about our Godot class so we can get pointers and stuff... - godot_class = jni_find_class(p_env, "org/redotengine/godot/Godot"); + godot_class = p_env->FindClass("org/godotengine/godot/Godot"); if (godot_class) { godot_class = (jclass)p_env->NewGlobalRef(godot_class); } else { @@ -77,7 +77,7 @@ GodotJavaWrapper::GodotJavaWrapper(JNIEnv *p_env, jobject p_godot_instance) { _on_godot_main_loop_started = p_env->GetMethodID(godot_class, "onGodotMainLoopStarted", "()V"); _on_godot_terminating = p_env->GetMethodID(godot_class, "onGodotTerminating", "()V"); _create_new_godot_instance = p_env->GetMethodID(godot_class, "createNewGodotInstance", "([Ljava/lang/String;)I"); - _get_render_view = p_env->GetMethodID(godot_class, "getRenderView", "()Lorg/redotengine/godot/GodotRenderView;"); + _get_render_view = p_env->GetMethodID(godot_class, "getRenderView", "()Lorg/godotengine/godot/GodotRenderView;"); _begin_benchmark_measure = p_env->GetMethodID(godot_class, "nativeBeginBenchmarkMeasure", "(Ljava/lang/String;Ljava/lang/String;)V"); _end_benchmark_measure = p_env->GetMethodID(godot_class, "nativeEndBenchmarkMeasure", "(Ljava/lang/String;Ljava/lang/String;)V"); _dump_benchmark = p_env->GetMethodID(godot_class, "nativeDumpBenchmark", "(Ljava/lang/String;)V"); diff --git a/platform/android/jni_utils.cpp b/platform/android/jni_utils.cpp index d6f9e87e098..22987e652aa 100644 --- a/platform/android/jni_utils.cpp +++ b/platform/android/jni_utils.cpp @@ -164,7 +164,7 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant *p_a case Variant::DICTIONARY: { Dictionary dict = *p_arg; - jclass dclass = jni_find_class(env, "org/redotengine/godot/Dictionary"); + jclass dclass = jni_find_class(env, "org/godotengine/godot/Dictionary"); jmethodID ctor = env->GetMethodID(dclass, "", "()V"); jobject jdict = env->NewObject(dclass, ctor); @@ -444,7 +444,7 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) { return varr; } - if (name == "java.util.HashMap" || name == "org.redotengine.godot.Dictionary") { + if (name == "java.util.HashMap" || name == "org.godotengine.godot.Dictionary") { Dictionary ret; jclass oclass = c; jmethodID get_keys = env->GetMethodID(oclass, "get_keys", "()[Ljava/lang/String;"); @@ -466,7 +466,7 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) { return ret; } - if (name == "org.redotengine.godot.variant.Callable") { + if (name == "org.godotengine.godot.variant.Callable") { return jcallable_to_callable(env, obj); } @@ -497,8 +497,8 @@ Variant::Type get_jni_type(const String &p_type) { { "[D", Variant::PACKED_FLOAT64_ARRAY }, { "[Ljava.lang.String;", Variant::PACKED_STRING_ARRAY }, { "[Ljava.lang.CharSequence;", Variant::PACKED_STRING_ARRAY }, - { "org.redotengine.godot.Dictionary", Variant::DICTIONARY }, - { "org.redotengine.godot.variant.Callable", Variant::CALLABLE }, + { "org.godotengine.godot.Dictionary", Variant::DICTIONARY }, + { "org.godotengine.godot.variant.Callable", Variant::CALLABLE }, { nullptr, Variant::NIL } }; diff --git a/platform/android/jni_utils.h b/platform/android/jni_utils.h index dad334180de..3d9f54bff4e 100644 --- a/platform/android/jni_utils.h +++ b/platform/android/jni_utils.h @@ -55,17 +55,17 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj); Variant::Type get_jni_type(const String &p_type); /** - * Convert a Godot Callable to a org.redotengine.godot.variant.Callable java object. + * Convert a Godot Callable to a org.godotengine.godot.variant.Callable java object. * @param p_env JNI environment instance * @param p_callable Callable parameter to convert. If null or invalid type, a null jobject is returned. - * @return org.redotengine.godot.variant.Callable jobject or null + * @return org.godotengine.godot.variant.Callable jobject or null */ jobject callable_to_jcallable(JNIEnv *p_env, const Variant &p_callable); /** - * Convert a org.redotengine.godot.variant.Callable java object to a Godot Callable variant. + * Convert a org.godotengine.godot.variant.Callable java object to a Godot Callable variant. * @param p_env JNI environment instance - * @param p_jcallable_obj org.redotengine.godot.variant.Callable java object to convert. + * @param p_jcallable_obj org.godotengine.godot.variant.Callable java object to convert. * @return Callable variant */ Callable jcallable_to_callable(JNIEnv *p_env, jobject p_jcallable_obj); diff --git a/platform/android/plugin/godot_plugin_jni.cpp b/platform/android/plugin/godot_plugin_jni.cpp index 51a8018e67d..cdb9a97e590 100644 --- a/platform/android/plugin/godot_plugin_jni.cpp +++ b/platform/android/plugin/godot_plugin_jni.cpp @@ -54,7 +54,7 @@ void unregister_plugins_singletons() { extern "C" { -JNIEXPORT jboolean JNICALL Java_org_redotengine_godot_plugin_GodotPlugin_nativeRegisterSingleton(JNIEnv *env, jclass clazz, jstring name, jobject obj) { +JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeRegisterSingleton(JNIEnv *env, jclass clazz, jstring name, jobject obj) { String singname = jstring_to_string(name, env); ERR_FAIL_COND_V(jni_singletons.has(singname), false); @@ -71,7 +71,7 @@ JNIEXPORT jboolean JNICALL Java_org_redotengine_godot_plugin_GodotPlugin_nativeR return true; } -JNIEXPORT void JNICALL Java_org_redotengine_godot_plugin_GodotPlugin_nativeRegisterMethod(JNIEnv *env, jclass clazz, jstring sname, jstring name, jstring ret, jobjectArray args) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeRegisterMethod(JNIEnv *env, jclass clazz, jstring sname, jstring name, jstring ret, jobjectArray args) { String singname = jstring_to_string(sname, env); ERR_FAIL_COND(!jni_singletons.has(singname)); @@ -93,7 +93,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_plugin_GodotPlugin_nativeRegis s->add_method(mname, types, get_jni_type(retval)); } -JNIEXPORT void JNICALL Java_org_redotengine_godot_plugin_GodotPlugin_nativeRegisterSignal(JNIEnv *env, jclass clazz, jstring j_plugin_name, jstring j_signal_name, jobjectArray j_signal_param_types) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeRegisterSignal(JNIEnv *env, jclass clazz, jstring j_plugin_name, jstring j_signal_name, jobjectArray j_signal_param_types) { String singleton_name = jstring_to_string(j_plugin_name, env); ERR_FAIL_COND(!jni_singletons.has(singleton_name)); @@ -114,7 +114,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_plugin_GodotPlugin_nativeRegis singleton->add_signal(signal_name, types); } -JNIEXPORT void JNICALL Java_org_redotengine_godot_plugin_GodotPlugin_nativeEmitSignal(JNIEnv *env, jclass clazz, jstring j_plugin_name, jstring j_signal_name, jobjectArray j_signal_params) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeEmitSignal(JNIEnv *env, jclass clazz, jstring j_plugin_name, jstring j_signal_name, jobjectArray j_signal_params) { String singleton_name = jstring_to_string(j_plugin_name, env); ERR_FAIL_COND(!jni_singletons.has(singleton_name)); diff --git a/platform/android/plugin/godot_plugin_jni.h b/platform/android/plugin/godot_plugin_jni.h index 1e6378985fc..6cd744aa916 100644 --- a/platform/android/plugin/godot_plugin_jni.h +++ b/platform/android/plugin/godot_plugin_jni.h @@ -38,8 +38,8 @@ void unregister_plugins_singletons(); extern "C" { -JNIEXPORT jboolean JNICALL Java_org_redotengine_godot_plugin_GodotPlugin_nativeRegisterSingleton(JNIEnv *env, jclass clazz, jstring name, jobject obj); -JNIEXPORT void JNICALL Java_org_redotengine_godot_plugin_GodotPlugin_nativeRegisterMethod(JNIEnv *env, jclass clazz, jstring sname, jstring name, jstring ret, jobjectArray args); -JNIEXPORT void JNICALL Java_org_redotengine_godot_plugin_GodotPlugin_nativeRegisterSignal(JNIEnv *env, jclass clazz, jstring j_plugin_name, jstring j_signal_name, jobjectArray j_signal_param_types); -JNIEXPORT void JNICALL Java_org_redotengine_godot_plugin_GodotPlugin_nativeEmitSignal(JNIEnv *env, jclass clazz, jstring j_plugin_name, jstring j_signal_name, jobjectArray j_signal_params); +JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeRegisterSingleton(JNIEnv *env, jclass clazz, jstring name, jobject obj); +JNIEXPORT void JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeRegisterMethod(JNIEnv *env, jclass clazz, jstring sname, jstring name, jstring ret, jobjectArray args); +JNIEXPORT void JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeRegisterSignal(JNIEnv *env, jclass clazz, jstring j_plugin_name, jstring j_signal_name, jobjectArray j_signal_param_types); +JNIEXPORT void JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeEmitSignal(JNIEnv *env, jclass clazz, jstring j_plugin_name, jstring j_signal_name, jobjectArray j_signal_params); } diff --git a/platform/android/variant/callable_jni.cpp b/platform/android/variant/callable_jni.cpp index 5adcbd7b256..5ef6ca9892b 100644 --- a/platform/android/variant/callable_jni.cpp +++ b/platform/android/variant/callable_jni.cpp @@ -67,7 +67,7 @@ static Callable _generate_callable(JNIEnv *p_env, jlong p_object_id, jstring p_m } extern "C" { -JNIEXPORT jobject JNICALL Java_org_redotengine_godot_variant_Callable_nativeCall(JNIEnv *p_env, jclass p_clazz, jlong p_native_callable, jobjectArray p_parameters) { +JNIEXPORT jobject JNICALL Java_org_godotengine_godot_variant_Callable_nativeCall(JNIEnv *p_env, jclass p_clazz, jlong p_native_callable, jobjectArray p_parameters) { const Variant *callable_variant = reinterpret_cast(p_native_callable); ERR_FAIL_NULL_V(callable_variant, nullptr); if (callable_variant->get_type() != Variant::CALLABLE) { @@ -105,7 +105,7 @@ JNIEXPORT jobject JNICALL Java_org_redotengine_godot_variant_Callable_nativeCall return ret; } -JNIEXPORT jobject JNICALL Java_org_redotengine_godot_variant_Callable_nativeCallObject(JNIEnv *p_env, jclass p_clazz, jlong p_object_id, jstring p_method_name, jobjectArray p_parameters) { +JNIEXPORT jobject JNICALL Java_org_godotengine_godot_variant_Callable_nativeCallObject(JNIEnv *p_env, jclass p_clazz, jlong p_object_id, jstring p_method_name, jobjectArray p_parameters) { Callable callable = _generate_callable(p_env, p_object_id, p_method_name, p_parameters); if (callable.is_valid()) { Variant result = callable.call(); @@ -116,7 +116,7 @@ JNIEXPORT jobject JNICALL Java_org_redotengine_godot_variant_Callable_nativeCall } } -JNIEXPORT void JNICALL Java_org_redotengine_godot_variant_Callable_nativeCallObjectDeferred(JNIEnv *p_env, jclass p_clazz, jlong p_object_id, jstring p_method_name, jobjectArray p_parameters) { +JNIEXPORT void JNICALL Java_org_godotengine_godot_variant_Callable_nativeCallObjectDeferred(JNIEnv *p_env, jclass p_clazz, jlong p_object_id, jstring p_method_name, jobjectArray p_parameters) { Callable callable = _generate_callable(p_env, p_object_id, p_method_name, p_parameters); if (callable.is_valid()) { callable.call_deferred(); @@ -124,7 +124,7 @@ JNIEXPORT void JNICALL Java_org_redotengine_godot_variant_Callable_nativeCallObj } JNIEXPORT void JNICALL -Java_org_redotengine_godot_variant_Callable_releaseNativePointer(JNIEnv *p_env, jclass clazz, jlong p_native_pointer) { +Java_org_godotengine_godot_variant_Callable_releaseNativePointer(JNIEnv *p_env, jclass clazz, jlong p_native_pointer) { Variant *variant = reinterpret_cast(p_native_pointer); ERR_FAIL_NULL(variant); memdelete(variant); diff --git a/platform/android/variant/callable_jni.h b/platform/android/variant/callable_jni.h index a8fe7f2f981..5d1cfa9eb5c 100644 --- a/platform/android/variant/callable_jni.h +++ b/platform/android/variant/callable_jni.h @@ -35,8 +35,8 @@ #include extern "C" { -JNIEXPORT jobject JNICALL Java_org_redotengine_godot_variant_Callable_nativeCall(JNIEnv *p_env, jclass p_clazz, jlong p_native_callable, jobjectArray p_parameters); -JNIEXPORT jobject JNICALL Java_org_redotengine_godot_variant_Callable_nativeCallObject(JNIEnv *p_env, jclass p_clazz, jlong p_object_id, jstring p_method_name, jobjectArray p_parameters); -JNIEXPORT void JNICALL Java_org_redotengine_godot_variant_Callable_nativeCallObjectDeferred(JNIEnv *p_env, jclass p_clazz, jlong p_object_id, jstring p_method_name, jobjectArray p_parameters); -JNIEXPORT void JNICALL Java_org_redotengine_godot_variant_Callable_releaseNativePointer(JNIEnv *p_env, jclass clazz, jlong p_native_pointer); +JNIEXPORT jobject JNICALL Java_org_godotengine_godot_variant_Callable_nativeCall(JNIEnv *p_env, jclass p_clazz, jlong p_native_callable, jobjectArray p_parameters); +JNIEXPORT jobject JNICALL Java_org_godotengine_godot_variant_Callable_nativeCallObject(JNIEnv *p_env, jclass p_clazz, jlong p_object_id, jstring p_method_name, jobjectArray p_parameters); +JNIEXPORT void JNICALL Java_org_godotengine_godot_variant_Callable_nativeCallObjectDeferred(JNIEnv *p_env, jclass p_clazz, jlong p_object_id, jstring p_method_name, jobjectArray p_parameters); +JNIEXPORT void JNICALL Java_org_godotengine_godot_variant_Callable_releaseNativePointer(JNIEnv *p_env, jclass clazz, jlong p_native_pointer); } diff --git a/platform/linuxbsd/wayland/display_server_wayland.cpp b/platform/linuxbsd/wayland/display_server_wayland.cpp index 0655453fba8..92a3fe2a934 100644 --- a/platform/linuxbsd/wayland/display_server_wayland.cpp +++ b/platform/linuxbsd/wayland/display_server_wayland.cpp @@ -73,11 +73,11 @@ String DisplayServerWayland::_get_app_id_from_context(Context p_context) { switch (p_context) { case CONTEXT_EDITOR: { - app_id = "org.redotengine.Editor"; + app_id = "org.godotengine.Editor"; } break; case CONTEXT_PROJECTMAN: { - app_id = "org.redotengine.ProjectManager"; + app_id = "org.godotengine.ProjectManager"; } break; case CONTEXT_ENGINE: @@ -86,7 +86,7 @@ String DisplayServerWayland::_get_app_id_from_context(Context p_context) { if (config_name.length() != 0) { app_id = config_name; } else { - app_id = "org.redotengine.Redot"; + app_id = "org.godotengine.Redot"; } } } diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index 1fb0c594d7c..070c9967609 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -3641,7 +3641,7 @@ if (was_empty && popup_list.is_empty()) { // Inform OS that popup was opened, to close other native popups. - [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"com.apple.HIToolbox.beginMenuTrackingNotification" object:@"org.redotengine.godot.popup_window"]; + [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"com.apple.HIToolbox.beginMenuTrackingNotification" object:@"org.godotengine.godot.popup_window"]; } time_since_popup = OS::get_singleton()->get_ticks_msec(); popup_list.push_back(p_window); @@ -3666,7 +3666,7 @@ } if (!was_empty && popup_list.is_empty()) { // Inform OS that all popups are closed. - [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"com.apple.HIToolbox.endMenuTrackingNotification" object:@"org.redotengine.godot.popup_window"]; + [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"com.apple.HIToolbox.endMenuTrackingNotification" object:@"org.godotengine.godot.popup_window"]; } } @@ -3684,7 +3684,7 @@ } if (!was_empty) { // Inform OS that all popups are closed. - [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"com.apple.HIToolbox.endMenuTrackingNotification" object:@"org.redotengine.godot.popup_window"]; + [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"com.apple.HIToolbox.endMenuTrackingNotification" object:@"org.godotengine.godot.popup_window"]; } } else { uint64_t delta = OS::get_singleton()->get_ticks_msec() - time_since_popup; @@ -3716,7 +3716,7 @@ } if (!was_empty && popup_list.is_empty()) { // Inform OS that all popups are closed. - [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"com.apple.HIToolbox.endMenuTrackingNotification" object:@"org.redotengine.godot.popup_window"]; + [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"com.apple.HIToolbox.endMenuTrackingNotification" object:@"org.godotengine.godot.popup_window"]; } } return closed; diff --git a/scene/3d/bone_attachment_3d.cpp b/scene/3d/bone_attachment_3d.cpp index 0da4f15d7a0..6e2f3a8418b 100644 --- a/scene/3d/bone_attachment_3d.cpp +++ b/scene/3d/bone_attachment_3d.cpp @@ -154,6 +154,31 @@ void BoneAttachment3D::_check_unbind() { } } +void BoneAttachment3D::_snap_to_bone() { + if (updating) { + return; + } + updating = true; + if (bone_idx >= 0) { + Skeleton3D *sk = get_skeleton(); + if (sk) { + if (!override_pose) { + if (use_external_skeleton) { + set_global_transform(sk->get_global_transform() * sk->get_bone_global_pose(bone_idx)); + } else { + set_transform(sk->get_bone_global_pose(bone_idx)); + } + } else { + if (!_override_dirty) { + _transform_changed(); + _override_dirty = true; + } + } + } + } + updating = false; +} + void BoneAttachment3D::_transform_changed() { if (!is_inside_tree()) { return; @@ -206,6 +231,8 @@ void BoneAttachment3D::set_bone_idx(const int &p_idx) { } } + _snap_to_bone(); + if (is_inside_tree()) { _check_bind(); } else { @@ -294,33 +321,7 @@ void BoneAttachment3D::_notification(int p_what) { } void BoneAttachment3D::on_skeleton_update() { - if (updating) { - return; - } - updating = true; - if (bone_idx >= 0) { - Skeleton3D *sk = get_skeleton(); - if (sk) { - if (!override_pose) { - if (use_external_skeleton) { - if (sk->is_inside_tree()) { - set_global_transform(sk->get_global_transform() * sk->get_bone_global_pose(bone_idx)); - // Else, do nothing, the transform will be set when the skeleton enters the tree: - // Skeleton3D::_notification(NOTIFICATION_ENTER_TREE) -> calls Skeleton3D::_notification(NOTIFICATION_UPDATE_SKELETON) - // -> emits skeleton_updated signal -> connected to BoneAttachment3D::on_skeleton_update() - } - } else { - set_transform(sk->get_bone_global_pose(bone_idx)); - } - } else { - if (!_override_dirty) { - _transform_changed(); - _override_dirty = true; - } - } - } - } - updating = false; + _snap_to_bone(); } #ifdef TOOLS_ENABLED diff --git a/scene/3d/bone_attachment_3d.h b/scene/3d/bone_attachment_3d.h index e508c5adfff..b0b3654ff5a 100644 --- a/scene/3d/bone_attachment_3d.h +++ b/scene/3d/bone_attachment_3d.h @@ -51,6 +51,7 @@ class BoneAttachment3D : public Node3D { void _check_bind(); void _check_unbind(); + void _snap_to_bone(); bool updating = false; void _transform_changed(); diff --git a/scene/3d/physics/area_3d.cpp b/scene/3d/physics/area_3d.cpp index f68bd158ebf..8df3d329923 100644 --- a/scene/3d/physics/area_3d.cpp +++ b/scene/3d/physics/area_3d.cpp @@ -35,6 +35,9 @@ #include "servers/audio_server.h" void Area3D::set_gravity_space_override_mode(SpaceOverride p_mode) { + if (gravity_space_override == p_mode) { + return; + } gravity_space_override = p_mode; PhysicsServer3D::get_singleton()->area_set_param(get_rid(), PhysicsServer3D::AREA_PARAM_GRAVITY_OVERRIDE_MODE, p_mode); } @@ -44,6 +47,9 @@ Area3D::SpaceOverride Area3D::get_gravity_space_override_mode() const { } void Area3D::set_gravity_is_point(bool p_enabled) { + if (gravity_is_point == p_enabled) { + return; + } gravity_is_point = p_enabled; PhysicsServer3D::get_singleton()->area_set_param(get_rid(), PhysicsServer3D::AREA_PARAM_GRAVITY_IS_POINT, p_enabled); } @@ -53,6 +59,9 @@ bool Area3D::is_gravity_a_point() const { } void Area3D::set_gravity_point_unit_distance(real_t p_scale) { + if (gravity_point_unit_distance == p_scale) { + return; + } gravity_point_unit_distance = p_scale; PhysicsServer3D::get_singleton()->area_set_param(get_rid(), PhysicsServer3D::AREA_PARAM_GRAVITY_POINT_UNIT_DISTANCE, p_scale); } @@ -62,6 +71,9 @@ real_t Area3D::get_gravity_point_unit_distance() const { } void Area3D::set_gravity_point_center(const Vector3 &p_center) { + if (gravity_vec == p_center) { + return; + } gravity_vec = p_center; PhysicsServer3D::get_singleton()->area_set_param(get_rid(), PhysicsServer3D::AREA_PARAM_GRAVITY_VECTOR, p_center); } @@ -71,6 +83,9 @@ const Vector3 &Area3D::get_gravity_point_center() const { } void Area3D::set_gravity_direction(const Vector3 &p_direction) { + if (gravity_vec == p_direction) { + return; + } gravity_vec = p_direction; PhysicsServer3D::get_singleton()->area_set_param(get_rid(), PhysicsServer3D::AREA_PARAM_GRAVITY_VECTOR, p_direction); } @@ -80,6 +95,9 @@ const Vector3 &Area3D::get_gravity_direction() const { } void Area3D::set_gravity(real_t p_gravity) { + if (gravity == p_gravity) { + return; + } gravity = p_gravity; PhysicsServer3D::get_singleton()->area_set_param(get_rid(), PhysicsServer3D::AREA_PARAM_GRAVITY, p_gravity); } @@ -89,6 +107,9 @@ real_t Area3D::get_gravity() const { } void Area3D::set_linear_damp_space_override_mode(SpaceOverride p_mode) { + if (linear_damp_space_override == p_mode) { + return; + } linear_damp_space_override = p_mode; PhysicsServer3D::get_singleton()->area_set_param(get_rid(), PhysicsServer3D::AREA_PARAM_LINEAR_DAMP_OVERRIDE_MODE, p_mode); } @@ -98,6 +119,9 @@ Area3D::SpaceOverride Area3D::get_linear_damp_space_override_mode() const { } void Area3D::set_angular_damp_space_override_mode(SpaceOverride p_mode) { + if (angular_damp_space_override == p_mode) { + return; + } angular_damp_space_override = p_mode; PhysicsServer3D::get_singleton()->area_set_param(get_rid(), PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP_OVERRIDE_MODE, p_mode); } @@ -107,6 +131,9 @@ Area3D::SpaceOverride Area3D::get_angular_damp_space_override_mode() const { } void Area3D::set_linear_damp(real_t p_linear_damp) { + if (linear_damp == p_linear_damp) { + return; + } linear_damp = p_linear_damp; PhysicsServer3D::get_singleton()->area_set_param(get_rid(), PhysicsServer3D::AREA_PARAM_LINEAR_DAMP, p_linear_damp); } @@ -116,6 +143,9 @@ real_t Area3D::get_linear_damp() const { } void Area3D::set_angular_damp(real_t p_angular_damp) { + if (angular_damp == p_angular_damp) { + return; + } angular_damp = p_angular_damp; PhysicsServer3D::get_singleton()->area_set_param(get_rid(), PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP, p_angular_damp); } @@ -125,6 +155,9 @@ real_t Area3D::get_angular_damp() const { } void Area3D::set_priority(int p_priority) { + if (priority == p_priority) { + return; + } priority = p_priority; PhysicsServer3D::get_singleton()->area_set_param(get_rid(), PhysicsServer3D::AREA_PARAM_PRIORITY, p_priority); } @@ -134,6 +167,9 @@ int Area3D::get_priority() const { } void Area3D::set_wind_force_magnitude(real_t p_wind_force_magnitude) { + if (wind_force_magnitude == p_wind_force_magnitude) { + return; + } wind_force_magnitude = p_wind_force_magnitude; if (is_inside_tree()) { _initialize_wind(); @@ -145,6 +181,9 @@ real_t Area3D::get_wind_force_magnitude() const { } void Area3D::set_wind_attenuation_factor(real_t p_wind_force_attenuation_factor) { + if (wind_attenuation_factor == p_wind_force_attenuation_factor) { + return; + } wind_attenuation_factor = p_wind_force_attenuation_factor; if (is_inside_tree()) { _initialize_wind(); @@ -156,6 +195,9 @@ real_t Area3D::get_wind_attenuation_factor() const { } void Area3D::set_wind_source_path(const NodePath &p_wind_source_path) { + if (wind_source_path == p_wind_source_path) { + return; + } wind_source_path = p_wind_source_path; if (is_inside_tree()) { _initialize_wind(); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index ed183846136..5581e72a51d 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -8605,9 +8605,12 @@ void TextEdit::_update_scrollbars() { updating_scrolls = true; if (!fit_content_height && total_rows > visible_rows) { + double visible_rows_exact = (double)_get_control_height() / (double)get_line_height(); + double fractional_visible_rows = visible_rows_exact - (double)visible_rows; + fractional_visible_rows = CLAMP(fractional_visible_rows, 0.0, 1.0); v_scroll->show(); - v_scroll->set_max(total_rows + _get_visible_lines_offset()); - v_scroll->set_page(visible_rows + _get_visible_lines_offset()); + v_scroll->set_max(total_rows); + v_scroll->set_page(visible_rows + fractional_visible_rows); set_v_scroll(get_v_scroll()); } else { first_visible_line = 0; diff --git a/scene/main/multiplayer_peer.cpp b/scene/main/multiplayer_peer.cpp index 689e664860d..73ed706dc0e 100644 --- a/scene/main/multiplayer_peer.cpp +++ b/scene/main/multiplayer_peer.cpp @@ -153,6 +153,7 @@ Error MultiplayerPeerExtension::get_packet(const uint8_t **r_buffer, int &r_buff } Error MultiplayerPeerExtension::put_packet(const uint8_t *p_buffer, int p_buffer_size) { + ERR_FAIL_COND_V(p_buffer_size < 0, ERR_INVALID_PARAMETER); Error err; if (GDVIRTUAL_CALL(_put_packet, p_buffer, p_buffer_size, err)) { return err; diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp index d9bac796d96..173179b268c 100644 --- a/scene/main/timer.cpp +++ b/scene/main/timer.cpp @@ -50,10 +50,18 @@ void Timer::_notification(int p_what) { if (!processing || timer_process_callback == TIMER_PROCESS_PHYSICS || !is_processing_internal()) { return; } - if (ignore_time_scale) { - time_left -= Engine::get_singleton()->get_process_step(); - } else { - time_left -= get_process_delta_time(); + + switch (timer_process_type) { + case TIMER_PROCESS_TYPE_TIME: { + if (ignore_time_scale) { + time_left -= Engine::get_singleton()->get_process_step(); + } else { + time_left -= get_process_delta_time(); + } + } break; + case TIMER_PROCESS_TYPE_FRAMES: { + time_left -= 1; + } break; } if (time_left < 0) { @@ -71,10 +79,18 @@ void Timer::_notification(int p_what) { if (!processing || timer_process_callback == TIMER_PROCESS_IDLE || !is_physics_processing_internal()) { return; } - if (ignore_time_scale) { - time_left -= Engine::get_singleton()->get_process_step(); - } else { - time_left -= get_physics_process_delta_time(); + + switch (timer_process_type) { + case TIMER_PROCESS_TYPE_TIME: { + if (ignore_time_scale) { + time_left -= Engine::get_singleton()->get_process_step(); + } else { + time_left -= get_physics_process_delta_time(); + } + } break; + case TIMER_PROCESS_TYPE_FRAMES: { + time_left -= 1; + } break; } if (time_left < 0) { @@ -91,7 +107,12 @@ void Timer::_notification(int p_what) { void Timer::set_wait_time(double p_time) { ERR_FAIL_COND_MSG(p_time <= 0, "Time should be greater than zero."); - wait_time = p_time; + if (timer_process_type == TIMER_PROCESS_TYPE_FRAMES) { + ERR_FAIL_COND_MSG(p_time != (int)p_time, "Frame mode only accepts non-fractional values. (Frames will be rounded.)"); + wait_time = (int)p_time; + } else { + wait_time = p_time; + } update_configuration_warnings(); } @@ -165,19 +186,19 @@ void Timer::set_timer_process_callback(TimerProcessCallback p_callback) { return; } - switch (timer_process_callback) { + switch (p_callback) { case TIMER_PROCESS_PHYSICS: - if (is_physics_processing_internal()) { - set_physics_process_internal(false); - set_process_internal(true); - } - break; - case TIMER_PROCESS_IDLE: if (is_processing_internal()) { set_process_internal(false); set_physics_process_internal(true); } break; + case TIMER_PROCESS_IDLE: + if (is_physics_processing_internal()) { + set_physics_process_internal(false); + set_process_internal(true); + } + break; } timer_process_callback = p_callback; } @@ -186,6 +207,26 @@ Timer::TimerProcessCallback Timer::get_timer_process_callback() const { return timer_process_callback; } +void Timer::set_timer_process_type(TimerProcessType p_type) { + if (timer_process_type == p_type) { + return; + } + switch (timer_process_type) { + case TIMER_PROCESS_TYPE_FRAMES: { + wait_time = (int)wait_time; + time_left = (int)time_left; + }; break; + case TIMER_PROCESS_TYPE_TIME: + break; + } + timer_process_type = p_type; + notify_property_list_changed(); +} + +Timer::TimerProcessType Timer::get_timer_process_type() const { + return timer_process_type; +} + void Timer::_set_process(bool p_process, bool p_force) { switch (timer_process_callback) { case TIMER_PROCESS_PHYSICS: @@ -208,6 +249,14 @@ PackedStringArray Timer::get_configuration_warnings() const { return warnings; } +void Timer::_validate_property(PropertyInfo &p_property) const { + if (timer_process_type == TIMER_PROCESS_TYPE_FRAMES && p_property.name == "wait_time") { + p_property.type = Variant::INT; + p_property.hint = PROPERTY_HINT_NONE; + p_property.hint_string = "suffix:f"; + } +} + void Timer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_wait_time", "time_sec"), &Timer::set_wait_time); ClassDB::bind_method(D_METHOD("get_wait_time"), &Timer::get_wait_time); @@ -234,9 +283,13 @@ void Timer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_timer_process_callback", "callback"), &Timer::set_timer_process_callback); ClassDB::bind_method(D_METHOD("get_timer_process_callback"), &Timer::get_timer_process_callback); + ClassDB::bind_method(D_METHOD("set_timer_process_type", "type"), &Timer::set_timer_process_type); + ClassDB::bind_method(D_METHOD("get_timer_process_type"), &Timer::get_timer_process_type); + ADD_SIGNAL(MethodInfo("timeout")); ADD_PROPERTY(PropertyInfo(Variant::INT, "process_callback", PROPERTY_HINT_ENUM, "Physics,Idle"), "set_timer_process_callback", "get_timer_process_callback"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "process_type", PROPERTY_HINT_ENUM, "Time,Frames"), "set_timer_process_type", "get_timer_process_type"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "wait_time", PROPERTY_HINT_RANGE, "0.001,4096,0.001,or_greater,exp,suffix:s"), "set_wait_time", "get_wait_time"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "one_shot"), "set_one_shot", "is_one_shot"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "autostart"), "set_autostart", "has_autostart"); @@ -246,4 +299,8 @@ void Timer::_bind_methods() { BIND_ENUM_CONSTANT(TIMER_PROCESS_PHYSICS); BIND_ENUM_CONSTANT(TIMER_PROCESS_IDLE); + + // bind enums + BIND_ENUM_CONSTANT(TIMER_PROCESS_TYPE_TIME); + BIND_ENUM_CONSTANT(TIMER_PROCESS_TYPE_FRAMES); } diff --git a/scene/main/timer.h b/scene/main/timer.h index 7a4518d891b..1ed93993c43 100644 --- a/scene/main/timer.h +++ b/scene/main/timer.h @@ -49,6 +49,7 @@ class Timer : public Node { protected: void _notification(int p_what); static void _bind_methods(); + void _validate_property(PropertyInfo &p_property) const; public: enum TimerProcessCallback { @@ -56,6 +57,13 @@ class Timer : public Node { TIMER_PROCESS_IDLE, }; + // Type instead of Mode to prevent name collisions when upgrading from 3 to 4 + // Godot 3 used TimerProcessMode which is now TimerProcessCallback + enum TimerProcessType { + TIMER_PROCESS_TYPE_TIME, + TIMER_PROCESS_TYPE_FRAMES, + }; + void set_wait_time(double p_time); double get_wait_time() const; @@ -83,9 +91,14 @@ class Timer : public Node { void set_timer_process_callback(TimerProcessCallback p_callback); TimerProcessCallback get_timer_process_callback() const; + void set_timer_process_type(TimerProcessType p_type); + TimerProcessType get_timer_process_type() const; + private: TimerProcessCallback timer_process_callback = TIMER_PROCESS_IDLE; + TimerProcessType timer_process_type = TIMER_PROCESS_TYPE_TIME; void _set_process(bool p_process, bool p_force = false); }; VARIANT_ENUM_CAST(Timer::TimerProcessCallback); +VARIANT_ENUM_CAST(Timer::TimerProcessType); diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 01fe9b45f47..e41faaf1aca 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -160,6 +160,7 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const { const NodeData *nd = &nodes[0]; Node **ret_nodes = (Node **)alloca(sizeof(Node *) * nc); + ret_nodes[0] = nullptr; // Sidesteps "maybe uninitialized" false-positives on GCC. bool gen_node_path_cache = p_edit_state != GEN_EDIT_STATE_DISABLED && node_path_cache.is_empty(); diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index 4e06f8b42d9..20e7f3c7f46 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -272,7 +272,7 @@ Ref ResourceLoaderText::_parse_node_tag(VariantParser::ResourcePars String assign; Variant value; - error = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, &parser); + error = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, &parser, false, true); if (error) { if (error == ERR_FILE_MISSING_DEPENDENCIES) { @@ -355,7 +355,7 @@ Ref ResourceLoaderText::_parse_node_tag(VariantParser::ResourcePars unbinds, bind_ints); - error = VariantParser::parse_tag(&stream, lines, error_text, next_tag, &parser); + error = VariantParser::parse_tag(&stream, lines, error_text, next_tag, &parser, false, true); if (error) { if (error != ERR_FILE_EOF) { @@ -378,7 +378,7 @@ Ref ResourceLoaderText::_parse_node_tag(VariantParser::ResourcePars packed_scene->get_state()->add_editable_instance(path.simplified()); - error = VariantParser::parse_tag(&stream, lines, error_text, next_tag, &parser); + error = VariantParser::parse_tag(&stream, lines, error_text, next_tag, &parser, false, true); if (error) { if (error != ERR_FILE_EOF) { @@ -474,7 +474,7 @@ Error ResourceLoaderText::load() { } } - error = VariantParser::parse_tag(&stream, lines, error_text, next_tag, &rp); + error = VariantParser::parse_tag(&stream, lines, error_text, next_tag, &rp, false, true); if (error) { _printerr(); @@ -594,7 +594,7 @@ Error ResourceLoaderText::load() { String assign; Variant value; - error = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, &rp); + error = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, &rp, false, true); if (error) { _printerr(); @@ -723,7 +723,7 @@ Error ResourceLoaderText::load() { String assign; Variant value; - error = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, &rp); + error = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, &rp, false, true); if (error) { if (error != ERR_FILE_EOF) { @@ -927,7 +927,7 @@ void ResourceLoaderText::get_dependencies(Ref p_f, List *p_d p_dependencies->push_back(path); - Error err = VariantParser::parse_tag(&stream, lines, error_text, next_tag, &rp); + Error err = VariantParser::parse_tag(&stream, lines, error_text, next_tag, &rp, false, true); if (err) { print_line(error_text + " - " + itos(lines)); @@ -952,7 +952,7 @@ Error ResourceLoaderText::rename_dependencies(Ref p_f, const String uint64_t tag_end = f->get_position(); while (true) { - Error err = VariantParser::parse_tag(&stream, lines, error_text, next_tag, &rp); + Error err = VariantParser::parse_tag(&stream, lines, error_text, next_tag, &rp, false, true); if (err != OK) { error = ERR_FILE_CORRUPT; @@ -1081,7 +1081,7 @@ void ResourceLoaderText::open(Ref p_f, bool p_skip_first_tag) { resource_current = 0; VariantParser::Tag tag; - Error err = VariantParser::parse_tag(&stream, lines, error_text, tag); + Error err = VariantParser::parse_tag(&stream, lines, error_text, tag, nullptr, false, true); if (err) { error = err; @@ -1138,7 +1138,7 @@ void ResourceLoaderText::open(Ref p_f, bool p_skip_first_tag) { } if (!p_skip_first_tag) { - err = VariantParser::parse_tag(&stream, lines, error_text, next_tag, &rp); + err = VariantParser::parse_tag(&stream, lines, error_text, next_tag, &rp, false, true); if (err) { error_text = "Unexpected end of file"; @@ -1167,7 +1167,7 @@ Error ResourceLoaderText::get_classes_used(HashSet *r_classes) { rp_new.userdata = &dummy_read; while (next_tag.name == "ext_resource") { - error = VariantParser::parse_tag(&stream, lines, error_text, next_tag, &rp_new); + error = VariantParser::parse_tag(&stream, lines, error_text, next_tag, &rp_new, false, true); if (error) { _printerr(); @@ -1194,7 +1194,7 @@ Error ResourceLoaderText::get_classes_used(HashSet *r_classes) { String assign; Variant value; - error = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, &rp_new); + error = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, &rp_new, false, true); if (error) { if (error == ERR_FILE_EOF) { @@ -1237,7 +1237,7 @@ Error ResourceLoaderText::get_classes_used(HashSet *r_classes) { String assign; Variant value; - error = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, &rp_new); + error = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, &rp_new, false, true); if (error) { if (error == ERR_FILE_MISSING_DEPENDENCIES) { @@ -1278,7 +1278,7 @@ String ResourceLoaderText::recognize_script_class(Ref p_f) { ignore_resource_parsing = true; VariantParser::Tag tag; - Error err = VariantParser::parse_tag(&stream, lines, error_text, tag); + Error err = VariantParser::parse_tag(&stream, lines, error_text, tag, nullptr, false, true); if (err) { _printerr(); @@ -1316,7 +1316,7 @@ String ResourceLoaderText::recognize(Ref p_f) { ignore_resource_parsing = true; VariantParser::Tag tag; - Error err = VariantParser::parse_tag(&stream, lines, error_text, tag); + Error err = VariantParser::parse_tag(&stream, lines, error_text, tag, nullptr, false, true); if (err) { _printerr(); @@ -1360,7 +1360,7 @@ ResourceUID::ID ResourceLoaderText::get_uid(Ref p_f) { ignore_resource_parsing = true; VariantParser::Tag tag; - Error err = VariantParser::parse_tag(&stream, lines, error_text, tag); + Error err = VariantParser::parse_tag(&stream, lines, error_text, tag, nullptr, false, true); if (err) { _printerr(); @@ -1948,7 +1948,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const Refstore_string(name.property_name_encode() + " = " + vars + "\n"); } } @@ -2012,14 +2012,14 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const Refstore_string(" instance_placeholder="); - VariantWriter::write_to_string(instance_placeholder, vars, _write_resources, this, use_compat); + VariantWriter::write_to_string(instance_placeholder, vars, _write_resources, this, use_compat, true); f->store_string(vars); } if (instance.is_valid()) { String vars; f->store_string(" instance="); - VariantWriter::write_to_string(instance, vars, _write_resources, this, use_compat); + VariantWriter::write_to_string(instance, vars, _write_resources, this, use_compat, true); f->store_string(vars); } @@ -2027,7 +2027,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const Refget_node_property_count(i); j++) { String vars; - VariantWriter::write_to_string(state->get_node_property_value(i, j), vars, _write_resources, this, use_compat); + VariantWriter::write_to_string(state->get_node_property_value(i, j), vars, _write_resources, this, use_compat, true); f->store_string(String(state->get_node_property_name(i, j)).property_name_encode() + " = " + vars + "\n"); } @@ -2061,7 +2061,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const Refstore_string(connstr); if (binds.size()) { String vars; - VariantWriter::write_to_string(binds, vars, _write_resources, this, use_compat); + VariantWriter::write_to_string(binds, vars, _write_resources, this, use_compat, true); f->store_string(" binds= " + vars); } diff --git a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp index b1658030e39..b133efac0d0 100644 --- a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp +++ b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp @@ -305,13 +305,14 @@ template draw_list_bind_uniform_set(draw_list, render_base_uniform_set, SCENE_UNIFORM_SET); - RD::get_singleton()->draw_list_bind_uniform_set(draw_list, p_params->render_pass_uniform_set, RENDER_PASS_UNIFORM_SET); - RD::get_singleton()->draw_list_bind_uniform_set(draw_list, scene_shader.default_vec4_xform_uniform_set, TRANSFORMS_UNIFORM_SET); + rd->draw_list_bind_uniform_set(draw_list, render_base_uniform_set, SCENE_UNIFORM_SET); + rd->draw_list_bind_uniform_set(draw_list, p_params->render_pass_uniform_set, RENDER_PASS_UNIFORM_SET); + rd->draw_list_bind_uniform_set(draw_list, scene_shader.default_vec4_xform_uniform_set, TRANSFORMS_UNIFORM_SET); RID prev_material_uniform_set; @@ -342,13 +343,17 @@ void RenderForwardClustered::_render_list_template(RenderingDevice::DrawListID p const GeometryInstanceSurfaceDataCache *surf = p_params->elements[i]; const RenderElementInfo &element_info = p_params->element_info[i]; + auto *owner = surf->owner; + auto base_flags = owner->base_flags; + auto owner_instance_count = owner->instance_count; + if (p_pass_mode == PASS_MODE_COLOR && surf->color_pass_inclusion_mask && (p_color_pass_flags & surf->color_pass_inclusion_mask) == 0) { // Some surfaces can be repeated in multiple render lists. We exclude them from being rendered on the color pass based on the // features supported by the pass compared to the exclusion mask. continue; } - if (surf->owner->instance_count == 0) { + if (owner_instance_count == 0) { continue; } @@ -405,7 +410,7 @@ void RenderForwardClustered::_render_list_template(RenderingDevice::DrawListID p } if (cull_variant == SceneShaderForwardClustered::ShaderData::CULL_VARIANT_MAX) { - bool mirror = surf->owner->mirror; + bool mirror = owner->mirror; if (p_params->reverse_cull) { mirror = !mirror; } @@ -416,13 +421,13 @@ void RenderForwardClustered::_render_list_template(RenderingDevice::DrawListID p pipeline_key.primitive_type = surf->primitive; - RID xforms_uniform_set = surf->owner->transforms_uniform_set; + RID xforms_uniform_set = owner->transforms_uniform_set; SceneShaderForwardClustered::ShaderSpecialization pipeline_specialization = p_params->base_specialization; - pipeline_specialization.multimesh = bool(surf->owner->base_flags & INSTANCE_DATA_FLAG_MULTIMESH); - pipeline_specialization.multimesh_format_2d = bool(surf->owner->base_flags & INSTANCE_DATA_FLAG_MULTIMESH_FORMAT_2D); - pipeline_specialization.multimesh_has_color = bool(surf->owner->base_flags & INSTANCE_DATA_FLAG_MULTIMESH_HAS_COLOR); - pipeline_specialization.multimesh_has_custom_data = bool(surf->owner->base_flags & INSTANCE_DATA_FLAG_MULTIMESH_HAS_CUSTOM_DATA); + pipeline_specialization.multimesh = bool(base_flags & INSTANCE_DATA_FLAG_MULTIMESH); + pipeline_specialization.multimesh_format_2d = bool(base_flags & INSTANCE_DATA_FLAG_MULTIMESH_FORMAT_2D); + pipeline_specialization.multimesh_has_color = bool(base_flags & INSTANCE_DATA_FLAG_MULTIMESH_HAS_COLOR); + pipeline_specialization.multimesh_has_custom_data = bool(base_flags & INSTANCE_DATA_FLAG_MULTIMESH_HAS_CUSTOM_DATA); if constexpr (p_pass_mode == PASS_MODE_COLOR) { pipeline_specialization.use_light_soft_shadows = element_info.uses_softshadow; @@ -502,8 +507,8 @@ void RenderForwardClustered::_render_list_template(RenderingDevice::DrawListID p RD::VertexFormatID vertex_format = -1; bool pipeline_motion_vectors = pipeline_key.color_pass_flags & SceneShaderForwardClustered::PIPELINE_COLOR_PASS_FLAG_MOTION_VECTORS; uint64_t input_mask = shader->get_vertex_input_mask(pipeline_key.version, pipeline_key.color_pass_flags, pipeline_key.ubershader); - if (surf->owner->mesh_instance.is_valid()) { - mesh_storage->mesh_instance_surface_get_vertex_arrays_and_format(surf->owner->mesh_instance, surf->surface_index, input_mask, pipeline_motion_vectors, vertex_array_rd, vertex_format); + if (owner->mesh_instance.is_valid()) { + mesh_storage->mesh_instance_surface_get_vertex_arrays_and_format(owner->mesh_instance, surf->surface_index, input_mask, pipeline_motion_vectors, vertex_array_rd, vertex_format); } else { mesh_storage->mesh_surface_get_vertex_arrays_and_format(mesh_surface, input_mask, pipeline_motion_vectors, vertex_array_rd, vertex_format); } @@ -544,39 +549,39 @@ void RenderForwardClustered::_render_list_template(RenderingDevice::DrawListID p index_array_rd = mesh_storage->mesh_surface_get_index_array(mesh_surface, element_info.lod_index); if (prev_vertex_array_rd != vertex_array_rd) { - RD::get_singleton()->draw_list_bind_vertex_array(draw_list, vertex_array_rd); + rd->draw_list_bind_vertex_array(draw_list, vertex_array_rd); prev_vertex_array_rd = vertex_array_rd; } if (prev_index_array_rd != index_array_rd) { if (index_array_rd.is_valid()) { - RD::get_singleton()->draw_list_bind_index_array(draw_list, index_array_rd); + rd->draw_list_bind_index_array(draw_list, index_array_rd); } prev_index_array_rd = index_array_rd; } if (!pipeline_rd.is_null()) { - RD::get_singleton()->draw_list_bind_render_pipeline(draw_list, pipeline_rd); + rd->draw_list_bind_render_pipeline(draw_list, pipeline_rd); } if (xforms_uniform_set.is_valid() && prev_xforms_uniform_set != xforms_uniform_set) { - RD::get_singleton()->draw_list_bind_uniform_set(draw_list, xforms_uniform_set, TRANSFORMS_UNIFORM_SET); + rd->draw_list_bind_uniform_set(draw_list, xforms_uniform_set, TRANSFORMS_UNIFORM_SET); prev_xforms_uniform_set = xforms_uniform_set; } if (material_uniform_set != prev_material_uniform_set) { // Update uniform set. - if (material_uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(material_uniform_set)) { // Material may not have a uniform set. - RD::get_singleton()->draw_list_bind_uniform_set(draw_list, material_uniform_set, MATERIAL_UNIFORM_SET); + if (material_uniform_set.is_valid() && rd->uniform_set_is_valid(material_uniform_set)) { // Material may not have a uniform set. + rd->draw_list_bind_uniform_set(draw_list, material_uniform_set, MATERIAL_UNIFORM_SET); } prev_material_uniform_set = material_uniform_set; } - if (surf->owner->base_flags & INSTANCE_DATA_FLAG_PARTICLES) { - particles_storage->particles_get_instance_buffer_motion_vectors_offsets(surf->owner->data->base, push_constant.multimesh_motion_vectors_current_offset, push_constant.multimesh_motion_vectors_previous_offset); - } else if (surf->owner->base_flags & INSTANCE_DATA_FLAG_MULTIMESH) { - mesh_storage->_multimesh_get_motion_vectors_offsets(surf->owner->data->base, push_constant.multimesh_motion_vectors_current_offset, push_constant.multimesh_motion_vectors_previous_offset); + if (base_flags & INSTANCE_DATA_FLAG_PARTICLES) { + particles_storage->particles_get_instance_buffer_motion_vectors_offsets(owner->data->base, push_constant.multimesh_motion_vectors_current_offset, push_constant.multimesh_motion_vectors_previous_offset); + } else if (base_flags & INSTANCE_DATA_FLAG_MULTIMESH) { + mesh_storage->_multimesh_get_motion_vectors_offsets(owner->data->base, push_constant.multimesh_motion_vectors_current_offset, push_constant.multimesh_motion_vectors_previous_offset); } else { push_constant.multimesh_motion_vectors_current_offset = 0; push_constant.multimesh_motion_vectors_previous_offset = 0; @@ -592,17 +597,17 @@ void RenderForwardClustered::_render_list_template(RenderingDevice::DrawListID p push_constant_size = sizeof(SceneState::PushConstant) - sizeof(SceneState::PushConstantUbershader); } - RD::get_singleton()->draw_list_set_push_constant(draw_list, &push_constant, push_constant_size); + rd->draw_list_set_push_constant(draw_list, &push_constant, push_constant_size); - uint32_t instance_count = surf->owner->instance_count > 1 ? surf->owner->instance_count : element_info.repeat; + uint32_t instance_count = owner_instance_count > 1 ? owner_instance_count : element_info.repeat; if (surf->flags & GeometryInstanceSurfaceDataCache::FLAG_USES_PARTICLE_TRAILS) { - instance_count /= surf->owner->trail_steps; + instance_count /= owner->trail_steps; } - if (bool(surf->owner->base_flags & INSTANCE_DATA_FLAG_MULTIMESH_INDIRECT)) { - RD::get_singleton()->draw_list_draw_indirect(draw_list, index_array_rd.is_valid(), mesh_storage->_multimesh_get_command_buffer_rd_rid(surf->owner->data->base), surf->surface_index * sizeof(uint32_t) * mesh_storage->INDIRECT_MULTIMESH_COMMAND_STRIDE, 1, 0); + if (bool(base_flags & INSTANCE_DATA_FLAG_MULTIMESH_INDIRECT)) { + rd->draw_list_draw_indirect(draw_list, index_array_rd.is_valid(), mesh_storage->_multimesh_get_command_buffer_rd_rid(owner->data->base), surf->surface_index * sizeof(uint32_t) * mesh_storage->INDIRECT_MULTIMESH_COMMAND_STRIDE, 1, 0); } else { - RD::get_singleton()->draw_list_draw(draw_list, index_array_rd.is_valid(), instance_count); + rd->draw_list_draw(draw_list, index_array_rd.is_valid(), instance_count); } } diff --git a/servers/rendering/renderer_scene_cull.cpp b/servers/rendering/renderer_scene_cull.cpp index 5e37492be02..7c946a80900 100644 --- a/servers/rendering/renderer_scene_cull.cpp +++ b/servers/rendering/renderer_scene_cull.cpp @@ -2816,8 +2816,13 @@ void RendererSceneCull::_scene_cull_threaded(uint32_t p_thread, CullData *cull_d } void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cull_result, uint64_t p_from, uint64_t p_to) { - uint64_t frame_number = RSG::rasterizer->get_frame_number(); - float lightmap_probe_update_speed = RSG::light_storage->lightmap_get_probe_capture_update_speed() * RSG::rasterizer->get_frame_delta_time(); + auto *rasterizer = RSG::rasterizer; + auto *ls = RSG::light_storage; + auto *ps = RSG::particles_storage; + auto *rs = RS::get_singleton(); + + uint64_t frame_number = rasterizer->get_frame_number(); + float lightmap_probe_update_speed = ls->lightmap_get_probe_capture_update_speed() * rasterizer->get_frame_delta_time(); uint32_t sdfgi_last_light_index = 0xFFFFFFFF; uint32_t sdfgi_last_light_cascade = 0xFFFFFFFF; @@ -2827,36 +2832,48 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul Transform3D inv_cam_transform = cull_data.cam_transform.inverse(); float z_near = cull_data.camera_matrix->get_z_near(); + const Vector3 cam_origin = cull_data.cam_transform.origin; + const Basis cam_basis = cull_data.cam_transform.basis; + const Vector3 view_forward = -cam_basis.get_column(2).normalized(); + const Vector3 view_up = cam_basis.get_column(1).normalized(); + + static const Callable base_callable = callable_mp_static(&RendererSceneCull::_scene_particles_set_view_axis); + for (uint64_t i = p_from; i < p_to; i++) { bool mesh_visible = false; InstanceData &idata = cull_data.scenario->instance_data[i]; + const uint32_t base_type = idata.flags & InstanceData::FLAG_BASE_TYPE_MASK; + const uint32_t layer_mask = idata.layer_mask; uint32_t visibility_flags = idata.flags & (InstanceData::FLAG_VISIBILITY_DEPENDENCY_HIDDEN_CLOSE_RANGE | InstanceData::FLAG_VISIBILITY_DEPENDENCY_HIDDEN | InstanceData::FLAG_VISIBILITY_DEPENDENCY_FADE_CHILDREN); int32_t visibility_check = -1; + const RID instance_rid = RID::from_uint64(idata.instance_data_rid); + + const auto &aabb = cull_data.scenario->instance_aabbs[i]; + #define HIDDEN_BY_VISIBILITY_CHECKS (visibility_flags == InstanceData::FLAG_VISIBILITY_DEPENDENCY_HIDDEN_CLOSE_RANGE || visibility_flags == InstanceData::FLAG_VISIBILITY_DEPENDENCY_HIDDEN) -#define LAYER_CHECK (cull_data.visible_layers & idata.layer_mask) -#define IN_FRUSTUM(f) (cull_data.scenario->instance_aabbs[i].in_frustum(f)) -#define VIS_RANGE_CHECK ((idata.visibility_index == -1) || _visibility_range_check(cull_data.scenario->instance_visibility[idata.visibility_index], cull_data.cam_transform.origin, cull_data.visibility_viewport_mask) == 0) +#define LAYER_CHECK (cull_data.visible_layers & layer_mask) +#define IN_FRUSTUM(f) (aabb.in_frustum(f)) +#define VIS_RANGE_CHECK ((idata.visibility_index == -1) || _visibility_range_check(cull_data.scenario->instance_visibility[idata.visibility_index], cam_origin, cull_data.visibility_viewport_mask) == 0) #define VIS_PARENT_CHECK (_visibility_parent_check(cull_data, idata)) #define VIS_CHECK (visibility_check < 0 ? (visibility_check = (visibility_flags != InstanceData::FLAG_VISIBILITY_DEPENDENCY_NEEDS_CHECK || (VIS_RANGE_CHECK && VIS_PARENT_CHECK))) : visibility_check) -#define OCCLUSION_CULLED (cull_data.occlusion_buffer != nullptr && (cull_data.scenario->instance_data[i].flags & InstanceData::FLAG_IGNORE_OCCLUSION_CULLING) == 0 && cull_data.occlusion_buffer->is_occluded(cull_data.scenario->instance_aabbs[i].bounds, cull_data.cam_transform.origin, inv_cam_transform, *cull_data.camera_matrix, z_near, cull_data.scenario->instance_data[i].occlusion_timeout)) +#define OCCLUSION_CULLED (cull_data.occlusion_buffer != nullptr && (idata.flags & InstanceData::FLAG_IGNORE_OCCLUSION_CULLING) == 0 && cull_data.occlusion_buffer->is_occluded(aabb.bounds, cam_origin, inv_cam_transform, *cull_data.camera_matrix, z_near, idata.occlusion_timeout)) if (!HIDDEN_BY_VISIBILITY_CHECKS) { - if ((LAYER_CHECK && IN_FRUSTUM(cull_data.cull->frustum) && VIS_CHECK && !OCCLUSION_CULLED) || (cull_data.scenario->instance_data[i].flags & InstanceData::FLAG_IGNORE_ALL_CULLING)) { - uint32_t base_type = idata.flags & InstanceData::FLAG_BASE_TYPE_MASK; + if ((LAYER_CHECK && IN_FRUSTUM(cull_data.cull->frustum) && VIS_CHECK && !OCCLUSION_CULLED) || (idata.flags & InstanceData::FLAG_IGNORE_ALL_CULLING)) { if (base_type == RS::INSTANCE_LIGHT) { cull_result.lights.push_back(idata.instance); - cull_result.light_instances.push_back(RID::from_uint64(idata.instance_data_rid)); - if (cull_data.shadow_atlas.is_valid() && RSG::light_storage->light_has_shadow(idata.base_rid)) { - RSG::light_storage->light_instance_mark_visible(RID::from_uint64(idata.instance_data_rid)); //mark it visible for shadow allocation later + cull_result.light_instances.push_back(instance_rid); + if (cull_data.shadow_atlas.is_valid() && ls->light_has_shadow(idata.base_rid)) { + ls->light_instance_mark_visible(instance_rid); //mark it visible for shadow allocation later } } else if (base_type == RS::INSTANCE_REFLECTION_PROBE) { if (cull_data.render_reflection_probe != idata.instance) { //avoid entering The Matrix - if ((idata.flags & InstanceData::FLAG_REFLECTION_PROBE_DIRTY) || RSG::light_storage->reflection_probe_instance_needs_redraw(RID::from_uint64(idata.instance_data_rid))) { + if ((idata.flags & InstanceData::FLAG_REFLECTION_PROBE_DIRTY) || ls->reflection_probe_instance_needs_redraw(instance_rid)) { InstanceReflectionProbeData *reflection_probe = static_cast(idata.instance->base_data); cull_data.cull->lock.lock(); if (!reflection_probe->update_list.in_list()) { @@ -2868,12 +2885,12 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul idata.flags &= ~InstanceData::FLAG_REFLECTION_PROBE_DIRTY; } - if (RSG::light_storage->reflection_probe_instance_has_reflection(RID::from_uint64(idata.instance_data_rid))) { - cull_result.reflections.push_back(RID::from_uint64(idata.instance_data_rid)); + if (ls->reflection_probe_instance_has_reflection(instance_rid)) { + cull_result.reflections.push_back(instance_rid); } } } else if (base_type == RS::INSTANCE_DECAL) { - cull_result.decals.push_back(RID::from_uint64(idata.instance_data_rid)); + cull_result.decals.push_back(instance_rid); } else if (base_type == RS::INSTANCE_VOXEL_GI) { InstanceVoxelGIData *voxel_gi = static_cast(idata.instance->base_data); @@ -2882,12 +2899,12 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul voxel_gi_update_list.add(&voxel_gi->update_element); } cull_data.cull->lock.unlock(); - cull_result.voxel_gi_instances.push_back(RID::from_uint64(idata.instance_data_rid)); + cull_result.voxel_gi_instances.push_back(instance_rid); } else if (base_type == RS::INSTANCE_LIGHTMAP) { - cull_result.lightmaps.push_back(RID::from_uint64(idata.instance_data_rid)); + cull_result.lightmaps.push_back(instance_rid); } else if (base_type == RS::INSTANCE_FOG_VOLUME) { - cull_result.fog_volumes.push_back(RID::from_uint64(idata.instance_data_rid)); + cull_result.fog_volumes.push_back(instance_rid); } else if (base_type == RS::INSTANCE_VISIBLITY_NOTIFIER) { InstanceVisibilityNotifierData *vnd = idata.visibility_notifier; if (!vnd->list_element.in_list()) { @@ -2896,7 +2913,7 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul visible_notifier_list_lock.unlock(); vnd->just_visible = true; } - vnd->visible_in_frame = RSG::rasterizer->get_frame_number(); + vnd->visible_in_frame = frame_number; } else if (((1 << base_type) & RS::INSTANCE_GEOMETRY_MASK) && !(idata.flags & InstanceData::FLAG_CAST_SHADOWS_ONLY)) { bool keep = true; @@ -2908,15 +2925,15 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul mesh_visible = true; } else if (base_type == RS::INSTANCE_PARTICLES) { //particles visible? process them - if (RSG::particles_storage->particles_is_inactive(idata.base_rid)) { + if (ps->particles_is_inactive(idata.base_rid)) { //but if nothing is going on, don't do it. keep = false; } else { cull_data.cull->lock.lock(); - RSG::particles_storage->particles_request_process(idata.base_rid); + ps->particles_request_process(idata.base_rid); cull_data.cull->lock.unlock(); - RS::get_singleton()->call_on_render_thread(callable_mp_static(&RendererSceneCull::_scene_particles_set_view_axis).bind(idata.base_rid, -cull_data.cam_transform.basis.get_column(2).normalized(), cull_data.cam_transform.basis.get_column(1).normalized())); + rs->call_on_render_thread(base_callable.bind(idata.base_rid, view_forward, view_up)); //particles visible? request redraw RenderingServerDefault::redraw_request(); } @@ -2924,9 +2941,10 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul if (idata.parent_array_index != -1) { float fade = 1.0f; - const uint32_t &parent_flags = cull_data.scenario->instance_data[idata.parent_array_index].flags; + const InstanceData &parent = cull_data.scenario->instance_data[idata.parent_array_index]; + const uint32_t parent_flags = parent.flags; if (parent_flags & InstanceData::FLAG_VISIBILITY_DEPENDENCY_FADE_CHILDREN) { - const int32_t &parent_idx = cull_data.scenario->instance_data[idata.parent_array_index].visibility_index; + const int32_t &parent_idx = parent.visibility_index; fade = cull_data.scenario->instance_visibility[parent_idx].children_fade_alpha; } idata.instance_geometry->set_parent_fade_alpha(fade); @@ -2938,11 +2956,12 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul for (const Instance *E : geom->lights) { InstanceLightData *light = static_cast(E->base_data); - if (!(RSG::light_storage->light_get_cull_mask(E->base) & idata.layer_mask)) { + + if (!(ls->light_get_cull_mask(E->base) & layer_mask)) { continue; } - if ((RSG::light_storage->light_get_bake_mode(E->base) == RS::LIGHT_BAKE_STATIC) && idata.instance->lightmap) { + if ((ls->light_get_bake_mode(E->base) == RS::LIGHT_BAKE_STATIC) && idata.instance->lightmap) { continue; } @@ -3043,13 +3062,11 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul } for (uint32_t j = 0; j < cull_data.cull->shadow_count; j++) { - if (!light_culler->cull_directional_light(cull_data.scenario->instance_aabbs[i], j)) { + if (!light_culler->cull_directional_light(aabb, j)) { continue; } for (uint32_t k = 0; k < cull_data.cull->shadows[j].cascade_count; k++) { if (IN_FRUSTUM(cull_data.cull->shadows[j].cascades[k].frustum) && VIS_CHECK) { - uint32_t base_type = idata.flags & InstanceData::FLAG_BASE_TYPE_MASK; - if (((1 << base_type) & RS::INSTANCE_GEOMETRY_MASK) && idata.flags & InstanceData::FLAG_CAST_SHADOWS && (LAYER_CHECK & cull_data.cull->shadows[j].caster_mask)) { cull_result.directional_shadows[j].cascade_geometry_instances[k].push_back(idata.instance_geometry); mesh_visible = true; @@ -3068,9 +3085,7 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul #undef OCCLUSION_CULLED for (uint32_t j = 0; j < cull_data.cull->sdfgi.region_count; j++) { - if (cull_data.scenario->instance_aabbs[i].in_aabb(cull_data.cull->sdfgi.region_aabb[j])) { - uint32_t base_type = idata.flags & InstanceData::FLAG_BASE_TYPE_MASK; - + if (aabb.in_aabb(cull_data.cull->sdfgi.region_aabb[j])) { if (base_type == RS::INSTANCE_LIGHT) { InstanceLightData *instance_light = (InstanceLightData *)idata.instance->base_data; if (instance_light->bake_mode == RS::LIGHT_BAKE_STATIC && cull_data.cull->sdfgi.region_cascade[j] <= instance_light->max_sdfgi_cascade) { @@ -3089,8 +3104,8 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul } } - if (mesh_visible && cull_data.scenario->instance_data[i].flags & InstanceData::FLAG_USES_MESH_INSTANCE) { - cull_result.mesh_instances.push_back(cull_data.scenario->instance_data[i].instance->mesh_instance); + if (mesh_visible && idata.flags & InstanceData::FLAG_USES_MESH_INSTANCE) { + cull_result.mesh_instances.push_back(idata.instance->mesh_instance); } } } @@ -3102,11 +3117,15 @@ void RendererSceneCull::_scene_particles_set_view_axis(RID p_particles, const Ve void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_camera_data, const Ref &p_render_buffers, RID p_environment, RID p_force_camera_attributes, RID p_compositor, uint32_t p_visible_layers, RID p_scenario, RID p_viewport, RID p_shadow_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_mesh_lod_threshold, bool p_using_shadows, RenderingMethod::RenderInfo *r_render_info) { Instance *render_reflection_probe = instance_owner.get_or_null(p_reflection_probe); //if null, not rendering to it + // Camera data caching: + const Transform3D &cam_transform = p_camera_data->main_transform; + const Projection &cam_proj = p_camera_data->main_projection; + // Prepare the light - camera volume culling system. - light_culler->prepare_camera(p_camera_data->main_transform, p_camera_data->main_projection); + light_culler->prepare_camera(cam_transform, cam_proj); Scenario *scenario = scenario_owner.get_or_null(p_scenario); - Vector3 camera_position = p_camera_data->main_transform.origin; + Vector3 camera_position = cam_transform.origin; ERR_FAIL_COND(p_render_buffers.is_null()); @@ -3114,6 +3133,19 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c scene_render->set_scene_pass(render_pass); + // global storage caches: + auto *ls = RSG::light_storage; + auto *ms = RSG::mesh_storage; + auto *vp = RSG::viewport; + auto *wtp = WorkerThreadPool::get_singleton(); + + // Camera data caching: + bool cam_ortho = p_camera_data->is_orthogonal; + bool cam_vaspect = p_camera_data->vaspect; + + // Scenario caches + auto *inst_vis = &scenario->instance_visibility; + if (p_reflection_probe.is_null()) { //no rendering code here, this is only to set up what needs to be done, request regions, etc. scene_render->sdfgi_update(p_render_buffers, p_environment, camera_position); //update conditions for SDFGI (whether its used or not) @@ -3121,7 +3153,7 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c RENDER_TIMESTAMP("Update Visibility Dependencies"); - if (scenario->instance_visibility.get_bin_count() > 0) { + if (inst_vis->get_bin_count() > 0) { if (!scenario->viewport_visibility_masks.has(p_viewport)) { scenario_add_viewport_visibility_mask(scenario->self, p_viewport); } @@ -3131,17 +3163,17 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c visibility_cull_data.viewport_mask = scenario->viewport_visibility_masks[p_viewport]; visibility_cull_data.camera_position = camera_position; - for (int i = scenario->instance_visibility.get_bin_count() - 1; i > 0; i--) { // We skip bin 0 - visibility_cull_data.cull_offset = scenario->instance_visibility.get_bin_start(i); - visibility_cull_data.cull_count = scenario->instance_visibility.get_bin_size(i); + for (int i = inst_vis->get_bin_count() - 1; i > 0; i--) { // We skip bin 0 + visibility_cull_data.cull_offset = inst_vis->get_bin_start(i); + visibility_cull_data.cull_count = inst_vis->get_bin_size(i); if (visibility_cull_data.cull_count == 0) { continue; } if (visibility_cull_data.cull_count > thread_cull_threshold) { - WorkerThreadPool::GroupID group_task = WorkerThreadPool::get_singleton()->add_template_group_task(this, &RendererSceneCull::_visibility_cull_threaded, &visibility_cull_data, WorkerThreadPool::get_singleton()->get_thread_count(), -1, true, SNAME("VisibilityCullInstances")); - WorkerThreadPool::get_singleton()->wait_for_group_task_completion(group_task); + WorkerThreadPool::GroupID group_task = wtp->add_template_group_task(this, &RendererSceneCull::_visibility_cull_threaded, &visibility_cull_data, wtp->get_thread_count(), -1, true, SNAME("VisibilityCullInstances")); + wtp->wait_for_group_task_completion(group_task); } else { _visibility_cull(visibility_cull_data, visibility_cull_data.cull_offset, visibility_cull_data.cull_offset + visibility_cull_data.cull_count); } @@ -3150,11 +3182,11 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c RENDER_TIMESTAMP("Cull 3D Scene"); - //rasterizer->set_camera(p_camera_data->main_transform, p_camera_data.main_projection, p_camera_data.is_orthogonal); + //rasterizer->set_camera(cam_transform, p_camera_data.main_projection, p_camera_data.is_orthogonal); /* STEP 2 - CULL */ - Vector planes = p_camera_data->main_projection.get_projection_planes(p_camera_data->main_transform); + Vector planes = cam_proj.get_projection_planes(cam_transform); cull.frustum = Frustum(planes); Vector directional_lights; @@ -3178,7 +3210,7 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c //check shadow.. if (light) { - if (p_using_shadows && p_shadow_atlas.is_valid() && RSG::light_storage->light_has_shadow(E->base) && !(RSG::light_storage->light_get_type(E->base) == RS::LIGHT_DIRECTIONAL && RSG::light_storage->light_directional_get_sky_mode(E->base) == RS::LIGHT_DIRECTIONAL_SKY_MODE_SKY_ONLY)) { + if (p_using_shadows && p_shadow_atlas.is_valid() && ls->light_has_shadow(E->base) && !(ls->light_get_type(E->base) == RS::LIGHT_DIRECTIONAL && ls->light_directional_get_sky_mode(E->base) == RS::LIGHT_DIRECTIONAL_SKY_MODE_SKY_ONLY)) { lights_with_shadow.push_back(E); } //add to list @@ -3186,10 +3218,10 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c } } - RSG::light_storage->set_directional_shadow_count(lights_with_shadow.size()); + ls->set_directional_shadow_count(lights_with_shadow.size()); for (int i = 0; i < lights_with_shadow.size(); i++) { - _light_instance_setup_directional_shadow(i, lights_with_shadow[i], p_camera_data->main_transform, p_camera_data->main_projection, p_camera_data->is_orthogonal, p_camera_data->vaspect); + _light_instance_setup_directional_shadow(i, lights_with_shadow[i], cam_transform, cam_proj, cam_ortho, cam_vaspect); } } @@ -3230,11 +3262,11 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c cull_data.cull = &cull; cull_data.scenario = scenario; cull_data.shadow_atlas = p_shadow_atlas; - cull_data.cam_transform = p_camera_data->main_transform; + cull_data.cam_transform = cam_transform; cull_data.visible_layers = p_visible_layers; cull_data.render_reflection_probe = render_reflection_probe; cull_data.occlusion_buffer = RendererSceneOcclusionCull::get_singleton()->buffer_get_ptr(p_viewport); - cull_data.camera_matrix = &p_camera_data->main_projection; + cull_data.camera_matrix = &cam_proj; cull_data.visibility_viewport_mask = scenario->viewport_visibility_masks.has(p_viewport) ? scenario->viewport_visibility_masks[p_viewport] : 0; //#define DEBUG_CULL_TIME #ifdef DEBUG_CULL_TIME @@ -3247,8 +3279,8 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c thread.clear(); } - WorkerThreadPool::GroupID group_task = WorkerThreadPool::get_singleton()->add_template_group_task(this, &RendererSceneCull::_scene_cull_threaded, &cull_data, scene_cull_result_threads.size(), -1, true, SNAME("RenderCullInstances")); - WorkerThreadPool::get_singleton()->wait_for_group_task_completion(group_task); + WorkerThreadPool::GroupID group_task = wtp->add_template_group_task(this, &RendererSceneCull::_scene_cull_threaded, &cull_data, scene_cull_result_threads.size(), -1, true, SNAME("RenderCullInstances")); + wtp->wait_for_group_task_completion(group_task); for (InstanceCullResult &thread : scene_cull_result_threads) { scene_cull_result.append_from(thread); @@ -3269,9 +3301,9 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c if (scene_cull_result.mesh_instances.size()) { for (uint64_t i = 0; i < scene_cull_result.mesh_instances.size(); i++) { - RSG::mesh_storage->mesh_instance_check_for_update(scene_cull_result.mesh_instances[i]); + ms->mesh_instance_check_for_update(scene_cull_result.mesh_instances[i]); } - RSG::mesh_storage->update_mesh_instances(); + ms->update_mesh_instances(); } } @@ -3287,7 +3319,7 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c for (uint32_t j = 0; j < cull.shadows[i].cascade_count; j++) { const Cull::Shadow::Cascade &c = cull.shadows[i].cascades[j]; // print_line("shadow " + itos(i) + " cascade " + itos(j) + " elements: " + itos(c.cull_result.size())); - RSG::light_storage->light_instance_set_shadow_transform(cull.shadows[i].light_instance, c.projection, c.transform, c.zfar, c.split, j, c.shadow_texel_size, c.bias_scale, c.range_begin, c.uv_scale); + ls->light_instance_set_shadow_transform(cull.shadows[i].light_instance, c.projection, c.transform, c.zfar, c.split, j, c.shadow_texel_size, c.bias_scale, c.range_begin, c.uv_scale); if (max_shadows_used == MAX_UPDATE_SHADOWS) { continue; } @@ -3299,16 +3331,19 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c } // Positional Shadows - for (uint32_t i = 0; i < (uint32_t)scene_cull_result.lights.size(); i++) { + bool shadow_atlas_valid = p_shadow_atlas.is_valid(); + uint32_t scene_cull_result_ls = scene_cull_result.lights.size(); + + for (uint32_t i = 0; i < scene_cull_result_ls; i++) { Instance *ins = scene_cull_result.lights[i]; - if (!p_shadow_atlas.is_valid()) { + if (!shadow_atlas_valid) { continue; } InstanceLightData *light = static_cast(ins->base_data); - if (!RSG::light_storage->light_instance_is_shadow_visible_at_position(light->instance, camera_position)) { + if (!ls->light_instance_is_shadow_visible_at_position(light->instance, camera_position)) { continue; } @@ -3316,16 +3351,16 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c { //compute coverage - Transform3D cam_xf = p_camera_data->main_transform; - float zn = p_camera_data->main_projection.get_z_near(); + const Transform3D &cam_xf = cam_transform; + float zn = cam_proj.get_z_near(); Plane p(-cam_xf.basis.get_column(2), cam_xf.origin + cam_xf.basis.get_column(2) * -zn); //camera near plane // near plane half width and height - Vector2 vp_half_extents = p_camera_data->main_projection.get_viewport_half_extents(); + Vector2 vp_half_extents = cam_proj.get_viewport_half_extents(); - switch (RSG::light_storage->light_get_type(ins->base)) { + switch (ls->light_get_type(ins->base)) { case RS::LIGHT_OMNI: { - float radius = RSG::light_storage->light_get_param(ins->base, RS::LIGHT_PARAM_RANGE); + float radius = ls->light_get_param(ins->base, RS::LIGHT_PARAM_RANGE); //get two points parallel to near plane Vector3 points[2] = { @@ -3333,7 +3368,7 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c ins->transform.origin + cam_xf.basis.get_column(0) * radius }; - if (!p_camera_data->is_orthogonal) { + if (!cam_ortho) { //if using perspetive, map them to near plane for (int j = 0; j < 2; j++) { if (p.distance_to(points[j]) < 0) { @@ -3348,8 +3383,8 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c coverage = screen_diameter / (vp_half_extents.x + vp_half_extents.y); } break; case RS::LIGHT_SPOT: { - float radius = RSG::light_storage->light_get_param(ins->base, RS::LIGHT_PARAM_RANGE); - float angle = RSG::light_storage->light_get_param(ins->base, RS::LIGHT_PARAM_SPOT_ANGLE); + float radius = ls->light_get_param(ins->base, RS::LIGHT_PARAM_RANGE); + float angle = ls->light_get_param(ins->base, RS::LIGHT_PARAM_SPOT_ANGLE); float w = radius * Math::sin(Math::deg_to_rad(angle)); float d = radius * Math::cos(Math::deg_to_rad(angle)); @@ -3361,7 +3396,7 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c base + cam_xf.basis.get_column(0) * w }; - if (!p_camera_data->is_orthogonal) { + if (!cam_ortho) { //if using perspetive, map them to near plane for (int j = 0; j < 2; j++) { if (p.distance_to(points[j]) < 0) { @@ -3395,7 +3430,7 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c // Directional lights aren't handled here, _light_instance_update_shadow is called from elsewhere. // Checking for this in case this changes, as this is assumed. - DEV_CHECK_ONCE(RSG::light_storage->light_get_type(ins->base) != RS::LIGHT_DIRECTIONAL); + DEV_CHECK_ONCE(ls->light_get_type(ins->base) != RS::LIGHT_DIRECTIONAL); // Tighter caster culling to the camera frustum should work correctly with multiple viewports + cameras. // The first camera will cull tightly, but if the light is present on more than 1 camera, the second will @@ -3409,12 +3444,12 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c } } - bool redraw = RSG::light_storage->shadow_atlas_update_light(p_shadow_atlas, light->instance, coverage, light->last_version); + bool redraw = ls->shadow_atlas_update_light(p_shadow_atlas, light->instance, coverage, light->last_version); if (redraw && max_shadows_used < MAX_UPDATE_SHADOWS) { //must redraw! RENDER_TIMESTAMP("> Render Light3D " + itos(i)); - if (_light_instance_update_shadow(ins, p_camera_data->main_transform, p_camera_data->main_projection, p_camera_data->is_orthogonal, p_camera_data->vaspect, p_shadow_atlas, scenario, p_screen_mesh_lod_threshold, p_visible_layers)) { + if (_light_instance_update_shadow(ins, cam_transform, cam_proj, cam_ortho, cam_vaspect, p_shadow_atlas, scenario, p_screen_mesh_lod_threshold, p_visible_layers)) { light->make_shadow_dirty(); } RENDER_TIMESTAMP("< Render Light3D " + itos(i)); @@ -3480,15 +3515,15 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c RID occluders_tex; const RendererSceneRender::CameraData *prev_camera_data = p_camera_data; if (p_viewport.is_valid()) { - occluders_tex = RSG::viewport->viewport_get_occluder_debug_texture(p_viewport); - prev_camera_data = RSG::viewport->viewport_get_prev_camera_data(p_viewport); + occluders_tex = vp->viewport_get_occluder_debug_texture(p_viewport); + prev_camera_data = vp->viewport_get_prev_camera_data(p_viewport); } RENDER_TIMESTAMP("Render 3D Scene"); scene_render->render_scene(p_render_buffers, p_camera_data, prev_camera_data, scene_cull_result.geometry_instances, scene_cull_result.light_instances, scene_cull_result.reflections, scene_cull_result.voxel_gi_instances, scene_cull_result.decals, scene_cull_result.lightmaps, scene_cull_result.fog_volumes, p_environment, camera_attributes, p_compositor, p_shadow_atlas, occluders_tex, p_reflection_probe.is_valid() ? RID() : scenario->reflection_atlas, p_reflection_probe, p_reflection_probe_pass, p_screen_mesh_lod_threshold, render_shadow_data, max_shadows_used, render_sdfgi_data, cull.sdfgi.region_count, &sdfgi_update_data, r_render_info); if (p_viewport.is_valid()) { - RSG::viewport->viewport_set_prev_camera_data(p_viewport, p_camera_data); + vp->viewport_set_prev_camera_data(p_viewport, p_camera_data); } for (uint32_t i = 0; i < max_shadows_used; i++) { diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp index f0a9c68a059..99dd9c5fc02 100644 --- a/servers/rendering_server.cpp +++ b/servers/rendering_server.cpp @@ -1255,6 +1255,13 @@ Error RenderingServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surfa // Include custom array format type. if (format & (1ULL << (ARRAY_CUSTOM0 + i))) { format |= (RS::ARRAY_FORMAT_CUSTOM_MASK << (RS::ARRAY_FORMAT_CUSTOM_BASE + i * RS::ARRAY_FORMAT_CUSTOM_BITS)) & p_compress_format; + + // If the mesh contains no vertex array, infer the array length from the custom array. + if (array_len == 0) { + Vector custom_array = p_arrays[RS::ARRAY_CUSTOM0 + i]; + uint32_t factor_reciprocal = _get_vertex_to_custom_array_length_factor(format, RS::ARRAY_CUSTOM0 + i); + array_len = custom_array.size() / factor_reciprocal; + } } } @@ -1389,6 +1396,31 @@ Error RenderingServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surfa return OK; } +int32_t RenderingServer::_get_vertex_to_custom_array_length_factor(uint32_t p_format, int p_array_index) { + uint32_t type = (p_format >> (ARRAY_FORMAT_CUSTOM_BASE + ARRAY_FORMAT_CUSTOM_BITS * (p_array_index - RS::ARRAY_CUSTOM0))) & ARRAY_FORMAT_CUSTOM_MASK; + switch (type) { + case ARRAY_CUSTOM_RGBA8_UNORM: + case ARRAY_CUSTOM_RGBA8_SNORM: + case ARRAY_CUSTOM_RG_HALF: { + return 4; + } break; + case ARRAY_CUSTOM_RGBA_HALF: { + return 8; + } break; + case ARRAY_CUSTOM_R_FLOAT: + case ARRAY_CUSTOM_RG_FLOAT: + case ARRAY_CUSTOM_RGB_FLOAT: + case ARRAY_CUSTOM_RGBA_FLOAT: { + int32_t s = type - ARRAY_CUSTOM_R_FLOAT + 1; + + return s; + } break; + default: { + ERR_FAIL_V_MSG(0, "Invalid custom format type."); + } + } +} + void RenderingServer::mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_primitive, const Array &p_arrays, const Array &p_blend_shapes, const Dictionary &p_lods, BitField p_compress_format) { SurfaceData sd; Error err = mesh_create_surface_data_from_arrays(&sd, p_primitive, p_arrays, p_blend_shapes, p_lods, p_compress_format); diff --git a/servers/rendering_server.h b/servers/rendering_server.h index c023911b073..abf97c00508 100644 --- a/servers/rendering_server.h +++ b/servers/rendering_server.h @@ -410,6 +410,7 @@ class RenderingServer : public Object { /// Returns stride virtual void mesh_surface_make_offsets_from_format(uint64_t p_format, int p_vertex_len, int p_index_len, uint32_t *r_offsets, uint32_t &r_vertex_element_size, uint32_t &r_normal_element_size, uint32_t &r_attrib_element_size, uint32_t &r_skin_element_size) const; virtual Error mesh_create_surface_data_from_arrays(SurfaceData *r_surface_data, PrimitiveType p_primitive, const Array &p_arrays, const Array &p_blend_shapes = Array(), const Dictionary &p_lods = Dictionary(), uint64_t p_compress_format = 0); + int32_t _get_vertex_to_custom_array_length_factor(uint32_t p_format, int p_array_index); Array mesh_create_arrays_from_surface_data(const SurfaceData &p_data) const; Array mesh_surface_get_arrays(RID p_mesh, int p_surface) const; TypedArray mesh_surface_get_blend_shape_arrays(RID p_mesh, int p_surface) const; diff --git a/tests/core/io/test_config_file.h b/tests/core/io/test_config_file.h index 4afea237ea9..e4c2dacb51b 100644 --- a/tests/core/io/test_config_file.h +++ b/tests/core/io/test_config_file.h @@ -116,6 +116,27 @@ antialiasing = false ; Duplicate key. "The configuration file shouldn't parse successfully."); } +TEST_CASE("[ConfigFile] Parsing object") { + const String config_source = R"( +[test] + +test=Object(RefCounted,"script":null) +)"; + ConfigFile config_file; + + ERR_PRINT_OFF; + Error error = config_file.parse(config_source); + ERR_PRINT_ON; + + CHECK(error == ERR_UNAUTHORIZED); + CHECK(!config_file.has_section_key("test", "test")); + + error = config_file.parse(config_source, true); + + CHECK(error == OK); + CHECK(config_file.get_value("test", "test").get_type() == Variant::OBJECT); +} + TEST_CASE("[ConfigFile] Saving file") { ConfigFile config_file; config_file.set_value("player", "name", "Unnamed Player"); diff --git a/tests/core/math/test_transform_2d.h b/tests/core/math/test_transform_2d.h index 5ba0be706bf..3d89d1f211b 100644 --- a/tests/core/math/test_transform_2d.h +++ b/tests/core/math/test_transform_2d.h @@ -112,6 +112,23 @@ TEST_CASE("[Transform2D] Affine inverse") { CHECK(affine_inverted_again == orig); } +TEST_CASE("[Transform2D] Set rotation") { + const real_t rot = 1.8; + const Vector2 scale = Vector2(2.5, 5); + const Vector2 useless_pos = Vector2(); + Transform2D subject = Transform2D(0.2, scale, 0.0, useless_pos); + + subject.set_rotation(rot); + + const real_t res_rot = subject.get_rotation(); + const Vector2 res_scale = subject.get_scale(); + const real_t tol = 0.001; + + CHECK(Math::is_equal_approx(rot, res_rot, tol)); + CHECK(Math::is_equal_approx(scale.x, res_scale.x, tol)); + CHECK(Math::is_equal_approx(scale.y, res_scale.y, tol)); +} + TEST_CASE("[Transform2D] Orthonormalized") { const Transform2D T = create_dummy_transform(); const Transform2D orthonormalized_T = T.orthonormalized(); diff --git a/tests/core/variant/test_variant.h b/tests/core/variant/test_variant.h index f546169edd9..7ef8bb9c312 100644 --- a/tests/core/variant/test_variant.h +++ b/tests/core/variant/test_variant.h @@ -1911,6 +1911,49 @@ TEST_CASE("[Variant] Writer recursive dictionary on keys") { } #endif +TEST_CASE("[Variant] Writer and parser object") { + Ref ref_counted; + ref_counted.instantiate(); + ref_counted->set_meta("test", 123); + const String expected = "Object(RefCounted,\"script\":null,\"metadata/test\":123)\n"; + String encoded; + + ERR_PRINT_OFF; + VariantWriter::write_to_string(ref_counted, encoded); + ERR_PRINT_ON; + + CHECK_EQ(encoded, "null"); + + encoded.clear(); + VariantWriter::write_to_string(ref_counted, encoded, nullptr, nullptr, true, true); + + CHECK_EQ(encoded, expected); + + VariantParser::StreamString ss; + ss.s = expected; + Variant parsed; + String errs; + int line; + + ERR_PRINT_OFF; + Error error = VariantParser::parse(&ss, parsed, errs, line); + ERR_PRINT_ON; + + CHECK_EQ(error, ERR_UNAUTHORIZED); + CHECK_EQ(parsed, Variant()); + + ss = VariantParser::StreamString(); + ss.s = expected; + + error = VariantParser::parse(&ss, parsed, errs, line, nullptr, true); + + CHECK_EQ(error, OK); + ref_counted = parsed; + CHECK(ref_counted.is_valid()); + CHECK_EQ(ref_counted->get_class(), RefCounted::get_class_static()); + CHECK_EQ(ref_counted->get_meta("test"), Variant(123)); +} + TEST_CASE("[Variant] Basic comparison") { CHECK_EQ(Variant(1), Variant(1)); CHECK_FALSE(Variant(1) != Variant(1)); diff --git a/tests/scene/test_text_edit.h b/tests/scene/test_text_edit.h index 531e49a351e..37665711d76 100644 --- a/tests/scene/test_text_edit.h +++ b/tests/scene/test_text_edit.h @@ -6619,23 +6619,23 @@ TEST_CASE("[SceneTree][TextEdit] mouse") { // Add method to get drawn column count? Point2i start_pos = text_edit->get_pos_at_line_column(0, 0); - Point2i end_pos = text_edit->get_pos_at_line_column(0, 105); + Point2i end_pos = text_edit->get_pos_at_line_column(0, 104); CHECK(text_edit->get_line_column_at_pos(Point2i(start_pos.x, start_pos.y)) == Point2i(0, 0)); - CHECK(text_edit->get_line_column_at_pos(Point2i(end_pos.x, end_pos.y)) == Point2i(104, 0)); + CHECK(text_edit->get_line_column_at_pos(Point2i(end_pos.x, end_pos.y)) == Point2i(103, 0)); // Should this return Point2i(-1, -1) if its also < 0 not just > vis_lines. - CHECK(text_edit->get_line_column_at_pos(Point2i(end_pos.x - 100, end_pos.y), false) == Point2i(90, 0)); + CHECK(text_edit->get_line_column_at_pos(Point2i(end_pos.x - 100, end_pos.y), false) == Point2i(88, 0)); CHECK(text_edit->get_line_column_at_pos(Point2i(end_pos.x, end_pos.y + 100), false) == Point2i(-1, -1)); CHECK(text_edit->get_line_column_at_pos(Point2i(end_pos.x - 100, end_pos.y + 100), false) == Point2i(-1, -1)); - CHECK(text_edit->get_line_column_at_pos(Point2i(end_pos.x, end_pos.y - 100), false) == Point2i(104, 0)); - CHECK(text_edit->get_line_column_at_pos(Point2i(end_pos.x - 100, end_pos.y - 100), false) == Point2i(90, 0)); + CHECK(text_edit->get_line_column_at_pos(Point2i(end_pos.x, end_pos.y - 100), false) == Point2i(103, 0)); + CHECK(text_edit->get_line_column_at_pos(Point2i(end_pos.x - 100, end_pos.y - 100), false) == Point2i(88, 0)); - CHECK(text_edit->get_line_column_at_pos(Point2i(end_pos.x - 100, end_pos.y)) == Point2i(90, 0)); + CHECK(text_edit->get_line_column_at_pos(Point2i(end_pos.x - 100, end_pos.y)) == Point2i(88, 0)); CHECK(text_edit->get_line_column_at_pos(Point2i(end_pos.x, end_pos.y + 100)) == Point2i(140, 0)); CHECK(text_edit->get_line_column_at_pos(Point2i(end_pos.x - 100, end_pos.y + 100)) == Point2i(140, 0)); - CHECK(text_edit->get_line_column_at_pos(Point2i(end_pos.x, end_pos.y - 100)) == Point2i(104, 0)); - CHECK(text_edit->get_line_column_at_pos(Point2i(end_pos.x - 100, end_pos.y - 100)) == Point2i(90, 0)); + CHECK(text_edit->get_line_column_at_pos(Point2i(end_pos.x, end_pos.y - 100)) == Point2i(103, 0)); + CHECK(text_edit->get_line_column_at_pos(Point2i(end_pos.x - 100, end_pos.y - 100)) == Point2i(88, 0)); memdelete(text_edit); } @@ -7486,14 +7486,14 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { // First visible line. CHECK(text_edit->get_first_visible_line() == 0); - CHECK(text_edit->get_v_scroll() == 0); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(0))); CHECK(text_edit->get_last_full_visible_line() == visible_lines - 1); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); text_edit->set_line_as_first_visible(visible_lines); MessageQueue::get_singleton()->flush(); CHECK(text_edit->get_first_visible_line() == visible_lines); - CHECK(text_edit->get_v_scroll() == visible_lines); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(visible_lines))); CHECK(text_edit->get_last_full_visible_line() == (visible_lines * 2) - 1); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); @@ -7513,7 +7513,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { text_edit->set_line_as_first_visible(5, 1); MessageQueue::get_singleton()->flush(); CHECK(text_edit->get_first_visible_line() == 5); - CHECK(text_edit->get_v_scroll() == 11); + CHECK(Math::is_equal_approx(text_edit->get_v_scroll(), double(11))); CHECK(text_edit->get_last_full_visible_line() == visible_lines - 6); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 1); @@ -7524,7 +7524,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { text_edit->set_line_as_first_visible(0); MessageQueue::get_singleton()->flush(); CHECK(text_edit->get_first_visible_line() == 0); - CHECK(text_edit->get_v_scroll() == 0); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(0))); CHECK(text_edit->get_last_full_visible_line() == visible_lines - 1); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); @@ -7532,7 +7532,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { text_edit->set_line_as_last_visible(visible_lines * 2); MessageQueue::get_singleton()->flush(); CHECK(text_edit->get_first_visible_line() == visible_lines); - CHECK(text_edit->get_v_scroll() == visible_lines); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(visible_lines))); CHECK(text_edit->get_last_full_visible_line() == (visible_lines * 2) - 1); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); @@ -7553,7 +7553,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { text_edit->set_line_as_last_visible(visible_lines + 5, 1); MessageQueue::get_singleton()->flush(); CHECK(text_edit->get_first_visible_line() == 16); - CHECK(text_edit->get_v_scroll() == 32.0); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(32.0))); CHECK(text_edit->get_last_full_visible_line() == visible_lines + 5); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); @@ -7564,7 +7564,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { text_edit->set_line_as_first_visible(0); MessageQueue::get_singleton()->flush(); CHECK(text_edit->get_first_visible_line() == 0); - CHECK(text_edit->get_v_scroll() == 0); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(0))); CHECK(text_edit->get_last_full_visible_line() == visible_lines - 1); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); @@ -7572,7 +7572,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { text_edit->set_line_as_center_visible(visible_lines + (visible_lines / 2)); MessageQueue::get_singleton()->flush(); CHECK(text_edit->get_first_visible_line() == visible_lines); - CHECK(text_edit->get_v_scroll() == visible_lines); + CHECK(Math::is_equal_approx(text_edit->get_v_scroll(), double(visible_lines))); CHECK(text_edit->get_last_full_visible_line() == (visible_lines * 2) - 1); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); @@ -7593,7 +7593,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { text_edit->set_line_as_center_visible(visible_lines + (visible_lines / 2) + 5, 1); MessageQueue::get_singleton()->flush(); CHECK(text_edit->get_first_visible_line() == visible_lines + (visible_lines / 2)); - CHECK(text_edit->get_v_scroll() == (visible_lines * 3)); + CHECK(Math::is_equal_approx(text_edit->get_v_scroll(), double((visible_lines * 3)))); CHECK(text_edit->get_last_full_visible_line() == (visible_lines * 2) - 1); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 1); @@ -7605,14 +7605,15 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { MessageQueue::get_singleton()->flush(); CHECK(text_edit->get_first_visible_line() == (visible_lines * 2) + 3); - CHECK(text_edit->get_v_scroll() == (visible_lines * 4) + 6); + CHECK(Math::is_equal_approx(text_edit->get_v_scroll(), double((visible_lines * 4) + 6))); CHECK(text_edit->get_last_full_visible_line() == (visible_lines * 2) + 8); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); text_edit->set_scroll_past_end_of_file_enabled(false); MessageQueue::get_singleton()->flush(); CHECK(text_edit->get_first_visible_line() == (visible_lines * 2) + 3); - CHECK(text_edit->get_v_scroll() == (visible_lines * 4) - 4); + INFO("v_scroll: " << text_edit->get_v_scroll() << " visible_lines: " << visible_lines); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double((visible_lines * 4) - 5))); CHECK(text_edit->get_last_full_visible_line() == (visible_lines * 2) + 8); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); @@ -7623,7 +7624,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { text_edit->set_line_as_first_visible(0); MessageQueue::get_singleton()->flush(); CHECK(text_edit->get_first_visible_line() == 0); - CHECK(text_edit->get_v_scroll() == 0); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(0))); CHECK(text_edit->get_last_full_visible_line() == visible_lines - 1); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); @@ -7637,14 +7638,14 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { MessageQueue::get_singleton()->flush(); CHECK(text_edit->is_caret_visible()); CHECK(text_edit->get_first_visible_line() == 5); - CHECK(text_edit->get_v_scroll() == 5); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(5))); CHECK(text_edit->get_last_full_visible_line() == (visible_lines - 1) + 5); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); text_edit->center_viewport_to_caret(); MessageQueue::get_singleton()->flush(); CHECK(text_edit->get_first_visible_line() == visible_lines - 5); - CHECK(text_edit->get_v_scroll() == visible_lines - 5); + CHECK(Math::is_equal_approx(text_edit->get_v_scroll(), double(visible_lines - 5))); CHECK(text_edit->get_last_full_visible_line() == (visible_lines * 2) - 6); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); @@ -7652,7 +7653,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { text_edit->adjust_viewport_to_caret(); MessageQueue::get_singleton()->flush(); CHECK(text_edit->get_first_visible_line() == visible_lines - 5); - CHECK(text_edit->get_v_scroll() == visible_lines - 5); + CHECK(Math::is_equal_approx(text_edit->get_v_scroll(), double(visible_lines - 5))); CHECK(text_edit->get_last_full_visible_line() == (visible_lines * 2) - 6); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); @@ -7663,7 +7664,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { MessageQueue::get_singleton()->flush(); CHECK(text_edit->is_caret_visible()); CHECK(text_edit->get_first_visible_line() == 1); - CHECK(text_edit->get_v_scroll() == 1); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(1))); CHECK(text_edit->get_last_full_visible_line() == visible_lines); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 0); @@ -7671,14 +7672,14 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { text_edit->set_line_as_first_visible(0); MessageQueue::get_singleton()->flush(); CHECK(text_edit->get_first_visible_line() == 0); - CHECK(text_edit->get_v_scroll() == 0); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(0))); CHECK(text_edit->get_last_full_visible_line() == visible_lines - 1); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); text_edit->adjust_viewport_to_caret(); MessageQueue::get_singleton()->flush(); CHECK(text_edit->get_first_visible_line() == 0); - CHECK(text_edit->get_v_scroll() == 0); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(0))); CHECK(text_edit->get_last_full_visible_line() == visible_lines - 1); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); @@ -7693,7 +7694,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { MessageQueue::get_singleton()->flush(); CHECK(text_edit->get_first_visible_line() == (visible_lines / 2) + 6); - CHECK(text_edit->get_v_scroll() == (visible_lines + (visible_lines / 2)) + 1); + CHECK(Math::is_equal_approx(text_edit->get_v_scroll(), double((visible_lines + (visible_lines / 2)) + 1))); CHECK(text_edit->get_last_full_visible_line() == (visible_lines) + 5); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 1); @@ -7701,7 +7702,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { text_edit->center_viewport_to_caret(); MessageQueue::get_singleton()->flush(); CHECK(text_edit->get_first_visible_line() == visible_lines); - CHECK(text_edit->get_v_scroll() == (visible_lines * 2) + 1); + CHECK(Math::is_equal_approx(text_edit->get_v_scroll(), double((visible_lines * 2) + 1))); CHECK(text_edit->get_last_full_visible_line() == (visible_lines * 2) - 11); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 1); @@ -7709,7 +7710,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { text_edit->adjust_viewport_to_caret(); MessageQueue::get_singleton()->flush(); CHECK(text_edit->get_first_visible_line() == visible_lines); - CHECK(text_edit->get_v_scroll() == (visible_lines * 2) + 1); + CHECK(Math::is_equal_approx(text_edit->get_v_scroll(), double((visible_lines * 2) + 1))); CHECK(text_edit->get_last_full_visible_line() == (visible_lines * 2) - 11); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 1); @@ -7720,7 +7721,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { MessageQueue::get_singleton()->flush(); CHECK(text_edit->is_caret_visible()); CHECK(text_edit->get_first_visible_line() == 1); - CHECK(text_edit->get_v_scroll() == 3); + CHECK(Math::is_equal_approx(text_edit->get_v_scroll(), double(3))); CHECK(text_edit->get_last_full_visible_line() == (visible_lines / 2) + 1); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 1); CHECK(text_edit->get_caret_wrap_index() == 1); @@ -7729,14 +7730,14 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { MessageQueue::get_singleton()->flush(); CHECK(text_edit->is_caret_visible()); CHECK(text_edit->get_first_visible_line() == 0); - CHECK(text_edit->get_v_scroll() == 0); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(0))); CHECK(text_edit->get_last_full_visible_line() == visible_lines - 11); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); text_edit->adjust_viewport_to_caret(); MessageQueue::get_singleton()->flush(); CHECK(text_edit->get_first_visible_line() == 0); - CHECK(text_edit->get_v_scroll() == 0); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(0))); CHECK(text_edit->get_last_full_visible_line() == visible_lines - 11); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); @@ -7747,7 +7748,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { text_edit->set_line_as_first_visible(0); MessageQueue::get_singleton()->flush(); CHECK(text_edit->get_first_visible_line() == 0); - CHECK(text_edit->get_v_scroll() == 0); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(0))); CHECK(text_edit->get_last_full_visible_line() == visible_lines - 1); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 0); @@ -7771,7 +7772,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(10, 10), MouseButton::WHEEL_DOWN, MouseButtonMask::NONE, Key::NONE); CHECK(text_edit->get_v_scroll() > v_scroll); SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(10, 10), MouseButton::WHEEL_UP, MouseButtonMask::NONE, Key::NONE); - CHECK(text_edit->get_v_scroll() == v_scroll); + CHECK(Math::is_equal_approx(text_edit->get_v_scroll(), double(v_scroll))); // smooth scroll speed. text_edit->set_smooth_scroll_enabled(true); @@ -7782,7 +7783,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_v_scroll() >= v_scroll); SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(10, 10), MouseButton::WHEEL_UP, MouseButtonMask::NONE, Key::NONE); text_edit->notification(TextEdit::NOTIFICATION_INTERNAL_PHYSICS_PROCESS); - CHECK(text_edit->get_v_scroll() == v_scroll); + CHECK(Math::is_equal_approx(text_edit->get_v_scroll(), double(v_scroll))); v_scroll = text_edit->get_v_scroll(); text_edit->set_v_scroll_speed(10000); @@ -7791,7 +7792,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_v_scroll() >= v_scroll); SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(10, 10), MouseButton::WHEEL_UP, MouseButtonMask::NONE, Key::NONE); text_edit->notification(TextEdit::NOTIFICATION_INTERNAL_PHYSICS_PROCESS); - CHECK(text_edit->get_v_scroll() == v_scroll); + CHECK(Math::is_equal_approx(text_edit->get_v_scroll(), double(v_scroll))); ERR_PRINT_OFF; CHECK(text_edit->get_scroll_pos_for_line(-1) == 0); @@ -7813,7 +7814,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { text_edit->set_smooth_scroll_enabled(false); CHECK(text_edit->get_first_visible_line() == 0); - CHECK(text_edit->get_v_scroll() == 0); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(0))); CHECK(text_edit->get_last_full_visible_line() == visible_lines - 1); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); @@ -7822,7 +7823,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 1); CHECK(text_edit->get_first_visible_line() == 1); - CHECK(text_edit->get_v_scroll() == 1); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(1))); CHECK(text_edit->get_last_full_visible_line() == visible_lines); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 0); @@ -7831,7 +7832,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 1); CHECK(text_edit->get_first_visible_line() == 0); - CHECK(text_edit->get_v_scroll() == 0); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(0))); CHECK(text_edit->get_last_full_visible_line() == visible_lines - 1); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 0); @@ -7841,7 +7842,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 21); CHECK(text_edit->get_first_visible_line() == 0); - CHECK(text_edit->get_v_scroll() == 0); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(0))); CHECK(text_edit->get_last_full_visible_line() == visible_lines - 1); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 0); @@ -7850,7 +7851,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 41); CHECK(text_edit->get_first_visible_line() == 20); - CHECK(text_edit->get_v_scroll() == 20); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(20))); CHECK(text_edit->get_last_full_visible_line() == (visible_lines - 1) * 2); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 0); @@ -7859,7 +7860,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 21); CHECK(text_edit->get_first_visible_line() == 20); - CHECK(text_edit->get_v_scroll() == 20); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(20))); CHECK(text_edit->get_last_full_visible_line() == (visible_lines - 1) * 2); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 0); @@ -7868,7 +7869,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 1); CHECK(text_edit->get_first_visible_line() == 1); - CHECK(text_edit->get_v_scroll() == 1); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(1))); CHECK(text_edit->get_last_full_visible_line() == visible_lines); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 0); @@ -7881,7 +7882,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 2); CHECK(text_edit->get_first_visible_line() == 2); - CHECK(text_edit->get_v_scroll() == 2); + CHECK(Math::is_equal_approx(text_edit->get_v_scroll(), double(2))); CHECK(text_edit->get_last_full_visible_line() == visible_lines + 1); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 0); @@ -7890,7 +7891,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 2); CHECK(text_edit->get_first_visible_line() == 1); - CHECK(text_edit->get_v_scroll() == 1); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(1))); CHECK(text_edit->get_last_full_visible_line() == visible_lines); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 0); @@ -7900,7 +7901,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 22); CHECK(text_edit->get_first_visible_line() == 1); - CHECK(text_edit->get_v_scroll() == 1); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(1))); CHECK(text_edit->get_last_full_visible_line() == visible_lines); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 0); @@ -7909,7 +7910,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 42); CHECK(text_edit->get_first_visible_line() == 21); - CHECK(text_edit->get_v_scroll() == 21); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(21))); CHECK(text_edit->get_last_full_visible_line() == (visible_lines * 2) - 1); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 0); @@ -7918,7 +7919,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 22); CHECK(text_edit->get_first_visible_line() == 21); - CHECK(text_edit->get_v_scroll() == 21); + CHECK(Math::is_equal_approx(Math::floor(text_edit->get_v_scroll()), double(21))); CHECK(text_edit->get_last_full_visible_line() == (visible_lines * 2) - 1); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 0); @@ -7927,7 +7928,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 2); CHECK(text_edit->get_first_visible_line() == 2); - CHECK(text_edit->get_v_scroll() == 2); + CHECK(Math::is_equal_approx(text_edit->get_v_scroll(), double(2))); CHECK(text_edit->get_last_full_visible_line() == visible_lines + 1); CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 0); diff --git a/version.py b/version.py index 3e9f3944e06..161c6d1b7c5 100644 --- a/version.py +++ b/version.py @@ -1,14 +1,14 @@ short_name = "redot" -name = "Redot Engine" -major = 4 -minor = 5 +name = "Redot Engine LTS" +major = 26 +minor = 1 patch = 0 -status = "alpha" +status = "beta" status_version = 0 module_config = "" website = "https://redotengine.org" docs = "latest" godot_major = 4 godot_minor = 5 -godot_patch = 0 -godot_status = "beta" +godot_patch = 1 +godot_status = "stable"