From 04b7ccfd87d802e6b9a22b86c8d098979164b8ba Mon Sep 17 00:00:00 2001 From: Fox Caminiti Date: Mon, 15 Aug 2022 23:03:30 -0400 Subject: undo started --- createcalls.cpp | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) (limited to 'createcalls.cpp') diff --git a/createcalls.cpp b/createcalls.cpp index 633a37a..4564d59 100644 --- a/createcalls.cpp +++ b/createcalls.cpp @@ -8,31 +8,35 @@ IncrementFrame(project_data *File, int16 Amount) { } static bool32 -Source_Generate(project_data *File, memory *Memory, char *Path) +Source_Generate(project_data *File, memory *Memory, void *Path) { Assert(File->NumberOfSources < MAX_SOURCES); source *Source = &File->Source[File->NumberOfSources]; bool32 Found = 0; + /* + // TODO(fox): Unbreak stbi! int w, h; if (stbi_info(Path, &w, &h, NULL)) { - Source->Info.Width = w; - Source->Info.Height = h; Source->SourceType = source_type_image; Found = true; } + */ - if (!Found && AV_IsFileSupported(Path)) { + // TODO(fox): This cast won't work above STRING_MAX. + if (!Found && AV_IsFileSupported((char *)Path)) { Source->SourceType = source_type_video; Found = true; } if (Found) { - Source->Info.BytesPerPixel = 4; - Source->Path = Path; - File->NumberOfSources++; + Action_Change_Commit(Memory, &Source->Path, &Path, action_change_ptr); + uint32 i = File->NumberOfSources + 1; + Action_Change_Commit(Memory, &File->NumberOfSources, &i, action_change_u16); return 1; + } else { + // PostMsg(State, "File open fail..."); } return 0; @@ -133,7 +137,7 @@ project_layer * Layer_Init(project_data *File, memory *Memory) File->Layer[a] = (project_layer *)AllocateMemory(Memory, sizeof(project_layer), F_Layers); - File->Layer[a]->Name = (char *)AllocateMemory(Memory, 256, F_Strings); + File->Layer[a]->Name = (char *)AllocateMemory(Memory, STRING_SIZE, F_Strings); sprintf(File->Layer[a]->Name, "Layer %i", a); File->Layer[a]->x = InitFloatProperty("X Position", 0.0f, 1.0f); File->Layer[a]->y = InitFloatProperty("Y Position", 0.0f, 1.0f); @@ -386,14 +390,20 @@ Layer_ScreenSpaceToLocal(project_layer *Layer, ui *UI, comp_buffer CompBuffer, I static void LoadTestFootage(project_data *File, project_state *State, memory *Memory) { - if (!Source_Generate(File, Memory, "../asset/24.mp4")) - PostMsg(State, "File open fail..."); - source *Source = &File->Source[0]; + void *SourceString = String_GenerateFromChar(Memory, "../asset/24.mp4"); + Source_Generate(File, Memory, SourceString); Layer_CreateFromSource(File, State, Memory, Source); + Action_Undo(Memory); + Action_Undo(Memory); + Action_Redo(Memory); + Action_Redo(Memory); + Assert(0); + source *Source = &File->Source[0]; SelectLayer(File->Layer[0], State, 0); // AddEffect(File->Layer[0], Memory, 3); + /* mask *Mask = &File->Layer[0]->Mask[0]; File->Layer[0]->NumberOfMasks = 1; Mask->Point[0].Pos = V2(200, 200); @@ -421,11 +431,12 @@ LoadTestFootage(project_data *File, project_state *State, memory *Memory) Mask->Point[4].HandleBezier = true; Mask->NumberOfPoints = 5; + */ // if (!Source_Generate(File, Memory, "../asset/test.png")) // PostMsg(State, "File open fail..."); - if (!Source_Generate(File, Memory, "../asset/debug.png")) - PostMsg(State, "File open fail..."); + // if (!Source_Generate(File, Memory, "../asset/debug.png")) + // PostMsg(State, "File open fail..."); // property_channel *Property = &File->Layer[0]->x; // ManualKeyframeInsertF(Property, Memory, 1, 500); @@ -439,8 +450,8 @@ LoadTestFootage(project_data *File, project_state *State, memory *Memory) // Layer_CreateFromSource(File, State, Memory, Source); - if (!Source_Generate(File, Memory, "../asset/p.mp4")) - PostMsg(State, "File open fail..."); + // if (!Source_Generate(File, Memory, "../asset/p.mp4")) + // PostMsg(State, "File open fail..."); // source *Source2 = &File->Source[1]; // project_layer *Layer2 = Layer_Init(File, Memory); // AV_Init(Source2, &Layer2->BitmapInfo, Memory); -- cgit v1.2.3