Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from godotengine:master #114

Merged
merged 22 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4083238
Fix Input::remove_joy_mapping
MJacred Dec 15, 2024
f7c6a86
Apply feedback + Remove unused variable `uid` in parse_mapping()
MJacred Jan 13, 2025
e98f3a6
Apply feedback
MJacred Jan 13, 2025
f355382
Updating the index after the first mapping record of p_guid requires …
MJacred Jan 13, 2025
8e75fae
Ue an array removed_idx
MJacred Jan 14, 2025
220cf87
Clarifying the impact of "Normal Map (RG Channels)" on texture imports.
tom-schultz Jan 16, 2025
5768928
Fix GDScript editor crash on invalid `tween_property` arguments.
bruvzg Jan 16, 2025
b4f25b1
Clean up the XR editor logic
m4gr3d Jan 16, 2025
8eb5443
Clarify SpringBone's gravity unit and improve documentation
TokageItLab Jan 16, 2025
912c86a
Changed SpringBone to return the prev rotation instead of init
TokageItLab Jan 16, 2025
133ea4f
[Wayland] Fix excessive IME updates.
bruvzg Jan 17, 2025
14093fd
[TextServer] Fix ICU data incorrectly marked as loaded even if file w…
bruvzg Jan 17, 2025
484d6d4
Fix emission_shape_changed signal error when using ShaderMaterial wit…
paddy-exe Jan 16, 2025
49481c1
Merge pull request #98792 from MJacred/fix_remove_joy_mapping
Repiteo Jan 17, 2025
d6f688b
Merge pull request #101684 from bruvzg/wl_ime_upd
Repiteo Jan 17, 2025
97daaca
Merge pull request #101685 from bruvzg/ts_data_ld
Repiteo Jan 17, 2025
923eb44
Merge pull request #101617 from paddy-exe/processmaterial-vs-shaderma…
Repiteo Jan 17, 2025
9875cb6
Merge pull request #101652 from TokageItLab/gravity-doc-springbone
Repiteo Jan 17, 2025
4425ce0
Merge pull request #101651 from TokageItLab/fix-flip-springbone
Repiteo Jan 17, 2025
02ea1f8
Merge pull request #101623 from tom-schultz/patch-1
Repiteo Jan 17, 2025
041cb20
Merge pull request #101645 from m4gr3d/disable_xr_mode_for_regular_la…
Repiteo Jan 17, 2025
9630d4e
Merge pull request #101632 from bruvzg/gds_tween_property_crash
Repiteo Jan 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 59 additions & 5 deletions core/input/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1602,9 +1602,6 @@ void Input::parse_mapping(const String &p_mapping) {
return;
}

CharString uid;
uid.resize(17);

mapping.uid = entry[0];
mapping.name = entry[1];

Expand Down Expand Up @@ -1712,15 +1709,72 @@ void Input::add_joy_mapping(const String &p_mapping, bool p_update_existing) {
}

