Merge branch 'master' of https://github.com/Ultimaker/Cura.git into master-CURA-1923

This commit is contained in:
Thomas Karl Pietrowski 2016-08-01 11:04:48 +02:00
commit c6e727ada9
41 changed files with 579 additions and 324 deletions

View File

@ -30,9 +30,10 @@ class ConvexHullDecorator(SceneNodeDecorator):
def setNode(self, node): def setNode(self, node):
previous_node = self._node previous_node = self._node
# Disconnect from previous node signals
if previous_node is not None and node is not previous_node: if previous_node is not None and node is not previous_node:
previous_node.transformationChanged.connect(self._onChanged) previous_node.transformationChanged.disconnect(self._onChanged)
previous_node.parentChanged.connect(self._onChanged) previous_node.parentChanged.disconnect(self._onChanged)
super().setNode(node) super().setNode(node)
@ -286,5 +287,5 @@ class ConvexHullDecorator(SceneNodeDecorator):
_affected_settings = [ _affected_settings = [
"adhesion_type", "raft_base_thickness", "raft_interface_thickness", "raft_surface_layers", "adhesion_type", "raft_base_thickness", "raft_interface_thickness", "raft_surface_layers",
"raft_surface_thickness", "raft_airgap", "print_sequence", "raft_surface_thickness", "raft_airgap", "raft_margin", "print_sequence",
"skirt_gap", "skirt_line_count", "skirt_brim_line_width", "skirt_distance"] "skirt_gap", "skirt_line_count", "skirt_brim_line_width", "skirt_distance"]

View File

@ -23,7 +23,7 @@ class ConvexHullNode(SceneNode):
self._original_parent = parent self._original_parent = parent
# Color of the drawn convex hull # Color of the drawn convex hull
self._color = Color(35, 35, 35, 192) self._color = Color(0.4, 0.4, 0.4, 1.0)
# The y-coordinate of the convex hull mesh. Must not be 0, to prevent z-fighting. # The y-coordinate of the convex hull mesh. Must not be 0, to prevent z-fighting.
self._mesh_height = 0.1 self._mesh_height = 0.1

View File

@ -98,7 +98,7 @@ class CuraApplication(QtApplication):
SettingDefinition.addSupportedProperty("settable_per_meshgroup", DefinitionPropertyType.Any, default = True) SettingDefinition.addSupportedProperty("settable_per_meshgroup", DefinitionPropertyType.Any, default = True)
SettingDefinition.addSupportedProperty("settable_globally", DefinitionPropertyType.Any, default = True) SettingDefinition.addSupportedProperty("settable_globally", DefinitionPropertyType.Any, default = True)
SettingDefinition.addSupportedProperty("global_inherits_stack", DefinitionPropertyType.Function, default = "-1") SettingDefinition.addSupportedProperty("global_inherits_stack", DefinitionPropertyType.Function, default = "-1")
SettingDefinition.addSettingType("extruder", int, str, Validator) SettingDefinition.addSettingType("extruder", None, str, Validator)
## Add the 4 types of profiles to storage. ## Add the 4 types of profiles to storage.
Resources.addStorageType(self.ResourceTypes.QualityInstanceContainer, "quality") Resources.addStorageType(self.ResourceTypes.QualityInstanceContainer, "quality")
@ -128,6 +128,8 @@ class CuraApplication(QtApplication):
self._machine_action_manager = MachineActionManager.MachineActionManager() self._machine_action_manager = MachineActionManager.MachineActionManager()
self._machine_manager = None # This is initialized on demand. self._machine_manager = None # This is initialized on demand.
self._additional_components = {} # Components to add to certain areas in the interface
super().__init__(name = "cura", version = CuraVersion, buildtype = CuraBuildType) super().__init__(name = "cura", version = CuraVersion, buildtype = CuraBuildType)
self.setWindowIcon(QIcon(Resources.getPath(Resources.Images, "cura-icon.png"))) self.setWindowIcon(QIcon(Resources.getPath(Resources.Images, "cura-icon.png")))
@ -201,7 +203,7 @@ class CuraApplication(QtApplication):
"dialog_profile_path", "dialog_profile_path",
"dialog_material_path"]: "dialog_material_path"]:
Preferences.getInstance().addPreference("local_file/%s" % key, "~/") Preferences.getInstance().addPreference("local_file/%s" % key, os.path.expanduser("~/"))
Preferences.getInstance().setDefault("local_file/last_used_type", "text/x-gcode") Preferences.getInstance().setDefault("local_file/last_used_type", "text/x-gcode")
@ -553,12 +555,18 @@ class CuraApplication(QtApplication):
def deleteSelection(self): def deleteSelection(self):
if not self.getController().getToolsEnabled(): if not self.getController().getToolsEnabled():
return return
removed_group_nodes = []
op = GroupedOperation() op = GroupedOperation()
nodes = Selection.getAllSelectedObjects() nodes = Selection.getAllSelectedObjects()
for node in nodes: for node in nodes:
op.addOperation(RemoveSceneNodeOperation(node)) op.addOperation(RemoveSceneNodeOperation(node))
group_node = node.getParent()
if group_node and group_node.callDecoration("isGroup") and group_node not in removed_group_nodes:
remaining_nodes_in_group = list(set(group_node.getChildren()) - set(nodes))
if len(remaining_nodes_in_group) == 1:
removed_group_nodes.append(group_node)
op.addOperation(SetParentOperation(remaining_nodes_in_group[0], group_node.getParent()))
op.addOperation(RemoveSceneNodeOperation(group_node))
op.push() op.push()
pass pass
@ -584,8 +592,7 @@ class CuraApplication(QtApplication):
op.push() op.push()
if group_node: if group_node:
if len(group_node.getChildren()) == 1 and group_node.callDecoration("isGroup"): if len(group_node.getChildren()) == 1 and group_node.callDecoration("isGroup"):
group_node.getChildren()[0].translate(group_node.getPosition()) op.addOperation(SetParentOperation(group_node.getChildren()[0], group_node.getParent()))
group_node.getChildren()[0].setParent(group_node.getParent())
op = RemoveSceneNodeOperation(group_node) op = RemoveSceneNodeOperation(group_node)
op.push() op.push()
@ -627,6 +634,22 @@ class CuraApplication(QtApplication):
op = SetTransformOperation(node, Vector()) op = SetTransformOperation(node, Vector())
op.push() op.push()
## Select all nodes containing mesh data in the scene.
@pyqtSlot()
def selectAll(self):
if not self.getController().getToolsEnabled():
return
Selection.clear()
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
if type(node) is not SceneNode:
continue
if not node.getMeshData() and not node.callDecoration("isGroup"):
continue # Node that doesnt have a mesh and is not a group.
if node.getParent() and node.getParent().callDecoration("isGroup"):
continue # Grouped nodes don't need resetting as their parent (the group) is resetted)
Selection.add(node)
## Delete all nodes containing mesh data in the scene. ## Delete all nodes containing mesh data in the scene.
@pyqtSlot() @pyqtSlot()
def deleteAll(self): def deleteAll(self):
@ -650,6 +673,7 @@ class CuraApplication(QtApplication):
op.addOperation(RemoveSceneNodeOperation(node)) op.addOperation(RemoveSceneNodeOperation(node))
op.push() op.push()
Selection.clear()
## Reset all translation on nodes with mesh data. ## Reset all translation on nodes with mesh data.
@pyqtSlot() @pyqtSlot()
@ -877,3 +901,21 @@ class CuraApplication(QtApplication):
def getBuildVolume(self): def getBuildVolume(self):
return self._volume return self._volume
additionalComponentsChanged = pyqtSignal(str, arguments = ["areaId"])
@pyqtProperty("QVariantMap", notify = additionalComponentsChanged)
def additionalComponents(self):
return self._additional_components
## Add a component to a list of components to be reparented to another area in the GUI.
# The actual reparenting is done by the area itself.
# \param area_id \type{str} Identifying name of the area to which the component should be reparented
# \param component \type{QQuickComponent} The component that should be reparented
@pyqtSlot(str, "QVariant")
def addAdditionalComponent(self, area_id, component):
if area_id not in self._additional_components:
self._additional_components[area_id] = []
self._additional_components[area_id].append(component)
self.additionalComponentsChanged.emit(area_id)

View File

@ -57,9 +57,10 @@ class MachineActionManager(QObject):
def addRequiredAction(self, definition_id, action_key): def addRequiredAction(self, definition_id, action_key):
if action_key in self._machine_actions: if action_key in self._machine_actions:
if definition_id in self._required_actions: if definition_id in self._required_actions:
self._required_actions[definition_id] |= {self._machine_actions[action_key]} if self._machine_actions[action_key] not in self._required_actions[definition_id]:
self._required_actions[definition_id].append(self._machine_actions[action_key])
else: else:
self._required_actions[definition_id] = {self._machine_actions[action_key]} self._required_actions[definition_id] = [self._machine_actions[action_key]]
else: else:
raise UnknownMachineActionError("Action %s, which is required for %s is not known." % (action_key, definition_id)) raise UnknownMachineActionError("Action %s, which is required for %s is not known." % (action_key, definition_id))
@ -67,9 +68,10 @@ class MachineActionManager(QObject):
def addSupportedAction(self, definition_id, action_key): def addSupportedAction(self, definition_id, action_key):
if action_key in self._machine_actions: if action_key in self._machine_actions:
if definition_id in self._supported_actions: if definition_id in self._supported_actions:
self._supported_actions[definition_id] |= {self._machine_actions[action_key]} if self._machine_actions[action_key] not in self._supported_actions[definition_id]:
self._supported_actions[definition_id].append(self._machine_actions[action_key])
else: else:
self._supported_actions[definition_id] = {self._machine_actions[action_key]} self._supported_actions[definition_id] = [self._machine_actions[action_key]]
else: else:
Logger.log("w", "Unable to add %s to %s, as the action is not recognised", action_key, definition_id) Logger.log("w", "Unable to add %s to %s, as the action is not recognised", action_key, definition_id)

View File

@ -71,7 +71,6 @@ class PlatformPhysics:
# If there is no convex hull for the node, start calculating it and continue. # If there is no convex hull for the node, start calculating it and continue.
if not node.getDecorator(ConvexHullDecorator): if not node.getDecorator(ConvexHullDecorator):
node.addDecorator(ConvexHullDecorator()) node.addDecorator(ConvexHullDecorator())
node.callDecoration("recomputeConvexHull")
if Preferences.getInstance().getValue("physics/automatic_push_free"): if Preferences.getInstance().getValue("physics/automatic_push_free"):
# Check for collisions between convex hulls # Check for collisions between convex hulls
@ -95,11 +94,11 @@ class PlatformPhysics:
# Get the overlap distance for both convex hulls. If this returns None, there is no intersection. # Get the overlap distance for both convex hulls. If this returns None, there is no intersection.
head_hull = node.callDecoration("getConvexHullHead") head_hull = node.callDecoration("getConvexHullHead")
if head_hull: if head_hull:
overlap = head_hull.intersectsPolygon(other_node.callDecoration("getConvexHull")) overlap = head_hull.intersectsPolygon(other_node.callDecoration("getConvexHullHead"))
if not overlap: if not overlap:
other_head_hull = other_node.callDecoration("getConvexHullHead") other_head_hull = other_node.callDecoration("getConvexHullHead")
if other_head_hull: if other_head_hull:
overlap = node.callDecoration("getConvexHull").intersectsPolygon(other_head_hull) overlap = node.callDecoration("getConvexHullHead").intersectsPolygon(other_head_hull)
else: else:
own_convex_hull = node.callDecoration("getConvexHull") own_convex_hull = node.callDecoration("getConvexHull")
other_convex_hull = other_node.callDecoration("getConvexHull") other_convex_hull = other_node.callDecoration("getConvexHull")

View File

