Skip to content

Commit

Permalink
Import svg using CanvasFileNaming helper
Browse files Browse the repository at this point in the history
  • Loading branch information
blackwarthog authored and morevnaproject committed Jun 18, 2016
1 parent d780cc4 commit 82e5102
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
15 changes: 6 additions & 9 deletions synfig-core/src/modules/mod_svg/layer_svg.cpp
Expand Up @@ -72,17 +72,13 @@ svg_layer::set_param(const String & param, const ValueBase &value)
if(param=="filename"){
Canvas::Handle canvas;
//if ext of filename == "svg" then
canvas=open_svg(value.get(String()),errors,warnings);
filename = value.get(String());
canvas=open_svg(CanvasFileNaming::make_full_filename(get_canvas()->get_file_path(), filename),errors,warnings);
//else other parsers maybe
if(canvas){
if(canvas)
canvas->set_inline(get_canvas());
set_sub_canvas(canvas);
if(param=="filename" && value.same_type_as(filename))
{
value.put(&filename);
return true;
}
}
set_sub_canvas(canvas);
return true;
}
return Layer_Group::set_param(param,value);
}
Expand All @@ -108,6 +104,7 @@ svg_layer::get_param_vocab()const

ret.push_back(ParamDesc("filename")
.set_local_name(_("Filename"))
.set_hint("filename")
);
return ret;
}
Expand Down
6 changes: 5 additions & 1 deletion synfig-studio/src/synfigapp/canvasinterface.cpp
Expand Up @@ -792,7 +792,11 @@ CanvasInterface::import(const synfig::String &filename, synfig::String &errors,
// If this is a SIF file, then we need to do things slightly differently
if (ext=="sif" || ext=="sifz")try
{
Canvas::Handle outside_canvas(synfig::open_canvas_as(get_canvas()->get_identifier().file_system->get_identifier(full_filename), full_filename, errors, warnings));
FileSystem::Handle file_system = CanvasFileNaming::make_filesystem(full_filename);
if(!file_system)
throw String(_("Unable to open container")) + ":\n\n" + errors;

Canvas::Handle outside_canvas(synfig::open_canvas_as(file_system->get_identifier(CanvasFileNaming::find_canvas_file(file_system)), full_filename, errors, warnings));
if(!outside_canvas)
throw String(_("Unable to open this composition")) + ":\n\n" + errors;

Expand Down

0 comments on commit 82e5102

Please sign in to comment.