SYNFIG_LAYER_SET_NAME(Plant,"plant");
SYNFIG_LAYER_SET_LOCAL_NAME(Plant,N_("Plant"));
SYNFIG_LAYER_SET_CATEGORY(Plant,N_("Other"));
-SYNFIG_LAYER_SET_VERSION(Plant,"0.1");
+SYNFIG_LAYER_SET_VERSION(Plant,"0.2");
SYNFIG_LAYER_SET_CVS_ID(Plant,"$Id$");
/* === P R O C E D U R E S ================================================= */
velocity(0.3),
perp_velocity(0.0),
step(0.01),
- sprouts(10)
+ sprouts(10),
+ version(version__),
+ use_width(true)
{
bounding_rect=Rect::zero();
random_factor=0.2;
// loop through the bline; seg counts the blines as we do so; stop before iter is the last bline in the list
for(;next!=bline.end();iter=next++,seg++)
{
+ float iterw=iter->get_width(); // the width value of the iter vertex
+ float nextw=next->get_width(); // the width value of the next vertex
+ float width; // the width at an intermediate position
curve.p1()=iter->get_vertex();
curve.t1()=iter->get_tangent2();
curve.p2()=next->get_vertex();
branch_velocity[0] += random_factor * random(Random::SMOOTH_COSINE, 1, f*splits, 0.0f, 0.0f);
branch_velocity[1] += random_factor * random(Random::SMOOTH_COSINE, 2, f*splits, 0.0f, 0.0f);
+ if (use_width)
+ {
+ width = iterw+(nextw-iterw)*f; // calculate the width based on the current position
+
+ branch_velocity[0] *= width; // scale the velocity accordingly to the current width
+ branch_velocity[1] *= width;
+ }
+
branch_count++;
branch(i, 0, 0, // time
stunt_growth, // stunt growth
EXPORT(reverse);
EXPORT_NAME();
- EXPORT_VERSION();
+
+ if(param=="Version" || param=="version" || param=="version__")
+ return version;
return Layer_Composite::get_param(param);
}
}
bool
+Plant::set_version(const String &ver)
+{
+ version = ver;
+
+ if (version == "0.1")
+ use_width = false;
+
+ return true;
+}
+
+bool
Plant::accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const
{
bool ret(context.accelerated_render(surface,quality,renddesc,cb));
void branch(int n, int depth,float t, float stunt_growth, synfig::Point position,synfig::Vector velocity)const;
void sync()const;
+ String version;
+ bool use_width;
public:
virtual ValueBase get_param(const String & param)const;
+ virtual bool set_version(const synfig::String &ver);
+
virtual Vocab get_param_vocab()const;
virtual bool accelerated_render(synfig::Context context,synfig::Surface *surface,int quality, const synfig::RendDesc &renddesc, synfig::ProgressCallback *cb)const;\