@ -244,6 +244,7 @@ class ContainerManager(QObject):
if not type_name or entry["type"] == type_name: if not type_name or entry["type"] == type_name:
filters.append(filter_string) filters.append(filter_string)
filters.append("All Files (*)")
return filters return filters
## Export a container to a file ## Export a container to a file
@ -280,6 +281,9 @@ class ContainerManager(QObject):
return { "status": "error", "message": "Container not found"} return { "status": "error", "message": "Container not found"}
container = containers[0] container = containers[0]
if UM.Platform.isOSX() and "." in file_url:
file_url = file_url[:file_url.rfind(".")]
for suffix in mime_type.suffixes: for suffix in mime_type.suffixes:
if file_url.endswith(suffix): if file_url.endswith(suffix):
break break
@ -301,7 +305,7 @@ class ContainerManager(QObject):
with UM.SaveFile(file_url, "w") as f: with UM.SaveFile(file_url, "w") as f:
f.write(contents) f.write(contents)
return { "status": "success", "message": "Succesfully exported container"} return { "status": "success", "message": "Succesfully exported container", "path": file_url}
## Imports a profile from a file ## Imports a profile from a file
# #
@ -371,11 +375,20 @@ class ContainerManager(QObject):
"container": container_type "container": container_type
} }
suffix_list = "*." + mime_type.preferredSuffix suffix = mime_type.preferredSuffix
if UM.Platform.isOSX() and "." in suffix:
# OSX's File dialog is stupid and does not allow selecting files with a . in its name
suffix = suffix[suffix.index(".") + 1:]
suffix_list = "*." + suffix
for suffix in mime_type.suffixes: for suffix in mime_type.suffixes:
if suffix == mime_type.preferredSuffix: if suffix == mime_type.preferredSuffix:
continue continue
if UM.Platform.isOSX() and "." in suffix:
# OSX's File dialog is stupid and does not allow selecting files with a . in its name
suffix = suffix[suffix.index("."):]
suffix_list += ", *." + suffix suffix_list += ", *." + suffix
name_filter = "{0} ({1})".format(mime_type.comment, suffix_list) name_filter = "{0} ({1})".format(mime_type.comment, suffix_list)

View File

@ -26,7 +26,7 @@ class MachineManager(QObject):
self._global_container_stack = None self._global_container_stack = None
Application.getInstance().globalContainerStackChanged.connect(self._onGlobalContainerChanged) Application.getInstance().globalContainerStackChanged.connect(self._onGlobalContainerChanged)
self._global_stack_valid = None self._active_stack_valid = None
self._onGlobalContainerChanged() self._onGlobalContainerChanged()
ExtruderManager.getInstance().activeExtruderChanged.connect(self._onActiveExtruderStackChanged) ExtruderManager.getInstance().activeExtruderChanged.connect(self._onActiveExtruderStackChanged)
@ -74,7 +74,7 @@ class MachineManager(QObject):
activeStackChanged = pyqtSignal() activeStackChanged = pyqtSignal()
globalValueChanged = pyqtSignal() # Emitted whenever a value inside global container is changed. globalValueChanged = pyqtSignal() # Emitted whenever a value inside global container is changed.
globalValidationChanged = pyqtSignal() # Emitted whenever a validation inside global container is changed activeValidationChanged = pyqtSignal() # Emitted whenever a validation inside active container is changed
blurSettings = pyqtSignal() # Emitted to force fields in the advanced sidebar to un-focus, so they update properly blurSettings = pyqtSignal() # Emitted to force fields in the advanced sidebar to un-focus, so they update properly
@ -269,25 +269,29 @@ class MachineManager(QObject):
if property_name == "global_inherits_stack": if property_name == "global_inherits_stack":
if self._active_container_stack and self._active_container_stack != self._global_container_stack: if self._active_container_stack and self._active_container_stack != self._global_container_stack:
# Update the global user value when the "global_inherits_stack" function points to a different stack # Update the global user value when the "global_inherits_stack" function points to a different stack
stack_index = int(self._active_container_stack.getProperty(key, property_name)) extruder_stacks = list(ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId()))
extruder_stacks = [stack for stack in ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId())] target_stack_position = int(self._active_container_stack.getProperty(key, "global_inherits_stack"))
if target_stack_position == -1: # Prevent -1 from selecting wrong stack.
target_stack = self._active_container_stack
else:
target_stack = extruder_stacks[target_stack_position]
if len(extruder_stacks) > stack_index: new_value = target_stack.getProperty(key, "value")
new_value = extruder_stacks[stack_index].getProperty(key, "value")
if self._global_container_stack.getProperty(key, "value") != new_value: if self._global_container_stack.getProperty(key, "value") != new_value:
self._global_container_stack.getTop().setProperty(key, "value", new_value) self._global_container_stack.getTop().setProperty(key, "value", new_value)
if property_name == "validationState": if property_name == "validationState":
if self._global_stack_valid: if self._active_stack_valid:
changed_validation_state = self._active_container_stack.getProperty(key, property_name) changed_validation_state = self._active_container_stack.getProperty(key, property_name)
if changed_validation_state in (UM.Settings.ValidatorState.Exception, UM.Settings.ValidatorState.MaximumError, UM.Settings.ValidatorState.MinimumError): if changed_validation_state in (UM.Settings.ValidatorState.Exception, UM.Settings.ValidatorState.MaximumError, UM.Settings.ValidatorState.MinimumError):
self._global_stack_valid = False self._active_stack_valid = False
self.globalValidationChanged.emit() self.activeValidationChanged.emit()
else: else:
has_errors = self._checkStackForErrors(self._active_container_stack) has_errors = self._checkStackForErrors(self._active_container_stack)
if not has_errors: if not has_errors:
self._global_stack_valid = True self._active_stack_valid = True
self.globalValidationChanged.emit() self.activeValidationChanged.emit()
def _onGlobalContainerChanged(self): def _onGlobalContainerChanged(self):
if self._global_container_stack: if self._global_container_stack:
self._global_container_stack.nameChanged.disconnect(self._onMachineNameChanged) self._global_container_stack.nameChanged.disconnect(self._onMachineNameChanged)
@ -310,8 +314,6 @@ class MachineManager(QObject):
self._global_container_stack.nameChanged.connect(self._onMachineNameChanged) self._global_container_stack.nameChanged.connect(self._onMachineNameChanged)
self._global_container_stack.containersChanged.connect(self._onInstanceContainersChanged) self._global_container_stack.containersChanged.connect(self._onInstanceContainersChanged)
self._global_container_stack.propertyChanged.connect(self._onGlobalPropertyChanged) self._global_container_stack.propertyChanged.connect(self._onGlobalPropertyChanged)
self._global_stack_valid = not self._checkStackForErrors(self._global_container_stack)
self.globalValidationChanged.emit()
material = self._global_container_stack.findContainer({"type": "material"}) material = self._global_container_stack.findContainer({"type": "material"})
material.nameChanged.connect(self._onMaterialNameChanged) material.nameChanged.connect(self._onMaterialNameChanged)
@ -329,6 +331,8 @@ class MachineManager(QObject):
self._active_container_stack.propertyChanged.connect(self._onGlobalPropertyChanged) self._active_container_stack.propertyChanged.connect(self._onGlobalPropertyChanged)
else: else:
self._active_container_stack = self._global_container_stack self._active_container_stack = self._global_container_stack
self._active_stack_valid = not self._checkStackForErrors(self._active_container_stack)
self.activeValidationChanged.emit()
def _onInstanceContainersChanged(self, container): def _onInstanceContainersChanged(self, container):
container_type = container.getMetaDataEntry("type") container_type = container.getMetaDataEntry("type")
@ -433,11 +437,11 @@ class MachineManager(QObject):
return len(user_settings) != 0 return len(user_settings) != 0
## Check if the global profile does not contain error states ## Check if the global profile does not contain error states
# Note that the _global_stack_valid is cached due to performance issues # Note that the _active_stack_valid is cached due to performance issues
# Calling _checkStackForErrors on every change is simply too expensive # Calling _checkStackForErrors on every change is simply too expensive
@pyqtProperty(bool, notify = globalValidationChanged) @pyqtProperty(bool, notify = activeValidationChanged)
def isGlobalStackValid(self): def isActiveStackValid(self):
return bool(self._global_stack_valid) return bool(self._active_stack_valid)
@pyqtProperty(str, notify = activeStackChanged) @pyqtProperty(str, notify = activeStackChanged)
def activeUserProfileId(self): def activeUserProfileId(self):
@ -549,7 +553,7 @@ class MachineManager(QObject):
return "" return ""
@pyqtSlot(str, str) @pyqtSlot(str, str)
def renameQualityContainer(self, container_id, new_name): def renameQualityContainer(self, container_id, nbalew_name):
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = container_id, type = "quality") containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = container_id, type = "quality")
if containers: if containers:
new_name = self._createUniqueName("quality", containers[0].getName(), new_name, new_name = self._createUniqueName("quality", containers[0].getName(), new_name,

View File

@ -75,6 +75,7 @@ class SettingOverrideDecorator(SceneNodeDecorator):
# \param extruder_stack_id The new extruder stack to print with. # \param extruder_stack_id The new extruder stack to print with.
def setActiveExtruder(self, extruder_stack_id): def setActiveExtruder(self, extruder_stack_id):
self._extruder_stack = extruder_stack_id self._extruder_stack = extruder_stack_id
self._updateNextStack()
self.activeExtruderChanged.emit() self.activeExtruderChanged.emit()
def getStack(self): def getStack(self):

View File

@ -9,18 +9,20 @@ from UM.Math.Vector import Vector
from UM.Scene.SceneNode import SceneNode from UM.Scene.SceneNode import SceneNode
from UM.Scene.GroupDecorator import GroupDecorator from UM.Scene.GroupDecorator import GroupDecorator
from UM.Math.Quaternion import Quaternion from UM.Math.Quaternion import Quaternion
from UM.Job import Job from UM.Job import Job
import math import math
import zipfile import zipfile
try:
import xml.etree.cElementTree as ET
except ImportError:
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
## Base implementation for reading 3MF files. Has no support for textures. Only loads meshes! ## Base implementation for reading 3MF files. Has no support for textures. Only loads meshes!
class ThreeMFReader(MeshReader): class ThreeMFReader(MeshReader):
def __init__(self): def __init__(self):
super(ThreeMFReader, self).__init__() super().__init__()
self._supported_extensions = [".3mf"] self._supported_extensions = [".3mf"]
self._namespaces = { self._namespaces = {
@ -116,4 +118,10 @@ class ThreeMFReader(MeshReader):
except Exception as e: except Exception as e:
Logger.log("e", "exception occured in 3mf reader: %s", e) Logger.log("e", "exception occured in 3mf reader: %s", e)
try: # Selftest - There might be more functions that should fail
boundingBox = result.getBoundingBox()
boundingBox.isValid()
except:
return None
return result return result

View File

@ -13,6 +13,7 @@ message Slice
repeated ObjectList object_lists = 1; // The meshgroups to be printed one after another repeated ObjectList object_lists = 1; // The meshgroups to be printed one after another
SettingList global_settings = 2; // The global settings used for the whole print job SettingList global_settings = 2; // The global settings used for the whole print job
repeated Extruder extruders = 3; // The settings sent to each extruder object repeated Extruder extruders = 3; // The settings sent to each extruder object
repeated SettingExtruder global_inherits_stack = 4; //From which stack the setting would inherit if not defined in a stack.
} }
message Extruder message Extruder
@ -108,8 +109,14 @@ message Setting {
bytes value = 2; // The value of the setting bytes value = 2; // The value of the setting
} }
message SettingExtruder {
string name = 1; //The setting key.
int32 extruder = 2; //From which extruder stack the setting should inherit.
}
message GCodePrefix { message GCodePrefix {
bytes data = 2; // Header string to be prenpended before the rest of the gcode sent from the engine bytes data = 2; //Header string to be prepended before the rest of the g-code sent from the engine.
} }
message SlicingFinished { message SlicingFinished {

View File

@ -13,9 +13,11 @@ from UM.Resources import Resources
from UM.Settings.Validator import ValidatorState #To find if a setting is in an error state. We can't slice then. from UM.Settings.Validator import ValidatorState #To find if a setting is in an error state. We can't slice then.
from UM.Platform import Platform from UM.Platform import Platform
import cura.Settings import cura.Settings
from cura.OneAtATimeIterator import OneAtATimeIterator from cura.OneAtATimeIterator import OneAtATimeIterator
from cura.Settings.ExtruderManager import ExtruderManager
from . import ProcessSlicedLayersJob from . import ProcessSlicedLayersJob
from . import ProcessGCodeJob from . import ProcessGCodeJob
from . import StartSliceJob from . import StartSliceJob
@ -40,7 +42,8 @@ class CuraEngineBackend(Backend):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
# Find out where the engine is located, and how it is called. This depends on how Cura is packaged and which OS we are running on. # Find out where the engine is located, and how it is called.
# This depends on how Cura is packaged and which OS we are running on.
default_engine_location = os.path.join(Application.getInstallPrefix(), "bin", "CuraEngine") default_engine_location = os.path.join(Application.getInstallPrefix(), "bin", "CuraEngine")
if hasattr(sys, "frozen"): if hasattr(sys, "frozen"):
default_engine_location = os.path.join(os.path.dirname(os.path.abspath(sys.executable)), "CuraEngine") default_engine_location = os.path.join(os.path.dirname(os.path.abspath(sys.executable)), "CuraEngine")
@ -92,7 +95,7 @@ class CuraEngineBackend(Backend):
self._always_restart = True # Always restart the engine when starting a new slice. Don't keep the process running. TODO: Fix engine statelessness. self._always_restart = True # Always restart the engine when starting a new slice. Don't keep the process running. TODO: Fix engine statelessness.
self._process_layers_job = None # The currently active job to process layers, or None if it is not processing layers. self._process_layers_job = None # The currently active job to process layers, or None if it is not processing layers.
self._backend_log_max_lines = 200 # Maximal count of lines to buffer self._backend_log_max_lines = 20000 # Maximum number of lines to buffer
self._error_message = None # Pop-up message that shows errors. self._error_message = None # Pop-up message that shows errors.
self.backendQuit.connect(self._onBackendQuit) self.backendQuit.connect(self._onBackendQuit)
@ -117,9 +120,10 @@ class CuraEngineBackend(Backend):
# \return list of commands and args / parameters. # \return list of commands and args / parameters.
def getEngineCommand(self): def getEngineCommand(self):
json_path = Resources.getPath(Resources.DefinitionContainers, "fdmprinter.def.json") json_path = Resources.getPath(Resources.DefinitionContainers, "fdmprinter.def.json")
return [Preferences.getInstance().getValue("backend/location"), "connect", "127.0.0.1:{0}".format(self._port), "-j", json_path, "-vv"] return [Preferences.getInstance().getValue("backend/location"), "connect", "127.0.0.1:{0}".format(self._port), "-j", json_path, ""]
## Emitted when we get a message containing print duration and material amount. This also implies the slicing has finished. ## Emitted when we get a message containing print duration and material amount.
# This also implies the slicing has finished.
# \param time The amount of time the print will take. # \param time The amount of time the print will take.
# \param material_amount The amount of material the print will use. # \param material_amount The amount of material the print will use.
printDurationMessage = Signal() printDurationMessage = Signal()
@ -204,7 +208,7 @@ class CuraEngineBackend(Backend):
if job.getResult() == StartSliceJob.StartJobResult.SettingError: if job.getResult() == StartSliceJob.StartJobResult.SettingError:
if Application.getInstance().getPlatformActivity: if Application.getInstance().getPlatformActivity:
self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice. Please check your setting values for errors."), lifetime = 10) self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice. Please check your setting values for errors."))
self._error_message.show() self._error_message.show()
self.backendStateChange.emit(BackendState.Error) self.backendStateChange.emit(BackendState.Error)
else: else:
@ -213,7 +217,7 @@ class CuraEngineBackend(Backend):
if job.getResult() == StartSliceJob.StartJobResult.NothingToSlice: if job.getResult() == StartSliceJob.StartJobResult.NothingToSlice:
if Application.getInstance().getPlatformActivity: if Application.getInstance().getPlatformActivity:
self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice. No suitable objects found."), lifetime = 10) self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice. No suitable objects found."))
self._error_message.show() self._error_message.show()
self.backendStateChange.emit(BackendState.Error) self.backendStateChange.emit(BackendState.Error)
else: else:
@ -252,6 +256,9 @@ class CuraEngineBackend(Backend):
return return
super()._onSocketError(error) super()._onSocketError(error)
if error.getErrorCode() == Arcus.ErrorCode.Debug:
return
self._terminate() self._terminate()
if error.getErrorCode() not in [Arcus.ErrorCode.BindFailedError, Arcus.ErrorCode.ConnectionResetError, Arcus.ErrorCode.Debug]: if error.getErrorCode() not in [Arcus.ErrorCode.BindFailedError, Arcus.ErrorCode.ConnectionResetError, Arcus.ErrorCode.Debug]:
@ -313,7 +320,7 @@ class CuraEngineBackend(Backend):
## Called when a print time message is received from the engine. ## Called when a print time message is received from the engine.
# #
# \param message The protobuf message containing the print time and # \param message The protobuff message containing the print time and
# material amount per extruder # material amount per extruder
def _onPrintTimeMaterialEstimates(self, message): def _onPrintTimeMaterialEstimates(self, message):
material_amounts = [] material_amounts = []
@ -388,22 +395,35 @@ class CuraEngineBackend(Backend):
if self._global_container_stack: if self._global_container_stack:
self._global_container_stack.propertyChanged.disconnect(self._onSettingChanged) self._global_container_stack.propertyChanged.disconnect(self._onSettingChanged)
self._global_container_stack.containersChanged.disconnect(self._onChanged) self._global_container_stack.containersChanged.disconnect(self._onChanged)
extruders = list(ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId()))
if extruders:
for extruder in extruders:
extruder.propertyChanged.disconnect(self._onSettingChanged)
self._global_container_stack = Application.getInstance().getGlobalContainerStack() self._global_container_stack = Application.getInstance().getGlobalContainerStack()
if self._global_container_stack: if self._global_container_stack:
self._global_container_stack.propertyChanged.connect(self._onSettingChanged) # Note: Only starts slicing when the value changed. self._global_container_stack.propertyChanged.connect(self._onSettingChanged) # Note: Only starts slicing when the value changed.
self._global_container_stack.containersChanged.connect(self._onChanged) self._global_container_stack.containersChanged.connect(self._onChanged)
extruders = list(ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId()))
if extruders:
for extruder in extruders:
extruder.propertyChanged.connect(self._onSettingChanged)
self._onActiveExtruderChanged() self._onActiveExtruderChanged()
self._onChanged() self._onChanged()
def _onActiveExtruderChanged(self): def _onActiveExtruderChanged(self):
if self._global_container_stack:
# Connect all extruders of the active machine. This might cause a few connects that have already happend,
# but that shouldn't cause issues as only new / unique connections are added.
extruders = list(ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId()))
if extruders:
for extruder in extruders:
extruder.propertyChanged.connect(self._onSettingChanged)
if self._active_extruder_stack: if self._active_extruder_stack:
self._active_extruder_stack.propertyChanged.disconnect(self._onSettingChanged)
self._active_extruder_stack.containersChanged.disconnect(self._onChanged) self._active_extruder_stack.containersChanged.disconnect(self._onChanged)
self._active_extruder_stack = cura.Settings.ExtruderManager.getInstance().getActiveExtruderStack() self._active_extruder_stack = cura.Settings.ExtruderManager.getInstance().getActiveExtruderStack()
if self._active_extruder_stack: if self._active_extruder_stack:
self._active_extruder_stack.propertyChanged.connect(self._onSettingChanged) # Note: Only starts slicing when the value changed.
self._active_extruder_stack.containersChanged.connect(self._onChanged) self._active_extruder_stack.containersChanged.connect(self._onChanged)

