Add parameter static option for rest of layers.
authorCarlos Lopez <genetita@gmail.com>
Sun, 29 Aug 2010 15:31:45 +0000 (17:31 +0200)
committerCarlos Lopez <genetita@gmail.com>
Sun, 29 Aug 2010 15:31:45 +0000 (17:31 +0200)
19 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/import.cpp
synfig-core/src/modules/lyr_std/rotate.cpp
synfig-core/src/modules/lyr_std/shade.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/xorpattern.cpp
synfig-core/src/modules/lyr_std/zoom.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/noise.cpp
synfig-core/src/modules/mod_particle/plant.cpp
synfig-core/src/synfig/layer_bitmap.cpp

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 f7385a9..d393f59 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 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 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 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 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 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 7519182..7c6511c 100644 (file)
@@ -82,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;
@@ -97,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);