|
@@ -7,6 +7,7 @@ from UM.Scene.Camera import Camera
|
|
|
from UM.Scene.Platform import Platform
|
|
|
from UM.Math.Vector import Vector
|
|
|
from UM.Math.Matrix import Matrix
|
|
|
+from UM.Math.Quaternion import Quaternion
|
|
|
from UM.Resources import Resources
|
|
|
from UM.Scene.ToolHandle import ToolHandle
|
|
|
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
|
|
@@ -35,6 +36,7 @@ from . import PrintInformation
|
|
|
from PyQt5.QtCore import pyqtSlot, QUrl, Qt, pyqtSignal, pyqtProperty
|
|
|
from PyQt5.QtGui import QColor
|
|
|
|
|
|
+import platform
|
|
|
import sys
|
|
|
import os.path
|
|
|
import numpy
|
|
@@ -42,10 +44,11 @@ numpy.seterr(all="ignore")
|
|
|
|
|
|
class CuraApplication(QtApplication):
|
|
|
def __init__(self):
|
|
|
+ Resources.addResourcePath(os.path.join(QtApplication.getInstallPrefix(), "share", "cura"))
|
|
|
if not hasattr(sys, "frozen"):
|
|
|
Resources.addResourcePath(os.path.join(os.path.abspath(os.path.dirname(__file__)), ".."))
|
|
|
|
|
|
- super().__init__(name = "cura", version = "master")
|
|
|
+ super().__init__(name = "cura", version = "15.05.90")
|
|
|
|
|
|
self.setRequiredPlugins([
|
|
|
"CuraEngineBackend",
|
|
@@ -72,6 +75,7 @@ class CuraApplication(QtApplication):
|
|
|
## Handle loading of all plugin types (and the backend explicitly)
|
|
|
# \sa PluginRegistery
|
|
|
def _loadPlugins(self):
|
|
|
+ self._plugin_registry.addPluginLocation(os.path.join(QtApplication.getInstallPrefix(), "lib", "cura"))
|
|
|
if not hasattr(sys, "frozen"):
|
|
|
self._plugin_registry.addPluginLocation(os.path.join(os.path.abspath(os.path.dirname(__file__)), "..", "plugins"))
|
|
|
|
|
@@ -85,6 +89,9 @@ class CuraApplication(QtApplication):
|
|
|
|
|
|
self._plugin_registry.loadPlugin("CuraEngineBackend")
|
|
|
|
|
|
+ def addCommandLineOptions(self, parser):
|
|
|
+ parser.add_argument("file", nargs="*", help="Files to load after starting the application.")
|
|
|
+
|
|
|
def run(self):
|
|
|
self._i18n_catalog = i18nCatalog("cura");
|
|
|
|
|
@@ -153,6 +160,10 @@ class CuraApplication(QtApplication):
|
|
|
if self._engine.rootObjects:
|
|
|
self.closeSplash()
|
|
|
|
|
|
+ for file in self.getCommandLineOption("file", []):
|
|
|
+ job = ReadMeshJob(os.path.abspath(file))
|
|
|
+ job.start()
|
|
|
+
|
|
|
self.exec_()
|
|
|
|
|
|
def registerObjects(self, engine):
|
|
@@ -205,9 +216,7 @@ class CuraApplication(QtApplication):
|
|
|
node = self.getController().getScene().findObject(object_id)
|
|
|
|
|
|
if node:
|
|
|
- transform = node.getLocalTransformation()
|
|
|
- transform.setTranslation(Vector(0, 0, 0))
|
|
|
- op = SetTransformOperation(node, transform)
|
|
|
+ op = SetTransformOperation(node, Vector())
|
|
|
op.push()
|
|
|
|
|
|
## Delete all mesh data on the scene.
|
|
@@ -240,9 +249,7 @@ class CuraApplication(QtApplication):
|
|
|
op = GroupedOperation()
|
|
|
|
|
|
for node in nodes:
|
|
|
- transform = node.getLocalTransformation()
|
|
|
- transform.setTranslation(Vector(0, 0, 0))
|
|
|
- op.addOperation(SetTransformOperation(node, transform))
|
|
|
+ op.addOperation(SetTransformOperation(node, Vector()))
|
|
|
|
|
|
op.push()
|
|
|
|
|
@@ -259,8 +266,7 @@ class CuraApplication(QtApplication):
|
|
|
op = GroupedOperation()
|
|
|
|
|
|
for node in nodes:
|
|
|
- transform = Matrix()
|
|
|
- op.addOperation(SetTransformOperation(node, transform))
|
|
|
+ op.addOperation(SetTransformOperation(node, Vector(), Quaternion(), Vector(1, 1, 1)))
|
|
|
|
|
|
op.push()
|
|
|
|
|
@@ -274,12 +280,18 @@ class CuraApplication(QtApplication):
|
|
|
|
|
|
nodes.append(node)
|
|
|
|
|
|
- if nodes:
|
|
|
- file_name = node.getMeshData().getFileName()
|
|
|
+ if not nodes:
|
|
|
+ return
|
|
|
|
|
|
- job = ReadMeshJob(file_name)
|
|
|
- job.finished.connect(lambda j: node.setMeshData(j.getResult()))
|
|
|
- job.start()
|
|
|
+ for node in nodes:
|
|
|
+ if not node.getMeshData():
|
|
|
+ continue
|
|
|
+
|
|
|
+ file_name = node.getMeshData().getFileName()
|
|
|
+ if file_name:
|
|
|
+ job = ReadMeshJob(file_name)
|
|
|
+ job.finished.connect(lambda j: node.setMeshData(j.getResult()))
|
|
|
+ job.start()
|
|
|
|
|
|
## Get logging data of the backend engine
|
|
|
# \returns \type{string} Logging data
|