diff options
Diffstat (limited to 'src/imgui_ui_viewport.cpp')
-rw-r--r-- | src/imgui_ui_viewport.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/imgui_ui_viewport.cpp b/src/imgui_ui_viewport.cpp index ed26ce7..dc37225 100644 --- a/src/imgui_ui_viewport.cpp +++ b/src/imgui_ui_viewport.cpp @@ -676,7 +676,7 @@ ImGui_Viewport_TransformUI2(project_data *File, project_state *State, memory *Me Layer_DeselectAll(File, State, Memory, 1); State->Interact_Transform = {}; } - if (Selection != -1) + if (Selection > 0) Layer_Select(Memory, State, Selection); } State->Interact_Active = interact_type_none; @@ -1108,6 +1108,7 @@ ImGui_Viewport(project_data *File, project_state *State, ui *UI, memory *Memory, bool open = true; ImGui::Begin("Viewport", &open, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse); + DebugWatchVar("Count: ", &State->PreviousSelectionCount, d_int); if (ImGui::IsWindowHovered(ImGuiFocusedFlags_ChildWindows)) { State->FocusedWindow = focus_viewport; @@ -1144,16 +1145,8 @@ ImGui_Viewport(project_data *File, project_state *State, ui *UI, memory *Memory, // BGCOL = IM_COL32(0, 0, 0, 255); OUTLINE = IM_COL32(255,255,255, 255); } - draw_list->AddRectFilled(ViewportMin, ViewportMax, BGCOL); - draw_list->AddRect(ViewportMin, ViewportMax, IM_COL32(255,255,255, 255)); - - real32 FontSize = ImGui::GetFontSize(); - ImGui::SetCursorScreenPos(ImVec2(ViewportMax.x - FontSize*2, ViewportMin.y + ViewportScale.y - FontSize*3.0)); - ImGui::PushStyleColor(ImGuiCol_Button, IM_COL32(0, 0, 0, 80)); - if (ImGui::Button("?")) - State->ImGuiPopups = popup_keybinds; - ImGui::PopStyleColor(); + draw_list->AddRectFilled(ViewportMin, ViewportMax, BGCOL); // Actual composition texture draw_list->PushClipRect(ViewportMin, ViewportMax, true); @@ -1167,7 +1160,7 @@ ImGui_Viewport(project_data *File, project_state *State, ui *UI, memory *Memory, Arbitrary_Zero(Data, Memory->Slot[B_PointData].Size); gl_viewport_data *RenderData = (gl_viewport_data *)Data; Data += sizeof(gl_viewport_data); - *RenderData = { ImGui::GetMainViewport()->Size, + *RenderData = { ViewportMin, ViewportMax, ImGui::GetMainViewport()->Size, State->ViewportEnabled, Comp->Width, Comp->Height, Comp->BytesPerPixel, UI->CompPos, UI->CompZoom, UI->CompZoom.x / Comp->Width, {} }; layer_transforms ExtraT = {}; @@ -1180,6 +1173,15 @@ ImGui_Viewport(project_data *File, project_state *State, ui *UI, memory *Memory, } draw_list->PopClipRect(); + draw_list->AddRect(ViewportMin, ViewportMax, IM_COL32(255,255,255, 255)); + + real32 FontSize = ImGui::GetFontSize(); + ImGui::SetCursorScreenPos(ImVec2(ViewportMax.x - FontSize*2, ViewportMin.y + ViewportScale.y - FontSize*3.0)); + ImGui::PushStyleColor(ImGuiCol_Button, IM_COL32(0, 0, 0, 80)); + if (ImGui::Button("?")) + State->ImGuiPopups = popup_keybinds; + ImGui::PopStyleColor(); + // UI+interaction for layer if (State->MostRecentlySelectedLayer > -1) @@ -1275,7 +1277,7 @@ ImGui_Viewport(project_data *File, project_state *State, ui *UI, memory *Memory, v2 CompPoint = ImGui_ScreenPointToCompUV(ViewportMin, UI->CompPos, UI->CompZoom, io.MousePos) * V2(MainComp->Width, MainComp->Height); int32 Selection = LayerIterate_TestSelection(State, Memory, File->PrincipalCompIndex, T, CompPoint, SortedCompArray, SortedLayerArray, io.KeyShift); - if (!io.KeyShift && !State->InteractTransformMode && Selection != -1) { + if (!io.KeyShift && !State->InteractTransformMode && Selection > 0) { Layer_DeselectAll(File, State, Memory); Layer_Select(Memory, State, Selection); State->Interact_Active = interact_type_viewport_transform_gizmo; @@ -1323,10 +1325,10 @@ ImGui_Viewport(project_data *File, project_state *State, ui *UI, memory *Memory, SortedCompArray, SortedLayerArray, io.KeyShift); if (State->Tool == tool_default && State->Interact_Active == interact_type_none) { if (!io.KeyShift && State->Interact_Active == interact_type_none) { - Layer_DeselectAll(File, State, Memory); + Layer_DeselectAll(File, State, Memory, 0, 1); State->Interact_Transform = {}; } - if (Selection != -1) + if (Selection > 0) Layer_Select(Memory, State, Selection); } } |