added native look editor and the set info panel

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@82 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-11-20 17:26:34 +00:00
parent 141400d8aa
commit 3cbf2577c1
32 changed files with 458 additions and 48 deletions
+23
View File
@@ -10,6 +10,7 @@
#include <script/context.hpp>
#include <util/dynamic_arg.hpp>
#include <util/io/package.hpp>
#include <gui/util.hpp> // load_resource_image
// image generating functions have two modes
// if last_update_age > 0 they return whether the image is still up to date
@@ -59,6 +60,10 @@ bool script_image_up_to_date(const ScriptValueP& value) {
// ----------------------------------------------------------------------------- : ScriptableImage
ScriptableImage::ScriptableImage(const String& script_)
: script(script_)
{}
ScriptImageP ScriptableImage::generate(Context& ctx, Package& pkg) const {
try {
WITH_DYNAMIC_ARG(load_images_from, &pkg);
@@ -200,3 +205,21 @@ SCRIPT_FUNCTION(set_mask) {
);
}
}
SCRIPT_FUNCTION(buildin_image) {
if (last_update_age() == 0) {
SCRIPT_PARAM(String, input);
Image img = load_resource_image(input);
if (!img.Ok()) throw ScriptError(_("There is no build in image '") + input + _("'"));
return new_intrusive1<ScriptImage>(img);
} else {
SCRIPT_RETURN(true);
}
}
void init_script_image_functions(Context& ctx) {
ctx.setVariable(_("linear blend"), script_linear_blend);
ctx.setVariable(_("masked blend"), script_masked_blend);
ctx.setVariable(_("set mask"), script_set_mask);
ctx.setVariable(_("buildin image"), script_buildin_image);
}