From 2091402572d32219e8f0745538568d09f081c146 Mon Sep 17 00:00:00 2001 From: bd_ Date: Wed, 9 Nov 2022 17:39:52 -0800 Subject: [PATCH] Rename FPV -> Visible Head Accessory --- .../Editor/AvatarProcessor.cs | 2 +- .../Editor/Inspector/FirstPersonVisibleEditor.cs | 14 +++++++------- ...or.cs => VisibleHeadAccessoryMeshProcessor.cs} | 4 ++-- ... => VisibleHeadAccessoryMeshProcessor.cs.meta} | 0 ...cessor.cs => VisibleHeadAccessoryProcessor.cs} | 14 +++++++------- ...meta => VisibleHeadAccessoryProcessor.cs.meta} | 0 .../Runtime/ModularAvatarFirstPersonVisible.cs | 7 ------- .../Runtime/ModularAvatarVisibleHeadAccessory.cs | 10 ++++++++++ ... => ModularAvatarVisibleHeadAccessory.cs.meta} | 0 ...{first-person.md => visible-head-accessory.md} | 8 ++++---- ...son-visible.png => visible-head-accessory.png} | Bin ...{first-person.md => visible-head-accessory.md} | 2 +- ...son-visible.png => visible-head-accessory.png} | Bin 13 files changed, 32 insertions(+), 29 deletions(-) rename Packages/net.fushizen.modular-avatar/Editor/{FirstPersonVisibleMeshProcessor.cs => VisibleHeadAccessoryMeshProcessor.cs} (98%) rename Packages/net.fushizen.modular-avatar/Editor/{FirstPersonVisibleMeshProcessor.cs.meta => VisibleHeadAccessoryMeshProcessor.cs.meta} (100%) rename Packages/net.fushizen.modular-avatar/Editor/{FirstPersonVisibleProcessor.cs => VisibleHeadAccessoryProcessor.cs} (90%) rename Packages/net.fushizen.modular-avatar/Editor/{FirstPersonVisibleProcessor.cs.meta => VisibleHeadAccessoryProcessor.cs.meta} (100%) delete mode 100644 Packages/net.fushizen.modular-avatar/Runtime/ModularAvatarFirstPersonVisible.cs create mode 100644 Packages/net.fushizen.modular-avatar/Runtime/ModularAvatarVisibleHeadAccessory.cs rename Packages/net.fushizen.modular-avatar/Runtime/{ModularAvatarFirstPersonVisible.cs.meta => ModularAvatarVisibleHeadAccessory.cs.meta} (100%) rename docs/docs/reference/{first-person.md => visible-head-accessory.md} (80%) rename docs/docs/reference/{first-person-visible.png => visible-head-accessory.png} (100%) rename docs/i18n/ja/docusaurus-plugin-content-docs/current/reference/{first-person.md => visible-head-accessory.md} (98%) rename docs/i18n/ja/docusaurus-plugin-content-docs/current/reference/{first-person-visible.png => visible-head-accessory.png} (100%) diff --git a/Packages/net.fushizen.modular-avatar/Editor/AvatarProcessor.cs b/Packages/net.fushizen.modular-avatar/Editor/AvatarProcessor.cs index 7293a7ee..9b4e7147 100644 --- a/Packages/net.fushizen.modular-avatar/Editor/AvatarProcessor.cs +++ b/Packages/net.fushizen.modular-avatar/Editor/AvatarProcessor.cs @@ -114,7 +114,7 @@ namespace net.fushizen.modular_avatar.core.editor new MergeArmatureHook().OnPreprocessAvatar(avatarGameObject); new RetargetMeshes().OnPreprocessAvatar(avatarGameObject); new BoneProxyProcessor().OnPreprocessAvatar(avatarGameObject); - new FirstPersonVisibleProcessor(avatarGameObject.GetComponent()).Process(); + new VisibleHeadAccessoryProcessor(avatarGameObject.GetComponent()).Process(); new MergeAnimatorProcessor().OnPreprocessAvatar(avatarGameObject); new BlendshapeSyncAnimationProcessor().OnPreprocessAvatar(avatarGameObject); diff --git a/Packages/net.fushizen.modular-avatar/Editor/Inspector/FirstPersonVisibleEditor.cs b/Packages/net.fushizen.modular-avatar/Editor/Inspector/FirstPersonVisibleEditor.cs index b6143981..01d76a16 100644 --- a/Packages/net.fushizen.modular-avatar/Editor/Inspector/FirstPersonVisibleEditor.cs +++ b/Packages/net.fushizen.modular-avatar/Editor/Inspector/FirstPersonVisibleEditor.cs @@ -4,22 +4,22 @@ using UnityEngine; namespace net.fushizen.modular_avatar.core.editor { - [CustomEditor(typeof(ModularAvatarFirstPersonVisible))] + [CustomEditor(typeof(ModularAvatarVisibleHeadAccessory))] public class FirstPersonVisibleEditor : Editor { - private FirstPersonVisibleProcessor _processor; + private VisibleHeadAccessoryProcessor _processor; private void OnEnable() { - var target = (ModularAvatarFirstPersonVisible) this.target; + var target = (ModularAvatarVisibleHeadAccessory) this.target; var avatar = RuntimeUtil.FindAvatarInParents(target.transform); - if (avatar != null) _processor = new FirstPersonVisibleProcessor(avatar); + if (avatar != null) _processor = new VisibleHeadAccessoryProcessor(avatar); } public override void OnInspectorGUI() { - var target = (ModularAvatarFirstPersonVisible) this.target; + var target = (ModularAvatarVisibleHeadAccessory) this.target; LogoDisplay.DisplayLogo(); @@ -36,8 +36,8 @@ namespace net.fushizen.modular_avatar.core.editor switch (status) { - case FirstPersonVisibleProcessor.ReadyStatus.Ready: - case FirstPersonVisibleProcessor.ReadyStatus.ParentMarked: + case VisibleHeadAccessoryProcessor.ReadyStatus.Ready: + case VisibleHeadAccessoryProcessor.ReadyStatus.ParentMarked: EditorGUILayout.HelpBox(Localization.S("fpvisible.normal"), MessageType.Info); break; default: diff --git a/Packages/net.fushizen.modular-avatar/Editor/FirstPersonVisibleMeshProcessor.cs b/Packages/net.fushizen.modular-avatar/Editor/VisibleHeadAccessoryMeshProcessor.cs similarity index 98% rename from Packages/net.fushizen.modular-avatar/Editor/FirstPersonVisibleMeshProcessor.cs rename to Packages/net.fushizen.modular-avatar/Editor/VisibleHeadAccessoryMeshProcessor.cs index 2defc1c4..323d7192 100644 --- a/Packages/net.fushizen.modular-avatar/Editor/FirstPersonVisibleMeshProcessor.cs +++ b/Packages/net.fushizen.modular-avatar/Editor/VisibleHeadAccessoryMeshProcessor.cs @@ -11,13 +11,13 @@ namespace net.fushizen.modular_avatar.core.editor /// want to make visible in the first-person view. To handle this case, we must retarget those meshes to use our /// proxy head bone instead. /// - internal class FirstPersonVisibleMeshProcessor + internal class VisibleHeadAccessoryMeshProcessor { private SkinnedMeshRenderer _renderer; private HashSet _visibleBones; private Transform _proxyHead; - public FirstPersonVisibleMeshProcessor( + public VisibleHeadAccessoryMeshProcessor( SkinnedMeshRenderer renderer, HashSet visibleBones, Transform proxyHead diff --git a/Packages/net.fushizen.modular-avatar/Editor/FirstPersonVisibleMeshProcessor.cs.meta b/Packages/net.fushizen.modular-avatar/Editor/VisibleHeadAccessoryMeshProcessor.cs.meta similarity index 100% rename from Packages/net.fushizen.modular-avatar/Editor/FirstPersonVisibleMeshProcessor.cs.meta rename to Packages/net.fushizen.modular-avatar/Editor/VisibleHeadAccessoryMeshProcessor.cs.meta diff --git a/Packages/net.fushizen.modular-avatar/Editor/FirstPersonVisibleProcessor.cs b/Packages/net.fushizen.modular-avatar/Editor/VisibleHeadAccessoryProcessor.cs similarity index 90% rename from Packages/net.fushizen.modular-avatar/Editor/FirstPersonVisibleProcessor.cs rename to Packages/net.fushizen.modular-avatar/Editor/VisibleHeadAccessoryProcessor.cs index 90c3a302..62cfa739 100644 --- a/Packages/net.fushizen.modular-avatar/Editor/FirstPersonVisibleProcessor.cs +++ b/Packages/net.fushizen.modular-avatar/Editor/VisibleHeadAccessoryProcessor.cs @@ -6,7 +6,7 @@ using VRC.SDK3.Dynamics.PhysBone.Components; namespace net.fushizen.modular_avatar.core.editor { - internal class FirstPersonVisibleProcessor + internal class VisibleHeadAccessoryProcessor { private const double EPSILON = 0.01; @@ -25,7 +25,7 @@ namespace net.fushizen.modular_avatar.core.editor private HashSet _visibleBones = new HashSet(); private Transform _proxyHead; - public FirstPersonVisibleProcessor(VRCAvatarDescriptor avatar) + public VisibleHeadAccessoryProcessor(VRCAvatarDescriptor avatar) { _avatar = avatar; @@ -59,7 +59,7 @@ namespace net.fushizen.modular_avatar.core.editor { bool didWork = false; - foreach (var target in _avatar.GetComponentsInChildren(true)) + foreach (var target in _avatar.GetComponentsInChildren(true)) { var w = Process(target); didWork = didWork || w; @@ -70,12 +70,12 @@ namespace net.fushizen.modular_avatar.core.editor // Process meshes foreach (var smr in _avatar.GetComponentsInChildren(true)) { - new FirstPersonVisibleMeshProcessor(smr, _visibleBones, _proxyHead).Retarget(); + new VisibleHeadAccessoryMeshProcessor(smr, _visibleBones, _proxyHead).Retarget(); } } } - bool Process(ModularAvatarFirstPersonVisible target) + bool Process(ModularAvatarVisibleHeadAccessory target) { bool didWork = false; @@ -144,7 +144,7 @@ namespace net.fushizen.modular_avatar.core.editor return obj.transform; } - internal ReadyStatus Validate(ModularAvatarFirstPersonVisible target) + internal ReadyStatus Validate(ModularAvatarVisibleHeadAccessory target) { ReadyStatus status = ReadyStatus.NotUnderHead; Transform node = target.transform.parent; @@ -153,7 +153,7 @@ namespace net.fushizen.modular_avatar.core.editor while (node != null) { - if (node.GetComponent()) return ReadyStatus.ParentMarked; + if (node.GetComponent()) return ReadyStatus.ParentMarked; if (_activeBones.Contains(node)) return ReadyStatus.InPhysBoneChain; if (node == _headBone) diff --git a/Packages/net.fushizen.modular-avatar/Editor/FirstPersonVisibleProcessor.cs.meta b/Packages/net.fushizen.modular-avatar/Editor/VisibleHeadAccessoryProcessor.cs.meta similarity index 100% rename from Packages/net.fushizen.modular-avatar/Editor/FirstPersonVisibleProcessor.cs.meta rename to Packages/net.fushizen.modular-avatar/Editor/VisibleHeadAccessoryProcessor.cs.meta diff --git a/Packages/net.fushizen.modular-avatar/Runtime/ModularAvatarFirstPersonVisible.cs b/Packages/net.fushizen.modular-avatar/Runtime/ModularAvatarFirstPersonVisible.cs deleted file mode 100644 index d4ff8c87..00000000 --- a/Packages/net.fushizen.modular-avatar/Runtime/ModularAvatarFirstPersonVisible.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace net.fushizen.modular_avatar.core -{ - public class ModularAvatarFirstPersonVisible : AvatarTagComponent - { - // no configuration needed - } -} \ No newline at end of file diff --git a/Packages/net.fushizen.modular-avatar/Runtime/ModularAvatarVisibleHeadAccessory.cs b/Packages/net.fushizen.modular-avatar/Runtime/ModularAvatarVisibleHeadAccessory.cs new file mode 100644 index 00000000..0043d1d3 --- /dev/null +++ b/Packages/net.fushizen.modular-avatar/Runtime/ModularAvatarVisibleHeadAccessory.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace net.fushizen.modular_avatar.core +{ + [AddComponentMenu("Modular Avatar/MA Visible Head Accessory")] + public class ModularAvatarVisibleHeadAccessory : AvatarTagComponent + { + // no configuration needed + } +} \ No newline at end of file diff --git a/Packages/net.fushizen.modular-avatar/Runtime/ModularAvatarFirstPersonVisible.cs.meta b/Packages/net.fushizen.modular-avatar/Runtime/ModularAvatarVisibleHeadAccessory.cs.meta similarity index 100% rename from Packages/net.fushizen.modular-avatar/Runtime/ModularAvatarFirstPersonVisible.cs.meta rename to Packages/net.fushizen.modular-avatar/Runtime/ModularAvatarVisibleHeadAccessory.cs.meta diff --git a/docs/docs/reference/first-person.md b/docs/docs/reference/visible-head-accessory.md similarity index 80% rename from docs/docs/reference/first-person.md rename to docs/docs/reference/visible-head-accessory.md index 0336912f..e68a2047 100644 --- a/docs/docs/reference/first-person.md +++ b/docs/docs/reference/visible-head-accessory.md @@ -1,6 +1,6 @@ -# First Person Visible +# Visible Head Accessory -![First person visible component](first-person-visible.png) +![Visible Head Accessory component](visible-head-accessory.png) This component can be used to make a GameObject placed under the Head bone visible in first-person view. @@ -16,9 +16,9 @@ Using this component on _all_ children of the Head can be distracting, as your b Finally, the processing involved in this component is somewhat heavyweight, and may result in slower build times. -## Setting up First Person Visible +## Setting up Visible Head Accessory -Just attach a First Person Visible component under a child of the Head bone. There are no configuration options to set. +Just attach a Visible Head Accessory component under a child of the Head bone. There are no configuration options to set. The component will automatically generate a clone of the Head bone, which is connected to the real head bone using a parent constraint. Only one constraint will be generated, even if multiple First Person Visible components are used. As such, the performance impact of this component is the same whether you use one or dozens. diff --git a/docs/docs/reference/first-person-visible.png b/docs/docs/reference/visible-head-accessory.png similarity index 100% rename from docs/docs/reference/first-person-visible.png rename to docs/docs/reference/visible-head-accessory.png diff --git a/docs/i18n/ja/docusaurus-plugin-content-docs/current/reference/first-person.md b/docs/i18n/ja/docusaurus-plugin-content-docs/current/reference/visible-head-accessory.md similarity index 98% rename from docs/i18n/ja/docusaurus-plugin-content-docs/current/reference/first-person.md rename to docs/i18n/ja/docusaurus-plugin-content-docs/current/reference/visible-head-accessory.md index 0336912f..fa084f69 100644 --- a/docs/i18n/ja/docusaurus-plugin-content-docs/current/reference/first-person.md +++ b/docs/i18n/ja/docusaurus-plugin-content-docs/current/reference/visible-head-accessory.md @@ -1,4 +1,4 @@ -# First Person Visible +# Visible Head Accessory ![First person visible component](first-person-visible.png) diff --git a/docs/i18n/ja/docusaurus-plugin-content-docs/current/reference/first-person-visible.png b/docs/i18n/ja/docusaurus-plugin-content-docs/current/reference/visible-head-accessory.png similarity index 100% rename from docs/i18n/ja/docusaurus-plugin-content-docs/current/reference/first-person-visible.png rename to docs/i18n/ja/docusaurus-plugin-content-docs/current/reference/visible-head-accessory.png