mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-09 03:49:00 +08:00
Merge branch 'master' of github.com:Ultimaker/Cura
This commit is contained in:
commit
433d45cdae
18
cura/CuraApplication.py
Normal file → Executable file
18
cura/CuraApplication.py
Normal file → Executable file
@ -1094,18 +1094,6 @@ class CuraApplication(QtApplication):
|
|||||||
|
|
||||||
fileLoaded = pyqtSignal(str)
|
fileLoaded = pyqtSignal(str)
|
||||||
|
|
||||||
def _onFileLoaded(self, job):
|
|
||||||
nodes = job.getResult()
|
|
||||||
for node in nodes:
|
|
||||||
if node is not None:
|
|
||||||
self.fileLoaded.emit(job.getFileName())
|
|
||||||
node.setSelectable(True)
|
|
||||||
node.setName(os.path.basename(job.getFileName()))
|
|
||||||
op = AddSceneNodeOperation(node, self.getController().getScene().getRoot())
|
|
||||||
op.push()
|
|
||||||
|
|
||||||
self.getController().getScene().sceneChanged.emit(node) #Force scene change.
|
|
||||||
|
|
||||||
def _onJobFinished(self, job):
|
def _onJobFinished(self, job):
|
||||||
if type(job) is not ReadMeshJob or not job.getResult():
|
if type(job) is not ReadMeshJob or not job.getResult():
|
||||||
return
|
return
|
||||||
@ -1133,10 +1121,8 @@ class CuraApplication(QtApplication):
|
|||||||
else:
|
else:
|
||||||
Logger.log("w", "Could not find a mesh in reloaded node.")
|
Logger.log("w", "Could not find a mesh in reloaded node.")
|
||||||
|
|
||||||
def _openFile(self, file):
|
def _openFile(self, filename):
|
||||||
job = ReadMeshJob(os.path.abspath(file))
|
self.readLocalFile(QUrl.fromLocalFile(filename))
|
||||||
job.finished.connect(self._onFileLoaded)
|
|
||||||
job.start()
|
|
||||||
|
|
||||||
def _addProfileReader(self, profile_reader):
|
def _addProfileReader(self, profile_reader):
|
||||||
# TODO: Add the profile reader to the list of plug-ins that can be used when importing profiles.
|
# TODO: Add the profile reader to the list of plug-ins that can be used when importing profiles.
|
||||||
|
@ -342,11 +342,6 @@ class CuraEngineBackend(QObject, Backend):
|
|||||||
#
|
#
|
||||||
# \param source The scene node that was changed.
|
# \param source The scene node that was changed.
|
||||||
def _onSceneChanged(self, source):
|
def _onSceneChanged(self, source):
|
||||||
if self._tool_active:
|
|
||||||
# do it later
|
|
||||||
self._postponed_scene_change_sources.append(source)
|
|
||||||
return
|
|
||||||
|
|
||||||
if type(source) is not SceneNode:
|
if type(source) is not SceneNode:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -354,25 +349,27 @@ class CuraEngineBackend(QObject, Backend):
|
|||||||
if source == self._scene.getRoot():
|
if source == self._scene.getRoot():
|
||||||
num_objects = 0
|
num_objects = 0
|
||||||
for node in DepthFirstIterator(self._scene.getRoot()):
|
for node in DepthFirstIterator(self._scene.getRoot()):
|
||||||
# For now this seems to be a reliable method to check for nodes that impact slicing
|
# Only count sliceable objects
|
||||||
# From: SliceInfo, _onWriteStarted
|
if node.callDecoration("isSliceable"):
|
||||||
if type(node) is not SceneNode or not node.getMeshData():
|
num_objects += 1
|
||||||
continue
|
|
||||||
num_objects += 1
|
|
||||||
if num_objects != self._last_num_objects:
|
if num_objects != self._last_num_objects:
|
||||||
self._last_num_objects = num_objects
|
self._last_num_objects = num_objects
|
||||||
root_scene_nodes_changed = True
|
root_scene_nodes_changed = True
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.determineAutoSlicing()
|
|
||||||
|
|
||||||
if not source.callDecoration("isGroup") and not root_scene_nodes_changed:
|
if not source.callDecoration("isGroup") and not root_scene_nodes_changed:
|
||||||
if source.getMeshData() is None:
|
if source.getMeshData() is None:
|
||||||
return
|
return
|
||||||
if source.getMeshData().getVertices() is None:
|
if source.getMeshData().getVertices() is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if self._tool_active:
|
||||||
|
# do it later, each source only has to be done once
|
||||||
|
if source not in self._postponed_scene_change_sources:
|
||||||
|
self._postponed_scene_change_sources.append(source)
|
||||||
|
return
|
||||||
|
|
||||||
self.needsSlicing()
|
self.needsSlicing()
|
||||||
self.stopSlicing()
|
self.stopSlicing()
|
||||||
self._onChanged()
|
self._onChanged()
|
||||||
@ -517,6 +514,7 @@ class CuraEngineBackend(QObject, Backend):
|
|||||||
# \param tool The tool that the user was using.
|
# \param tool The tool that the user was using.
|
||||||
def _onToolOperationStopped(self, tool):
|
def _onToolOperationStopped(self, tool):
|
||||||
self._tool_active = False # React on scene change again
|
self._tool_active = False # React on scene change again
|
||||||
|
self.determineAutoSlicing() # Switch timer on if appropriate
|
||||||
# Process all the postponed scene changes
|
# Process all the postponed scene changes
|
||||||
while self._postponed_scene_change_sources:
|
while self._postponed_scene_change_sources:
|
||||||
source = self._postponed_scene_change_sources.pop(0)
|
source = self._postponed_scene_change_sources.pop(0)
|
||||||
|
5
plugins/SliceInfoPlugin/SliceInfo.py
Normal file → Executable file
5
plugins/SliceInfoPlugin/SliceInfo.py
Normal file → Executable file
@ -90,9 +90,8 @@ class SliceInfo(Extension):
|
|||||||
# Listing all files placed on the buildplate
|
# Listing all files placed on the buildplate
|
||||||
modelhashes = []
|
modelhashes = []
|
||||||
for node in DepthFirstIterator(CuraApplication.getInstance().getController().getScene().getRoot()):
|
for node in DepthFirstIterator(CuraApplication.getInstance().getController().getScene().getRoot()):
|
||||||
if type(node) is not SceneNode or not node.getMeshData():
|
if node.callDecoration("isSliceable"):
|
||||||
continue
|
modelhashes.append(node.getMeshData().getHash())
|
||||||
modelhashes.append(node.getMeshData().getHash())
|
|
||||||
|
|
||||||
# Creating md5sums and formatting them as discussed on JIRA
|
# Creating md5sums and formatting them as discussed on JIRA
|
||||||
modelhash_formatted = ",".join(modelhashes)
|
modelhash_formatted = ",".join(modelhashes)
|
||||||
|
@ -262,6 +262,7 @@ Item
|
|||||||
id: reloadAllAction;
|
id: reloadAllAction;
|
||||||
text: catalog.i18nc("@action:inmenu menubar:file","Re&load All Models");
|
text: catalog.i18nc("@action:inmenu menubar:file","Re&load All Models");
|
||||||
iconName: "document-revert";
|
iconName: "document-revert";
|
||||||
|
shortcut: "F5"
|
||||||
onTriggered: Printer.reloadAll();
|
onTriggered: Printer.reloadAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user