mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 13:49:02 +08:00
Merge branch 'master' of github.com:Ultimaker/Cura
This commit is contained in:
commit
4474b16847
@ -350,6 +350,8 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||||||
extruder_stacks_added = []
|
extruder_stacks_added = []
|
||||||
container_stacks_added = []
|
container_stacks_added = []
|
||||||
|
|
||||||
|
containers_added = []
|
||||||
|
|
||||||
global_stack_id_original = self._stripFileToId(global_stack_file)
|
global_stack_id_original = self._stripFileToId(global_stack_file)
|
||||||
global_stack_id_new = global_stack_id_original
|
global_stack_id_new = global_stack_id_original
|
||||||
global_stack_need_rename = False
|
global_stack_need_rename = False
|
||||||
@ -497,73 +499,12 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||||||
for container in containers_to_add:
|
for container in containers_to_add:
|
||||||
self._container_registry.addContainer(container)
|
self._container_registry.addContainer(container)
|
||||||
container.setDirty(True)
|
container.setDirty(True)
|
||||||
|
containers_added.append(container)
|
||||||
|
|
||||||
# Get the stack(s) saved in the workspace.
|
# Get the stack(s) saved in the workspace.
|
||||||
Logger.log("d", "Workspace loading is checking stacks containers...")
|
Logger.log("d", "Workspace loading is checking stacks containers...")
|
||||||
|
|
||||||
# load extruder stack files
|
# --
|
||||||
try:
|
|
||||||
for index, extruder_stack_file in enumerate(extruder_stack_files):
|
|
||||||
container_id = self._stripFileToId(extruder_stack_file)
|
|
||||||
|
|
||||||
container_stacks = self._container_registry.findContainerStacks(id = container_id)
|
|
||||||
if container_stacks:
|
|
||||||
# this container stack already exists, try to resolve
|
|
||||||
stack = container_stacks[0]
|
|
||||||
if self._resolve_strategies["machine"] == "override":
|
|
||||||
pass # do nothing
|
|
||||||
elif self._resolve_strategies["machine"] == "new":
|
|
||||||
# create a new extruder stack from this one
|
|
||||||
new_id = self.getNewId(container_id)
|
|
||||||
stack = ExtruderStack(new_id)
|
|
||||||
stack.deserialize(archive.open(extruder_stack_file).read().decode("utf-8"))
|
|
||||||
|
|
||||||
# Ensure a unique ID and name
|
|
||||||
stack._id = new_id
|
|
||||||
|
|
||||||
self._container_registry.addContainer(stack)
|
|
||||||
extruder_stacks_added.append(stack)
|
|
||||||
else:
|
|
||||||
if self._resolve_strategies["machine"] == "override":
|
|
||||||
global_stacks = self._container_registry.findContainerStacks(id = global_stack_id_original)
|
|
||||||
# deserialize new extruder stack over the current ones
|
|
||||||
if global_stacks:
|
|
||||||
old_extruder_stack_id = global_stacks[0].extruders[index].getId()
|
|
||||||
# HACK delete file
|
|
||||||
self._container_registry._deleteFiles(global_stacks[0].extruders[index])
|
|
||||||
global_stacks[0].extruders[index].deserialize(archive.open(extruder_stack_file).read().decode("utf-8"))
|
|
||||||
# HACK
|
|
||||||
global_stacks[0]._extruders = global_stacks[0]._extruders[:2]
|
|
||||||
# HACK update cache
|
|
||||||
del self._container_registry._id_container_cache[old_extruder_stack_id]
|
|
||||||
new_extruder_stack_id = global_stacks[0].extruders[index].getId()
|
|
||||||
self._container_registry._id_container_cache[new_extruder_stack_id] = global_stacks[0].extruders[index]
|
|
||||||
|
|
||||||
stack = global_stacks[0].extruders[index]
|
|
||||||
else:
|
|
||||||
Logger.log("w", "Could not find global stack, while I expected it: %s" % global_stack_id_original)
|
|
||||||
elif self._resolve_strategies["machine"] == "new":
|
|
||||||
# container not found, create a new one
|
|
||||||
stack = ExtruderStack(container_id)
|
|
||||||
stack.deserialize(archive.open(extruder_stack_file).read().decode("utf-8"))
|
|
||||||
self._container_registry.addContainer(stack)
|
|
||||||
extruder_stacks_added.append(stack)
|
|
||||||
else:
|
|
||||||
Logger.log("w", "Unknown resolve strategy: %s" % str(self._resolve_strategies["machine"]))
|
|
||||||
|
|
||||||
if global_stack_need_rename:
|
|
||||||
if stack.getMetaDataEntry("machine"):
|
|
||||||
stack.setMetaDataEntry("machine", global_stack_id_new)
|
|
||||||
extruder_stacks.append(stack)
|
|
||||||
|
|
||||||
except:
|
|
||||||
Logger.logException("w", "We failed to serialize the stack. Trying to clean up.")
|
|
||||||
# Something went really wrong. Try to remove any data that we added.
|
|
||||||
for container in extruder_stacks:
|
|
||||||
self._container_registry.removeContainer(container.getId())
|
|
||||||
|
|
||||||
return None
|
|
||||||
|
|
||||||
# load global stack file
|
# load global stack file
|
||||||
try:
|
try:
|
||||||
# Check if a stack by this ID already exists;
|
# Check if a stack by this ID already exists;
|
||||||
@ -606,22 +547,80 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||||||
stack.deserialize(archive.open(global_stack_file).read().decode("utf-8"))
|
stack.deserialize(archive.open(global_stack_file).read().decode("utf-8"))
|
||||||
container_stacks_added.append(stack)
|
container_stacks_added.append(stack)
|
||||||
self._container_registry.addContainer(stack)
|
self._container_registry.addContainer(stack)
|
||||||
|
containers_added.append(stack)
|
||||||
|
|
||||||
global_stack = stack
|
global_stack = stack
|
||||||
Job.yieldThread()
|
Job.yieldThread()
|
||||||
|
except:
|
||||||
|
Logger.logException("w", "We failed to serialize the stack. Trying to clean up.")
|
||||||
|
# Something went really wrong. Try to remove any data that we added.
|
||||||
|
for container in containers_added:
|
||||||
|
self._container_registry.removeContainer(container.getId())
|
||||||
|
return
|
||||||
|
|
||||||
|
# --
|
||||||
|
# load extruder stack files
|
||||||
|
try:
|
||||||
|
for index, extruder_stack_file in enumerate(extruder_stack_files):
|
||||||
|
container_id = self._stripFileToId(extruder_stack_file)
|
||||||
|
|
||||||
|
container_stacks = self._container_registry.findContainerStacks(id = container_id)
|
||||||
|
if container_stacks:
|
||||||
|
# this container stack already exists, try to resolve
|
||||||
|
stack = container_stacks[0]
|
||||||
|
if self._resolve_strategies["machine"] == "override":
|
||||||
|
pass # do nothing
|
||||||
|
elif self._resolve_strategies["machine"] == "new":
|
||||||
|
# create a new extruder stack from this one
|
||||||
|
new_id = self.getNewId(container_id)
|
||||||
|
stack = ExtruderStack(new_id)
|
||||||
|
stack.deserialize(archive.open(extruder_stack_file).read().decode("utf-8"))
|
||||||
|
|
||||||
|
# Ensure a unique ID and name
|
||||||
|
stack._id = new_id
|
||||||
|
|
||||||
|
self._container_registry.addContainer(stack)
|
||||||
|
extruder_stacks_added.append(stack)
|
||||||
|
containers_added.append(stack)
|
||||||
|
else:
|
||||||
|
if self._resolve_strategies["machine"] == "override":
|
||||||
|
global_stacks = self._container_registry.findContainerStacks(id = global_stack_id_original)
|
||||||
|
# deserialize new extruder stack over the current ones
|
||||||
|
if global_stacks:
|
||||||
|
old_extruder_stack_id = global_stacks[0].extruders[index].getId()
|
||||||
|
# HACK delete file
|
||||||
|
self._container_registry._deleteFiles(global_stacks[0].extruders[index])
|
||||||
|
global_stacks[0].extruders[index].deserialize(archive.open(extruder_stack_file).read().decode("utf-8"))
|
||||||
|
# HACK
|
||||||
|
global_stacks[0]._extruders = global_stacks[0]._extruders[:2]
|
||||||
|
# HACK update cache
|
||||||
|
del self._container_registry._id_container_cache[old_extruder_stack_id]
|
||||||
|
new_extruder_stack_id = global_stacks[0].extruders[index].getId()
|
||||||
|
self._container_registry._id_container_cache[new_extruder_stack_id] = global_stacks[0].extruders[index]
|
||||||
|
|
||||||
|
stack = global_stacks[0].extruders[index]
|
||||||
|
else:
|
||||||
|
Logger.log("w", "Could not find global stack, while I expected it: %s" % global_stack_id_original)
|
||||||
|
elif self._resolve_strategies["machine"] == "new":
|
||||||
|
# container not found, create a new one
|
||||||
|
stack = ExtruderStack(container_id)
|
||||||
|
stack.deserialize(archive.open(extruder_stack_file).read().decode("utf-8"))
|
||||||
|
self._container_registry.addContainer(stack)
|
||||||
|
extruder_stacks_added.append(stack)
|
||||||
|
containers_added.append(stack)
|
||||||
|
else:
|
||||||
|
Logger.log("w", "Unknown resolve strategy: %s" % str(self._resolve_strategies["machine"]))
|
||||||
|
|
||||||
|
if global_stack_need_rename:
|
||||||
|
if stack.getMetaDataEntry("machine"):
|
||||||
|
stack.setMetaDataEntry("machine", global_stack_id_new)
|
||||||
|
extruder_stacks.append(stack)
|
||||||
except:
|
except:
|
||||||
Logger.logException("w", "We failed to serialize the stack. Trying to clean up.")
|
Logger.logException("w", "We failed to serialize the stack. Trying to clean up.")
|
||||||
# Something went really wrong. Try to remove any data that we added.
|
# Something went really wrong. Try to remove any data that we added.
|
||||||
for container in containers_to_add:
|
for container in containers_added:
|
||||||
self._container_registry.removeContainer(container.getId())
|
self._container_registry.removeContainer(container.getId())
|
||||||
|
return
|
||||||
for container in container_stacks_added:
|
|
||||||
self._container_registry.removeContainer(container.getId())
|
|
||||||
|
|
||||||
for container in extruder_stacks_added:
|
|
||||||
self._container_registry.removeContainer(container.getId())
|
|
||||||
|
|
||||||
return None
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Replacing the old containers if resolve is "new".
|
# Replacing the old containers if resolve is "new".
|
||||||
|
@ -4595,7 +4595,9 @@
|
|||||||
"description": "Smooth the spiralized contours to reduce the visibility of the Z seam (the Z-seam should be barely visible on the print but will still be visible in the layer view). Note that smoothing will tend to blur fine surface details.",
|
"description": "Smooth the spiralized contours to reduce the visibility of the Z seam (the Z-seam should be barely visible on the print but will still be visible in the layer view). Note that smoothing will tend to blur fine surface details.",
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"default_value": true,
|
"default_value": true,
|
||||||
"enabled": "magic_spiralize"
|
"enabled": "magic_spiralize",
|
||||||
|
"settable_per_mesh": false,
|
||||||
|
"settable_per_extruder": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1,66 +0,0 @@
|
|||||||
// Copyright (c) 2015 Ultimaker B.V.
|
|
||||||
// Cura is released under the terms of the AGPLv3 or higher.
|
|
||||||
|
|
||||||
import QtQuick 2.2
|
|
||||||
import QtQuick.Controls 1.1
|
|
||||||
import QtQuick.Window 2.1
|
|
||||||
|
|
||||||
import UM 1.1 as UM
|
|
||||||
|
|
||||||
UM.Dialog
|
|
||||||
{
|
|
||||||
id: base
|
|
||||||
|
|
||||||
//: Dialog title
|
|
||||||
title: catalog.i18nc("@title:window", "Multiply Model")
|
|
||||||
|
|
||||||
minimumWidth: 400 * Screen.devicePixelRatio
|
|
||||||
minimumHeight: 80 * Screen.devicePixelRatio
|
|
||||||
width: minimumWidth
|
|
||||||
height: minimumHeight
|
|
||||||
|
|
||||||
property var objectId: 0;
|
|
||||||
onAccepted: CuraApplication.multiplyObject(base.objectId, parseInt(copiesField.text))
|
|
||||||
|
|
||||||
property variant catalog: UM.I18nCatalog { name: "cura" }
|
|
||||||
|
|
||||||
signal reset()
|
|
||||||
onReset: {
|
|
||||||
copiesField.text = "1";
|
|
||||||
copiesField.selectAll();
|
|
||||||
copiesField.focus = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Row
|
|
||||||
{
|
|
||||||
spacing: UM.Theme.getSize("default_margin").width
|
|
||||||
|
|
||||||
Label {
|
|
||||||
text: "Number of copies:"
|
|
||||||
anchors.verticalCenter: copiesField.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
TextField {
|
|
||||||
id: copiesField
|
|
||||||
validator: RegExpValidator { regExp: /^\d{0,2}/ }
|
|
||||||
maximumLength: 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
rightButtons:
|
|
||||||
[
|
|
||||||
Button
|
|
||||||
{
|
|
||||||
text: catalog.i18nc("@action:button","OK")
|
|
||||||
onClicked: base.accept()
|
|
||||||
enabled: base.objectId != 0 && parseInt(copiesField.text) > 0
|
|
||||||
},
|
|
||||||
Button
|
|
||||||
{
|
|
||||||
text: catalog.i18nc("@action:button","Cancel")
|
|
||||||
onClicked: base.reject()
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user