From 4a982de650f64a6d2a94b137d65fc1233d5c9098 Mon Sep 17 00:00:00 2001 From: dooglus Date: Mon, 4 Feb 2008 18:40:29 +0000 Subject: [PATCH] Add the 'offset' parameter to the Plant layer. git-svn-id: http://svn.voria.com/code@1575 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/src/modules/mod_particle/plant.cpp | 13 ++++++++++--- synfig-core/trunk/src/modules/mod_particle/plant.h | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/synfig-core/trunk/src/modules/mod_particle/plant.cpp b/synfig-core/trunk/src/modules/mod_particle/plant.cpp index 1a89f1f..cdaa592 100644 --- a/synfig-core/trunk/src/modules/mod_particle/plant.cpp +++ b/synfig-core/trunk/src/modules/mod_particle/plant.cpp @@ -76,6 +76,7 @@ SYNFIG_LAYER_SET_CVS_ID(Plant,"$Id$"); Plant::Plant(): + offset(0,0), split_angle(Angle::deg(10)), gravity(0,-0.1), velocity(0.3), @@ -283,6 +284,7 @@ Plant::set_param(const String & param, const ValueBase &value) needs_sync_=true; return true; } + IMPORT(offset); IMPORT_PLUS(split_angle,needs_sync_=true); IMPORT_PLUS(gravity,needs_sync_=true); IMPORT_PLUS(gradient,needs_sync_=true); @@ -342,6 +344,7 @@ Plant::get_param(const String& param)const if(param=="seed") return random.get_seed(); EXPORT(bline); + EXPORT(offset); EXPORT(split_angle); EXPORT(gravity); EXPORT(velocity); @@ -373,10 +376,14 @@ Plant::get_param_vocab()const ret.push_back(ParamDesc("bline") .set_local_name(_("Vertices")) .set_description(_("A list of BLine Points")) - //.set_origin("offset") + .set_origin("offset") //.set_scalar("width") ); + ret.push_back(ParamDesc("offset") + .set_local_name(_("Offset")) + ); + ret.push_back(ParamDesc("gradient") .set_local_name(_("Gradient")) .set_description(_("Gradient to be used for coloring the plant")) @@ -474,8 +481,8 @@ Plant::accelerated_render(Context context,Surface *surface,int quality, const Re dest_surface.set_wh(surface->get_w(),surface->get_h()); dest_surface.clear(); - const Point tl(renddesc.get_tl()); - const Point br(renddesc.get_br()); + const Point tl(renddesc.get_tl()-offset); + const Point br(renddesc.get_br()-offset); const int w(renddesc.get_w()); const int h(renddesc.get_h()); diff --git a/synfig-core/trunk/src/modules/mod_particle/plant.h b/synfig-core/trunk/src/modules/mod_particle/plant.h index e43818c..dec87ff 100644 --- a/synfig-core/trunk/src/modules/mod_particle/plant.h +++ b/synfig-core/trunk/src/modules/mod_particle/plant.h @@ -57,6 +57,8 @@ private: std::vector bline; bool bline_loop; + Point offset; + synfig::Gradient gradient; struct Particle -- 2.7.4