mirror of
https://github.com/aseprite/aseprite.git
synced 2024-12-25 15:18:23 +00:00
Add JSON data format into Export Sprite Sheet UI
This commit is contained in:
parent
65dd457847
commit
e79236b3a3
@ -260,6 +260,7 @@
|
||||
<option id="best_fit" type="bool" default="false" />
|
||||
<option id="texture_filename" type="std::string" />
|
||||
<option id="data_filename" type="std::string" />
|
||||
<option id="data_format" type="DocumentExporter::DataFormat" default="DocumentExporter::DefaultDataFormat" />
|
||||
<option id="border_padding" type="int" default="0" />
|
||||
<option id="shape_padding" type="int" default="0" />
|
||||
<option id="inner_padding" type="int" default="0" />
|
||||
|
@ -49,6 +49,10 @@
|
||||
|
||||
<hbox />
|
||||
<hbox id="data_meta" cell_hspan="3">
|
||||
<combobox id="data_format">
|
||||
<listitem text="Hash" value="0" />
|
||||
<listitem text="Array" value="1" />
|
||||
</combobox>
|
||||
<label text="Meta:" />
|
||||
<check id="list_layers" text="Layers" />
|
||||
<check id="list_tags" text="Frame Tags" />
|
||||
|
@ -359,6 +359,7 @@ public:
|
||||
|
||||
m_dataFilename = m_docPref.spriteSheet.dataFilename();
|
||||
dataEnabled()->setSelected(!m_dataFilename.empty());
|
||||
dataFormat()->setSelectedItemIndex(int(m_docPref.spriteSheet.dataFormat()));
|
||||
listLayers()->setSelected(m_docPref.spriteSheet.listLayers());
|
||||
listTags()->setSelected(m_docPref.spriteSheet.listFrameTags());
|
||||
updateDataFields();
|
||||
@ -449,6 +450,13 @@ public:
|
||||
return std::string();
|
||||
}
|
||||
|
||||
DocumentExporter::DataFormat dataFormatValue() const {
|
||||
if (dataEnabled()->isSelected())
|
||||
return DocumentExporter::DataFormat(dataFormat()->getSelectedItemIndex());
|
||||
else
|
||||
return DocumentExporter::DefaultDataFormat;
|
||||
}
|
||||
|
||||
int borderPaddingValue() const {
|
||||
if (paddingEnabled()->isSelected()) {
|
||||
int value = borderPadding()->textInt();
|
||||
@ -758,6 +766,7 @@ void ExportSpriteSheetCommand::onExecute(Context* context)
|
||||
docPref.spriteSheet.bestFit(window.bestFitValue());
|
||||
docPref.spriteSheet.textureFilename(window.filenameValue());
|
||||
docPref.spriteSheet.dataFilename(window.dataFilenameValue());
|
||||
docPref.spriteSheet.dataFormat(window.dataFormatValue());
|
||||
docPref.spriteSheet.borderPadding(window.borderPaddingValue());
|
||||
docPref.spriteSheet.shapePadding(window.shapePaddingValue());
|
||||
docPref.spriteSheet.innerPadding(window.innerPaddingValue());
|
||||
@ -787,6 +796,7 @@ void ExportSpriteSheetCommand::onExecute(Context* context)
|
||||
bool bestFit = docPref.spriteSheet.bestFit();
|
||||
std::string filename = docPref.spriteSheet.textureFilename();
|
||||
std::string dataFilename = docPref.spriteSheet.dataFilename();
|
||||
DocumentExporter::DataFormat dataFormat = docPref.spriteSheet.dataFormat();
|
||||
std::string layerName = docPref.spriteSheet.layer();
|
||||
std::string frameTagName = docPref.spriteSheet.frameTag();
|
||||
int borderPadding = docPref.spriteSheet.borderPadding();
|
||||
@ -877,8 +887,10 @@ void ExportSpriteSheetCommand::onExecute(Context* context)
|
||||
DocumentExporter exporter;
|
||||
if (!filename.empty())
|
||||
exporter.setTextureFilename(filename);
|
||||
if (!dataFilename.empty())
|
||||
if (!dataFilename.empty()) {
|
||||
exporter.setDataFilename(dataFilename);
|
||||
exporter.setDataFormat(dataFormat);
|
||||
}
|
||||
exporter.setTextureWidth(sheet_w);
|
||||
exporter.setTextureHeight(sheet_h);
|
||||
exporter.setSpriteSheetType(type);
|
||||
|
@ -10,6 +10,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "app/color.h"
|
||||
#include "app/document_exporter.h"
|
||||
#include "app/pref/option.h"
|
||||
#include "app/sprite_sheet_type.h"
|
||||
#include "app/tools/freehand_algorithm.h"
|
||||
|
Loading…
Reference in New Issue
Block a user