mirror of
https://github.com/4sval/FModel.git
synced 2026-03-22 01:34:37 -05:00
fixed non virtual sockets being deleted on anim change
This commit is contained in:
parent
4797a4b338
commit
0ed26e1a7d
|
|
@ -1 +1 @@
|
|||
Subproject commit c24bb1a031f8d463a8401e3952c9a11344e208a8
|
||||
Subproject commit 2623c0baa171d05f6f6d3922a1a6ea3ae675fb25
|
||||
|
|
@ -186,10 +186,10 @@ public class ApplicationViewModel : ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
public async Task InitImGuiSettings()
|
||||
public async Task InitImGuiSettings(bool forceDownload)
|
||||
{
|
||||
var imgui = Path.Combine(/*UserSettings.Default.OutputDirectory, ".data", */"imgui.ini");
|
||||
if (File.Exists(imgui)) return;
|
||||
if (!forceDownload || File.Exists(imgui)) return;
|
||||
|
||||
await ApplicationService.ApiEndpointView.DownloadFileAsync("https://cdn.fmodel.app/d/configurations/imgui.ini", imgui);
|
||||
if (new FileInfo(imgui).Length == 0)
|
||||
|
|
|
|||
|
|
@ -92,9 +92,15 @@ public class Skeleton : IDisposable
|
|||
{
|
||||
for (int frame = 0; frame < _animatedBonesTransform[s][boneIndices.BoneIndex].Length; frame++)
|
||||
{
|
||||
// TODO: append the delta transform
|
||||
// ex: if bone 4, with parent 3, has its first found parent transform at 2,
|
||||
// we need to append the transform from 4 to 3 so that bone 4 won't be placed where bone 3 should be
|
||||
_animatedBonesTransform[s][boneIndices.BoneIndex][frame] = new Transform
|
||||
{
|
||||
Relation = originalTransform.LocalMatrix * _animatedBonesTransform[s][boneIndices.ParentTrackIndex][frame].Matrix
|
||||
Relation = _animatedBonesTransform[s][boneIndices.ParentTrackIndex][frame].Matrix,
|
||||
Rotation = originalTransform.Rotation,
|
||||
Position = originalTransform.Position,
|
||||
Scale = originalTransform.Scale
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ public class TimeTracker : IDisposable
|
|||
|
||||
for (int i = 0; i < animations.Count; i++)
|
||||
{
|
||||
var y = timelineP0.Y + _timeBarHeight + timeStep.Y * (i % 2);
|
||||
var y = timelineP0.Y + _timeBarHeight + timeStep.Y * i;
|
||||
animations[i].ImGuiAnimation(drawList, timelineP0, treeP0, treeP1, timeStep, timeRatio, y, _thickness);
|
||||
DrawSeparator(drawList, timelineP0, y + timeStep.Y, animations[i].EndTime * timeRatio.X, ETrackerType.End);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,12 +99,12 @@ public class Options
|
|||
{
|
||||
if (!TryGetModel(guid, out var model)) return;
|
||||
|
||||
DetachAndRemoveModels(model);
|
||||
DetachAndRemoveModels(model, true);
|
||||
model.Dispose();
|
||||
Models.Remove(guid);
|
||||
}
|
||||
|
||||
private void DetachAndRemoveModels(Model model)
|
||||
private void DetachAndRemoveModels(Model model, bool detach)
|
||||
{
|
||||
foreach (var socket in model.Sockets.ToList())
|
||||
{
|
||||
|
|
@ -112,8 +112,12 @@ public class Options
|
|||
{
|
||||
if (!TryGetModel(info.Guid, out var attachedModel)) continue;
|
||||
|
||||
attachedModel.SafeDetachModel(model);
|
||||
RemoveModel(info.Guid);
|
||||
if (attachedModel.IsAnimatedProp)
|
||||
{
|
||||
attachedModel.SafeDetachModel(model);
|
||||
RemoveModel(info.Guid);
|
||||
}
|
||||
else if (detach) attachedModel.SafeDetachModel(model);
|
||||
}
|
||||
|
||||
if (socket.IsVirtual)
|
||||
|
|
@ -139,7 +143,7 @@ public class Options
|
|||
if (!TryGetModel(guid, out var animatedModel)) continue;
|
||||
|
||||
animatedModel.Skeleton.ResetAnimatedData(true);
|
||||
DetachAndRemoveModels(animatedModel);
|
||||
DetachAndRemoveModels(animatedModel, false);
|
||||
}
|
||||
animation.Dispose();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user