mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2024-12-29 18:55:06 +08:00
fix: issues when handling VRCExpressionMenus with an uninitialized type field (#1303)
This commit is contained in:
parent
123523540e
commit
11a62c88d4
@ -301,10 +301,9 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
EditorGUILayout.BeginVertical();
|
EditorGUILayout.BeginVertical();
|
||||||
|
|
||||||
if (_type.hasMultipleDifferentValues) return;
|
if (_type.hasMultipleDifferentValues) return;
|
||||||
VRCExpressionsMenu.Control.ControlType type =
|
var controlTypeArray = Enum.GetValues(typeof(VRCExpressionsMenu.Control.ControlType));
|
||||||
(VRCExpressionsMenu.Control.ControlType) Enum
|
var index = Math.Clamp(_type.enumValueIndex, 0, controlTypeArray.Length - 1);
|
||||||
.GetValues(typeof(VRCExpressionsMenu.Control.ControlType))
|
var type = (VRCExpressionsMenu.Control.ControlType)controlTypeArray.GetValue(index);
|
||||||
.GetValue(_type.enumValueIndex);
|
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
@ -119,9 +119,11 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
|
|
||||||
internal static VRCExpressionsMenu.Control CloneControl(VRCExpressionsMenu.Control c)
|
internal static VRCExpressionsMenu.Control CloneControl(VRCExpressionsMenu.Control c)
|
||||||
{
|
{
|
||||||
|
var type = c.type != 0 ? c.type : VRCExpressionsMenu.Control.ControlType.Button;
|
||||||
|
|
||||||
return new VRCExpressionsMenu.Control()
|
return new VRCExpressionsMenu.Control()
|
||||||
{
|
{
|
||||||
type = c.type,
|
type = type,
|
||||||
name = c.name,
|
name = c.name,
|
||||||
icon = c.icon,
|
icon = c.icon,
|
||||||
parameter = new VRCExpressionsMenu.Control.Parameter() { name = c.parameter?.name },
|
parameter = new VRCExpressionsMenu.Control.Parameter() { name = c.parameter?.name },
|
||||||
|
Loading…
Reference in New Issue
Block a user