Add remember new tilemap layer base index (fix #2735)

This commit is contained in:
Gaspar Capello 2022-07-13 18:11:46 -03:00 committed by David Capello
parent 8c3aac3926
commit 12e59b887f
2 changed files with 9 additions and 0 deletions

View File

@ -423,6 +423,9 @@
<section id="canvas_size">
<option id="trim_outside" type="bool" default="false" />
</section>
<section id="tileset">
<option id="base_index" type="int" default="1" />
</section>
</global>
<tool>

View File

@ -24,6 +24,7 @@
#include "app/i18n/strings.h"
#include "app/load_widget.h"
#include "app/modules/gui.h"
#include "app/pref/preferences.h"
#include "app/restore_visible_layers.h"
#include "app/tx.h"
#include "app/ui/main_window.h"
@ -208,6 +209,9 @@ void NewLayerCommand::onExecute(Context* context)
#ifdef ENABLE_UI
// If params specify to ask the user about the name...
if (params().ask() && context->isUIAvailable()) {
auto& pref = Preferences::instance();
tilesetInfo.baseIndex = pref.tileset.baseIndex();
// We open the window to ask the name
app::gen::NewLayer window;
TilesetSelector* tilesetSelector = nullptr;
@ -227,6 +231,8 @@ void NewLayerCommand::onExecute(Context* context)
if (window.closer() != window.ok())
return;
pref.tileset.baseIndex(tilesetSelector->getInfo().baseIndex);
name = window.name()->text();
if (tilesetSelector)
tilesetInfo = tilesetSelector->getInfo();