X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fsynfig%2Flayer_composite.cpp;h=7381017d1c8bbff65af557c63f80243a16180784;hb=0d270efd0dd73dad0077a76ab0b5408510ab1151;hp=8a4188e0717c625536ae2975e6ecd7728af9256b;hpb=cc54c38609ee9745ad678e5e9b9d7d2912be9c95;p=synfig.git diff --git a/synfig-core/trunk/src/synfig/layer_composite.cpp b/synfig-core/trunk/src/synfig/layer_composite.cpp index 8a4188e..7381017 100644 --- a/synfig-core/trunk/src/synfig/layer_composite.cpp +++ b/synfig-core/trunk/src/synfig/layer_composite.cpp @@ -150,11 +150,22 @@ Layer_Composite::get_param_vocab()const bool Layer_Composite::set_param(const String & param, const ValueBase &value) { - if(param=="amount" && value.same_as(amount_)) + if(param=="amount" && value.same_type_as(amount_)) amount_=value.get(amount_); else - if(param=="blend_method" && value.same_as(int())) - blend_method_=static_cast(value.get(int())); + if(param=="blend_method" && value.same_type_as(int())) + { + Color::BlendMethod blend_method = static_cast(value.get(int())); + + if (blend_method < 0 || blend_method >= Color::BLEND_END) + { + warning("illegal value (%d) for blend_method - using Composite instead", blend_method); + blend_method_ = Color::BLEND_COMPOSITE; + return false; + } + + blend_method_ = blend_method; + } else return Layer::set_param(param,value); return true;