Skip to content

Commit 396015c

Browse files
committed
[Automated] Merged dev into main
2 parents 3224be0 + e989ed6 commit 396015c

File tree

526 files changed

+139793
-76
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

526 files changed

+139793
-76
lines changed

.github/workflows/cleanup.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ jobs:
2121
run: |
2222
git pull
2323
git merge --allow-unrelated-histories $(git commit-tree -p main -m "[Automated] Cleanup" origin/dev^{tree})
24-
- name: Use CHANGELOG and package.json from main
24+
- name: Rename Samples folder
2525
run: |
26-
git checkout HEAD~1 CHANGELOG.md
27-
git checkout HEAD~1 package.json
2826
git rm Samples.meta
2927
git mv Samples Samples~
3028
git commit --amend --no-edit --allow-empty

.github/workflows/merge.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ jobs:
2121
run: |
2222
git pull
2323
git merge --no-ff --allow-unrelated-histories -X theirs origin/dev -m "[Automated] Merged dev into main"
24-
- name: Use CHANGELOG and package.json from main
25-
run: |
26-
git checkout HEAD~1 CHANGELOG.md
27-
git checkout HEAD~1 package.json
28-
git commit --amend --no-edit
2924
- name: Push
3025
run: |
3126
git push

.github/workflows/release.yml

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,49 @@ jobs:
1414
name: Release
1515
runs-on: ubuntu-latest
1616
steps:
17-
- name: Checkout
17+
- name: Checkout Repository
1818
uses: actions/checkout@v3
19-
- name: Pull latest
20-
run: |
21-
git pull
22-
- name: Setup Node
19+
- name: Set up Node.js
2320
uses: actions/setup-node@v3
2421
with:
25-
node-version: 14
26-
- name: Semantic Release
27-
uses: cycjimmy/semantic-release-action@v3
28-
with:
29-
semantic_version: 19
30-
branch: main
31-
extra_plugins: |
32-
@semantic-release/changelog
33-
@semantic-release/npm
34-
@semantic-release/git
22+
node-version: '14'
23+
- name: Extract Version from package.json
24+
id: package_version
25+
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
26+
- name: Create Release
27+
id: create_release
28+
uses: actions/create-release@v1
3529
env:
3630
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37-
PROJECT_NAME: Unity-Movement
31+
with:
32+
tag_name: v${{ env.VERSION }}
33+
release_name: v${{ env.VERSION }}
34+
draft: false
35+
prerelease: false
36+
- name: Get Changelog Entry
37+
id: changelog
38+
run: |
39+
VERSION=${{ env.VERSION }}
40+
echo "Looking for changelog entries for version $VERSION"
41+
CHANGELOG=$(awk -v ver="$VERSION" 'BEGIN {RS="## "; FS="\n"} $1 ~ ver {for (i=2; i<=NF; i++) print $i}' CHANGELOG.md)
42+
if [ -z "$CHANGELOG" ]; then
43+
echo "No changelog entry found for version $VERSION"
44+
else
45+
echo "Changelog entry found:"
46+
echo "$CHANGELOG"
47+
fi
48+
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
49+
echo "$CHANGELOG" >> $GITHUB_ENV
50+
echo "EOF" >> $GITHUB_ENV
51+
- name: Update Release
52+
uses: actions/github-script@v3
53+
with:
54+
github-token: ${{ secrets.GITHUB_TOKEN }}
55+
script: |
56+
const body = process.env.CHANGELOG;
57+
github.repos.updateRelease({
58+
owner: context.repo.owner,
59+
repo: context.repo.repo,
60+
release_id: ${{ steps.create_release.outputs.id }},
61+
body: body
62+
})

