From e89dc91182a94e48ca9220a2fe075db680ddff04 Mon Sep 17 00:00:00 2001 From: Fox Caminiti Date: Tue, 16 Aug 2022 15:06:45 -0400 Subject: undo functional --- layer.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'layer.cpp') diff --git a/layer.cpp b/layer.cpp index 8983076..b289976 100644 --- a/layer.cpp +++ b/layer.cpp @@ -56,6 +56,16 @@ InteractProperty(int16 a, project_data *File, project_state *State, bool32 Ended // Cache->InteractIndex = State->SelectedLayerIndex[0]; if (Ended) { + project_layer *Layer = File->Layer[State->MostRecentlySelectedLayer]; + // We can't end for pos/anchor point until we commit both channels. Should think of something better. + if ((a == 1) || (a == 3)) { + Action_Change_Commit(Memory, &Layer->Property[a].CurrentValue.f, &State->InteractCache[1], &Layer->Property[a].CurrentValue.f, action_change_r32); + } else { + Action_Change_Commit(Memory, &Layer->Property[a].CurrentValue.f, &State->InteractCache[0], &Layer->Property[a].CurrentValue.f, action_change_r32); + } + if (!(a == 0) && !(a == 2)) { + Action_Entry_End(Memory); + } State->IsInteracting = false; // Cache->Interact = Clear; } @@ -64,7 +74,7 @@ InteractProperty(int16 a, project_data *File, project_state *State, bool32 Ended } static void -TransformsInteract(project_data *File, project_state *State, ui *UI, transforms_hotkey_interact Mode) +TransformsInteract(project_data *File, project_state *State, memory *Memory, ui *UI, transforms_hotkey_interact Mode) { if (UI->FocusedWindow == focus_timeline) { temp_layer_list List = FindSelectedLayerIndex(File, State->NumberOfSelectedLayers); @@ -83,6 +93,20 @@ TransformsInteract(project_data *File, project_state *State, ui *UI, transforms_ } } } else if (UI->FocusedWindow == focus_viewport) { + // TODO(fox): Make multi-select possible! + project_layer *Layer = File->Layer[State->MostRecentlySelectedLayer]; + Action_Entry_Begin(Memory, action_entry_default, "Tranforms interact"); + if (Mode == sliding_position) { + State->InteractCache[0] = Layer->x.CurrentValue.f; + State->InteractCache[1] = Layer->y.CurrentValue.f; + } else if (Mode == sliding_anchorpoint) { + State->InteractCache[0] = Layer->ax.CurrentValue.f; + State->InteractCache[1] = Layer->ay.CurrentValue.f; + } else if (Mode == sliding_rotation) { + State->InteractCache[0] = Layer->rotation.CurrentValue.f; + } else if (Mode == sliding_scale) { + State->InteractCache[0] = Layer->scale.CurrentValue.f; + } State->IsInteracting = true; State->TransformsHotkeyInteract = Mode; } -- cgit v1.2.3