Browse Source

Merge branch '5.7' into CURA-11526-upgrade-script

Casper Lamboo 1 year ago
parent
commit
1c6a018c8b

+ 2 - 1
cura/OAuth2/AuthorizationService.py

@@ -305,7 +305,8 @@ class AuthorizationService:
                                                                        message_type = Message.MessageType.ERROR)
                             Logger.warning("Unable to get user profile using auth data from preferences.")
                             self._unable_to_get_data_message.show()
-                self.getUserProfile(callback)
+                if self._get_user_profile:
+                    self.getUserProfile(callback)
         except (ValueError, TypeError):
             Logger.logException("w", "Could not load auth data from preferences")
 

+ 0 - 4
plugins/3MFReader/ThreeMFWorkspaceReader.py

@@ -915,10 +915,6 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
 
                 # Prepare the machine
                 self._applyChangesToMachine(global_stack, extruder_stack_dict)
-            else:
-                # Just clear the settings now, so that we can change the active machine without conflicts
-                self._clearMachineSettings(global_stack, {})
-
 
             Logger.log("d", "Workspace loading is notifying rest of the code of changes...")
             # Actually change the active machine.

+ 41 - 40
plugins/3MFReader/WorkspaceDialog.qml

@@ -156,46 +156,6 @@ UM.Dialog
                     }
                 }
 
-                WorkspaceSection
-                {
-                    id: profileSection
-                    title: manager.isUcp? catalog.i18nc("@action:label", "Suggested Profile settings"):catalog.i18nc("@action:label", "Profile settings")
-                    iconSource: UM.Theme.getIcon("Sliders")
-                    content: Column
-                    {
-                        id: profileSettingsValuesTable
-                        spacing: UM.Theme.getSize("default_margin").height
-                        leftPadding: UM.Theme.getSize("medium_button_icon").width + UM.Theme.getSize("default_margin").width
-
-                        WorkspaceRow
-                        {
-                            leftLabelText: catalog.i18nc("@action:label", "Name")
-                            rightLabelText: manager.qualityName
-                            visible: manager.isCompatibleMachine
-                        }
-
-                        WorkspaceRow
-                        {
-                            leftLabelText: catalog.i18nc("@action:label", "Intent")
-                            rightLabelText: manager.intentName
-                            visible: manager.isCompatibleMachine
-                        }
-
-                        WorkspaceRow
-                        {
-                            leftLabelText: catalog.i18nc("@action:label", "Not in profile")
-                            rightLabelText: catalog.i18ncp("@action:label", "%1 override", "%1 overrides", manager.numUserSettings).arg(manager.numUserSettings)
-                            visible: manager.numUserSettings != 0 && manager.isCompatibleMachine
-                        }
-
-                        WorkspaceRow
-                        {
-                            leftLabelText: catalog.i18nc("@action:label", "Derivative from")
-                            rightLabelText: catalog.i18ncp("@action:label", "%1, %2 override", "%1, %2 overrides", manager.numSettingsOverridenByQualityChanges).arg(manager.qualityType).arg(manager.numSettingsOverridenByQualityChanges)
-                            visible: manager.numSettingsOverridenByQualityChanges != 0 && manager.isCompatibleMachine
-                        }
-                    }
-                }
                 WorkspaceSection
                 {
                     id: ucpProfileSection
@@ -279,6 +239,47 @@ UM.Dialog
                     }
                 }
 
