bool
Metaballs::set_param(const String & param, const ValueBase &value)
{
- if( param=="centers" && value.same_as(centers))
+ if( param=="centers" && value.same_type_as(centers))
{
centers = value;
return true;
}
- if( param=="weights" && value.same_as(weights))
+ if( param=="weights" && value.same_type_as(weights))
{
weights = value;
return true;
}
- if( param=="radii" && value.same_as(radii))
+ if( param=="radii" && value.same_type_as(radii))
{
radii = value;
return true;
{
Mutex::Lock lock(mutex);
/*
- if(param=="font" && value.same_as(font))
+ if(param=="font" && value.same_type_as(font))
{
new_font(etl::basename(value.get(font)),style,weight);
family=etl::basename(value.get(font));
bool BooleanCurve::set_param(const String & param, const synfig::ValueBase &value)
{
- if(param=="regions" && value.same_as(regions))
+ if(param=="regions" && value.same_type_as(regions))
{
vector<BLinePoint> bv;
int size = value.get_list().size();
{
try{
IMPORT(time_offset);
- if(param=="filename" && value.same_as(filename))
+ if(param=="filename" && value.same_type_as(filename))
{
if(!get_canvas())
{
IMPORT(smooth_outside);
IMPORT(broken);
- if(param=="iterations" && value.same_as(iterations))
+ if(param=="iterations" && value.same_type_as(iterations))
{
iterations=value.get(iterations);
if(iterations<0)
iterations=500000;
return true;
}
- if(param=="bailout" && value.same_as(bailout))
+ if(param=="bailout" && value.same_type_as(bailout))
{
bailout=value.get(bailout);
bailout*=bailout;
IMPORT(gradient_inside);
IMPORT(gradient_outside);
- if(param=="iterations" && value.same_as(iterations))
+ if(param=="iterations" && value.same_type_as(iterations))
{
iterations=value.get(iterations);
if(iterations<0)
iterations=500000;
return true;
}
- if(param=="bailout" && value.same_as(bailout))
+ if(param=="bailout" && value.same_type_as(bailout))
{
bailout=value.get(bailout);
bailout*=bailout;
{
IMPORT(origin);
- if(param=="amount" && value.same_as(amount))
+ if(param=="amount" && value.same_type_as(amount))
{
amount=value.get(amount);
sin_val=Angle::sin(amount).get();
return true;
}
- if( param=="width_list" && value.same_as(width_list))
+ if( param=="width_list" && value.same_type_as(width_list))
{
width_list=value;
//sync();
bool
Star::set_param(const String & param, const ValueBase &value)
{
- if( param=="radius1" && value.same_as(radius1))
+ if( param=="radius1" && value.same_type_as(radius1))
{
value.put(&radius1);
sync();
return true;
}
- if( param=="radius2" && value.same_as(radius2))
+ if( param=="radius2" && value.same_type_as(radius2))
{
value.put(&radius2);
sync();
return true;
}
- if( param=="points" && value.same_as(points))
+ if( param=="points" && value.same_type_as(points))
{
value.put(&points);
if(points<2)points=2;
return true;
}
- if( param=="angle" && value.same_as(angle))
+ if( param=="angle" && value.same_type_as(angle))
{
value.put(&angle);
sync();
bool
LinearGradient::set_param(const String & param, const ValueBase &value)
{
- if(param=="p1" && value.same_as(p1))
+ if(param=="p1" && value.same_type_as(p1))
{
p1=value.get(p1);
sync();
return true;
}
- if(param=="p2" && value.same_as(p2))
+ if(param=="p2" && value.same_type_as(p2))
{
p2=value.get(p2);
sync();
bool
NoiseDistort::set_param(const String & param, const ValueBase &value)
{
- if(param=="seed" && value.same_as(int()))
+ if(param=="seed" && value.same_type_as(int()))
{
random.set_seed(value.get(int()));
return true;
bool
Noise::set_param(const String & param, const ValueBase &value)
{
- if(param=="seed" && value.same_as(int()))
+ if(param=="seed" && value.same_type_as(int()))
{
random.set_seed(value.get(int()));
return true;
return true;
}
- if(param=="seed" && value.same_as(int()))
+ if(param=="seed" && value.same_type_as(int()))
{
random.set_seed(value.get(int()));
needs_sync_=true;
bool
Layer::set_param(const String ¶m, const ValueBase &value)
{
- if(param=="z_depth" && value.same_as(z_depth_))
+ if(param=="z_depth" && value.same_type_as(z_depth_))
{
z_depth_=value.get(z_depth_);
return true;
#define SYNFIG_LAYER_INIT(class) synfig::Layer* class::create() { return new class(); }
//! \writeme
-#define IMPORT_PLUS(x,y) if(param==#x && value.same_as(x)) { value.put(&x);{y;}return true;}
+#define IMPORT_PLUS(x,y) if(param==#x && value.same_type_as(x)) { value.put(&x);{y;}return true;}
//! \writeme
-#define IMPORT_AS(x,y) if(param==y && value.same_as(x)) { value.put(&x); return true;}
+#define IMPORT_AS(x,y) if(param==y && value.same_type_as(x)) { value.put(&x); return true;}
//! \writeme
#define IMPORT(x) IMPORT_AS(x,#x)
bool
Layer_Composite::set_param(const String & param, const ValueBase &value)
{
- if(param=="amount" && value.same_as(amount_))
+ if(param=="amount" && value.same_type_as(amount_))
amount_=value.get(amount_);
else
- if(param=="blend_method" && value.same_as(int()))
+ if(param=="blend_method" && value.same_type_as(int()))
blend_method_=static_cast<Color::BlendMethod>(value.get(int()));
else
return Layer::set_param(param,value);
{
IMPORT(origin);
- if(param=="canvas" && value.same_as(Canvas::Handle()))
+ if(param=="canvas" && value.same_type_as(Canvas::Handle()))
{
set_sub_canvas(value.get(Canvas::Handle()));
return true;
bool
Layer_Polygon::set_param(const String & param, const ValueBase &value)
{
- if( param=="vector_list" && value.same_as(vector_list))
+ if( param=="vector_list" && value.same_type_as(vector_list))
{
vector_list=value;
Layer_Shape::clear();
//! Checks the type of the parameter against itself. Returns true if they are of the same type.
template <class T> bool
- same_as(const T &x)const
+ same_type_as(const T &x)const
{
const Type testtype(get_type(x));
template <typename T>
const T &get(const T& x)const
{
- assert(is_valid() && same_as(x));
+ assert(is_valid() && same_type_as(x));
return *static_cast<const T*>(data);
}
float get(const float &)const { return get(Real()); }
template <typename T>
void put(T* x)const
{
- assert(same_as(*x));
+ assert(same_type_as(*x));
*x=*static_cast<const T*>(data);
}
void put(float* x)const { *x=get(Real()); }
Value(const ValueBase &x):ValueBase(x)
{
- if(!x.same_as(T()))
+ if(!x.same_type_as(T()))
throw Exception::BadType("Value<T>(ValueBase): Type Mismatch");
}
Value<T>& operator=(const ValueBase& x)
{
- if(!x.same_as(T()))
+ if(!x.same_type_as(T()))
throw Exception::BadType("Value<T>(ValueBase): Type Mismatch");
return ValueBase::operator=(x);
}
}
Value(const ValueBase &x):ValueBase(x)
{
- if(!x.same_as(T()))
+ if(!x.same_type_as(T()))
throw Exception::BadType("Value<T>(ValueBase): Type Mismatch");
}
Value()
Value<T>& operator=(const ValueBase& x)
{
- if(!x.same_as(T()))
+ if(!x.same_type_as(T()))
throw Exception::BadType("Value<T>(ValueBase): Type Mismatch");
return ValueBase::operator=(x);
}
ValueNode_TimedSwap::set_swap_time(const ValueNode::Handle &x)
{
if(!x
- || !ValueBase(ValueBase::TYPE_TIME).same_as(x->get_type())
+ || !ValueBase(ValueBase::TYPE_TIME).same_type_as(x->get_type())
&& !PlaceholderValueNode::Handle::cast_dynamic(x)
)
return false;
ValueNode_TimedSwap::set_swap_length(const ValueNode::Handle &x)
{
if(!x || (
- !ValueBase(ValueBase::TYPE_TIME).same_as(x->get_type())
+ !ValueBase(ValueBase::TYPE_TIME).same_type_as(x->get_type())
&& !PlaceholderValueNode::Handle::cast_dynamic(x)
)
)
duck->set_origin(last_duck());
/*
ValueBase value(synfigapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time()));
- if(value.same_as(synfig::Point()))
+ if(value.same_type_as(synfig::Point()))
duck->set_origin(value.get(synfig::Point()));
*/
}
duck->set_origin(last_duck());
/*
ValueBase value(synfigapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time()));
- if(value.same_as(synfig::Point()))
+ if(value.same_type_as(synfig::Point()))
duck->set_origin(value.get(synfig::Point()));
*/
}
width->set_name(guid_string(synfigapp::ValueDesc(value_node,i))+".w");
{
ValueBase value(synfigapp::ValueDesc(value_desc.get_layer(),param_desc->get_hint()).get_value(get_time()));
- if(value.same_as(synfig::Real()))
+ if(value.same_type_as(synfig::Real()))
width->set_scalar(value.get(synfig::Real())*0.5f);
}
}
duck->set_origin(last_duck());
/*
ValueBase value(synfigapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time()));
- if(value.same_as(synfig::Point()))
+ if(value.same_type_as(synfig::Point()))
duck->set_origin(value.get(synfig::Point()));
*/
// if(!param_desc->get_origin().empty())
duck->set_origin(last_duck());
/*
ValueBase value(synfigapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time()));
- if(value.same_as(synfig::Point()))
+ if(value.same_type_as(synfig::Point()))
duck->set_origin(value.get(synfig::Point()));
*/
// if(!param_desc->get_origin().empty())
while(!layer_list.empty())
{
ValueBase value(layer_list.front()->get_param("amount"));
- if(value.same_as(Real()))
+ if(value.same_type_as(Real()))
{
get_canvas_interface()->change_value(synfigapp::ValueDesc(layer_list.front(),"amount"),value.get(Real())+adjust);
}
while(!layer_list.empty())
{
ValueBase value(layer_list.front()->get_param("amount"));
- if(value.same_as(Real()))
+ if(value.same_type_as(Real()))
{
get_canvas_interface()->change_value(synfigapp::ValueDesc(layer_list.front(),"amount"),value.get(Real())+adjust);
}
button_duplicate->set_sensitive(true);
button_delete->set_sensitive(true);
- if(layer_list.size()==1 && (*layer_list.begin())->get_param("amount").is_valid()&& (*layer_list.begin())->get_param("amount").same_as(Real()))
+ if(layer_list.size()==1 && (*layer_list.begin())->get_param("amount").is_valid()&& (*layer_list.begin())->get_param("amount").same_type_as(Real()))
{
quick_layer=*layer_list.begin();
}
x.set(false);
ValueBase v(layer->get_param("children_lock"));
- if(v.same_as(bool()))
+ if(v.same_type_as(bool()))
x.set(v.get(bool()));
g_value_init(value.gobj(),x.value_type());