View File

@ -56,10 +56,9 @@ class ProcessSlicedLayersJob(Job):
## Remove old layer data (if any) ## Remove old layer data (if any)
for node in DepthFirstIterator(self._scene.getRoot()): for node in DepthFirstIterator(self._scene.getRoot()):
if type(node) is SceneNode and node.getMeshData():
if node.callDecoration("getLayerData"): if node.callDecoration("getLayerData"):
self._scene.getRoot().removeChild(node) node.getParent().removeChild(node)
Job.yieldThread() break
if self._abort_requested: if self._abort_requested:
if self._progress: if self._progress:
self._progress.hide() self._progress.hide()
@ -74,7 +73,7 @@ class ProcessSlicedLayersJob(Job):
# instead simply offset all other layers so the lowest layer is always 0. # instead simply offset all other layers so the lowest layer is always 0.
min_layer_number = 0 min_layer_number = 0
for layer in self._layers: for layer in self._layers:
if(layer.id < min_layer_number): if layer.id < min_layer_number:
min_layer_number = layer.id min_layer_number = layer.id
current_layer = 0 current_layer = 0
@ -117,7 +116,6 @@ class ProcessSlicedLayersJob(Job):
new_points[:, 1] = points[:, 2] new_points[:, 1] = points[:, 2]
new_points[:, 2] = -points[:, 1] new_points[:, 2] = -points[:, 1]
this_poly = LayerPolygon.LayerPolygon(layer_data, extruder, line_types, new_points, line_widths) this_poly = LayerPolygon.LayerPolygon(layer_data, extruder, line_types, new_points, line_widths)
this_poly.buildCache() this_poly.buildCache()
@ -185,4 +183,3 @@ class ProcessSlicedLayersJob(Job):
else: else:
if self._progress: if self._progress:
self._progress.hide() self._progress.hide()

View File

@ -13,6 +13,7 @@ from UM.Scene.SceneNode import SceneNode
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
from UM.Settings.Validator import ValidatorState from UM.Settings.Validator import ValidatorState
from UM.Settings.SettingRelation import RelationType
from cura.OneAtATimeIterator import OneAtATimeIterator from cura.OneAtATimeIterator import OneAtATimeIterator
@ -24,6 +25,7 @@ class StartJobResult(IntEnum):
SettingError = 3 SettingError = 3
NothingToSlice = 4 NothingToSlice = 4
## Formatter class that handles token expansion in start/end gcod ## Formatter class that handles token expansion in start/end gcod
class GcodeStartEndFormatter(Formatter): class GcodeStartEndFormatter(Formatter):
def get_value(self, key, args, kwargs): # [CodeStyle: get_value is an overridden function from the Formatter class] def get_value(self, key, args, kwargs): # [CodeStyle: get_value is an overridden function from the Formatter class]
@ -37,6 +39,7 @@ class GcodeStartEndFormatter(Formatter):
Logger.log("w", "Incorrectly formatted placeholder '%s' in start/end gcode", key) Logger.log("w", "Incorrectly formatted placeholder '%s' in start/end gcode", key)
return "{" + str(key) + "}" return "{" + str(key) + "}"
## Job class that builds up the message of scene data to send to CuraEngine. ## Job class that builds up the message of scene data to send to CuraEngine.
class StartSliceJob(Job): class StartSliceJob(Job):
def __init__(self, slice_message): def __init__(self, slice_message):
@ -71,7 +74,7 @@ class StartSliceJob(Job):
return return
# Don't slice if there is a setting with an error value. # Don't slice if there is a setting with an error value.
if self._checkStackForErrors(stack): if not Application.getInstance().getMachineManager().isActiveStackValid:
self.setResult(StartJobResult.SettingError) self.setResult(StartJobResult.SettingError)
return return
@ -123,11 +126,15 @@ class StartSliceJob(Job):
if temp_list: if temp_list:
object_groups.append(temp_list) object_groups.append(temp_list)
# There are cases when there is nothing to slice. This can happen due to one at a time slicing not being
# able to find a possible sequence or because there are no objects on the build plate (or they are outside
# the build volume)
if not object_groups: if not object_groups:
self.setResult(StartJobResult.NothingToSlice) self.setResult(StartJobResult.NothingToSlice)
return return
self._buildGlobalSettingsMessage(stack) self._buildGlobalSettingsMessage(stack)
self._buildGlobalInheritsStackMessage(stack)
for extruder_stack in cura.Settings.ExtruderManager.getInstance().getMachineExtruders(stack.getId()): for extruder_stack in cura.Settings.ExtruderManager.getInstance().getMachineExtruders(stack.getId()):
self._buildExtruderMessage(extruder_stack) self._buildExtruderMessage(extruder_stack)
@ -171,6 +178,7 @@ class StartSliceJob(Job):
Logger.logException("w", "Unable to do token replacement on start/end gcode") Logger.logException("w", "Unable to do token replacement on start/end gcode")
return str(value).encode("utf-8") return str(value).encode("utf-8")
## Create extruder message from stack
def _buildExtruderMessage(self, stack): def _buildExtruderMessage(self, stack):
message = self._slice_message.addRepeatedMessage("extruders") message = self._slice_message.addRepeatedMessage("extruders")
message.id = int(stack.getMetaDataEntry("position")) message.id = int(stack.getMetaDataEntry("position"))
@ -209,11 +217,54 @@ class StartSliceJob(Job):
else: else:
setting_message.value = str(value).encode("utf-8") setting_message.value = str(value).encode("utf-8")
## Sends for some settings which extruder they should fallback to if not
# set.
#
# This is only set for settings that have the global_inherits_stack
# property.
#
# \param stack The global stack with all settings, from which to read the
# global_inherits_stack property.
def _buildGlobalInheritsStackMessage(self, stack):
for key in stack.getAllKeys():
extruder = int(stack.getProperty(key, "global_inherits_stack"))
if extruder >= 0: #Set to a specific extruder.
setting_extruder = self._slice_message.addRepeatedMessage("global_inherits_stack")
setting_extruder.name = key
setting_extruder.extruder = extruder
## Check if a node has per object settings and ensure that they are set correctly in the message
# \param node \type{SceneNode} Node to check.
# \param message object_lists message to put the per object settings in
def _handlePerObjectSettings(self, node, message): def _handlePerObjectSettings(self, node, message):
stack = node.callDecoration("getStack") stack = node.callDecoration("getStack")
# Check if the node has a stack attached to it and the stack has any settings in the top container.
if stack: if stack:
for key in stack.getAllKeys(): # Check all settings for relations, so we can also calculate the correct values for dependant settings.
changed_setting_keys = set(stack.getTop().getAllKeys())
for key in stack.getTop().getAllKeys():
instance = stack.getTop().getInstance(key)
self._addRelations(changed_setting_keys, instance.definition.relations)
Job.yieldThread()
# Ensure that the engine is aware what the build extruder is
if stack.getProperty("machine_extruder_count", "value") > 1:
changed_setting_keys.add("extruder_nr")
# Get values for all changed settings
for key in changed_setting_keys:
setting = message.addRepeatedMessage("settings") setting = message.addRepeatedMessage("settings")
setting.name = key setting.name = key
setting.value = str(stack.getProperty(key, "value")).encode("utf-8") setting.value = str(stack.getProperty(key, "value")).encode("utf-8")
Job.yieldThread() Job.yieldThread()
## Recursive function to put all settings that require eachother for value changes in a list
# \param relations_set \type{set} Set of keys (strings) of settings that are influenced
# \param relations list of relation objects that need to be checked.
def _addRelations(self, relations_set, relations):
for relation in filter(lambda r: r.role == "value", relations):
if relation.type == RelationType.RequiresTarget:
continue
relations_set.add(relation.target.key)
self._addRelations(relations_set, relation.target.relations)

