From 36eb2d48c743d70ea39c3bd0afc1a23c127397aa Mon Sep 17 00:00:00 2001 From: clifford Date: Fri, 8 Jan 2010 03:35:04 +0000 Subject: Clifford Wolf: Fixed dumping/caching of import_* statements git-svn-id: http://svn.clifford.at/openscad/trunk@236 b57f626f-c46c-0410-a088-ec61d464b74c diff --git a/import.cc b/import.cc index 3d332b8..88fae83 100644 --- a/import.cc +++ b/import.cc @@ -200,23 +200,22 @@ QString ImportNode::dump(QString indent) const { if (dump_cache.isEmpty()) { QString text; + struct stat st; + memset(&st, 0, sizeof(struct stat)); + stat(filename.toAscii().data(), &st); if (type == TYPE_STL) - text.sprintf("import_stl(filename = \"%s\", convexity = %d);\n", - filename.toAscii().data(), convexity); + text.sprintf("import_stl(file = \"%s\", cache = \"%x.%x\", convexity = %d);\n", + filename.toAscii().data(), (int)st.st_mtime, (int)st.st_size, convexity); if (type == TYPE_OFF) - text.sprintf("import_off(filename = \"%s\", convexity = %d);\n", - filename.toAscii().data(), convexity); - if (type == TYPE_DXF) { - struct stat st; - memset(&st, 0, sizeof(struct stat)); - stat(filename.toAscii().data(), &st); + text.sprintf("import_off(file = \"%s\", cache = \"%x.%x\", convexity = %d);\n", + filename.toAscii().data(), (int)st.st_mtime, (int)st.st_size, convexity); + if (type == TYPE_DXF) text.sprintf("import_dxf(file = \"%s\", cache = \"%x.%x\", layer = \"%s\", " "origin = [ %f %f ], scale = %f, convexity = %d, " "$fn = %f, $fa = %f, $fs = %f);\n", filename.toAscii().data(), (int)st.st_mtime, (int)st.st_size, layername.toAscii().data(), origin_x, origin_y, scale, convexity, fn, fs, fa); - } ((AbstractNode*)this)->dump_cache = indent + QString("n%1: ").arg(idx) + text; } return dump_cache; -- cgit v0.10.1