mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-30 15:32:38 +00:00
Rename DocumentExporter -> DocExporter
This commit is contained in:
parent
cf8eee60b0
commit
b8317805f8
@ -391,7 +391,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="data_format" type="DocExporter::DataFormat" default="DocExporter::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" />
|
||||
|
@ -499,11 +499,11 @@ add_library(app-lib
|
||||
doc.cpp
|
||||
doc_api.cpp
|
||||
doc_diff.cpp
|
||||
doc_exporter.cpp
|
||||
doc_range.cpp
|
||||
doc_range_ops.cpp
|
||||
doc_undo.cpp
|
||||
docs.cpp
|
||||
document_exporter.cpp
|
||||
extensions.cpp
|
||||
extra_cel.cpp
|
||||
file/file.cpp
|
||||
|
@ -14,7 +14,7 @@ namespace app {
|
||||
|
||||
class AppOptions;
|
||||
class Context;
|
||||
class DocumentExporter;
|
||||
class DocExporter;
|
||||
struct CliOpenFile;
|
||||
|
||||
class CliDelegate {
|
||||
@ -29,7 +29,7 @@ namespace app {
|
||||
virtual void afterOpenFile(const CliOpenFile& cof) { }
|
||||
virtual void saveFile(Context* ctx, const CliOpenFile& cof) { }
|
||||
virtual void loadPalette(Context* ctx, const CliOpenFile& cof, const std::string& filename) { }
|
||||
virtual void exportFiles(Context* ctx, DocumentExporter& exporter) { }
|
||||
virtual void exportFiles(Context* ctx, DocExporter& exporter) { }
|
||||
virtual void execScript(const std::string& filename) { }
|
||||
};
|
||||
|
||||
|
@ -17,8 +17,8 @@
|
||||
#include "app/commands/params.h"
|
||||
#include "app/console.h"
|
||||
#include "app/doc.h"
|
||||
#include "app/doc_exporter.h"
|
||||
#include "app/doc_undo.h"
|
||||
#include "app/document_exporter.h"
|
||||
#include "app/file/file.h"
|
||||
#include "app/filename_formatter.h"
|
||||
#include "app/restore_visible_layers.h"
|
||||
@ -119,7 +119,7 @@ CliProcessor::CliProcessor(CliDelegate* delegate,
|
||||
, m_exporter(nullptr)
|
||||
{
|
||||
if (options.hasExporterParams())
|
||||
m_exporter.reset(new DocumentExporter);
|
||||
m_exporter.reset(new DocExporter);
|
||||
}
|
||||
|
||||
void CliProcessor::process(Context* ctx)
|
||||
@ -154,12 +154,12 @@ void CliProcessor::process(Context* ctx)
|
||||
// --format <format>
|
||||
else if (opt == &m_options.format()) {
|
||||
if (m_exporter) {
|
||||
DocumentExporter::DataFormat format = DocumentExporter::DefaultDataFormat;
|
||||
DocExporter::DataFormat format = DocExporter::DefaultDataFormat;
|
||||
|
||||
if (value.value() == "json-hash")
|
||||
format = DocumentExporter::JsonHashDataFormat;
|
||||
format = DocExporter::JsonHashDataFormat;
|
||||
else if (value.value() == "json-array")
|
||||
format = DocumentExporter::JsonArrayDataFormat;
|
||||
format = DocExporter::JsonArrayDataFormat;
|
||||
|
||||
m_exporter->setDataFormat(format);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ namespace app {
|
||||
|
||||
class AppOptions;
|
||||
class Context;
|
||||
class DocumentExporter;
|
||||
class DocExporter;
|
||||
|
||||
class CliProcessor {
|
||||
public:
|
||||
@ -33,7 +33,7 @@ namespace app {
|
||||
|
||||
CliDelegate* m_delegate;
|
||||
const AppOptions& m_options;
|
||||
base::UniquePtr<DocumentExporter> m_exporter;
|
||||
base::UniquePtr<DocExporter> m_exporter;
|
||||
};
|
||||
|
||||
} // namespace app
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "app/cli/app_options.h"
|
||||
#include "app/cli/cli_processor.h"
|
||||
#include "app/document_exporter.h"
|
||||
#include "app/doc_exporter.h"
|
||||
|
||||
#include <initializer_list>
|
||||
|
||||
@ -32,7 +32,7 @@ public:
|
||||
void beforeOpenFile(const CliOpenFile& cof) override { }
|
||||
void afterOpenFile(const CliOpenFile& cof) override { }
|
||||
void saveFile(Context* ctx, const CliOpenFile& cof) override { }
|
||||
void exportFiles(Context* ctx, DocumentExporter& exporter) override { }
|
||||
void exportFiles(Context* ctx, DocExporter& exporter) override { }
|
||||
void execScript(const std::string& filename) override { }
|
||||
|
||||
bool helpWasShown() const { return m_helpWasShown; }
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "app/commands/params.h"
|
||||
#include "app/console.h"
|
||||
#include "app/doc.h"
|
||||
#include "app/document_exporter.h"
|
||||
#include "app/doc_exporter.h"
|
||||
#include "app/file/palette_file.h"
|
||||
#include "app/ui_context.h"
|
||||
#include "base/convert_to.h"
|
||||
@ -112,7 +112,7 @@ void DefaultCliDelegate::loadPalette(Context* ctx,
|
||||
}
|
||||
}
|
||||
|
||||
void DefaultCliDelegate::exportFiles(Context* ctx, DocumentExporter& exporter)
|
||||
void DefaultCliDelegate::exportFiles(Context* ctx, DocExporter& exporter)
|
||||
{
|
||||
LOG("APP: Exporting sheet...\n");
|
||||
|
||||
|
@ -19,7 +19,7 @@ namespace app {
|
||||
void afterOpenFile(const CliOpenFile& cof) override;
|
||||
void saveFile(Context* ctx, const CliOpenFile& cof) override;
|
||||
void loadPalette(Context* ctx, const CliOpenFile& cof, const std::string& filename) override;
|
||||
void exportFiles(Context* ctx, DocumentExporter& exporter) override;
|
||||
void exportFiles(Context* ctx, DocExporter& exporter) override;
|
||||
void execScript(const std::string& filename) override;
|
||||
};
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "app/cli/cli_open_file.h"
|
||||
#include "app/context.h"
|
||||
#include "app/doc.h"
|
||||
#include "app/document_exporter.h"
|
||||
#include "app/doc_exporter.h"
|
||||
#include "app/file/file.h"
|
||||
#include "base/fs.h"
|
||||
#include "base/unique_ptr.h"
|
||||
@ -164,7 +164,7 @@ void PreviewCliDelegate::loadPalette(Context* ctx,
|
||||
<< " - Palette: '" << filename << "'\n";
|
||||
}
|
||||
|
||||
void PreviewCliDelegate::exportFiles(Context* ctx, DocumentExporter& exporter)
|
||||
void PreviewCliDelegate::exportFiles(Context* ctx, DocExporter& exporter)
|
||||
{
|
||||
std::string type = "None";
|
||||
switch (exporter.spriteSheetType()) {
|
||||
@ -188,8 +188,8 @@ void PreviewCliDelegate::exportFiles(Context* ctx, DocumentExporter& exporter)
|
||||
if (!exporter.dataFilename().empty()) {
|
||||
std::string format = "Unknown";
|
||||
switch (exporter.dataFormat()) {
|
||||
case DocumentExporter::JsonHashDataFormat: format = "JSON Hash"; break;
|
||||
case DocumentExporter::JsonArrayDataFormat: format = "JSON Array"; break;
|
||||
case DocExporter::JsonHashDataFormat: format = "JSON Hash"; break;
|
||||
case DocExporter::JsonArrayDataFormat: format = "JSON Array"; break;
|
||||
}
|
||||
std::cout << " - Save data file: '" << exporter.dataFilename() << "'\n"
|
||||
<< " - Data format: " << format << "\n";
|
||||
|
@ -25,7 +25,7 @@ namespace app {
|
||||
void loadPalette(Context* ctx,
|
||||
const CliOpenFile& cof,
|
||||
const std::string& filename) override;
|
||||
void exportFiles(Context* ctx, DocumentExporter& exporter) override;
|
||||
void exportFiles(Context* ctx, DocExporter& exporter) override;
|
||||
void execScript(const std::string& filename) override;
|
||||
|
||||
private:
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "app/context.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/doc.h"
|
||||
#include "app/document_exporter.h"
|
||||
#include "app/doc_exporter.h"
|
||||
#include "app/file/file.h"
|
||||
#include "app/file_selector.h"
|
||||
#include "app/i18n/strings.h"
|
||||
@ -329,11 +329,11 @@ public:
|
||||
return std::string();
|
||||
}
|
||||
|
||||
DocumentExporter::DataFormat dataFormatValue() const {
|
||||
DocExporter::DataFormat dataFormatValue() const {
|
||||
if (dataEnabled()->isSelected())
|
||||
return DocumentExporter::DataFormat(dataFormat()->getSelectedItemIndex());
|
||||
return DocExporter::DataFormat(dataFormat()->getSelectedItemIndex());
|
||||
else
|
||||
return DocumentExporter::DefaultDataFormat;
|
||||
return DocExporter::DefaultDataFormat;
|
||||
}
|
||||
|
||||
int borderPaddingValue() const {
|
||||
@ -679,7 +679,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();
|
||||
DocExporter::DataFormat dataFormat = docPref.spriteSheet.dataFormat();
|
||||
std::string layerName = docPref.spriteSheet.layer();
|
||||
std::string frameTagName = docPref.spriteSheet.frameTag();
|
||||
int borderPadding = docPref.spriteSheet.borderPadding();
|
||||
@ -756,7 +756,7 @@ void ExportSpriteSheetCommand::onExecute(Context* context)
|
||||
if (sheet_w == 0) sheet_w = fit.width;
|
||||
if (sheet_h == 0) sheet_h = fit.height;
|
||||
|
||||
DocumentExporter exporter;
|
||||
DocExporter exporter;
|
||||
if (!filename.empty())
|
||||
exporter.setTextureFilename(filename);
|
||||
if (!dataFilename.empty()) {
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "app/document_exporter.h"
|
||||
#include "app/doc_exporter.h"
|
||||
|
||||
#include "app/cmd/set_pixel_format.h"
|
||||
#include "app/console.h"
|
||||
@ -111,7 +111,7 @@ private:
|
||||
|
||||
typedef base::SharedPtr<SampleBounds> SampleBoundsPtr;
|
||||
|
||||
DocumentExporter::Item::Item(Doc* doc,
|
||||
DocExporter::Item::Item(Doc* doc,
|
||||
doc::FrameTag* frameTag,
|
||||
doc::SelectedLayers* selLayers,
|
||||
doc::SelectedFrames* selFrames)
|
||||
@ -122,7 +122,7 @@ DocumentExporter::Item::Item(Doc* doc,
|
||||
{
|
||||
}
|
||||
|
||||
DocumentExporter::Item::Item(Item&& other)
|
||||
DocExporter::Item::Item(Item&& other)
|
||||
: doc(other.doc)
|
||||
, frameTag(other.frameTag)
|
||||
, selLayers(other.selLayers)
|
||||
@ -132,13 +132,13 @@ DocumentExporter::Item::Item(Item&& other)
|
||||
other.selFrames = nullptr;
|
||||
}
|
||||
|
||||
DocumentExporter::Item::~Item()
|
||||
DocExporter::Item::~Item()
|
||||
{
|
||||
delete selLayers;
|
||||
delete selFrames;
|
||||
}
|
||||
|
||||
int DocumentExporter::Item::frames() const
|
||||
int DocExporter::Item::frames() const
|
||||
{
|
||||
if (selFrames)
|
||||
return selFrames->size();
|
||||
@ -150,7 +150,7 @@ int DocumentExporter::Item::frames() const
|
||||
return doc->sprite()->totalFrames();
|
||||
}
|
||||
|
||||
doc::frame_t DocumentExporter::Item::firstFrame() const
|
||||
doc::frame_t DocExporter::Item::firstFrame() const
|
||||
{
|
||||
if (selFrames)
|
||||
return selFrames->firstFrame();
|
||||
@ -160,7 +160,7 @@ doc::frame_t DocumentExporter::Item::firstFrame() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
doc::SelectedFrames DocumentExporter::Item::getSelectedFrames() const
|
||||
doc::SelectedFrames DocExporter::Item::getSelectedFrames() const
|
||||
{
|
||||
if (selFrames)
|
||||
return *selFrames;
|
||||
@ -176,7 +176,7 @@ doc::SelectedFrames DocumentExporter::Item::getSelectedFrames() const
|
||||
return frames;
|
||||
}
|
||||
|
||||
class DocumentExporter::Sample {
|
||||
class DocExporter::Sample {
|
||||
public:
|
||||
Sample(Doc* document, Sprite* sprite, SelectedLayers* selLayers,
|
||||
frame_t frame, const std::string& filename, int innerPadding) :
|
||||
@ -239,7 +239,7 @@ private:
|
||||
bool m_isDuplicated;
|
||||
};
|
||||
|
||||
class DocumentExporter::Samples {
|
||||
class DocExporter::Samples {
|
||||
public:
|
||||
typedef std::list<Sample> List;
|
||||
typedef List::iterator iterator;
|
||||
@ -260,14 +260,14 @@ private:
|
||||
List m_samples;
|
||||
};
|
||||
|
||||
class DocumentExporter::LayoutSamples {
|
||||
class DocExporter::LayoutSamples {
|
||||
public:
|
||||
virtual ~LayoutSamples() { }
|
||||
virtual void layoutSamples(Samples& samples, int borderPadding, int shapePadding, int& width, int& height) = 0;
|
||||
};
|
||||
|
||||
class DocumentExporter::SimpleLayoutSamples :
|
||||
public DocumentExporter::LayoutSamples {
|
||||
class DocExporter::SimpleLayoutSamples :
|
||||
public DocExporter::LayoutSamples {
|
||||
public:
|
||||
SimpleLayoutSamples(SpriteSheetType type)
|
||||
: m_type(type) {
|
||||
@ -357,8 +357,8 @@ private:
|
||||
SpriteSheetType m_type;
|
||||
};
|
||||
|
||||
class DocumentExporter::BestFitLayoutSamples :
|
||||
public DocumentExporter::LayoutSamples {
|
||||
class DocExporter::BestFitLayoutSamples :
|
||||
public DocExporter::LayoutSamples {
|
||||
public:
|
||||
void layoutSamples(Samples& samples, int borderPadding, int shapePadding, int& width, int& height) override {
|
||||
gfx::PackingRects pr;
|
||||
@ -393,7 +393,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
DocumentExporter::DocumentExporter()
|
||||
DocExporter::DocExporter()
|
||||
: m_dataFormat(DefaultDataFormat)
|
||||
, m_textureWidth(0)
|
||||
, m_textureHeight(0)
|
||||
@ -409,7 +409,7 @@ DocumentExporter::DocumentExporter()
|
||||
{
|
||||
}
|
||||
|
||||
Doc* DocumentExporter::exportSheet(Context* ctx)
|
||||
Doc* DocExporter::exportSheet(Context* ctx)
|
||||
{
|
||||
// We output the metadata to std::cout if the user didn't specify a file.
|
||||
std::ofstream fos;
|
||||
@ -463,7 +463,7 @@ Doc* DocumentExporter::exportSheet(Context* ctx)
|
||||
return textureDocument.release();
|
||||
}
|
||||
|
||||
gfx::Size DocumentExporter::calculateSheetSize()
|
||||
gfx::Size DocExporter::calculateSheetSize()
|
||||
{
|
||||
Samples samples;
|
||||
captureSamples(samples);
|
||||
@ -471,7 +471,7 @@ gfx::Size DocumentExporter::calculateSheetSize()
|
||||
return calculateSheetSize(samples);
|
||||
}
|
||||
|
||||
void DocumentExporter::captureSamples(Samples& samples)
|
||||
void DocExporter::captureSamples(Samples& samples)
|
||||
{
|
||||
for (auto& item : m_documents) {
|
||||
Doc* doc = item.doc;
|
||||
@ -597,7 +597,7 @@ void DocumentExporter::captureSamples(Samples& samples)
|
||||
}
|
||||
}
|
||||
|
||||
void DocumentExporter::layoutSamples(Samples& samples)
|
||||
void DocExporter::layoutSamples(Samples& samples)
|
||||
{
|
||||
switch (m_sheetType) {
|
||||
case SpriteSheetType::Packed: {
|
||||
@ -617,7 +617,7 @@ void DocumentExporter::layoutSamples(Samples& samples)
|
||||
}
|
||||
}
|
||||
|
||||
gfx::Size DocumentExporter::calculateSheetSize(const Samples& samples) const
|
||||
gfx::Size DocExporter::calculateSheetSize(const Samples& samples) const
|
||||
{
|
||||
gfx::Rect fullTextureBounds(0, 0, m_textureWidth, m_textureHeight);
|
||||
|
||||
@ -640,7 +640,7 @@ gfx::Size DocumentExporter::calculateSheetSize(const Samples& samples) const
|
||||
|
||||
// If the user didn't specified the sprite sheet size, the border is
|
||||
// added right here (the left/top border padding should be added by
|
||||
// the DocumentExporter::LayoutSamples() impl).
|
||||
// the DocExporter::LayoutSamples() impl).
|
||||
if (m_textureWidth == 0) fullTextureBounds.w += m_borderPadding;
|
||||
if (m_textureHeight == 0) fullTextureBounds.h += m_borderPadding;
|
||||
|
||||
@ -648,7 +648,7 @@ gfx::Size DocumentExporter::calculateSheetSize(const Samples& samples) const
|
||||
fullTextureBounds.y+fullTextureBounds.h);
|
||||
}
|
||||
|
||||
Doc* DocumentExporter::createEmptyTexture(const Samples& samples) const
|
||||
Doc* DocExporter::createEmptyTexture(const Samples& samples) const
|
||||
{
|
||||
PixelFormat pixelFormat = IMAGE_INDEXED;
|
||||
Palette* palette = nullptr;
|
||||
@ -693,7 +693,7 @@ Doc* DocumentExporter::createEmptyTexture(const Samples& samples) const
|
||||
return document.release();
|
||||
}
|
||||
|
||||
void DocumentExporter::renderTexture(Context* ctx, const Samples& samples, Image* textureImage) const
|
||||
void DocExporter::renderTexture(Context* ctx, const Samples& samples, Image* textureImage) const
|
||||
{
|
||||
textureImage->clear(0);
|
||||
|
||||
@ -720,7 +720,7 @@ void DocumentExporter::renderTexture(Context* ctx, const Samples& samples, Image
|
||||
}
|
||||
}
|
||||
|
||||
void DocumentExporter::createDataFile(const Samples& samples, std::ostream& os, Image* textureImage)
|
||||
void DocExporter::createDataFile(const Samples& samples, std::ostream& os, Image* textureImage)
|
||||
{
|
||||
std::string frames_begin;
|
||||
std::string frames_end;
|
||||
@ -963,7 +963,7 @@ void DocumentExporter::createDataFile(const Samples& samples, std::ostream& os,
|
||||
<< "}\n";
|
||||
}
|
||||
|
||||
void DocumentExporter::renderSample(const Sample& sample, doc::Image* dst, int x, int y) const
|
||||
void DocExporter::renderSample(const Sample& sample, doc::Image* dst, int x, int y) const
|
||||
{
|
||||
gfx::Clip clip(x, y, sample.trimmedBounds());
|
||||
|
@ -4,8 +4,8 @@
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
|
||||
#ifndef APP_DOCUMENT_EXPORTER_H_INCLUDED
|
||||
#define APP_DOCUMENT_EXPORTER_H_INCLUDED
|
||||
#ifndef APP_DOC_EXPORTER_H_INCLUDED
|
||||
#define APP_DOC_EXPORTER_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "app/sprite_sheet_type.h"
|
||||
@ -33,7 +33,7 @@ namespace app {
|
||||
class Context;
|
||||
class Doc;
|
||||
|
||||
class DocumentExporter {
|
||||
class DocExporter {
|
||||
public:
|
||||
enum DataFormat {
|
||||
JsonHashDataFormat,
|
||||
@ -41,7 +41,7 @@ namespace app {
|
||||
DefaultDataFormat = JsonHashDataFormat
|
||||
};
|
||||
|
||||
DocumentExporter();
|
||||
DocExporter();
|
||||
|
||||
DataFormat dataFormat() const { return m_dataFormat; }
|
||||
const std::string& dataFilename() { return m_dataFilename; }
|
||||
@ -146,7 +146,7 @@ namespace app {
|
||||
// will not be exported at all in the final result.
|
||||
std::map<doc::ObjectId, std::pair<int, int> > m_tagDelta;
|
||||
|
||||
DISABLE_COPYING(DocumentExporter);
|
||||
DISABLE_COPYING(DocExporter);
|
||||
};
|
||||
|
||||
} // namespace app
|
@ -10,8 +10,8 @@
|
||||
|
||||
#include "app/color.h"
|
||||
#include "app/commands/filters/cels_target.h"
|
||||
#include "app/doc_exporter.h"
|
||||
#include "app/docs_observer.h"
|
||||
#include "app/document_exporter.h"
|
||||
#include "app/pref/option.h"
|
||||
#include "app/sprite_sheet_type.h"
|
||||
#include "app/tools/freehand_algorithm.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user