Frame properties: one field table for change-all, shared widgets
- FRAME_CHANGE_SCALARS generates FrameChange fields, the frames_change apply step and change-all population - Change-all draws component rows from tables instead of five widget lambdas and 46 aliases - Frame properties uses one edit path (edit::COMPLETE), a vec2 field table and an X/Y flip loop - Shared INTERPOLATION_LABELS and Document::layer_regions_get Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
30ea363c39
commit
a4638a422d
9 files changed
+421
-744
No files matched your search
@@ -17,6 +17,33 @@ using namespace glm;
|
||||
|
||||
namespace anm2ed::imgui
|
||||
{
|
||||
struct Vec2Field
|
||||
{
|
||||
StringType label;
|
||||
StringType tooltip;
|
||||
StringType edit;
|
||||
vec2 Element::* member;
|
||||
bool isRegionField;
|
||||
};
|
||||
|
||||
constexpr Vec2Field VEC2_FIELDS[] = {
|
||||
{BASIC_CROP, TOOLTIP_CROP, EDIT_FRAME_CROP, &Element::crop, true},
|
||||
{BASIC_SIZE, TOOLTIP_SIZE, EDIT_FRAME_SIZE, &Element::size, true},
|
||||
{BASIC_POSITION, TOOLTIP_POSITION, EDIT_FRAME_POSITION, &Element::position, false},
|
||||
{BASIC_PIVOT, TOOLTIP_PIVOT, EDIT_FRAME_PIVOT, &Element::pivot, true},
|
||||
{BASIC_SCALE, TOOLTIP_SCALE, EDIT_FRAME_SCALE, &Element::scale, false},
|
||||
{BASIC_SHEAR, TOOLTIP_SHEAR, EDIT_FRAME_SHEAR, &Element::shear, false}};
|
||||
|
||||
struct FlipButton
|
||||
{
|
||||
StringType label;
|
||||
StringType edit;
|
||||
StringType tooltip;
|
||||
};
|
||||
|
||||
constexpr FlipButton FLIP_BUTTONS[] = {{LABEL_FLIP_X, EDIT_FRAME_FLIP_X, TOOLTIP_FLIP_X},
|
||||
{LABEL_FLIP_Y, EDIT_FRAME_FLIP_Y, TOOLTIP_FLIP_Y}};
|
||||
|
||||
void FrameProperties::update(Manager& manager, Settings& settings)
|
||||
{
|
||||
auto& document = *manager.get();
|
||||
@@ -37,72 +64,31 @@ namespace anm2ed::imgui
|
||||
auto& type = reference.itemType;
|
||||
auto frame = reference.frameIndex >= 0 ? anm2.element_get(reference) : nullptr;
|
||||
|
||||
auto frame_edit = [&](auto message, auto behavior)
|
||||
{
|
||||
auto queuedReference = reference;
|
||||
manager.command_push({manager.selected, [=](Manager&, Document& document) mutable
|
||||
{
|
||||
if (queuedReference.frameIndex < 0) return;
|
||||
auto frame = document.anm2.element_get(queuedReference);
|
||||
auto itemReference = queuedReference;
|
||||
itemReference.frameIndex = -1;
|
||||
auto item = document.anm2.element_get(itemReference);
|
||||
if (!frame) return;
|
||||
|
||||
document.snapshots.frames_push(localize.get(message), {queuedReference});
|
||||
behavior(document, *frame, item, queuedReference);
|
||||
document.change(Document::FRAMES);
|
||||
}});
|
||||
};
|
||||
|
||||
auto persistent_edit = [&](auto state, auto message, auto behavior)
|
||||
auto frame_edit = [&](edit::Type state, StringType message, auto behavior)
|
||||
{
|
||||
if (state == edit::NONE) return;
|
||||
|
||||
auto queuedReference = reference;
|
||||
manager.command_push({manager.selected, [=](Manager&, Document& document) mutable
|
||||
{
|
||||
if (queuedReference.frameIndex < 0) return;
|
||||
auto frame = document.anm2.element_get(queuedReference);
|
||||
auto itemReference = queuedReference;
|
||||
itemReference.frameIndex = -1;
|
||||
auto item = document.anm2.element_get(itemReference);
|
||||
if (!frame) return;
|
||||
|
||||
if (state == edit::START)
|
||||
document.snapshots.frames_push(localize.get(message), {queuedReference});
|
||||
behavior(document, *frame, item, queuedReference);
|
||||
if (state == edit::END) document.change(Document::FRAMES);
|
||||
}});
|
||||
manager.command_push(
|
||||
{manager.selected, [=, queuedReference = reference](Manager&, Document& document) mutable
|
||||
{
|
||||
auto frame = queuedReference.frameIndex < 0 ? nullptr : document.anm2.element_get(queuedReference);
|
||||
if (!frame) return;
|
||||
auto item = document.anm2.element_get(Reference{queuedReference.animationIndex, queuedReference.itemType,
|
||||
queuedReference.itemID, -1, queuedReference.groupType,
|
||||
queuedReference.groupId});
|
||||
if (state == edit::START || state == edit::COMPLETE)
|
||||
document.snapshots.frames_push(localize.get(message), {queuedReference});
|
||||
behavior(document, *frame, item, queuedReference);
|
||||
if (state == edit::END || state == edit::COMPLETE) document.change(Document::FRAMES);
|
||||
}});
|
||||
};
|
||||
|
||||
auto regionLabelsString = std::vector<std::string>{localize.get(BASIC_NONE)};
|
||||
auto regionLabels = std::vector<const char*>{regionLabelsString[0].c_str()};
|
||||
auto regionIds = std::vector<int>{-1};
|
||||
auto interpolationLabelsString =
|
||||
std::vector<std::string>{localize.get(BASIC_NONE), localize.get(BASIC_LINEAR), localize.get(BASIC_EASE_IN),
|
||||
localize.get(BASIC_EASE_OUT), localize.get(BASIC_EASE_IN_OUT)};
|
||||
auto interpolationLabels =
|
||||
std::vector<const char*>{interpolationLabelsString[0].c_str(), interpolationLabelsString[1].c_str(),
|
||||
interpolationLabelsString[2].c_str(), interpolationLabelsString[3].c_str(),
|
||||
interpolationLabelsString[4].c_str()};
|
||||
auto interpolationValues =
|
||||
std::vector<int>{(int)Interpolation::NONE, (int)Interpolation::LINEAR, (int)Interpolation::EASE_IN,
|
||||
(int)Interpolation::EASE_OUT, (int)Interpolation::EASE_IN_OUT};
|
||||
|
||||
if (type == LAYER && reference.itemID != -1)
|
||||
{
|
||||
if (auto layer = anm2.element_get(ElementType::LAYER_ELEMENT, reference.itemID))
|
||||
{
|
||||
auto regionIt = document.regionBySpritesheet.find(layer->spritesheetId);
|
||||
if (regionIt != document.regionBySpritesheet.end() && !regionIt->second.ids.empty() &&
|
||||
!regionIt->second.labels.empty())
|
||||
{
|
||||
regionLabels = regionIt->second.labels;
|
||||
regionIds = regionIt->second.ids;
|
||||
}
|
||||
}
|
||||
}
|
||||
auto regions = document.layer_regions_get(type == LAYER ? reference.itemID : -1);
|
||||
auto noneLabel = std::string(localize.get(BASIC_NONE));
|
||||
auto regionLabels = regions ? regions->labels : std::vector<const char*>{noneLabel.c_str()};
|
||||
auto regionIds = regions ? regions->ids : std::vector<int>{-1};
|
||||
std::vector<const char*> interpolationLabels{};
|
||||
for (auto label : INTERPOLATION_LABELS)
|
||||
interpolationLabels.push_back(localize.get(label));
|
||||
|
||||
auto mode_selector_draw = [&]()
|
||||
{
|
||||
@@ -136,7 +122,7 @@ namespace anm2ed::imgui
|
||||
frame)
|
||||
{
|
||||
auto eventId = useFrame.eventId;
|
||||
frame_edit(EDIT_TRIGGER_EVENT,
|
||||
frame_edit(edit::COMPLETE, EDIT_TRIGGER_EVENT,
|
||||
[eventId](Document&, Element& frame, Element*, const Reference&) { frame.eventId = eventId; });
|
||||
}
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_TRIGGER_EVENT));
|
||||
@@ -147,7 +133,7 @@ namespace anm2ed::imgui
|
||||
frame)
|
||||
{
|
||||
auto atFrame = useFrame.atFrame;
|
||||
frame_edit(EDIT_TRIGGER_AT_FRAME,
|
||||
frame_edit(edit::COMPLETE, EDIT_TRIGGER_AT_FRAME,
|
||||
[atFrame](Document& document, Element& frame, Element* item, const Reference&)
|
||||
{
|
||||
frame.atFrame = atFrame;
|
||||
@@ -163,7 +149,8 @@ namespace anm2ed::imgui
|
||||
frame)
|
||||
{
|
||||
auto isVisible = useFrame.isVisible;
|
||||
frame_edit(EDIT_TRIGGER_VISIBILITY, [isVisible](Document&, Element& frame, Element*, const Reference&)
|
||||
frame_edit(edit::COMPLETE, EDIT_TRIGGER_VISIBILITY,
|
||||
[isVisible](Document&, Element& frame, Element*, const Reference&)
|
||||
{ frame.isVisible = isVisible; });
|
||||
}
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_TRIGGER_VISIBILITY));
|
||||
@@ -185,7 +172,7 @@ namespace anm2ed::imgui
|
||||
{
|
||||
auto soundIndex = (std::size_t)i;
|
||||
auto soundId = id;
|
||||
frame_edit(EDIT_TRIGGER_SOUND,
|
||||
frame_edit(edit::COMPLETE, EDIT_TRIGGER_SOUND,
|
||||
[soundIndex, soundId](Document&, Element& frame, Element*, const Reference&)
|
||||
{
|
||||
if (soundIndex < frame.soundIds.size()) frame.soundIds[soundIndex] = soundId;
|
||||
@@ -201,7 +188,7 @@ namespace anm2ed::imgui
|
||||
auto widgetSize = imgui::widget_size_with_row_get(2);
|
||||
|
||||
if (ImGui::Button(localize.get(BASIC_ADD), widgetSize) && frame)
|
||||
frame_edit(EDIT_ADD_TRIGGER_SOUND,
|
||||
frame_edit(edit::COMPLETE, EDIT_ADD_TRIGGER_SOUND,
|
||||
[](Document&, Element& frame, Element*, const Reference&) { frame.soundIds.push_back(-1); });
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ADD_TRIGGER_SOUND));
|
||||
|
||||
@@ -209,7 +196,7 @@ namespace anm2ed::imgui
|
||||
|
||||
ImGui::BeginDisabled(useFrame.soundIds.empty());
|
||||
if (ImGui::Button(localize.get(BASIC_REMOVE), widgetSize) && frame)
|
||||
frame_edit(EDIT_REMOVE_TRIGGER_SOUND,
|
||||
frame_edit(edit::COMPLETE, EDIT_REMOVE_TRIGGER_SOUND,
|
||||
[](Document&, Element& frame, Element*, const Reference&)
|
||||
{
|
||||
if (!frame.soundIds.empty()) frame.soundIds.pop_back();
|
||||
@@ -221,71 +208,27 @@ namespace anm2ed::imgui
|
||||
{
|
||||
bool isRegionSet = frame && displayFrame.regionId != -1 && displayFrame.crop == frame->crop &&
|
||||
displayFrame.size == frame->size && displayFrame.pivot == frame->pivot;
|
||||
ImGui::BeginDisabled(type == ROOT || type == NULL_ || isRegionSet);
|
||||
for (auto& field : VEC2_FIELDS)
|
||||
{
|
||||
auto cropDisplay = frame ? displayFrame.crop : vec2();
|
||||
auto cropEdit =
|
||||
drag_float2_persistent(localize.get(BASIC_CROP), frame ? &cropDisplay : &dummy_value<vec2>(),
|
||||
DRAG_SPEED, 0.0f, 0.0f, frame ? vec2_format_get(displayFrame.crop) : "");
|
||||
persistent_edit(cropEdit, EDIT_FRAME_CROP,
|
||||
[cropDisplay](Document&, Element& frame, Element*, const Reference&)
|
||||
{ frame.crop = cropDisplay; });
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CROP));
|
||||
|
||||
auto sizeDisplay = frame ? displayFrame.size : vec2();
|
||||
auto sizeEdit =
|
||||
drag_float2_persistent(localize.get(BASIC_SIZE), frame ? &sizeDisplay : &dummy_value<vec2>(),
|
||||
DRAG_SPEED, 0.0f, 0.0f, frame ? vec2_format_get(displayFrame.size) : "");
|
||||
persistent_edit(sizeEdit, EDIT_FRAME_SIZE,
|
||||
[sizeDisplay](Document&, Element& frame, Element*, const Reference&)
|
||||
{ frame.size = sizeDisplay; });
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SIZE));
|
||||
const auto& source = field.isRegionField ? displayFrame : useFrame;
|
||||
auto value = frame ? source.*field.member : vec2();
|
||||
ImGui::BeginDisabled(field.isRegionField && (type == ROOT || type == NULL_ || isRegionSet));
|
||||
auto state =
|
||||
drag_float2_persistent(localize.get(field.label), frame ? &value : &dummy_value<vec2>(), DRAG_SPEED,
|
||||
0.0f, 0.0f, frame ? vec2_format_get(source.*field.member) : "");
|
||||
frame_edit(state, field.edit,
|
||||
[value, member = field.member](Document&, Element& frame, Element*, const Reference&)
|
||||
{ frame.*member = value; });
|
||||
ImGui::SetItemTooltip("%s", localize.get(field.tooltip));
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
|
||||
auto positionEdit =
|
||||
drag_float2_persistent(localize.get(BASIC_POSITION), frame ? &useFrame.position : &dummy_value<vec2>(),
|
||||
DRAG_SPEED, 0.0f, 0.0f, frame ? vec2_format_get(frame->position) : "");
|
||||
persistent_edit(positionEdit, EDIT_FRAME_POSITION,
|
||||
[position = useFrame.position](Document&, Element& frame, Element*, const Reference&)
|
||||
{ frame.position = position; });
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_POSITION));
|
||||
|
||||
ImGui::BeginDisabled(type == ROOT || type == NULL_ || isRegionSet);
|
||||
{
|
||||
auto pivotDisplay = frame ? displayFrame.pivot : vec2();
|
||||
auto pivotEdit =
|
||||
drag_float2_persistent(localize.get(BASIC_PIVOT), frame ? &pivotDisplay : &dummy_value<vec2>(),
|
||||
DRAG_SPEED, 0.0f, 0.0f, frame ? vec2_format_get(displayFrame.pivot) : "");
|
||||
persistent_edit(pivotEdit, EDIT_FRAME_PIVOT,
|
||||
[pivotDisplay](Document&, Element& frame, Element*, const Reference&)
|
||||
{ frame.pivot = pivotDisplay; });
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_PIVOT));
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
|
||||
auto scaleEdit =
|
||||
drag_float2_persistent(localize.get(BASIC_SCALE), frame ? &useFrame.scale : &dummy_value<vec2>(),
|
||||
DRAG_SPEED, 0.0f, 0.0f, frame ? vec2_format_get(frame->scale) : "");
|
||||
persistent_edit(scaleEdit, EDIT_FRAME_SCALE,
|
||||
[scale = useFrame.scale](Document&, Element& frame, Element*, const Reference&)
|
||||
{ frame.scale = scale; });
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SCALE));
|
||||
|
||||
auto shearEdit =
|
||||
drag_float2_persistent(localize.get(BASIC_SHEAR), frame ? &useFrame.shear : &dummy_value<vec2>(),
|
||||
DRAG_SPEED, 0.0f, 0.0f, frame ? vec2_format_get(frame->shear) : "");
|
||||
persistent_edit(shearEdit, EDIT_FRAME_SHEAR,
|
||||
[shear = useFrame.shear](Document&, Element& frame, Element*, const Reference&)
|
||||
{ frame.shear = shear; });
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SHEAR));
|
||||
|
||||
auto rotationEdit =
|
||||
drag_float_persistent(localize.get(BASIC_ROTATION), frame ? &useFrame.rotation : &dummy_value<float>(),
|
||||
DRAG_SPEED, 0.0f, 0.0f, frame ? float_format_get(frame->rotation) : "");
|
||||
persistent_edit(rotationEdit, EDIT_FRAME_ROTATION,
|
||||
[rotation = useFrame.rotation](Document&, Element& frame, Element*, const Reference&)
|
||||
{ frame.rotation = rotation; });
|
||||
frame_edit(rotationEdit, EDIT_FRAME_ROTATION,
|
||||
[rotation = useFrame.rotation](Document&, Element& frame, Element*, const Reference&)
|
||||
{ frame.rotation = rotation; });
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ROTATION));
|
||||
|
||||
if (input_int_range(localize.get(BASIC_DURATION), frame ? useFrame.duration : dummy_value<int>(),
|
||||
@@ -294,23 +237,24 @@ namespace anm2ed::imgui
|
||||
frame)
|
||||
{
|
||||
auto duration = useFrame.duration;
|
||||
frame_edit(EDIT_FRAME_DURATION, [duration](Document&, Element& frame, Element*, const Reference&)
|
||||
frame_edit(edit::COMPLETE, EDIT_FRAME_DURATION,
|
||||
[duration](Document&, Element& frame, Element*, const Reference&)
|
||||
{ frame.duration = duration; });
|
||||
}
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_DURATION));
|
||||
|
||||
auto tintEdit =
|
||||
color_edit4_persistent(localize.get(BASIC_TINT), frame ? &useFrame.tint : &dummy_value<vec4>());
|
||||
persistent_edit(tintEdit, EDIT_FRAME_TINT,
|
||||
[tint = useFrame.tint](Document&, Element& frame, Element*, const Reference&)
|
||||
{ frame.tint = tint; });
|
||||
frame_edit(tintEdit, EDIT_FRAME_TINT,
|
||||
[tint = useFrame.tint](Document&, Element& frame, Element*, const Reference&)
|
||||
{ frame.tint = tint; });
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_TINT));
|
||||
|
||||
auto colorOffsetEdit = color_edit3_persistent(localize.get(BASIC_COLOR_OFFSET),
|
||||
frame ? &useFrame.colorOffset : &dummy_value<vec3>());
|
||||
persistent_edit(colorOffsetEdit, EDIT_FRAME_COLOR_OFFSET,
|
||||
[colorOffset = useFrame.colorOffset](Document&, Element& frame, Element*, const Reference&)
|
||||
{ frame.colorOffset = colorOffset; });
|
||||
frame_edit(colorOffsetEdit, EDIT_FRAME_COLOR_OFFSET,
|
||||
[colorOffset = useFrame.colorOffset](Document&, Element& frame, Element*, const Reference&)
|
||||
{ frame.colorOffset = colorOffset; });
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_COLOR_OFFSET));
|
||||
|
||||
ImGui::BeginDisabled(type != LAYER);
|
||||
@@ -319,7 +263,7 @@ namespace anm2ed::imgui
|
||||
frame)
|
||||
{
|
||||
auto regionId = useFrame.regionId;
|
||||
frame_edit(EDIT_SET_REGION_PROPERTIES,
|
||||
frame_edit(edit::COMPLETE, EDIT_SET_REGION_PROPERTIES,
|
||||
[regionId](Document& document, Element& frame, Element*, const Reference& reference)
|
||||
{
|
||||
frame.regionId = regionId;
|
||||
@@ -333,10 +277,10 @@ namespace anm2ed::imgui
|
||||
ImGui::EndDisabled();
|
||||
|
||||
auto interpolationValue = frame ? static_cast<int>(useFrame.interpolation) : dummy_value<int>();
|
||||
if (combo_id_mapped(localize.get(BASIC_INTERPOLATED), &interpolationValue, interpolationValues,
|
||||
interpolationLabels) &&
|
||||
if (ImGui::Combo(localize.get(BASIC_INTERPOLATED), &interpolationValue, interpolationLabels.data(),
|
||||
(int)interpolationLabels.size()) &&
|
||||
frame)
|
||||
frame_edit(EDIT_FRAME_INTERPOLATION,
|
||||
frame_edit(edit::COMPLETE, EDIT_FRAME_INTERPOLATION,
|
||||
[interpolationValue](Document&, Element& frame, Element*, const Reference&)
|
||||
{ frame.interpolation = static_cast<Interpolation>(interpolationValue); });
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_FRAME_INTERPOLATION));
|
||||
@@ -347,7 +291,8 @@ namespace anm2ed::imgui
|
||||
frame)
|
||||
{
|
||||
auto shaderId = useFrame.shaderId;
|
||||
frame_edit(EDIT_FRAME_SHADER, [shaderId](Document&, Element& frame, Element*, const Reference&)
|
||||
frame_edit(edit::COMPLETE, EDIT_FRAME_SHADER,
|
||||
[shaderId](Document&, Element& frame, Element*, const Reference&)
|
||||
{ frame.shaderId = shaderId; });
|
||||
}
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_FRAME_SHADER));
|
||||
@@ -357,42 +302,27 @@ namespace anm2ed::imgui
|
||||
frame)
|
||||
{
|
||||
auto isVisible = useFrame.isVisible;
|
||||
frame_edit(EDIT_FRAME_VISIBILITY, [isVisible](Document&, Element& frame, Element*, const Reference&)
|
||||
frame_edit(edit::COMPLETE, EDIT_FRAME_VISIBILITY,
|
||||
[isVisible](Document&, Element& frame, Element*, const Reference&)
|
||||
{ frame.isVisible = isVisible; });
|
||||
}
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_FRAME_VISIBILITY));
|
||||
|
||||
auto widgetSize = widget_size_with_row_get(2);
|
||||
|
||||
if (ImGui::Button(localize.get(LABEL_FLIP_X), widgetSize) && frame)
|
||||
for (int axis = 0; axis < (int)std::size(FLIP_BUTTONS); ++axis)
|
||||
{
|
||||
if (ImGui::IsKeyDown(ImGuiMod_Ctrl))
|
||||
frame_edit(EDIT_FRAME_FLIP_X,
|
||||
[](Document&, Element& frame, Element*, const Reference&)
|
||||
if (axis > 0) ImGui::SameLine();
|
||||
if (ImGui::Button(localize.get(FLIP_BUTTONS[axis].label), widgetSize) && frame)
|
||||
frame_edit(edit::COMPLETE, FLIP_BUTTONS[axis].edit,
|
||||
[axis, isPositionFlipped = ImGui::IsKeyDown(ImGuiMod_Ctrl)](Document&, Element& frame,
|
||||
Element*, const Reference&)
|
||||
{
|
||||
frame.scale.x = -frame.scale.x;
|
||||
frame.position.x = -frame.position.x;
|
||||
frame.scale[axis] = -frame.scale[axis];
|
||||
if (isPositionFlipped) frame.position[axis] = -frame.position[axis];
|
||||
});
|
||||
else
|
||||
frame_edit(EDIT_FRAME_FLIP_X, [](Document&, Element& frame, Element*, const Reference&)
|
||||
{ frame.scale.x = -frame.scale.x; });
|
||||
ImGui::SetItemTooltip("%s", localize.get(FLIP_BUTTONS[axis].tooltip));
|
||||
}
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_FLIP_X));
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button(localize.get(LABEL_FLIP_Y), widgetSize) && frame)
|
||||
{
|
||||
if (ImGui::IsKeyDown(ImGuiMod_Ctrl))
|
||||
frame_edit(EDIT_FRAME_FLIP_Y,
|
||||
[](Document&, Element& frame, Element*, const Reference&)
|
||||
{
|
||||
frame.scale.y = -frame.scale.y;
|
||||
frame.position.y = -frame.position.y;
|
||||
});
|
||||
else
|
||||
frame_edit(EDIT_FRAME_FLIP_Y, [](Document&, Element& frame, Element*, const Reference&)
|
||||
{ frame.scale.y = -frame.scale.y; });
|
||||
}
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_FLIP_Y));
|
||||
|
||||
ImGui::Separator();
|
||||
ImGui::Dummy(ImVec2(0.0f, ImGui::GetFrameHeight()));
|
||||
|
||||
Reference in new issue
Block a user