View File

@ -9,6 +9,8 @@ import UM.Settings.ContainerRegistry
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
from cura.Settings.ExtruderManager import ExtruderManager from cura.Settings.ExtruderManager import ExtruderManager
from UM.Settings.InstanceContainer import InstanceContainer
import re #For escaping characters in the settings. import re #For escaping characters in the settings.
import json import json
@ -61,6 +63,20 @@ class GCodeWriter(MeshWriter):
return False return False
## Create a new container with container 2 as base and container 1 written over it.
def _createFlattenedContainerInstance(self, instance_container1, instance_container2):
flat_container = InstanceContainer(instance_container2.getName())
flat_container.setDefinition(instance_container2.getDefinition())
flat_container.setMetaData(instance_container2.getMetaData())
for key in instance_container2.getAllKeys():
flat_container.setProperty(key, "value", instance_container2.getProperty(key, "value"))
for key in instance_container1.getAllKeys():
flat_container.setProperty(key, "value", instance_container1.getProperty(key, "value"))
return flat_container
## Serialises a container stack to prepare it for writing at the end of the ## Serialises a container stack to prepare it for writing at the end of the
# g-code. # g-code.
# #
@ -74,38 +90,13 @@ class GCodeWriter(MeshWriter):
prefix_length = len(prefix) prefix_length = len(prefix)
container_with_profile = stack.findContainer({"type": "quality"}) container_with_profile = stack.findContainer({"type": "quality"})
machine_manager = CuraApplication.getInstance().getMachineManager() flat_global_container = self._createFlattenedContainerInstance(stack.getTop(),container_with_profile)
serialized = flat_global_container.serialize()
# Duplicate the current quality profile and update it with any user settings.
flat_quality_id = machine_manager.duplicateContainer(container_with_profile.getId())
flat_quality = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = flat_quality_id)[0]
flat_quality._dirty = False
user_settings = stack.getTop()
# We don't want to send out any signals, so disconnect them.
flat_quality.propertyChanged.disconnectAll()
for key in user_settings.getAllKeys():
flat_quality.setProperty(key, "value", user_settings.getProperty(key, "value"))
serialized = flat_quality.serialize()
data = {"global_quality": serialized} data = {"global_quality": serialized}
manager = ExtruderManager.getInstance()
for extruder in manager.getMachineExtruders(stack.getId()): for extruder in ExtruderManager.getInstance().getMachineExtruders(stack.getId()):
extruder_quality = extruder.findContainer({"type": "quality"}) extruder_quality = extruder.findContainer({"type": "quality"})
flat_extruder_quality = self._createFlattenedContainerInstance(extruder.getTop(), extruder_quality)
flat_extruder_quality_id = machine_manager.duplicateContainer(extruder_quality.getId())
flat_extruder_quality = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id=flat_extruder_quality_id)[0]
flat_extruder_quality._dirty = False
extruder_user_settings = extruder.getTop()
# We don't want to send out any signals, so disconnect them.
flat_extruder_quality.propertyChanged.disconnectAll()
for key in extruder_user_settings.getAllKeys():
flat_extruder_quality.setProperty(key, "value", extruder_user_settings.getProperty(key, "value"))
extruder_serialized = flat_extruder_quality.serialize() extruder_serialized = flat_extruder_quality.serialize()
data.setdefault("extruder_quality", []).append(extruder_serialized) data.setdefault("extruder_quality", []).append(extruder_serialized)

View File

@ -11,6 +11,7 @@ from UM.Math.Color import Color
from UM.Mesh.MeshBuilder import MeshBuilder from UM.Mesh.MeshBuilder import MeshBuilder
from UM.Job import Job from UM.Job import Job
from UM.Preferences import Preferences from UM.Preferences import Preferences
from UM.Logger import Logger
from UM.View.RenderBatch import RenderBatch from UM.View.RenderBatch import RenderBatch
from UM.View.GL.OpenGL import OpenGL from UM.View.GL.OpenGL import OpenGL
@ -34,7 +35,7 @@ class LayerView(View):
self._shader = None self._shader = None
self._selection_shader = None self._selection_shader = None
self._num_layers = 0 self._num_layers = 0
self._layer_percentage = 0 # what percentage of layers need to be shown (SLider gives value between 0 - 100) self._layer_percentage = 0 # what percentage of layers need to be shown (Slider gives value between 0 - 100)
self._proxy = LayerViewProxy.LayerViewProxy() self._proxy = LayerViewProxy.LayerViewProxy()
self._controller.getScene().getRoot().childrenChanged.connect(self._onSceneChanged) self._controller.getScene().getRoot().childrenChanged.connect(self._onSceneChanged)
self._max_layers = 0 self._max_layers = 0
@ -43,12 +44,14 @@ class LayerView(View):
self._current_layer_jumps = None self._current_layer_jumps = None
self._top_layers_job = None self._top_layers_job = None
self._activity = False self._activity = False
self._old_max_layers = 0
Preferences.getInstance().addPreference("view/top_layer_count", 5) Preferences.getInstance().addPreference("view/top_layer_count", 5)
Preferences.getInstance().addPreference("view/only_show_top_layers", False)
Preferences.getInstance().preferenceChanged.connect(self._onPreferencesChanged) Preferences.getInstance().preferenceChanged.connect(self._onPreferencesChanged)
self._solid_layers = int(Preferences.getInstance().getValue("view/top_layer_count")) self._solid_layers = int(Preferences.getInstance().getValue("view/top_layer_count"))
self._only_show_top_layers = bool(Preferences.getInstance().getValue("view/only_show_top_layers"))
self._busy = False self._busy = False
def getActivity(self): def getActivity(self):
@ -100,7 +103,7 @@ class LayerView(View):
continue continue
# Render all layers below a certain number as line mesh instead of vertices. # Render all layers below a certain number as line mesh instead of vertices.
if self._current_layer_num - self._solid_layers > -1: if self._current_layer_num - self._solid_layers > -1 and not self._only_show_top_layers:
start = 0 start = 0
end = 0 end = 0
element_counts = layer_data.getElementCounts() element_counts = layer_data.getElementCounts()
@ -126,14 +129,12 @@ class LayerView(View):
if self._current_layer_num > self._max_layers: if self._current_layer_num > self._max_layers:
self._current_layer_num = self._max_layers self._current_layer_num = self._max_layers
self.resetLayerData()
self._startUpdateTopLayers() self._startUpdateTopLayers()
self.currentLayerNumChanged.emit() self.currentLayerNumChanged.emit()
def calculateMaxLayers(self): def calculateMaxLayers(self):
scene = self.getController().getScene() scene = self.getController().getScene()
renderer = self.getRenderer() # TODO: @UnusedVariable
self._activity = True self._activity = True
self._old_max_layers = self._max_layers self._old_max_layers = self._max_layers
@ -199,7 +200,7 @@ class LayerView(View):
if not job.getResult(): if not job.getResult():
return return
self.resetLayerData() # Reset the layer data only when job is done. Doing it now prevents "blinking" data.
self._current_layer_mesh = job.getResult().get("layers") self._current_layer_mesh = job.getResult().get("layers")
self._current_layer_jumps = job.getResult().get("jumps") self._current_layer_jumps = job.getResult().get("jumps")
self._controller.getScene().sceneChanged.emit(self._controller.getScene().getRoot()) self._controller.getScene().sceneChanged.emit(self._controller.getScene().getRoot())
@ -207,14 +208,15 @@ class LayerView(View):
self._top_layers_job = None self._top_layers_job = None
def _onPreferencesChanged(self, preference): def _onPreferencesChanged(self, preference):
if preference != "view/top_layer_count": if preference != "view/top_layer_count" and preference != "view/only_show_top_layers":
return return
self._solid_layers = int(Preferences.getInstance().getValue("view/top_layer_count")) self._solid_layers = int(Preferences.getInstance().getValue("view/top_layer_count"))
self._only_show_top_layers = bool(Preferences.getInstance().getValue("view/only_show_top_layers"))
self.resetLayerData()
self._startUpdateTopLayers() self._startUpdateTopLayers()
class _CreateTopLayersJob(Job): class _CreateTopLayersJob(Job):
def __init__(self, scene, layer_number, solid_layers): def __init__(self, scene, layer_number, solid_layers):
super().__init__() super().__init__()
@ -242,20 +244,20 @@ class _CreateTopLayersJob(Job):
try: try:
layer = layer_data.getLayer(layer_number).createMesh() layer = layer_data.getLayer(layer_number).createMesh()
except Exception as e: except Exception:
print(e) Logger.logException("w", "An exception occurred while creating layer mesh.")
return return
if not layer or layer.getVertices() is None: if not layer or layer.getVertices() is None:
continue continue
layer_mesh.addIndices(layer_mesh._vertex_count+layer.getIndices()) layer_mesh.addIndices(layer_mesh.getVertexCount() + layer.getIndices())
layer_mesh.addVertices(layer.getVertices()) layer_mesh.addVertices(layer.getVertices())
# Scale layer color by a brightness factor based on the current layer number # Scale layer color by a brightness factor based on the current layer number
# This will result in a range of 0.5 - 1.0 to multiply colors by. # This will result in a range of 0.5 - 1.0 to multiply colors by.
brightness = numpy.ones((1, 4), dtype=numpy.float32) * (2.0 - (i / self._solid_layers)) / 2.0 brightness = numpy.ones((1, 4), dtype=numpy.float32) * (2.0 - (i / self._solid_layers)) / 2.0
brightness[0, 3] = 1.0; brightness[0, 3] = 1.0
layer_mesh.addColors(layer.getColors() * brightness) layer_mesh.addColors(layer.getColors() * brightness)
if self._cancel: if self._cancel:

View File

