DXF export: always declare layers before using them.

Before this commit, the #s001-active-grp layer was not declared,
and this broke some external software, such as Inkscape.
See https://bugs.launchpad.net/inkscape/+bug/1472429 for details.
pull/36/head
EvilSpirit 2016-08-07 19:42:05 +07:00 committed by whitequark
parent 35a20ae260
commit e381c70842
1 changed files with 7 additions and 12 deletions

View File

@ -167,21 +167,16 @@ public:
layer.name = "text";
dxf->writeLayer(&layer);
for(int i = 0; i < SK.style.n; i++) {
Style *s = &SK.style.elem[i];
std::set<uint32_t> usedStyles;
// check for using
bool used = false;
for(DxfFileWriter::BezierPath &path : writer->paths) {
for(SBezier *sb : path.beziers) {
if((uint32_t)sb->auxA != s->h.v) continue;
used = true;
break;
usedStyles.insert((uint32_t)sb->auxA);
}
if(used) break;
}
if(!used) continue;
for(uint32_t v : usedStyles) {
Style *s = Style::Get(hStyle{v});
layer.name = s->DescriptionString();
dxf->writeLayer(&layer);
}