Remove .gitignore do nothing is ignored.
[synfig.git] / synfig-core / trunk / src / synfig / valuenode_dynamiclist.cpp
index 7cdbd1f..a8c253a 100644 (file)
@@ -577,6 +577,12 @@ ValueNode_DynamicList::create_from(const ValueBase &value)
 
        ValueNode_DynamicList* value_node(new ValueNode_DynamicList(value_list.front().get_type()));
 
+       // when creating a list of vectors, start it off being looped.
+       // I think the only time this is used if for creating polygons,
+       // and we want them to be looped by default
+       if (value_node->get_contained_type() == ValueBase::TYPE_VECTOR)
+               value_node->set_loop(true);
+
        for(iter=value_list.begin();iter!=value_list.end();++iter)
        {
                ValueNode::Handle item(ValueNode_Const::create(*iter));
@@ -589,6 +595,9 @@ ValueNode_DynamicList::create_from(const ValueBase &value)
 ValueBase
 ValueNode_DynamicList::operator()(Time t)const
 {
+       if (getenv("SYNFIG_DEBUG_VALUENODE_OPERATORS"))
+               printf("%s:%d operator()\n", __FILE__, __LINE__);
+
        std::vector<ValueBase> ret_list;
        std::vector<ListEntry>::const_iterator iter;
 
@@ -660,7 +669,7 @@ ValueNode_DynamicList::clone(const GUID& deriv_guid)const
 {
        { ValueNode* x(find_value_node(get_guid()^deriv_guid).get()); if(x)return x; }
 
-       ValueNode_DynamicList* ret=new ValueNode_DynamicList(container_type);
+       ValueNode_DynamicList* ret=dynamic_cast<ValueNode_DynamicList*>(create_new());
        ret->set_guid(get_guid()^deriv_guid);
 
        std::vector<ListEntry>::const_iterator iter;
@@ -674,7 +683,7 @@ ValueNode_DynamicList::clone(const GUID& deriv_guid)const
                        ListEntry list_entry(*iter);
                        //list_entry.value_node=find_value_node(iter->value_node->get_guid()^deriv_guid).get();
                        //if(!list_entry.value_node)
-                               list_entry.value_node=iter->value_node->clone(deriv_guid);
+                       list_entry.value_node=iter->value_node->clone(deriv_guid);
                        ret->add(list_entry);
                        //ret->list.back().value_node=iter->value_node.clone();
                }
@@ -713,6 +722,13 @@ ValueNode_DynamicList::check_type(ValueBase::Type type)
        return type==ValueBase::TYPE_LIST;
 }
 
+void
+ValueNode_DynamicList::set_member_canvas(etl::loose_handle<Canvas> canvas)
+{
+       for (vector<ListEntry>::iterator iter = list.begin(); iter != list.end(); iter++)
+               iter->value_node->set_parent_canvas(canvas);
+}
+
 ValueBase::Type
 ValueNode_DynamicList::get_contained_type()const
 {
@@ -722,9 +738,7 @@ ValueNode_DynamicList::get_contained_type()const
 LinkableValueNode*
 ValueNode_DynamicList::create_new()const
 {
-       assert(0);
-
-       return 0;
+       return new ValueNode_DynamicList(container_type);
 }
 
 int