Merge branch 'genete_static_values'
authorCarlos Lopez <genetita@gmail.com>
Wed, 1 Sep 2010 15:32:44 +0000 (17:32 +0200)
committerCarlos Lopez <genetita@gmail.com>
Wed, 1 Sep 2010 15:32:44 +0000 (17:32 +0200)
70 files changed:
synfig-core/src/modules/lyr_freetype/lyr_freetype.cpp
synfig-core/src/modules/lyr_std/bevel.cpp
synfig-core/src/modules/lyr_std/clamp.cpp
synfig-core/src/modules/lyr_std/curvewarp.cpp
synfig-core/src/modules/lyr_std/import.cpp
synfig-core/src/modules/lyr_std/insideout.cpp
synfig-core/src/modules/lyr_std/julia.cpp
synfig-core/src/modules/lyr_std/mandelbrot.cpp
synfig-core/src/modules/lyr_std/rotate.cpp
synfig-core/src/modules/lyr_std/shade.cpp
synfig-core/src/modules/lyr_std/sphere_distort.cpp
synfig-core/src/modules/lyr_std/stretch.cpp
synfig-core/src/modules/lyr_std/supersample.cpp
synfig-core/src/modules/lyr_std/timeloop.cpp
synfig-core/src/modules/lyr_std/translate.cpp
synfig-core/src/modules/lyr_std/twirl.cpp
synfig-core/src/modules/lyr_std/warp.cpp
synfig-core/src/modules/lyr_std/xorpattern.cpp
synfig-core/src/modules/lyr_std/zoom.cpp
synfig-core/src/modules/mod_example/filledrect.cpp
synfig-core/src/modules/mod_example/metaballs.cpp
synfig-core/src/modules/mod_example/simplecircle.cpp
synfig-core/src/modules/mod_filter/blur.cpp
synfig-core/src/modules/mod_filter/colorcorrect.cpp
synfig-core/src/modules/mod_filter/halftone2.cpp
synfig-core/src/modules/mod_filter/halftone3.cpp
synfig-core/src/modules/mod_filter/lumakey.cpp
synfig-core/src/modules/mod_filter/radialblur.cpp
synfig-core/src/modules/mod_geometry/checkerboard.cpp
synfig-core/src/modules/mod_geometry/circle.cpp
synfig-core/src/modules/mod_geometry/outline.cpp
synfig-core/src/modules/mod_geometry/rectangle.cpp
synfig-core/src/modules/mod_geometry/star.cpp
synfig-core/src/modules/mod_gradient/conicalgradient.cpp
synfig-core/src/modules/mod_gradient/curvegradient.cpp
synfig-core/src/modules/mod_gradient/lineargradient.cpp
synfig-core/src/modules/mod_gradient/radialgradient.cpp
synfig-core/src/modules/mod_gradient/spiralgradient.cpp
synfig-core/src/modules/mod_noise/distort.cpp
synfig-core/src/modules/mod_noise/noise.cpp
synfig-core/src/modules/mod_particle/plant.cpp
synfig-core/src/synfig/layer.cpp
synfig-core/src/synfig/layer.h
synfig-core/src/synfig/layer_bitmap.cpp
synfig-core/src/synfig/layer_composite.cpp
synfig-core/src/synfig/layer_composite.h
synfig-core/src/synfig/layer_motionblur.cpp
synfig-core/src/synfig/layer_pastecanvas.cpp
synfig-core/src/synfig/layer_pastecanvas.h
synfig-core/src/synfig/layer_polygon.cpp
synfig-core/src/synfig/layer_solidcolor.cpp
synfig-core/src/synfig/loadcanvas.cpp
synfig-core/src/synfig/loadcanvas.h
synfig-core/src/synfig/savecanvas.cpp
synfig-core/src/synfig/value.cpp
synfig-core/src/synfig/value.h
synfig-core/src/synfig/valuenode_const.cpp
synfig-core/src/synfig/valuenode_const.h
synfig-studio/src/gui/trees/canvastreestore.cpp
synfig-studio/src/synfigapp/Makefile.am
synfig-studio/src/synfigapp/action.cpp
synfig-studio/src/synfigapp/actions/layerparamsetstatic.cpp [new file with mode: 0644]
synfig-studio/src/synfigapp/actions/layerparamsetstatic.h [new file with mode: 0644]
synfig-studio/src/synfigapp/actions/layerparamunsetstatic.cpp [new file with mode: 0644]
synfig-studio/src/synfigapp/actions/layerparamunsetstatic.h [new file with mode: 0644]
synfig-studio/src/synfigapp/actions/valuedescset.cpp
synfig-studio/src/synfigapp/actions/valuenodeconstsetstatic.cpp [new file with mode: 0644]
synfig-studio/src/synfigapp/actions/valuenodeconstsetstatic.h [new file with mode: 0644]
synfig-studio/src/synfigapp/actions/valuenodeconstunsetstatic.cpp [new file with mode: 0644]
synfig-studio/src/synfigapp/actions/valuenodeconstunsetstatic.h [new file with mode: 0644]

index 2da592a..06d0f92 100644 (file)
@@ -109,6 +109,8 @@ Layer_Freetype::Layer_Freetype()
        new_font(family,style,weight);
 
        invert=false;
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 Layer_Freetype::~Layer_Freetype()
index dacf270..7821833 100644 (file)
@@ -89,6 +89,8 @@ Layer_Bevel::Layer_Bevel():
        calc_offset();
        use_luma=false;
        solid=false;
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 void
index 14b4c41..eafb048 100644 (file)
@@ -68,6 +68,8 @@ Layer_Clamp::Layer_Clamp():
        ceiling(1.0f),
        floor(0.0f)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 inline Color
index 82c213d..131cef0 100644 (file)
@@ -169,6 +169,8 @@ CurveWarp::CurveWarp():
        bline[1].set_width(1.0f);
 
        sync();
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 inline Point
index 567f756..d37eecf 100644 (file)
@@ -67,6 +67,8 @@ SYNFIG_LAYER_SET_CVS_ID(Import,"$Id$");
 Import::Import()
 {
        time_offset=0;
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 Import::~Import()
@@ -86,6 +88,7 @@ Import::set_param(const String & param, const ValueBase &value)
        IMPORT(time_offset);
        if(param=="filename" && value.same_type_as(filename))
        {
+               set_param_static(param, value.get_static());
                if(!get_canvas())
                {
                        filename=value.get(filename);
@@ -187,8 +190,11 @@ Import::get_param(const String & param)const
        {
                if(param=="filename")
                {
+                       ValueBase ret(ValueBase::TYPE_STRING);
+                       ret.set_static(get_param_static(param));
                        string curpath(cleanup_path(absolute_path(get_canvas()->get_file_path())));
-                       return relative_path(curpath,abs_filename);
+                       ret=relative_path(curpath,abs_filename);
+                       return ret;
                }
        }
        else
index 1ed9c2c..8dd633e 100644 (file)
@@ -64,6 +64,8 @@ SYNFIG_LAYER_SET_CVS_ID(InsideOut,"$Id$");
 InsideOut::InsideOut():
        origin(0,0)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 bool
index ad2478e..4061b28 100644 (file)
@@ -118,6 +118,8 @@ Julia::Julia():color_shift(angle::degrees(0))
 
        bailout=4;
        lp=log(log(bailout));
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 bool
@@ -144,6 +146,7 @@ Julia::set_param(const String & param, const ValueBase &value)
        IMPORT(smooth_outside);
        IMPORT(broken);
 
+// TODO: Use IMPORT_PLUS
        if(param=="iterations" && value.same_type_as(iterations))
        {
                iterations=value.get(iterations);
@@ -151,6 +154,7 @@ Julia::set_param(const String & param, const ValueBase &value)
                        iterations=0;
                if(iterations>500000)
                        iterations=500000;
+               set_param_static(param, value.get_static());
                return true;
        }
        if(param=="bailout" && value.same_type_as(bailout))
@@ -158,6 +162,7 @@ Julia::set_param(const String & param, const ValueBase &value)
                bailout=value.get(bailout);
                bailout*=bailout;
                lp=log(log(bailout));
+               set_param_static(param, value.get_static());
                return true;
        }
 
@@ -188,7 +193,11 @@ Julia::get_param(const String & param)const
        EXPORT(broken);
 
        if(param=="bailout")
-               return sqrt(bailout);
+       {
+               ValueBase ret(sqrt(bailout));
+               ret.set_static(get_param_static(param));
+               return ret;
+       }
 
        EXPORT_NAME();
        EXPORT_VERSION();
index bacbbda..9e7e4bd 100644 (file)
@@ -119,6 +119,9 @@ Mandelbrot::Mandelbrot():
 
        bailout=4;
        lp=log(log(bailout));
+
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 bool
@@ -147,6 +150,7 @@ Mandelbrot::set_param(const String & param, const ValueBase &value)
        IMPORT(gradient_inside);
        IMPORT(gradient_outside);
 
+// TODO: Use IMPORT_PLUS
        if(param=="iterations" && value.same_type_as(iterations))
        {
                iterations=value.get(iterations);
@@ -154,6 +158,7 @@ Mandelbrot::set_param(const String & param, const ValueBase &value)
                        iterations=0;
                if(iterations>500000)
                        iterations=500000;
+               set_param_static(param, value.get_static());
                return true;
        }
        if(param=="bailout" && value.same_type_as(bailout))
@@ -161,6 +166,7 @@ Mandelbrot::set_param(const String & param, const ValueBase &value)
                bailout=value.get(bailout);
                bailout*=bailout;
                lp=log(log(bailout));
+               set_param_static(param, value.get_static());
                return true;
        }
 
@@ -195,7 +201,11 @@ Mandelbrot::get_param(const String & param)const
        EXPORT(gradient_outside);
 
        if(param=="bailout")
-               return sqrt(bailout);
+       {
+               ValueBase ret(sqrt(bailout));
+               ret.set_static(get_param_static(param));
+               return ret;
+       }
 
        EXPORT_NAME();
        EXPORT_VERSION();
index fd13f92..569e903 100644 (file)
@@ -69,6 +69,8 @@ Rotate::Rotate():
        sin_val (0),
        cos_val (1)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 Rotate::~Rotate()
@@ -85,6 +87,7 @@ Rotate::set_param(const String & param, const ValueBase &value)
                amount=value.get(amount);
                sin_val=Angle::sin(amount).get();
                cos_val=Angle::cos(amount).get();
+               set_param_static(param, value.get_static());
                return true;
        }
 
