mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-28 18:32:50 +00:00
lua: Add support to specify ExportSpriteSheet params
This commit is contained in:
parent
271865e13d
commit
4dd7febb99
@ -27,6 +27,7 @@
|
||||
#include "app/ui/status_bar.h"
|
||||
#include "app/ui/timeline/timeline.h"
|
||||
#include "base/bind.h"
|
||||
#include "base/clamp.h"
|
||||
#include "base/convert_to.h"
|
||||
#include "base/fs.h"
|
||||
#include "base/string.h"
|
||||
@ -162,12 +163,35 @@ namespace {
|
||||
|
||||
}
|
||||
|
||||
struct ExportSpriteSheetParams : public NewParams {
|
||||
Param<bool> ui { this, true, "ui" };
|
||||
Param<bool> askOverwrite { this, true, { "askOverwrite", "ask-overwrite" } };
|
||||
Param<app::SpriteSheetType> type { this, app::SpriteSheetType::None, "type" };
|
||||
Param<int> columns { this, 0, "columns" };
|
||||
Param<int> rows { this, 0, "rows" };
|
||||
Param<int> width { this, 0, "width" };
|
||||
Param<int> height { this, 0, "height" };
|
||||
Param<bool> bestFit { this, false, "bestFit" };
|
||||
Param<std::string> textureFilename { this, std::string(), "textureFilename" };
|
||||
Param<std::string> dataFilename { this, std::string(), "dataFilename" };
|
||||
Param<DocExporter::DataFormat> dataFormat { this, DocExporter::DefaultDataFormat, "dataFormat" };
|
||||
Param<int> borderPadding { this, 0, "borderPadding" };
|
||||
Param<int> shapePadding { this, 0, "shapePadding" };
|
||||
Param<int> innerPadding { this, 0, "innerPadding" };
|
||||
Param<bool> trim { this, false, "trim" };
|
||||
Param<bool> openGenerated { this, false, "openGenerated" };
|
||||
Param<std::string> layer { this, std::string(), "layer" };
|
||||
Param<std::string> tag { this, std::string(), "tag" };
|
||||
Param<bool> listLayers { this, true, "listLayers" };
|
||||
Param<bool> listTags { this, true, "listTags" };
|
||||
Param<bool> listSlices { this, true, "listSlices" };
|
||||
};
|
||||
|
||||
class ExportSpriteSheetWindow : public app::gen::ExportSpriteSheet {
|
||||
public:
|
||||
ExportSpriteSheetWindow(Site& site, DocumentPreferences& docPref)
|
||||
ExportSpriteSheetWindow(Site& site, ExportSpriteSheetParams& params)
|
||||
: m_site(site)
|
||||
, m_sprite(site.sprite())
|
||||
, m_docPref(docPref)
|
||||
, m_filenameAskOverwrite(true)
|
||||
, m_dataFilenameAskOverwrite(true)
|
||||
{
|
||||
@ -183,25 +207,25 @@ public:
|
||||
sheetType()->addItem("Vertical Strip");
|
||||
sheetType()->addItem("By Rows");
|
||||
sheetType()->addItem("By Columns");
|
||||
if (m_docPref.spriteSheet.type() != app::SpriteSheetType::None)
|
||||
sheetType()->setSelectedItemIndex((int)m_docPref.spriteSheet.type()-1);
|
||||
if (params.type() != app::SpriteSheetType::None)
|
||||
sheetType()->setSelectedItemIndex((int)params.type()-1);
|
||||
|
||||
fill_layers_combobox(
|
||||
m_sprite, layers(), m_docPref.spriteSheet.layer());
|
||||
m_sprite, layers(), params.layer());
|
||||
|
||||
fill_frames_combobox(
|
||||
m_sprite, frames(), m_docPref.spriteSheet.frameTag());
|
||||
m_sprite, frames(), params.tag());
|
||||
|
||||
openGenerated()->setSelected(m_docPref.spriteSheet.openGenerated());
|
||||
trimEnabled()->setSelected(m_docPref.spriteSheet.trim());
|
||||
openGenerated()->setSelected(params.openGenerated());
|
||||
trimEnabled()->setSelected(params.trim());
|
||||
|
||||
borderPadding()->setTextf("%d", m_docPref.spriteSheet.borderPadding());
|
||||
shapePadding()->setTextf("%d", m_docPref.spriteSheet.shapePadding());
|
||||
innerPadding()->setTextf("%d", m_docPref.spriteSheet.innerPadding());
|
||||
borderPadding()->setTextf("%d", params.borderPadding());
|
||||
shapePadding()->setTextf("%d", params.shapePadding());
|
||||
innerPadding()->setTextf("%d", params.innerPadding());
|
||||
paddingEnabled()->setSelected(
|
||||
m_docPref.spriteSheet.borderPadding() ||
|
||||
m_docPref.spriteSheet.shapePadding() ||
|
||||
m_docPref.spriteSheet.innerPadding());
|
||||
params.borderPadding() ||
|
||||
params.shapePadding() ||
|
||||
params.innerPadding());
|
||||
paddingContainer()->setVisible(paddingEnabled()->isSelected());
|
||||
|
||||
for (int i=2; i<=8192; i*=2) {
|
||||
@ -210,36 +234,36 @@ public:
|
||||
if (i >= m_sprite->height()) fitHeight()->addItem(value);
|
||||
}
|
||||
|
||||
if (m_docPref.spriteSheet.bestFit()) {
|
||||
if (params.bestFit()) {
|
||||
bestFit()->setSelected(true);
|
||||
onBestFit();
|
||||
}
|
||||
else {
|
||||
columns()->setTextf("%d", m_docPref.spriteSheet.columns());
|
||||
rows()->setTextf("%d", m_docPref.spriteSheet.rows());
|
||||
columns()->setTextf("%d", params.columns());
|
||||
rows()->setTextf("%d", params.rows());
|
||||
onColumnsChange();
|
||||
|
||||
if (m_docPref.spriteSheet.width() > 0 || m_docPref.spriteSheet.height() > 0) {
|
||||
if (m_docPref.spriteSheet.width() > 0)
|
||||
fitWidth()->getEntryWidget()->setTextf("%d", m_docPref.spriteSheet.width());
|
||||
if (params.width() > 0 || params.height() > 0) {
|
||||
if (params.width() > 0)
|
||||
fitWidth()->getEntryWidget()->setTextf("%d", params.width());
|
||||
|
||||
if (m_docPref.spriteSheet.height() > 0)
|
||||
fitHeight()->getEntryWidget()->setTextf("%d", m_docPref.spriteSheet.height());
|
||||
if (params.height() > 0)
|
||||
fitHeight()->getEntryWidget()->setTextf("%d", params.height());
|
||||
|
||||
onSizeChange();
|
||||
}
|
||||
}
|
||||
|
||||
m_filename = m_docPref.spriteSheet.textureFilename();
|
||||
m_filename = params.textureFilename();
|
||||
imageEnabled()->setSelected(!m_filename.empty());
|
||||
imageFilename()->setVisible(imageEnabled()->isSelected());
|
||||
|
||||
m_dataFilename = m_docPref.spriteSheet.dataFilename();
|
||||
m_dataFilename = params.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());
|
||||
listSlices()->setSelected(m_docPref.spriteSheet.listSlices());
|
||||
dataFormat()->setSelectedItemIndex(int(params.dataFormat()));
|
||||
listLayers()->setSelected(params.listLayers());
|
||||
listTags()->setSelected(params.listTags());
|
||||
listSlices()->setSelected(params.listSlices());
|
||||
updateDataFields();
|
||||
|
||||
std::string base = site.document()->filename();
|
||||
@ -575,18 +599,12 @@ private:
|
||||
|
||||
Site& m_site;
|
||||
Sprite* m_sprite;
|
||||
DocumentPreferences& m_docPref;
|
||||
std::string m_filename;
|
||||
std::string m_dataFilename;
|
||||
bool m_filenameAskOverwrite;
|
||||
bool m_dataFilenameAskOverwrite;
|
||||
};
|
||||
|
||||
struct ExportSpriteSheetParams : public NewParams {
|
||||
Param<bool> ui { this, true, "ui" };
|
||||
Param<bool> askOverwrite { this, true, { "askOverwrite", "ask-overwrite" } };
|
||||
};
|
||||
|
||||
class ExportSpriteSheetCommand : public CommandWithNewParams<ExportSpriteSheetParams> {
|
||||
public:
|
||||
ExportSpriteSheetCommand();
|
||||
@ -612,35 +630,63 @@ void ExportSpriteSheetCommand::onExecute(Context* context)
|
||||
Doc* document = site.document();
|
||||
Sprite* sprite = site.sprite();
|
||||
DocumentPreferences& docPref(Preferences::instance().document(document));
|
||||
auto& params = this->params();
|
||||
|
||||
#ifdef ENABLE_UI
|
||||
bool askOverwrite = params().askOverwrite();
|
||||
if (params().ui() && context->isUIAvailable()) {
|
||||
ExportSpriteSheetWindow window(site, docPref);
|
||||
bool askOverwrite = params.askOverwrite();
|
||||
// Show UI if the user specified it explicitly or the sprite sheet type wasn't specified.
|
||||
if (context->isUIAvailable() && params.ui() &&
|
||||
(params.ui.isSet() ||
|
||||
!params.type() == app::SpriteSheetType::None)) {
|
||||
// Copy document preferences to undefined params
|
||||
if (docPref.spriteSheet.defined(true) &&
|
||||
!params.type.isSet()) {
|
||||
params.type(docPref.spriteSheet.type());
|
||||
if (!params.columns.isSet()) params.columns( docPref.spriteSheet.columns());
|
||||
if (!params.rows.isSet()) params.rows( docPref.spriteSheet.rows());
|
||||
if (!params.width.isSet()) params.width( docPref.spriteSheet.width());
|
||||
if (!params.height.isSet()) params.height( docPref.spriteSheet.height());
|
||||
if (!params.bestFit.isSet()) params.bestFit( docPref.spriteSheet.bestFit());
|
||||
if (!params.textureFilename.isSet()) params.textureFilename( docPref.spriteSheet.textureFilename());
|
||||
if (!params.dataFilename.isSet()) params.dataFilename( docPref.spriteSheet.dataFilename());
|
||||
if (!params.dataFormat.isSet()) params.dataFormat( docPref.spriteSheet.dataFormat());
|
||||
if (!params.borderPadding.isSet()) params.borderPadding( docPref.spriteSheet.borderPadding());
|
||||
if (!params.shapePadding.isSet()) params.shapePadding( docPref.spriteSheet.shapePadding());
|
||||
if (!params.innerPadding.isSet()) params.innerPadding( docPref.spriteSheet.innerPadding());
|
||||
if (!params.trim.isSet()) params.trim( docPref.spriteSheet.trim());
|
||||
if (!params.openGenerated.isSet()) params.openGenerated( docPref.spriteSheet.openGenerated());
|
||||
if (!params.layer.isSet()) params.layer( docPref.spriteSheet.layer());
|
||||
if (!params.tag.isSet()) params.tag( docPref.spriteSheet.frameTag());
|
||||
if (!params.listLayers.isSet()) params.listLayers( docPref.spriteSheet.listLayers());
|
||||
if (!params.listTags.isSet()) params.listTags( docPref.spriteSheet.listFrameTags());
|
||||
if (!params.listSlices.isSet()) params.listSlices( docPref.spriteSheet.listSlices());
|
||||
}
|
||||
|
||||
ExportSpriteSheetWindow window(site, params);
|
||||
window.openWindowInForeground();
|
||||
if (!window.ok())
|
||||
return;
|
||||
|
||||
docPref.spriteSheet.defined(true);
|
||||
docPref.spriteSheet.type(window.spriteSheetTypeValue());
|
||||
docPref.spriteSheet.columns(window.columnsValue());
|
||||
docPref.spriteSheet.rows(window.rowsValue());
|
||||
docPref.spriteSheet.width(window.fitWidthValue());
|
||||
docPref.spriteSheet.height(window.fitHeightValue());
|
||||
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());
|
||||
docPref.spriteSheet.trim(window.trimValue());
|
||||
docPref.spriteSheet.openGenerated(window.openGeneratedValue());
|
||||
docPref.spriteSheet.layer(window.layerValue());
|
||||
docPref.spriteSheet.frameTag(window.frameTagValue());
|
||||
docPref.spriteSheet.listLayers(window.listLayersValue());
|
||||
docPref.spriteSheet.listFrameTags(window.listFrameTagsValue());
|
||||
docPref.spriteSheet.listSlices(window.listSlicesValue());
|
||||
docPref.spriteSheet.type (params.type (window.spriteSheetTypeValue()));
|
||||
docPref.spriteSheet.columns (params.columns (window.columnsValue()));
|
||||
docPref.spriteSheet.rows (params.rows (window.rowsValue()));
|
||||
docPref.spriteSheet.width (params.width (window.fitWidthValue()));
|
||||
docPref.spriteSheet.height (params.height (window.fitHeightValue()));
|
||||
docPref.spriteSheet.bestFit (params.bestFit (window.bestFitValue()));
|
||||
docPref.spriteSheet.textureFilename (params.textureFilename (window.filenameValue()));
|
||||
docPref.spriteSheet.dataFilename (params.dataFilename (window.dataFilenameValue()));
|
||||
docPref.spriteSheet.dataFormat (params.dataFormat (window.dataFormatValue()));
|
||||
docPref.spriteSheet.borderPadding (params.borderPadding (window.borderPaddingValue()));
|
||||
docPref.spriteSheet.shapePadding (params.shapePadding (window.shapePaddingValue()));
|
||||
docPref.spriteSheet.innerPadding (params.innerPadding (window.innerPaddingValue()));
|
||||
docPref.spriteSheet.trim (params.trim (window.trimValue()));
|
||||
docPref.spriteSheet.openGenerated (params.openGenerated (window.openGeneratedValue()));
|
||||
docPref.spriteSheet.layer (params.layer (window.layerValue()));
|
||||
docPref.spriteSheet.frameTag (params.tag (window.frameTagValue()));
|
||||
docPref.spriteSheet.listLayers (params.listLayers (window.listLayersValue()));
|
||||
docPref.spriteSheet.listFrameTags (params.listTags (window.listFrameTagsValue()));
|
||||
docPref.spriteSheet.listSlices (params.listSlices (window.listSlicesValue()));
|
||||
|
||||
// Default preferences for future sprites
|
||||
DocumentPreferences& defPref(Preferences::instance().document(nullptr));
|
||||
@ -656,27 +702,24 @@ void ExportSpriteSheetCommand::onExecute(Context* context)
|
||||
}
|
||||
#endif // ENABLE_UI
|
||||
|
||||
app::SpriteSheetType type = docPref.spriteSheet.type();
|
||||
int columns = docPref.spriteSheet.columns();
|
||||
int rows = docPref.spriteSheet.rows();
|
||||
int width = docPref.spriteSheet.width();
|
||||
int height = docPref.spriteSheet.height();
|
||||
bool bestFit = docPref.spriteSheet.bestFit();
|
||||
std::string filename = docPref.spriteSheet.textureFilename();
|
||||
std::string dataFilename = docPref.spriteSheet.dataFilename();
|
||||
DocExporter::DataFormat dataFormat = docPref.spriteSheet.dataFormat();
|
||||
std::string layerName = docPref.spriteSheet.layer();
|
||||
std::string frameTagName = docPref.spriteSheet.frameTag();
|
||||
int borderPadding = docPref.spriteSheet.borderPadding();
|
||||
int shapePadding = docPref.spriteSheet.shapePadding();
|
||||
int innerPadding = docPref.spriteSheet.innerPadding();
|
||||
borderPadding = MID(0, borderPadding, 100);
|
||||
shapePadding = MID(0, shapePadding, 100);
|
||||
innerPadding = MID(0, innerPadding, 100);
|
||||
const bool trimCels = docPref.spriteSheet.trim();
|
||||
const bool listLayers = docPref.spriteSheet.listLayers();
|
||||
const bool listFrameTags = docPref.spriteSheet.listFrameTags();
|
||||
const bool listSlices = docPref.spriteSheet.listSlices();
|
||||
const app::SpriteSheetType type = params.type();
|
||||
int columns = params.columns();
|
||||
int rows = params.rows();
|
||||
int width = params.width();
|
||||
int height = params.height();
|
||||
const bool bestFit = params.bestFit();
|
||||
const std::string filename = params.textureFilename();
|
||||
const std::string dataFilename = params.dataFilename();
|
||||
const DocExporter::DataFormat dataFormat = params.dataFormat();
|
||||
const std::string layerName = params.layer();
|
||||
const std::string tagName = params.tag();
|
||||
const int borderPadding = base::clamp(params.borderPadding(), 0, 100);
|
||||
const int shapePadding = base::clamp(params.shapePadding(), 0, 100);
|
||||
const int innerPadding = base::clamp(params.innerPadding(), 0, 100);
|
||||
const bool trimCels = params.trim();
|
||||
const bool listLayers = params.listLayers();
|
||||
const bool listTags = params.listTags();
|
||||
const bool listSlices = params.listSlices();
|
||||
|
||||
#ifdef ENABLE_UI
|
||||
if (context->isUIAvailable() && askOverwrite) {
|
||||
@ -688,7 +731,7 @@ void ExportSpriteSheetCommand::onExecute(Context* context)
|
||||
|
||||
SelectedFrames selFrames;
|
||||
FrameTag* frameTag =
|
||||
calculate_selected_frames(site, frameTagName, selFrames);
|
||||
calculate_selected_frames(site, tagName, selFrames);
|
||||
|
||||
frame_t nframes = selFrames.size();
|
||||
ASSERT(nframes > 0);
|
||||
@ -758,7 +801,7 @@ void ExportSpriteSheetCommand::onExecute(Context* context)
|
||||
exporter.setInnerPadding(innerPadding);
|
||||
exporter.setTrimCels(trimCels);
|
||||
if (listLayers) exporter.setListLayers(true);
|
||||
if (listFrameTags) exporter.setListFrameTags(true);
|
||||
if (listTags) exporter.setListFrameTags(true);
|
||||
if (listSlices) exporter.setListSlices(true);
|
||||
exporter.addDocument(document, frameTag,
|
||||
(!selLayers.empty() ? &selLayers: nullptr),
|
||||
|
@ -10,14 +10,59 @@
|
||||
|
||||
#include "app/commands/new_params.h"
|
||||
|
||||
#include "app/doc_exporter.h"
|
||||
#include "app/script/luacpp.h"
|
||||
#include "app/sprite_sheet_type.h"
|
||||
#include "base/convert_to.h"
|
||||
#include "base/string.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
template<>
|
||||
void Param<bool>::fromString(const std::string& value)
|
||||
{
|
||||
m_value = (value == "1" || value == "true");
|
||||
setValue(value == "1" || value == "true");
|
||||
}
|
||||
|
||||
template<>
|
||||
void Param<int>::fromString(const std::string& value)
|
||||
{
|
||||
setValue(base::convert_to<int>(value));
|
||||
}
|
||||
|
||||
template<>
|
||||
void Param<std::string>::fromString(const std::string& value)
|
||||
{
|
||||
setValue(value);
|
||||
}
|
||||
|
||||
template<>
|
||||
void Param<app::SpriteSheetType>::fromString(const std::string& value)
|
||||
{
|
||||
if (value == "horizontal")
|
||||
setValue(app::SpriteSheetType::Horizontal);
|
||||
else if (value == "vertical")
|
||||
setValue(app::SpriteSheetType::Vertical);
|
||||
else if (value == "rows")
|
||||
setValue(app::SpriteSheetType::Rows);
|
||||
else if (value == "columns")
|
||||
setValue(app::SpriteSheetType::Columns);
|
||||
else if (value == "packed")
|
||||
setValue(app::SpriteSheetType::Packed);
|
||||
else
|
||||
setValue(app::SpriteSheetType::None);
|
||||
}
|
||||
|
||||
template<>
|
||||
void Param<app::DocExporter::DataFormat>::fromString(const std::string& value)
|
||||
{
|
||||
// JsonArray, json-array, json_array, etc.
|
||||
if (base::utf8_icmp(value, "JsonArray") == 0 ||
|
||||
base::utf8_icmp(value, "json-array") == 0 ||
|
||||
base::utf8_icmp(value, "json_array") == 0)
|
||||
setValue(app::DocExporter::JsonArrayDataFormat);
|
||||
else
|
||||
setValue(app::DocExporter::JsonHashDataFormat);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SCRIPTING
|
||||
@ -25,7 +70,40 @@ void Param<bool>::fromString(const std::string& value)
|
||||
template<>
|
||||
void Param<bool>::fromLua(lua_State* L, int index)
|
||||
{
|
||||
m_value = lua_toboolean(L, index);
|
||||
setValue(lua_toboolean(L, index));
|
||||
}
|
||||
|
||||
template<>
|
||||
void Param<int>::fromLua(lua_State* L, int index)
|
||||
{
|
||||
setValue(lua_tointeger(L, index));
|
||||
}
|
||||
|
||||
template<>
|
||||
void Param<std::string>::fromLua(lua_State* L, int index)
|
||||
{
|
||||
if (const char* s = lua_tostring(L, index))
|
||||
setValue(s);
|
||||
else
|
||||
setValue(std::string());
|
||||
}
|
||||
|
||||
template<>
|
||||
void Param<app::SpriteSheetType>::fromLua(lua_State* L, int index)
|
||||
{
|
||||
if (lua_isstring(L, index))
|
||||
fromString(lua_tostring(L, index));
|
||||
else
|
||||
setValue((app::SpriteSheetType)lua_tointeger(L, index));
|
||||
}
|
||||
|
||||
template<>
|
||||
void Param<app::DocExporter::DataFormat>::fromLua(lua_State* L, int index)
|
||||
{
|
||||
if (lua_isstring(L, index))
|
||||
fromString(lua_tostring(L, index));
|
||||
else
|
||||
setValue((app::DocExporter::DataFormat)lua_tointeger(L, index));
|
||||
}
|
||||
|
||||
void CommandWithNewParamsBase::onLoadParams(const Params& params)
|
||||
|
@ -73,8 +73,13 @@ namespace app {
|
||||
params->addParam(id, this);
|
||||
}
|
||||
|
||||
bool isSet() {
|
||||
return m_isSet;
|
||||
}
|
||||
|
||||
void resetValue() override {
|
||||
m_value = m_defaultValue;
|
||||
m_isSet = false;
|
||||
}
|
||||
|
||||
void fromString(const std::string& value) override;
|
||||
@ -86,13 +91,20 @@ namespace app {
|
||||
return m_value;
|
||||
}
|
||||
|
||||
void operator()(const T& value) {
|
||||
T& operator()(const T& value) {
|
||||
m_value = value;
|
||||
m_isSet = true;
|
||||
return m_value;
|
||||
}
|
||||
|
||||
private:
|
||||
void setValue(const T& value) {
|
||||
operator()(value);
|
||||
}
|
||||
|
||||
T m_defaultValue;
|
||||
T m_value;
|
||||
bool m_isSet = false;
|
||||
};
|
||||
|
||||
class CommandWithNewParamsBase : public Command {
|
||||
|
@ -13,9 +13,11 @@
|
||||
|
||||
#include "app/app.h"
|
||||
#include "app/console.h"
|
||||
#include "app/doc_exporter.h"
|
||||
#include "app/doc_range.h"
|
||||
#include "app/script/luacpp.h"
|
||||
#include "app/script/security.h"
|
||||
#include "app/sprite_sheet_type.h"
|
||||
#include "base/chrono.h"
|
||||
#include "base/file_handle.h"
|
||||
#include "base/fs.h"
|
||||
@ -278,6 +280,23 @@ Engine::Engine()
|
||||
setfield_integer(L, "CELS", DocRange::kCels);
|
||||
lua_pop(L, 1);
|
||||
|
||||
lua_newtable(L);
|
||||
lua_pushvalue(L, -1);
|
||||
lua_setglobal(L, "SpriteSheetType");
|
||||
setfield_integer(L, "HORIZONTAL", SpriteSheetType::Horizontal);
|
||||
setfield_integer(L, "VERTICAL", SpriteSheetType::Vertical);
|
||||
setfield_integer(L, "ROWS", SpriteSheetType::Rows);
|
||||
setfield_integer(L, "COLUMNS", SpriteSheetType::Columns);
|
||||
setfield_integer(L, "PACKED", SpriteSheetType::Packed);
|
||||
lua_pop(L, 1);
|
||||
|
||||
lua_newtable(L);
|
||||
lua_pushvalue(L, -1);
|
||||
lua_setglobal(L, "SpriteSheetDataFormat");
|
||||
setfield_integer(L, "JSON_HASH", DocExporter::JsonHashDataFormat);
|
||||
setfield_integer(L, "JSON_ARRAY", DocExporter::JsonArrayDataFormat);
|
||||
lua_pop(L, 1);
|
||||
|
||||
// Register classes/prototypes
|
||||
register_cel_class(L);
|
||||
register_cels_class(L);
|
||||
|
Loading…
x
Reference in New Issue
Block a user