mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2024-12-29 18:55:06 +08:00
Rename FPV -> Visible Head Accessory
This commit is contained in:
parent
0cfedf9d77
commit
2091402572
@ -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<VRCAvatarDescriptor>()).Process();
|
||||
new VisibleHeadAccessoryProcessor(avatarGameObject.GetComponent<VRCAvatarDescriptor>()).Process();
|
||||
new MergeAnimatorProcessor().OnPreprocessAvatar(avatarGameObject);
|
||||
new BlendshapeSyncAnimationProcessor().OnPreprocessAvatar(avatarGameObject);
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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.
|
||||
/// </summary>
|
||||
internal class FirstPersonVisibleMeshProcessor
|
||||
internal class VisibleHeadAccessoryMeshProcessor
|
||||
{
|
||||
private SkinnedMeshRenderer _renderer;
|
||||
private HashSet<Transform> _visibleBones;
|
||||
private Transform _proxyHead;
|
||||
|
||||
public FirstPersonVisibleMeshProcessor(
|
||||
public VisibleHeadAccessoryMeshProcessor(
|
||||
SkinnedMeshRenderer renderer,
|
||||
HashSet<Transform> visibleBones,
|
||||
Transform proxyHead
|
@ -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<Transform> _visibleBones = new HashSet<Transform>();
|
||||
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<ModularAvatarFirstPersonVisible>(true))
|
||||
foreach (var target in _avatar.GetComponentsInChildren<ModularAvatarVisibleHeadAccessory>(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<SkinnedMeshRenderer>(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<ModularAvatarFirstPersonVisible>()) return ReadyStatus.ParentMarked;
|
||||
if (node.GetComponent<ModularAvatarVisibleHeadAccessory>()) return ReadyStatus.ParentMarked;
|
||||
if (_activeBones.Contains(node)) return ReadyStatus.InPhysBoneChain;
|
||||
|
||||
if (node == _headBone)
|
@ -1,7 +0,0 @@
|
||||
namespace net.fushizen.modular_avatar.core
|
||||
{
|
||||
public class ModularAvatarFirstPersonVisible : AvatarTagComponent
|
||||
{
|
||||
// no configuration needed
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
||||
}
|
@ -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.
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
@ -1,4 +1,4 @@
|
||||
# First Person Visible
|
||||
# Visible Head Accessory
|
||||
|
||||
![First person visible component](first-person-visible.png)
|
||||
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
Loading…
Reference in New Issue
Block a user