- Keyframes will be removed from the animation if they have a duration of 0 ticks
This commit is contained in:
AbstractConcept 2022-11-09 18:03:52 -06:00
parent b15c046738
commit 0828ecd037
40 changed files with 99 additions and 92 deletions

View file

@ -101,6 +101,16 @@ namespace RimWorldAnimationStudio
if (keyframe.atTick.HasValue) if (keyframe.atTick.HasValue)
{ {
if (i + 1 < Keyframes.Count)
{ Keyframes[i].TickDuration = Keyframes[i + 1].atTick.Value - Keyframes[i].atTick.Value; }
// Safeguard - if two keys end up in having the same atTick, the duration of the first will be 0 and should be deleted
if (Keyframes[i].TickDuration == 0)
{
Keyframes.RemoveAt(i);
continue;
}
BodyAngle.Add((float)keyframe.atTick / (float)duration, keyframe.BodyAngle, true); BodyAngle.Add((float)keyframe.atTick / (float)duration, keyframe.BodyAngle, true);
HeadAngle.Add((float)keyframe.atTick / (float)duration, keyframe.HeadAngle, true); HeadAngle.Add((float)keyframe.atTick / (float)duration, keyframe.HeadAngle, true);
BodyOffsetX.Add((float)keyframe.atTick / (float)duration, keyframe.BodyOffsetX, true); BodyOffsetX.Add((float)keyframe.atTick / (float)duration, keyframe.BodyOffsetX, true);
@ -119,9 +129,6 @@ namespace RimWorldAnimationStudio
addon.PosZ.Add((float)keyframe.atTick / (float)duration, keyframe.GetAddonKeyframe(addon.AddonName).PosZ, true); addon.PosZ.Add((float)keyframe.atTick / (float)duration, keyframe.GetAddonKeyframe(addon.AddonName).PosZ, true);
addon.Rotation.Add((float)keyframe.atTick / (float)duration, keyframe.GetAddonKeyframe(addon.AddonName).Rotation, true); addon.Rotation.Add((float)keyframe.atTick / (float)duration, keyframe.GetAddonKeyframe(addon.AddonName).Rotation, true);
} }
if (i + 1 < Keyframes.Count)
{ Keyframes[i].TickDuration = Keyframes[i + 1].atTick.Value - Keyframes[i].atTick.Value; }
} }
else else

Binary file not shown.

Binary file not shown.

View file

