mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-04-24 13:29:01 +08:00
fixing ui issues=
This commit is contained in:
parent
6ba3f95177
commit
9f9d5f7c26
@ -4,6 +4,7 @@ using System.Runtime.Serialization;
|
||||
using nadena.dev.modular_avatar.core.menu;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.PlayerLoop;
|
||||
using VRC.SDK3.Avatars.ScriptableObjects;
|
||||
using static nadena.dev.modular_avatar.core.editor.Localization;
|
||||
|
||||
@ -223,6 +224,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
case VRCExpressionsMenu.Control.ControlType.SubMenu:
|
||||
{
|
||||
object menuSource = null;
|
||||
bool canExpand = false;
|
||||
|
||||
if (_prop_submenuSource != null)
|
||||
{
|
||||
@ -255,6 +257,8 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
case SubmenuSource.MenuAsset:
|
||||
{
|
||||
EditorGUILayout.PropertyField(_submenu, G("menuitem.prop.submenu_asset"));
|
||||
canExpand = true;
|
||||
|
||||
if (_submenu.hasMultipleDifferentValues) break;
|
||||
menuSource = _submenu.objectReferenceValue;
|
||||
break;
|
||||
@ -289,6 +293,35 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
}
|
||||
}
|
||||
|
||||
if (canExpand && (_submenu.hasMultipleDifferentValues || _submenu.objectReferenceValue != null))
|
||||
{
|
||||
if (GUILayout.Button(G("menuitem.misc.extract")))
|
||||
{
|
||||
_obj.ApplyModifiedProperties();
|
||||
|
||||
foreach (var targetObj in _obj.targetObjects)
|
||||
{
|
||||
var menuItem = (ModularAvatarMenuItem) targetObj;
|
||||
if (menuItem.Control.type == VRCExpressionsMenu.Control.ControlType.SubMenu
|
||||
&& menuItem.Control.subMenu != null
|
||||
&& menuItem.MenuSource == SubmenuSource.MenuAsset
|
||||
)
|
||||
{
|
||||
Undo.RecordObject(menuItem, "Extract menu");
|
||||
MenuExtractor.ExtractSingleLayerMenu(menuItem.Control.subMenu,
|
||||
menuItem.gameObject);
|
||||
menuItem.Control.subMenu = null;
|
||||
menuItem.MenuSource = SubmenuSource.Children;
|
||||
menuItem.menuSource_otherObjectChildren = null;
|
||||
EditorUtility.SetDirty(menuItem);
|
||||
PrefabUtility.RecordPrefabInstancePropertyModifications(menuItem);
|
||||
}
|
||||
}
|
||||
|
||||
_obj.Update();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case VRCExpressionsMenu.Control.ControlType.RadialPuppet:
|
||||
|
@ -51,7 +51,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
if (_disableProp != null)
|
||||
{
|
||||
_disableProp.serializedObject.Update();
|
||||
GUILayout.Space(20);
|
||||
GUILayout.Space(10);
|
||||
GUILayout.Label("Enabled", GUILayout.Width(50));
|
||||
EditorGUILayout.PropertyField(_disableProp, GUIContent.none,
|
||||
GUILayout.Width(EditorGUIUtility.singleLineHeight));
|
||||
|
@ -11,6 +11,8 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
[CustomEditor(typeof(ToggleGroup))]
|
||||
internal class ToggleGroupInspector : MAEditorBase
|
||||
{
|
||||
private bool _showInner;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
EditorApplication.hierarchyChanged += Invalidate;
|
||||
@ -88,7 +90,9 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
{
|
||||
if (_menuItemActions == null) Invalidate();
|
||||
|
||||
EditorGUILayout.LabelField("Bound menu items", EditorStyles.boldLabel);
|
||||
_showInner = EditorGUILayout.Foldout(_showInner, "Bound menu items");
|
||||
if (_showInner)
|
||||
{
|
||||
foreach (var action in _menuItemActions)
|
||||
{
|
||||
try
|
||||
@ -104,5 +108,8 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
EditorGUILayout.Space(4);
|
||||
}
|
||||
}
|
||||
|
||||
Localization.ShowLanguageUI();
|
||||
}
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace nadena.dev.modular_avatar.core
|
||||
{
|
||||
[AddComponentMenu("Modular Avatar/MA Toggle Group")]
|
||||
public class ToggleGroup : AvatarTagComponent
|
||||
{
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user