mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-04-11 23:19:00 +08:00
fix: incorrect parameter type detemination for float values
This commit is contained in:
parent
f8124cae03
commit
a93b003129
@ -34,19 +34,10 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
hidden = true;
|
||||
}
|
||||
|
||||
var type = AnimatorControllerParameterType.Bool;
|
||||
|
||||
if (type != AnimatorControllerParameterType.Float &&
|
||||
(_component.Control.value > 1.01 || _component.Control.value < -0.01))
|
||||
type = AnimatorControllerParameterType.Int;
|
||||
|
||||
if (Mathf.Abs(Mathf.Round(_component.Control.value) - _component.Control.value) > 0.01f)
|
||||
type = AnimatorControllerParameterType.Float;
|
||||
|
||||
yield return new ProvidedParameter(
|
||||
name,
|
||||
ParameterNamespace.Animator,
|
||||
_component, PluginDefinition.Instance, type)
|
||||
_component, PluginDefinition.Instance, _component.AnimatorControllerParameterType)
|
||||
{
|
||||
WantSynced = _component.isSynced,
|
||||
IsHidden = hidden,
|
||||
|
@ -136,10 +136,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
}
|
||||
}
|
||||
|
||||
var type =
|
||||
Mathf.Abs(mami.Control.value - Mathf.Round(mami.Control.value)) > 0.01f ? VRCExpressionParameters.ValueType.Float
|
||||
: mami.Control.value < 0 || mami.Control.value > 1 ? VRCExpressionParameters.ValueType.Int
|
||||
: VRCExpressionParameters.ValueType.Bool;
|
||||
var type = mami.ExpressionParametersValueType;
|
||||
if (valueType == VRCExpressionParameters.ValueType.Bool || type == VRCExpressionParameters.ValueType.Float)
|
||||
{
|
||||
valueType = type;
|
||||
|
@ -149,6 +149,52 @@ namespace nadena.dev.modular_avatar.core
|
||||
if (control.subParameters.Length > maxSubParams)
|
||||
control.subParameters = control.subParameters.Take(maxSubParams).ToArray();
|
||||
}
|
||||
|
||||
internal VRCExpressionParameters.ValueType ExpressionParametersValueType
|
||||
{
|
||||
get
|
||||
{
|
||||
// 0, 1
|
||||
var type = VRCExpressionParameters.ValueType.Bool;
|
||||
|
||||
// 2, 3, ..., (255)
|
||||
if (Control.value > 1)
|
||||
{
|
||||
type = VRCExpressionParameters.ValueType.Int;
|
||||
}
|
||||
|
||||
// (-1.0), ..., -0.1, 0.1, ..., 0.9
|
||||
if (Control.value < 0 || Mathf.Abs(Control.value - Mathf.Round(Control.value)) > 0.01f)
|
||||
{
|
||||
type = VRCExpressionParameters.ValueType.Float;
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
internal AnimatorControllerParameterType AnimatorControllerParameterType
|
||||
{
|
||||
get
|
||||
{
|
||||
// 0, 1
|
||||
var type = AnimatorControllerParameterType.Bool;
|
||||
|
||||
// 2, 3, ..., (255)
|
||||
if (Control.value > 1)
|
||||
{
|
||||
type = AnimatorControllerParameterType.Int;
|
||||
}
|
||||
|
||||
// (-1.0), ..., -0.1, 0.1, ..., 0.9
|
||||
if (Control.value < 0 || Mathf.Abs(Control.value - Mathf.Round(Control.value)) > 0.01f)
|
||||
{
|
||||
type = AnimatorControllerParameterType.Float;
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user