@ -21,7 +21,7 @@ MonoBehaviour:
m_ShowMode: 4 m_ShowMode: 4
m_Title: m_Title:
m_RootView: {fileID: 2} m_RootView: {fileID: 2}
m_MinSize: {x: 875, y: 300} m_MinSize: {x: 875, y: 542}
m_MaxSize: {x: 10000, y: 10000} m_MaxSize: {x: 10000, y: 10000}
m_Maximized: 1 m_Maximized: 1
--- !u!114 &2 --- !u!114 &2
@ -46,7 +46,7 @@ MonoBehaviour:
y: 0 y: 0
width: 1920 width: 1920
height: 997 height: 997
m_MinSize: {x: 875, y: 300} m_MinSize: {x: 875, y: 542}
m_MaxSize: {x: 10000, y: 10000} m_MaxSize: {x: 10000, y: 10000}
--- !u!114 &3 --- !u!114 &3
MonoBehaviour: MonoBehaviour:
@ -115,7 +115,7 @@ MonoBehaviour:
m_MinSize: {x: 677, y: 492} m_MinSize: {x: 677, y: 492}
m_MaxSize: {x: 14001, y: 14042} m_MaxSize: {x: 14001, y: 14042}
vertical: 0 vertical: 0
controlID: 41 controlID: 196
--- !u!114 &6 --- !u!114 &6
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 52 m_ObjectHideFlags: 52
@ -140,7 +140,7 @@ MonoBehaviour:
m_MinSize: {x: 402, y: 492} m_MinSize: {x: 402, y: 492}
m_MaxSize: {x: 10001, y: 14042} m_MaxSize: {x: 10001, y: 14042}
vertical: 1 vertical: 1
controlID: 42 controlID: 201
--- !u!114 &7 --- !u!114 &7
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 52 m_ObjectHideFlags: 52
@ -165,7 +165,7 @@ MonoBehaviour:
m_MinSize: {x: 402, y: 221} m_MinSize: {x: 402, y: 221}
m_MaxSize: {x: 8002, y: 4021} m_MaxSize: {x: 8002, y: 4021}
vertical: 0 vertical: 0
controlID: 43 controlID: 202
--- !u!114 &8 --- !u!114 &8
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 52 m_ObjectHideFlags: 52
@ -324,10 +324,10 @@ MonoBehaviour:
m_VRangeLocked: 0 m_VRangeLocked: 0
hZoomLockedByDefault: 0 hZoomLockedByDefault: 0
vZoomLockedByDefault: 0 vZoomLockedByDefault: 0
m_HBaseRangeMin: -537.5 m_HBaseRangeMin: -960
m_HBaseRangeMax: 537.5 m_HBaseRangeMax: 960
m_VBaseRangeMin: -325 m_VBaseRangeMin: -453.5
m_VBaseRangeMax: 325 m_VBaseRangeMax: 453.5
m_HAllowExceedBaseRangeMin: 1 m_HAllowExceedBaseRangeMin: 1
m_HAllowExceedBaseRangeMax: 1 m_HAllowExceedBaseRangeMax: 1
m_VAllowExceedBaseRangeMin: 1 m_VAllowExceedBaseRangeMin: 1
@ -344,24 +344,24 @@ MonoBehaviour:
m_DrawArea: m_DrawArea:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 0 y: 21
width: 1075 width: 1920
height: 650 height: 907
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Translation: {x: 537.5, y: 325} m_Translation: {x: 960, y: 453.5}
m_MarginLeft: 0 m_MarginLeft: 0
m_MarginRight: 0 m_MarginRight: 0
m_MarginTop: 0 m_MarginTop: 0
m_MarginBottom: 0 m_MarginBottom: 0
m_LastShownAreaInsideMargins: m_LastShownAreaInsideMargins:
serializedVersion: 2 serializedVersion: 2
x: -537.5 x: -960
y: -325 y: -453.5
width: 1075 width: 1920
height: 650 height: 907
m_MinimalGUI: 1 m_MinimalGUI: 1
m_defaultScale: 1 m_defaultScale: 1
m_LastWindowPixelSize: {x: 1075, y: 650} m_LastWindowPixelSize: {x: 1920, y: 928}
m_ClearInEditMode: 1 m_ClearInEditMode: 1
m_NoCameraWarning: 1 m_NoCameraWarning: 1
m_LowResolutionForAspectRatios: 01000000000000000000 m_LowResolutionForAspectRatios: 01000000000000000000
@ -398,7 +398,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0} scrollPos: {x: 0, y: 0}
m_SelectedIDs: m_SelectedIDs:
m_LastClickedID: 0 m_LastClickedID: 0
m_ExpandedIDs: 8af5ffff9ef5ffff44f6ffff4afbffff m_ExpandedIDs: c6dbffffdadbffff80dcffff4cfbffff
m_RenameOverlay: m_RenameOverlay:
m_UserAcceptedRename: 0 m_UserAcceptedRename: 0
m_Name: m_Name:
@ -1115,9 +1115,9 @@ MonoBehaviour:
m_IsLocked: 0 m_IsLocked: 0
m_FolderTreeState: m_FolderTreeState:
scrollPos: {x: 0, y: 143} scrollPos: {x: 0, y: 143}
m_SelectedIDs: 4c4e0000 m_SelectedIDs: 4e4e0000
m_LastClickedID: 20044 m_LastClickedID: 20046
m_ExpandedIDs: 00000000404e0000424e0000444e0000464e0000484e00004a4e00004c4e00004e4e0000504e0000524e0000544e0000564e000000ca9a3b m_ExpandedIDs: 00000000424e0000444e0000464e0000484e00004a4e00004c4e00004e4e0000504e0000524e0000544e0000564e0000584e000000ca9a3b
m_RenameOverlay: m_RenameOverlay:
m_UserAcceptedRename: 0 m_UserAcceptedRename: 0
m_Name: m_Name:
@ -1145,7 +1145,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0} scrollPos: {x: 0, y: 0}
m_SelectedIDs: m_SelectedIDs:
m_LastClickedID: 0 m_LastClickedID: 0
m_ExpandedIDs: 00000000404e0000424e0000444e0000464e0000484e00004a4e00004c4e00004e4e0000504e0000524e0000544e0000564e0000 m_ExpandedIDs: 00000000424e0000444e0000464e0000484e00004a4e00004c4e00004e4e0000504e0000524e0000544e0000564e0000584e000000ca9a3b
m_RenameOverlay: m_RenameOverlay:
m_UserAcceptedRename: 0 m_UserAcceptedRename: 0
m_Name: m_Name:

View file

