mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-01-30 18:22:52 +08:00
chore: remove components merged into the Mesh Settings component
This commit is contained in:
parent
3c7634e4ea
commit
f41719e432
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c217d78c5408b04489548a5823bed3d4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,72 @@
|
||||
using nadena.dev.modular_avatar.core.editor;
|
||||
using NUnit.Framework;
|
||||
using UnityEngine;
|
||||
using VRC.SDK3.Avatars.Components;
|
||||
|
||||
namespace modular_avatar_tests
|
||||
{
|
||||
internal class MeshSettingsTests : TestBase
|
||||
{
|
||||
private static readonly string PREFAB_NAME = "MeshSettingsTests.prefab";
|
||||
|
||||
[Test]
|
||||
public void TestProbeAnchor()
|
||||
{
|
||||
var prefab = CreatePrefab(PREFAB_NAME);
|
||||
var context = new BuildContext(prefab.GetComponent<VRCAvatarDescriptor>());
|
||||
new MeshSettingsPass(context).OnPreprocessAvatar();
|
||||
|
||||
var root = prefab.transform.Find("RendererRoot");
|
||||
var target = prefab.transform.Find("ProbeTarget");
|
||||
var obj1 = prefab.transform.Find("ProbeTargetRenderers/SkinnedMeshRenderer").GetComponent<Renderer>();
|
||||
var obj2 = prefab.transform.Find("ProbeTargetRenderers/MeshRenderer").GetComponent<Renderer>();
|
||||
var obj3 = prefab.transform.Find("ProbeTargetRenderers/ParticleSystemRenderer").GetComponent<Renderer>();
|
||||
var obj4 = prefab.transform.Find("ProbeTargetRenderers/TrailRenderer").GetComponent<Renderer>();
|
||||
|
||||
Assert.AreEqual(target, obj1.probeAnchor);
|
||||
Assert.AreEqual(target, obj2.probeAnchor);
|
||||
Assert.AreEqual(target, obj3.probeAnchor);
|
||||
Assert.AreEqual(target, obj4.probeAnchor);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestProbeAnchorOverrides()
|
||||
{
|
||||
var prefab = CreatePrefab(PREFAB_NAME);
|
||||
var context = new BuildContext(prefab.GetComponent<VRCAvatarDescriptor>());
|
||||
new MeshSettingsPass(context).OnPreprocessAvatar();
|
||||
|
||||
var noninherit = prefab.transform.Find("ProbeTargetRenderers/NonInherited").GetComponent<MeshRenderer>();
|
||||
var overrideset = prefab.transform.Find("ProbeTargetRenderers/OverrideSet").GetComponent<MeshRenderer>();
|
||||
|
||||
Assert.AreEqual(noninherit.transform.Find("Target"), noninherit.probeAnchor);
|
||||
Assert.AreEqual(overrideset.transform.Find("Target"), overrideset.probeAnchor);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSetBounds()
|
||||
{
|
||||
var prefab = CreatePrefab(PREFAB_NAME);
|
||||
var context = new BuildContext(prefab.GetComponent<VRCAvatarDescriptor>());
|
||||
new MeshSettingsPass(context).OnPreprocessAvatar();
|
||||
|
||||
var target = prefab.transform.Find("ProbeTarget");
|
||||
|
||||
var inherit = prefab.transform.Find("Bounds/Inherit").GetComponent<SkinnedMeshRenderer>();
|
||||
var overridden = prefab.transform.Find("Bounds/Overridden").GetComponent<SkinnedMeshRenderer>();
|
||||
var notset = prefab.transform.Find("Bounds/NotSet").GetComponent<SkinnedMeshRenderer>();
|
||||
|
||||
Assert.AreEqual(new Vector3(1, 2, 3), inherit.bounds.center);
|
||||
Assert.AreEqual(new Vector3(4, 5, 6), inherit.bounds.extents);
|
||||
Assert.AreEqual(target, inherit.rootBone);
|
||||
|
||||
Assert.AreEqual(new Vector3(8, 8, 8), overridden.bounds.center);
|
||||
Assert.AreEqual(new Vector3(9, 9, 9), overridden.bounds.extents);
|
||||
Assert.AreEqual(overridden.transform.Find("Target"), overridden.rootBone);
|
||||
|
||||
Assert.AreEqual(new Vector3(0, 0, 0), notset.bounds.center);
|
||||
Assert.AreEqual(new Vector3(2, 2, 2), notset.bounds.extents);
|
||||
Assert.AreEqual(notset.transform.Find("Target"), notset.rootBone);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b18784296c2581e498e5127a23e6f019
|
||||
guid: 1c3ea8cc803f79c45a629964d7316a3f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: a8edd5bd1a0a64a40aa99cc09fb5f198, type: 3}
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f3adfcc27e73a249badd8f42ca5a57c
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -198,9 +198,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
new MenuInstallHook().OnPreprocessAvatar(avatarGameObject, context);
|
||||
new MergeArmatureHook().OnPreprocessAvatar(context, avatarGameObject);
|
||||
new BoneProxyProcessor().OnPreprocessAvatar(avatarGameObject);
|
||||
new ProbeAnchorProcessor().OnPreprocessAvatar(avatarGameObject);
|
||||
new VisibleHeadAccessoryProcessor(vrcAvatarDescriptor).Process(context);
|
||||
new BoundsOverrideProcessor().OnProcessAvatar(avatarGameObject);
|
||||
new MeshSettingsPass(context).OnPreprocessAvatar();
|
||||
new RemapAnimationPass(vrcAvatarDescriptor).Process(context.AnimationDatabase);
|
||||
new BlendshapeSyncAnimationProcessor().OnPreprocessAvatar(avatarGameObject, context);
|
||||
|
@ -1,156 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 bd_
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using nadena.dev.modular_avatar.editor.ErrorReporting;
|
||||
using UnityEngine;
|
||||
|
||||
namespace nadena.dev.modular_avatar.core.editor
|
||||
{
|
||||
internal class BoundsOverrideProcessor
|
||||
{
|
||||
internal void OnProcessAvatar(GameObject avatarObject)
|
||||
{
|
||||
Queue<ModularAvatarBoundsOverride> overrides = new Queue<ModularAvatarBoundsOverride>();
|
||||
Queue<ModularAvatarBoundsOverrideBlocker> blockers = new Queue<ModularAvatarBoundsOverrideBlocker>();
|
||||
|
||||
FindTopLevelOverrides(avatarObject.transform, overrides);
|
||||
|
||||
while (overrides.Count > 0 || blockers.Count > 0)
|
||||
{
|
||||
while (overrides.Count > 0)
|
||||
{
|
||||
var processTargetOverride = overrides.Dequeue();
|
||||
BuildReport.ReportingObject(processTargetOverride,
|
||||
() => ProcessOverride(processTargetOverride, overrides, blockers));
|
||||
}
|
||||
|
||||
while (blockers.Count > 0)
|
||||
{
|
||||
var processTargetBlocker = blockers.Dequeue();
|
||||
|
||||
foreach (Transform children in processTargetBlocker.transform.OfType<Transform>())
|
||||
{
|
||||
FindTopLevelOverrides(children, overrides);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void FindTopLevelOverrides(Transform root, Queue<ModularAvatarBoundsOverride> overrides)
|
||||
{
|
||||
Queue<Transform> childrenQueue = new Queue<Transform>();
|
||||
childrenQueue.Enqueue(root);
|
||||
|
||||
while (childrenQueue.Count > 0)
|
||||
{
|
||||
var currentTransform = childrenQueue.Dequeue();
|
||||
|
||||
var currentOverride = currentTransform.GetComponent<ModularAvatarBoundsOverride>();
|
||||
if (currentOverride != null)
|
||||
{
|
||||
overrides.Enqueue(currentOverride);
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (Transform children in currentTransform.OfType<Transform>())
|
||||
{
|
||||
childrenQueue.Enqueue(children);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void ProcessOverride(ModularAvatarBoundsOverride targetOverride,
|
||||
Queue<ModularAvatarBoundsOverride> overrides, Queue<ModularAvatarBoundsOverrideBlocker> blockers)
|
||||
{
|
||||
var targetRenderer = targetOverride.GetComponent<SkinnedMeshRenderer>();
|
||||
if (targetRenderer != null)
|
||||
{
|
||||
var rootBone = targetOverride.rootBoneTarget.Get(targetOverride)?.transform;
|
||||
if (rootBone != null)
|
||||
{
|
||||
targetRenderer.rootBone = targetOverride.rootBoneTarget.Get(targetOverride)?.transform;
|
||||
}
|
||||
|
||||
targetRenderer.localBounds = targetOverride.bounds;
|
||||
}
|
||||
|
||||
var processTargetBlocker = targetOverride.GetComponent<ModularAvatarBoundsOverrideBlocker>();
|
||||
if (processTargetBlocker != null)
|
||||
{
|
||||
blockers.Enqueue(processTargetBlocker);
|
||||
return;
|
||||
}
|
||||
|
||||
ProcessOverrideChildren(targetOverride, overrides, blockers);
|
||||
}
|
||||
|
||||
private static void ProcessOverrideChildren(ModularAvatarBoundsOverride targetOverride,
|
||||
Queue<ModularAvatarBoundsOverride> overrides, Queue<ModularAvatarBoundsOverrideBlocker> blockers)
|
||||
{
|
||||
Queue<Transform> childrenQueue = new Queue<Transform>();
|
||||
foreach (Transform children in targetOverride.transform.OfType<Transform>())
|
||||
{
|
||||
childrenQueue.Enqueue(children);
|
||||
}
|
||||
|
||||
while (childrenQueue.Count > 0)
|
||||
{
|
||||
var currentTransform = childrenQueue.Dequeue();
|
||||
|
||||
var currentOverride = currentTransform.GetComponent<ModularAvatarBoundsOverride>();
|
||||
if (currentOverride != null)
|
||||
{
|
||||
overrides.Enqueue(currentOverride);
|
||||
continue;
|
||||
}
|
||||
|
||||
var currentBlocker = currentTransform.GetComponent<ModularAvatarBoundsOverrideBlocker>();
|
||||
if (currentBlocker != null)
|
||||
{
|
||||
blockers.Enqueue(currentBlocker);
|
||||
continue;
|
||||
}
|
||||
|
||||
var currentRenderer = currentTransform.GetComponent<SkinnedMeshRenderer>();
|
||||
if (currentRenderer != null)
|
||||
{
|
||||
var rootBone = targetOverride.rootBoneTarget.Get(targetOverride)?.transform;
|
||||
if (rootBone != null)
|
||||
{
|
||||
currentRenderer.rootBone = targetOverride.rootBoneTarget.Get(targetOverride)?.transform;
|
||||
}
|
||||
|
||||
currentRenderer.localBounds = targetOverride.bounds;
|
||||
}
|
||||
|
||||
foreach (Transform children in currentTransform.OfType<Transform>())
|
||||
{
|
||||
childrenQueue.Enqueue(children);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8585986069504c0f84a6a1d5c559f36c
|
||||
timeCreated: 1685441711
|
@ -22,10 +22,6 @@ namespace nadena.dev.modular_avatar.editor.ErrorReporting
|
||||
return CheckInternal(bs);
|
||||
case ModularAvatarBoneProxy bp:
|
||||
return CheckInternal(bp);
|
||||
case ModularAvatarBoundsOverride bo:
|
||||
return CheckInternal(bo);
|
||||
case ModularAvatarProbeAnchor pa:
|
||||
return CheckInternal(pa);
|
||||
case ModularAvatarMenuInstaller mi:
|
||||
return CheckInternal(mi);
|
||||
case ModularAvatarMergeAnimator obj:
|
||||
@ -140,32 +136,6 @@ namespace nadena.dev.modular_avatar.editor.ErrorReporting
|
||||
return null;
|
||||
}
|
||||
|
||||
private static List<ErrorLog> CheckInternal(ModularAvatarProbeAnchor pa)
|
||||
{
|
||||
if (pa.probeTarget == null)
|
||||
{
|
||||
return new List<ErrorLog>()
|
||||
{
|
||||
new ErrorLog(ReportLevel.Validation, "validation.probe_anchor.no_target", pa)
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static List<ErrorLog> CheckInternal(ModularAvatarBoundsOverride bo)
|
||||
{
|
||||
if (bo.rootBoneTarget.Get(bo) == null)
|
||||
{
|
||||
return new List<ErrorLog>()
|
||||
{
|
||||
new ErrorLog(ReportLevel.Validation, "validation.bounds_override.no_target", bo)
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static List<ErrorLog> CheckInternal(ModularAvatarMenuInstaller mi)
|
||||
{
|
||||
// TODO - check that target menu is in the avatar
|
||||
|
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 bd_
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
using UnityEditor;
|
||||
using static nadena.dev.modular_avatar.core.editor.Localization;
|
||||
|
||||
namespace nadena.dev.modular_avatar.core.editor
|
||||
{
|
||||
[CustomEditor(typeof(ModularAvatarBoundsOverrideBlocker))]
|
||||
[CanEditMultipleObjects]
|
||||
internal class BoundsOverrideBlockerEditor : MAEditorBase
|
||||
{
|
||||
protected override void OnInnerInspectorGUI()
|
||||
{
|
||||
EditorGUILayout.HelpBox(S("bounds_override_blocker.help"), MessageType.Info);
|
||||
|
||||
Localization.ShowLanguageUI();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93f879e0ab854080a081f66efdbd490a
|
||||
timeCreated: 1685421592
|
@ -1,91 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 bd_
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using static nadena.dev.modular_avatar.core.editor.Localization;
|
||||
|
||||
namespace nadena.dev.modular_avatar.core.editor
|
||||
{
|
||||
[CustomEditor(typeof(ModularAvatarBoundsOverride))]
|
||||
[CanEditMultipleObjects]
|
||||
internal class BoundsOverrideEditor : MAEditorBase
|
||||
{
|
||||
private SerializedProperty _rootBoneTargetProperty;
|
||||
private SerializedProperty _boundsProperty;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
_rootBoneTargetProperty = serializedObject.FindProperty(nameof(ModularAvatarBoundsOverride.rootBoneTarget));
|
||||
_boundsProperty = serializedObject.FindProperty(nameof(ModularAvatarBoundsOverride.bounds));
|
||||
}
|
||||
|
||||
protected override void OnInnerInspectorGUI()
|
||||
{
|
||||
// TODO: 言語ファイル対応
|
||||
EditorGUILayout.HelpBox(S("bounds_override.help"), MessageType.Info);
|
||||
|
||||
using (var changeCheckScope = new EditorGUI.ChangeCheckScope())
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
EditorGUILayout.PropertyField(_rootBoneTargetProperty, G("bounds_override.root_bone"));
|
||||
EditorGUILayout.PropertyField(_boundsProperty, G("bounds_override.bounds"));
|
||||
|
||||
if (changeCheckScope.changed)
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
|
||||
Localization.ShowLanguageUI();
|
||||
}
|
||||
|
||||
|
||||
[DrawGizmo(GizmoType.Selected)]
|
||||
private static void DrawGizmo(ModularAvatarBoundsOverride component, GizmoType gizmoType)
|
||||
{
|
||||
Matrix4x4 oldMatrix = Gizmos.matrix;
|
||||
|
||||
Vector3 center = component.bounds.center;
|
||||
Vector3 size = component.bounds.size;
|
||||
try
|
||||
{
|
||||
Transform rootBone = component.rootBoneTarget.Get(component)?.transform;
|
||||
if (rootBone != null)
|
||||
{
|
||||
Gizmos.matrix *= rootBone.localToWorldMatrix;
|
||||
}
|
||||
} catch (NullReferenceException e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
component.rootBoneTarget.referencePath = null;
|
||||
}
|
||||
|
||||
Gizmos.DrawWireCube(center, size);
|
||||
Gizmos.matrix = oldMatrix;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5522e0754434ce98886989dca5a09da
|
||||
timeCreated: 1685420534
|
@ -1,39 +0,0 @@
|
||||
using UnityEditor;
|
||||
using static nadena.dev.modular_avatar.core.editor.Localization;
|
||||
|
||||
namespace nadena.dev.modular_avatar.core.editor
|
||||
{
|
||||
[CustomEditor(typeof(ModularAvatarProbeAnchor))]
|
||||
[CanEditMultipleObjects]
|
||||
internal class ProbeAnchorEditor : MAEditorBase
|
||||
{
|
||||
private SerializedProperty prop_probeTarget;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
prop_probeTarget = serializedObject.FindProperty(nameof(ModularAvatarProbeAnchor.probeTarget));
|
||||
}
|
||||
|
||||
private void ShowParametersUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
EditorGUILayout.PropertyField(prop_probeTarget, G("probeanchor.target"));
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
protected override void OnInnerInspectorGUI()
|
||||
{
|
||||
EditorGUILayout.HelpBox(S("probe_anchor.help"), MessageType.Info);
|
||||
EditorGUI.BeginChangeCheck();
|
||||
ShowParametersUI();
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
Localization.ShowLanguageUI();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ac49767157d7e142b4b1f277baf00ed
|
||||
timeCreated: 1664757842
|
@ -3,7 +3,6 @@
|
||||
"test0.test_b": "test_b",
|
||||
"boneproxy.foldout.advanced": "Advanced",
|
||||
"boneproxy.target": "Target",
|
||||
"probeanchor.target": "Target",
|
||||
"menuinstall.help.hint_set_menu": "This prefab will be installed to the root menu of your avatar by default. Select a different menu or uncheck the component's enabled checkbox to prevent this.",
|
||||
"menuinstall.help.hint_bad_menu": "Selected menu asset is not part of your avatar.",
|
||||
"menuinstall.installto": "Install To",
|
||||
@ -60,16 +59,11 @@
|
||||
"hint.not_in_avatar": "This component needs to be placed inside your avatar to work properly.",
|
||||
"boneproxy.err.MovingTarget": "You cannot specify a target object that will be moved by other Modular Avatar components",
|
||||
"boneproxy.err.NotInAvatar": "You must specify an object that is in the avatar",
|
||||
"probeanchor.err.NotInAvatar": "You must specify an object that is in the avatar",
|
||||
"boneproxy.attachment": "Attachment mode",
|
||||
"boneproxy.attachment.AsChildAtRoot": "As child; at root",
|
||||
"boneproxy.attachment.AsChildKeepWorldPose": "As child; keep position and rotation",
|
||||
"boneproxy.attachment.AsChildKeepPosition": "As child; keep position",
|
||||
"boneproxy.attachment.AsChildKeepRotation": "As child; keep rotation",
|
||||
"bounds_override.help": "Set the Bounds and RootBoon of the Renderer in this object.",
|
||||
"bounds_override.root_bone": "Root Bone",
|
||||
"bounds_override.bounds": "Bounds",
|
||||
"bounds_override_blocker.help": "Within this object will no longer be affected by the parent's BoundsOverride.",
|
||||
"mesh_settings.header_probe_anchor": "Anchor Override Configuration",
|
||||
"mesh_settings.inherit_probe_anchor": "Anchor Override Mode",
|
||||
"mesh_settings.probe_anchor": "Anchor Override",
|
||||
@ -84,7 +78,6 @@
|
||||
"mesh_settings.inherit_mode.Set": "Set",
|
||||
"mesh_settings.inherit_mode.DontSet": "Don't Set (use mesh as-is)",
|
||||
"pb_blocker.help": "This object will not be affected by PhysBones attached to parents.",
|
||||
"probe_anchor.help": "Sets the Anchor Override for the inner renderer object.",
|
||||
"hint.bad_vrcsdk": "Incompatible version of VRCSDK detected.\n\nPlease try upgrading your VRCSDK; if this does not work, check for a newer version of Modular Avatar as well.",
|
||||
"error.stack_trace": "Stack trace (provide this when reporting bugs!)",
|
||||
"error.merge_armature.merge_into_self": "Your Merge Armature component is referencing itself, or a child of itself, as the merge target. You should reference the avatar's armature instead. Do not put Merge Armature on the avatar's main armature.",
|
||||
@ -100,8 +93,6 @@
|
||||
"validation.blendshape_sync.missing_target_renderer": "No renderer found on the target object",
|
||||
"validation.blendshape_sync.missing_target_mesh": "No mesh found on the renderer on the target object",
|
||||
"validation.bone_proxy.no_target": "No target object specified (or target object not found)",
|
||||
"validation.bounds_override.no_target": "No target object specified (or target object not found)",
|
||||
"validation.probe_anchor.no_target": "No target object specified (or target object not found)",
|
||||
"validation.menu_installer.no_menu": "No menu to install specified",
|
||||
"validation.merge_animator.no_animator": "No animator to merge specified",
|
||||
"validation.merge_armature.no_target": "No merge target specified",
|
||||
|
@ -58,16 +58,11 @@
|
||||
"hint.not_in_avatar": "このコンポーネントが正しく動作するには、アバター内に配置する必要があります。",
|
||||
"boneproxy.err.MovingTarget": "他のモジュラーアバターコンポーネントで移動されるオブジェクトを指定できません。",
|
||||
"boneproxy.err.NotInAvatar": "アバター内のオブジェクトを指定してください。",
|
||||
"probeanchor.err.NotInAvatar": "アバター内のオブジェクトを指定してください。",
|
||||
"boneproxy.attachment": "配置モード",
|
||||
"boneproxy.attachment.AsChildAtRoot": "子として・ルートに配置",
|
||||
"boneproxy.attachment.AsChildKeepWorldPose": "子として・ワールド位置と向きを維持",
|
||||
"boneproxy.attachment.AsChildKeepPosition": "子として・ワールド位置を維持",
|
||||
"boneproxy.attachment.AsChildKeepRotation": "子として・ワールド向きを維持",
|
||||
"bounds_override.help": "このオブジェクト内のRendererのBounds、RootBoonを設定します。",
|
||||
"bounds_override.root_bone": "ルートボーン",
|
||||
"bounds_override.bounds": "バウンズ",
|
||||
"bounds_override_blocker.help": "このオブジェクト内は親のBoundsOverrideの影響を受けなくなります。",
|
||||
"mesh_settings.header_probe_anchor": "Anchor Override 設定",
|
||||
"mesh_settings.inherit_probe_anchor": "設定モード",
|
||||
"mesh_settings.probe_anchor": "Anchor Override",
|
||||
@ -82,7 +77,6 @@
|
||||
"mesh_settings.inherit_mode.Set": "設定",
|
||||
"mesh_settings.inherit_mode.DontSet": "設定しない(メッシュ本体の設定のまま)",
|
||||
"pb_blocker.help": "このオブジェクトは親のPhysBoneから影響を受けなくなります。",
|
||||
"probe_anchor.help": "このオブジェクトに含まれるレンダラーのAnchorOverrideを設定します。",
|
||||
"hint.bad_vrcsdk": "使用中のVRCSDKのバージョンとは互換性がありません。\n\nVRCSDKを更新してみてください。それでもだめでしたら、Modular Avatarにも最新版が出てないかチェックしてください。",
|
||||
"error.stack_trace": "スタックトレース(バグを報告する時は必ず添付してください!)",
|
||||
"error.merge_armature.merge_into_self": "Merge Armatureに自分自身のオブジェクト、もしくは自分の子をターゲットにしてしています。かわりにアバターのメインArmatureを指定してください。アバター自体のArmatureに追加しないでください。",
|
||||
@ -98,8 +92,6 @@
|
||||
"validation.blendshape_sync.missing_target_renderer": "同期元のオブジェクトにはSkinnedMeshRendererがありません。",
|
||||
"validation.blendshape_sync.missing_target_mesh": "同期元のオブジェクトにはSkinnedMeshRendererがありますが、メッシュがありません。",
|
||||
"validation.bone_proxy.no_target": "ターゲットオブジェクトが未設定、もしくは存在しません。",
|
||||
"validation.bounds_override.no_target": "ターゲットオブジェクトが未設定、もしくは存在しません。",
|
||||
"validation.probe_anchor.no_target": "ターゲットオブジェクトが未設定、もしくは存在しません。",
|
||||
"validation.menu_installer.no_menu": "インストールするメニューがありません。",
|
||||
"validation.merge_animator.no_animator": "Animator Controllerがありません。",
|
||||
"validation.merge_armature.no_target": "ターゲットオブジェクトが未設定、もしくは存在しません。",
|
||||
|
@ -1,7 +1,6 @@
|
||||
{
|
||||
"boneproxy.foldout.advanced": "高级设置",
|
||||
"boneproxy.target": "目标",
|
||||
"probeanchor.target": "目标",
|
||||
"menuinstall.help.hint_set_menu": "此预制体的菜单默认会安装Avatar的顶部菜单中. 如果不需要, 可以选择其他菜单或取消勾选启用复选框.",
|
||||
"menuinstall.help.hint_bad_menu": "选择的菜单不属于当前Avatar.",
|
||||
"menuinstall.installto": "安装到",
|
||||
@ -53,11 +52,9 @@
|
||||
"hint.not_in_avatar": "此组件需要放置于你的Avatar中才能工作",
|
||||
"boneproxy.err.MovingTarget": "您不能指定将由其他 Modular Avatar 组件移动的目标对象",
|
||||
"boneproxy.err.NotInAvatar": "你必须指定一个在Avatar中的对象",
|
||||
"probeanchor.err.NotInAvatar": "你必须指定一个在Avatar中的对象",
|
||||
"boneproxy.attachment": "附加模式",
|
||||
"boneproxy.attachment.AsChildAtRoot": "作为子对象, 放置于Root",
|
||||
"boneproxy.attachment.AsChildKeepWorldPosition": "作为子对象, 保持原有位置",
|
||||
"pb_blocker.help": "当前对象不会受到附加的父对象的PhysBones的影响.",
|
||||
"probe_anchor.help": "设置此对象所包含的渲染器的AnchorOverride",
|
||||
"hint.bad_vrcsdk": "检测到不兼容的VRCSDK版本.\n\n请尝试升级VRCSDK; 如果这不起作用, 请尝试新版本的Modular Avatar."
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 bd_
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
using nadena.dev.modular_avatar.editor.ErrorReporting;
|
||||
using UnityEngine;
|
||||
|
||||
namespace nadena.dev.modular_avatar.core.editor
|
||||
{
|
||||
internal class ProbeAnchorProcessor
|
||||
{
|
||||
internal enum ValidationResult
|
||||
{
|
||||
OK,
|
||||
NotInAvatar
|
||||
}
|
||||
|
||||
internal void OnPreprocessAvatar(GameObject avatarGameObject)
|
||||
{
|
||||
var boneProxies = avatarGameObject.GetComponentsInChildren<ModularAvatarProbeAnchor>(true);
|
||||
|
||||
foreach (var proxy in boneProxies)
|
||||
{
|
||||
BuildReport.ReportingObject(proxy, () => ProcessAnchor(avatarGameObject, proxy));
|
||||
}
|
||||
}
|
||||
|
||||
private void ProcessAnchor(GameObject avatarGameObject, ModularAvatarProbeAnchor proxy)
|
||||
{
|
||||
if (proxy.probeTarget.Get(proxy) != null && ValidateTarget(avatarGameObject, proxy.probeTarget.Get(proxy).transform) == ValidationResult.OK)
|
||||
{
|
||||
foreach (Renderer r in proxy.GetComponentsInChildren<Renderer>(true))
|
||||
{
|
||||
r.probeAnchor = proxy.probeTarget.Get(proxy).transform;
|
||||
}
|
||||
}
|
||||
|
||||
Object.DestroyImmediate(proxy);
|
||||
}
|
||||
|
||||
internal static ValidationResult ValidateTarget(GameObject avatarGameObject, Transform proxyTarget)
|
||||
{
|
||||
var avatar = avatarGameObject.transform;
|
||||
var node = proxyTarget;
|
||||
|
||||
while (node != null && node != avatar)
|
||||
{
|
||||
node = node.parent;
|
||||
}
|
||||
|
||||
if (node == null) return ValidationResult.NotInAvatar;
|
||||
else return ValidationResult.OK;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cdb66cfc3a147a849810baa9315df90f
|
||||
timeCreated: 1661649405
|
@ -1,38 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 bd_
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
// TODO: 言語の設定
|
||||
|
||||
namespace nadena.dev.modular_avatar.core
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
[AddComponentMenu("Modular Avatar/MA Bounds Override")]
|
||||
public class ModularAvatarBoundsOverride : AvatarTagComponent
|
||||
{
|
||||
public AvatarObjectReference rootBoneTarget;
|
||||
public Bounds bounds = new Bounds(Vector3.zero, Vector3.one * 2);
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf12d50d3180465f82d7131d7efae861
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: a8edd5bd1a0a64a40aa99cc09fb5f198, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 bd_
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
// TODO: 言語の設定
|
||||
|
||||
namespace nadena.dev.modular_avatar.core
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
[AddComponentMenu("Modular Avatar/MA Bounds Override Blocker")]
|
||||
public class ModularAvatarBoundsOverrideBlocker : AvatarTagComponent
|
||||
{ }
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 29eb7b2eb11840c48051428a9c6c43a4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: a8edd5bd1a0a64a40aa99cc09fb5f198, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,38 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 bd_
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace nadena.dev.modular_avatar.core
|
||||
{
|
||||
[ExecuteInEditMode]
|
||||
[DisallowMultipleComponent]
|
||||
[AddComponentMenu("Modular Avatar/MA Probe Anchor")]
|
||||
public class ModularAvatarProbeAnchor : AvatarTagComponent
|
||||
{
|
||||
public AvatarObjectReference probeTarget;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user