Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 18 additions & 0 deletions Editor/Marker Editor.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "VRLabs Marker Editor",
"rootNamespace": "",
"references": [
"GUID:2740cbf73e918894f95147c6a53f959c"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
7 changes: 7 additions & 0 deletions Editor/Marker Editor.asmdef.meta

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

24 changes: 11 additions & 13 deletions Editor/MarkerEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,9 @@ public void Generate()
// Install layers, parameters, and menu before prefab setup
// FX layer
if (useIndexFinger)
AssetDatabase.CopyAsset("Assets/VRLabs/Marker/Resources/M_FX (Finger).controller", directory + "FXtemp.controller");
AssetDatabase.CopyAsset(AssetDatabase.GetAssetPath(Resources.Load<AnimatorController>("M_FX (Finger)")), directory + "FXtemp.controller");
else
AssetDatabase.CopyAsset("Assets/VRLabs/Marker/Resources/M_FX.controller", directory + "FXtemp.controller");
AssetDatabase.CopyAsset(AssetDatabase.GetAssetPath(Resources.Load<AnimatorController>("M_FX")), directory + "FXtemp.controller");
AnimatorController FX = AssetDatabase.LoadAssetAtPath(directory + "FXtemp.controller", typeof(AnimatorController)) as AnimatorController;

// remove controller layers before merging to avatar, corresponding to setup
Expand Down Expand Up @@ -374,12 +374,12 @@ public void Generate()
AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(FX)); // delete temporary FX layer

// Gesture layer
AssetDatabase.CopyAsset("Assets/VRLabs/Marker/Resources/M_Gesture.controller", directory + "gestureTemp.controller"); // to modify
AssetDatabase.CopyAsset(AssetDatabase.GetAssetPath(Resources.Load<AnimatorController>("M_Gesture")), directory + "gestureTemp.controller"); // to modify
AnimatorController gesture = AssetDatabase.LoadAssetAtPath(directory + "gestureTemp.controller", typeof(AnimatorController)) as AnimatorController;

if (descriptor.baseAnimationLayers[2].isDefault == true || descriptor.baseAnimationLayers[2].animatorController == null)
{
AssetDatabase.CopyAsset("Assets/VRLabs/Marker/Resources/Default/M_DefaultGesture.controller", directory + "Gesture.controller");
AssetDatabase.CopyAsset(AssetDatabase.GetAssetPath(Resources.Load<AnimatorController>("Default/M_DefaultGesture")), directory + "Gesture.controller");
AnimatorController gestureOriginal = AssetDatabase.LoadAssetAtPath(directory + "Gesture.controller", typeof(AnimatorController)) as AnimatorController;

descriptor.customExpressions = true;
Expand All @@ -400,11 +400,11 @@ public void Generate()
{
if (gesture.layers[0].stateMachine.states[i].state.motion.name == "M_Gesture")
{
gesture.layers[0].stateMachine.states[i].state.motion = AssetDatabase.LoadAssetAtPath("Assets/VRLabs/Marker/Resources/Animations/Gesture/M_Gesture (Finger).anim", typeof(AnimationClip)) as AnimationClip;
gesture.layers[0].stateMachine.states[i].state.motion = AssetDatabase.LoadAssetAtPath(AssetDatabase.GetAssetPath(Resources.Load<AnimationClip>("Animations/Gesture/M_Gesture (Finger)")), typeof(AnimationClip)) as AnimationClip;
}
else if (gesture.layers[0].stateMachine.states[i].state.motion.name == "M_Gesture Draw")
{
gesture.layers[0].stateMachine.states[i].state.motion = AssetDatabase.LoadAssetAtPath("Assets/VRLabs/Marker/Resources/Animations/Gesture/M_Gesture Draw (Finger).anim", typeof(AnimationClip)) as AnimationClip;
gesture.layers[0].stateMachine.states[i].state.motion = AssetDatabase.LoadAssetAtPath(AssetDatabase.GetAssetPath(Resources.Load<AnimationClip>("Animations/Gesture/M_Gesture Draw (Finger)")), typeof(AnimationClip)) as AnimationClip;
}
}
}
Expand Down Expand Up @@ -486,7 +486,7 @@ public void Generate()
ScriptFunctions.AddParameter(descriptor, p_menu, directory);

// handle menu instancing
AssetDatabase.CopyAsset("Assets/VRLabs/Marker/Resources/M_Menu.asset", directory + "Marker Menu.asset");
AssetDatabase.CopyAsset(AssetDatabase.GetAssetPath(Resources.Load<VRCExpressionsMenu>("M_Menu")), directory + "Marker Menu.asset");
VRCExpressionsMenu markerMenu = AssetDatabase.LoadAssetAtPath(directory + "Marker Menu.asset", typeof(VRCExpressionsMenu)) as VRCExpressionsMenu;

