mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
fixed import_image not generating in CLI
This commit is contained in:
@@ -408,6 +408,7 @@ public:
|
||||
Image generate(const Options&) const override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
inline String toString() { return filepath; }
|
||||
inline String ExternalImage::toCode() const override { return "<image>"; }
|
||||
private:
|
||||
String filepath;
|
||||
};
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <data/format/formats.hpp>
|
||||
#include <gfx/generated_image.hpp>
|
||||
#include <render/symbol/filter.hpp>
|
||||
#include <cli/text_io_handler.hpp> // for MSE_CLI
|
||||
|
||||
void parse_enum(const String&, ImageCombine& out);
|
||||
|
||||
@@ -45,8 +46,12 @@ SCRIPT_FUNCTION(to_card_image) {
|
||||
}
|
||||
|
||||
SCRIPT_FUNCTION(import_image) {
|
||||
SCRIPT_PARAM(Set*, set);
|
||||
SCRIPT_PARAM(String, path);
|
||||
return make_intrusive<ExternalImage>(path);
|
||||
auto extImg = make_intrusive<ExternalImage>(path);
|
||||
if (cli.haveConsole()) // makes sure generate() is called, but only once, when using the CLI
|
||||
extImg->generate(GeneratedImage::Options(0, 0, set->stylesheet.get(), set));
|
||||
return extImg;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Image functions
|
||||
|
||||
Reference in New Issue
Block a user