Browse Source

Handle finished signal for the ReadMeshJob started from command line args

This puts the actual mesh into the scene rather than just loading it and
discarding it afterwards. Now file arguments supplied to the application
actually work.

Fixes "Open With" on Windows and the related Asana issue.
Arjen Hiemstra 9 years ago
parent
commit
a53e56e282
1 changed files with 13 additions and 0 deletions
  1. 13 0
      cura/CuraApplication.py

+ 13 - 0
cura/CuraApplication.py

@@ -162,6 +162,7 @@ class CuraApplication(QtApplication):
 
             for file in self.getCommandLineOption("file", []):
                 job = ReadMeshJob(os.path.abspath(file))
+                job.finished.connect(self._onFileLoaded)
                 job.start()
 
             self.exec_()
@@ -447,3 +448,15 @@ class CuraApplication(QtApplication):
     def _onMessageActionTriggered(self, message, action):
         if action == "eject":
             self.getStorageDevice("LocalFileStorage").ejectRemovableDrive(message._sdcard)
+
+    def _onFileLoaded(self, job):
+        mesh = job.getResult()
+        if mesh != None:
+            node = SceneNode()
+
+            node.setSelectable(True)
+            node.setMeshData(mesh)
+            node.setName(os.path.basename(job.getFileName()))
+
+            op = AddSceneNodeOperation(node, self.getController().getScene().getRoot())
+            op.push()