mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-02-03 04:02:52 +08:00
Show warning when components are outside of the avatar root
Closes: #39
This commit is contained in:
parent
f9c709dc51
commit
4f4faa929d
@ -413,6 +413,7 @@ namespace net.fushizen.modular_avatar.core.editor
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
LogoDisplay.DisplayLogo();
|
||||
InspectorCommon.DisplayOutOfAvatarWarning(targets);
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
_devMode = EditorGUILayout.Toggle(G("params.devmode"), _devMode);
|
||||
|
@ -246,6 +246,8 @@ namespace net.fushizen.modular_avatar.core.editor
|
||||
{
|
||||
LogoDisplay.DisplayLogo();
|
||||
|
||||
InspectorCommon.DisplayOutOfAvatarWarning(targets);
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
_list.DoLayoutList();
|
||||
|
@ -29,6 +29,7 @@ namespace net.fushizen.modular_avatar.core.editor
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
LogoDisplay.DisplayLogo();
|
||||
InspectorCommon.DisplayOutOfAvatarWarning(targets);
|
||||
|
||||
GameObject parentAvatar = null;
|
||||
|
||||
|
@ -21,6 +21,10 @@ namespace net.fushizen.modular_avatar.core.editor
|
||||
{
|
||||
var target = (ModularAvatarFirstPersonVisible) this.target;
|
||||
|
||||
LogoDisplay.DisplayLogo();
|
||||
|
||||
InspectorCommon.DisplayOutOfAvatarWarning(targets);
|
||||
|
||||
#if UNITY_ANDROID
|
||||
EditorGUILayout.HelpBox(Localization.S("fpvisible.quest"), MessageType.Warning);
|
||||
|
||||
|
@ -1,21 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace net.fushizen.modular_avatar.core.editor
|
||||
{
|
||||
public class GUIColorScope : IDisposable
|
||||
{
|
||||
private readonly Color _oldColor;
|
||||
|
||||
public GUIColorScope(Color color)
|
||||
{
|
||||
_oldColor = GUI.color;
|
||||
GUI.color = color;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
GUI.color = _oldColor;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 775469f355c64ef2b3e3f5de10e2cde4
|
||||
timeCreated: 1667876954
|
@ -0,0 +1,23 @@
|
||||
using UnityEditor;
|
||||
using UnityEditor.Experimental.SceneManagement;
|
||||
using UnityEngine;
|
||||
|
||||
namespace net.fushizen.modular_avatar.core.editor
|
||||
{
|
||||
internal static class InspectorCommon
|
||||
{
|
||||
internal static void DisplayOutOfAvatarWarning(Object[] targets)
|
||||
{
|
||||
if (PrefabStageUtility.GetCurrentPrefabStage() != null) return;
|
||||
if (targets.Length != 1) return;
|
||||
|
||||
var target = targets[0] as Component;
|
||||
if (target == null) return;
|
||||
|
||||
if (RuntimeUtil.FindAvatarInParents(target.transform) == null)
|
||||
{
|
||||
EditorGUILayout.HelpBox(Localization.S("hint.not_in_avatar"), MessageType.Warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f28108b9ff54e18af150d9172ae275b
|
||||
timeCreated: 1667882294
|
@ -50,6 +50,7 @@ namespace net.fushizen.modular_avatar.core.editor
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
LogoDisplay.DisplayLogo();
|
||||
InspectorCommon.DisplayOutOfAvatarWarning(targets);
|
||||
|
||||
SetupMenuEditor();
|
||||
|
||||
|
@ -49,6 +49,7 @@ namespace net.fushizen.modular_avatar.core.editor
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
LogoDisplay.DisplayLogo();
|
||||
InspectorCommon.DisplayOutOfAvatarWarning(targets);
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
|
@ -33,6 +33,7 @@ namespace net.fushizen.modular_avatar.core.editor
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
LogoDisplay.DisplayLogo();
|
||||
InspectorCommon.DisplayOutOfAvatarWarning(targets);
|
||||
|
||||
var target = (ModularAvatarMergeArmature) this.target;
|
||||
var priorMergeTarget = target.mergeTargetObject;
|
||||
|
@ -44,5 +44,6 @@
|
||||
"fpvisible.InPhysBoneChain": "This object is controlled by a Physics Bone chain and cannot be made visible in first person safely. Select the start of the chain instead.",
|
||||
"blendshape.mesh": "Mesh",
|
||||
"blendshape.source": "Source blendshape",
|
||||
"blendshape.target": "Target blendshape"
|
||||
"blendshape.target": "Target blendshape",
|
||||
"hint.not_in_avatar": "This component needs to be placed inside your avatar to work properly."
|
||||
}
|
@ -44,5 +44,6 @@
|
||||
"fpvisible.InPhysBoneChain": "このオブジェクトはPhysBoneに制御されているため、一人視点で表示できません。PhysBoneの始点を指定してください。",
|
||||
"blendshape.mesh": "メッシュ",
|
||||
"blendshape.source": "元メッシュのブレンドシェープ",
|
||||
"blendshape.target": "このメッシュのブレンドシェープ"
|
||||
"blendshape.target": "このメッシュのブレンドシェープ",
|
||||
"hint.not_in_avatar": "このコンポーネントが正しく動作するには、アバター内に配置する必要があります。"
|
||||
}
|
Loading…
Reference in New Issue
Block a user