Remove .gitignore do nothing is ignored.
[synfig.git] / synfig-core / trunk / src / synfig / layer.cpp
index 4c9eb35..8fcbfbf 100644 (file)
@@ -266,7 +266,19 @@ Layer::disconnect_dynamic_param(const String& param)
        if(previous)
        {
                dynamic_param_list_.erase(param);
-               remove_child(previous.get());
+
+               // fix 2353284: if two parameters in the same layer are
+               // connected to the same valuenode and we disconnect one of
+               // them, the parent-child relationship for the remaining
+               // connection was being deleted.  now we search the parameter
+               // list to see if another parameter uses the same valuenode
+               DynamicParamList::const_iterator iter;
+               for (iter = dynamic_param_list().begin(); iter != dynamic_param_list().end(); iter++)
+                       if (iter->second == previous)
+                               break;
+               if (iter == dynamic_param_list().end())
+                       remove_child(previous.get());
+
                changed();
        }
        return true;
@@ -276,8 +288,7 @@ void
 Layer::on_changed()
 {
        dirty_time_=Time::end();
-       if(active())
-               Node::on_changed();
+       Node::on_changed();
 }
 
 bool
@@ -305,18 +316,20 @@ Layer::get_z_depth(const synfig::Time& t)const
        return (*dynamic_param_list().find("z_depth")->second)(t).get(Real());
 }
 
-#ifdef THIS_CODE_IS_NOT_USED
-Layer*
+Layer::Handle
 Layer::simple_clone()const
 {
        if(!book().count(get_name())) return 0;
-       Layer *ret = create(get_name()).get();
-       ret->set_canvas(get_canvas());
+       Handle ret = create(get_name()).get();
+       ret->group_=group_;
+       //ret->set_canvas(get_canvas());
        ret->set_description(get_description());
+       ret->set_active(active());
        ret->set_param_list(get_param_list());
+       for(DynamicParamList::const_iterator iter=dynamic_param_list().begin();iter!=dynamic_param_list().end();++iter)
+               ret->connect_dynamic_param(iter->first, iter->second);
        return ret;
 }
-#endif /* THIS_CODE_IS_NOT_USED */
 
 Layer::Handle
 Layer::clone(const GUID& deriv_guid) const