improve to_json(StyleP)

This commit is contained in:
GenevensiS
2026-01-17 07:55:34 +01:00
parent a741a4d26d
commit 28d5993fe6
13 changed files with 637 additions and 150 deletions
+10 -4
View File
@@ -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();