Skip to content

Commit

Permalink
Fix CurveKey data being lost when editing, show text when array is dr…
Browse files Browse the repository at this point in the history
…iven and don't generate the list in that case
  • Loading branch information
Nytra authored and Banane9 committed Sep 5, 2024
1 parent 256173c commit 5d20d85
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions MonkeyLoader.Resonite.Integration/UI/SyncArrayEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ private static void AddUpdateProxies<T>(SyncArray<CurveKey<T>> array,
point.Changed += syncObject =>
{
var index = list.IndexOfElement(point);
array[index] = new CurveKey<T>(point.Position, point.Value);
array[index] = new CurveKey<T>(point.Position, point.Value, array[index].leftTangent, array[index].rightTangent);
};
}
}
Expand Down Expand Up @@ -364,10 +364,18 @@ private static bool Prefix(ISyncArray array, string name, FieldInfo fieldInfo, U
}

ui.Panel().Slot.GetComponent<LayoutElement>();
SyncMemberEditorBuilder.GenerateMemberField(array, name, ui, labelSize);
var memberFieldSlot = SyncMemberEditorBuilder.GenerateMemberField(array, name, ui, labelSize);
ui.NestOut();
SyncMemberEditorBuilder.BuildList(list, name, listField, ui);
ui.Current[ui.Current.ChildrenCount - 1].DestroyWhenLocalUserLeaves();
if (!array.IsDriven)
{
SyncMemberEditorBuilder.BuildList(list, name, listField, ui);
ui.Current[ui.Current.ChildrenCount - 1].DestroyWhenLocalUserLeaves();
}
else
{
LocaleString text = "(array is driven)";
ui.Text(in text);
}

return false;
}
Expand Down

0 comments on commit 5d20d85

Please sign in to comment.