From f00396bdfe73435862e18464d4d71146fe3da12f Mon Sep 17 00:00:00 2001 From: shweet Date: Thu, 25 Jun 2026 00:07:01 -0400 Subject: [PATCH] fixed issue with ctrl+click --- src/anm2/anm2.cpp | 17 +++++++------ src/imgui/window/timeline.cpp | 1 + .../wizard/change_all_frame_properties.cpp | 24 +++++++++++-------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/anm2/anm2.cpp b/src/anm2/anm2.cpp index 80adb5d..0835959 100644 --- a/src/anm2/anm2.cpp +++ b/src/anm2/anm2.cpp @@ -184,7 +184,7 @@ namespace anm2ed return math::uint8_to_float(value); } - int color_write(float value) { return math::float_to_uint8(glm::clamp(value, 0.0f, 1.0f)); } + int color_write(float value) { return math::float_to_uint8(value); } Interpolation interpolation_read(const XMLElement* element, const char* attribute) { @@ -1060,7 +1060,6 @@ namespace anm2ed const std::set& selection) { const auto clamp_identity = [](auto value) { return value; }; - const auto clamp01 = [](auto value) { return glm::clamp(value, 0.0f, 1.0f); }; const auto clamp_duration = [](int value) { return std::max(FRAME_DURATION_MIN, value); }; if (selection.empty()) return; @@ -1122,13 +1121,13 @@ namespace anm2ed apply_scalar(frame->position.y, change.positionY); apply_scalar(frame->scale.x, change.scaleX); apply_scalar(frame->scale.y, change.scaleY); - apply_scalar_with_clamp(frame->colorOffset.x, change.colorOffsetR, clamp01); - apply_scalar_with_clamp(frame->colorOffset.y, change.colorOffsetG, clamp01); - apply_scalar_with_clamp(frame->colorOffset.z, change.colorOffsetB, clamp01); - apply_scalar_with_clamp(frame->tint.x, change.tintR, clamp01); - apply_scalar_with_clamp(frame->tint.y, change.tintG, clamp01); - apply_scalar_with_clamp(frame->tint.z, change.tintB, clamp01); - apply_scalar_with_clamp(frame->tint.w, change.tintA, clamp01); + apply_scalar(frame->colorOffset.x, change.colorOffsetR); + apply_scalar(frame->colorOffset.y, change.colorOffsetG); + apply_scalar(frame->colorOffset.z, change.colorOffsetB); + apply_scalar(frame->tint.x, change.tintR); + apply_scalar(frame->tint.y, change.tintG); + apply_scalar(frame->tint.z, change.tintB); + apply_scalar(frame->tint.w, change.tintA); } } diff --git a/src/imgui/window/timeline.cpp b/src/imgui/window/timeline.cpp index 1c6cbdc..ec9a039 100644 --- a/src/imgui/window/timeline.cpp +++ b/src/imgui/window/timeline.cpp @@ -287,6 +287,7 @@ namespace anm2ed::imgui selection.insert(frameReference); targetDocument.items.references.insert(itemReference); } + targetDocument.reference = frameReference; targetDocument.frame_references_set(std::move(selection)); frames_selection_sync_for(targetDocument); }; diff --git a/src/imgui/wizard/change_all_frame_properties.cpp b/src/imgui/wizard/change_all_frame_properties.cpp index baf9c9a..abb3a30 100644 --- a/src/imgui/wizard/change_all_frame_properties.cpp +++ b/src/imgui/wizard/change_all_frame_properties.cpp @@ -148,17 +148,17 @@ namespace anm2ed::imgui::wizard ImGui::PushItemWidth(width); - PROPERTIES_WIDGET(ImGui::DragInt(valueRLabel, &valueAlt.r, DRAG_SPEED, 0, 255, "R:%d"), checkboxRLabel, + PROPERTIES_WIDGET(ImGui::DragInt(valueRLabel, &valueAlt.r, DRAG_SPEED, 0, 0, "R:%d"), checkboxRLabel, isREnabled); ImGui::SameLine(); - PROPERTIES_WIDGET(ImGui::DragInt(valueGLabel, &valueAlt.g, DRAG_SPEED, 0, 255, "G:%d"), checkboxGLabel, + PROPERTIES_WIDGET(ImGui::DragInt(valueGLabel, &valueAlt.g, DRAG_SPEED, 0, 0, "G:%d"), checkboxGLabel, isGEnabled); ImGui::SameLine(); - PROPERTIES_WIDGET(ImGui::DragInt(valueBLabel, &valueAlt.b, DRAG_SPEED, 0, 255, "B:%d"), checkboxBLabel, + PROPERTIES_WIDGET(ImGui::DragInt(valueBLabel, &valueAlt.b, DRAG_SPEED, 0, 0, "B:%d"), checkboxBLabel, isBEnabled); ImGui::PopItemWidth(); @@ -167,7 +167,9 @@ namespace anm2ed::imgui::wizard value = vec3(uint8_to_float(valueAlt.r), uint8_to_float(valueAlt.g), uint8_to_float(valueAlt.b)); - ImVec4 buttonColor = {isREnabled ? value.r : 0, isGEnabled ? value.g : 0, isBEnabled ? value.b : 0, 1}; + ImVec4 buttonColor = {isREnabled ? glm::clamp(value.r, 0.0f, 1.0f) : 0, + isGEnabled ? glm::clamp(value.g, 0.0f, 1.0f) : 0, + isBEnabled ? glm::clamp(value.b, 0.0f, 1.0f) : 0, 1}; ImGui::ColorButton(label, buttonColor); @@ -190,21 +192,21 @@ namespace anm2ed::imgui::wizard ImGui::PushItemWidth(width); - PROPERTIES_WIDGET(ImGui::DragInt(valueRLabel, &valueAlt.r, DRAG_SPEED, 0, 255, "R:%d"), checkboxRLabel, + PROPERTIES_WIDGET(ImGui::DragInt(valueRLabel, &valueAlt.r, DRAG_SPEED, 0, 0, "R:%d"), checkboxRLabel, isREnabled); ImGui::SameLine(); - PROPERTIES_WIDGET(ImGui::DragInt(valueGLabel, &valueAlt.g, DRAG_SPEED, 0, 255, "G:%d"), checkboxGLabel, + PROPERTIES_WIDGET(ImGui::DragInt(valueGLabel, &valueAlt.g, DRAG_SPEED, 0, 0, "G:%d"), checkboxGLabel, isGEnabled); ImGui::SameLine(); - PROPERTIES_WIDGET(ImGui::DragInt(valueBLabel, &valueAlt.b, DRAG_SPEED, 0, 255, "B:%d"), checkboxBLabel, + PROPERTIES_WIDGET(ImGui::DragInt(valueBLabel, &valueAlt.b, DRAG_SPEED, 0, 0, "B:%d"), checkboxBLabel, isBEnabled); ImGui::SameLine(); - PROPERTIES_WIDGET(ImGui::DragInt(valueALabel, &valueAlt.a, DRAG_SPEED, 0, 255, "A:%d"), checkboxALabel, + PROPERTIES_WIDGET(ImGui::DragInt(valueALabel, &valueAlt.a, DRAG_SPEED, 0, 0, "A:%d"), checkboxALabel, isAEnabled); ImGui::PopItemWidth(); @@ -214,8 +216,10 @@ namespace anm2ed::imgui::wizard value = vec4(uint8_to_float(valueAlt.r), uint8_to_float(valueAlt.g), uint8_to_float(valueAlt.b), uint8_to_float(valueAlt.a)); - ImVec4 buttonColor = {isREnabled ? value.r : 0, isGEnabled ? value.g : 0, isBEnabled ? value.b : 0, - isAEnabled ? value.a : 1}; + ImVec4 buttonColor = {isREnabled ? glm::clamp(value.r, 0.0f, 1.0f) : 0, + isGEnabled ? glm::clamp(value.g, 0.0f, 1.0f) : 0, + isBEnabled ? glm::clamp(value.b, 0.0f, 1.0f) : 0, + isAEnabled ? glm::clamp(value.a, 0.0f, 1.0f) : 1}; ImGui::ColorButton(label, buttonColor); ImGui::SameLine();