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.cpp37
1 files changed, 31 insertions, 6 deletions
diff --git a/src/imgui_ui_timeline.cpp b/src/imgui_ui_timeline.cpp
index 29b2835..6c111f1 100644
--- a/src/imgui_ui_timeline.cpp
+++ b/src/imgui_ui_timeline.cpp
@@ -1,3 +1,4 @@
+#include "imgui.h"
#if SPECIAL
#include "main.h"
#endif
@@ -427,8 +428,11 @@ ImGui_Timeline_DrawPrecomp(project_data *File, project_state *State, memory *Mem
// 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--)
+ int LayerCount = SortedCompStart.LayerCount + SortedCompStart.FakeLayerCount;
+ for (int i = 0; i < LayerCount; i++)
{
+ if (i != 0)
+ int a = 0;
sorted_layer_array SortEntry = SortedLayerStart[i];
uint32 Index_Physical = SortEntry.Block_Layer_Index;
block_layer *Layer = (block_layer *)Memory_Block_AddressAtIndex(Memory, F_Layers, Index_Physical);
@@ -458,11 +462,13 @@ ImGui_Timeline_DrawPrecomp(project_data *File, project_state *State, memory *Mem
BorderColor = ImColor(0.2, 0.2, 0.2, 1.0f);
draw_list->AddRectFilled(Layer_ScreenPos_Min, Layer_ScreenPos_Max, LayerColor);
+ if (SortEntry.IsFake)
+ draw_list->AddRectFilled(Layer_ScreenPos_Min, Layer_ScreenPos_Max, IM_COL32(129, 50, 180, 90));
draw_list->AddRect(Layer_ScreenPos_Min, Layer_ScreenPos_Max, BorderColor, 2);
block_string *String = (block_string *)Memory_Block_AddressAtIndex(Memory, F_Strings, Layer->Block_String_Index);
char buf[128];
#if DEBUG
- sprintf(buf, "%s, %i", String->Char, Index_Physical);
+ sprintf(buf, "%s, (idx: %i so: %.1f di: %.1f", String->Char, Index_Physical, SortEntry.SortedOffset, SortEntry. DisplayOffset);
#else
sprintf(buf, "%s", String->Char);
#endif
@@ -499,7 +505,7 @@ ImGui_Timeline_DrawPrecomp(project_data *File, project_state *State, memory *Mem
Test &= (Layer_ScreenPos_Min.x <= io.MouseClickedPos[0].x && Layer_ScreenPos_Max.x >= io.MousePos.x);
if (Test) {
- if (!Layer->IsSelected) {
+ if (!Layer->IsSelected && !Layer->IsLocked) {
Layer_Select(Memory, State, Index_Physical);
}
} else if (!io.KeyShift) {
@@ -519,7 +525,7 @@ ImGui_Timeline_DrawPrecomp(project_data *File, project_state *State, memory *Mem
ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeEW);
}
if (ImGui::IsItemActivated()) {
- if (!Layer->IsSelected) {
+ if (!Layer->IsSelected && !Layer->IsLocked) {
if (!io.KeyShift) Layer_DeselectAll(File, State, Memory);
Layer_Select(Memory, State, Index_Physical);
}
@@ -563,7 +569,7 @@ ImGui_Timeline_DrawPrecomp(project_data *File, project_state *State, memory *Mem
ImGui::InvisibleButton("##layer_mid", Layer_ScreenSize, ImGuiMouseButton_Left);
if (ImGui::IsItemActivated()) {
- if (!Layer->IsSelected) {
+ if (!Layer->IsSelected && !Layer->IsLocked) {
if (!io.KeyShift) Layer_DeselectAll(File, State, Memory);
Layer_Select(Memory, State, Index_Physical);
Layer_Select_RecurseUp(Memory, State, Index_Physical, RecursionIdx, Recursions);
@@ -572,7 +578,7 @@ ImGui_Timeline_DrawPrecomp(project_data *File, project_state *State, memory *Mem
ImGui::OpenPopupOnItemClick("layerpopup", ImGuiPopupFlags_MouseButtonRight);
if (ImGui::BeginPopup("layerpopup")) {
- if (ImGui::Selectable("Visible")) {
+ if (ImGui::MenuItem("Visible", NULL, Layer->IsVisible)) {
bool32 Commit = false;
int h = 0, z = 0, i = 0;
while (Block_Loop(Memory, F_Layers, File->Layer_Count, &h, &z, &i)) {
@@ -591,6 +597,25 @@ ImGui_Timeline_DrawPrecomp(project_data *File, project_state *State, memory *Mem
State->UpdateFrame = true;
}
}
+ if (ImGui::MenuItem("Lock", NULL, Layer->IsLocked)) {
+ bool32 Commit = false;
+ int h = 0, z = 0, i = 0;
+ while (Block_Loop(Memory, F_Layers, File->Layer_Count, &h, &z, &i)) {
+ block_layer *Layer = (block_layer *)Memory_Block_AddressAtIndex(Memory, F_Layers, i);
+ if (Layer->IsSelected) {
+ if (!Commit) {
+ History_Entry_Commit(Memory, "Toggle lock");
+ Commit = true;
+ }
+ History_Action_Swap(Memory, F_Layers, sizeof(Layer->IsLocked), &Layer->IsLocked);
+ Layer->IsLocked ^= 1;
+ }
+ }
+ if (Commit) {
+ History_Entry_End(Memory);
+ State->UpdateFrame = true;
+ }
+ }
if (ImGui::MenuItem("Pre-compose layer")) {
Precomp_UICreateButton(File, State, Memory, CompIndex, SortedCompStart, SortedLayerStart);
State->UpdateKeyframes = true;