fixed some problems

Sun, 01 Apr 2018 11:39:07 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Sun, 01 Apr 2018 11:39:07 +0300
changeset 1367
0aab8d972cf6
parent 1365
3f917410e977
child 1368
36105978da93

fixed some problems

src/documentmanager.cpp file | annotate | diff | comparison | revisions
src/linetypes/modelobject.cpp file | annotate | diff | comparison | revisions
--- a/src/documentmanager.cpp	Sat Mar 31 21:23:22 2018 +0300
+++ b/src/documentmanager.cpp	Sun Apr 01 11:39:07 2018 +0300
@@ -216,15 +216,14 @@
 		if (fileToOverride == nullptr)
 			load = m_window->newDocument(implicit);
 
-		load->setFullPath(path);
-		load->setName(LDDocument::shortenName(path));
-
 		// Loading the file shouldn't count as actual edits to the document.
 		load->history()->setIgnoring (true);
 
 		Parser parser {file};
 		Winding winding = NoWinding;
 		load->header = parser.parseHeader(winding);
+		load->setFullPath(path);
+		load->setName(LDDocument::shortenName(path));
 		load->setWinding(winding);
 		parser.parseBody(*load);
 		file.close();
--- a/src/linetypes/modelobject.cpp	Sat Mar 31 21:23:22 2018 +0300
+++ b/src/linetypes/modelobject.cpp	Sun Apr 01 11:39:07 2018 +0300
@@ -164,19 +164,24 @@
 	bool deep,
 	bool render
 ) {
-	Model inlined {context};
-	fileInfo(context)->inlineContents(inlined, deep, render);
+	LDDocument* subfile = this->fileInfo(context);
 
-	// Transform the objects
-	for (LDObject* object : inlined)
+	if (subfile != nullptr)
 	{
-		if (::shouldInvert(this, parentWinding, context))
-			::invert(object, context);
+		Model inlined {context};
+		subfile->inlineContents(inlined, deep, render);
 
-		TransformObject(object, transformationMatrix(), position(), color());
+		// Transform the objects
+		for (LDObject* object : inlined)
+		{
+			if (::shouldInvert(this, parentWinding, context))
+				::invert(object, context);
+
+			TransformObject(object, transformationMatrix(), position(), color());
+		}
+
+		model.merge(inlined);
 	}
-
-	model.merge(inlined);
 }
 
 // =============================================================================

mercurial