Solved merge conflicts. CURA-3214

This commit is contained in:
Jack Ha 2017-02-21 11:01:20 +01:00
commit 057dc2fd7d
27 changed files with 50293 additions and 588 deletions

View file

@ -182,7 +182,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
self._dialog.setMachineType(machine_type)
self._dialog.setExtruders(extruders)
self._dialog.setVariantType(variant_type_name)
self._dialog.setHasObjectsOnPlate(Application.getInstance().getPlatformActivity)
self._dialog.setHasObjectsOnPlate(Application.getInstance().platformActivity)
self._dialog.show()
# Block until the dialog is closed.

View file

@ -177,7 +177,7 @@ class ThreeMFWriter(MeshWriter):
transformation_matrix._data[2, 1] = 1
transformation_matrix._data[2, 2] = 0
global_container_stack = UM.Application.getInstance().getGlobalContainerStack()
global_container_stack = Application.getInstance().getGlobalContainerStack()
# Second step: 3MF defines the left corner of the machine as center, whereas cura uses the center of the
# build volume.
if global_container_stack:

View file

@ -253,7 +253,7 @@ class CuraEngineBackend(QObject, Backend):
return
if job.getResult() == StartSliceJob.StartJobResult.MaterialIncompatible:
if Application.getInstance().getPlatformActivity:
if Application.getInstance().platformActivity:
self._error_message = Message(catalog.i18nc("@info:status",
"The selected material is incompatible with the selected machine or configuration."))
self._error_message.show()
@ -263,7 +263,7 @@ class CuraEngineBackend(QObject, Backend):
return
if job.getResult() == StartSliceJob.StartJobResult.SettingError:
if Application.getInstance().getPlatformActivity:
if Application.getInstance().platformActivity:
extruders = list(ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId()))
error_keys = []
for extruder in extruders:
@ -284,7 +284,7 @@ class CuraEngineBackend(QObject, Backend):
return
if job.getResult() == StartSliceJob.StartJobResult.BuildPlateError:
if Application.getInstance().getPlatformActivity:
if Application.getInstance().platformActivity:
self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice because the prime tower or prime position(s) are invalid."))
self._error_message.show()
self.backendStateChange.emit(BackendState.Error)
@ -292,7 +292,7 @@ class CuraEngineBackend(QObject, Backend):
self.backendStateChange.emit(BackendState.NotStarted)
if job.getResult() == StartSliceJob.StartJobResult.NothingToSlice:
if Application.getInstance().getPlatformActivity:
if Application.getInstance().platformActivity:
self._error_message = Message(catalog.i18nc("@info:status", "Nothing to slice because none of the models fit the build volume. Please scale or rotate models to fit."))
self._error_message.show()
self.backendStateChange.emit(BackendState.Error)

View file

@ -48,8 +48,7 @@ class LayerPass(RenderPass):
self._layer_shader.setUniformValue("u_layer_view_type", self._layer_view.getLayerViewType())
self._layer_shader.setUniformValue("u_extruder_opacity", self._layer_view.getExtruderOpacities())
self._layer_shader.setUniformValue("u_show_travel_moves", self._layer_view.getShowTravelMoves())
self._layer_shader.setUniformValue("u_show_support", self._layer_view.getShowSupport())
self._layer_shader.setUniformValue("u_show_adhesion", self._layer_view.getShowAdhesion())
self._layer_shader.setUniformValue("u_show_helpers", self._layer_view.getShowHelpers())
self._layer_shader.setUniformValue("u_show_skin", self._layer_view.getShowSkin())
self._layer_shader.setUniformValue("u_show_infill", self._layer_view.getShowInfill())
else:
@ -57,8 +56,7 @@ class LayerPass(RenderPass):
self._layer_shader.setUniformValue("u_layer_view_type", 1)
self._layer_shader.setUniformValue("u_extruder_opacity", [1, 1, 1, 1])
self._layer_shader.setUniformValue("u_show_travel_moves", 0)
self._layer_shader.setUniformValue("u_show_support", 1)
self._layer_shader.setUniformValue("u_show_adhesion", 1)
self._layer_shader.setUniformValue("u_show_helpers", 1)
self._layer_shader.setUniformValue("u_show_skin", 1)
self._layer_shader.setUniformValue("u_show_infill", 1)

