Better duplication of collection.

This commit is contained in:
Chandler Cox
2025-08-26 20:25:02 -05:00
parent 1fb6586dff
commit 824b49dd88

View File

@@ -756,13 +756,22 @@ namespace FlaxEditor.CustomEditors.Editors
return;
var count = Count;
Resize(count + 1);
RefreshInternal(); // Force update values.
Shift(count, index + 1);
RefreshInternal(); // Force update values.
var cloned = CloneValues();
cloned[index + 1] = Utilities.Utils.CloneValue(cloned[index]);
SetValue(cloned);
var newValues = Allocate(count + 1);
var oldValues = (IList)Values[0];
for (int i = 0; i <= index; i++)
{
newValues[i] = oldValues[i];
}
newValues[index + 1] = Utilities.Utils.CloneValue(oldValues[index]);
for (int i = index + 1; i < count; i++)
{
newValues[i + 1] = oldValues[i];
}
SetValue(newValues);
}
/// <summary>