mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-01-17 20:00:06 +08:00
feat: improve handling of editoronly objects (#224)
This commit is contained in:
parent
db7be7107c
commit
d39c098893
@ -150,6 +150,8 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
AssetDatabase.StartAssetEditing();
|
AssetDatabase.StartAssetEditing();
|
||||||
nowProcessing = true;
|
nowProcessing = true;
|
||||||
|
|
||||||
|
ClearEditorOnlyTagComponents(avatarGameObject.transform);
|
||||||
|
|
||||||
BoneDatabase.ResetBones();
|
BoneDatabase.ResetBones();
|
||||||
PathMappings.Init(vrcAvatarDescriptor.gameObject);
|
PathMappings.Init(vrcAvatarDescriptor.gameObject);
|
||||||
ClonedMenuMappings.Clear();
|
ClonedMenuMappings.Clear();
|
||||||
@ -216,6 +218,28 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void ClearEditorOnlyTagComponents(Transform obj)
|
||||||
|
{
|
||||||
|
// EditorOnly objects can be used for multiple purposes - users might want a camera rig to be available in
|
||||||
|
// play mode, for example. For now, we'll prune MA components from EditorOnly objects, but otherwise leave
|
||||||
|
// them in place when in play mode.
|
||||||
|
|
||||||
|
if (obj.CompareTag("EditorOnly"))
|
||||||
|
{
|
||||||
|
foreach (var component in obj.GetComponentsInChildren<AvatarTagComponent>(true))
|
||||||
|
{
|
||||||
|
UnityEngine.Object.DestroyImmediate(component);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (Transform transform in obj)
|
||||||
|
{
|
||||||
|
ClearEditorOnlyTagComponents(transform);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[SuppressMessage("ReSharper", "PossibleNullReferenceException")]
|
[SuppressMessage("ReSharper", "PossibleNullReferenceException")]
|
||||||
private static void FixupAnimatorDebugData(GameObject avatarGameObject)
|
private static void FixupAnimatorDebugData(GameObject avatarGameObject)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user