diff options
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/main.cpp b/src/main.cpp index 82f0153..3f8388e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,5 @@ #include "main.h" +#include "imgui_internal_widgets.h" SDL_Thread *Thread[8]; SDL_sem *Semaphore; @@ -98,8 +99,9 @@ Main_InputTest(project_data *File, project_state *State, memory *Memory, sorted_ ImGuiID DockID = ImGui::DockSpaceOverViewport(ImGui::GetMainViewport(), ImGuiDockNodeFlags_AutoHideTabBar); if (State->FirstFrame) { - ImGui::MyWindowSetup(DockID); - } + ImGui::MyWindowSetup(&State->RightDock, DockID); + } + ImGui::MyDockWindow("Timeline", State->RightDock); if (State->Warp_WantSetPos) { ImGui_WarpMouseFinish(State, io.MousePos); @@ -413,12 +415,16 @@ Render_UI(project_data *File, project_state *State, memory *Memory, ui *UI, ImDr Frame_End_Abs > Frame_Current && Layer->IsVisible) { shape_layer *Shape = &Layer->Shape; + shape_options ShapeOpt = Layer->ShapeOpt; void *Data = StartAddress; layer_transforms T = Layer_GetTransforms(Layer); if (State->Interact_Active == interact_type_viewport_transform && Layer->IsSelected == 1) { Transform_ApplyInteractive(*(interact_transform *)&State->Interact_Offset[0], &T.x, &T.y, &T.rotation, &T.scale); } + if (State->Interact_Active == interact_type_viewport_transform_gizmo && Layer->IsSelected == 1) { + Transform_ApplyInteractive(*(interact_transform *)&State->Interact_Offset[0], &T.x, &T.y, &T.rotation, &T.scale); + } if (State->Interact_Active == interact_type_viewport_slide && Layer->IsSelected == 1) { // Transform_ApplySlide((v2 *)&State->Interact_Offset[0], &T); } @@ -429,11 +435,11 @@ Render_UI(project_data *File, project_state *State, memory *Memory, ui *UI, ImDr } v2 Min = {}, Max = {}; - uint32 NumberOfVerts = NVG_FlattenPath(Memory, Shape, (nvg_point *)Data, + uint32 NumberOfVerts = NVG_FlattenPath(Memory, Shape, ShapeOpt, (nvg_point *)Data, State, T, Shape->Width, Shape->Height, Comp->Width, Comp->Height, 1, &Min, &Max); StartAddress += NumberOfVerts * sizeof(nvg_point); void *Data_Stroke = StartAddress; - uint32 StrokeCount = NVG_ExpandStroke(Memory, NumberOfVerts, Shape->Opt.StrokeWidth, Shape->Opt.LineCapType, Shape->Opt.LineJoinType, Shape->IsClosed, (nvg_point *)Data, (real32 *)Data_Stroke); + uint32 StrokeCount = NVG_ExpandStroke(Memory, NumberOfVerts, ShapeOpt.StrokeWidth, ShapeOpt.LineCapType, ShapeOpt.LineJoinType, Shape->IsClosed, (nvg_point *)Data, (real32 *)Data_Stroke); StartAddress += StrokeCount * sizeof(real32) * 4; void *Data_Fill = StartAddress; NVG_ExpandFill(Memory, NumberOfVerts, (nvg_point *)Data, (real32 *)Data_Fill); @@ -447,9 +453,9 @@ Render_UI(project_data *File, project_state *State, memory *Memory, ui *UI, ImDr RenderData->LayerCount++; StartAddress += sizeof(gl_data); - int Visibility = (Shape->Opt.StrokeWidth > 0.0f) ? Shape->Opt.Visibility : 1; - *GL_Data = { Data_Stroke, StrokeCount, Shape->Opt.StrokeCol, - Data_Fill, NumberOfVerts, Shape->Opt.FillCol, + int Visibility = (ShapeOpt.StrokeWidth > 0.0f) ? ShapeOpt.Visibility : 1; + *GL_Data = { Data_Stroke, StrokeCount, ShapeOpt.StrokeCol, + Data_Fill, NumberOfVerts, ShapeOpt.FillCol, T, Shape->Width, Shape->Height, Visibility }; } } @@ -724,7 +730,6 @@ int main(int argc, char *argv[]) { Memory_InitTable(&GlobalMemory, &Memory, 1 * 1024 * 1024, P_AVInfo, "FFmpeg state", sizeof(av_info)); Memory_InitTable(&GlobalMemory, &Memory, 1 * 1024 * 1024, P_UndoBuffer, "Undo buffer"); - Memory_InitTable(&GlobalMemory, &Memory, 40 * 1024 * 1024, P_MiscCache, "Misc persistent"); Memory_InitTable(&GlobalMemory, &Memory, sizeof(project_data), F_File, "File", sizeof(project_data)); Memory_InitTable(&GlobalMemory, &Memory, 1 * 1024 * 1024, F_Precomps, "Precomps", sizeof(block_composition)); @@ -739,7 +744,6 @@ int main(int argc, char *argv[]) { Memory_InitTable(&GlobalMemory, &Memory, (uint64)5 * 1024 * 1024, B_Thumbnails, "Thumbnails"); Memory_InitTable(&GlobalMemory, &Memory, (uint64)5 * 1024 * 1024, B_PointData, "Point data"); Memory_InitTable(&GlobalMemory, &Memory, (uint64)128 * 1024 * 1024, B_ScratchSpace, "Scratch"); - // Memory_InitTable(&GlobalMemory, &Memory, (uint64)1 * 1024 * 1024, B_CacheEntries, "Cache entries", sizeof(cache_entry)); Memory_InitTable(&GlobalMemory, &Memory, (uint64)700 * 1024 * 1024, B_CachedBitmaps, "Cached bitmap buffer"); uint8 *Test = (uint8 *)Memory.Slot[B_ScratchSpace].Address + Memory.Slot[B_ScratchSpace].Size + 2; @@ -791,7 +795,7 @@ int main(int argc, char *argv[]) { block_composition *MainComp = (block_composition *)Memory_Block_AllocateAddress(&Memory, F_Precomps); MainComp->Width = 1280; - MainComp->Height = 720; + MainComp->Height = 1280; MainComp->FPS = 60; MainComp->BytesPerPixel = 4; MainComp->Frame_Count = 80; @@ -1157,6 +1161,8 @@ int main(int argc, char *argv[]) { File_Sort_Pop(&Memory, Sorted.Layer_SortSize, Sorted.Property_SortSize, Sorted.Source_SortSize); + // NOTE(fox): We could theoretically allow scratch to persist between + // frames, but we'd have to make sure the pop order stays the same in all scenarios. Assert(Debug.ScratchState == 0); if (State->IsPlaying && State->HotFramePerf > 1 && FullyCached) { |