mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-01-31 18:52:54 +08:00
Merge pull request #17 from bdunderscore/fix-vrc-bug-exn-not-blocking
Workaround vrc bug - exceptions don't halt build
This commit is contained in:
commit
27f9898ea4
@ -27,11 +27,11 @@ using VRC.SDKBase.Editor.BuildPipeline;
|
|||||||
|
|
||||||
namespace net.fushizen.modular_avatar.core.editor
|
namespace net.fushizen.modular_avatar.core.editor
|
||||||
{
|
{
|
||||||
public class BoneProxyHook : IVRCSDKPreprocessAvatarCallback
|
public class BoneProxyHook : HookBase
|
||||||
{
|
{
|
||||||
public int callbackOrder => HookSequence.SEQ_BONE_PROXY;
|
public override int callbackOrder => HookSequence.SEQ_BONE_PROXY;
|
||||||
|
|
||||||
public bool OnPreprocessAvatar(GameObject avatarGameObject)
|
protected override bool OnPreprocessAvatarWrapped(GameObject avatarGameObject)
|
||||||
{
|
{
|
||||||
var boneProxies = avatarGameObject.GetComponentsInChildren<ModularAvatarBoneProxy>(true);
|
var boneProxies = avatarGameObject.GetComponentsInChildren<ModularAvatarBoneProxy>(true);
|
||||||
|
|
||||||
|
25
Packages/net.fushizen.modular-avatar/Editor/HookBase.cs
Normal file
25
Packages/net.fushizen.modular-avatar/Editor/HookBase.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
using VRC.SDKBase.Editor.BuildPipeline;
|
||||||
|
|
||||||
|
namespace net.fushizen.modular_avatar.core.editor
|
||||||
|
{
|
||||||
|
public abstract class HookBase : IVRCSDKPreprocessAvatarCallback
|
||||||
|
{
|
||||||
|
public bool OnPreprocessAvatar(GameObject avatarGameObject)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return OnPreprocessAvatarWrapped(avatarGameObject);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogError(e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract bool OnPreprocessAvatarWrapped(GameObject avatarGameObject);
|
||||||
|
public abstract int callbackOrder { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d65a87d13d234177b18f1b0fbbf12360
|
||||||
|
timeCreated: 1662780435
|
@ -30,11 +30,11 @@ namespace net.fushizen.modular_avatar.core.editor
|
|||||||
/**
|
/**
|
||||||
* Ensure that any AvatarTagComponents are purged just before upload.
|
* Ensure that any AvatarTagComponents are purged just before upload.
|
||||||
*/
|
*/
|
||||||
public class LastResortTagComponentCleaner : IVRCSDKPreprocessAvatarCallback
|
public class LastResortTagComponentCleaner : HookBase
|
||||||
{
|
{
|
||||||
public int callbackOrder => 0;
|
public override int callbackOrder => 0;
|
||||||
|
|
||||||
public bool OnPreprocessAvatar(GameObject avatarGameObject)
|
protected override bool OnPreprocessAvatarWrapped(GameObject avatarGameObject)
|
||||||
{
|
{
|
||||||
foreach (var component in avatarGameObject.GetComponentsInChildren<AvatarTagComponent>(true))
|
foreach (var component in avatarGameObject.GetComponentsInChildren<AvatarTagComponent>(true))
|
||||||
{
|
{
|
||||||
|
@ -31,12 +31,12 @@ using VRC.SDKBase.Editor.BuildPipeline;
|
|||||||
|
|
||||||
namespace net.fushizen.modular_avatar.core.editor
|
namespace net.fushizen.modular_avatar.core.editor
|
||||||
{
|
{
|
||||||
public class MergeAnimatorHook : IVRCSDKPreprocessAvatarCallback
|
public class MergeAnimatorHook : HookBase
|
||||||
{
|
{
|
||||||
private const string SAMPLE_PATH_PACKAGE = "Packages/com.vrchat.avatars/Samples/AV3 Demo Assets/Animation/Controllers";
|
private const string SAMPLE_PATH_PACKAGE = "Packages/com.vrchat.avatars/Samples/AV3 Demo Assets/Animation/Controllers";
|
||||||
private const string SAMPLE_PATH_LEGACY = "Assets/VRCSDK/Examples3/Animation/Controllers";
|
private const string SAMPLE_PATH_LEGACY = "Assets/VRCSDK/Examples3/Animation/Controllers";
|
||||||
|
|
||||||
public int callbackOrder => HookSequence.SEQ_MERGE_ANIMATORS;
|
public override int callbackOrder => HookSequence.SEQ_MERGE_ANIMATORS;
|
||||||
|
|
||||||
private Dictionary<VRCAvatarDescriptor.AnimLayerType, AnimatorController> defaultControllers_ =
|
private Dictionary<VRCAvatarDescriptor.AnimLayerType, AnimatorController> defaultControllers_ =
|
||||||
new Dictionary<VRCAvatarDescriptor.AnimLayerType, AnimatorController>();
|
new Dictionary<VRCAvatarDescriptor.AnimLayerType, AnimatorController>();
|
||||||
@ -44,7 +44,7 @@ namespace net.fushizen.modular_avatar.core.editor
|
|||||||
Dictionary<VRCAvatarDescriptor.AnimLayerType, AnimatorCombiner> mergeSessions =
|
Dictionary<VRCAvatarDescriptor.AnimLayerType, AnimatorCombiner> mergeSessions =
|
||||||
new Dictionary<VRCAvatarDescriptor.AnimLayerType, AnimatorCombiner>();
|
new Dictionary<VRCAvatarDescriptor.AnimLayerType, AnimatorCombiner>();
|
||||||
|
|
||||||
public bool OnPreprocessAvatar(GameObject avatarGameObject)
|
protected override bool OnPreprocessAvatarWrapped(GameObject avatarGameObject)
|
||||||
{
|
{
|
||||||
var descriptor = avatarGameObject.GetComponent<VRCAvatarDescriptor>();
|
var descriptor = avatarGameObject.GetComponent<VRCAvatarDescriptor>();
|
||||||
|
|
||||||
|
@ -34,14 +34,14 @@ using Vector3 = UnityEngine.Vector3;
|
|||||||
|
|
||||||
namespace net.fushizen.modular_avatar.core.editor
|
namespace net.fushizen.modular_avatar.core.editor
|
||||||
{
|
{
|
||||||
public class MergeArmatureHook : IVRCSDKPreprocessAvatarCallback
|
public class MergeArmatureHook : HookBase
|
||||||
{
|
{
|
||||||
public int callbackOrder => HookSequence.SEQ_MERGE_ARMATURE;
|
public override int callbackOrder => HookSequence.SEQ_MERGE_ARMATURE;
|
||||||
|
|
||||||
private Dictionary<Transform, Transform> BoneRemappings = new Dictionary<Transform, Transform>();
|
private Dictionary<Transform, Transform> BoneRemappings = new Dictionary<Transform, Transform>();
|
||||||
private List<GameObject> ToDelete = new List<GameObject>();
|
private List<GameObject> ToDelete = new List<GameObject>();
|
||||||
|
|
||||||
public bool OnPreprocessAvatar(GameObject avatarGameObject)
|
protected override bool OnPreprocessAvatarWrapped(GameObject avatarGameObject)
|
||||||
{
|
{
|
||||||
var mergeArmatures = avatarGameObject.transform.GetComponentsInChildren<ModularAvatarMergeArmature>(true);
|
var mergeArmatures = avatarGameObject.transform.GetComponentsInChildren<ModularAvatarMergeArmature>(true);
|
||||||
|
|
||||||
|
@ -30,10 +30,10 @@ using VRC.SDKBase.Editor.BuildPipeline;
|
|||||||
|
|
||||||
namespace net.fushizen.modular_avatar.core.editor
|
namespace net.fushizen.modular_avatar.core.editor
|
||||||
{
|
{
|
||||||
internal class MeshRetargeterResetHook : IVRCSDKPreprocessAvatarCallback
|
internal class MeshRetargeterResetHook : HookBase
|
||||||
{
|
{
|
||||||
public int callbackOrder => HookSequence.SEQ_RESETTERS;
|
public override int callbackOrder => HookSequence.SEQ_RESETTERS;
|
||||||
public bool OnPreprocessAvatar(GameObject avatarGameObject)
|
protected override bool OnPreprocessAvatarWrapped(GameObject avatarGameObject)
|
||||||
{
|
{
|
||||||
BoneDatabase.ResetBones();
|
BoneDatabase.ResetBones();
|
||||||
return true;
|
return true;
|
||||||
@ -84,10 +84,10 @@ namespace net.fushizen.modular_avatar.core.editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class RetargetMeshes : IVRCSDKPreprocessAvatarCallback
|
internal class RetargetMeshes : HookBase
|
||||||
{
|
{
|
||||||
public int callbackOrder => HookSequence.SEQ_RETARGET_MESH;
|
public override int callbackOrder => HookSequence.SEQ_RETARGET_MESH;
|
||||||
public bool OnPreprocessAvatar(GameObject avatarGameObject)
|
protected override bool OnPreprocessAvatarWrapped(GameObject avatarGameObject)
|
||||||
{
|
{
|
||||||
foreach (var renderer in avatarGameObject.GetComponentsInChildren<SkinnedMeshRenderer>(true))
|
foreach (var renderer in avatarGameObject.GetComponentsInChildren<SkinnedMeshRenderer>(true))
|
||||||
{
|
{
|
||||||
|
@ -74,10 +74,10 @@ namespace net.fushizen.modular_avatar.core.editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class ClearPathMappings : IVRCSDKPreprocessAvatarCallback
|
internal class ClearPathMappings : HookBase
|
||||||
{
|
{
|
||||||
public int callbackOrder => HookSequence.SEQ_RESETTERS;
|
public override int callbackOrder => HookSequence.SEQ_RESETTERS;
|
||||||
public bool OnPreprocessAvatar(GameObject avatarGameObject)
|
protected override bool OnPreprocessAvatarWrapped(GameObject avatarGameObject)
|
||||||
{
|
{
|
||||||
PathMappings.Clear();
|
PathMappings.Clear();
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user