View file

@ -70,8 +70,21 @@ class LayerView(View):
Preferences.getInstance().addPreference("view/top_layer_count", 5)
Preferences.getInstance().addPreference("view/only_show_top_layers", False)
Preferences.getInstance().addPreference("view/force_layer_view_compatibility_mode", False)
Preferences.getInstance().addPreference("layerview/layer_view_type", 0)
Preferences.getInstance().addPreference("layerview/extruder0_opacity", 1.0)
Preferences.getInstance().addPreference("layerview/extruder1_opacity", 1.0)
Preferences.getInstance().addPreference("layerview/extruder2_opacity", 1.0)
Preferences.getInstance().addPreference("layerview/extruder3_opacity", 1.0)
Preferences.getInstance().addPreference("layerview/show_travel_moves", False)
Preferences.getInstance().addPreference("layerview/show_helpers", True)
Preferences.getInstance().addPreference("layerview/show_skin", True)
Preferences.getInstance().addPreference("layerview/show_infill", True)
Preferences.getInstance().preferenceChanged.connect(self._onPreferencesChanged)
self._updateWithPreferences()
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"))
@ -84,8 +97,7 @@ class LayerView(View):
self._extruder_count = 0
self._extruder_opacity = [1.0, 1.0, 1.0, 1.0]
self._show_travel_moves = 0
self._show_support = 1
self._show_adhesion = 1
self._show_helpers = 1
self._show_skin = 1
self._show_infill = 1
@ -197,19 +209,12 @@ class LayerView(View):
def getShowTravelMoves(self):
return self._show_travel_moves
def setShowSupport(self, show):
self._show_support = show
def setShowHelpers(self, show):
self._show_helpers = show
self.currentLayerNumChanged.emit()
def getShowSupport(self):
return self._show_support
def setShowAdhesion(self, show):
self._show_adhesion = show
self.currentLayerNumChanged.emit()
def getShowAdhesion(self):
return self._show_adhesion
def getShowHelpers(self):
return self._show_helpers
def setShowSkin(self, show):
self._show_skin = show
@ -311,7 +316,7 @@ class LayerView(View):
self._old_composite_shader = self._composite_pass.getCompositeShader()
self._composite_pass.setCompositeShader(self._layerview_composite_shader)
if self.getLayerViewType() == self.LAYER_VIEW_TYPE_LINE_TYPE:
if self.getLayerViewType() == self.LAYER_VIEW_TYPE_LINE_TYPE or self._compatibility_mode:
self.enableLegend()
elif event.type == Event.ViewDeactivateEvent:
@ -370,18 +375,46 @@ class LayerView(View):
self._top_layers_job = None
def _onPreferencesChanged(self, preference):
if preference not in {"view/top_layer_count", "view/only_show_top_layers", "view/force_layer_view_compatibility_mode"}:
return
def _updateWithPreferences(self):
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._compatibility_mode = OpenGLContext.isLegacyOpenGL() or bool(
Preferences.getInstance().getValue("view/force_layer_view_compatibility_mode"))
self.setLayerViewType(int(float(Preferences.getInstance().getValue("layerview/layer_view_type"))));
self.setExtruderOpacity(0, float(Preferences.getInstance().getValue("layerview/extruder0_opacity")))
self.setExtruderOpacity(1, float(Preferences.getInstance().getValue("layerview/extruder1_opacity")))
self.setExtruderOpacity(2, float(Preferences.getInstance().getValue("layerview/extruder2_opacity")))
self.setExtruderOpacity(3, float(Preferences.getInstance().getValue("layerview/extruder3_opacity")))
self.setShowTravelMoves(bool(Preferences.getInstance().getValue("layerview/show_travel_moves")))
self.setShowHelpers(bool(Preferences.getInstance().getValue("layerview/show_helpers")))
self.setShowSkin(bool(Preferences.getInstance().getValue("layerview/show_skin")))
self.setShowInfill(bool(Preferences.getInstance().getValue("layerview/show_infill")))
self._startUpdateTopLayers()
self.preferencesChanged.emit()
def _onPreferencesChanged(self, preference):
if preference not in {
"view/top_layer_count",
"view/only_show_top_layers",
"view/force_layer_view_compatibility_mode",
"layerview/layer_view_type",
"layerview/extruder0_opacity",
"layerview/extruder1_opacity",
"layerview/extruder2_opacity",
"layerview/extruder3_opacity",
"layerview/show_travel_moves",
"layerview/show_helpers",
"layerview/show_skin",
"layerview/show_infill",
}:
return
self._updateWithPreferences()
def _getLegendItems(self):
if self._legend_items is None:
theme = Application.getInstance().getTheme()