@ -47,7 +47,9 @@ Item {
id: extruders_model id: extruders_model
onRowsInserted: extruderSelector.visible = extruders_model.rowCount() > 1 onRowsInserted: extruderSelector.visible = extruders_model.rowCount() > 1
onModelReset: extruderSelector.visible = extruders_model.rowCount() > 1 onModelReset: extruderSelector.visible = extruders_model.rowCount() > 1
onModelChanged: extruderSelector.color = extruders_model.getItem(extruderSelector.currentIndex).colour
} }
property string color: extruders_model.getItem(extruderSelector.currentIndex).colour
visible: extruders_model.rowCount() > 1 visible: extruders_model.rowCount() > 1
textRole: "name" textRole: "name"
width: UM.Theme.getSize("setting_control").width width: UM.Theme.getSize("setting_control").width
@ -88,7 +90,7 @@ Item {
anchors.leftMargin: UM.Theme.getSize("default_lining").width anchors.leftMargin: UM.Theme.getSize("default_lining").width
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
color: extruders_model.getItem(extruderSelector.currentIndex).colour color: extruderSelector.color
border.width: UM.Theme.getSize("default_lining").width border.width: UM.Theme.getSize("default_lining").width
border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : UM.Theme.getColor("setting_control_border") border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : UM.Theme.getColor("setting_control_border")
} }
@ -125,7 +127,11 @@ Item {
} }
} }
} }
Component.onCompleted:
{
// Ensure primary extruder is set as active
UM.ActiveTool.setProperty("SelectedActiveExtruder", extruders_model.getItem(0).id)
}
onActivated: UM.ActiveTool.setProperty("SelectedActiveExtruder", extruders_model.getItem(index).id); onActivated: UM.ActiveTool.setProperty("SelectedActiveExtruder", extruders_model.getItem(index).id);
onModelChanged: updateCurrentIndex(); onModelChanged: updateCurrentIndex();
@ -136,6 +142,7 @@ Item {
if(extruders_model.getItem(i).id == UM.ActiveTool.properties.getValue("SelectedActiveExtruder")) if(extruders_model.getItem(i).id == UM.ActiveTool.properties.getValue("SelectedActiveExtruder"))
{ {
extruderSelector.currentIndex = i; extruderSelector.currentIndex = i;
extruderSelector.color = extruders_model.getItem(i).colour;
return; return;
} }
} }
@ -243,6 +250,7 @@ Item {
key: model.key key: model.key
watchedProperties: [ "value", "enabled", "validationState" ] watchedProperties: [ "value", "enabled", "validationState" ]
storeIndex: 0 storeIndex: 0
removeUnusedValue: false
} }
} }
} }

View File

@ -3,6 +3,7 @@
from UM.View.View import View from UM.View.View import View
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
from UM.Scene.Selection import Selection
from UM.Resources import Resources from UM.Resources import Resources
from UM.Application import Application from UM.Application import Application
from UM.Preferences import Preferences from UM.Preferences import Preferences
@ -57,21 +58,24 @@ class SolidView(View):
# renderer.queueNode(scene.getRoot(), mesh = node.getBoundingBoxMesh(),mode = Renderer.RenderLines) # renderer.queueNode(scene.getRoot(), mesh = node.getBoundingBoxMesh(),mode = Renderer.RenderLines)
uniforms = {} uniforms = {}
if self._extruders_model.rowCount() > 0: if self._extruders_model.rowCount() == 0:
material = Application.getInstance().getGlobalContainerStack().findContainer({ "type": "material" })
material_color = material.getMetaDataEntry("color_code", default = self._extruders_model.defaultColours[0]) if material else self._extruders_model.defaultColours[0]
else:
# Get color to render this mesh in from ExtrudersModel # Get color to render this mesh in from ExtrudersModel
extruder_index = 0 extruder_index = 0
extruder_id = node.callDecoration("getActiveExtruder") extruder_id = node.callDecoration("getActiveExtruder")
if extruder_id: if extruder_id:
extruder_index = max(0, self._extruders_model.find("id", extruder_id)) extruder_index = max(0, self._extruders_model.find("id", extruder_id))
extruder_color = self._extruders_model.getItem(extruder_index)["colour"] material_color = self._extruders_model.getItem(extruder_index)["colour"]
try: try:
# Colors are passed as rgb hex strings (eg "#ffffff"), and the shader needs # Colors are passed as rgb hex strings (eg "#ffffff"), and the shader needs
# an rgba list of floats (eg [1.0, 1.0, 1.0, 1.0]) # an rgba list of floats (eg [1.0, 1.0, 1.0, 1.0])
uniforms["diffuse_color"] = [ uniforms["diffuse_color"] = [
int(extruder_color[1:3], 16) / 255, int(material_color[1:3], 16) / 255,
int(extruder_color[3:5], 16) / 255, int(material_color[3:5], 16) / 255,
int(extruder_color[5:7], 16) / 255, int(material_color[5:7], 16) / 255,
1.0 1.0
] ]
except ValueError: except ValueError:
@ -84,7 +88,7 @@ class SolidView(View):
renderer.queueNode(node, shader = self._enabled_shader, uniforms = uniforms) renderer.queueNode(node, shader = self._enabled_shader, uniforms = uniforms)
else: else:
renderer.queueNode(node, material = self._enabled_shader, uniforms = uniforms) renderer.queueNode(node, material = self._enabled_shader, uniforms = uniforms)
if node.callDecoration("isGroup"): if node.callDecoration("isGroup") and Selection.isSelected(node):
renderer.queueNode(scene.getRoot(), mesh = node.getBoundingBoxMesh(), mode = Renderer.RenderLines) renderer.queueNode(scene.getRoot(), mesh = node.getBoundingBoxMesh(), mode = Renderer.RenderLines)
def endRendering(self): def endRendering(self):

View File

@ -18,6 +18,11 @@ class BedLevelMachineAction(MachineAction):
pass pass
def _reset(self): def _reset(self):
self._bed_level_position = 0
pass
@pyqtSlot()
def startBedLeveling(self):
self._bed_level_position = 0 self._bed_level_position = 0
printer_output_devices = self._getPrinterOutputDevices() printer_output_devices = self._getPrinterOutputDevices()
if printer_output_devices: if printer_output_devices:
@ -52,4 +57,5 @@ class BedLevelMachineAction(MachineAction):
output_device.moveHead(0, 0, -3) output_device.moveHead(0, 0, -3)
self._bed_level_position += 1 self._bed_level_position += 1
elif self._bed_level_position >= 3: elif self._bed_level_position >= 3:
output_device.sendCommand("M18") # Turn off all motors so the user can move the axes
self.setFinished() self.setFinished()

View File

@ -47,37 +47,37 @@ Cura.MachineAction
text: catalog.i18nc("@label", "For every position; insert a piece of paper under the nozzle and adjust the print bed height. The print bed height is right when the paper is slightly gripped by the tip of the nozzle.") text: catalog.i18nc("@label", "For every position; insert a piece of paper under the nozzle and adjust the print bed height. The print bed height is right when the paper is slightly gripped by the tip of the nozzle.")
} }
Item Row
{ {
id: bedlevelingWrapper id: bedlevelingWrapper
anchors.top: bedlevelingText.bottom anchors.top: bedlevelingText.bottom
anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.topMargin: UM.Theme.getSize("default_margin").height
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
height: skipBedlevelingButton.height width: childrenRect.width
width: bedlevelingButton.width + skipBedlevelingButton.width + UM.Theme.getSize("default_margin").height < bedLevelMachineAction.width ? bedlevelingButton.width + skipBedlevelingButton.width + UM.Theme.getSize("default_margin").height : bedLevelMachineAction.width spacing: UM.Theme.getSize("default_margin").width
Button Button
{ {
id: bedlevelingButton id: startBedLevelingButton
anchors.top: parent.top text: catalog.i18nc("@action:button","Start Bed Leveling")
anchors.left: parent.left
text: catalog.i18nc("@action:button","Move to Next Position");
onClicked: onClicked:
{ {
manager.moveToNextLevelPosition() startBedLevelingButton.visible = false;
bedlevelingButton.visible = true;
checkupMachineAction.heatupHotendStarted = false;
checkupMachineAction.heatupBedStarted = false;
manager.startCheck();
} }
} }
Button Button
{ {
id: skipBedlevelingButton id: bedlevelingButton
anchors.top: parent.width < bedLevelMachineAction.width ? parent.top : bedlevelingButton.bottom text: catalog.i18nc("@action:button","Move to Next Position")
anchors.topMargin: parent.width < bedLevelMachineAction.width ? 0 : UM.Theme.getSize("default_margin").height/2 visible: false
anchors.left: parent.width < bedLevelMachineAction.width ? bedlevelingButton.right : parent.left
anchors.leftMargin: parent.width < bedLevelMachineAction.width ? UM.Theme.getSize("default_margin").width : 0
text: catalog.i18nc("@action:button","Skip bed leveling");
onClicked: onClicked:
{ {
manager.setFinished() manager.moveToNextLevelPosition();
} }
} }
} }

View File

@ -155,6 +155,7 @@ class UMOCheckupMachineAction(MachineAction):
if output_devices: if output_devices:
self._output_device = output_devices[0] self._output_device = output_devices[0]
try: try:
self._output_device.sendCommand("M18") # Turn off all motors so the user can move the axes
self._output_device.startPollEndstop() self._output_device.startPollEndstop()
self._output_device.bedTemperatureChanged.connect(self.bedTemperatureChanged) self._output_device.bedTemperatureChanged.connect(self.bedTemperatureChanged)
self._output_device.hotendTemperaturesChanged.connect(self.hotendTemperatureChanged) self._output_device.hotendTemperaturesChanged.connect(self.hotendTemperatureChanged)

View File

@ -39,38 +39,26 @@ Cura.MachineAction
text: catalog.i18nc("@label", "It's a good idea to do a few sanity checks on your Ultimaker. You can skip this step if you know your machine is functional"); text: catalog.i18nc("@label", "It's a good idea to do a few sanity checks on your Ultimaker. You can skip this step if you know your machine is functional");
} }
Item Row
{ {
id: startStopButtons id: startStopButtons
anchors.top: pageDescription.bottom anchors.top: pageDescription.bottom
anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.topMargin: UM.Theme.getSize("default_margin").height
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
height: childrenRect.height width: childrenRect.width
width: startCheckButton.width + skipCheckButton.width + UM.Theme.getSize("default_margin").height < checkupMachineAction.width ? startCheckButton.width + skipCheckButton.width + UM.Theme.getSize("default_margin").height : checkupMachineAction.width spacing: UM.Theme.getSize("default_margin").width
Button Button
{ {
id: startCheckButton id: startCheckButton
anchors.top: parent.top
anchors.left: parent.left
text: catalog.i18nc("@action:button","Start Printer Check"); text: catalog.i18nc("@action:button","Start Printer Check");
onClicked: onClicked:
{ {
checkupMachineAction.heatupHotendStarted = false checkupMachineAction.heatupHotendStarted = false;
checkupMachineAction.heatupBedStarted = false checkupMachineAction.heatupBedStarted = false;
manager.startCheck() manager.startCheck();
startCheckButton.visible = false;
} }
} }
Button
{
id: skipCheckButton
anchors.top: parent.width < checkupMachineAction.width ? parent.top : startCheckButton.bottom
anchors.topMargin: parent.width < checkupMachineAction.width ? 0 : UM.Theme.getSize("default_margin").height/2
anchors.left: parent.width < checkupMachineAction.width ? startCheckButton.right : parent.left
anchors.leftMargin: parent.width < checkupMachineAction.width ? UM.Theme.getSize("default_margin").width : 0
text: catalog.i18nc("@action:button", "Skip Printer Check");
onClicked: manager.setFinished()
}
} }
Item Item

View File

@ -12,6 +12,9 @@ class UMOUpgradeSelection(MachineAction):
super().__init__("UMOUpgradeSelection", catalog.i18nc("@action", "Select upgrades")) super().__init__("UMOUpgradeSelection", catalog.i18nc("@action", "Select upgrades"))
self._qml_url = "UMOUpgradeSelectionMachineAction.qml" self._qml_url = "UMOUpgradeSelectionMachineAction.qml"
def _reset(self):
self.heatedBedChanged.emit()
heatedBedChanged = pyqtSignal() heatedBedChanged = pyqtSignal()
@pyqtProperty(bool, notify = heatedBedChanged) @pyqtProperty(bool, notify = heatedBedChanged)

View File

@ -44,7 +44,7 @@ Cura.MachineAction
text: catalog.i18nc("@label", "Heated bed (official kit or self-built)") text: catalog.i18nc("@label", "Heated bed (official kit or self-built)")
checked: manager.hasHeatedBed checked: manager.hasHeatedBed
onClicked: manager.hasHeatedBed ? manager.removeHeatedBed() : manager.addHeatedBed() onClicked: checked ? manager.addHeatedBed() : manager.removeHeatedBed()
} }
UM.I18nCatalog { id: catalog; name: "cura"; } UM.I18nCatalog { id: catalog; name: "cura"; }

View File

