27 #ifndef __SYNFIG_APP_VALUE_DESC_H
28 #define __SYNFIG_APP_VALUE_DESC_H
32 #include <synfig/valuenode.h>
33 #include <synfig/string.h>
34 #include <synfig/layer.h>
35 #include <synfig/value.h>
36 #include <synfig/valuenodes/valuenode_animated.h>
37 #include <synfig/valuenodes/valuenode_const.h>
38 #include <synfig/canvas.h>
39 #include <synfig/interpolation.h>
58 synfig::Time waypoint_time;
67 std::vector<synfig::String> sub_names;
84 if((layer||rhs.layer) && layer!=rhs.layer)
86 if((!name.empty()||!rhs.name.empty()) && name!=rhs.name)
90 if((canvas||rhs.canvas) && canvas!=rhs.canvas)
92 if((parent_value_node||rhs.parent_value_node) && (parent_value_node!=rhs.parent_value_node))
94 if(scalar!=rhs.scalar)
98 if(sub_names!=rhs.sub_names)
112 parent_value_node = other.parent_value_node;
114 waypoint_time = other.waypoint_time;
115 canvas = other.canvas;
116 scalar = other.scalar;
117 sub_names = other.sub_names;
118 if (parent_desc != NULL && 0 >= --parent_desc->links_count)
120 parent_desc = other.parent_desc;
121 if (parent_desc != NULL) parent_desc->links_count++;
130 parent_desc(init_parent(parent)),
134 ValueDesc(synfig::Layer::LooseHandle layer,
const synfig::String& param_name,
const ValueDesc &parent = blank):
139 parent_desc(init_parent(parent)),
144 parent_value_node(parent_value_node),
147 parent_desc(init_parent(parent)),
152 parent_value_node(parent_value_node),
155 parent_desc(init_parent(parent)),
167 parent_value_node(parent_value_node),
169 waypoint_time(waypoint_time),
171 parent_desc(init_parent(parent)),
180 parent_desc(init_parent(parent)),
185 parent_value_node(parent_value_node),
188 parent_desc(init_parent(parent)),
195 parent_value_node(parent.parent_value_node),
197 waypoint_time(parent.waypoint_time),
198 canvas(parent.canvas),
199 scalar(parent.scalar),
200 parent_desc(init_parent(parent)),
203 assert(!sub_name.empty());
204 sub_names.reserve(parent.sub_names.size() + 1);
205 sub_names.insert(sub_names.end(), parent.sub_names.begin(), parent.sub_names.end());
206 sub_names.push_back(sub_name);
213 parent_value_node(other.parent_value_node),
215 waypoint_time(other.waypoint_time),
216 canvas(other.canvas),
217 scalar(other.scalar),
218 sub_names(other.sub_names),
219 parent_desc(other.parent_desc),
222 if (parent_desc != NULL) parent_desc->links_count++;
226 index(-1), scalar(0), parent_desc(NULL), links_count(0) { }
230 assert(links_count == 0);
231 if (parent_desc != NULL && 0 >= --parent_desc->links_count)
238 {
return layer || parent_value_node || canvas; }
244 {
return (
bool)layer; }
247 {
return (
bool)parent_value_node; }
259 {
return (
bool)canvas; }
262 {
return !sub_names.empty(); }
268 || (
parent_is_layer() && (bool)layer->dynamic_param_list().count(name));
272 {
return (
parent_is_layer() && !layer->dynamic_param_list().count(name))
280 && layer->dynamic_param_list().count(name)
281 && synfig::ValueNode_Animated::Handle::cast_dynamic(layer->dynamic_param_list().find(name)->second))
283 && synfig::ValueNode_Animated::Handle::cast_dynamic(
get_value_node()));
288 {
return parent_desc != NULL; }
292 {
return parent_desc == NULL ? blank : *parent_desc; }
302 const synfig::String&
310 synfig::Layer::Vocab vocab = layer->get_param_vocab();
311 for(synfig::Layer::Vocab::iterator i = vocab.begin(); i != vocab.end(); i++)
312 if (i->get_name() == name)
313 { out_param_desc = *i;
return true; }
332 { assert(
parent_is_linkable_value_node());
return (synfig::LinkableValueNode::Handle::cast_reinterpret(parent_value_node))->link_name(index); }
334 const std::vector<synfig::String>&
338 const synfig::String&
346 const synfig::String&
356 return layer->get_canvas();
357 if(parent_value_node)
358 return parent_value_node->get_root_canvas();
366 return canvas->find_value_node(name,
false);
368 return layer->dynamic_param_list().find(name)->second;
370 return (synfig::LinkableValueNode::Handle::cast_reinterpret(parent_value_node))->get_link(index);
373 return parent_value_node;
375 return (synfig::ValueNode_Animated::Handle::cast_reinterpret(parent_value_node))->find(waypoint_time)->get_value_node();
384 return (*parent_value_node)(0);
388 return layer->get_param(name);
389 return synfig::ValueBase();
397 return value_node->get_type();
410 synfig::Interpolation
419 return value->get_interpolation();
421 return synfig::Interpolation(5);
442 return synfig::GUID::zero();
459 return sub_name.empty() ? *
this :
ValueDesc(*
this, sub_name);