View file

@ -75,7 +75,7 @@ Item
border.color: UM.Theme.getColor("slider_groove_border")
color: UM.Theme.getColor("tool_panel_background")
visible: UM.LayerView.getLayerActivity && Printer.getPlatformActivity ? true : false
visible: UM.LayerView.layerActivity && Printer.platformActivity ? true : false
TextField
{
@ -161,11 +161,11 @@ Item
{
id: layerViewTypes
ListElement {
text: "Material color"
text: "Material Color"
type_id: 0
}
ListElement {
text: "Line type"
text: "Line Type"
type_id: 1 // these ids match the switching in the shader
}
}
@ -177,19 +177,27 @@ Item
anchors.left: parent.left
model: layerViewTypes
visible: !UM.LayerView.compatibilityMode
property int layer_view_type: UM.Preferences.getValue("layerview/layer_view_type")
currentIndex: layer_view_type // index matches type_id
onActivated: {
// Combobox selection
var type_id = layerViewTypes.get(index).type_id;
UM.LayerView.setLayerViewType(type_id);
if (type_id == 1) {
UM.Preferences.setValue("layerview/layer_view_type", type_id);
updateLegend();
}
onModelChanged: {
updateLegend();
}
// Update visibility of legend.
function updateLegend() {
var type_id = layerViewTypes.get(currentIndex).type_id;
if (UM.LayerView.compatibilityMode || (type_id == 1)) {
// Line type
UM.LayerView.enableLegend();
} else {
UM.LayerView.disableLegend();
}
}
onModelChanged: {
currentIndex = UM.LayerView.getLayerViewType();
}
}
Label
@ -197,86 +205,106 @@ Item
id: compatibilityModeLabel
anchors.top: parent.top
anchors.left: parent.left
text: catalog.i18nc("@label","Compatibility mode")
text: catalog.i18nc("@label","Compatibility Mode")
visible: UM.LayerView.compatibilityMode
}
Connections {
target: UM.Preferences
onPreferenceChanged:
{
layerTypeCombobox.layer_view_type = UM.Preferences.getValue("layerview/layer_view_type");
view_settings.extruder0_checked = UM.Preferences.getValue("layerview/extruder0_opacity") > 0.5;
view_settings.extruder1_checked = UM.Preferences.getValue("layerview/extruder1_opacity") > 0.5;
view_settings.extruder2_checked = UM.Preferences.getValue("layerview/extruder2_opacity") > 0.5;
view_settings.extruder3_checked = UM.Preferences.getValue("layerview/extruder3_opacity") > 0.5;
view_settings.show_travel_moves = UM.Preferences.getValue("layerview/show_travel_moves");
view_settings.show_helpers = UM.Preferences.getValue("layerview/show_helpers");
view_settings.show_skin = UM.Preferences.getValue("layerview/show_skin");
view_settings.show_infill = UM.Preferences.getValue("layerview/show_infill");
}
}
ColumnLayout {
id: view_settings
property bool extruder0_checked: UM.Preferences.getValue("layerview/extruder0_opacity") > 0.5
property bool extruder1_checked: UM.Preferences.getValue("layerview/extruder1_opacity") > 0.5
property bool extruder2_checked: UM.Preferences.getValue("layerview/extruder2_opacity") > 0.5
property bool extruder3_checked: UM.Preferences.getValue("layerview/extruder3_opacity") > 0.5
property bool show_travel_moves: UM.Preferences.getValue("layerview/show_travel_moves")
property bool show_helpers: UM.Preferences.getValue("layerview/show_helpers")
property bool show_skin: UM.Preferences.getValue("layerview/show_skin")
property bool show_infill: UM.Preferences.getValue("layerview/show_infill")
anchors.top: UM.LayerView.compatibilityMode ? compatibilityModeLabel.bottom : layerTypeCombobox.bottom
anchors.topMargin: UM.Theme.getSize("default_margin").height
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width
CheckBox {
checked: true
checked: view_settings.extruder0_checked
onClicked: {
UM.LayerView.setExtruderOpacity(0, checked ? 1.0 : 0.0);
UM.Preferences.setValue("layerview/extruder0_opacity", checked ? 1.0 : 0.0);
}
text: "Extruder 1"
visible: !UM.LayerView.compatibilityMode && (UM.LayerView.getExtruderCount >= 1)
visible: !UM.LayerView.compatibilityMode && (UM.LayerView.extruderCount >= 1)
}
CheckBox {
checked: true
checked: view_settings.extruder1_checked
onClicked: {
UM.LayerView.setExtruderOpacity(1, checked ? 1.0 : 0.0);
UM.Preferences.setValue("layerview/extruder1_opacity", checked ? 1.0 : 0.0);
}
text: "Extruder 2"
visible: !UM.LayerView.compatibilityMode && (UM.LayerView.getExtruderCount >= 2)
visible: !UM.LayerView.compatibilityMode && (UM.LayerView.extruderCount >= 2)
}
CheckBox {
checked: true
checked: view_settings.extruder2_checked
onClicked: {
UM.LayerView.setExtruderOpacity(2, checked ? 1.0 : 0.0);
UM.Preferences.setValue("layerview/extruder2_opacity", checked ? 1.0 : 0.0);
}
text: "Extruder 3"
visible: !UM.LayerView.compatibilityMode && (UM.LayerView.getExtruderCount >= 3)
visible: !UM.LayerView.compatibilityMode && (UM.LayerView.etruderCount >= 3)
}
CheckBox {
checked: true
checked: view_settings.extruder3_checked
onClicked: {
UM.LayerView.setExtruderOpacity(3, checked ? 1.0 : 0.0);
UM.Preferences.setValue("layerview/extruder3_opacity", checked ? 1.0 : 0.0);
}
text: "Extruder 4"
visible: !UM.LayerView.compatibilityMode && (UM.LayerView.getExtruderCount >= 4)
visible: !UM.LayerView.compatibilityMode && (UM.LayerView.extruderCount >= 4)
}
Label {
text: "Other extruders always visible"
visible: !UM.LayerView.compatibilityMode && (UM.LayerView.getExtruderCount >= 5)
visible: !UM.LayerView.compatibilityMode && (UM.LayerView.extruderCount >= 5)
}
CheckBox {
checked: view_settings.show_travel_moves
onClicked: {
UM.LayerView.setShowTravelMoves(checked ? 1 : 0);
UM.Preferences.setValue("layerview/show_travel_moves", checked);
}
text: "Show travel moves"
text: catalog.i18nc("@label", "Show Travel Moves")
}
CheckBox {
checked: true
checked: view_settings.show_helpers
onClicked: {
UM.LayerView.setShowSupport(checked ? 1 : 0);
UM.Preferences.setValue("layerview/show_helpers", checked);
}
text: "Show support"
text: catalog.i18nc("@label", "Show Helpers")
}
CheckBox {
checked: true
checked: view_settings.show_skin
onClicked: {
UM.LayerView.setShowAdhesion(checked ? 1 : 0);
UM.Preferences.setValue("layerview/show_skin", checked);
}
text: "Show adhesion"
text: catalog.i18nc("@label", "Show Shell")
}
CheckBox {
checked: true
checked: view_settings.show_infill
onClicked: {
UM.LayerView.setShowSkin(checked ? 1 : 0);
UM.Preferences.setValue("layerview/show_infill", checked);
}
text: "Show skin"
}
CheckBox {
checked: true
onClicked: {
UM.LayerView.setShowInfill(checked ? 1 : 0);
}
text: "Show infill"
text: catalog.i18nc("@label", "Show Infill")
}
}
}