+                WorkspaceSection
+                {
+                    id: profileSection
+                    title: manager.isUcp? catalog.i18nc("@action:label", "Suggested Profile settings"):catalog.i18nc("@action:label", "Profile settings")
+                    iconSource: UM.Theme.getIcon("Sliders")
+                    content: Column
+                    {
+                        id: profileSettingsValuesTable
+                        spacing: UM.Theme.getSize("default_margin").height
+                        leftPadding: UM.Theme.getSize("medium_button_icon").width + UM.Theme.getSize("default_margin").width
+
+                        WorkspaceRow
+                        {
+                            leftLabelText: catalog.i18nc("@action:label", "Name")
+                            rightLabelText: manager.qualityName
+                            visible: manager.isCompatibleMachine
+                        }
+
+                        WorkspaceRow
+                        {
+                            leftLabelText: catalog.i18nc("@action:label", "Intent")
+                            rightLabelText: manager.intentName
+                            visible: manager.isCompatibleMachine
+                        }
+
+                        WorkspaceRow
+                        {
+                            leftLabelText: catalog.i18nc("@action:label", "Not in profile")
+                            rightLabelText: catalog.i18ncp("@action:label", "%1 override", "%1 overrides", manager.numUserSettings).arg(manager.numUserSettings)
+                            visible: manager.numUserSettings != 0 && !manager.isUcp
+                        }
+
+                        WorkspaceRow
+                        {
+                            leftLabelText: catalog.i18nc("@action:label", "Derivative from")
+                            rightLabelText: catalog.i18ncp("@action:label", "%1, %2 override", "%1, %2 overrides", manager.numSettingsOverridenByQualityChanges).arg(manager.qualityType).arg(manager.numSettingsOverridenByQualityChanges)
+                            visible: manager.numSettingsOverridenByQualityChanges != 0 && manager.isCompatibleMachine
+                        }
+                    }
+                }
+
                 WorkspaceSection
                 {
                     id: materialSection

+ 2 - 2
plugins/3MFWriter/UCPDialog.py

@@ -75,9 +75,9 @@ class UCPDialog(QObject):
             device.requestWrite(
                 nodes,
                 file_name,
-                ["application/vnd.ms-package.3dmanufacturing-3dmodel+xml"],
+                ["application/x-ucp"],
                 workspace_handler,
-                preferred_mimetype_list="application/vnd.ms-package.3dmanufacturing-3dmodel+xml"
+                preferred_mimetype_list="application/x-ucp"
             )
         except OutputDeviceError.UserCanceledError:
             self._onRejected()

+ 8 - 2
plugins/3MFWriter/__init__.py

@@ -32,16 +32,22 @@ def getMetaData():
                     "description": i18n_catalog.i18nc("@item:inlistbox", "3MF file"),
                     "mime_type": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml",
                     "mode": ThreeMFWriter.ThreeMFWriter.OutputMode.BinaryMode
-                }
+                },
             ]
         }
         metaData["workspace_writer"] = {
             "output": [
                 {
                     "extension": workspace_extension,
-                    "description": i18n_catalog.i18nc("@item:inlistbox", "Universal Cura Project (UCP) file"),
+                    "description": i18n_catalog.i18nc("@item:inlistbox", "Cura Project 3MF file"),
                     "mime_type": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml",
                     "mode": ThreeMFWorkspaceWriter.ThreeMFWorkspaceWriter.OutputMode.BinaryMode
+                },
+                {
+                    "extension": "3mf",
+                    "description": i18n_catalog.i18nc("@item:inlistbox", "Universal Cura Project"),
+                    "mime_type": "application/x-ucp",
+                    "mode": ThreeMFWorkspaceWriter.ThreeMFWorkspaceWriter.OutputMode.BinaryMode
                 }
             ]
         }

+ 2 - 0
plugins/PostProcessingPlugin/PostProcessingPlugin.qml

@@ -120,6 +120,8 @@ UM.Dialog
                         UM.Label
                         {
                             Layout.fillWidth: true
+                            Layout.preferredHeight: height
+                            elide: Text.ElideRight
                             text: manager.getScriptLabelByKey(modelData.toString())
                         }
 

+ 25 - 0
plugins/SimulationView/SimulationPass.py

@@ -121,6 +121,7 @@ class SimulationPass(RenderPass):
         disabled_batch = RenderBatch(self._disabled_shader)
         head_position = None  # Indicates the current position of the print head
         nozzle_node = None
+        not_a_vector = Vector(math.nan, math.nan, math.nan)
 
         for node in DepthFirstIterator(self._scene.getRoot()):
 
@@ -143,6 +144,10 @@ class SimulationPass(RenderPass):
                 if self._layer_view.getCurrentLayer() > -1 and ((not self._layer_view._only_show_top_layers) or (not self._layer_view.getCompatibilityMode())):
                     start = 0
                     end = 0