@ -56,29 +56,21 @@ Cura.MachineAction
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: catalog.i18nc("@label", "Cura requires these new features and thus your firmware will most likely need to be upgraded. You can do so now."); text: catalog.i18nc("@label", "Cura requires these new features and thus your firmware will most likely need to be upgraded. You can do so now.");
} }
Item Row
{ {
anchors.top: upgradeText2.bottom anchors.top: upgradeText2.bottom
anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.topMargin: UM.Theme.getSize("default_margin").height
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
width: upgradeButton.width + skipUpgradeButton.width + UM.Theme.getSize("default_margin").height < upgradeFirmwareMachineAction.width ? upgradeButton.width + skipUpgradeButton.width + UM.Theme.getSize("default_margin").height : upgradeFirmwareMachineAction.width width: childrenRect.width
spacing: UM.Theme.getSize("default_margin").width
Button Button
{ {
id: upgradeButton id: upgradeButton
anchors.top: parent.top
anchors.left: parent.left
text: catalog.i18nc("@action:button","Upgrade to Marlin Firmware"); text: catalog.i18nc("@action:button","Upgrade to Marlin Firmware");
onClicked: Cura.USBPrinterManager.updateAllFirmware() onClicked:
}
Button
{ {
id: skipUpgradeButton Cura.USBPrinterManager.updateAllFirmware()
anchors.top: parent.width < upgradeFirmwareMachineAction.width ? parent.top : upgradeButton.bottom }
anchors.topMargin: parent.width < upgradeFirmwareMachineAction.width ? 0 : UM.Theme.getSize("default_margin").height / 2
anchors.left: parent.width < upgradeFirmwareMachineAction.width ? upgradeButton.right : parent.left
anchors.leftMargin: parent.width < upgradeFirmwareMachineAction.width ? UM.Theme.getSize("default_margin").width : 0
text: catalog.i18nc("@action:button", "Skip Upgrade");
onClicked: manager.setFinished()
} }
} }
} }

View File

@ -150,6 +150,8 @@
"label": "Number extruders", "label": "Number extruders",
"description": "Number of extruder trains. An extruder train is the combination of a feeder, bowden tube, and nozzle.", "description": "Number of extruder trains. An extruder train is the combination of a feeder, bowden tube, and nozzle.",
"default_value": 1, "default_value": 1,
"minimum_value": "1",
"maximum_value": "16",
"type": "int", "type": "int",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false, "settable_per_extruder": false,
@ -630,9 +632,8 @@
"type": "float", "type": "float",
"enabled": "support_enable", "enabled": "support_enable",
"value": "line_width", "value": "line_width",
"global_inherits_stack": "support_extruder_nr",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false "settable_per_extruder": true
}, },
"support_roof_line_width": "support_roof_line_width":
{ {
@ -645,9 +646,8 @@
"type": "float", "type": "float",
"enabled": "support_roof_enable", "enabled": "support_roof_enable",
"value": "line_width", "value": "line_width",
"global_inherits_stack": "support_extruder_nr",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false "settable_per_extruder": true
}, },
"prime_tower_line_width": "prime_tower_line_width":
{ {
@ -1238,8 +1238,8 @@
"default_value": false, "default_value": false,
"enabled": "retraction_enable", "enabled": "retraction_enable",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": true, "settable_per_extruder": true
"children": { },
"retraction_hop_only_when_collides": { "retraction_hop_only_when_collides": {
"label": "Z Hop Only Over Printed Parts", "label": "Z Hop Only Over Printed Parts",
"description": "Only perform a Z Hop when moving over printed parts which cannot be avoided by horizontal motion by Avoid Printed Parts when Traveling.", "description": "Only perform a Z Hop when moving over printed parts which cannot be avoided by horizontal motion by Avoid Printed Parts when Traveling.",
@ -1260,8 +1260,6 @@
"enabled": "retraction_enable and retraction_hop_enabled", "enabled": "retraction_enable and retraction_hop_enabled",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": true "settable_per_extruder": true
}
}
}, },
"material_standby_temperature": "material_standby_temperature":
{ {
@ -1444,10 +1442,9 @@
"maximum_value_warning": "150", "maximum_value_warning": "150",
"default_value": 60, "default_value": 60,
"value": "speed_print", "value": "speed_print",
"global_inherits_stack": "support_extruder_nr",
"enabled": "support_enable", "enabled": "support_enable",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false, "settable_per_extruder": true,
"children": "children":
{ {
"speed_support_infill": "speed_support_infill":
@ -1461,10 +1458,9 @@
"maximum_value": "299792458000", "maximum_value": "299792458000",
"maximum_value_warning": "150", "maximum_value_warning": "150",
"value": "speed_support", "value": "speed_support",
"global_inherits_stack": "support_extruder_nr",
"enabled": "support_enable", "enabled": "support_enable",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false "settable_per_extruder": true
}, },
"speed_support_roof": "speed_support_roof":
{ {
@ -1478,9 +1474,8 @@
"maximum_value_warning": "150", "maximum_value_warning": "150",
"enabled": "support_roof_enable and support_enable", "enabled": "support_roof_enable and support_enable",
"value": "speed_support / 1.5", "value": "speed_support / 1.5",
"global_inherits_stack": "support_extruder_nr",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false "settable_per_extruder": true
} }
} }
}, },
@ -1516,15 +1511,45 @@
}, },
"speed_layer_0": { "speed_layer_0": {
"label": "Initial Layer Speed", "label": "Initial Layer Speed",
"description": "The print speed for the initial layer. A lower value is advised to improve adhesion to the build plate.", "description": "The speed for the initial layer. A lower value is advised to improve adhesion to the build plate.",
"unit": "mm/s", "unit": "mm/s",
"type": "float", "type": "float",
"default_value": 30, "default_value": 30,
"minimum_value": "0.1", "minimum_value": "0.1",
"maximum_value": "299792458000", "maximum_value": "299792458000",
"maximum_value_warning": "300", "maximum_value_warning": "300",
"settable_per_mesh": true,
"children":
{
"speed_print_layer_0":
{
"label": "Initial Layer Print Speed",
"description": "The speed of printing for the initial layer. A lower value is advised to improve adhesion to the build plate.",
"unit": "mm/s",
"type": "float",
"default_value": 30,
"value": "speed_layer_0",
"minimum_value": "0.1",
"maximum_value": "299792458000",
"maximum_value_warning": "300",
"settable_per_mesh": true "settable_per_mesh": true
}, },
"speed_travel_layer_0":
{
"label": "Initial Layer Travel Speed",
"description": "The speed of travel moves in the initial layer. A lower value is advised to prevent pulling previously printed parts away from the build plate.",
"unit": "mm/s",
"type": "float",
"default_value": 60,
"value": "speed_layer_0 * speed_travel / speed_print",
"minimum_value": "0.1",
"maximum_value": "299792458000",
"maximum_value_warning": "300",
"settable_per_mesh": true,
"settable_per_extruder": true
}
}
},
"skirt_brim_speed": { "skirt_brim_speed": {
"label": "Skirt/Brim Speed", "label": "Skirt/Brim Speed",
"description": "The speed at which the skirt and brim are printed. Normally this is done at the initial layer speed, but sometimes you might want to print the skirt or brim at a different speed.", "description": "The speed at which the skirt and brim are printed. Normally this is done at the initial layer speed, but sometimes you might want to print the skirt or brim at a different speed.",
@ -1650,10 +1675,9 @@
"maximum_value_warning": "10000", "maximum_value_warning": "10000",
"default_value": 3000, "default_value": 3000,
"value": "acceleration_print", "value": "acceleration_print",
"global_inherits_stack": "support_extruder_nr",
"enabled": "acceleration_enabled and support_enable", "enabled": "acceleration_enabled and support_enable",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false, "settable_per_extruder": true,
"children": { "children": {
"acceleration_support_infill": { "acceleration_support_infill": {
"label": "Support Infill Acceleration", "label": "Support Infill Acceleration",
@ -1662,13 +1686,12 @@
"type": "float", "type": "float",
"default_value": 3000, "default_value": 3000,
"value": "acceleration_support", "value": "acceleration_support",
"global_inherits_stack": "support_extruder_nr",
"minimum_value": "0.1", "minimum_value": "0.1",
"minimum_value_warning": "100", "minimum_value_warning": "100",
"maximum_value_warning": "10000", "maximum_value_warning": "10000",
"enabled": "acceleration_enabled and support_enable", "enabled": "acceleration_enabled and support_enable",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false "settable_per_extruder": true
}, },
"acceleration_support_roof": { "acceleration_support_roof": {
"label": "Support Roof Acceleration", "label": "Support Roof Acceleration",
@ -1677,13 +1700,12 @@
"type": "float", "type": "float",
"default_value": 3000, "default_value": 3000,
"value": "acceleration_support", "value": "acceleration_support",
"global_inherits_stack": "support_extruder_nr",
"minimum_value": "0.1", "minimum_value": "0.1",
"minimum_value_warning": "100", "minimum_value_warning": "100",
"maximum_value_warning": "10000", "maximum_value_warning": "10000",
"enabled": "acceleration_enabled and support_roof_enable and support_enable", "enabled": "acceleration_enabled and support_roof_enable and support_enable",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false "settable_per_extruder": true
} }
} }
}, },
@ -1841,10 +1863,9 @@
"maximum_value_warning": "50", "maximum_value_warning": "50",
"default_value": 20, "default_value": 20,
"value": "jerk_print", "value": "jerk_print",
"global_inherits_stack": "support_extruder_nr",
"enabled": "jerk_enabled and support_enable", "enabled": "jerk_enabled and support_enable",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false, "settable_per_extruder": true,
"children": { "children": {
"jerk_support_infill": { "jerk_support_infill": {
"label": "Support Infill Jerk", "label": "Support Infill Jerk",
@ -1853,13 +1874,12 @@
"type": "float", "type": "float",
"default_value": 20, "default_value": 20,
"value": "jerk_support", "value": "jerk_support",
"global_inherits_stack": "support_extruder_nr",
"minimum_value": "0.1", "minimum_value": "0.1",
"minimum_value_warning": "5", "minimum_value_warning": "5",
"maximum_value_warning": "50", "maximum_value_warning": "50",
"enabled": "jerk_enabled and support_enable", "enabled": "jerk_enabled and support_enable",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false "settable_per_extruder": true
}, },
"jerk_support_roof": { "jerk_support_roof": {
"label": "Support Roof Jerk", "label": "Support Roof Jerk",
@ -1868,13 +1888,12 @@
"type": "float", "type": "float",
"default_value": 20, "default_value": 20,
"value": "jerk_support", "value": "jerk_support",
"global_inherits_stack": "support_extruder_nr",
"minimum_value": "0.1", "minimum_value": "0.1",
"minimum_value_warning": "5", "minimum_value_warning": "5",
"maximum_value_warning": "50", "maximum_value_warning": "50",
"enabled": "jerk_enabled and support_roof_enable and support_enable", "enabled": "jerk_enabled and support_roof_enable and support_enable",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false "settable_per_extruder": true
} }
} }
}, },
@ -2180,7 +2199,7 @@
"default_value": "zigzag", "default_value": "zigzag",
"enabled": "support_enable", "enabled": "support_enable",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false "settable_per_extruder": true
}, },
"support_connect_zigzags": "support_connect_zigzags":
{ {
@ -2190,7 +2209,7 @@
"default_value": true, "default_value": true,
"enabled": "support_enable and (support_pattern == \"zigzag\")", "enabled": "support_enable and (support_pattern == \"zigzag\")",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false "settable_per_extruder": true
}, },
"support_infill_rate": "support_infill_rate":
{ {
@ -2203,7 +2222,7 @@
"default_value": 15, "default_value": 15,
"enabled": "support_enable", "enabled": "support_enable",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false, "settable_per_extruder": true,
"children": { "children": {
"support_line_distance": "support_line_distance":
{ {
@ -2216,7 +2235,7 @@
"enabled": "support_enable", "enabled": "support_enable",
"value": "(support_line_width * 100) / support_infill_rate * (2 if support_pattern == \"grid\" else (3 if support_pattern == \"triangles\" else 1))", "value": "(support_line_width * 100) / support_infill_rate * (2 if support_pattern == \"grid\" else (3 if support_pattern == \"triangles\" else 1))",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false "settable_per_extruder": true
} }
} }
}, },
@ -2389,7 +2408,7 @@
"maximum_value_warning": "100", "maximum_value_warning": "100",
"enabled":"support_roof_enable and support_enable", "enabled":"support_roof_enable and support_enable",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false, "settable_per_extruder": true,
"children": "children":
{ {
"support_roof_line_distance": "support_roof_line_distance":
@ -2403,7 +2422,7 @@
"value": "0 if support_roof_density == 0 else (support_roof_line_width * 100) / support_roof_density * (2 if support_roof_pattern == \"grid\" else (3 if support_roof_pattern == \"triangles\" else 1))", "value": "0 if support_roof_density == 0 else (support_roof_line_width * 100) / support_roof_density * (2 if support_roof_pattern == \"grid\" else (3 if support_roof_pattern == \"triangles\" else 1))",
"enabled": "support_roof_enable and support_enable", "enabled": "support_roof_enable and support_enable",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false "settable_per_extruder": true
} }
} }
}, },
@ -2423,7 +2442,7 @@
"default_value": "concentric", "default_value": "concentric",
"enabled": "support_roof_enable and support_enable", "enabled": "support_roof_enable and support_enable",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false "settable_per_extruder": true
}, },
"support_use_towers": "support_use_towers":
{ {
@ -3357,9 +3376,9 @@
"type": "float", "type": "float",
"minimum_value": "0", "minimum_value": "0",
"maximum_value_warning": "9999", "maximum_value_warning": "9999",
"default_value": 0, "default_value": 10,
"value": "9999 if draft_shield_height_limitation == 'full' and draft_shield_enabled else 0.0", "value": "10",
"enabled": "draft_shield_height_limitation == \"limited\"", "enabled": "draft_shield_enabled and draft_shield_height_limitation == \"limited\"",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false "settable_per_extruder": false
}, },

