summaryrefslogtreecommitdiff
path: root/src/imgui_ui_viewport.cpp
diff options
context:
space:
mode:
authorFox Caminiti <fox@foxcam.net>2023-02-17 17:20:18 -0500
committerFox Caminiti <fox@foxcam.net>2023-02-17 17:20:18 -0500
commit02870398a99fab6351182fba407d7d733affa5a1 (patch)
treefb5f4744f46e9d7816072e4d01547034bca04bb2 /src/imgui_ui_viewport.cpp
parentfffb3474ee0321d73a47db01dbc4b6b19670ddc5 (diff)
blend mode rendering halfway implemented
Diffstat (limited to 'src/imgui_ui_viewport.cpp')
-rw-r--r--src/imgui_ui_viewport.cpp47
1 files changed, 46 insertions, 1 deletions
diff --git a/src/imgui_ui_viewport.cpp b/src/imgui_ui_viewport.cpp
index 4b6f6ce..b2830de 100644
--- a/src/imgui_ui_viewport.cpp
+++ b/src/imgui_ui_viewport.cpp
@@ -744,6 +744,20 @@ ImGui_Viewport_SelectedLayerUI(project_state *State, memory *Memory, ui *UI, ImG
Height = Source->Height;
}
+ if (State->Interact_Active == interact_type_viewport_slide) {
+ real32 Threshold = 10;
+ v2 CompUV = V2(State->Interact_Offset[0], State->Interact_Offset[1]);
+ v2 CompPos = CompUV * V2(Comp->Width, Comp->Height);
+ v2 LayerPos = V2(Layer->x.CurrentValue, Layer->y.CurrentValue);
+ v2 Difference = V2(fabs(CompPos.x - LayerPos.x), fabs(CompPos.y - LayerPos.y));
+ printf("Diff: %.1f, %.1f\n", Difference.x, Difference.y);
+ if (Difference.x < Threshold &&
+ Difference.y < Threshold)
+ {
+ Assert(0);
+ }
+ }
+
layer_transforms T = Layer_GetTransforms(Layer);
if ((State->Interact_Active == interact_type_viewport_transform ||
State->Interact_Active == interact_type_viewport_transform_gizmo) && Layer->IsSelected & 0x01) {
@@ -892,6 +906,8 @@ ImGui_Viewport(project_data *File, project_state *State, ui *UI, memory *Memory,
Render_UI(File, State, Memory, UI, draw_list, Data, RenderData,
SortedCompArray, SortedLayerArray, ExtraT,
SortedPropertyStart, SortedKeyframeArray, File->PrincipalCompIndex, State->Frame_Current);
+ State->UpdateFrame = false;
+ State->UpdateKeyframes = false;
draw_list->AddCallback(GL_Test, (void *)StartAddress);
draw_list->AddCallback(ImDrawCallback_ResetRenderState, NULL);
draw_list->AddRect(CompPosMin, CompPosMax, OUTLINE);
@@ -1107,6 +1123,36 @@ ImGui_Viewport(project_data *File, project_state *State, ui *UI, memory *Memory,
if (IsActive)
int a = 0;
+ if (State->Tool == tool_default && State->Interact_Active == interact_type_none && !io.MouseDelta.x && !io.MouseDelta.y) {
+ ImGui::OpenPopupOnItemClick("defaultcontext", ImGuiPopupFlags_MouseButtonRight);
+ if (ImGui::BeginPopup("defaultcontext")) {
+ ImGui::Text("Insert keyframe...");
+ if (ImGui::Button("X/Y")) {
+ Property_AddKeyframe_AllSelected(File, State, Memory, F_Layers, SortedLayerArray, SortedCompArray, SortedKeyframeArray, 0, State->Frame_Current);
+ Property_AddKeyframe_AllSelected(File, State, Memory, F_Layers, SortedLayerArray, SortedCompArray, SortedKeyframeArray, 1, State->Frame_Current);
+ ImGui::CloseCurrentPopup();
+ }
+ ImGui::SameLine();
+ if (ImGui::Button("Rotation")) {
+ Property_AddKeyframe_AllSelected(File, State, Memory, F_Layers, SortedLayerArray, SortedCompArray, SortedKeyframeArray, 4, State->Frame_Current);
+ ImGui::CloseCurrentPopup();
+ }
+ if (ImGui::Button("Scale")) {
+ Property_AddKeyframe_AllSelected(File, State, Memory, F_Layers, SortedLayerArray, SortedCompArray, SortedKeyframeArray, 5, State->Frame_Current);
+ ImGui::CloseCurrentPopup();
+ }
+ ImGui::SameLine();
+ if (ImGui::Button("X/Y+R+S")) {
+ Property_AddKeyframe_AllSelected(File, State, Memory, F_Layers, SortedLayerArray, SortedCompArray, SortedKeyframeArray, 0, State->Frame_Current);
+ Property_AddKeyframe_AllSelected(File, State, Memory, F_Layers, SortedLayerArray, SortedCompArray, SortedKeyframeArray, 1, State->Frame_Current);
+ Property_AddKeyframe_AllSelected(File, State, Memory, F_Layers, SortedLayerArray, SortedCompArray, SortedKeyframeArray, 4, State->Frame_Current);
+ Property_AddKeyframe_AllSelected(File, State, Memory, F_Layers, SortedLayerArray, SortedCompArray, SortedKeyframeArray, 5, State->Frame_Current);
+ ImGui::CloseCurrentPopup();
+ }
+ ImGui::EndPopup();
+ }
+ }
+
if (State->Tool == tool_pen && State->Interact_Active == interact_type_none && State->MostRecentlySelectedLayer == -1) {
v2 CompUV = State->LastClickedPoint;
ImVec2 ScreenPoint = ImVec2(UI->CompPos.x + CompUV.x * UI->CompZoom.x,
@@ -1160,7 +1206,6 @@ ImGui_Viewport(project_data *File, project_state *State, ui *UI, memory *Memory,
State->Interact_Offset[1] = MouseCompPos.y;
State->Interact_Offset[3] = PrevMouseCompPos.x;
State->Interact_Offset[4] = PrevMouseCompPos.y;
- Slide_Test(File, State, Memory, SortedCompArray, SortedLayerArray);
}
}