+                    vertex_before_head = not_a_vector
+                    vertex_after_head = not_a_vector
+                    vertex_distance_ratio = 0.0
+                    towards_next_vertex = 0
                     element_counts = layer_data.getElementCounts()
                     for layer in sorted(element_counts.keys()):
                         # In the current layer, we show just the indicated paths
@@ -159,6 +164,8 @@ class SimulationPass(RenderPass):
                                 ratio = self._layer_view.getCurrentPath() - math.floor(self._layer_view.getCurrentPath())
                                 pos_a = Vector(polygon.data[index][0], polygon.data[index][1],
                                                polygon.data[index][2])
+                                vertex_before_head = pos_a
+                                vertex_distance_ratio = ratio
                                 if ratio <= 0.0001 or index + 1 == len(polygon.data):
                                     # in case there multiple polygons and polygon changes, the first point has the same value as the last point in the previous polygon
                                     head_position = pos_a + node.getWorldPosition()
@@ -168,6 +175,8 @@ class SimulationPass(RenderPass):
                                                    polygon.data[index + 1][2])
                                     vec = pos_a * (1.0 - ratio) + pos_b * ratio
                                     head_position = vec + node.getWorldPosition()
+                                    vertex_after_head = pos_b
+                                    towards_next_vertex = 2  # Add two to the index to print the current and next vertices as an 'unfinished' line (to the nozzle).
                                 break
                             break
                         if self._layer_view.getMinimumLayer() > layer:
@@ -187,6 +196,11 @@ class SimulationPass(RenderPass):
                         self._current_shader = self._layer_shader
                         self._switching_layers = True
 
+                    # reset 'last vertex'
+                    self._layer_shader.setUniformValue("u_last_vertex", not_a_vector)
+                    self._layer_shader.setUniformValue("u_next_vertex", not_a_vector)
+                    self._layer_shader.setUniformValue("u_last_line_ratio", 1.0)
+
                     # The first line does not have a previous line: add a MoveCombingType in front for start detection
                     # this way the first start of the layer can also be drawn
                     prev_line_types = numpy.concatenate([numpy.asarray([LayerPolygon.MoveCombingType], dtype = numpy.float32), layer_data._attributes["line_types"]["value"]])
@@ -203,6 +217,17 @@ class SimulationPass(RenderPass):
                     current_layer_batch.addItem(node.getWorldTransformation(), layer_data)
                     current_layer_batch.render(self._scene.getActiveCamera())
 
+                    # Last line may be partial
+                    if vertex_after_head != not_a_vector and vertex_after_head != not_a_vector:
+                        self._layer_shader.setUniformValue("u_last_vertex", vertex_before_head)
+                        self._layer_shader.setUniformValue("u_next_vertex", vertex_after_head)
+                        self._layer_shader.setUniformValue("u_last_line_ratio", vertex_distance_ratio)
+                        last_line_start = current_layer_end
+                        last_line_end = current_layer_end + towards_next_vertex
+                        last_line_batch = RenderBatch(self._layer_shader, type = RenderBatch.RenderType.Solid, mode=RenderBatch.RenderMode.Lines, range = (last_line_start, last_line_end))
+                        last_line_batch.addItem(node.getWorldTransformation(), layer_data)
+                        last_line_batch.render(self._scene.getActiveCamera())
+
                     self._old_current_layer = self._layer_view.getCurrentLayer()
                     self._old_current_path = self._layer_view.getCurrentPath()
 

+ 12 - 0
plugins/SimulationView/layers3d.shader

@@ -19,6 +19,10 @@ vertex41core =
 
     uniform highp mat4 u_normalMatrix;
 
+    uniform vec3 u_last_vertex;
+    uniform vec3 u_next_vertex;
+    uniform float u_last_line_ratio;
+
     in highp vec4 a_vertex;
     in lowp vec4 a_color;
     in lowp vec4 a_material_color;
