Merge branch 'master' into feature_support_bottoms

This commit is contained in:
Tim Kuipers 2016-07-28 13:53:43 +02:00
commit 2ab9531f83
12 changed files with 75 additions and 36 deletions

View File

@ -30,9 +30,10 @@ class ConvexHullDecorator(SceneNodeDecorator):
def setNode(self, node):
previous_node = self._node
# Disconnect from previous node signals
if previous_node is not None and node is not previous_node:
previous_node.transformationChanged.connect(self._onChanged)
previous_node.parentChanged.connect(self._onChanged)
previous_node.transformationChanged.disconnect(self._onChanged)
previous_node.parentChanged.disconnect(self._onChanged)
super().setNode(node)

View File

@ -23,7 +23,7 @@ class ConvexHullNode(SceneNode):
self._original_parent = parent
# 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.
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_globally", DefinitionPropertyType.Any, default = True)
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.
Resources.addStorageType(self.ResourceTypes.QualityInstanceContainer, "quality")
@ -128,6 +128,8 @@ class CuraApplication(QtApplication):
self._machine_action_manager = MachineActionManager.MachineActionManager()
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)
self.setWindowIcon(QIcon(Resources.getPath(Resources.Images, "cura-icon.png")))
@ -876,4 +878,22 @@ class CuraApplication(QtApplication):
self.getMainWindow().setMinimumSize(size)
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

@ -71,7 +71,6 @@ class PlatformPhysics:
# If there is no convex hull for the node, start calculating it and continue.
if not node.getDecorator(ConvexHullDecorator):
node.addDecorator(ConvexHullDecorator())
node.callDecoration("recomputeConvexHull")
if Preferences.getInstance().getValue("physics/automatic_push_free"):
# 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.
head_hull = node.callDecoration("getConvexHullHead")
if head_hull:
overlap = head_hull.intersectsPolygon(other_node.callDecoration("getConvexHull"))
overlap = head_hull.intersectsPolygon(other_node.callDecoration("getConvexHullHead"))
if not overlap:
other_head_hull = other_node.callDecoration("getConvexHullHead")
if other_head_hull:
overlap = node.callDecoration("getConvexHull").intersectsPolygon(other_head_hull)
overlap = node.callDecoration("getConvexHullHead").intersectsPolygon(other_head_hull)
else:
own_convex_hull = node.callDecoration("getConvexHull")
other_convex_hull = other_node.callDecoration("getConvexHull")

View File

@ -252,6 +252,9 @@ class CuraEngineBackend(Backend):
return
super()._onSocketError(error)
if error.getErrorCode() == Arcus.ErrorCode.Debug:
return
self._terminate()
if error.getErrorCode() not in [Arcus.ErrorCode.BindFailedError, Arcus.ErrorCode.ConnectionResetError, Arcus.ErrorCode.Debug]:

View File

@ -246,6 +246,7 @@ Item {
key: model.key
watchedProperties: [ "value", "enabled", "validationState" ]
storeIndex: 0
removeUnusedValue: false
}
}
}

View File

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

View File

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

View File

@ -3380,7 +3380,7 @@
"maximum_value_warning": "9999",
"default_value": 0,
"value": "9999 if draft_shield_height_limitation == 'full' and draft_shield_enabled else 0.0",
"enabled": "draft_shield_height_limitation == \"limited\"",
"enabled": "draft_shield_enabled and draft_shield_height_limitation == \"limited\"",
"settable_per_mesh": false,
"settable_per_extruder": false
},

View File

@ -67,6 +67,8 @@ UM.ManagementPage
enabled: base.currentItem != null && base.currentItem.id != Cura.MachineManager.activeMaterialId
onClicked: Cura.MachineManager.setActiveMaterial(base.currentItem.id)
},
/*
// disabled because it has a lot of issues
Button
{
text: catalog.i18nc("@action:button", "Duplicate");
@ -89,7 +91,7 @@ UM.ManagementPage
Cura.MachineManager.setActiveMaterial(material_id)
}
},
}, */
Button
{
text: catalog.i18nc("@action:button", "Remove");

View File

@ -84,6 +84,27 @@ Rectangle {
anchors.topMargin: UM.Theme.getSize("default_margin").height
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 {
id: saveToButton
@ -102,8 +123,7 @@ Rectangle {
}
style: ButtonStyle {
background:
Rectangle
background: Rectangle
{
border.width: UM.Theme.getSize("default_lining").width
border.color: !control.enabled ? UM.Theme.getColor("action_button_disabled_border") :
@ -126,7 +146,7 @@ Rectangle {
text: control.text;
}
}
label: Item { }
label: Item { }
}
}

View File

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