View file

@ -20,7 +20,7 @@ class LayerViewProxy(QObject):
preferencesChanged = pyqtSignal()
@pyqtProperty(bool, notify = activityChanged)
def getLayerActivity(self):
def layerActivity(self):
active_view = self._controller.getActiveView()
if type(active_view) == LayerView.LayerView.LayerView:
return active_view.getActivity()
@ -79,7 +79,7 @@ class LayerViewProxy(QObject):
if type(active_view) == LayerView.LayerView.LayerView:
active_view.setLayerViewType(layer_view_type)
@pyqtProperty(bool)
@pyqtSlot(result = int)
def getLayerViewType(self):
active_view = self._controller.getActiveView()
if type(active_view) == LayerView.LayerView.LayerView:
@ -100,16 +100,10 @@ class LayerViewProxy(QObject):
active_view.setShowTravelMoves(show)
@pyqtSlot(int)
def setShowSupport(self, show):
def setShowHelpers(self, show):
active_view = self._controller.getActiveView()
if type(active_view) == LayerView.LayerView.LayerView:
active_view.setShowSupport(show)
@pyqtSlot(int)
def setShowAdhesion(self, show):
active_view = self._controller.getActiveView()
if type(active_view) == LayerView.LayerView.LayerView:
active_view.setShowAdhesion(show)
active_view.setShowHelpers(show)
@pyqtSlot(int)
def setShowSkin(self, show):
@ -124,7 +118,7 @@ class LayerViewProxy(QObject):
active_view.setShowInfill(show)
@pyqtProperty(int, notify = globalStackChanged)
def getExtruderCount(self):
def extruderCount(self):
active_view = self._controller.getActiveView()
if type(active_view) == LayerView.LayerView.LayerView:
return active_view.getExtruderCount()