index 4ab3917..d0f0686 100644 (file)
@@ -84,6 +84,8 @@ Layer_Shade::Layer_Shade():
        origin(0.2,-0.2),
        invert(false)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 bool
index 9c0003e..5786a46 100644 (file)
@@ -87,6 +87,8 @@ percent(1.0),
 type(TYPE_NORMAL),
 clip(false)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 
index 0f1c37d..65ae87f 100644 (file)
@@ -68,6 +68,8 @@ Layer_Stretch::Layer_Stretch():
        amount(1,1),
        center(0,0)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 
index 608a242..27c8c13 100644 (file)
@@ -65,6 +65,8 @@ SuperSample::SuperSample():width(2),height(2)
 {
        scanline=false;
        alpha_aware=true;
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 bool
index 4306c4a..f896af0 100644 (file)
@@ -71,6 +71,8 @@ Layer_TimeLoop::Layer_TimeLoop()
        link_time=0;
        local_time=0;
        duration=1;
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 Layer_TimeLoop::~Layer_TimeLoop()
index b0f65db..68f5d5f 100644 (file)
@@ -64,6 +64,8 @@ SYNFIG_LAYER_SET_CVS_ID(Translate,"$Id$");
 
 Translate::Translate():origin(0,0)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 Translate::~Translate()
index 38d2097..89a4785 100644 (file)
@@ -71,6 +71,8 @@ Twirl::Twirl():
        distort_inside(true),
        distort_outside(false)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 bool
index f11c290..729272e 100644 (file)
@@ -74,6 +74,8 @@ Warp::Warp():
 {
        sync();
        horizon=4;
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 Warp::~Warp()
index 4d2a394..1335514 100644 (file)
@@ -65,6 +65,8 @@ XORPattern::XORPattern():
        origin(0.125,0.125),
        size(0.25,0.25)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 bool
index ff73c4c..c4efd73 100644 (file)
@@ -63,6 +63,8 @@ Zoom::Zoom():
        center(0,0),
        amount(0)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 bool
index 663c0db..d78f45e 100644 (file)
@@ -75,6 +75,8 @@ FilledRect::FilledRect():
        bevel(0),
        bevCircle(0)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 bool
index 6d79e68..44ef9ec 100644 (file)
@@ -74,6 +74,8 @@ Metaballs::Metaballs():
        centers.push_back(Point( 0, -1.5));     radii.push_back(2.5);   weights.push_back(1);
        centers.push_back(Point(-2,  1));       radii.push_back(2.5);   weights.push_back(1);
        centers.push_back(Point( 2,  1));       radii.push_back(2.5);   weights.push_back(1);
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 bool
index f6fc8ef..2269cbe 100644 (file)
@@ -70,6 +70,8 @@ SimpleCircle::SimpleCircle():
        center(0,0),
        radius(0.5)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 bool
index f3af3ea..35ee6f7 100644 (file)
@@ -82,6 +82,9 @@ Blur_Layer::Blur_Layer():
        size(0.1,0.1),
        type(Blur::FASTGAUSSIAN)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
+       set_param_static("blend_method", true);
 }
 
 bool
index 3a0468e..f595db2 100644 (file)
@@ -68,6 +68,8 @@ Layer_ColorCorrect::Layer_ColorCorrect():
        contrast(1.0),
        exposure(0.0)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 inline Color
@@ -172,6 +174,7 @@ Layer_ColorCorrect::set_param(const String & param, const ValueBase &value)
        if(param=="gamma" && value.get_type()==ValueBase::TYPE_REAL)
        {
                gamma.set_gamma(1.0/value.get(Real()));
+               set_param_static(param, value.get_static());
                return true;
        }
        return false;
@@ -186,7 +189,11 @@ Layer_ColorCorrect::get_param(const String &param)const
        EXPORT(exposure);
 
        if(param=="gamma")
-               return 1.0/gamma.get_gamma();
+       {
+               ValueBase ret(1.0/gamma.get_gamma());
+               ret.set_static(get_param_static(param));
+               return ret;
+       }
 
        EXPORT_NAME();
        EXPORT_VERSION();
index 177f6a0..f4f29da 100644 (file)
@@ -73,6 +73,9 @@ Halftone2::Halftone2():
        halftone.type=TYPE_SYMMETRIC;
 
        set_blend_method(Color::BLEND_STRAIGHT);
+
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 inline Color
index a2a4283..8b9c841 100644 (file)
@@ -101,6 +101,9 @@ Halftone3::Halftone3()
                        inverse_matrix[i][j]=(j==i)?1.0f:0.0f;
 
        sync();
+
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 void
index 9b30808..f468c2a 100644 (file)
@@ -67,6 +67,8 @@ LumaKey::LumaKey():
        Layer_Composite (1.0,Color::BLEND_STRAIGHT)
 {
        set_blend_method(Color::BLEND_STRAIGHT);
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 
index 2d018a6..7d93fd3 100644 (file)
@@ -69,6 +69,9 @@ RadialBlur::RadialBlur():
        size    (0.2),
        fade_out(false)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
+       set_param_static("blend_method",true);
 }
 
 RadialBlur::~RadialBlur()
index d195bc0..2389e01 100644 (file)
@@ -68,7 +68,10 @@ CheckerBoard::CheckerBoard():
        color                   (Color::black()),
        origin                  (Point(0.125,0.125)),
        size                    (Point(0.25,0.25))
-{}
+{
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
+}
 
 inline bool
 CheckerBoard::point_test(const synfig::Point& getpos)const
index d8f51a7..5c8d059 100644 (file)
@@ -69,6 +69,8 @@ Circle::Circle():
        falloff                 (FALLOFF_INTERPOLATION_LINEAR)
 {
        constructcache();
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 bool
index e84effb..17e7867 100644 (file)
@@ -161,6 +161,9 @@ Outline::Outline()
        bline=bline_point_list;
 
        needs_sync=true;
+
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 
index ef096f7..ee50b80 100644 (file)
@@ -82,6 +82,8 @@ Rectangle::Rectangle():
        expand(0),
        invert(false)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 bool
index cb1d8e6..d28c8c8 100644 (file)
@@ -78,6 +78,8 @@ Star::Star():
        regular_polygon(false)
 {
        sync();
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 void
@@ -106,6 +108,7 @@ Star::set_param(const String & param, const ValueBase &value)
        {
                value.put(&radius1);
                sync();
+               set_param_static(param, value.get_static());
                return true;
        }
 
@@ -113,6 +116,7 @@ Star::set_param(const String & param, const ValueBase &value)
        {
                value.put(&radius2);
                sync();
+               set_param_static(param, value.get_static());
                return true;
        }
 
@@ -121,6 +125,7 @@ Star::set_param(const String & param, const ValueBase &value)
                value.put(&points);
                if(points<2)points=2;
                sync();
+               set_param_static(param, value.get_static());
                return true;
        }
 
@@ -128,6 +133,7 @@ Star::set_param(const String & param, const ValueBase &value)
        {
                value.put(&angle);
                sync();
+               set_param_static(param, value.get_static());
                return true;
        }
 
@@ -135,6 +141,7 @@ Star::set_param(const String & param, const ValueBase &value)
        {
                value.put(&regular_polygon);
                sync();
+               set_param_static(param, value.get_static());
                return true;
        }
 
index 7657e4c..4916d0f 100644 (file)
@@ -71,6 +71,8 @@ ConicalGradient::ConicalGradient():
        angle(Angle::zero()),
        symmetric(false)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 bool
index 1d7eb89..ec376ba 100644 (file)
@@ -229,6 +229,8 @@ CurveGradient::CurveGradient():
        bline_loop=true;
 
        sync();
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 inline Color
index 19b1299..c47ffad 100644 (file)
@@ -77,6 +77,8 @@ LinearGradient::LinearGradient():
        zigzag(false)
 {
        sync();
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 inline Color
@@ -142,12 +144,14 @@ LinearGradient::set_param(const String & param, const ValueBase &value)
        if(param=="p1" && value.same_type_as(p1))
        {
                p1=value.get(p1);
+               set_param_static(param, value.get_static());
                sync();
                return true;
        }
        if(param=="p2" && value.same_type_as(p2))
        {
                p2=value.get(p2);
+               set_param_static(param, value.get_static());
                sync();
                return true;
        }
index e991200..a9a3bb9 100644 (file)
@@ -72,6 +72,8 @@ RadialGradient::RadialGradient():
        loop(false),
        zigzag(false)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 bool
index ac751c4..3a2fee5 100644 (file)
@@ -71,6 +71,8 @@ SpiralGradient::SpiralGradient():
        angle(Angle::zero()),
        clockwise(false)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 bool
index 1660c7d..c946440 100644 (file)
@@ -72,6 +72,8 @@ NoiseDistort::NoiseDistort():
        random.set_seed(time(NULL));
        turbulent=false;
        displacement=Vector(0.25,0.25);
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 inline Color
@@ -159,6 +161,7 @@ NoiseDistort::set_param(const String & param, const ValueBase &value)
        if(param=="seed" && value.same_type_as(int()))
        {
                random.set_seed(value.get(int()));
+               set_param_static(param, value.get_static());
                return true;
        }
        IMPORT(size);
@@ -174,7 +177,11 @@ ValueBase
 NoiseDistort::get_param(const String & param)const
 {
        if(param=="seed")
-               return random.get_seed();
+       {
+               ValueBase ret(random.get_seed());
+               ret.set_static(get_param_static(param));
+               return ret;
+       }
        EXPORT(size);
        EXPORT(speed);
        EXPORT(smooth);
index 61550f4..e4d5c3b 100644 (file)
@@ -76,6 +76,8 @@ Noise::Noise():
        displacement=Vector(1,1);
        do_displacement=false;
        super_sample=false;
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 
@@ -208,6 +210,7 @@ Noise::set_param(const String & param, const ValueBase &value)
        if(param=="seed" && value.same_type_as(int()))
        {
                random.set_seed(value.get(int()));
+               set_param_static(param, value.get_static());
                return true;
        }
        IMPORT(size);
@@ -226,7 +229,11 @@ ValueBase
 Noise::get_param(const String & param)const
 {
        if(param=="seed")
-               return random.get_seed();
+       {
+               ValueBase ret(random.get_seed());
+               ret.set_static(get_param_static(param));
+               return ret;
+       }
        EXPORT(size);
        EXPORT(speed);
        EXPORT(smooth);
index 47b13a3..7ffdfe3 100644 (file)
@@ -111,6 +111,8 @@ Plant::Plant():
        sync();
        size_as_alpha=false;
        reverse=true;
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 void
@@ -278,13 +280,14 @@ Plant::set_param(const String & param, const ValueBase &value)
                bline=value;
                bline_loop=value.get_loop();
                needs_sync_=true;
-
+               set_param_static(param, value.get_static());
                return true;
        }
        if(param=="seed" && value.same_type_as(int()))
        {
                random.set_seed(value.get(int()));
                needs_sync_=true;
+               set_param_static(param, value.get_static());
                return true;
        }
        IMPORT(origin);
@@ -348,7 +351,11 @@ ValueBase
 Plant::get_param(const String& param)const
 {
        if(param=="seed")
-               return random.get_seed();
+       {
+               ValueBase ret(random.get_seed());
+               ret.set_static(get_param_static(param));
+               return ret;
+       }
        EXPORT(bline);
        EXPORT(origin);
        EXPORT(split_angle);
index 9d1adf3..3569a5a 100644 (file)
@@ -135,10 +135,13 @@ Layer::subsys_stop()
 
 Layer::Layer():
        active_(true),
-       z_depth_(0.0f),
-       dirty_time_(Time::end())
+       z_depth(0.0f),
+       dirty_time_(Time::end())//,
+       //z_depth_static(false)
 {
        _LayerCounter::counter++;
+       Vocab vocab=get_param_vocab();
+       fill_static(vocab);
 }
 
 Layer::LooseHandle
@@ -292,14 +295,45 @@ Layer::on_changed()
 bool
 Layer::set_param(const String &param, const ValueBase &value)
 {
-       if(param=="z_depth" && value.same_type_as(z_depth_))
+       IMPORT(z_depth)
+       return false;
+}
+
+bool
+Layer::set_param_static(const String &param, const bool x)
+{
+       Sparams::iterator iter=static_params.find(param);
+       if(iter!=static_params.end())
        {
-               z_depth_=value.get(z_depth_);
+               iter->second=x;
                return true;
        }
        return false;
 }
 
+
+void Layer::fill_static(Vocab vocab)
+{
+       Vocab::const_iterator viter;
+       for(viter=vocab.begin();viter!=vocab.end();viter++)
+       {
+               if(static_params.find(viter->get_name())==static_params.end())
+                       static_params.insert(make_pair(viter->get_name(),false));
+       }
+}
+
+
+bool
+Layer::get_param_static(const String &param) const
+{
+
+       Sparams::const_iterator iter=static_params.find(param);
+       if(iter!=static_params.end())
+               return iter->second;
+       return false;
+}
+
+
 etl::handle<Transform>
 Layer::get_transform()const
 {
@@ -310,7 +344,7 @@ float
 Layer::get_z_depth(const synfig::Time& t)const
 {
        if(!dynamic_param_list().count("z_depth"))
-               return z_depth_;
+               return z_depth;
        return (*dynamic_param_list().find("z_depth")->second)(t).get(Real());
 }
 
@@ -449,8 +483,11 @@ ValueBase
 Layer::get_param(const String & param)const
 {
        if(param=="z_depth")
-               return get_z_depth();
-
+       {
+               synfig::ValueBase ret(get_z_depth());
+               ret.set_static(get_param_static(param));
+               return ret;
+       }
        return ValueBase();
 }
 
@@ -544,7 +581,7 @@ Layer::get_param_vocab()const
 {
        Layer::Vocab ret;
 
-       ret.push_back(ParamDesc(z_depth_,"z_depth")
+       ret.push_back(ParamDesc(z_depth,"z_depth")
                .set_local_name(_("Z Depth"))
                .set_animation_only(true)
        );
index c002330..a867197 100644 (file)
@@ -81,6 +81,7 @@
        if (param==#x && value.same_type_as(x))                                                                                         \
        {                                                                                                                                                                       \
                value.put(&x);                                                                                                                                  \
+               set_param_static(#x,value.get_static());                                                                                \
                {                                                                                                                                                               \
                        y;                                                                                                                                                      \
                }                                                                                                                                                               \
@@ -92,6 +93,7 @@
        if (param==y && value.same_type_as(x))                                                                                          \
        {                                                                                                                                                                       \
                value.put(&x);                                                                                                                                  \
+               set_param_static(y,value.get_static());                                                                         \
                return true;                                                                                                                                    \
        }
 
 //! Exports a parameter 'x' if param is same type as given 'y'
 #define EXPORT_AS(x,y)                                                                                                                                 \
        if (param==y)                                                                                                                                           \
-               return ValueBase(x);
+       {                                                                                                                                                                       \
+               synfig::ValueBase ret(x);                                                                                                               \
+               ret.set_static(get_param_static(y));                                                                                    \
+               return ret;                                                                                                                                             \
+       }
 
 //! Exports a parameter if it is the same type as value
 #define EXPORT(x)                                                                                                                                              \
 //! This is used as the category for layer book entries which represent aliases of layers.
 //! It prevents these layers showing up in the menu.
 #define CATEGORY_DO_NOT_USE "Do Not Use"
+/*
+//! x=variable name, y=static bool value
+#define SET_STATIC(x,y)                                                                                                                                        \
+       if(param==#x && x ## _static != y)                                                                                                      \
+       {                                                                                                                                                                       \
+               x ## _static = y;                                                                                                                               \
+               return true;                                                                                                                                    \
+       }
+
+#define GET_STATIC(x)                                                                                                                                  \
+       if(param==#x)                                                                                                                                           \
+               return x ## _static;                                                                                                                    \
+*/
 
 /* === T Y P E D E F S ===================================================== */
 
@@ -251,7 +270,11 @@ private:
        String description_;
 
        //! The depth parameter of the layer in the layer stack
-       float z_depth_;
+       float z_depth;
+
+       //! True if zdepth is not affected when in animation mode
+       typedef std::map<String, bool> Sparams;
+       Sparams static_params;
 
        //! \writeme
        mutable Time dirty_time_;
@@ -371,13 +394,13 @@ public:
        int get_depth()const;
 
        //! Gets the non animated z depth of the layer
-       float get_z_depth()const { return z_depth_; }
+       float get_z_depth()const { return z_depth; }
 
        //! Gets the z depth of the layer at a time t
        float get_z_depth(const synfig::Time& t)const;
 
        //! Sets the z depth of the layer (non animated)
-       void set_z_depth(float x) { z_depth_=x; }
+       void set_z_depth(float x) { z_depth=x; }
 
        //! Sets the Canvas that this Layer is a part of
        void set_canvas(etl::loose_handle<Canvas> canvas);
@@ -446,6 +469,10 @@ public:
        */
        virtual bool set_param(const String &param, const ValueBase &value);
 
+       virtual bool set_param_static(const String &param, const bool x);
+       virtual bool get_param_static(const String &param) const;
+       virtual void fill_static(Vocab vocab);
+
        //!     Sets a list of parameters
        virtual bool set_param_list(const ParamList &);
 
index 8443429..7c6511c 100644 (file)
@@ -69,6 +69,9 @@ synfig::Layer_Bitmap::Layer_Bitmap():
        trimmed                 (false),
        gamma_adjust    (1.0)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
+       set_param_static("c", true);
 }
 
 bool
@@ -79,6 +82,7 @@ synfig::Layer_Bitmap::set_param(const String & param, ValueBase value)
        IMPORT(c);
        if(param=="gamma_adjust"&& value.get_type()==ValueBase::TYPE_REAL)
        {
+               set_param_static(param, value.get_static());
                gamma_adjust=1.0/value.get(Real());
                //gamma_adjust.set_gamma(1.0/value.get(Real()));
                return true;
@@ -94,17 +98,31 @@ synfig::Layer_Bitmap::get_param(const String & param)const
        EXPORT(br);
        EXPORT(c);
        if(param=="gamma_adjust")
-               return 1.0/gamma_adjust;
+       {
+               ValueBase ret(1.0/gamma_adjust);
+               ret.set_static(get_param_static(param));
+               return ret;
+       }
 
        if(param=="_width")
        {
-               if (trimmed) return int(width);
-               return surface.get_w();
+               ValueBase ret1(ValueBase::TYPE_INTEGER);
+               ret1=int(width);
+               ValueBase ret2(surface.get_w());
+               ret1.set_static(get_param_static(param));
+               ret2.set_static(get_param_static(param));
+               if (trimmed) return ret1;
+               return ret2;
        }
        if(param=="_height")
        {
-               if (trimmed) return int(height);
-               return surface.get_h();
+               ValueBase ret1(ValueBase::TYPE_INTEGER);
+               ret1=int(height);
+               ValueBase ret2(surface.get_h());
+               ret1.set_static(get_param_static(param));
+               ret2.set_static(get_param_static(param));
+               if (trimmed) return ret1;
+               return ret2;
        }
 
        return Layer_Composite::get_param(param);
index 5d03787..70d4430 100644 (file)
@@ -59,13 +59,22 @@ using namespace synfig;
 /* === P R O C E D U R E S ================================================= */
 
 /* === M E T H O D S ======================================================= */
+Layer_Composite::Layer_Composite(float         a, Color::BlendMethod   bm):
+               amount                          (a),
+               blend_method            (bm),
+               converted_blend_        (false),
+               transparent_color_      (false)
+       {
+               Layer::Vocab voc(get_param_vocab());
+               Layer::fill_static(voc);
+       }
 
 bool
 Layer_Composite::accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc_, ProgressCallback *cb)  const
 {
        RendDesc renddesc(renddesc_);
 
-       if(!amount_)
+       if(!amount)
                return context.accelerated_render(surface,quality,renddesc,cb);
 
        CanvasBase image;
@@ -143,10 +152,10 @@ Layer_Composite::get_param_vocab()const
        //! First fills the returning vocabulary with the ancestor class
        Layer::Vocab ret(Layer::get_param_vocab());
        //! Now inserts the two parameters that this layer knows.
-       ret.push_back(ParamDesc(amount_,"amount")
+       ret.push_back(ParamDesc(amount,"amount")
                .set_local_name(_("Amount"))
        );
-       ret.push_back(ParamDesc(blend_method_,"blend_method")
+       ret.push_back(ParamDesc(blend_method,"blend_method")
                .set_local_name(_("Blend Method"))
        );
 
@@ -156,21 +165,25 @@ Layer_Composite::get_param_vocab()const
 bool
 Layer_Composite::set_param(const String & param, const ValueBase &value)
 {
-       if(param=="amount" && value.same_type_as(amount_))
-               amount_=value.get(amount_);
+       if(param=="amount" && value.same_type_as(amount))
+       {
+               amount=value.get(amount);
+               set_param_static(param,value.get_static());
+       }
        else
        if(param=="blend_method" && value.same_type_as(int()))
        {
-               blend_method_ = static_cast<Color::BlendMethod>(value.get(int()));
+               blend_method = static_cast<Color::BlendMethod>(value.get(int()));
+               set_param_static(param,value.get_static());
 
-               if (blend_method_ < 0 || blend_method_ >= Color::BLEND_END)
+               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;
+                       warning("illegal value (%d) for blend_method - using Composite instead", blend_method);
+                       blend_method = Color::BLEND_COMPOSITE;
                        return false;
                }
 
-               if (blend_method_ == Color::BLEND_STRAIGHT && !reads_context())
+               if (blend_method == Color::BLEND_STRAIGHT && !reads_context())
                {
                        Canvas::Handle canvas(get_canvas());
                        if (canvas)
@@ -184,7 +197,7 @@ Layer_Composite::set_param(const String & param, const ValueBase &value)
                                                                version.c_str(), get_non_empty_description().c_str());
                                        else
                                        {
-                                               blend_method_ = Color::BLEND_COMPOSITE;
+                                               blend_method = Color::BLEND_COMPOSITE;
                                                converted_blend_ = true;
 
                                                // if this layer has a transparent color, go back and set the color again
@@ -205,11 +218,20 @@ Layer_Composite::set_param(const String & param, const ValueBase &value)
 ValueBase
 Layer_Composite::get_param(const String & param)const
 {
+
        //! First check if the parameter's string is known.
        if(param=="amount")
-               return get_amount();
+       {
+               synfig::ValueBase ret(get_amount());
+               ret.set_static(get_param_static(param));
+               return ret;
+       }
        if(param=="blend_method")
-               return static_cast<int>(get_blend_method());
+       {
+               synfig::ValueBase ret(static_cast<int>(get_blend_method()));
+               ret.set_static(get_param_static(param));
+               return ret;
+       }
        //! If it is unknown then call the ancestor's get param member
        //! to see if it can handle that parameter's string.
        return Layer::get_param(param);
index 458bae7..46a07b6 100644 (file)
@@ -49,21 +49,14 @@ class Layer_Composite : public Layer
 {
 private:
        //! The amount of composite
-       float amount_;
+       float amount;
        //! The blend method for the composition
-       Color::BlendMethod blend_method_;
+       Color::BlendMethod blend_method;
 
 protected:
        //! Default constructor. Not used directly.
-       Layer_Composite(
-               float   amount=1.0,
-               Color::BlendMethod      blend_method=Color::BLEND_COMPOSITE
-       ):
-               amount_                         (amount),
-               blend_method_           (blend_method),
-               converted_blend_        (false),
-               transparent_color_      (false)
-       { }
+       Layer_Composite(float amount=1.0, Color::BlendMethod blend_method=Color::BLEND_COMPOSITE);
+
        //! Converted blend is used to check if an old version of canvas
        //! is used in the composition. Old Straight was used as new Composite
        //! \todo verify this
@@ -74,17 +67,17 @@ protected:
 
 public:
        //! Gets the amount of the layer
-       float get_amount()const { return amount_; }
+       float get_amount()const { return amount; }
        //! Sets the amount of the layer and returns this layer
-       Layer_Composite& set_amount(float x) { amount_=x; return *this; }
+       Layer_Composite& set_amount(float x) { amount=x; return *this; }
        //! Gets the blend method of the layer
-       Color::BlendMethod get_blend_method()const { return blend_method_; }
+       Color::BlendMethod get_blend_method()const { return blend_method; }
        //! Sets the blend method of the layer and returns this layer
-       Layer_Composite& set_blend_method(Color::BlendMethod x) { blend_method_=x; return *this; }
+       Layer_Composite& set_blend_method(Color::BlendMethod x) { blend_method=x; return *this; }
        //! Returns true is amount is 1 and blend method is straight
-       virtual bool is_solid_color()const { return amount_==1.0f && blend_method_==Color::BLEND_STRAIGHT; }
+       virtual bool is_solid_color()const { return amount==1.0f && blend_method==Color::BLEND_STRAIGHT; }
        //! Returns true if the amount is zero.
-       bool is_disabled()const { return amount_==0.0f; }
+       bool is_disabled()const { return amount==0.0f; }
        //! Gets the parameter vocabulary. To be overrided by the derived.
        virtual Vocab get_param_vocab()const;
        //! Sets the value for the given parameter.
index 855112c..61fa152 100644 (file)
@@ -68,6 +68,8 @@ Layer_MotionBlur::Layer_MotionBlur():
        subsample_start         (0.0),
        subsample_end           (1.0)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 bool
index cd61506..6cdd09f 100644 (file)
@@ -92,6 +92,9 @@ Layer_PasteCanvas::Layer_PasteCanvas():
        children_lock=false;
        muck_with_time_=true;
        curr_time=Time::begin();
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
+       set_param_static("children_lock", true);
 }
 
 Layer_PasteCanvas::~Layer_PasteCanvas()
@@ -178,9 +181,9 @@ Layer_PasteCanvas::set_param(const String & param, const ValueBase &value)
        if(param=="canvas" && value.same_type_as(Canvas::Handle()))
        {
                set_sub_canvas(value.get(Canvas::Handle()));
+               set_param_static(param, value.get_static());
                return true;
        }
-
        //! \todo this introduces bug 1844764 if enabled; it was introduced in r954.
        // http://synfig.org/images/3/3d/Moving-waypoints.sifz is an
        // example of an animation that has its waypoints displayed
@@ -565,3 +568,17 @@ void Layer_PasteCanvas::get_times_vfunc(Node::time_set &set) const
 
        Layer::get_times_vfunc(set);
 }
+
+
+bool
+Layer_PasteCanvas::set_param_static(const String &param, const bool x)
+{
+       return Layer_Composite::set_param_static(param, x);
+}
+
+
+bool
+Layer_PasteCanvas::get_param_static(const String &param) const
+{
+       return Layer_Composite::get_param_static(param);
+}
index 01bf40f..0ae2c98 100644 (file)
@@ -157,6 +157,8 @@ public:
        virtual bool set_param(const String & param, const synfig::ValueBase &value);
        //! Get the value of the specified parameter. \see Layer::get_param
        virtual ValueBase get_param(const String & param)const;
+       virtual bool set_param_static(const String &param, const bool x);
+       virtual bool get_param_static(const String &param) const;
        //! Gets the blend color of the Layer in the context at \a pos
        virtual Color get_color(Context context, const Point &pos)const;
        //! Sets the time of the Paste Canvas Layer and those under it
index 299bbbf..8c92f8f 100644 (file)
@@ -74,6 +74,8 @@ Layer_Polygon::Layer_Polygon():
        vector_list.push_back(Point(-0.333333,0));
        vector_list.push_back(Point(0.333333,0));
        sync();
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 Layer_Polygon::~Layer_Polygon()
index 9b9c2b7..be1ffdc 100644 (file)
@@ -67,6 +67,8 @@ Layer_SolidColor::Layer_SolidColor():
        Layer_Composite(1.0,Color::BLEND_COMPOSITE),
        color(Color::black())
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 bool
index 08a0f06..47dccdb 100644 (file)
@@ -824,50 +824,120 @@ CanvasParser::parse_angle(xmlpp::Element *element)
        return Angle::deg(atof(val.c_str()));
 }
 
+bool
+CanvasParser::parse_static(xmlpp::Element *element)
+{
+       if(!element->get_attribute("static"))
+               return false;
+
+       string val=element->get_attribute("static")->get_value();
+
+       if(val=="true" || val=="1")
+               return true;
+       if(val=="false" || val=="0")
+               return false;
+
+       error(element,strprintf(_("Bad value \"%s\" in <%s>"),val.c_str(),"bool"));
+
+       return false;
+}
+
+
 ValueBase
 CanvasParser::parse_value(xmlpp::Element *element,Canvas::Handle canvas)
 {
        if(element->get_name()=="real")
-               return parse_real(element);
+       {
+               ValueBase ret;
+               ret.set(parse_real(element));
+               ret.set_static(parse_static(element));
+               return ret;
+       }
        else
        if(element->get_name()=="time")
-               return parse_time(element,canvas);
+       {
+               ValueBase ret;
+               ret.set(parse_time(element,canvas));
+               ret.set_static(parse_static(element));
+               return ret;
+       }
        else
        if(element->get_name()=="integer")
-               return parse_integer(element);
+       {
+               ValueBase ret;
+               ret.set(parse_integer(element));
+               ret.set_static(parse_static(element));
+               return ret;
+       }
        else
        if(element->get_name()=="string")
-               return parse_string(element);
+       {
+               ValueBase ret;
+               ret.set(parse_string(element));
+               ret.set_static(parse_static(element));
+               return ret;
+       }
        else
        if(element->get_name()=="vector")
-               return parse_vector(element);
+       {
+               ValueBase ret;
+               ret.set(parse_vector(element));
+               ret.set_static(parse_static(element));
+               return ret;
+       }
        else
        if(element->get_name()=="color")
-               return parse_color(element);
+       {
+               ValueBase ret;
+               ret.set(parse_color(element));
+               ret.set_static(parse_static(element));
+               return ret;
+       }
        else
        if(element->get_name()=="segment")
-               return parse_segment(element);
+       {
+               ValueBase ret;
+               ret.set(parse_segment(element));
+               ret.set_static(parse_static(element));
+               return ret;
+       }
        else
        if(element->get_name()=="list")
                return parse_list(element,canvas);
        else
        if(element->get_name()=="gradient")
-               return parse_gradient(element);
+       {
+               ValueBase ret;
+               ret.set(parse_gradient(element));
+               ret.set_static(parse_static(element));
+               return ret;
+       }
        else
        if(element->get_name()=="bool")
-               return parse_bool(element);
+       {
+               ValueBase ret;
+               ret.set(parse_bool(element));
+               ret.set_static(parse_static(element));
+               return ret;
+       }
        else
-       //if(element->get_name()=="canvas")
-       //      return parse_canvas(element,canvas,true);       // inline canvas
-       //else
        if(element->get_name()=="angle" || element->get_name()=="degrees" || element->get_name()=="radians" || element->get_name()=="rotations")
-               return parse_angle(element);
-       else
+       {
+               ValueBase ret;
+               ret.set(parse_angle(element));
+               ret.set_static(parse_static(element));
+               return ret;
+       }       else
        if(element->get_name()=="bline_point")
                return parse_bline_point(element);
        else
        if(element->get_name()=="canvas")
-               return ValueBase(parse_canvas(element,canvas,true));
+       {
+               ValueBase ret;
+               ret.set(parse_canvas(element,canvas,true));
+               ret.set_static(parse_static(element));
+               return ret;
+       }
        else
        {
                error_unexpected_element(element,element->get_name());
@@ -1766,6 +1836,8 @@ CanvasParser::parse_layer(xmlpp::Element *element,Canvas::Handle canvas)
                                        if(!c) error((*iter),strprintf(_("Failed to load subcanvas '%s'"), str.c_str()));
                                        if(!layer->set_param(param_name,c))
                                                error((*iter),_("Layer rejected canvas link"));
+                                       //Parse the static option and sets it to the canvas ValueBase
+                                       layer->set_param_static(param_name, parse_static(child));
                                }
                                else
                                try
index b347850..8cfc482 100644 (file)
@@ -203,6 +203,9 @@ private:
        //! Dynamic List Parsnig Function
        etl::handle<ValueNode_DynamicList> parse_dynamic_list(xmlpp::Element *node,Canvas::Handle canvas);
 
+       //! Static option for ValueBase parsing fucntion
+       bool parse_static(xmlpp::Element *node);
+
 }; // END of CanvasParser
 
 /* === E X T E R N S ======================================================= */
index 7682195..34f3fbd 100644 (file)
@@ -91,74 +91,90 @@ xmlpp::Element* encode_keyframe(xmlpp::Element* root,const Keyframe &kf, float f
        return root;
 }
 
+xmlpp::Element* encode_static(xmlpp::Element* root,bool s)
+{
+       if(s)
+               root->set_attribute("static", s?"true":"false");
+       return root;
+}
 
-xmlpp::Element* encode_real(xmlpp::Element* root,Real v)
+
+xmlpp::Element* encode_real(xmlpp::Element* root,Real v,bool s=false)
 {
        root->set_name("real");
-       root->set_attribute("value",strprintf(VECTOR_VALUE_TYPE_FORMAT,v));
+       root->set_attribute("value",strprintf(VECTOR_VALUE_TYPE_FORMAT,v));
+       encode_static(root, s);
        return root;
 }
 
-xmlpp::Element* encode_time(xmlpp::Element* root,Time t)
+xmlpp::Element* encode_time(xmlpp::Element* root,Time t,bool s=false)
 {
        root->set_name("time");
-       root->set_attribute("value",t.get_string());
+       root->set_attribute("value",t.get_string());
+       encode_static(root, s);
        return root;
 }
 
-xmlpp::Element* encode_integer(xmlpp::Element* root,int i)
+xmlpp::Element* encode_integer(xmlpp::Element* root,int i,bool s=false)
 {
        root->set_name("integer");
        root->set_attribute("value",strprintf("%i",i));
+       encode_static(root, s);
        return root;
 }
 
-xmlpp::Element* encode_bool(xmlpp::Element* root,bool b)
+xmlpp::Element* encode_bool(xmlpp::Element* root, bool b,bool s=false)
 {
        root->set_name("bool");
        root->set_attribute("value",b?"true":"false");
+       encode_static(root, s);
        return root;
 }
 
-xmlpp::Element* encode_string(xmlpp::Element* root,const String &str)
+xmlpp::Element* encode_string(xmlpp::Element* root,const String &str,bool s=false)
 {
        root->set_name("string");
        root->set_child_text(str);
+       encode_static(root, s);
        return root;
 }
 
-xmlpp::Element* encode_vector(xmlpp::Element* root,Vector vect)
+xmlpp::Element* encode_vector(xmlpp::Element* root,Vector vect,bool s=false)
 {
        root->set_name("vector");
        root->add_child("x")->set_child_text(strprintf(VECTOR_VALUE_TYPE_FORMAT,(float)vect[0]));
        root->add_child("y")->set_child_text(strprintf(VECTOR_VALUE_TYPE_FORMAT,(float)vect[1]));
+       encode_static(root, s);
        return root;
 }
 
-xmlpp::Element* encode_color(xmlpp::Element* root,Color color)
+xmlpp::Element* encode_color(xmlpp::Element* root,Color color,bool s=false)
 {
        root->set_name("color");
        root->add_child("r")->set_child_text(strprintf(COLOR_VALUE_TYPE_FORMAT,(float)color.get_r()));
        root->add_child("g")->set_child_text(strprintf(COLOR_VALUE_TYPE_FORMAT,(float)color.get_g()));
        root->add_child("b")->set_child_text(strprintf(COLOR_VALUE_TYPE_FORMAT,(float)color.get_b()));
        root->add_child("a")->set_child_text(strprintf(COLOR_VALUE_TYPE_FORMAT,(float)color.get_a()));
+       encode_static(root, s);
        return root;
 }
 
-xmlpp::Element* encode_angle(xmlpp::Element* root,Angle theta)
+xmlpp::Element* encode_angle(xmlpp::Element* root,Angle theta,bool s=false)
 {
        root->set_name("angle");
        root->set_attribute("value",strprintf("%f",(float)Angle::deg(theta).get()));
+       encode_static(root, s);
        return root;
 }
 
-xmlpp::Element* encode_segment(xmlpp::Element* root,Segment seg)
+xmlpp::Element* encode_segment(xmlpp::Element* root,Segment seg,bool s=false)
 {
        root->set_name("segment");
        encode_vector(root->add_child("p1")->add_child("vector"),seg.p1);
        encode_vector(root->add_child("t1")->add_child("vector"),seg.t1);
        encode_vector(root->add_child("p2")->add_child("vector"),seg.p2);
        encode_vector(root->add_child("t2")->add_child("vector"),seg.t2);
+       encode_static(root, s);
        return root;
 }
 
@@ -177,10 +193,10 @@ xmlpp::Element* encode_bline_point(xmlpp::Element* root,BLinePoint bline_point)
        return root;
 }
 
-xmlpp::Element* encode_gradient(xmlpp::Element* root,Gradient x)
+xmlpp::Element* encode_gradient(xmlpp::Element* root,Gradient x,bool s=false)
 {
        root->set_name("gradient");
-
+       encode_static(root, s);
        Gradient::const_iterator iter;
        x.sort();
        for(iter=x.begin();iter!=x.end();iter++)
@@ -212,27 +228,27 @@ xmlpp::Element* encode_value(xmlpp::Element* root,const ValueBase &data,Canvas::
        switch(data.get_type())
        {
        case ValueBase::TYPE_REAL:
-               return encode_real(root,data.get(Real()));
+               return encode_real(root,data.get(Real()), data.get_static());
        case ValueBase::TYPE_TIME:
-               return encode_time(root,data.get(Time()));
+               return encode_time(root,data.get(Time()), data.get_static());
        case ValueBase::TYPE_INTEGER:
-               return encode_integer(root,data.get(int()));
+               return encode_integer(root,data.get(int()), data.get_static());
        case ValueBase::TYPE_COLOR:
-               return encode_color(root,data.get(Color()));
+               return encode_color(root,data.get(Color()), data.get_static());
        case ValueBase::TYPE_VECTOR:
-               return encode_vector(root,data.get(Vector()));
+               return encode_vector(root,data.get(Vector()), data.get_static());
        case ValueBase::TYPE_ANGLE:
-               return encode_angle(root,data.get(Angle()));
+               return encode_angle(root,data.get(Angle()), data.get_static());
        case ValueBase::TYPE_BOOL:
-               return encode_bool(root,data.get(bool()));
+               return encode_bool(root,data.get(bool()), data.get_static());
        case ValueBase::TYPE_STRING:
-               return encode_string(root,data.get(String()));
+               return encode_string(root,data.get(String()), data.get_static());
        case ValueBase::TYPE_SEGMENT:
-               return encode_segment(root,data.get(Segment()));
+               return encode_segment(root,data.get(Segment()), data.get_static());
        case ValueBase::TYPE_BLINEPOINT:
                return encode_bline_point(root,data.get(BLinePoint()));
        case ValueBase::TYPE_GRADIENT:
-               return encode_gradient(root,data.get(Gradient()));
+               return encode_gradient(root,data.get(Gradient()), data.get_static());
        case ValueBase::TYPE_LIST:
                return encode_list(root,data,canvas);
        case ValueBase::TYPE_CANVAS:
@@ -552,6 +568,8 @@ xmlpp::Element* encode_layer(xmlpp::Element* root,Layer::ConstHandle layer)
                                        xmlpp::Element *node=root->add_child("param");
                                        node->set_attribute("name",iter->get_name());
                                        node->set_attribute("use",child->get_relative_id(layer->get_canvas()));
+                                       if(value.get_static())
+                                               node->set_attribute("static", value.get_static()?"true":"false");
                                        continue;
                                }
                        }
index fdc629b..f9a41b7 100644 (file)
@@ -57,14 +57,15 @@ using namespace etl;
 
 /* === M E T H O D S ======================================================= */
 
-ValueBase::ValueBase():type(TYPE_NIL),data(0),ref_count(0),loop_(0)
+ValueBase::ValueBase():type(TYPE_NIL),data(0),ref_count(0),loop_(0),static_(0)
 {
 }
 
 ValueBase::ValueBase(Type x):
        type(x),
        data(0),
-       loop_(0)
+       loop_(0),
+       static_(0)
 {
        switch(type)
        {
@@ -216,6 +217,7 @@ ValueBase::operator=(const ValueBase& x)
                ref_count=x.ref_count;
        }
        loop_=x.loop_;
+       static_=x.static_;
        return *this;
 }
 
index 1ff51c5..c55f4c9 100644 (file)
@@ -123,6 +123,8 @@ protected:
        etl::reference_counter ref_count;
        //! For Values with loop option like TYPE_LIST
        bool loop_;
+       //! For Values of Constant Value Nodes
+       bool static_;
 
        /*
  --    ** -- C O N S T R U C T O R S -----------------------------------
@@ -135,8 +137,8 @@ public:
 
        //! Template constructor for any type
        template <typename T>
-       ValueBase(const T &x, bool loop_=false):
-               type(TYPE_NIL),data(0),ref_count(0),loop_(loop_)
+       ValueBase(const T &x, bool loop_=false, bool static_=false):
+               type(TYPE_NIL),data(0),ref_count(0),loop_(loop_), static_(static_)
                { set(x); }
 
        //! Copy constructor. The data is not copied, just the type.
@@ -184,6 +186,12 @@ public:
        //! Sets the loop option.
        void set_loop(bool x) { loop_=x; }
 
+       //! Gets the static option.
+       bool get_static()const { return static_; }
+
+       //! Sets the static option.
+       void set_static(bool x) { static_=x; }
+
        //! True if the Value is not valid or is type LIST and is empty
        bool empty()const;
 
index 89ecae7..69caae5 100644 (file)
@@ -118,13 +118,13 @@ ValueNode_Const::set_value(const ValueBase &data)
 String
 ValueNode_Const::get_name()const
 {
-       return "constant";
+       return get_static()?"static":"constant";
 }
 
 String
 ValueNode_Const::get_local_name()const
 {
-       return _("Constant");
+       return get_static()?_("Static"):_("Constant");
 }
 
 void ValueNode_Const::get_times_vfunc(Node::time_set &/*set*/) const
index 08a4559..a97bbde 100644 (file)
@@ -56,7 +56,8 @@ public:
        ValueBase &get_value();
        void set_value(const ValueBase &data);
 
-
+       bool get_static()const {return get_value().get_static();}
+       void set_static(bool x) { get_value().set_static(x); }
        virtual String get_name()const;
        virtual String get_local_name()const;
 
index 33bf9a7..57fd42a 100644 (file)
@@ -193,6 +193,7 @@ CanvasTreeStore::get_value_vfunc(const Gtk::TreeModel::iterator& iter, int colum
        if(column==model.type.index())
        {
                synfigapp::ValueDesc value_desc((*iter)[model.value_desc]);
+               String stype, lname;
 
                Glib::Value<Glib::ustring> x;
                g_value_init(x.gobj(),x.value_type());
@@ -205,16 +206,20 @@ CanvasTreeStore::get_value_vfunc(const Gtk::TreeModel::iterator& iter, int colum
                }
                else
                {
-                       if(!value_desc.is_value_node() || value_desc.get_value_node()->get_name()=="constant")
+                       stype=ValueBase::type_local_name(value_desc.get_value_type());
+                       if(value_desc.get_value_node())
                        {
-                               x.set(ValueBase::type_local_name(value_desc.get_value_type()));
+                               lname=value_desc.get_value_node()->get_name();
+                               if (lname=="animated" || lname=="static")
+                                       stype+=" (" + value_desc.get_value_node()->get_local_name() + ")";
                        }
-                       else
+                       else if(value_desc.parent_is_layer_param())
                        {
-                               x.set(value_desc.get_value_node()->get_local_name());
+                               if(value_desc.get_value().get_static())
+                                       stype+=_(" (Static)");
                        }
                }
-
+               x.set(stype.c_str());
                g_value_init(value.gobj(),x.value_type());
                g_value_copy(x.gobj(),value.gobj());
        }
index 887205e..40d466c 100644 (file)
@@ -17,6 +17,8 @@ LAYER_ACTION_HH = \
        actions/layerparamconnect.h \
        actions/layerparamdisconnect.h \
        actions/layerparamset.h \
+       actions/layerparamsetstatic.h\
+       actions/layerparamunsetstatic.h\
        actions/layerraise.h \
        actions/layerremove.h \
        actions/layersetdesc.h
@@ -31,6 +33,8 @@ LAYER_ACTION_CC = \
        actions/layerparamconnect.cpp \
        actions/layerparamdisconnect.cpp \
        actions/layerparamset.cpp \
+       actions/layerparamsetstatic.cpp\
+       actions/layerparamunsetstatic.cpp\
        actions/layerraise.cpp \
        actions/layerremove.cpp \
        actions/layersetdesc.cpp
@@ -58,6 +62,8 @@ VALUEDESC_ACTION_CC = \
 VALUENODE_ACTION_HH = \
        actions/valuenodeadd.h \
        actions/valuenodeconstset.h \
+       actions/valuenodeconstsetstatic.h\
+       actions/valuenodeconstunsetstatic.h\
        actions/valuenodedynamiclistinsert.h \
        actions/valuenodedynamiclistinsertsmart.h \
        actions/valuenodedynamiclistloop.h \
@@ -74,6 +80,8 @@ VALUENODE_ACTION_HH = \
 VALUENODE_ACTION_CC = \
        actions/valuenodeadd.cpp \
        actions/valuenodeconstset.cpp \
+       actions/valuenodeconstsetstatic.cpp\
+       actions/valuenodeconstunsetstatic.cpp\
        actions/valuenodedynamiclistinsert.cpp \
        actions/valuenodedynamiclistinsertsmart.cpp \
        actions/valuenodedynamiclistloop.cpp \
index 7a98252..21d5f0c 100644 (file)
@@ -41,6 +41,8 @@
 #include "actions/layeradd.h"
 #include "actions/layeractivate.h"
 #include "actions/layerparamset.h"
+#include "actions/layerparamsetstatic.h"
+#include "actions/layerparamunsetstatic.h"
 #include "actions/layerparamconnect.h"
 #include "actions/layerparamdisconnect.h"
 #include "actions/layerencapsulate.h"
@@ -48,6 +50,8 @@
 #include "actions/layersetdesc.h"
 
 #include "actions/valuenodeconstset.h"
+#include "actions/valuenodeconstsetstatic.h"
+#include "actions/valuenodeconstunsetstatic.h"
 #include "actions/valuenodeadd.h"
 #include "actions/valuenodereplace.h"
 #include "actions/valuenodelinkconnect.h"
@@ -161,6 +165,8 @@ Action::Main::Main()
        ADD_ACTION(Action::LayerAdd);
        ADD_ACTION(Action::LayerActivate);
        ADD_ACTION(Action::LayerParamSet);
+       ADD_ACTION(Action::LayerParamSetStatic);
+       ADD_ACTION(Action::LayerParamUnSetStatic);
        ADD_ACTION(Action::LayerParamConnect);
        ADD_ACTION(Action::LayerParamDisconnect);
        ADD_ACTION(Action::LayerEncapsulate);
@@ -168,6 +174,8 @@ Action::Main::Main()
        ADD_ACTION(Action::LayerSetDesc);
 
        ADD_ACTION(Action::ValueNodeConstSet);
+       ADD_ACTION(Action::ValueNodeConstSetStatic);
+       ADD_ACTION(Action::ValueNodeConstUnSetStatic);
        ADD_ACTION(Action::ValueNodeAdd);
        ADD_ACTION(Action::ValueNodeReplace);
        ADD_ACTION(Action::ValueNodeLinkConnect);
diff --git a/synfig-studio/src/synfigapp/actions/layerparamsetstatic.cpp b/synfig-studio/src/synfigapp/actions/layerparamsetstatic.cpp
new file mode 100644 (file)
index 0000000..c8fc234
--- /dev/null
@@ -0,0 +1,186 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file layerparamsetstatic.cpp
+**     \brief Template File
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2010 Carlos López
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+#      include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+#      include <config.h>
+#endif
+
+#include "layerparamsetstatic.h"
+#include <synfigapp/canvasinterface.h>
+
+#include <synfigapp/general.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::LayerParamSetStatic);
+ACTION_SET_NAME(Action::LayerParamSetStatic,"LayerParamSetStatic");
+ACTION_SET_LOCAL_NAME(Action::LayerParamSetStatic,N_("Set Static"));
+ACTION_SET_TASK(Action::LayerParamSetStatic,"setstatic");
+ACTION_SET_CATEGORY(Action::LayerParamSetStatic,Action::CATEGORY_VALUEDESC);
+ACTION_SET_PRIORITY(Action::LayerParamSetStatic,0);
+ACTION_SET_VERSION(Action::LayerParamSetStatic,"0.0");
+ACTION_SET_CVS_ID(Action::LayerParamSetStatic,"$Id$");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::LayerParamSetStatic::LayerParamSetStatic()
+{
+}
+
+Action::ParamVocab
+Action::LayerParamSetStatic::get_param_vocab()
+{
+       ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+       ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
+               .set_local_name(_("Value Desc"))
+       );
+
+       return ret;
+}
+
+bool
+Action::LayerParamSetStatic::is_candidate(const ParamList &x)
+{
+       if(!candidate_check(get_param_vocab(),x))
+               return false;
+
+       ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
+
+       if(!value_desc.parent_is_layer_param())
+               return false;
+
+       synfig::ValueBase parameter;
+       synfig::Layer::Handle _layer;
+       synfig::String _param_name;
+       _layer = value_desc.get_layer();
+       _param_name = value_desc.get_param_name();
+
+       if(!_layer || _param_name.empty())
+               return false;
+
+       //!Check that the parameter is not Value Node (Const, Animated or Linkable)
+       if(_layer->dynamic_param_list().count(_param_name))
+               return false;
+       //! Retrieves the current parameter
+       parameter = _layer->get_param(_param_name);
+       //! Check that the parameter is not a inline canvas
+       if(parameter.get_type()==ValueBase::TYPE_CANVAS && parameter.get(Canvas::Handle()))
+               if(parameter.get(Canvas::Handle())->is_inline())
+                       return false;
+       //! Check if it is already static
+       if(parameter.get_static())
+               return false;
+
+       return true;
+
+}
+
+bool
+Action::LayerParamSetStatic::set_param(const synfig::String& name, const Action::Param &param)
+{
+
+       if(!layer && name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+       {
+               ValueDesc value_desc(param.get_value_desc());
+               if(!value_desc.parent_is_layer_param())
+                       return false;
+
+               layer=Layer::Handle::cast_dynamic(value_desc.get_layer());
+
+               if(!layer)
+                       return false;
+       }
+
+
+       if(param_name.empty() && name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+       {
+               ValueDesc value_desc(param.get_value_desc());
+               if(!value_desc.parent_is_layer_param())
+                       return false;
+
+               param_name=value_desc.get_param_name();
+
+               if(param_name.empty())
+                       return false;
+       }
+
+       return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::LayerParamSetStatic::is_ready()const
+{
+       if(!layer || param_name.empty())
+               return false;
+
+       return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::LayerParamSetStatic::perform()
+{
+       //! See if the parameter is dynamic
+       if(layer->dynamic_param_list().count(param_name))
+               throw Error(_("This action is not for Value Nodes!"));
+
+       old_static_value=layer->get_param_static(param_name);
+
+       if(!layer->set_param_static(param_name,true))
+               throw Error(_("Layer did not accept static value."));
+
+       //! Signal layer changed
+       layer->changed();
+       //! Signal that a layer parameter changed
+       if(get_canvas_interface())
+               get_canvas_interface()->signal_layer_param_changed()(layer,param_name);
+}
+
+void
+Action::LayerParamSetStatic::undo()
+{
+       if(!layer->set_param_static(param_name,old_static_value))
+               throw Error(_("Layer did not accept static value."));
+       //! Signal layer changed
+       layer->changed();
+       //! Signal that a layer parameter changed
+       if(get_canvas_interface())
+               get_canvas_interface()->signal_layer_param_changed()(layer,param_name);
+}
diff --git a/synfig-studio/src/synfigapp/actions/layerparamsetstatic.h b/synfig-studio/src/synfigapp/actions/layerparamsetstatic.h
new file mode 100644 (file)
index 0000000..022ef03
--- /dev/null
@@ -0,0 +1,78 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file layerparamsetstatic.h
+**     \brief Template File
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2010 Carlos López
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_LAYERPARAMSETSTATIC_H
+#define __SYNFIG_APP_ACTION_LAYERPARAMSETSTATIC_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/layer.h>
+#include <synfigapp/action.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class LayerParamSetStatic :
+       public Undoable,
+       public CanvasSpecific
+{
+private:
+
+       synfig::Layer::Handle layer;
+       synfig::String  param_name;
+       bool old_static_value;
+
+
+public:
+
+       LayerParamSetStatic();
+
+       static ParamVocab get_param_vocab();
+       static bool is_candidate(const ParamList &x);
+
+       virtual bool set_param(const synfig::String& name, const Param &);
+       virtual bool is_ready()const;
+
+       virtual void perform();
+       virtual void undo();
+
+       ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
diff --git a/synfig-studio/src/synfigapp/actions/layerparamunsetstatic.cpp b/synfig-studio/src/synfigapp/actions/layerparamunsetstatic.cpp
new file mode 100644 (file)
index 0000000..814b1a5
--- /dev/null
@@ -0,0 +1,189 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file layerparamunsetstatic.cpp
+**     \brief Template File
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2010 Carlos López
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+#      include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+#      include <config.h>
+#endif
+
+#include "layerparamunsetstatic.h"
+#include <synfigapp/canvasinterface.h>
+
+#include <synfigapp/general.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::LayerParamUnSetStatic);
+ACTION_SET_NAME(Action::LayerParamUnSetStatic,"LayerParamUnSetStatic");
+ACTION_SET_LOCAL_NAME(Action::LayerParamUnSetStatic,N_("UnSet Static"));
+ACTION_SET_TASK(Action::LayerParamUnSetStatic,"unsetstatic");
+ACTION_SET_CATEGORY(Action::LayerParamUnSetStatic,Action::CATEGORY_VALUEDESC);
+ACTION_SET_PRIORITY(Action::LayerParamUnSetStatic,0);
+ACTION_SET_VERSION(Action::LayerParamUnSetStatic,"0.0");
+ACTION_SET_CVS_ID(Action::LayerParamUnSetStatic,"$Id$");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::LayerParamUnSetStatic::LayerParamUnSetStatic()
+{
+}
+
+Action::ParamVocab
+Action::LayerParamUnSetStatic::get_param_vocab()
+{
+       ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+       ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
+               .set_local_name(_("Value Desc"))
+       );
+
+       return ret;
+}
+
+bool
+Action::LayerParamUnSetStatic::is_candidate(const ParamList &x)
+{
+       if(!candidate_check(get_param_vocab(),x))
+               return false;
+
+       ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
+
+       if(!value_desc.parent_is_layer_param())
+               return false;
+
+       synfig::ValueBase parameter;
+       synfig::Layer::Handle _layer;
+       synfig::String _param_name;
+       _layer = value_desc.get_layer();
+       _param_name = value_desc.get_param_name();
+
+       if(!_layer || _param_name.empty())
+               return false;
+
+       //!Check that the parameter is not Value Node (Const, Animated or Linkable)
+       if(_layer->dynamic_param_list().count(_param_name))
+               return false;
+
+       //! Retrieves the current parameter
+       parameter = _layer->get_param(_param_name);
+       //! Check that the parameter is not a inline canvas
+       if(parameter.get_type()==ValueBase::TYPE_CANVAS)
+               if(parameter.get(Canvas::Handle())->is_inline() && parameter.get(Canvas::Handle()))
+                       return false;
+       //! Check if it is not static
+       if(!parameter.get_static())
+               return false;
+
+       return true;
+
+}
+
+bool
+Action::LayerParamUnSetStatic::set_param(const synfig::String& name, const Action::Param &param)
+{
+
+       if(!layer && name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+       {
+               ValueDesc value_desc(param.get_value_desc());
+               if(!value_desc.parent_is_layer_param())
+                       return false;
+
+               layer=Layer::Handle::cast_dynamic(value_desc.get_layer());
+
+               if(!layer)
+                       return false;
+       }
+
+
+       if(param_name.empty() && name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+       {
+               ValueDesc value_desc(param.get_value_desc());
+
+               if(!value_desc.parent_is_layer_param())
+                       return false;
+
+               param_name=value_desc.get_param_name();
+
+               if(param_name.empty())
+                       return false;
+
+       }
+
+       return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::LayerParamUnSetStatic::is_ready()const
+{
+       if(!layer || param_name.empty())
+               return false;
+
+       return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::LayerParamUnSetStatic::perform()
+{
+       //! See if the parameter is dynamic
+       if(layer->dynamic_param_list().count(param_name))
+               throw Error(_("This action is not for Value Nodes!"));
+
+       old_static_value=layer->get_param_static(param_name);
+
+       if(!layer->set_param_static(param_name,false))
+               throw Error(_("Layer did not accept static value."));
+
+       //! Signal layer changed
+       layer->changed();
+       //! Signal that a layer parameter changed
+       if(get_canvas_interface())
+               get_canvas_interface()->signal_layer_param_changed()(layer,param_name);
+}
+
+void
+Action::LayerParamUnSetStatic::undo()
+{
+       if(!layer->set_param(param_name,old_static_value))
+               throw Error(_("Layer did not accept parameter."));
+       //! Signal layer changed
+       layer->changed();
+       //! Signal that a layer parameter changed
+       if(get_canvas_interface())
+               get_canvas_interface()->signal_layer_param_changed()(layer,param_name);
+}
diff --git a/synfig-studio/src/synfigapp/actions/layerparamunsetstatic.h b/synfig-studio/src/synfigapp/actions/layerparamunsetstatic.h
new file mode 100644 (file)
index 0000000..4b63049
--- /dev/null
@@ -0,0 +1,77 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file layerparamunsetstatic.h
+**     \brief Template File
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2010 Carlos López
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_LAYERPARAMUNSETSTATIC_H
+#define __SYNFIG_APP_ACTION_LAYERPARAMUNSETSTATIC_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/layer.h>
+#include <synfigapp/action.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class LayerParamUnSetStatic :
+       public Undoable,
+       public CanvasSpecific
+{
+private:
+
+       synfig::Layer::Handle layer;
+       synfig::String  param_name;
+       bool old_static_value;
+
+public:
+
+       LayerParamUnSetStatic();
+
+       static ParamVocab get_param_vocab();
+       static bool is_candidate(const ParamList &x);
+
+       virtual bool set_param(const synfig::String& name, const Param &);
+       virtual bool is_ready()const;
+
+       virtual void perform();
+       virtual void undo();
+
+       ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
index 83b2646..35f6d26 100644 (file)
@@ -446,9 +446,17 @@ Action::ValueDescSet::prepare()
        }
 */
 
-
+       ValueBase local_value;
+       local_value.set_static(false);
+               if(!value_desc.is_value_node() || ValueNode_Const::Handle::cast_dynamic(value_desc.get_value_node()))
+               {
+                       if(value_desc.is_value_node())
+                               local_value=ValueNode_Const::Handle::cast_dynamic(value_desc.get_value_node())->get_value();
+                       else
+                               local_value=value_desc.get_value();
+               }
        // If we are in animate editing mode
-       if(get_edit_mode()&MODE_ANIMATE)
+       if(get_edit_mode()&MODE_ANIMATE && !local_value.get_static())
        {
 
                ValueNode_Animated::Handle& value_node(value_node_animated);
@@ -527,7 +535,8 @@ Action::ValueDescSet::prepare()
                        if(ValueNode_Const::Handle::cast_dynamic(value_desc.get_value_node()))
                        {
                                Action::Handle action(ValueNodeConstSet::create());
-
+                               synfig::ValueNode_Const::Handle localvaluenode(ValueNode_Const::Handle::cast_dynamic(value_desc.get_value_node()));
+                               value.set_static(localvaluenode->get_static());
                                action->set_param("canvas",get_canvas());
                                action->set_param("canvas_interface",get_canvas_interface());
                                action->set_param("value_node",value_desc.get_value_node());
@@ -549,7 +558,8 @@ Action::ValueDescSet::prepare()
                if(value_desc.parent_is_layer_param() && !value_desc.is_value_node())
                {
                        Action::Handle layer_param_set(LayerParamSet::create());
-
+                       synfig::ValueBase localvalue(value_desc.get_value());
+                       value.set_static(local_value.get_static());
                        layer_param_set->set_param("canvas",get_canvas());
                        layer_param_set->set_param("canvas_interface",get_canvas_interface());
                        layer_param_set->set_param("layer",value_desc.get_layer());
diff --git a/synfig-studio/src/synfigapp/actions/valuenodeconstsetstatic.cpp b/synfig-studio/src/synfigapp/actions/valuenodeconstsetstatic.cpp
new file mode 100644 (file)
index 0000000..1699673
--- /dev/null
@@ -0,0 +1,169 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file valuenodeconstsetstatic.cpp
+**     \brief Template File
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2010 Carlos López
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+#      include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+#      include <config.h>
+#endif
+
+#include "valuenodeconstsetstatic.h"
+#include <synfigapp/canvasinterface.h>
+
+#include <synfigapp/general.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ValueNodeConstSetStatic);
+ACTION_SET_NAME(Action::ValueNodeConstSetStatic,"ValueNodeConstSetStatic");
+ACTION_SET_LOCAL_NAME(Action::ValueNodeConstSetStatic,N_("Set Static"));
+ACTION_SET_TASK(Action::ValueNodeConstSetStatic,"setstatic");
+ACTION_SET_CATEGORY(Action::ValueNodeConstSetStatic,Action::CATEGORY_VALUEDESC|Action::CATEGORY_VALUENODE);
+ACTION_SET_PRIORITY(Action::ValueNodeConstSetStatic,0);
+ACTION_SET_VERSION(Action::ValueNodeConstSetStatic,"0.0");
+ACTION_SET_CVS_ID(Action::ValueNodeConstSetStatic,"$Id$");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ValueNodeConstSetStatic::ValueNodeConstSetStatic()
+{
+}
+
+Action::ParamVocab
+Action::ValueNodeConstSetStatic::get_param_vocab()
+{
+       ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+       ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
+               .set_local_name(_("ValueNode"))
+       );
+
+       return ret;
+}
+
+bool
+Action::ValueNodeConstSetStatic::is_candidate(const ParamList &x)
+{
+       if (!candidate_check(get_param_vocab(),x))
+               return false;
+
+       ValueNode::Handle value_node;
+       ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
+
+       if(value_desc.parent_is_value_node_const() || value_desc.parent_is_linkable_value_node())
+               value_node = value_desc.get_value_node();
+       else
+               value_node = x.find("value_node")->second.get_value_node();
+
+       // We need a constant value node or a constant layer param.
+       return (
+                       (ValueNode_Const::Handle::cast_dynamic(value_node) &&
+                       // We need the constant value node to be not static.
+                       !ValueNode_Const::Handle::cast_dynamic(value_node)->get_static())
+                       );
+}
+
+bool
+Action::ValueNodeConstSetStatic::set_param(const synfig::String& name, const Action::Param &param)
+{
+       if(!value_node && name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+       {
+               ValueDesc value_desc(param.get_value_desc());
+               if(!value_desc.parent_is_value_node())
+                       return false;
+
+               value_node=ValueNode_Const::Handle::cast_dynamic(value_desc.get_value_node());
+
+               if(!value_node)
+                       return false;
+
+               return true;
+       }
+
+       if(!value_node && name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
+       {
+               value_node=ValueNode_Const::Handle::cast_dynamic(param.get_value_node());
+
+               if(!value_node)
+                       return false;
+
+               return true;
+       }
+
+       return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ValueNodeConstSetStatic::is_ready()const
+{
+       if(!value_node)
+               return false;
+       return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ValueNodeConstSetStatic::perform()
+{
+       old_static_value=value_node->get_static();
+
+       if(old_static_value==true)
+       {
+               set_dirty(false);
+               return;
+       }
+       set_dirty(true);
+       value_node->set_static(true);
+
+       value_node->changed();
+}
+
+void
+Action::ValueNodeConstSetStatic::undo()
+{
+       if(old_static_value==value_node->get_static())
+       {
+               set_dirty(false);
+               return;
+       }
+
+       set_dirty(true);
+       value_node->set_static(old_static_value);
+
+       value_node->changed();
+
+}
diff --git a/synfig-studio/src/synfigapp/actions/valuenodeconstsetstatic.h b/synfig-studio/src/synfigapp/actions/valuenodeconstsetstatic.h
new file mode 100644 (file)
index 0000000..f8aad32
--- /dev/null
@@ -0,0 +1,77 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file valuenodeconstsetstatic.h
+**     \brief Template File
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2010 Carlos López
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_VALUENODECONSTSETSTATIC_H
+#define __SYNFIG_APP_ACTION_VALUENODECONSTSETSTATIC_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/valuenode_const.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class ValueNodeConstSetStatic :
+       public Undoable,
+       public CanvasSpecific
+{
+private:
+
+       synfig::ValueNode_Const::Handle value_node;
+       bool old_static_value;
+
+
+public:
+
+       ValueNodeConstSetStatic();
+
+       static ParamVocab get_param_vocab();
+       static bool is_candidate(const ParamList &x);
+
+       virtual bool set_param(const synfig::String& name, const Param &);
+       virtual bool is_ready()const;
+
+       virtual void perform();
+       virtual void undo();
+
+       ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
diff --git a/synfig-studio/src/synfigapp/actions/valuenodeconstunsetstatic.cpp b/synfig-studio/src/synfigapp/actions/valuenodeconstunsetstatic.cpp
new file mode 100644 (file)
index 0000000..e26dee4
--- /dev/null
@@ -0,0 +1,169 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file valuenodeconstunsetstatic.cpp
+**     \brief Template File
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2010 Carlos López
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+#      include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+#      include <config.h>
+#endif
+
+#include "valuenodeconstunsetstatic.h"
+#include <synfigapp/canvasinterface.h>
+
+#include <synfigapp/general.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::ValueNodeConstUnSetStatic);
+ACTION_SET_NAME(Action::ValueNodeConstUnSetStatic,"ValueNodeConstUnSetStatic");
+ACTION_SET_LOCAL_NAME(Action::ValueNodeConstUnSetStatic,N_("UnSet Static"));
+ACTION_SET_TASK(Action::ValueNodeConstUnSetStatic,"unsetstatic");
+ACTION_SET_CATEGORY(Action::ValueNodeConstUnSetStatic,Action::CATEGORY_VALUEDESC|Action::CATEGORY_VALUENODE);
+ACTION_SET_PRIORITY(Action::ValueNodeConstUnSetStatic,0);
+ACTION_SET_VERSION(Action::ValueNodeConstUnSetStatic,"0.0");
+ACTION_SET_CVS_ID(Action::ValueNodeConstUnSetStatic,"$Id$");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::ValueNodeConstUnSetStatic::ValueNodeConstUnSetStatic()
+{
+}
+
+Action::ParamVocab
+Action::ValueNodeConstUnSetStatic::get_param_vocab()
+{
+       ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+       ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
+               .set_local_name(_("ValueNode"))
+       );
+
+       return ret;
+}
+
+bool
+Action::ValueNodeConstUnSetStatic::is_candidate(const ParamList &x)
+{
+       if (!candidate_check(get_param_vocab(),x))
+               return false;
+
+       ValueNode::Handle value_node;
+       ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
+
+       if(value_desc.parent_is_value_node_const() || value_desc.parent_is_linkable_value_node())
+               value_node = value_desc.get_value_node();
+       else
+               value_node = x.find("value_node")->second.get_value_node();
+
+       // We need a constant value node or a constant layer param.
+       return (
+                       (ValueNode_Const::Handle::cast_dynamic(value_node) &&
+                       // We need the constant value node to be static.
+                       ValueNode_Const::Handle::cast_dynamic(value_node)->get_static())
+                       );
+}
+
+bool
+Action::ValueNodeConstUnSetStatic::set_param(const synfig::String& name, const Action::Param &param)
+{
+       if(!value_node && name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
+       {
+               ValueDesc value_desc(param.get_value_desc());
+               if(!value_desc.parent_is_value_node())
+                       return false;
+
+               value_node=ValueNode_Const::Handle::cast_dynamic(value_desc.get_value_node());
+
+               if(!value_node)
+                       return false;
+
+               return true;
+       }
+
+       if(!value_node && name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
+       {
+               value_node=ValueNode_Const::Handle::cast_dynamic(param.get_value_node());
+
+               if(!value_node)
+                       return false;
+
+               return true;
+       }
+
+       return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::ValueNodeConstUnSetStatic::is_ready()const
+{
+       if(!value_node)
+               return false;
+       return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::ValueNodeConstUnSetStatic::perform()
+{
+       old_static_value=value_node->get_static();
+
+       if(old_static_value==false)
+       {
+               set_dirty(false);
+               return;
+       }
+       set_dirty(true);
+       value_node->set_static(false);
+
+       value_node->changed();
+}
+
+void
+Action::ValueNodeConstUnSetStatic::undo()
+{
+       if(old_static_value==value_node->get_static())
+       {
+               set_dirty(false);
+               return;
+       }
+
+       set_dirty(true);
+       value_node->set_static(old_static_value);
+
+       value_node->changed();
+
+}
diff --git a/synfig-studio/src/synfigapp/actions/valuenodeconstunsetstatic.h b/synfig-studio/src/synfigapp/actions/valuenodeconstunsetstatic.h
new file mode 100644 (file)
index 0000000..a7af967
--- /dev/null
@@ -0,0 +1,77 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file valuenodeconstunsetstatic.h
+**     \brief Template File
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2010 Carlos López
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_VALUENODECONSTUNSETSTATIC_H
+#define __SYNFIG_APP_ACTION_VALUENODECONSTUNSETSTATIC_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfigapp/action.h>
+#include <synfig/valuenode_const.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class ValueNodeConstUnSetStatic :
+       public Undoable,
+       public CanvasSpecific
+{
+private:
+
+       synfig::ValueNode_Const::Handle value_node;
+       bool old_static_value;
+
+
+public:
+
+       ValueNodeConstUnSetStatic();
+
+       static ParamVocab get_param_vocab();
+       static bool is_candidate(const ParamList &x);
+
+       virtual bool set_param(const synfig::String& name, const Param &);
+       virtual bool is_ready()const;
+
+       virtual void perform();
+       virtual void undo();
+
+       ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif