mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-30 15:32:38 +00:00
Save the whole group of grid/bg/pixel grid settings when these elements are displayed in the Editor
https://community.aseprite.org/t/3303/10
This commit is contained in:
parent
d8b933c3f1
commit
b190cc985e
@ -394,19 +394,19 @@
|
||||
<option id="x_axis" type="double" default="0" />
|
||||
<option id="y_axis" type="double" default="0" />
|
||||
</section>
|
||||
<section id="grid">
|
||||
<section id="grid" canforce="true">
|
||||
<option id="snap" type="bool" default="false" />
|
||||
<option id="bounds" type="gfx::Rect" default="doc::Sprite::DefaultGridBounds()" />
|
||||
<option id="color" type="app::Color" default="app::Color::fromRgb(0, 0, 255)" />
|
||||
<option id="opacity" type="int" default="160" />
|
||||
<option id="auto_opacity" type="bool" default="true" />
|
||||
</section>
|
||||
<section id="pixel_grid">
|
||||
<section id="pixel_grid" canforce="true">
|
||||
<option id="color" type="app::Color" default="app::Color::fromRgb(200, 200, 200)" />
|
||||
<option id="opacity" type="int" default="160" />
|
||||
<option id="auto_opacity" type="bool" default="true" />
|
||||
</section>
|
||||
<section id="bg">
|
||||
<section id="bg" canforce="true">
|
||||
<option id="type" type="BgType" default="BgType::CHECKED_16x16" />
|
||||
<option id="size" type="gfx::Size" default="gfx::Size(16, 16)" />
|
||||
<option id="zoom" type="bool" default="true" />
|
||||
|
@ -654,6 +654,11 @@ void Editor::drawOneSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& sprite
|
||||
rendered.get(), m_sprite, m_frame, gfx::Clip(0, 0, rc2));
|
||||
|
||||
m_renderEngine->removeExtraImage();
|
||||
|
||||
// If the checked background is visible in this sprite, we save
|
||||
// all settings of the background for this document.
|
||||
if (!m_sprite->isOpaque())
|
||||
m_docPref.bg.forceSection();
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
Console::showException(e);
|
||||
@ -724,7 +729,11 @@ void Editor::drawOneSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& sprite
|
||||
|
||||
drawGrid(g, enclosingRect, Rect(0, 0, 1, 1),
|
||||
m_docPref.pixelGrid.color(), alpha);
|
||||
|
||||
// Save all pixel grid settings that are unset
|
||||
m_docPref.pixelGrid.forceSection();
|
||||
}
|
||||
m_docPref.show.pixelGrid.forceDirtyFlag();
|
||||
|
||||
// Draw the grid
|
||||
if (m_docPref.show.grid()) {
|
||||
@ -745,7 +754,11 @@ void Editor::drawOneSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& sprite
|
||||
m_docPref.grid.color(), alpha);
|
||||
}
|
||||
}
|
||||
|
||||
// Save all grid settings that are unset
|
||||
m_docPref.grid.forceSection();
|
||||
}
|
||||
m_docPref.show.grid.forceDirtyFlag();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
Copyright (c) 2014 David Capello
|
||||
Copyright (C) 2019 Igara Studio S.A.
|
||||
Copyright (C) 2014-2018 David Capello
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Aseprite Code Generator
|
||||
*Copyright (C) 2014 David Capello*
|
||||
|
||||
> Distributed under [MIT license](LICENSE.txt)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Code Generator
|
||||
// Copyright (c) 2014, 2015 David Capello
|
||||
// Copyright (C) 2014-2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
|
@ -1,5 +1,6 @@
|
||||
// Aseprite Code Generator
|
||||
// Copyright (c) 2014-2018 David Capello
|
||||
// Copyright (C) 2019 Igara Studio S.A.
|
||||
// Copyright (C) 2014-2018 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -27,6 +28,9 @@ static void print_pref_class_def(TiXmlElement* elem, const std::string& classNam
|
||||
<< indent << "public:\n"
|
||||
<< indent << " " << className << "(const std::string& name);\n";
|
||||
|
||||
if (elem->Attribute("canforce"))
|
||||
std::cout << indent << " void forceSection();\n";
|
||||
|
||||
std::cout
|
||||
<< indent << " void load();\n"
|
||||
<< indent << " void save();\n"
|
||||
@ -102,6 +106,31 @@ static void print_pref_class_impl(TiXmlElement* elem, const std::string& prefix,
|
||||
<< "{\n"
|
||||
<< "}\n";
|
||||
|
||||
// Section::forceSection()
|
||||
if (elem->Attribute("canforce")) {
|
||||
std::cout
|
||||
<< "\n"
|
||||
<< "void " << prefix << className << "::forceSection()\n"
|
||||
<< "{\n";
|
||||
|
||||
child = (elem->FirstChild() ? elem->FirstChild()->ToElement(): nullptr);
|
||||
while (child) {
|
||||
if (child->Value()) {
|
||||
std::string name = child->Value();
|
||||
const char* childId = child->Attribute("id");
|
||||
|
||||
if (name == "option") {
|
||||
std::string memberName = convert_xmlid_to_cppid(childId, false);
|
||||
std::cout << " " << memberName << ".forceDirtyFlag();\n";
|
||||
}
|
||||
}
|
||||
child = child->NextSiblingElement();
|
||||
}
|
||||
|
||||
std::cout
|
||||
<< "}\n";
|
||||
}
|
||||
|
||||
// Section::load()
|
||||
|
||||
std::cout
|
||||
|
Loading…
x
Reference in New Issue
Block a user