View file

@ -32,8 +32,7 @@ fragment =
varying float v_line_type;
uniform int u_show_travel_moves;
uniform int u_show_support;
uniform int u_show_adhesion;
uniform int u_show_helpers;
uniform int u_show_skin;
uniform int u_show_infill;
@ -43,11 +42,12 @@ fragment =
// discard movements
discard;
}
// support: 4, 7, 10
if ((u_show_support == 0) && (
// support: 4, 5, 7, 10
if ((u_show_helpers == 0) && (
((v_line_type >= 3.5) && (v_line_type <= 4.5)) ||
((v_line_type >= 6.5) && (v_line_type <= 7.5)) ||
((v_line_type >= 9.5) && (v_line_type <= 10.5))
((v_line_type >= 9.5) && (v_line_type <= 10.5)) ||
((v_line_type >= 4.5) && (v_line_type <= 5.5))
)) {
discard;
}
@ -57,11 +57,6 @@ fragment =
)) {
discard;
}
// adhesion:
if ((u_show_adhesion == 0) && (v_line_type >= 4.5) && (v_line_type <= 5.5)) {
// discard movements
discard;
}
// infill:
if ((u_show_infill == 0) && (v_line_type >= 5.5) && (v_line_type <= 6.5)) {
// discard movements
@ -105,8 +100,7 @@ fragment41core =
out vec4 frag_color;
uniform int u_show_travel_moves;
uniform int u_show_support;
uniform int u_show_adhesion;
uniform int u_show_helpers;
uniform int u_show_skin;
uniform int u_show_infill;
@ -116,11 +110,12 @@ fragment41core =
// discard movements
discard;
}
// support: 4, 7, 10
if ((u_show_support == 0) && (
// helpers: 4, 5, 7, 10
if ((u_show_helpers == 0) && (
((v_line_type >= 3.5) && (v_line_type <= 4.5)) ||
((v_line_type >= 6.5) && (v_line_type <= 7.5)) ||
((v_line_type >= 9.5) && (v_line_type <= 10.5))
((v_line_type >= 9.5) && (v_line_type <= 10.5)) ||
((v_line_type >= 4.5) && (v_line_type <= 5.5))
)) {
discard;
}
@ -130,11 +125,6 @@ fragment41core =
)) {
discard;
}
// adhesion:
if ((u_show_adhesion == 0) && (v_line_type >= 4.5) && (v_line_type <= 5.5)) {
// discard movements
discard;
}
// infill:
if ((u_show_infill == 0) && (v_line_type >= 5.5) && (v_line_type <= 6.5)) {
// discard movements
@ -151,8 +141,7 @@ u_layer_view_type = 0
u_extruder_opacity = [1.0, 1.0, 1.0, 1.0]
u_show_travel_moves = 0
u_show_support = 1
u_show_adhesion = 1
u_show_helpers = 1
u_show_skin = 1
u_show_infill = 1

View file

@ -68,8 +68,7 @@ geometry41core =
uniform highp mat4 u_viewProjectionMatrix;
uniform int u_show_travel_moves;
uniform int u_show_support;
uniform int u_show_adhesion;
uniform int u_show_helpers;
uniform int u_show_skin;
uniform int u_show_infill;
@ -117,10 +116,7 @@ geometry41core =
if ((u_show_travel_moves == 0) && ((v_line_type[0] == 8) || (v_line_type[0] == 9))) {
return;
}
if ((u_show_support == 0) && ((v_line_type[0] == 4) || (v_line_type[0] == 7) || (v_line_type[0] == 10))) {
return;
}
if ((u_show_adhesion == 0) && (v_line_type[0] == 5)) {
if ((u_show_helpers == 0) && ((v_line_type[0] == 4) || (v_line_type[0] == 5) || (v_line_type[0] == 7) || (v_line_type[0] == 10))) {
return;
}
if ((u_show_skin == 0) && ((v_line_type[0] == 1) || (v_line_type[0] == 2) || (v_line_type[0] == 3))) {
@ -132,12 +128,11 @@ geometry41core =
if ((v_line_type[0] == 8) || (v_line_type[0] == 9)) {
// fixed size for movements
size_x = 0.1;
size_y = 0.1;
size_x = 0.2;
} else {
size_x = v_line_dim[0].x / 2 + 0.01; // radius, and make it nicely overlapping
size_y = v_line_dim[0].y / 2 + 0.01;
}
size_y = v_line_dim[0].y / 2 + 0.01;
g_vertex_delta = gl_in[1].gl_Position - gl_in[0].gl_Position;
g_vertex_normal_horz_head = normalize(vec3(-g_vertex_delta.x, -g_vertex_delta.y, -g_vertex_delta.z));
@ -149,48 +144,62 @@ geometry41core =
g_vertex_normal_vert = vec3(0.0, 1.0, 0.0);
g_vertex_offset_vert = vec4(g_vertex_normal_vert * size_y, 0.0);
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz));
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz));
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_vert));
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_vert));
myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz));
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz));
myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_vert));
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_vert));
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz));
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz));
if ((v_line_type[0] == 8) || (v_line_type[0] == 9)) {
// Travels: flat plane with pointy ends
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert));
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz_head + g_vertex_offset_vert));
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz + g_vertex_offset_vert));
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert));
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz + g_vertex_offset_vert));
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz + g_vertex_offset_vert));
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz_head + g_vertex_offset_vert));
EndPrimitive();
EndPrimitive();
} else {
// All normal lines are rendered as 3d tubes.
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz));
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz));
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_vert));
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_vert));
myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz));
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz));
myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_vert));
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_vert));
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz));
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz));
// left side
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz));
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_vert));
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz_head, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz_head));
myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz));
EndPrimitive();
EndPrimitive();
// left side
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz));
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_vert));
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz_head, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz_head));
myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz));
myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz));
myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_vert));
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz_head, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz_head));
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz));
EndPrimitive();
EndPrimitive();
myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_horz));
myEmitVertex(v_vertex[0], v_color[0], -g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[0].gl_Position - g_vertex_offset_vert));
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz_head, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz_head));
myEmitVertex(v_vertex[0], v_color[0], g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[0].gl_Position + g_vertex_offset_horz));
// right side
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz));
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_vert));
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz_head, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz_head));
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz));
EndPrimitive();
EndPrimitive();
// right side
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz));
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_vert));
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz_head, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz_head));
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz));
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz));
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_vert));
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz_head, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz_head));
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz));
EndPrimitive();
EndPrimitive();
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz));
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_vert, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_vert));
myEmitVertex(v_vertex[1], v_color[1], -g_vertex_normal_horz_head, u_viewProjectionMatrix * (gl_in[1].gl_Position - g_vertex_offset_horz_head));
myEmitVertex(v_vertex[1], v_color[1], g_vertex_normal_horz, u_viewProjectionMatrix * (gl_in[1].gl_Position + g_vertex_offset_horz));
EndPrimitive();
}
}
fragment41core =
@ -234,8 +243,7 @@ u_diffuseColor = [1.0, 0.79, 0.14, 1.0]
u_shininess = 20.0
u_show_travel_moves = 0
u_show_support = 1
u_show_adhesion = 1
u_show_helpers = 1
u_show_skin = 1
u_show_infill = 1