if (!localSpace) // change from submenu to 1 toggle
Expand All @@ -499,7 +499,7 @@ public void Generate()
}
else
{
AssetDatabase.CopyAsset("Assets/VRLabs/Marker/Resources/M_Menu Space.asset", directory + "Marker Space Submenu.asset");
AssetDatabase.CopyAsset(AssetDatabase.GetAssetPath(Resources.Load<VRCExpressionsMenu>("M_Menu Space")), directory + "Marker Space Submenu.asset");
VRCExpressionsMenu subMenu = AssetDatabase.LoadAssetAtPath(directory + "Marker Space Submenu.asset", typeof(VRCExpressionsMenu)) as VRCExpressionsMenu;

if (localSpaceFullBody == 0) // remove left and right foot controls
Expand All @@ -521,11 +521,11 @@ public void Generate()

VRCExpressionsMenu.Control.Parameter pm_menu = new VRCExpressionsMenu.Control.Parameter
{ name = "M_Menu" };
Texture2D markerIcon = AssetDatabase.LoadAssetAtPath("Assets/VRLabs/Marker/Resources/Icons/M_Icon_Menu.png", typeof(Texture2D)) as Texture2D;
Texture2D markerIcon = AssetDatabase.LoadAssetAtPath(AssetDatabase.GetAssetPath(Resources.Load<Texture2D>("Icons/M_Icon_Menu")), typeof(Texture2D)) as Texture2D;
ScriptFunctions.AddSubMenu(descriptor, markerMenu, "Marker", directory, pm_menu, markerIcon);

// setup in scene
GameObject marker = PrefabUtility.InstantiatePrefab(AssetDatabase.LoadAssetAtPath("Assets/VRLabs/Marker/Resources/Marker.prefab", typeof(GameObject))) as GameObject;
GameObject marker = PrefabUtility.InstantiatePrefab(AssetDatabase.LoadAssetAtPath(AssetDatabase.GetAssetPath(Resources.Load<GameObject>("Marker")), typeof(GameObject))) as GameObject;
if (PrefabUtility.IsPartOfPrefabInstance(marker))
PrefabUtility.UnpackPrefabInstance(marker, PrefabUnpackMode.Completely, InteractionMode.AutomatedAction);
marker.transform.SetParent(avatar.transform, false);
Expand Down Expand Up @@ -629,9 +629,7 @@ public void Generate()
private void CheckRequirements()
{
warnings.Clear();
if (!AssetDatabase.IsValidFolder("Assets/VRLabs/Marker"))
warnings.Add("The folder at path 'Assets/VRLabs/Marker' could not be found. Make sure you are importing a Unity package and not moving the folder.");


if (descriptor == null)
warnings.Add("There is no avatar descriptor on this GameObject. Please move this script onto your avatar, or create an avatar descriptor here.");
else
Expand Down
12 changes: 6 additions & 6 deletions Editor/ScriptFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ public static class ScriptFunctions
// ideally do not use these default paths; manage it from script's end by providing own copy of default animator.
public static readonly string[] _defaultLayerPath =
{
"Assets/VRLabs/Marker/Resources/Default/M_DefaultLocomotion.controller",
"Assets/VRLabs/Marker/Resources/Default/M_DefaultIdle.controller",
"Assets/VRLabs/Marker/Resources/Default/M_DefaultGesture.controller",
"Assets/VRLabs/Marker/Resources/Default/M_DefaultAction.controller"
"Default/M_DefaultLocomotion",
"Default/M_DefaultIdle",
"Default/M_DefaultGesture",
"Default/M_DefaultAction"
};

// Default parameters
Expand Down Expand Up @@ -221,7 +221,7 @@ public static void MergeController(VRCAvatarDescriptor descriptor, AnimatorContr
}
else if (layer < 4) // fx layer has no default layer
{
if ((AssetDatabase.LoadAssetAtPath(_defaultLayerPath[layer], typeof(AnimatorController)) as AnimatorController) == null)
if (Resources.Load<AnimatorController>(_defaultLayerPath[layer]) == null)
{
Debug.LogError("Couldn't find VRChat's default animator controller at path '" + _defaultLayerPath[layer] + "'! Merging was not performed.");
return;
Expand Down Expand Up @@ -250,7 +250,7 @@ public static void MergeController(VRCAvatarDescriptor descriptor, AnimatorContr
}
else
{
AssetDatabase.CopyAsset(_defaultLayerPath[layer], pathFromNew);
AssetDatabase.CopyAsset(AssetDatabase.GetAssetPath(Resources.Load<AnimatorController>(_defaultLayerPath[layer])), pathFromNew);
controllerOriginal = AssetDatabase.LoadAssetAtPath(pathFromNew, typeof(AnimatorController)) as AnimatorController;
}
descriptor.baseAnimationLayers[layer].animatorController = controllerOriginal;
Expand Down
8 changes: 8 additions & 0 deletions Runtime.meta

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

14 changes: 14 additions & 0 deletions Runtime/Marker.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "VRLabs Marker",
"rootNamespace": "",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
7 changes: 7 additions & 0 deletions Runtime/Marker.asmdef.meta

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

0 Marker.cs → Runtime/Marker.cs
100755 → 100644
File renamed without changes.
File renamed without changes.