View File

@ -7,6 +7,7 @@
"visible": true, "visible": true,
"author": "Calvindog717", "author": "Calvindog717",
"manufacturer": "PrintrBot", "manufacturer": "PrintrBot",
"category": "Other",
"file_formats": "text/x-gcode" "file_formats": "text/x-gcode"
}, },

View File

@ -57,7 +57,7 @@
"default_value": 2 "default_value": 2
}, },
"gantry_height": { "gantry_height": {
"default_value": 55 "default_value": 48
}, },
"machine_use_extruder_offset_to_offset_coords": { "machine_use_extruder_offset_to_offset_coords": {
"default_value": true "default_value": true

View File

@ -15,7 +15,7 @@
"preferred_material": "*pla*", "preferred_material": "*pla*",
"preferred_quality": "*normal*", "preferred_quality": "*normal*",
"first_start_actions": ["UMOUpgradeSelection", "UMOCheckup", "BedLevel"], "first_start_actions": ["UMOUpgradeSelection", "UMOCheckup", "BedLevel"],
"supported_actions": ["UMOCheckup", "UpgradeFirmware", "BedLevel", "UMOUpgradeSelection"] "supported_actions": ["UMOUpgradeSelection", "UMOCheckup", "BedLevel", "UpgradeFirmware"]
}, },
"overrides": { "overrides": {

View File

@ -27,6 +27,7 @@ Item
property alias multiplyObject: multiplyObjectAction; property alias multiplyObject: multiplyObjectAction;
property alias selectAll: selectAllAction;
property alias deleteAll: deleteAllAction; property alias deleteAll: deleteAllAction;
property alias reloadAll: reloadAllAction; property alias reloadAll: reloadAllAction;
property alias resetAllTranslation: resetAllTranslationAction; property alias resetAllTranslation: resetAllTranslationAction;
@ -119,7 +120,7 @@ Item
Action Action
{ {
id: updateProfileAction; id: updateProfileAction;
enabled: Cura.MachineManager.isGlobalStackValid && Cura.MachineManager.hasUserSettings && !Cura.MachineManager.isReadOnly(Cura.MachineManager.activeQualityId) enabled: Cura.MachineManager.isActiveStackValid && Cura.MachineManager.hasUserSettings && !Cura.MachineManager.isReadOnly(Cura.MachineManager.activeQualityId)
text: catalog.i18nc("@action:inmenu menubar:profile","&Update profile with current settings"); text: catalog.i18nc("@action:inmenu menubar:profile","&Update profile with current settings");
onTriggered: Cura.MachineManager.updateQualityContainerFromUserContainer() onTriggered: Cura.MachineManager.updateQualityContainerFromUserContainer()
} }
@ -135,7 +136,7 @@ Item
Action Action
{ {
id: addProfileAction; id: addProfileAction;
enabled: Cura.MachineManager.isGlobalStackValid && Cura.MachineManager.hasUserSettings enabled: Cura.MachineManager.isActiveStackValid && Cura.MachineManager.hasUserSettings
text: catalog.i18nc("@action:inmenu menubar:profile","&Create profile from current settings..."); text: catalog.i18nc("@action:inmenu menubar:profile","&Create profile from current settings...");
} }
@ -230,6 +231,16 @@ Item
iconName: "edit-duplicate" iconName: "edit-duplicate"
} }
Action
{
id: selectAllAction;
text: catalog.i18nc("@action:inmenu menubar:edit","&Select All Objects");
enabled: UM.Controller.toolsEnabled;
iconName: "edit-select-all";
shortcut: "Ctrl+A";
onTriggered: Printer.selectAll();
}
Action Action
{ {
id: deleteAllAction; id: deleteAllAction;

View File

@ -16,12 +16,23 @@ UM.Dialog
{ {
id: base id: base
title: catalog.i18nc("@title:window", "Add Printer") title: catalog.i18nc("@title:window", "Add Printer")
property string activeManufacturer: "Ultimaker"; property string preferredCategory: "Ultimaker"
property string activeCategory: preferredCategory
onVisibilityChanged:
{
// Reset selection and machine name
if (visible) {
activeCategory = preferredCategory;
machineList.currentIndex = 0;
machineName.text = getMachineName();
}
}
signal machineAdded(string id) signal machineAdded(string id)
function getMachineName() function getMachineName()
{ {
var name = machineList.model.getItem(machineList.currentIndex).name var name = machineList.model.get(machineList.currentIndex).name
return name return name
} }
@ -36,16 +47,32 @@ UM.Dialog
right: parent.right; right: parent.right;
bottom: parent.bottom; bottom: parent.bottom;
} }
ListView ListView
{ {
id: machineList id: machineList
model: UM.DefinitionContainersModel model: ListModel
{ {
id: machineDefinitionsModel id: sortedMachineDefinitionsModel
filter: {"visible":true} Component.onCompleted: {
// DefinitionContainersModel is sorted alphabetically, but we want the preferred
// category on top so we create a custom-sorted ListModel from it.
var items = [];
for(var i in machineDefinitionsModel.items) {
var item = machineDefinitionsModel.getItem(i);
if (item["category"] == preferredCategory)
sortedMachineDefinitionsModel.append(item);
else
items.push(item);
} }
section.property: "manufacturer" for(var i in items) {
sortedMachineDefinitionsModel.append(items[i]);
}
}
}
section.property: "category"
section.delegate: Button section.delegate: Button
{ {
text: section text: section
@ -76,16 +103,25 @@ UM.Dialog
sourceSize.width: width sourceSize.width: width
sourceSize.height: width sourceSize.height: width
color: palette.windowText color: palette.windowText
source: base.activeManufacturer == section ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_right") source: base.activeCategory == section ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_right")
} }
} }
} }
onClicked: onClicked:
{ {
base.activeManufacturer = section; base.activeCategory = section;
machineList.currentIndex = machineList.model.find("manufacturer", section) if (machineList.model.get(machineList.currentIndex).category != section) {
machineName.text = getMachineName() // Find the first machine from this category
for(var i = 0; i < sortedMachineDefinitionsModel.count; i++) {
var item = sortedMachineDefinitionsModel.get(i);
if (item.category == section) {
machineList.currentIndex = i;
break;
}
}
}
machineName.text = getMachineName();
} }
} }
@ -114,7 +150,7 @@ UM.Dialog
states: State states: State
{ {
name: "collapsed"; name: "collapsed";
when: base.activeManufacturer != model.manufacturer; when: base.activeCategory != model.category;
PropertyChanges { target: machineButton; opacity: 0; height: 0; } PropertyChanges { target: machineButton; opacity: 0; height: 0; }
} }
@ -161,7 +197,7 @@ UM.Dialog
onClicked: onClicked:
{ {
base.visible = false base.visible = false
var item = machineList.model.getItem(machineList.currentIndex); var item = machineList.model.get(machineList.currentIndex);
Cura.MachineManager.addMachine(machineName.text, item.id) Cura.MachineManager.addMachine(machineName.text, item.id)
base.machineAdded(item.id) // Emit signal that the user added a machine. base.machineAdded(item.id) // Emit signal that the user added a machine.
} }
@ -174,6 +210,11 @@ UM.Dialog
id: catalog; id: catalog;
name: "cura"; name: "cura";
} }
UM.DefinitionContainersModel
{
id: machineDefinitionsModel
filter: { "visible": true }
}
SystemPalette { id: palette } SystemPalette { id: palette }
ExclusiveGroup { id: printerGroup; } ExclusiveGroup { id: printerGroup; }
} }

View File

@ -54,10 +54,7 @@ UM.MainWindow
Keys.onPressed: { Keys.onPressed: {
if (event.key == Qt.Key_Backspace) if (event.key == Qt.Key_Backspace)
{ {
if(objectContextMenu.objectId != 0) Cura.Actions.deleteSelection.trigger()
{
Printer.deleteObject(objectContextMenu.objectId);
}
} }
} }
@ -121,6 +118,7 @@ UM.MainWindow
MenuItem { action: Cura.Actions.undo; } MenuItem { action: Cura.Actions.undo; }
MenuItem { action: Cura.Actions.redo; } MenuItem { action: Cura.Actions.redo; }
MenuSeparator { } MenuSeparator { }
MenuItem { action: Cura.Actions.selectAll; }
MenuItem { action: Cura.Actions.deleteSelection; } MenuItem { action: Cura.Actions.deleteSelection; }
MenuItem { action: Cura.Actions.deleteAll; } MenuItem { action: Cura.Actions.deleteAll; }
MenuItem { action: Cura.Actions.resetAllTranslation; } MenuItem { action: Cura.Actions.resetAllTranslation; }
@ -540,6 +538,7 @@ UM.MainWindow
MenuItem { action: Cura.Actions.deleteObject; } MenuItem { action: Cura.Actions.deleteObject; }
MenuItem { action: Cura.Actions.multiplyObject; } MenuItem { action: Cura.Actions.multiplyObject; }
MenuSeparator { } MenuSeparator { }
MenuItem { action: Cura.Actions.selectAll; }
MenuItem { action: Cura.Actions.deleteAll; } MenuItem { action: Cura.Actions.deleteAll; }
MenuItem { action: Cura.Actions.reloadAll; } MenuItem { action: Cura.Actions.reloadAll; }
MenuItem { action: Cura.Actions.resetAllTranslation; } MenuItem { action: Cura.Actions.resetAllTranslation; }
@ -592,6 +591,7 @@ UM.MainWindow
Menu Menu
{ {
id: contextMenu; id: contextMenu;
MenuItem { action: Cura.Actions.selectAll; }
MenuItem { action: Cura.Actions.deleteAll; } MenuItem { action: Cura.Actions.deleteAll; }
MenuItem { action: Cura.Actions.reloadAll; } MenuItem { action: Cura.Actions.reloadAll; }
MenuItem { action: Cura.Actions.resetAllTranslation; } MenuItem { action: Cura.Actions.resetAllTranslation; }

View File

@ -22,7 +22,7 @@ Rectangle
{ {
if(!printerConnected) if(!printerConnected)
return UM.Theme.getColor("status_offline") return UM.Theme.getColor("status_offline")
else if(Cura.MachineManager.printerOutputDevices[0].jobState == "printing" || Cura.MachineManager.printerOutputDevices[0].jobState == "pre_print") else if(Cura.MachineManager.printerOutputDevices[0].jobState == "printing" || Cura.MachineManager.printerOutputDevices[0].jobState == "pre_print" || Cura.MachineManager.printerOutputDevices[0].jobState == "wait_cleanup" )
return UM.Theme.getColor("status_busy") return UM.Theme.getColor("status_busy")
else if(Cura.MachineManager.printerOutputDevices[0].jobState == "ready" || Cura.MachineManager.printerOutputDevices[0].jobState == "") else if(Cura.MachineManager.printerOutputDevices[0].jobState == "ready" || Cura.MachineManager.printerOutputDevices[0].jobState == "")
return UM.Theme.getColor("status_ready") return UM.Theme.getColor("status_ready")
@ -30,6 +30,8 @@ Rectangle
return UM.Theme.getColor("status_paused") return UM.Theme.getColor("status_paused")
else if (Cura.MachineManager.printerOutputDevices[0].jobState == "error") else if (Cura.MachineManager.printerOutputDevices[0].jobState == "error")
return UM.Theme.getColor("status_stopped") return UM.Theme.getColor("status_stopped")
else if (Cura.MachineManager.printerOutputDevices[0].jobState == "offline")
return UM.Theme.getColor("status_offline")
else else
return UM.Theme.getColor("text") return UM.Theme.getColor("text")
} }
@ -41,7 +43,10 @@ Rectangle
{ {
if(!printerConnected) if(!printerConnected)
{ {
return catalog.i18nc("@label:", "Please check your printer connections") return catalog.i18nc("@label:", "Not connected to a printer")
} else if(Cura.MachineManager.printerOutputDevices[0].jobState == "offline")
{
return catalog.i18nc("@label:", "Lost connection with the printer")
} else if(Cura.MachineManager.printerOutputDevices[0].jobState == "printing") } else if(Cura.MachineManager.printerOutputDevices[0].jobState == "printing")
{ {
return catalog.i18nc("@label:", "Printing...") return catalog.i18nc("@label:", "Printing...")
@ -53,6 +58,10 @@ Rectangle
{ {
return catalog.i18nc("@label:", "Preparing...") return catalog.i18nc("@label:", "Preparing...")
} }
else if(Cura.MachineManager.printerOutputDevices[0].jobState == "wait_cleanup")
{
return catalog.i18nc("@label:", "Waiting for cleanup...")
}
else else
{ {
return " " return " "

View File

@ -192,6 +192,7 @@ UM.PreferencesPage
} }
} }
UM.TooltipArea { UM.TooltipArea {
width: childrenRect.width; width: childrenRect.width;
height: childrenRect.height; height: childrenRect.height;
@ -215,6 +216,19 @@ UM.PreferencesPage
} }
} }
} }
UM.TooltipArea {
width: childrenRect.width
height: childrenRect.height
text: catalog.i18nc("@info:tooltip", "Should only the top layers be displayed in layerview?")
CheckBox
{
id: topLayersOnlyCheckbox
text: catalog.i18nc("@option:check", "Only display top layer(s) in layer view")
checked: boolCheck(UM.Preferences.getValue("view/only_show_top_layers"))
onCheckedChanged: UM.Preferences.setValue("view/only_show_top_layers", checked)
}
}
Item Item
{ {

View File

@ -107,6 +107,12 @@ UM.ManagementPage
contents = content; contents = content;
content.onCompleted.connect(hide) content.onCompleted.connect(hide)
} }
rightButtons: Button
{
text: catalog.i18nc("@action:button", "Close")
iconName: "dialog-close"
onClicked: actionDialog.accept()
}
} }
Row Row

