SkinRenderer - Update ModelData_CollectionChanged add action

This commit is contained in:
miku-666
2024-03-01 15:35:49 +01:00
parent 4fcf152a6f
commit 216d655040

View File

@@ -682,11 +682,18 @@ namespace PckStudio.Rendering
#endif
}
private void UpdateMesh(string name)
{
if (!meshStorage.ContainsKey(name))
return;
meshStorage[name]?.UploadData();
}
private void UploadMeshData()
{
foreach (var cubeMesh in meshStorage?.Values)
foreach (var cubeMeshName in meshStorage?.Keys)
{
cubeMesh?.UploadData();
UpdateMesh(cubeMeshName);
}
}
@@ -729,6 +736,12 @@ namespace PckStudio.Rendering
switch (e.Action)
{
case NotifyCollectionChangedAction.Add:
if (e.NewItems[0] is SkinBOX addedBox)
{
AddCustomModelPart(addedBox);
UpdateMesh(addedBox.Type);
}
break;
case NotifyCollectionChangedAction.Remove:
case NotifyCollectionChangedAction.Replace:
ReInitialzeSkinData();