summaryrefslogtreecommitdiff
path: root/layer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'layer.cpp')
-rw-r--r--layer.cpp26
1 files changed, 25 insertions, 1 deletions
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;
}