Editor/Tracking/FaceExpressionModifierDrawer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ public class FaceExpressionModifierDrawer : PropertyDrawer
3939
/// </summary>
4040
public FaceExpressionModifierDrawer()
4141
{
42-
_labelWidth = Math.Max(_labelStyle.CalcSize(_multLabel).x, _labelStyle.CalcSize(_clmpLabel).x);
43-
4442
List<String> blendshapeNameList = new List<string>();
4543
foreach (string e in Enum.GetNames(typeof(OVRFaceExpressions.FaceExpression)))
4644
{
@@ -66,6 +64,8 @@ public override float GetPropertyHeight(SerializedProperty property, GUIContent
6664
/// <inheritdoc />
6765
public override void OnGUI(Rect rect, SerializedProperty property, GUIContent label)
6866
{
67+
_labelWidth = Math.Max(_labelStyle.CalcSize(_multLabel).x, _labelStyle.CalcSize(_clmpLabel).x);
68+
6969
var faceExpressionsProp =
7070
property.FindPropertyRelative(
7171
nameof(BlendshapeModifier.FaceExpressionModifier.FaceExpressions));

Editor/Utils/GenerateBuild.cs

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
// Copyright (c) Meta Platforms, Inc. and affiliates.
2+
3+
using System;
4+
using System.Collections.Generic;
5+
using System.IO;
6+
using UnityEditor;
7+
using UnityEngine;
8+
9+
namespace Oculus.Movement.Utils
10+
{
11+
/// <summary>
12+
/// This class contains useful menus used for generating sample builds.
13+
/// </summary>
14+
public class GenerateBuild
15+
{
16+
private static readonly string[] _sceneNames =
17+
new string[] {
18+
"t:scene, MovementAura",
19+
"t:scene, MovementBlendshapeMappingExample",
20+
"t:scene, MovementHighFidelity",
21+
"t:scene, MovementRetargeting",
22+
"t:scene, MovementBodyTrackingForFitness",
23+
"t:scene, MovementHipPinning",
24+
"t:scene, MovementISDKIntegration",
25+
"t:scene, MovementLocomotion"
26+
};
27+
28+
private const string _MAIN_BUILD_NAME = "movement";
29+
30+
/// <summary>
31+
/// Builds an APK with as many samples as possible, depending on whether or not
32+
/// those samples have been imported into the Assets folder or not.
33+
/// </summary>
34+
[MenuItem("Movement/Build Samples APK", priority = 100)]
35+
public static void CreateSamplesBuildAPK()
36+
{
37+
List<string> validScenePaths = new List<string>();
38+
foreach (string sceneName in _sceneNames)
39+
{
40+
var scenePath = PathOfAssetInAssetsFolder(sceneName);
41+
if (scenePath != String.Empty)
42+
{
43+
validScenePaths.Add(scenePath);
44+
}
45+
}
46+
47+
if (validScenePaths.Count == 0)
48+
{
49+
Debug.LogError($"No samples scenes have been imported; cannot build.");
50+
return;
51+
}
52+
53+
GenerateAndroidBuild(validScenePaths.ToArray(), _MAIN_BUILD_NAME,
54+
"MovementSDK Samples", false);
55+
}
56+
57+
private static string PathOfAssetInAssetsFolder(string assetName)
58+
{
59+
string[] guids =
60+
AssetDatabase.FindAssets(assetName, new string[] { "Assets" });
61+
if (guids.Length == 0)
62+
{
63+
return String.Empty;
64+
}
65+
return AssetDatabase.GUIDToAssetPath(guids[0]);
66+
}
67+
68+
private static void GenerateAndroidBuild(string[] buildScenes, string buildName,
69+
string productName, bool exitAfterBuild = true)
70+
{
71+
string previousAppIdentifier = PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.Android);
72+
string previousProductName = PlayerSettings.productName;
73+
string targetAppId = "com.meta." + buildName;
74+
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, targetAppId);
75+
PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARM64;
76+
PlayerSettings.SetScriptingBackend(BuildTargetGroup.Android, ScriptingImplementation.IL2CPP);
77+
bool prevForceSDCardPerm = PlayerSettings.Android.forceSDCardPermission;
78+
PlayerSettings.Android.forceSDCardPermission = false;
79+
PlayerSettings.productName = productName;
80+
BuildPlayerOptions buildOptions = new BuildPlayerOptions()
81+
{
82+
locationPathName = string.Format("builds/{0}.apk", buildName),
83+
scenes = buildScenes,
84+
target = BuildTarget.Android,
85+
targetGroup = BuildTargetGroup.Android,
86+
};
87+
buildOptions.options = new BuildOptions();
88+
89+
try
90+
{
91+
var error = BuildPipeline.BuildPlayer(buildOptions);
92+
RestorePreviousSettings(previousAppIdentifier, previousProductName, prevForceSDCardPerm);
93+
HandleBuildErrors.Check(error, exitAfterBuild, buildScenes);
94+
}
95+
catch
96+
{
97+
Debug.Log("Exception while building: exiting with exit code 2");
98+
RestorePreviousSettings(previousAppIdentifier, previousProductName, prevForceSDCardPerm);
99+
EditorApplication.Exit(2);
100+
}
101+
}
102+
103+
private static void RestorePreviousSettings(string previousAppIdentifier, string previousProductName,
104+
bool prevForceSDCardPerm)
105+
{
106+
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, previousAppIdentifier);
107+
PlayerSettings.productName = previousProductName;
108+
PlayerSettings.Android.forceSDCardPermission = prevForceSDCardPerm;
109+
}
110+
}
111+
112+
/// <summary>
113+
/// Handles errors after build process. This can be used to catch the edge case where
114+
/// builds don't actually succeed even if they are marked as doing so.
115+
/// </summary>
116+
public static class HandleBuildErrors
117+
{
118+
/// <summary>
119+
/// Check for build error edge cases.
120+
/// </summary>
121+
/// <param name="buildReport">Build report.</param>
122+
/// <param name="exitAfterBuild">If we need to exit after the build or not.</param>
123+
/// <param name="scenesBuilt">Scenes built.</param>
124+
public static void Check(UnityEditor.Build.Reporting.BuildReport buildReport, bool exitAfterBuild,
125+
string[] scenesBuilt)
126+
{
127+
bool buildSucceeded =
128+
buildReport.summary.result == UnityEditor.Build.Reporting.BuildResult.Succeeded;
129+
if (buildReport.summary.platform == BuildTarget.Android)
130+
{
131+
// Android can fail to produce the output even if the build is marked as succeeded in some rare
132+
// scenarios, notably if the Unity directory is read-only. This should be handled.
133+
buildSucceeded = buildSucceeded && File.Exists(buildReport.summary.outputPath);
134+
}
135+
if (buildSucceeded)
136+
{
137+
foreach (var scene in scenesBuilt)
138+
{
139+
Debug.Log($"Built scene {scene}.");
140+
}
141+
Debug.Log("Exiting with code 0. Success.");
142+
143+
if (exitAfterBuild)
144+
{
145+
EditorApplication.Exit(0);
146+
}
147+
}
148+
else
149+
{
150+
Debug.Log("Exiting with code 1. Failure.");
151+
if (exitAfterBuild)
152+
{
153+
EditorApplication.Exit(1);
154+
}
155+
}
156+
}
157+
}
158+
}

Editor/Utils/GenerateBuild.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/Utils/HelperMenusFace.cs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,9 @@ internal static class HelperMenusFace
1515
"Correctives Face";
1616
private const string _ARKIT_FACE_MENU =
1717
"ARKit Face";
18-
private const string _NO_DUPLICATES_SUFFIX =
19-
" (duplicate mapping off)";
2018

2119
[MenuItem(AddComponentsHelper._MOVEMENT_SAMPLES_MENU + _MOVEMENT_SAMPLES_FT_MENU +
2220
_CORRECTIVES_FACE_MENU)]
23-
private static void SetupCharacterForCorrectivesFace()
24-
{
25-
var activeGameObject = Selection.activeGameObject;
26-
27-
AddComponentsHelper.SetUpCharacterForCorrectivesFace(activeGameObject, true);
28-
}
29-
30-
[MenuItem(AddComponentsHelper._MOVEMENT_SAMPLES_MENU + _MOVEMENT_SAMPLES_FT_MENU +
31-
_CORRECTIVES_FACE_MENU + _NO_DUPLICATES_SUFFIX)]
3221
private static void SetupCharacterForCorrectivesFaceNoDuplicates()
3322
{
3423
var activeGameObject = Selection.activeGameObject;
@@ -37,15 +26,6 @@ private static void SetupCharacterForCorrectivesFaceNoDuplicates()
3726
}
3827

3928
[MenuItem(AddComponentsHelper._MOVEMENT_SAMPLES_MENU + _MOVEMENT_SAMPLES_FT_MENU + _ARKIT_FACE_MENU)]
40-
private static void SetupCharacterForARKitFace()
41-
{
42-
var activeGameObject = Selection.activeGameObject;
43-
44-
AddComponentsHelper.SetUpCharacterForARKitFace(activeGameObject, true);
45-
}
46-
47-
[MenuItem(AddComponentsHelper._MOVEMENT_SAMPLES_MENU + _MOVEMENT_SAMPLES_FT_MENU + _ARKIT_FACE_MENU
48-
+ _NO_DUPLICATES_SUFFIX)]
4929
private static void SetupCharacterForARKitFaceNoDuplicates()
5030
{
5131
var activeGameObject = Selection.activeGameObject;

Editor/Utils/ProjectValidation.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright (c) Meta Platforms, Inc. and affiliates.
22

33
using UnityEditor;
4-
using UnityEngine;
5-
using UnityEngine.SceneManagement;
64

75
namespace Oculus.Movement.Utils
86
{
@@ -13,7 +11,7 @@ namespace Oculus.Movement.Utils
1311
public class ProjectValidation
1412
{
1513
[MenuItem("Movement/Check Project Settings", priority = 100)]
16-
public static void BuildProjectAndroid64()
14+
public static void CheckProjectSettings()
1715
{
1816
ProjectSettingsValidationWindow.ShowProjectSettingsValidationWindow();
1917
}

Runtime/Scripts/AnimationRigging/RiggingUtilities.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static Transform FindBoneTransformFromCustomSkeleton(
5959
/// <returns>Bone transform.</returns>
6060
public static Transform FindBoneTransformFromSkeleton(
6161
OVRSkeleton skeleton,
62-
OVRSkeleton.BoneId boneId,
62+
int boneId,
6363
bool isBindPose = false)
6464
{
6565
if (!skeleton.IsInitialized ||
@@ -69,14 +69,8 @@ public static Transform FindBoneTransformFromSkeleton(
6969
}
7070

7171
var bones = isBindPose ? skeleton.BindPoses : skeleton.Bones;
72-
for (int boneIndex = 0; boneIndex < bones.Count; boneIndex++)
73-
{
74-
if (bones[boneIndex].Id == boneId)
75-
{
76-
return bones[boneIndex].Transform;
77-
}
78-
}
79-
return null;
72+
73+
return bones[boneId].Transform;
8074
}
8175

8276
/// <summary>

0 commit comments

Comments
 (0)