bool Layer::connect_dynamic_param(const String& param, etl::loose_handle<ValueNode> value_node) { if (!value_node) return disconnect_dynamic_param(param); ValueNode::Handle previous; DynamicParamList::iterator i = dynamic_param_list_.find(param); if (i != dynamic_param_list_.end()) previous = i->second; if (previous == value_node) return true; String param_noref = param; dynamic_param_list_[param]=ValueNode::Handle(value_node); if (previous) { // 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()); } add_child(value_node.get()); if(!value_node->is_exported() && get_canvas()) value_node->set_parent_canvas(get_canvas()); dynamic_param_changed(param); changed(); return true; }
bool Layer::connect_dynamic_param(const String& param, etl::loose_handle<ValueNode> value_node) { ValueNode::Handle previous(dynamic_param_list_[param]); if(previous==value_node) return true; dynamic_param_list_[param]=ValueNode::Handle(value_node); if(previous) remove_child(previous.get()); add_child(value_node.get()); if(!value_node->is_exported() && get_canvas()) { value_node->set_parent_canvas(get_canvas()); } changed(); return true; }