summaryrefslogtreecommitdiff
path: root/src/imgui_ui_timeline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/imgui_ui_timeline.cpp')
-rw-r--r--src/imgui_ui_timeline.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/imgui_ui_timeline.cpp b/src/imgui_ui_timeline.cpp
index 3a89641..42bb788 100644
--- a/src/imgui_ui_timeline.cpp
+++ b/src/imgui_ui_timeline.cpp
@@ -84,12 +84,15 @@ ImGui_Timeline_HorizontalIncrementDraw(project_state *State, ui *UI, ImDrawList
int32 NewCurrent = (int32)(State->Interact_Offset[0] + (DragDelta.x / TimelineZoomSize.x * MainComp.Frame_Count) + 0.5);
if (NewCurrent != State->Frame_Current) {
State->Frame_Current = NewCurrent;
+ State->UpdateKeyframes = true;
State->UpdateFrame = true;
}
}
if (IsItemDeactivated) {
State->Interact_Active = interact_type_none;
State->Interact_Modifier = 0;
+ State->UpdateKeyframes = true;
+ State->UpdateFrame = true;
}
}
@@ -417,7 +420,7 @@ ImGui_Timeline_DrawPrecomp(project_data *File, project_state *State, memory *Mem
ImGui::PushID(CompIndex);
- // NOTE(fox): Layer sorting pre-calculates UI positioning, so the order layers are drawn is arbitrary.
+ // NOTE(fox): Layer sorting pre-calculates UI positioning, so the order layers are drawn could be arbitrary.
real32 DisplayOffset = 0;
for (int i = SortedCompStart.LayerCount - 1; i >= 0; i--)
{
@@ -427,9 +430,7 @@ ImGui_Timeline_DrawPrecomp(project_data *File, project_state *State, memory *Mem
int32 Frame_Start = Layer->Frame_Start;
int32 Frame_End = Layer->Frame_End;
- real32 Vertical_Offset = SortEntry.SortedOffset + DisplayOffset;
-
- Layer_Evaluate_Display(State, Memory, Layer, SortedPropertyStart, SortedKeyframeArray, SortedLayerArray, SortedCompArray, SortedLayerStart, i, &DisplayOffset);
+ real32 Vertical_Offset = SortEntry.SortedOffset + SortEntry.DisplayOffset;
if (Layer->IsSelected)
Interact_Evaluate_Layer(Memory, State, Index_Physical, SortedCompStart, SortedLayerStart, &Frame_Start, &Frame_End);
@@ -661,7 +662,12 @@ ImGui_Timeline_DrawPrecomp(project_data *File, project_state *State, memory *Mem
}
if (ImGui::IsItemDeactivated()) {
- if (State->Interact_Active == interact_type_layer_move) {
+ if (ImGui::IsKeyPressed(ImGuiKey_Escape)) {
+ State->Interact_Active = interact_type_none;
+ State->Interact_Modifier = 0;
+ State->UpdateFrame = true;
+ Memory->PurgeCache = true;
+ } else if (State->Interact_Active == interact_type_layer_move) {
History_Entry_Commit(Memory, "Move layers");
for (int i = 0; i < SortedCompStart.LayerCount; i++)
{
@@ -695,10 +701,10 @@ ImGui_Timeline_DrawPrecomp(project_data *File, project_state *State, memory *Mem
{
if (Property->IsToggled) {
ImVec2 GraphMinPos = ImVec2(TimelineAbsolutePos.x, Layer_ScreenPos_Min.y + Layer_ScreenSize.y + (Layer_ScreenSize.y * Channel));
- ImVec2 GraphPos = GraphMinPos + ImVec2(0, Layer_ScreenSize.y);
- ImVec2 GraphMinBounds = GraphMinPos + ImVec2(0, Layer_ScreenSize.y * 0.5);
+ ImVec2 GraphPos = GraphMinPos + ImVec2(0, Layer_ScreenSize.y / 2);
+ ImVec2 GraphMinBounds = GraphMinPos;
ImVec2 GraphMaxBounds = GraphMinBounds + ImVec2(TimelineSizeWithBorder.x, Layer_ScreenSize.y);
- uint32 col = (Channel % 2) ? IM_COL32(50, 50, 50, 255) : IM_COL32(50, 50, 50, 128);
+ uint32 col = (Channel % 2) ? IM_COL32(50, 50, 50, 255) : IM_COL32(70, 70, 70, 255);
draw_list->AddRectFilled(GraphMinBounds, GraphMaxBounds, col);
ImGui_Timeline_DrawKeySheet(File, State, Memory, UI, io, draw_list, Property, ArrayLocation,
Increment, TimelineAbsolutePos, GraphPos, TimelineMoveSize, TimelineZoomSize,
@@ -719,12 +725,8 @@ ImGui_Timeline_DrawPrecomp(project_data *File, project_state *State, memory *Mem
sorted_comp_array Precomp_SortedCompStart = SortedCompArray[Layer->Block_Source_Index];
block_layer *Layer_Top = (block_layer *)Memory_Block_AddressAtIndex(Memory, F_Layers, Precomp_SortedLayerStart[Precomp_SortedCompStart.LayerCount - 1].Block_Layer_Index);
- block_layer *Layer_Bottom = (block_layer *)Memory_Block_AddressAtIndex(Memory, F_Layers, Precomp_SortedLayerStart[0].Block_Layer_Index);
real32 SmallestY = Layer_Top->Vertical_Offset;
- real32 LargestY = Layer_Bottom->Vertical_Offset;
- // Layer_Evaluate_Display(Layer_Top, SortedLayerArray, SortedCompArray, Precomp_SortedLayerStart, Precomp_SortedCompStart.LayerCount - 1, &SmallestY);
- // Layer_Evaluate_Display(Layer_Bottom, SortedLayerArray, SortedCompArray, Precomp_SortedLayerStart, 0, &LargestY);
- real32 PrecompHeight = LargestY - SmallestY + 2;
+ real32 PrecompHeight = Precomp_SortedCompStart.DisplaySize;
ImVec2 MinClipPos = ImVec2(Layer_ScreenPos_Min.x, Layer_ScreenPos_Max.y);
ImVec2 MaxClipPos = ImVec2(Layer_ScreenPos_Max.x, MinClipPos.y + (PrecompHeight * Increment.y * TimelineZoomSize.y));