View File

@ -67,6 +67,8 @@ UM.ManagementPage
enabled: base.currentItem != null && base.currentItem.id != Cura.MachineManager.activeMaterialId enabled: base.currentItem != null && base.currentItem.id != Cura.MachineManager.activeMaterialId
onClicked: Cura.MachineManager.setActiveMaterial(base.currentItem.id) onClicked: Cura.MachineManager.setActiveMaterial(base.currentItem.id)
}, },
/*
// disabled because it has a lot of issues
Button Button
{ {
text: catalog.i18nc("@action:button", "Duplicate"); text: catalog.i18nc("@action:button", "Duplicate");
@ -89,7 +91,7 @@ UM.ManagementPage
Cura.MachineManager.setActiveMaterial(material_id) Cura.MachineManager.setActiveMaterial(material_id)
} }
}, }, */
Button Button
{ {
text: catalog.i18nc("@action:button", "Remove"); text: catalog.i18nc("@action:button", "Remove");
@ -253,7 +255,7 @@ UM.ManagementPage
else if(result.status == "success") else if(result.status == "success")
{ {
messageDialog.icon = StandardIcon.Information messageDialog.icon = StandardIcon.Information
messageDialog.text = catalog.i18nc("@info:status", "Successfully exported material to <filename>%1</filename>").arg(fileUrl) messageDialog.text = catalog.i18nc("@info:status", "Successfully exported material to <filename>%1</filename>").arg(result.path)
messageDialog.open() messageDialog.open()
} }
CuraApplication.setDefaultPath("dialog_material_path", folder) CuraApplication.setDefaultPath("dialog_material_path", folder)

View File

@ -84,6 +84,27 @@ Rectangle {
anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.topMargin: UM.Theme.getSize("default_margin").height
anchors.left: parent.left anchors.left: parent.left
Row {
id: additionalComponentsRow
anchors.top: parent.top
anchors.right: saveToButton.visible ? saveToButton.left : parent.right
anchors.rightMargin: UM.Theme.getSize("default_margin").width
spacing: UM.Theme.getSize("default_margin").width
}
Connections {
target: Printer
onAdditionalComponentsChanged:
{
if(areaId == "saveButton") {
for (var component in Printer.additionalComponents["saveButton"]) {
Printer.additionalComponents["saveButton"][component].parent = additionalComponentsRow
}
}
}
}
Button { Button {
id: saveToButton id: saveToButton
@ -102,8 +123,7 @@ Rectangle {
} }
style: ButtonStyle { style: ButtonStyle {
background: background: Rectangle
Rectangle
{ {
border.width: UM.Theme.getSize("default_lining").width border.width: UM.Theme.getSize("default_lining").width
border.color: !control.enabled ? UM.Theme.getColor("action_button_disabled_border") : border.color: !control.enabled ? UM.Theme.getColor("action_button_disabled_border") :

View File

@ -86,18 +86,18 @@ SettingItem
} }
} }
onActivated: { forceActiveFocus(); provider.setPropertyValue("value", definition.options[index].key) } onActivated: { forceActiveFocus(); propertyProvider.setPropertyValue("value", definition.options[index].key) }
onModelChanged: updateCurrentIndex(); onModelChanged: updateCurrentIndex();
Connections Connections
{ {
target: provider target: propertyProvider
onPropertiesChanged: control.updateCurrentIndex() onPropertiesChanged: control.updateCurrentIndex()
} }
function updateCurrentIndex() { function updateCurrentIndex() {
for(var i = 0; i < definition.options.length; ++i) { for(var i = 0; i < definition.options.length; ++i) {
if(definition.options[i].key == provider.properties.value) { if(definition.options[i].key == propertyProvider.properties.value) {
currentIndex = i; currentIndex = i;
return; return;
} }

View File

@ -105,13 +105,13 @@ SettingItem
onActivated: onActivated:
{ {
forceActiveFocus(); forceActiveFocus();
provider.setPropertyValue("value", extruders_model.getItem(index).index) propertyProvider.setPropertyValue("value", extruders_model.getItem(index).index)
} }
onModelChanged: updateCurrentIndex(); onModelChanged: updateCurrentIndex();
Connections Connections
{ {
target: provider target: propertyProvider
onPropertiesChanged: control.updateCurrentIndex(); onPropertiesChanged: control.updateCurrentIndex();
} }
@ -119,7 +119,7 @@ SettingItem
{ {
for(var i = 0; i < extruders_model.rowCount(); ++i) for(var i = 0; i < extruders_model.rowCount(); ++i)
{ {
if(extruders_model.getItem(i).index == provider.properties.value) if(extruders_model.getItem(i).index == propertyProvider.properties.value)
{ {
currentIndex = i; currentIndex = i;
return; return;

View File

@ -138,7 +138,7 @@ Item {
{ {
id: linkedSettingIcon; id: linkedSettingIcon;
visible: base.settablePerExtruder != "True" && base.showLinkedSettingIcon visible: Cura.MachineManager.activeStackId != Cura.MachineManager.activeMachineId && base.settablePerExtruder != "True" && base.showLinkedSettingIcon
height: parent.height; height: parent.height;
width: height; width: height;

View File

@ -108,7 +108,7 @@ Rectangle
iconSource: { iconSource: {
if(!printerConnected) if(!printerConnected)
return UM.Theme.getIcon("tab_monitor") return UM.Theme.getIcon("tab_monitor")
else if(Cura.MachineManager.printerOutputDevices[0].jobState == "printing" || Cura.MachineManager.printerOutputDevices[0].jobState == "pre_print") else if(Cura.MachineManager.printerOutputDevices[0].jobState == "printing" || Cura.MachineManager.printerOutputDevices[0].jobState == "pre_print" || Cura.MachineManager.printerOutputDevices[0].jobState == "wait_cleanup" )
return UM.Theme.getIcon("tab_monitor_busy") return UM.Theme.getIcon("tab_monitor_busy")
else if(Cura.MachineManager.printerOutputDevices[0].jobState == "ready" || Cura.MachineManager.printerOutputDevices[0].jobState == "") else if(Cura.MachineManager.printerOutputDevices[0].jobState == "ready" || Cura.MachineManager.printerOutputDevices[0].jobState == "")
return UM.Theme.getIcon("tab_monitor_connected") return UM.Theme.getIcon("tab_monitor_connected")
@ -116,6 +116,8 @@ Rectangle
return UM.Theme.getIcon("tab_monitor_paused") return UM.Theme.getIcon("tab_monitor_paused")
else if (Cura.MachineManager.printerOutputDevices[0].jobState == "error") else if (Cura.MachineManager.printerOutputDevices[0].jobState == "error")
return UM.Theme.getIcon("tab_monitor_stopped") return UM.Theme.getIcon("tab_monitor_stopped")
else if (Cura.MachineManager.printerOutputDevices[0].jobState == "offline")
return UM.Theme.getIcon("tab_monitor_offline")
else else
return UM.Theme.getIcon("tab_monitor") return UM.Theme.getIcon("tab_monitor")
} }

View File

@ -1,7 +1,7 @@
[shaders] [shaders]
vertex = vertex =
uniform highp mat4 u_viewProjectionMatrix;
uniform highp mat4 u_modelMatrix; uniform highp mat4 u_modelMatrix;
uniform highp mat4 u_viewProjectionMatrix;
uniform highp mat4 u_normalMatrix; uniform highp mat4 u_normalMatrix;
attribute highp vec4 a_vertex; attribute highp vec4 a_vertex;
@ -10,7 +10,6 @@ vertex =
varying highp vec3 v_vertex; varying highp vec3 v_vertex;
varying highp vec3 v_normal; varying highp vec3 v_normal;
varying highp vec2 v_uvs;
void main() void main()
{ {
@ -19,56 +18,47 @@ vertex =
v_vertex = world_space_vert.xyz; v_vertex = world_space_vert.xyz;
v_normal = (u_normalMatrix * normalize(a_normal)).xyz; v_normal = (u_normalMatrix * normalize(a_normal)).xyz;
v_uvs = a_uvs;
} }
fragment = fragment =
uniform mediump vec4 u_ambientColor; uniform mediump vec4 u_ambientColor;
uniform mediump vec4 u_diffuseColor; uniform mediump vec4 u_diffuseColor;
uniform highp vec3 u_lightPosition; uniform highp vec3 u_lightPosition;
uniform highp vec3 u_viewPosition;
uniform mediump float u_opacity; uniform mediump float u_opacity;
uniform sampler2D u_texture;
varying highp vec3 v_vertex; varying highp vec3 v_vertex;
varying highp vec3 v_normal; varying highp vec3 v_normal;
varying highp vec2 v_uvs;
void main() void main()
{ {
// Copied from platform.shader, removed texture mediump vec4 finalColor = vec4(0.0);
mediump vec4 final_color = vec4(0.0);
/* Ambient Component */ /* Ambient Component */
final_color += u_ambientColor; finalColor += u_ambientColor;
highp vec3 normal = normalize(v_normal); highp vec3 normal = normalize(v_normal);
highp vec3 light_dir = normalize(u_lightPosition - v_vertex); highp vec3 lightDir = normalize(u_lightPosition - v_vertex);
/* Diffuse Component */ /* Diffuse Component */
highp float n_dot_l = clamp(dot(normal, light_dir), 0.0, 1.0); highp float NdotL = clamp(abs(dot(normal, lightDir)), 0.0, 1.0);
final_color += (n_dot_l * u_diffuseColor); finalColor += (NdotL * u_diffuseColor);
final_color.a = u_opacity; gl_FragColor = finalColor;
gl_FragColor.a = u_opacity;
gl_FragColor = final_color;
} }
[defaults] [defaults]
u_ambientColor = [0.3, 0.3, 0.3, 1.0] u_ambientColor = [0.1, 0.1, 0.1, 1.0]
u_diffuseColor = [1.0, 1.0, 1.0, 1.0] u_diffuseColor = [0.4, 0.4, 0.4, 1.0]
u_opacity = 0.5 u_opacity = 0.5
u_texture = 0
[bindings] [bindings]
u_viewProjectionMatrix = view_projection_matrix
u_modelMatrix = model_matrix u_modelMatrix = model_matrix
u_viewProjectionMatrix = view_projection_matrix
u_normalMatrix = normal_matrix u_normalMatrix = normal_matrix
u_lightPosition = light_0_position u_lightPosition = light_0_position
u_viewPosition = camera_position
[attributes] [attributes]
a_vertex = vertex a_vertex = vertex
a_normal = normal a_normal = normal
a_uvs = uv0