mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-01-04 13:45:04 +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 MergeArmatureHook().OnPreprocessAvatar(avatarGameObject);
|
||||||
new RetargetMeshes().OnPreprocessAvatar(avatarGameObject);
|
new RetargetMeshes().OnPreprocessAvatar(avatarGameObject);
|
||||||
new BoneProxyProcessor().OnPreprocessAvatar(avatarGameObject);
|
new BoneProxyProcessor().OnPreprocessAvatar(avatarGameObject);
|
||||||
new FirstPersonVisibleProcessor(avatarGameObject.GetComponent<VRCAvatarDescriptor>()).Process();
|
new VisibleHeadAccessoryProcessor(avatarGameObject.GetComponent<VRCAvatarDescriptor>()).Process();
|
||||||
new MergeAnimatorProcessor().OnPreprocessAvatar(avatarGameObject);
|
new MergeAnimatorProcessor().OnPreprocessAvatar(avatarGameObject);
|
||||||
new BlendshapeSyncAnimationProcessor().OnPreprocessAvatar(avatarGameObject);
|
new BlendshapeSyncAnimationProcessor().OnPreprocessAvatar(avatarGameObject);
|
||||||
|
|
||||||
|
@ -4,22 +4,22 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace net.fushizen.modular_avatar.core.editor
|
namespace net.fushizen.modular_avatar.core.editor
|
||||||
{
|
{
|
||||||
[CustomEditor(typeof(ModularAvatarFirstPersonVisible))]
|
[CustomEditor(typeof(ModularAvatarVisibleHeadAccessory))]
|
||||||
public class FirstPersonVisibleEditor : Editor
|
public class FirstPersonVisibleEditor : Editor
|
||||||
{
|
{
|
||||||
private FirstPersonVisibleProcessor _processor;
|
private VisibleHeadAccessoryProcessor _processor;
|
||||||
|
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
var target = (ModularAvatarFirstPersonVisible) this.target;
|
var target = (ModularAvatarVisibleHeadAccessory) this.target;
|
||||||
var avatar = RuntimeUtil.FindAvatarInParents(target.transform);
|
var avatar = RuntimeUtil.FindAvatarInParents(target.transform);
|
||||||
|
|
||||||
if (avatar != null) _processor = new FirstPersonVisibleProcessor(avatar);
|
if (avatar != null) _processor = new VisibleHeadAccessoryProcessor(avatar);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnInspectorGUI()
|
public override void OnInspectorGUI()
|
||||||
{
|
{
|
||||||
var target = (ModularAvatarFirstPersonVisible) this.target;
|
var target = (ModularAvatarVisibleHeadAccessory) this.target;
|
||||||
|
|
||||||
LogoDisplay.DisplayLogo();
|
LogoDisplay.DisplayLogo();
|
||||||
|
|
||||||
@ -36,8 +36,8 @@ namespace net.fushizen.modular_avatar.core.editor
|
|||||||
|
|
||||||
switch (status)
|
switch (status)
|
||||||
{
|
{
|
||||||
case FirstPersonVisibleProcessor.ReadyStatus.Ready:
|
case VisibleHeadAccessoryProcessor.ReadyStatus.Ready:
|
||||||
case FirstPersonVisibleProcessor.ReadyStatus.ParentMarked:
|
case VisibleHeadAccessoryProcessor.ReadyStatus.ParentMarked:
|
||||||
EditorGUILayout.HelpBox(Localization.S("fpvisible.normal"), MessageType.Info);
|
EditorGUILayout.HelpBox(Localization.S("fpvisible.normal"), MessageType.Info);
|
||||||
break;
|
break;
|
||||||
default:
|
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
|
/// 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.
|
/// proxy head bone instead.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class FirstPersonVisibleMeshProcessor
|
internal class VisibleHeadAccessoryMeshProcessor
|
||||||
{
|
{
|
||||||
private SkinnedMeshRenderer _renderer;
|
private SkinnedMeshRenderer _renderer;
|
||||||
private HashSet<Transform> _visibleBones;
|
private HashSet<Transform> _visibleBones;
|
||||||
private Transform _proxyHead;
|
private Transform _proxyHead;
|
||||||
|
|
||||||
public FirstPersonVisibleMeshProcessor(
|
public VisibleHeadAccessoryMeshProcessor(
|
||||||
SkinnedMeshRenderer renderer,
|
SkinnedMeshRenderer renderer,
|
||||||
HashSet<Transform> visibleBones,
|
HashSet<Transform> visibleBones,
|
||||||
Transform proxyHead
|
Transform proxyHead
|
@ -6,7 +6,7 @@ using VRC.SDK3.Dynamics.PhysBone.Components;
|
|||||||
|
|
||||||
namespace net.fushizen.modular_avatar.core.editor
|
namespace net.fushizen.modular_avatar.core.editor
|
||||||
{
|
{
|
||||||
internal class FirstPersonVisibleProcessor
|
internal class VisibleHeadAccessoryProcessor
|
||||||
{
|
{
|
||||||
private const double EPSILON = 0.01;
|
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 HashSet<Transform> _visibleBones = new HashSet<Transform>();
|
||||||
private Transform _proxyHead;
|
private Transform _proxyHead;
|
||||||
|
|
||||||
public FirstPersonVisibleProcessor(VRCAvatarDescriptor avatar)
|
public VisibleHeadAccessoryProcessor(VRCAvatarDescriptor avatar)
|
||||||
{
|
{
|
||||||
_avatar = avatar;
|
_avatar = avatar;
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ namespace net.fushizen.modular_avatar.core.editor
|
|||||||
{
|
{
|
||||||
bool didWork = false;
|
bool didWork = false;
|
||||||
|
|
||||||
foreach (var target in _avatar.GetComponentsInChildren<ModularAvatarFirstPersonVisible>(true))
|
foreach (var target in _avatar.GetComponentsInChildren<ModularAvatarVisibleHeadAccessory>(true))
|
||||||
{
|
{
|
||||||
var w = Process(target);
|
var w = Process(target);
|
||||||
didWork = didWork || w;
|
didWork = didWork || w;
|
||||||
@ -70,12 +70,12 @@ namespace net.fushizen.modular_avatar.core.editor
|
|||||||
// Process meshes
|
// Process meshes
|
||||||
foreach (var smr in _avatar.GetComponentsInChildren<SkinnedMeshRenderer>(true))
|
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;
|
bool didWork = false;
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ namespace net.fushizen.modular_avatar.core.editor
|
|||||||
return obj.transform;
|
return obj.transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal ReadyStatus Validate(ModularAvatarFirstPersonVisible target)
|
internal ReadyStatus Validate(ModularAvatarVisibleHeadAccessory target)
|
||||||
{
|
{
|
||||||
ReadyStatus status = ReadyStatus.NotUnderHead;
|
ReadyStatus status = ReadyStatus.NotUnderHead;
|
||||||
Transform node = target.transform.parent;
|
Transform node = target.transform.parent;
|
||||||
@ -153,7 +153,7 @@ namespace net.fushizen.modular_avatar.core.editor
|
|||||||
|
|
||||||
while (node != null)
|
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 (_activeBones.Contains(node)) return ReadyStatus.InPhysBoneChain;
|
||||||
|
|
||||||
if (node == _headBone)
|
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.
|
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.
|
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.
|
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.
|
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)
|
![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