@@ -134,6 +138,10 @@ vertex41core =
     void main()
     {
         vec4 v1_vertex = a_vertex;
+        if (v1_vertex.xyz == u_next_vertex)
+        {
+            v1_vertex.xyz = mix(u_last_vertex, u_next_vertex, u_last_line_ratio);
+        }
         v1_vertex.y -= a_line_dim.y / 2;  // half layer down
 
         vec4 world_space_vert = u_modelMatrix * v1_vertex;
@@ -427,6 +435,10 @@ u_max_feedrate = 1
 u_min_thickness = 0
 u_max_thickness = 1
 
+u_last_vertex = [0.0, 0.0, 0.0]
+u_next_vertex = [0.0, 0.0, 0.0]
+u_last_line_ratio = 1.0
+
 [bindings]
 u_modelMatrix = model_matrix
 u_viewMatrix = view_matrix

+ 5 - 1
resources/i18n/cs_CZ/cura.po

@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Cura 5.1\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2024-03-11 12:52+0100\n"
+"POT-Creation-Date: 2024-03-13 09:02+0100\n"
 "PO-Revision-Date: 2023-09-03 18:15+0200\n"
 "Last-Translator: Miroslav Šustek <sustmidown@centrum.cz>\n"
 "Language-Team: DenyCZ <www.github.com/DenyCZ>\n"
@@ -5112,6 +5112,10 @@ msgctxt "@title:column Unit of measurement"
 msgid "Unit"
 msgstr "Jednotka"
 
+msgctxt "@item:inlistbox"
+msgid "Universal Cura Project"
+msgstr ""
+
 msgctxt "@action:description Don't translate 'Universal Cura Project'"
 msgid "Universal Cura Project files can be printed on different 3D printers while retaining positional data and selected settings. When exported, all models present on the build plate will be included along with their current position, orientation, and scale. You can also select which per-extruder or per-model settings should be included to ensure proper printing."
 msgstr ""

+ 54 - 0
resources/i18n/cs_CZ/gradual_flow_settings.def.json.po

@@ -0,0 +1,54 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Uranium json setting files\n"
+"Report-Msgid-Bugs-To: plugins@ultimaker.com\n"
+"POT-Creation-Date: 2024-03-11 11:28+0000\n"
+"PO-Revision-Date: 2024-03-11 11:28+0000\n"
+"Last-Translator: Automatically generated\n"
+"Language-Team: none\n"
+"Language: en\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+msgctxt "gradual_flow_discretisation_step_size description"
+msgid "Duration of each step in the gradual flow change"
+msgstr "Duration of each step in the gradual flow change"
+
+msgctxt "gradual_flow_enabled description"
+msgid "Enable gradual flow changes. When enabled, the flow is gradually increased/decreased to the target flow. This is useful for printers with a bowden tube where the flow is not immediately changed when the extruder motor starts/stops."
+msgstr "Enable gradual flow changes. When enabled, the flow is gradually increased/decreased to the target flow. This is useful for printers with a bowden tube where the flow is not immediately changed when the extruder motor starts/stops."
+
+msgctxt "reset_flow_duration description"
+msgid "For any travel move longer than this value, the material flow is reset to the paths target flow"
+msgstr "For any travel move longer than this value, the material flow is reset to the paths target flow"
+
+msgctxt "gradual_flow_discretisation_step_size label"
+msgid "Gradual flow discretisation step size"
+msgstr "Gradual flow discretisation step size"
+
+msgctxt "gradual_flow_enabled label"
+msgid "Gradual flow enabled"
+msgstr "Gradual flow enabled"
+
+msgctxt "max_flow_acceleration label"
+msgid "Gradual flow max acceleration"
+msgstr "Gradual flow max acceleration"
+
+msgctxt "layer_0_max_flow_acceleration label"
+msgid "Initial layer max flow acceleration"
+msgstr "Initial layer max flow acceleration"
+
+msgctxt "max_flow_acceleration description"
+msgid "Maximum acceleration for gradual flow changes"
+msgstr "Maximum acceleration for gradual flow changes"
+
+msgctxt "layer_0_max_flow_acceleration description"
+msgid "Minimum speed for gradual flow changes for the first layer"
+msgstr "Minimum speed for gradual flow changes for the first layer"
+
+msgctxt "reset_flow_duration label"
+msgid "Reset flow duration"
+msgstr "Reset flow duration"

Some files were not shown because too many files changed in this diff