Skip to content

Commit

Permalink
[Automated] Merged dev into main
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Oct 11, 2024
2 parents 3224be0 + e989ed6 commit 396015c
Show file tree
Hide file tree
Showing 526 changed files with 139,793 additions and 76 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ jobs:
run: |
git pull
git merge --allow-unrelated-histories $(git commit-tree -p main -m "[Automated] Cleanup" origin/dev^{tree})
- name: Use CHANGELOG and package.json from main
- name: Rename Samples folder
run: |
git checkout HEAD~1 CHANGELOG.md
git checkout HEAD~1 package.json
git rm Samples.meta
git mv Samples Samples~
git commit --amend --no-edit --allow-empty
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ jobs:
run: |
git pull
git merge --no-ff --allow-unrelated-histories -X theirs origin/dev -m "[Automated] Merged dev into main"
- name: Use CHANGELOG and package.json from main
run: |
git checkout HEAD~1 CHANGELOG.md
git checkout HEAD~1 package.json
git commit --amend --no-edit
- name: Push
run: |
git push
57 changes: 41 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,49 @@ jobs:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
- name: Checkout Repository
uses: actions/checkout@v3
- name: Pull latest
run: |
git pull
- name: Setup Node
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 14
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v3
with:
semantic_version: 19
branch: main
extra_plugins: |
@semantic-release/changelog
@semantic-release/npm
@semantic-release/git
node-version: '14'
- name: Extract Version from package.json
id: package_version
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PROJECT_NAME: Unity-Movement
with:
tag_name: v${{ env.VERSION }}
release_name: v${{ env.VERSION }}
draft: false
prerelease: false
- name: Get Changelog Entry
id: changelog
run: |
VERSION=${{ env.VERSION }}
echo "Looking for changelog entries for version $VERSION"
CHANGELOG=$(awk -v ver="$VERSION" 'BEGIN {RS="## "; FS="\n"} $1 ~ ver {for (i=2; i<=NF; i++) print $i}' CHANGELOG.md)
if [ -z "$CHANGELOG" ]; then
echo "No changelog entry found for version $VERSION"
else
echo "Changelog entry found:"
echo "$CHANGELOG"
fi
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Update Release
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const body = process.env.CHANGELOG;
github.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: ${{ steps.create_release.outputs.id }},
body: body
})
4 changes: 2 additions & 2 deletions Editor/Tracking/FaceExpressionModifierDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ public class FaceExpressionModifierDrawer : PropertyDrawer
/// </summary>
public FaceExpressionModifierDrawer()
{
_labelWidth = Math.Max(_labelStyle.CalcSize(_multLabel).x, _labelStyle.CalcSize(_clmpLabel).x);

List<String> blendshapeNameList = new List<string>();
foreach (string e in Enum.GetNames(typeof(OVRFaceExpressions.FaceExpression)))
{
Expand All @@ -66,6 +64,8 @@ public override float GetPropertyHeight(SerializedProperty property, GUIContent
/// <inheritdoc />
public override void OnGUI(Rect rect, SerializedProperty property, GUIContent label)
{
_labelWidth = Math.Max(_labelStyle.CalcSize(_multLabel).x, _labelStyle.CalcSize(_clmpLabel).x);

var faceExpressionsProp =
property.FindPropertyRelative(
nameof(BlendshapeModifier.FaceExpressionModifier.FaceExpressions));
Expand Down
158 changes: 158 additions & 0 deletions Editor/Utils/GenerateBuild.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.

using System;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEngine;

namespace Oculus.Movement.Utils
{
/// <summary>
/// This class contains useful menus used for generating sample builds.
/// </summary>
public class GenerateBuild
{
private static readonly string[] _sceneNames =
new string[] {
"t:scene, MovementAura",
"t:scene, MovementBlendshapeMappingExample",
"t:scene, MovementHighFidelity",
"t:scene, MovementRetargeting",
"t:scene, MovementBodyTrackingForFitness",
"t:scene, MovementHipPinning",
"t:scene, MovementISDKIntegration",
"t:scene, MovementLocomotion"
};

private const string _MAIN_BUILD_NAME = "movement";

/// <summary>
/// Builds an APK with as many samples as possible, depending on whether or not
/// those samples have been imported into the Assets folder or not.
/// </summary>
[MenuItem("Movement/Build Samples APK", priority = 100)]
public static void CreateSamplesBuildAPK()
{
List<string> validScenePaths = new List<string>();
foreach (string sceneName in _sceneNames)
{
var scenePath = PathOfAssetInAssetsFolder(sceneName);
if (scenePath != String.Empty)
{
validScenePaths.Add(scenePath);
}
}

if (validScenePaths.Count == 0)
{
Debug.LogError($"No samples scenes have been imported; cannot build.");
return;
}

GenerateAndroidBuild(validScenePaths.ToArray(), _MAIN_BUILD_NAME,
"MovementSDK Samples", false);
}

private static string PathOfAssetInAssetsFolder(string assetName)
{
string[] guids =
AssetDatabase.FindAssets(assetName, new string[] { "Assets" });
if (guids.Length == 0)
{
return String.Empty;
}
return AssetDatabase.GUIDToAssetPath(guids[0]);
}

private static void GenerateAndroidBuild(string[] buildScenes, string buildName,
string productName, bool exitAfterBuild = true)
{
string previousAppIdentifier = PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.Android);
string previousProductName = PlayerSettings.productName;
string targetAppId = "com.meta." + buildName;
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, targetAppId);
PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARM64;
PlayerSettings.SetScriptingBackend(BuildTargetGroup.Android, ScriptingImplementation.IL2CPP);
bool prevForceSDCardPerm = PlayerSettings.Android.forceSDCardPermission;
PlayerSettings.Android.forceSDCardPermission = false;
PlayerSettings.productName = productName;
BuildPlayerOptions buildOptions = new BuildPlayerOptions()
{
locationPathName = string.Format("builds/{0}.apk", buildName),
scenes = buildScenes,
target = BuildTarget.Android,
targetGroup = BuildTargetGroup.Android,
};
buildOptions.options = new BuildOptions();

try
{
var error = BuildPipeline.BuildPlayer(buildOptions);
RestorePreviousSettings(previousAppIdentifier, previousProductName, prevForceSDCardPerm);
HandleBuildErrors.Check(error, exitAfterBuild, buildScenes);
}
catch
{
Debug.Log("Exception while building: exiting with exit code 2");
RestorePreviousSettings(previousAppIdentifier, previousProductName, prevForceSDCardPerm);
EditorApplication.Exit(2);
}
}

private static void RestorePreviousSettings(string previousAppIdentifier, string previousProductName,
bool prevForceSDCardPerm)
{
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, previousAppIdentifier);
PlayerSettings.productName = previousProductName;
PlayerSettings.Android.forceSDCardPermission = prevForceSDCardPerm;
}
}

/// <summary>
/// Handles errors after build process. This can be used to catch the edge case where
/// builds don't actually succeed even if they are marked as doing so.
/// </summary>
public static class HandleBuildErrors
{
/// <summary>
/// Check for build error edge cases.
/// </summary>
/// <param name="buildReport">Build report.</param>
/// <param name="exitAfterBuild">If we need to exit after the build or not.</param>
/// <param name="scenesBuilt">Scenes built.</param>
public static void Check(UnityEditor.Build.Reporting.BuildReport buildReport, bool exitAfterBuild,
string[] scenesBuilt)
{
bool buildSucceeded =
buildReport.summary.result == UnityEditor.Build.Reporting.BuildResult.Succeeded;
if (buildReport.summary.platform == BuildTarget.Android)
{
// Android can fail to produce the output even if the build is marked as succeeded in some rare
// scenarios, notably if the Unity directory is read-only. This should be handled.
buildSucceeded = buildSucceeded && File.Exists(buildReport.summary.outputPath);
}
if (buildSucceeded)
{
foreach (var scene in scenesBuilt)
{
Debug.Log($"Built scene {scene}.");
}
Debug.Log("Exiting with code 0. Success.");

if (exitAfterBuild)
{
EditorApplication.Exit(0);
}
}
else
{
Debug.Log("Exiting with code 1. Failure.");
if (exitAfterBuild)
{
EditorApplication.Exit(1);
}
}
}
}
}
11 changes: 11 additions & 0 deletions Editor/Utils/GenerateBuild.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 0 additions & 20 deletions Editor/Utils/HelperMenusFace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,9 @@ internal static class HelperMenusFace
"Correctives Face";
private const string _ARKIT_FACE_MENU =
"ARKit Face";
private const string _NO_DUPLICATES_SUFFIX =
" (duplicate mapping off)";

[MenuItem(AddComponentsHelper._MOVEMENT_SAMPLES_MENU + _MOVEMENT_SAMPLES_FT_MENU +
_CORRECTIVES_FACE_MENU)]
private static void SetupCharacterForCorrectivesFace()
{
var activeGameObject = Selection.activeGameObject;

AddComponentsHelper.SetUpCharacterForCorrectivesFace(activeGameObject, true);
}

[MenuItem(AddComponentsHelper._MOVEMENT_SAMPLES_MENU + _MOVEMENT_SAMPLES_FT_MENU +
_CORRECTIVES_FACE_MENU + _NO_DUPLICATES_SUFFIX)]
private static void SetupCharacterForCorrectivesFaceNoDuplicates()
{
var activeGameObject = Selection.activeGameObject;
Expand All @@ -37,15 +26,6 @@ private static void SetupCharacterForCorrectivesFaceNoDuplicates()
}

[MenuItem(AddComponentsHelper._MOVEMENT_SAMPLES_MENU + _MOVEMENT_SAMPLES_FT_MENU + _ARKIT_FACE_MENU)]
private static void SetupCharacterForARKitFace()
{
var activeGameObject = Selection.activeGameObject;

AddComponentsHelper.SetUpCharacterForARKitFace(activeGameObject, true);
}

[MenuItem(AddComponentsHelper._MOVEMENT_SAMPLES_MENU + _MOVEMENT_SAMPLES_FT_MENU + _ARKIT_FACE_MENU
+ _NO_DUPLICATES_SUFFIX)]
private static void SetupCharacterForARKitFaceNoDuplicates()
{
var activeGameObject = Selection.activeGameObject;
Expand Down
4 changes: 1 addition & 3 deletions Editor/Utils/ProjectValidation.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.

using UnityEditor;
using UnityEngine;
using UnityEngine.SceneManagement;

namespace Oculus.Movement.Utils
{
Expand All @@ -13,7 +11,7 @@ namespace Oculus.Movement.Utils
public class ProjectValidation
{
[MenuItem("Movement/Check Project Settings", priority = 100)]
public static void BuildProjectAndroid64()
public static void CheckProjectSettings()
{
ProjectSettingsValidationWindow.ShowProjectSettingsValidationWindow();
}
Expand Down
12 changes: 3 additions & 9 deletions Runtime/Scripts/AnimationRigging/RiggingUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static Transform FindBoneTransformFromCustomSkeleton(
/// <returns>Bone transform.</returns>
public static Transform FindBoneTransformFromSkeleton(
OVRSkeleton skeleton,
OVRSkeleton.BoneId boneId,
int boneId,
bool isBindPose = false)
{
if (!skeleton.IsInitialized ||
Expand All @@ -69,14 +69,8 @@ public static Transform FindBoneTransformFromSkeleton(
}

var bones = isBindPose ? skeleton.BindPoses : skeleton.Bones;
for (int boneIndex = 0; boneIndex < bones.Count; boneIndex++)
{
if (bones[boneIndex].Id == boneId)
{
return bones[boneIndex].Transform;
}
}
return null;

return bones[boneId].Transform;
}

/// <summary>
Expand Down
Loading

0 comments on commit 396015c

Please sign in to comment.