mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-25 03:02:31 +00:00
Reset tool preferences just once when running from CLI
This commit is contained in:
parent
351900b4e7
commit
a122f1ceba
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2020 Igara Studio S.A.
|
// Copyright (C) 2018-2021 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -183,6 +183,10 @@ DocumentPreferences& Preferences::document(const Doc* doc)
|
|||||||
|
|
||||||
void Preferences::resetToolPreferences(tools::Tool* tool)
|
void Preferences::resetToolPreferences(tools::Tool* tool)
|
||||||
{
|
{
|
||||||
|
if (tool->prefAlreadyResetFromScript())
|
||||||
|
return;
|
||||||
|
tool->markPrefAlreadyResetFromScript();
|
||||||
|
|
||||||
auto it = m_tools.find(tool->getId());
|
auto it = m_tools.find(tool->getId());
|
||||||
if (it != m_tools.end())
|
if (it != m_tools.end())
|
||||||
m_tools.erase(it);
|
m_tools.erase(it);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2021 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -61,6 +62,9 @@ namespace app {
|
|||||||
void setIntertwine(int button, Intertwine* intertwine) { m_button[button].m_intertwine = intertwine; }
|
void setIntertwine(int button, Intertwine* intertwine) { m_button[button].m_intertwine = intertwine; }
|
||||||
void setTracePolicy(int button, TracePolicy trace_policy) { m_button[button].m_trace_policy = trace_policy; }
|
void setTracePolicy(int button, TracePolicy trace_policy) { m_button[button].m_trace_policy = trace_policy; }
|
||||||
|
|
||||||
|
bool prefAlreadyResetFromScript() const { return m_prefAlreadyResetFromScript; }
|
||||||
|
void markPrefAlreadyResetFromScript() { m_prefAlreadyResetFromScript = true; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ToolGroup* m_group;
|
ToolGroup* m_group;
|
||||||
std::string m_id;
|
std::string m_id;
|
||||||
@ -68,6 +72,13 @@ namespace app {
|
|||||||
std::string m_tips;
|
std::string m_tips;
|
||||||
int m_default_brush_size;
|
int m_default_brush_size;
|
||||||
|
|
||||||
|
// Flag used to indicate that the preferences of this tool were
|
||||||
|
// already reset from scripts when they are executed in CLI mode
|
||||||
|
// (without GUI). This is needed to reset the preferences only
|
||||||
|
// once, but if the script then modifies the preferences, they
|
||||||
|
// are not reset again.
|
||||||
|
bool m_prefAlreadyResetFromScript = false;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
Fill m_fill;
|
Fill m_fill;
|
||||||
Ink* m_ink;
|
Ink* m_ink;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user