/* === M E T H O D S ======================================================= */
-Canvas::Canvas(const string &id):
+Canvas::Canvas(const String &id):
id_ (id),
+ version_ (CURRENT_CANVAS_VERSION),
cur_time_ (0),
is_inline_ (false),
is_dirty_ (true),
{
//if(is_inline() && parent_) assert(0);
_CanvasCounter::counter--;
- //DEBUGPOINT();
clear();
begin_delete();
}
return parent_->add_value_node(x,id);
// throw runtime_error("You cannot add a ValueNode to an inline Canvas");
- //DEBUGPOINT();
if(x->is_exported())
throw runtime_error("ValueNode is already exported");
try
{
- //DEBUGPOINT();
if(PlaceholderValueNode::Handle::cast_dynamic(value_node_list_.find(id)))
throw Exception::IDNotFound("add_value_node()");
- //DEBUGPOINT();
throw Exception::IDAlreadyExists(id);
}
catch(Exception::IDNotFound)
{
- //DEBUGPOINT();
x->set_id(id);
x->set_parent_canvas(this);
synfig::error("Unable to add ValueNode");
throw std::runtime_error("Unable to add ValueNode");
}
- //DEBUGPOINT();
return;
}
void
Canvas::push_back(etl::handle<Layer> x)
{
-// DEBUGPOINT();
// int i(x->count());
insert(end(),x);
//if(x->count()!=i+1)synfig::info("push_back before %d, after %d",i,x->count());
void
Canvas::push_front(etl::handle<Layer> x)
{
-// DEBUGPOINT();
// int i(x->count());
insert(begin(),x);
//if(x->count()!=i+1)synfig::error("push_front before %d, after %d",i,x->count());
}
void
-Canvas::erase(Canvas::iterator iter)
+Canvas::erase(iterator iter)
{
if(!(*iter)->get_group().empty())
remove_group_pair((*iter)->get_group(),(*iter));
{
name=get_id()+"_CLONE";
- throw runtime_error("Cloning of non-inline canvases is not yet suported");
+ throw runtime_error("Cloning of non-inline canvases is not yet supported");
}
Handle canvas(new Canvas(name));
if(is_inline())
{
canvas->is_inline_=true;
- canvas->parent_=0;
+ // \todo this was setting parent_=0 - is there a reason for that?
+ // this was causing bug 1838132, where cloning an inline canvas that contains an imported image fails
+ // it was failing to ascertain the absolute pathname of the imported image, since it needs the pathname
+ // of the canvas to get that, which is stored in the parent canvas
+ canvas->parent_=parent();
//canvas->set_inline(parent());
}
return ret;
}
+/* note - the "Motion Blur" and "Duplicate" layers need the dynamic
+ parameters of any PasteCanvas layers they loop over to be
+ maintained. When the variables in the following function
+ refer to "motion blur", they mean either of these two
+ layers. */
void
synfig::optimize_layers(Context context, Canvas::Handle op_canvas, bool seen_motion_blur_in_parent)
{
if(value.get_type()==ValueBase::TYPE_REAL && value.get(Real())==0)
continue;
- if(layer->get_name()=="MotionBlur")
+ if(layer->get_name()=="MotionBlur" || layer->get_name()=="duplicate")
{
float z_depth(layer->get_z_depth()*1.0001+i);
}
void
-Canvas::add_connection(Layer::LooseHandle layer, sigc::connection connection)
+Canvas::add_connection(etl::loose_handle<Layer> layer, sigc::connection connection)
{
connections_[layer].push_back(connection);
}
void
-Canvas::disconnect_connections(Layer::LooseHandle layer)
+Canvas::disconnect_connections(etl::loose_handle<Layer> layer)
{
std::vector<sigc::connection>::iterator iter;
for(iter=connections_[layer].begin();iter!=connections_[layer].end();++iter)