View file

@ -259,16 +259,23 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
data = """{"temperature": "%i", "timeout": "%i"}""" % (temperature, duration)
else:
data = """{"temperature": "%i"}""" % temperature
Logger.log("i", "Pre-heating bed to %i degrees.", temperature)
put_request = QNetworkRequest(url)
put_request.setHeader(QNetworkRequest.ContentTypeHeader, "application/json")
self._manager.put(put_request, data.encode())
self._preheat_bed_timer.start(self._preheat_bed_timeout * 1000) #Times 1000 because it needs to be provided as milliseconds.
self.preheatBedRemainingTimeChanged.emit()
## Cancels pre-heating the heated bed of the printer.
#
# If the bed is not pre-heated, nothing happens.
@pyqtSlot()
def cancelPreheatBed(self):
Logger.log("i", "Cancelling pre-heating of the bed.")
self.preheatBed(temperature = 0, duration = 0)
self._preheat_bed_timer.stop()
self._preheat_bed_timer.setInterval(0)
self.preheatBedRemainingTimeChanged.emit()
## Changes the target bed temperature on the printer.
#
@ -616,7 +623,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
warnings.append(i18n_catalog.i18nc("@label", "Not enough material for spool {0}.").format(index+1))
# Check if the right cartridges are loaded. Any failure in these results in a warning.
extruder_manager = cura.Settings.ExtruderManager.getInstance()
extruder_manager = cura.Settings.ExtruderManager.ExtruderManager.getInstance()
if print_information.materialLengths[index] != 0:
variant = extruder_manager.getExtruderStack(index).findContainer({"type": "variant"})
core_name = self._json_printer_state["heads"][0]["extruders"][index]["hotend"]["id"]
@ -811,7 +818,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
## Check if the authentication request was allowed by the printer.
def _checkAuthentication(self):
Logger.log("d", "Checking if authentication is correct for id %", self._authentication_id)
Logger.log("d", "Checking if authentication is correct for id %s", self._authentication_id)
self._manager.get(QNetworkRequest(QUrl("http://" + self._address + self._api_prefix + "auth/check/" + str(self._authentication_id))))
## Request a authentication key from the printer so we can be authenticated

View file

@ -650,11 +650,15 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
# ignored because there is no g-code to set this.
@pyqtSlot(float, float)
def preheatBed(self, temperature, duration):
Logger.log("i", "Pre-heating the bed to %i degrees.", temperature)
self._setTargetBedTemperature(temperature)
self.preheatBedRemainingTimeChanged.emit()
## Cancels pre-heating the heated bed of the printer.
#
# If the bed is not pre-heated, nothing happens.
@pyqtSlot()
def cancelPreheatBed(self):
self._setTargetBedTemperature(0)
Logger.log("i", "Cancelling pre-heating of the bed.")
self._setTargetBedTemperature(0)
self.preheatBedRemainingTimeChanged.emit()