ugh
This commit is contained in:
parent
6031db6620
commit
4809e7cfa0
17 changed files with 276 additions and 159 deletions
8
PlatformSpecificFX/Editor.meta
Normal file
8
PlatformSpecificFX/Editor.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4fb4c374accfed2468cd020df25fe43c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
22
PlatformSpecificFX/Editor/PlatformSpecificFXEditor.asmdef
Normal file
22
PlatformSpecificFX/Editor/PlatformSpecificFXEditor.asmdef
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"name": "PlatformSpecificFXEditor",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:62ced99b048af7f4d8dfe4bed8373d76",
|
||||
"GUID:5718fb738711cd34ea54e9553040911d",
|
||||
"GUID:901e56b065a857d4483a77f8cae73588",
|
||||
"GUID:209cbd2a789c4f72963fdbf1f8a01909",
|
||||
"GUID:424958f3f014e9b43ab88ec66b389caf"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c8c6365cf8a2e724caa7fe8be7e75792
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
51
PlatformSpecificFX/Editor/PlatformSpecificFXPlugin.cs
Normal file
51
PlatformSpecificFX/Editor/PlatformSpecificFXPlugin.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using gay.lilyy.platformspecificfx;
|
||||
using nadena.dev.ndmf;
|
||||
using nadena.dev.ndmf.vrchat;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using VRC.SDK3.Avatars.Components;
|
||||
|
||||
[assembly: ExportsPlugin(typeof(PlatformSpecificFXPlugin))]
|
||||
|
||||
namespace gay.lilyy.platformspecificfx
|
||||
{
|
||||
public class PlatformSpecificFXPlugin : Plugin<PlatformSpecificFXPlugin>
|
||||
{
|
||||
public override string DisplayName => "Platform Specific FX";
|
||||
public override string QualifiedName => "gay.lilyy.platformspecificfx";
|
||||
|
||||
protected override void Configure()
|
||||
{
|
||||
InPhase(BuildPhase.FirstChance).Run("PlatformSpecificFX", ctx =>
|
||||
{
|
||||
var configs = ctx.AvatarRootObject.GetComponentsInChildren<PlatformSpecificFX>(true);
|
||||
if (configs == null || configs.Length == 0)
|
||||
return;
|
||||
|
||||
var targetAnimator = EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows
|
||||
|| EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows64 ?
|
||||
configs[0].desktop : configs[0].mobile;
|
||||
if (targetAnimator == null) throw new Exception("Target animator not found");
|
||||
|
||||
var baseAnimationLayers = ctx.VRChatAvatarDescriptor().baseAnimationLayers.ToList();
|
||||
// replace the fx layer with the target animator
|
||||
var foundFXLayer = false;
|
||||
for (int i = 0; i < baseAnimationLayers.Count; i++)
|
||||
{
|
||||
var layer = baseAnimationLayers[i];
|
||||
if (layer.type == VRCAvatarDescriptor.AnimLayerType.FX) {
|
||||
Debug.Log($"Found FX Layer, Replacing with {targetAnimator.name}");
|
||||
layer.animatorController = targetAnimator;
|
||||
baseAnimationLayers[i] = layer;
|
||||
foundFXLayer = true;
|
||||
}
|
||||
}
|
||||
if (!foundFXLayer) throw new Exception("FX Layer not found");
|
||||
ctx.VRChatAvatarDescriptor().baseAnimationLayers = baseAnimationLayers.ToArray();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
11
PlatformSpecificFX/Editor/PlatformSpecificFXPlugin.cs.meta
Normal file
11
PlatformSpecificFX/Editor/PlatformSpecificFXPlugin.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1ce53e373aea68e4b97c79e7e8df274c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
PlatformSpecificFX/Runtime.meta
Normal file
8
PlatformSpecificFX/Runtime.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fb1855544ce8de94794ec16500fad59c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
13
PlatformSpecificFX/Runtime/PlatformSpecificFX.cs
Normal file
13
PlatformSpecificFX/Runtime/PlatformSpecificFX.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
using UnityEditor.Animations;
|
||||
using UnityEngine;
|
||||
|
||||
namespace gay.lilyy.platformspecificfx
|
||||
{
|
||||
[AddComponentMenu("LillithRosePup/Platform Specific FX")]
|
||||
public class PlatformSpecificFX : MonoBehaviour, VRC.SDKBase.IEditorOnly
|
||||
{
|
||||
public AnimatorController desktop;
|
||||
public AnimatorController mobile;
|
||||
}
|
||||
}
|
||||
|
||||
11
PlatformSpecificFX/Runtime/PlatformSpecificFX.cs.meta
Normal file
11
PlatformSpecificFX/Runtime/PlatformSpecificFX.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 24bc2531ec6d029449c1cf0e322c6612
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
14
PlatformSpecificFX/Runtime/PlatformSpecificFXRuntime.asmdef
Normal file
14
PlatformSpecificFX/Runtime/PlatformSpecificFXRuntime.asmdef
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "PlatformSpecificFXRuntime",
|
||||
"rootNamespace": "",
|
||||
"references": [],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 424958f3f014e9b43ab88ec66b389caf
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Add table
Add a link
Reference in a new issue