mirror of https://github.com/aseprite/aseprite.git
Compare commits
5 Commits
bf7e8058fe
...
5c2113566c
Author | SHA1 | Date |
---|---|---|
|
5c2113566c | |
|
2ba051b59b | |
|
3fcb000eb1 | |
|
0f32b43475 | |
|
a811dd320a |
Binary file not shown.
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
@ -256,12 +256,12 @@
|
|||
<part id="pal_presets" x="160" y="200" w="5" h="5" />
|
||||
<part id="pal_options" x="168" y="200" w="5" h="5" />
|
||||
<part id="pal_resize" x="176" y="200" w="5" h="5" />
|
||||
<part id="debug_continue" x="208" y="240" w="7" h="7" />
|
||||
<part id="debug_pause" x="208" y="247" w="7" h="7" />
|
||||
<part id="debug_step_into" x="222" y="240" w="7" h="7" />
|
||||
<part id="debug_step_over" x="215" y="240" w="7" h="7" />
|
||||
<part id="debug_step_out" x="229" y="240" w="7" h="7" />
|
||||
<part id="debug_breakpoint" x="236" y="240" w="7" h="7" />
|
||||
<part id="debug_continue" x="224" y="240" w="7" h="7" />
|
||||
<part id="debug_pause" x="224" y="247" w="7" h="7" />
|
||||
<part id="debug_step_into" x="238" y="240" w="7" h="7" />
|
||||
<part id="debug_step_over" x="231" y="240" w="7" h="7" />
|
||||
<part id="debug_step_out" x="245" y="240" w="7" h="7" />
|
||||
<part id="debug_breakpoint" x="252" y="240" w="7" h="7" />
|
||||
<part id="selection_replace" x="176" y="160" w="7" h="7" />
|
||||
<part id="selection_add" x="184" y="160" w="7" h="7" />
|
||||
<part id="selection_subtract" x="192" y="160" w="7" h="7" />
|
||||
|
@ -456,6 +456,7 @@
|
|||
<part id="spin_down" x="128" y="259" w="5" h="3" />
|
||||
<part id="right_diagonal_symmetry" x="176" y="240" w="13" h="13" />
|
||||
<part id="left_diagonal_symmetry" x="192" y="240" w="13" h="13" />
|
||||
<part id="point_symmetry" x="208" y="240" w="13" h="13" />
|
||||
</parts>
|
||||
<styles>
|
||||
<style id="box" />
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
@ -252,12 +252,12 @@
|
|||
<part id="pal_presets" x="160" y="200" w="5" h="5" />
|
||||
<part id="pal_options" x="168" y="200" w="5" h="5" />
|
||||
<part id="pal_resize" x="176" y="200" w="5" h="5" />
|
||||
<part id="debug_continue" x="208" y="240" w="7" h="7" />
|
||||
<part id="debug_pause" x="208" y="247" w="7" h="7" />
|
||||
<part id="debug_step_into" x="222" y="240" w="7" h="7" />
|
||||
<part id="debug_step_over" x="215" y="240" w="7" h="7" />
|
||||
<part id="debug_step_out" x="229" y="240" w="7" h="7" />
|
||||
<part id="debug_breakpoint" x="236" y="240" w="7" h="7" />
|
||||
<part id="debug_continue" x="224" y="240" w="7" h="7" />
|
||||
<part id="debug_pause" x="224" y="247" w="7" h="7" />
|
||||
<part id="debug_step_into" x="238" y="240" w="7" h="7" />
|
||||
<part id="debug_step_over" x="231" y="240" w="7" h="7" />
|
||||
<part id="debug_step_out" x="245" y="240" w="7" h="7" />
|
||||
<part id="debug_breakpoint" x="252" y="240" w="7" h="7" />
|
||||
<part id="selection_replace" x="176" y="160" w="7" h="7" />
|
||||
<part id="selection_add" x="184" y="160" w="7" h="7" />
|
||||
<part id="selection_subtract" x="192" y="160" w="7" h="7" />
|
||||
|
@ -452,6 +452,7 @@
|
|||
<part id="spin_down" x="128" y="259" w="5" h="3" />
|
||||
<part id="right_diagonal_symmetry" x="176" y="240" w="13" h="13" />
|
||||
<part id="left_diagonal_symmetry" x="192" y="240" w="13" h="13" />
|
||||
<part id="point_symmetry" x="208" y="240" w="13" h="13" />
|
||||
</parts>
|
||||
<styles>
|
||||
<style id="box" />
|
||||
|
|
|
@ -554,6 +554,9 @@
|
|||
<key command="SymmetryMode">
|
||||
<param name="orientation" value="left_diagonal" />
|
||||
</key>
|
||||
<key command="SymmetryMode">
|
||||
<param name="orientation" value="point" />
|
||||
</key>
|
||||
<key command="AutocropSprite" />
|
||||
<key command="AutocropSprite">
|
||||
<param name="byGrid" value="true" />
|
||||
|
|
|
@ -97,6 +97,7 @@
|
|||
<value id="RIGHT_DIAG" value="4" />
|
||||
<value id="LEFT_DIAG" value="8" />
|
||||
<value id="BOTH_DIAG" value="12" />
|
||||
<value id="POINT" value="16" />
|
||||
<value id="ALL" value="15" />
|
||||
</enum>
|
||||
<enum id="PaintingCursorType">
|
||||
|
|
|
@ -1944,6 +1944,7 @@ toggle_horizontal = Toggle Horizontal Symmetry
|
|||
toggle_vertical = Toggle Vertical Symmetry
|
||||
toggle_right_diagonal = Toggle 45° Symmetry
|
||||
toggle_left_diagonal = Toggle -45° Symmetry
|
||||
toggle_point = Toggle Point Symmetry
|
||||
show_options = Symmetry Options
|
||||
reset_position = Reset Symmetry to Center
|
||||
reset_position_to_view_center = Reset Symmetry to View Center
|
||||
|
|
|
@ -48,6 +48,7 @@ std::string SymmetryModeCommand::onGetFriendlyName() const
|
|||
case app::gen::SymmetryMode::VERTICAL: return Strings::symmetry_toggle_vertical();
|
||||
case app::gen::SymmetryMode::RIGHT_DIAG: return Strings::symmetry_toggle_right_diagonal();
|
||||
case app::gen::SymmetryMode::LEFT_DIAG: return Strings::symmetry_toggle_left_diagonal();
|
||||
case app::gen::SymmetryMode::POINT: return Strings::symmetry_toggle_point();
|
||||
default: return Strings::symmetry_toggle();
|
||||
}
|
||||
}
|
||||
|
@ -63,6 +64,8 @@ void SymmetryModeCommand::onLoadParams(const Params& params)
|
|||
m_mode = app::gen::SymmetryMode::RIGHT_DIAG;
|
||||
else if (mode == "left_diagonal")
|
||||
m_mode = app::gen::SymmetryMode::LEFT_DIAG;
|
||||
else if (mode == "point")
|
||||
m_mode = app::gen::SymmetryMode::POINT;
|
||||
else
|
||||
m_mode = app::gen::SymmetryMode::NONE;
|
||||
}
|
||||
|
|
|
@ -73,6 +73,15 @@ void Symmetry::generateStrokes(const Stroke& stroke, Strokes& strokes, ToolLoop*
|
|||
break;
|
||||
}
|
||||
|
||||
case gen::SymmetryMode::POINT: {
|
||||
Stroke strokeTemp;
|
||||
calculateSymmetricalStroke(stroke, strokeTemp, loop, doc::SymmetryIndex::FLIPPED_Y);
|
||||
|
||||
calculateSymmetricalStroke(strokeTemp, stroke2, loop, doc::SymmetryIndex::FLIPPED_XY);
|
||||
strokes.push_back(stroke2);
|
||||
break;
|
||||
}
|
||||
|
||||
case gen::SymmetryMode::ALL: {
|
||||
calculateSymmetricalStroke(stroke, stroke2, loop, doc::SymmetryIndex::FLIPPED_X);
|
||||
strokes.push_back(stroke2);
|
||||
|
@ -175,8 +184,13 @@ gen::SymmetryMode Symmetry::resolveMode(gen::SymmetryMode mode)
|
|||
{
|
||||
return (((int(mode) & int(gen::SymmetryMode::HORIZONTAL)) ||
|
||||
(int(mode) & int(gen::SymmetryMode::VERTICAL))) &&
|
||||
((int(mode) & int(gen::SymmetryMode::RIGHT_DIAG)) ||
|
||||
(int(mode) & int(gen::SymmetryMode::LEFT_DIAG)))) ?
|
||||
((int(mode) & int(gen::SymmetryMode::RIGHT_DIAG)) ||
|
||||
(int(mode) & int(gen::SymmetryMode::LEFT_DIAG)))) ||
|
||||
((int(mode) & int(gen::SymmetryMode::POINT)) &&
|
||||
((int(mode) & int(gen::SymmetryMode::RIGHT_DIAG)) ||
|
||||
(int(mode) & int(gen::SymmetryMode::LEFT_DIAG)) ||
|
||||
(int(mode) & int(gen::SymmetryMode::HORIZONTAL)) ||
|
||||
(int(mode) & int(gen::SymmetryMode::VERTICAL)))) ?
|
||||
gen::SymmetryMode::ALL :
|
||||
mode;
|
||||
}
|
||||
|
|
|
@ -1502,7 +1502,7 @@ protected:
|
|||
|
||||
class ContextBar::SymmetryField : public ButtonSet {
|
||||
public:
|
||||
SymmetryField() : ButtonSet(5)
|
||||
SymmetryField() : ButtonSet(6)
|
||||
{
|
||||
setMultiMode(MultiMode::Set);
|
||||
auto theme = SkinTheme::get(this);
|
||||
|
@ -1510,6 +1510,7 @@ public:
|
|||
addItem(theme->parts.verticalSymmetry(), theme->styles.symmetryField());
|
||||
addItem(theme->parts.rightDiagonalSymmetry(), theme->styles.symmetryField());
|
||||
addItem(theme->parts.leftDiagonalSymmetry(), theme->styles.symmetryField());
|
||||
addItem(theme->parts.pointSymmetry(), theme->styles.symmetryField());
|
||||
addItem("...", theme->styles.symmetryOptions());
|
||||
}
|
||||
|
||||
|
@ -1519,7 +1520,8 @@ public:
|
|||
tooltipManager->addTooltipFor(at(1), Strings::symmetry_toggle_vertical(), BOTTOM);
|
||||
tooltipManager->addTooltipFor(at(2), Strings::symmetry_toggle_right_diagonal(), BOTTOM);
|
||||
tooltipManager->addTooltipFor(at(3), Strings::symmetry_toggle_left_diagonal(), BOTTOM);
|
||||
tooltipManager->addTooltipFor(at(4), Strings::symmetry_show_options(), BOTTOM);
|
||||
tooltipManager->addTooltipFor(at(4), Strings::symmetry_toggle_point(), BOTTOM);
|
||||
tooltipManager->addTooltipFor(at(5), Strings::symmetry_show_options(), BOTTOM);
|
||||
}
|
||||
|
||||
void updateWithCurrentDocument()
|
||||
|
@ -1534,6 +1536,7 @@ public:
|
|||
at(1)->setSelected(int(docPref.symmetry.mode()) & int(app::gen::SymmetryMode::VERTICAL));
|
||||
at(2)->setSelected(int(docPref.symmetry.mode()) & int(app::gen::SymmetryMode::RIGHT_DIAG));
|
||||
at(3)->setSelected(int(docPref.symmetry.mode()) & int(app::gen::SymmetryMode::LEFT_DIAG));
|
||||
at(4)->setSelected(int(docPref.symmetry.mode()) & int(app::gen::SymmetryMode::POINT));
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -1556,14 +1559,16 @@ private:
|
|||
mode |= int(app::gen::SymmetryMode::RIGHT_DIAG);
|
||||
if (at(3)->isSelected())
|
||||
mode |= int(app::gen::SymmetryMode::LEFT_DIAG);
|
||||
if (at(4)->isSelected())
|
||||
mode |= int(app::gen::SymmetryMode::POINT);
|
||||
|
||||
if (app::gen::SymmetryMode(mode) != docPref.symmetry.mode()) {
|
||||
docPref.symmetry.mode(app::gen::SymmetryMode(mode));
|
||||
// Redraw symmetry rules
|
||||
doc->notifyGeneralUpdate();
|
||||
}
|
||||
else if (at(4)->isSelected()) {
|
||||
auto* item = at(4);
|
||||
else if (at(5)->isSelected()) {
|
||||
auto* item = at(5);
|
||||
|
||||
gfx::Rect bounds = item->bounds();
|
||||
item->setSelected(false);
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
#include "app/util/tile_flags_utils.h"
|
||||
#include "base/chrono.h"
|
||||
#include "base/convert_to.h"
|
||||
#include "base/scoped_value.h"
|
||||
#include "doc/doc.h"
|
||||
#include "doc/mask_boundaries.h"
|
||||
#include "doc/slice.h"
|
||||
|
@ -266,6 +267,23 @@ void Editor::setStateInternal(const EditorStatePtr& newState)
|
|||
{
|
||||
m_brushPreview.hide();
|
||||
|
||||
// Some onLeaveState impls (like the ones from MovingPixelsState,
|
||||
// WritingTextState, MovingSelectionState) might generate a
|
||||
// Tx/Transaction::commit(), which will add a new undo state,
|
||||
// triggering a sprite change scripting event
|
||||
// (SpriteEvents::onAddUndoState). This event could be handled by an
|
||||
// extension and that extension might want to save the current
|
||||
// sprite (e.g. calling Sprite_saveCopyAs, the kind of extension
|
||||
// that takes snapshots after each sprite change). That will be a
|
||||
// new Context::executeCommand() for the save command, generating a
|
||||
// BeforeCommandExecution signal, getting back to onLeaveState
|
||||
// again. In that case, we just ignore the reentry as the first
|
||||
// onLeaveState should handle everything (to avoid an stack
|
||||
// overflow/infinite recursion).
|
||||
if (m_leavingState)
|
||||
return;
|
||||
base::ScopedValue leaving(m_leavingState, true);
|
||||
|
||||
// Fire before change state event, set the state, and fire after
|
||||
// change state event.
|
||||
EditorState::LeaveAction leaveAction = m_state->onLeaveState(this, newState.get());
|
||||
|
@ -916,6 +934,19 @@ void Editor::drawOneSpriteUnclippedRect(ui::Graphics* g,
|
|||
topLeft,
|
||||
bottomRight);
|
||||
}
|
||||
if (mode & int(app::gen::SymmetryMode::POINT)) {
|
||||
int smallestDimension = std::min(enclosingRect.w, enclosingRect.h);
|
||||
g->drawHLine(
|
||||
symmetryButtons & int(app::gen::SymmetryMode::POINT) ? color : semiTransparentColor,
|
||||
enclosingRect.x + x - smallestDimension * 0.10f,
|
||||
enclosingRect.y + y,
|
||||
smallestDimension * 0.10f * 2.0f);
|
||||
g->drawVLine(
|
||||
(symmetryButtons & int(app::gen::SymmetryMode::POINT)) ? color : semiTransparentColor,
|
||||
enclosingRect.x + x,
|
||||
enclosingRect.y + y - smallestDimension * 0.10f,
|
||||
smallestDimension * 0.10f * 2.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Aseprite
|
||||
// Copyright (C) 2018-2024 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2025 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
|
@ -458,6 +458,13 @@ private:
|
|||
|
||||
DocView* m_docView;
|
||||
|
||||
// Special flag to avoid re-entering a new state when we are leaving
|
||||
// the current one. This avoids an infinite onLeaveState() recursion
|
||||
// in some special cases when an extension (third-party code)
|
||||
// creates a new sprite change in the same sprite change scripting
|
||||
// event.
|
||||
bool m_leavingState = false;
|
||||
|
||||
// Last known mouse position received by this editor when the
|
||||
// mouse button was pressed. Used for auto-scrolling. To get the
|
||||
// current mouse position on the editor you can use
|
||||
|
|
|
@ -428,8 +428,8 @@ bool MovingSliceState::onMouseMove(Editor* editor, MouseMessage* msg)
|
|||
if (editor->slicesTransforms())
|
||||
drawExtraCel();
|
||||
|
||||
// Redraw the editor.
|
||||
editor->invalidate();
|
||||
// Notify changes
|
||||
m_site.document()->notifyGeneralUpdate();
|
||||
|
||||
// Use StandbyState implementation
|
||||
return StandbyState::onMouseMove(editor, msg);
|
||||
|
|
|
@ -1030,7 +1030,8 @@ bool StandbyState::Decorator::getSymmetryHandles(Editor* editor, Handles& handle
|
|||
|
||||
if ((int(mode) & int(app::gen::SymmetryMode::HORIZONTAL)) ||
|
||||
(int(mode) & int(app::gen::SymmetryMode::RIGHT_DIAG)) ||
|
||||
(int(mode) & int(app::gen::SymmetryMode::LEFT_DIAG))) {
|
||||
(int(mode) & int(app::gen::SymmetryMode::LEFT_DIAG)) ||
|
||||
(int(mode) & int(app::gen::SymmetryMode::POINT))) {
|
||||
double pos = symmetry.xAxis();
|
||||
gfx::PointF pt1, pt2;
|
||||
|
||||
|
@ -1051,7 +1052,8 @@ bool StandbyState::Decorator::getSymmetryHandles(Editor* editor, Handles& handle
|
|||
|
||||
if ((int(mode) & int(app::gen::SymmetryMode::VERTICAL)) ||
|
||||
(int(mode) & int(app::gen::SymmetryMode::RIGHT_DIAG)) ||
|
||||
(int(mode) & int(app::gen::SymmetryMode::LEFT_DIAG))) {
|
||||
(int(mode) & int(app::gen::SymmetryMode::LEFT_DIAG)) ||
|
||||
(int(mode) & int(app::gen::SymmetryMode::POINT))) {
|
||||
double pos = symmetry.yAxis();
|
||||
gfx::PointF pt1, pt2;
|
||||
|
||||
|
|
Loading…
Reference in New Issue