model.cpp

changeset 23
69a91c1ff583
parent 22
335e430a6b4f
--- a/model.cpp	Sat Mar 16 17:50:13 2013 +0200
+++ b/model.cpp	Mon Mar 18 03:38:51 2013 +0200
@@ -4,6 +4,7 @@
 #include "io.h"
 #include "gui.h"
 #include "draw.h"
+#include "bbox.h"
 
 // Clear everything from the model
 void closeModel () {
@@ -37,6 +38,21 @@
 	g_qWindow->R->hardRefresh();
 }
 
+void openModel (str zPath) {
+	if (g_CurrentFile)
+		closeModel ();
+	
+	OpenFile* pFile = IO_OpenLDrawFile (zPath);
+	g_CurrentFile = pFile;
+	
+	// Recalculate the bounding box
+	g_BBox.calculate();
+	
+	// Rebuild the object tree view now.
+	g_qWindow->buildObjList ();
+	g_qWindow->setTitle ();
+}
+
 void saveModel () {
 	if (!g_CurrentFile)
 		return;

mercurial