@ -24,7 +24,7 @@ MonoBehaviour:
m_MinSize: {x: 677, y: 492} m_MinSize: {x: 677, y: 492}
m_MaxSize: {x: 14001, y: 14042} m_MaxSize: {x: 14001, y: 14042}
vertical: 0 vertical: 0
controlID: 3438 controlID: 134
--- !u!114 &2 --- !u!114 &2
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 52 m_ObjectHideFlags: 52
@ -141,7 +141,7 @@ MonoBehaviour:
m_MinSize: {x: 402, y: 492} m_MinSize: {x: 402, y: 492}
m_MaxSize: {x: 10001, y: 14042} m_MaxSize: {x: 10001, y: 14042}
vertical: 1 vertical: 1
controlID: 3439 controlID: 90
--- !u!114 &4 --- !u!114 &4
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 52 m_ObjectHideFlags: 52
@ -166,7 +166,7 @@ MonoBehaviour:
m_MinSize: {x: 402, y: 221} m_MinSize: {x: 402, y: 221}
m_MaxSize: {x: 8002, y: 4021} m_MaxSize: {x: 8002, y: 4021}
vertical: 0 vertical: 0
controlID: 3440 controlID: 65
--- !u!114 &5 --- !u!114 &5
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 52 m_ObjectHideFlags: 52
@ -224,7 +224,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0} scrollPos: {x: 0, y: 0}
m_SelectedIDs: m_SelectedIDs:
m_LastClickedID: 0 m_LastClickedID: 0
m_ExpandedIDs: 4cfbffffbc420000 m_ExpandedIDs: 4cfbffff
m_RenameOverlay: m_RenameOverlay:
m_UserAcceptedRename: 0 m_UserAcceptedRename: 0
m_Name: m_Name:
@ -1028,7 +1028,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0} scrollPos: {x: 0, y: 0}
m_SelectedIDs: m_SelectedIDs:
m_LastClickedID: 0 m_LastClickedID: 0
m_ExpandedIDs: 00000000424e0000444e0000464e0000484e00004a4e00004c4e00004e4e0000504e0000524e0000544e0000564e0000584e000000ca9a3b m_ExpandedIDs: 00000000424e0000444e0000464e0000484e00004a4e00004c4e00004e4e0000504e0000524e0000544e0000564e0000584e0000
m_RenameOverlay: m_RenameOverlay:
m_UserAcceptedRename: 0 m_UserAcceptedRename: 0
m_Name: m_Name:
@ -1160,8 +1160,8 @@ MonoBehaviour:
y: 0 y: 0
width: 506 width: 506
height: 947 height: 947
m_MinSize: {x: 275, y: 50} m_MinSize: {x: 276, y: 71}
m_MaxSize: {x: 4000, y: 4000} m_MaxSize: {x: 4001, y: 4021}
m_ActualView: {fileID: 16} m_ActualView: {fileID: 16}
m_Panes: m_Panes:
- {fileID: 16} - {fileID: 16}

Binary file not shown.

View file

