From 9062e0aae9f2f576b7a237c28028aa6b09feee5e Mon Sep 17 00:00:00 2001 From: Fox Caminiti Date: Wed, 17 Aug 2022 23:41:08 -0400 Subject: undo and pen development --- layer.cpp | 46 ++++------------------------------------------ 1 file changed, 4 insertions(+), 42 deletions(-) (limited to 'layer.cpp') diff --git a/layer.cpp b/layer.cpp index b289976..1730565 100644 --- a/layer.cpp +++ b/layer.cpp @@ -34,45 +34,6 @@ CompUVToLayerUV(project_layer *Layer, comp_buffer *CompBuffer, v2 CompUV) return V2(LayerU, LayerV); } -static void -CalculateAnchorOffset(project_layer *, real32, uint16); - -static void -InteractProperty(int16 a, project_data *File, project_state *State, bool32 Ended, real32 Value, memory *Memory) -{ - temp_layer_list List = FindSelectedLayerIndex(File, State->NumberOfSelectedLayers); - for (int i = 0; i < State->NumberOfSelectedLayers; i++) { - project_layer *Layer = File->Layer[List.LayerIndex[i]]; - // keyframe *Keyframe = InsertKeyframeAtFrame(&File->LayerPTR[State->SelectedLayerIndex[r]]->Property[Index], *State, File->CurrentFrame, Memory, Cache); - if (a == 2) { - CalculateAnchorOffset(Layer, Value, 0); - } else if (a == 3) { - CalculateAnchorOffset(Layer, Value, 1); - } else { - Layer->Property[a].CurrentValue.f += Value; - } - } - // Cache->Interact = Active; - // 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; - } - State->UpdateFrame = true; - // Cache->Frame[File->CurrentFrame].Cached = false; -} - static void TransformsInteract(project_data *File, project_state *State, memory *Memory, ui *UI, transforms_hotkey_interact Mode) { @@ -95,13 +56,14 @@ TransformsInteract(project_data *File, project_state *State, memory *Memory, ui } 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; + State->InteractCache[0] = Layer->x.CurrentValue.f; + State->InteractCache[1] = Layer->y.CurrentValue.f; + State->InteractCache[2] = Layer->ax.CurrentValue.f; + State->InteractCache[3] = Layer->ay.CurrentValue.f; } else if (Mode == sliding_rotation) { State->InteractCache[0] = Layer->rotation.CurrentValue.f; } else if (Mode == sliding_scale) { -- cgit v1.2.3