mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-04-25 05:49:00 +08:00
parent
d385eb8800
commit
d940e5de8a
@ -175,27 +175,42 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
_needsRebuild = true;
|
||||
}
|
||||
|
||||
private float ElementHeight(int index)
|
||||
// https://github.com/bdunderscore/modular-avatar/issues/217
|
||||
private float[] ElementHeightCache = null;
|
||||
|
||||
private float[] BuildHeightCache()
|
||||
{
|
||||
float[] cache = new float[_selectedIndices.Count];
|
||||
|
||||
for (int i = 0; i < _selectedIndices.Count; i++)
|
||||
{
|
||||
float baseHeight = _devMode ? elemHeight * 2 : elemHeight;
|
||||
|
||||
var param = GetParamByIndex(_selectedIndices[index]);
|
||||
var param = GetParamByIndex(_selectedIndices[i]);
|
||||
var syncMode = param.FindPropertyRelative(nameof(ParameterConfig.syncType));
|
||||
if (syncMode.enumValueIndex != (int) ParameterSyncType.NotSynced)
|
||||
{
|
||||
baseHeight += elemHeight;
|
||||
}
|
||||
|
||||
if (_selectedIndices[index] == -1)
|
||||
if (_selectedIndices[i] == -1)
|
||||
{
|
||||
return elemHeight + baseHeight;
|
||||
cache[i] = elemHeight + baseHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
return baseHeight;
|
||||
cache[i] = baseHeight;
|
||||
}
|
||||
}
|
||||
|
||||
return cache;
|
||||
}
|
||||
|
||||
private float ElementHeight(int reqIndex)
|
||||
{
|
||||
return ElementHeightCache[reqIndex];
|
||||
}
|
||||
|
||||
private void DrawAutodetectHeader(ref Rect rect)
|
||||
{
|
||||
Rect top = rect;
|
||||
@ -412,6 +427,8 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
|
||||
protected override void OnInnerInspectorGUI()
|
||||
{
|
||||
ElementHeightCache = BuildHeightCache();
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
_devMode = EditorGUILayout.Toggle(G("params.devmode"), _devMode);
|
||||
if (EditorGUI.EndChangeCheck() || _reorderableList == null || _needsRebuild) SetupList();
|
||||
|
Loading…
x
Reference in New Issue
Block a user