mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
improve to_json(StyleP)
This commit is contained in:
+10
-4
@@ -42,15 +42,21 @@ ImageCombine ScriptableImage::combine() const {
|
||||
}
|
||||
|
||||
bool ScriptableImage::update(Context& ctx) {
|
||||
if (!isScripted()) return false;
|
||||
GeneratedImageP new_value = script.invoke(ctx)->toImage();
|
||||
if (!isScripted()) return false;
|
||||
ScriptValueP eval = script.invoke(ctx);
|
||||
GeneratedImageP new_value = eval->toImage();
|
||||
if (!new_value || !value || *new_value != *value) {
|
||||
value = new_value;
|
||||
value = new_value;
|
||||
ScriptType type = eval->type();
|
||||
if (type == SCRIPT_NIL) scriptString = _("<nil>");
|
||||
else if (type == SCRIPT_STRING) scriptString = eval->toString();
|
||||
else if (type == SCRIPT_IMAGE) scriptString = _("<image from script>");
|
||||
else scriptString = _("<unknown>");
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScriptP ScriptableImage::getValidScriptP() {
|
||||
if (script) return script.getScriptP();
|
||||
|
||||
Reference in New Issue
Block a user