@ -130,129 +130,129 @@ ScriptsOnlyBuild:
- Class: 114 - Class: 114
Script: {instanceID: 11264} Script: {instanceID: 11264}
- Class: 114 - Class: 114
Script: {instanceID: 11272} Script: {instanceID: 11270}
- Class: 114 - Class: 114
Script: {instanceID: 11296} Script: {instanceID: 11294}
- Class: 114 - Class: 114
Script: {instanceID: 11454} Script: {instanceID: 11452}
- Class: 114 - Class: 114
Script: {instanceID: 11508} Script: {instanceID: 11506}
- Class: 114 - Class: 114
Script: {instanceID: 11584} Script: {instanceID: 11582}
- Class: 114 - Class: 114
Script: {instanceID: 11596} Script: {instanceID: 11594}
- Class: 114 - Class: 114
Script: {instanceID: 11610} Script: {instanceID: 11608}
- Class: 114 - Class: 114
Script: {instanceID: 11664} Script: {instanceID: 11662}
- Class: 114 - Class: 114
Script: {instanceID: 11738} Script: {instanceID: 11736}
- Class: 114 - Class: 114
Script: {instanceID: 11764} Script: {instanceID: 11762}
- Class: 114
Script: {instanceID: 11766}
- Class: 114 - Class: 114
Script: {instanceID: 11768} Script: {instanceID: 11768}
- Class: 114 - Class: 114
Script: {instanceID: 11770} Script: {instanceID: 11776}
- Class: 114 - Class: 114
Script: {instanceID: 11778} Script: {instanceID: 11786}
- Class: 114 - Class: 114
Script: {instanceID: 11788} Script: {instanceID: 11808}
- Class: 114 - Class: 114
Script: {instanceID: 11810} Script: {instanceID: 11872}
- Class: 114 - Class: 114
Script: {instanceID: 11874} Script: {instanceID: 11878}
- Class: 114 - Class: 114
Script: {instanceID: 11880} Script: {instanceID: 12146}
- Class: 114 - Class: 114
Script: {instanceID: 12148} Script: {instanceID: 12182}
- Class: 114 - Class: 114
Script: {instanceID: 12184} Script: {instanceID: 12326}
- Class: 114 - Class: 114
Script: {instanceID: 12328} Script: {instanceID: 12350}
- Class: 114 - Class: 114
Script: {instanceID: 12352} Script: {instanceID: 12366}
- Class: 114 - Class: 114
Script: {instanceID: 12368} Script: {instanceID: 12436}
- Class: 114 - Class: 114
Script: {instanceID: 12438} Script: {instanceID: 12616}
- Class: 114 - Class: 114
Script: {instanceID: 12618} Script: {instanceID: 12640}
- Class: 114 - Class: 114
Script: {instanceID: 12642} Script: {instanceID: 12758}
- Class: 114 - Class: 114
Script: {instanceID: 12760} Script: {instanceID: 12882}
- Class: 114 - Class: 114
Script: {instanceID: 12884} Script: {instanceID: 12926}
- Class: 114 - Class: 114
Script: {instanceID: 12928} Script: {instanceID: 13176}
- Class: 114 - Class: 114
Script: {instanceID: 13178} Script: {instanceID: 13202}
- Class: 114 - Class: 114
Script: {instanceID: 13204} Script: {instanceID: 13242}
- Class: 114 - Class: 114
Script: {instanceID: 13244} Script: {instanceID: 13252}
- Class: 114 - Class: 114
Script: {instanceID: 13254} Script: {instanceID: 13262}
- Class: 114 - Class: 114
Script: {instanceID: 13264} Script: {instanceID: 13272}
- Class: 114 - Class: 114
Script: {instanceID: 13274} Script: {instanceID: 13374}
- Class: 114 - Class: 114
Script: {instanceID: 13376} Script: {instanceID: 13392}
- Class: 114 - Class: 114
Script: {instanceID: 13394} Script: {instanceID: 13394}
- Class: 114 - Class: 114
Script: {instanceID: 13396} Script: {instanceID: 13428}
- Class: 114 - Class: 114
Script: {instanceID: 13430} Script: {instanceID: 13468}
- Class: 114 - Class: 114
Script: {instanceID: 13470} Script: {instanceID: 13484}
- Class: 114 - Class: 114
Script: {instanceID: 13486} Script: {instanceID: 13500}
- Class: 114 - Class: 114
Script: {instanceID: 13502} Script: {instanceID: 13512}
- Class: 114 - Class: 114
Script: {instanceID: 13514} Script: {instanceID: 13516}
- Class: 114 - Class: 114
Script: {instanceID: 13518} Script: {instanceID: 13552}
- Class: 114 - Class: 114
Script: {instanceID: 13554} Script: {instanceID: 13684}
- Class: 114 - Class: 114
Script: {instanceID: 13686} Script: {instanceID: 13710}
- Class: 114 - Class: 114
Script: {instanceID: 13712} Script: {instanceID: 13842}
- Class: 114 - Class: 114
Script: {instanceID: 13844} Script: {instanceID: 13916}
- Class: 114 - Class: 114
Script: {instanceID: 13918} Script: {instanceID: 13920}
- Class: 114 - Class: 114
Script: {instanceID: 13922} Script: {instanceID: 14048}
- Class: 114 - Class: 114
Script: {instanceID: 14050} Script: {instanceID: 14112}
- Class: 114 - Class: 114
Script: {instanceID: 14114} Script: {instanceID: 14208}
- Class: 114 - Class: 114
Script: {instanceID: 14210} Script: {instanceID: 14358}
- Class: 114 - Class: 114
Script: {instanceID: 14360} Script: {instanceID: 14506}
- Class: 114 - Class: 114
Script: {instanceID: 14508} Script: {instanceID: 14532}
- Class: 114 - Class: 114
Script: {instanceID: 14534} Script: {instanceID: 14534}
- Class: 114 - Class: 114
Script: {instanceID: 14536} Script: {instanceID: 14566}
- Class: 114 - Class: 114
Script: {instanceID: 14568} Script: {instanceID: 14588}
- Class: 114 - Class: 114
Script: {instanceID: 14590} Script: {instanceID: 14590}
- Class: 114 - Class: 114
Script: {instanceID: 14592} Script: {instanceID: 14630}
- Class: 114 - Class: 114
Script: {instanceID: 14632} Script: {instanceID: 14636}
- Class: 114 - Class: 114
Script: {instanceID: 14638} Script: {instanceID: 14678}
- Class: 114
Script: {instanceID: 14680}
- Class: 115 - Class: 115
Script: {instanceID: 0} Script: {instanceID: 0}
- Class: 128 - Class: 128

Binary file not shown.