mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-01-31 02:32:53 +08:00
fix: resolve parameter type conflicts for menu items in params usage window
This commit is contained in:
parent
c11a76642c
commit
4c6b41de4c
@ -182,7 +182,22 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
outerbox.RemoveFromClassList("no-data");
|
outerbox.RemoveFromClassList("no-data");
|
||||||
}
|
}
|
||||||
|
|
||||||
var orderedPlugins = ParameterInfo.ForUI.GetParametersForObject(target)
|
ParameterInfo.ConflictHandler onConflict = (type, p1, p2) =>
|
||||||
|
{
|
||||||
|
if (p1.Source is not ModularAvatarMenuItem ||
|
||||||
|
p2.Source is not ModularAvatarMenuItem)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p1.ParameterType == AnimatorControllerParameterType.Bool ||
|
||||||
|
p2.ParameterType == AnimatorControllerParameterType.Float)
|
||||||
|
{
|
||||||
|
p1.ParameterType = p2.ParameterType;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var orderedPlugins = ParameterInfo.ForUI.GetParametersForObject(target, onConflict)
|
||||||
.GroupBy(p => p.Plugin)
|
.GroupBy(p => p.Plugin)
|
||||||
.Select(group => (group.Key, group.Sum(p => p.BitUsage)))
|
.Select(group => (group.Key, group.Sum(p => p.BitUsage)))
|
||||||
.Where((kv, index) => kv.Item2 > 0)
|
.Where((kv, index) => kv.Item2 > 0)
|
||||||
@ -196,7 +211,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
int totalUsage = byPlugin.Sum(kv => kv.Item2);
|
int totalUsage = byPlugin.Sum(kv => kv.Item2);
|
||||||
|
|
||||||
int avatarTotalUsage =
|
int avatarTotalUsage =
|
||||||
ParameterInfo.ForUI.GetParametersForObject(avatarRoot).Sum(p => p.BitUsage);
|
ParameterInfo.ForUI.GetParametersForObject(avatarRoot, onConflict).Sum(p => p.BitUsage);
|
||||||
|
|
||||||
int freeSpace = VRCExpressionParameters.MAX_PARAMETER_COST - avatarTotalUsage;
|
int freeSpace = VRCExpressionParameters.MAX_PARAMETER_COST - avatarTotalUsage;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user