void Input::remove_joy_mapping(const String &p_guid) {
// One GUID can exist multiple times in `map_db`, and
// `add_joy_mapping` can choose not to update the existing mapping,
// so the indices can be all over the place. Therefore we need to remember them.
Vector<int> removed_idx;
int min_removed_idx = -1;
int max_removed_idx = -1;
int fallback_mapping_offset = 0;

for (int i = map_db.size() - 1; i >= 0; i--) {
if (p_guid == map_db[i].uid) {
map_db.remove_at(i);

if (max_removed_idx == -1) {
max_removed_idx = i;
}
min_removed_idx = i;
removed_idx.push_back(i);

if (i < fallback_mapping) {
fallback_mapping_offset++;
} else if (i == fallback_mapping) {
fallback_mapping = -1;
WARN_PRINT_ONCE(vformat("Removed fallback joypad input mapping \"%s\". This could lead to joypads not working as intended.", p_guid));
}
}
}

if (min_removed_idx == -1) {
return; // Nothing removed.
}

if (fallback_mapping > 0) {
// Fix the shifted index.
fallback_mapping -= fallback_mapping_offset;
}

int removed_idx_size = removed_idx.size();

// Update joypad mapping references: some
// * should use the fallback_mapping (if set; if not, they get unmapped), or
// * need their mapping reference fixed, because the deletion(s) offset them.
for (KeyValue<int, Joypad> &E : joy_names) {
Joypad &joy = E.value;
if (joy.uid == p_guid) {
_set_joypad_mapping(joy, -1);
if (joy.mapping < min_removed_idx) {
continue; // Not affected.
}

if (joy.mapping > max_removed_idx) {
_set_joypad_mapping(joy, joy.mapping - removed_idx_size);
continue; // Simple offset fix.
}

// removed_idx is in reverse order (ie. high to low), because the first loop is in reverse order.
for (int i = 0; i < removed_idx.size(); i++) {
if (removed_idx[i] == joy.mapping) {
// Set to fallback_mapping, if defined, else unmap the joypad.
// Currently, the fallback_mapping is only set internally, and only for Android.
_set_joypad_mapping(joy, fallback_mapping);
break;
}
if (removed_idx[i] < joy.mapping) {
// Complex offset fix:
// This mapping was shifted by `(removed_idx_size - i)` deletions.
_set_joypad_mapping(joy, joy.mapping - (removed_idx_size - i));
break;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/input/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class Input : public Object {

HashSet<uint32_t> ignored_device_ids;

int fallback_mapping = -1;
int fallback_mapping = -1; // Index of the guid in map_db.

CursorShape default_shape = CURSOR_ARROW;

Expand Down
3 changes: 2 additions & 1 deletion doc/classes/Input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@
<return type="void" />
<param index="0" name="guid" type="String" />
<description>
Removes all mappings from the internal database that match the given GUID.
Removes all mappings from the internal database that match the given GUID. All currently connected joypads that use this GUID will become unmapped.
On Android, Godot will map to an internal fallback mapping.
</description>
</method>
<method name="set_accelerometer">
Expand Down
1 change: 1 addition & 0 deletions doc/classes/ParticleProcessMaterial.xml
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@
<signal name="emission_shape_changed">
<description>
Emitted when this material's emission shape is changed in any way. This includes changes to [member emission_shape], [member emission_shape_scale], or [member emission_sphere_radius], and any other property that affects the emission shape's offset, size, scale, or orientation.
[b]Note:[/b] This signal is only emitted inside the editor for performance reasons.
</description>
</signal>
</signals>
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/ResourceImporterLayeredTexture.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Controls how color channels should be used in the imported texture.
[b]sRGB Friendly:[/b], prevents the RG color format from being used, as it does not support sRGB color.
[b]Optimized:[/b], allows the RG color format to be used if the texture does not use the blue channel. This reduces memory usage if the texture's blue channel can be discarded (all pixels must have a blue value of [code]0[/code]).
[b]Normal Map (RG Channels):[/b] This forces all layers from the texture to be imported with the RG color format to reduce memory usage, with only the red and green channels preserved. This only has an effect on textures with the VRAM Compressed or Basis Universal compression modes. This mode is only available in layered textures ([Cubemap], [CubemapArray], [Texture2DArray] and [Texture3D]).
[b]Normal Map (RG Channels):[/b] This forces all layers from the texture to be imported with the RG color format, with only the red and green channels preserved. RGTC (Red-Green Texture Compression) compression is able to preserve its detail much better, while using the same amount of memory as a standard RGBA VRAM-compressed texture. This only has an effect on textures with the VRAM Compressed or Basis Universal compression modes. This mode is only available in layered textures ([Cubemap], [CubemapArray], [Texture2DArray] and [Texture3D]).
</member>
<member name="compress/hdr_compression" type="int" setter="" getter="" default="1">
Controls how VRAM compression should be performed for HDR images.
Expand Down
4 changes: 2 additions & 2 deletions doc/classes/SpringBoneSimulator3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@
<param index="0" name="index" type="int" />
<param index="1" name="gravity" type="float" />
<description>
Sets the gravity amount of the bone chain.
Sets the gravity amount of the bone chain. This value is not an acceleration, but a constant velocity of movement in [method set_gravity_direction].
If [param gravity] is not [code]0[/code], the modified pose will not return to the original pose since it is always affected by gravity.
The value is scaled by [method set_gravity_damping_curve] and cached in each joint setting in the joint list.
</description>
Expand All @@ -465,7 +465,7 @@
<param index="0" name="index" type="int" />
<param index="1" name="gravity_direction" type="Vector3" />
<description>
Sets the gravity direction of the bone chain.
Sets the gravity direction of the bone chain. This value is internally normalized and then multiplied by [method set_gravity].
The value is cached in each joint setting in the joint list.
</description>
</method>
Expand Down
8 changes: 8 additions & 0 deletions modules/gdscript/gdscript_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2860,7 +2860,15 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c

if (p_argidx == 1 && p_context.node && p_context.node->type == GDScriptParser::Node::CALL && ClassDB::is_parent_class(class_name, SNAME("Tween")) && p_method == SNAME("tween_property")) {
// Get tweened objects properties.
if (static_cast<GDScriptParser::CallNode *>(p_context.node)->arguments.is_empty()) {
base_type.kind = GDScriptParser::DataType::UNRESOLVED;
break;
}
GDScriptParser::ExpressionNode *tweened_object = static_cast<GDScriptParser::CallNode *>(p_context.node)->arguments[0];
if (!tweened_object) {
base_type.kind = GDScriptParser::DataType::UNRESOLVED;
break;
}
StringName native_type = tweened_object->datatype.native_type;
switch (tweened_object->datatype.kind) {
case GDScriptParser::DataType::SCRIPT: {
Expand Down
2 changes: 1 addition & 1 deletion modules/text_server_adv/text_server_adv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,13 +458,13 @@ bool TextServerAdvanced::_load_support_data(const String &p_filename) {
}

err = U_ZERO_ERROR;
icu_data_loaded = true;
}

u_init(&err);
if (U_FAILURE(err)) {
ERR_FAIL_V_MSG(false, u_errorName(err));
}
icu_data_loaded = true;
}
#endif
return true;
Expand Down
7 changes: 7 additions & 0 deletions platform/android/export/export_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2840,6 +2840,13 @@ void EditorExportPlatformAndroid::get_command_line_flags(const Ref<EditorExportP
command_line_strings.push_back("--xr_mode_openxr");
} else { // XRMode.REGULAR is the default.
command_line_strings.push_back("--xr_mode_regular");

// Also override the 'xr/openxr/enabled' project setting.
// This is useful for multi-platforms projects supporting both XR and non-XR devices. The project would need
// to enable openxr for development, and would create multiple XR and non-XR export presets.
// These command line args ensure that the non-XR export presets will have openxr disabled.
command_line_strings.push_back("--xr-mode");
command_line_strings.push_back("off");
}

bool immersive = p_preset->get("screen/immersive_mode");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,4 @@ package org.godotengine.editor
*
* This is the implementation of the editor used when running on regular Android devices.
*/
open class GodotEditor : BaseGodotEditor() {
}
open class GodotEditor : BaseGodotEditor()
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,8 @@

<activity
android:name=".GodotXRGame"
android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|density|keyboard|navigation|screenLayout|uiMode"
android:process=":GodotXRGame"
android:launchMode="singleTask"
android:icon="@mipmap/ic_play_window"
android:label="@string/godot_game_activity_name"
android:exported="false"
android:screenOrientation="landscape"
android:resizeableActivity="false"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
tools:node="merge">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,76 +30,17 @@

package org.godotengine.editor

import org.godotengine.godot.GodotLib
import org.godotengine.godot.utils.isNativeXRDevice

/**
* Primary window of the Godot Editor.
*
* This is the implementation of the editor used when running on HorizonOS devices.
*/
open class GodotEditor : BaseGodotEditor() {

companion object {
private val TAG = GodotEditor::class.java.simpleName

/** Default behavior, means we check project settings **/
private const val XR_MODE_DEFAULT = "default"

/**
* Ignore project settings, OpenXR is disabled
*/
private const val XR_MODE_OFF = "off"

/**
* Ignore project settings, OpenXR is enabled
*/
private const val XR_MODE_ON = "on"

internal val XR_RUN_GAME_INFO = EditorWindowInfo(GodotXRGame::class.java, 1667, ":GodotXRGame")

internal val USE_SCENE_PERMISSIONS = listOf("com.oculus.permission.USE_SCENE", "horizonos.permission.USE_SCENE")
}

override fun getExcludedPermissions(): MutableSet<String> {
val excludedPermissions = super.getExcludedPermissions()
// The USE_SCENE permission is requested when the "xr/openxr/enabled" project setting
// is enabled.
excludedPermissions.addAll(USE_SCENE_PERMISSIONS)
return excludedPermissions
}

override fun retrieveEditorWindowInfo(args: Array<String>): EditorWindowInfo {
var hasEditor = false
var xrMode = XR_MODE_DEFAULT

var i = 0
while (i < args.size) {
when (args[i++]) {
EDITOR_ARG, EDITOR_ARG_SHORT, EDITOR_PROJECT_MANAGER_ARG, EDITOR_PROJECT_MANAGER_ARG_SHORT -> hasEditor = true
XR_MODE_ARG -> {
xrMode = args[i++]
}
}
}

return if (hasEditor) {
EDITOR_MAIN_INFO
} else {
val openxrEnabled = xrMode == XR_MODE_ON ||
(xrMode == XR_MODE_DEFAULT && GodotLib.getGlobal("xr/openxr/enabled").toBoolean())
if (openxrEnabled && isNativeXRDevice()) {
XR_RUN_GAME_INFO
} else {
RUN_GAME_INFO
}
}
}

override fun getEditorWindowInfoForInstanceId(instanceId: Int): EditorWindowInfo? {
return when (instanceId) {
XR_RUN_GAME_INFO.windowId -> XR_RUN_GAME_INFO
else -> super.getEditorWindowInfoForInstanceId(instanceId)
}
override fun getXRRuntimePermissions(): MutableSet<String> {
val xrRuntimePermissions = super.getXRRuntimePermissions()
xrRuntimePermissions.add("com.oculus.permission.USE_SCENE")
xrRuntimePermissions.add("horizonos.permission.USE_SCENE")
return xrRuntimePermissions
}
}
12 changes: 12 additions & 0 deletions platform/android/java/editor/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@
android:defaultWidth="@dimen/editor_default_window_width"
android:defaultHeight="@dimen/editor_default_window_height" />
</activity>
<activity
android:name=".GodotXRGame"
android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|density|keyboard|navigation|screenLayout|uiMode"
android:process=":GodotXRGame"
android:launchMode="singleTask"
android:icon="@mipmap/ic_play_window"
android:label="@string/godot_game_activity_name"
android:exported="false"
android:screenOrientation="landscape"
android:resizeableActivity="false"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
</activity>
</application>

</manifest>
Loading
Loading