mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
D6: Fixed gcode loading to scene while undo/redo
This commit is contained in:
parent
fecf23d66d
commit
90f7cebbbb
4 changed files with 24 additions and 4 deletions
|
@ -598,6 +598,9 @@ class CuraApplication(QtApplication):
|
||||||
continue
|
continue
|
||||||
if node.callDecoration("shouldBlockSlicing"):
|
if node.callDecoration("shouldBlockSlicing"):
|
||||||
should_pause = True
|
should_pause = True
|
||||||
|
gcode_list = node.callDecoration("gCodeList")
|
||||||
|
if gcode_list is not None:
|
||||||
|
self.getController().getScene().gcode_list = gcode_list
|
||||||
|
|
||||||
count += 1
|
count += 1
|
||||||
if not scene_bounding_box:
|
if not scene_bounding_box:
|
||||||
|
|
13
cura/GCodeListDecorator.py
Normal file
13
cura/GCodeListDecorator.py
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
from UM.Scene.SceneNodeDecorator import SceneNodeDecorator
|
||||||
|
|
||||||
|
|
||||||
|
class GCodeListDecorator(SceneNodeDecorator):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self._gcode_list = []
|
||||||
|
|
||||||
|
def gCodeList(self):
|
||||||
|
return self._gcode_list
|
||||||
|
|
||||||
|
def setGCodeList(self, list):
|
||||||
|
self._gcode_list = list
|
|
@ -16,7 +16,7 @@ catalog = i18nCatalog("cura")
|
||||||
from cura import LayerDataBuilder
|
from cura import LayerDataBuilder
|
||||||
from cura import LayerDataDecorator
|
from cura import LayerDataDecorator
|
||||||
from cura.LayerPolygon import LayerPolygon
|
from cura.LayerPolygon import LayerPolygon
|
||||||
from cura.SliceableObjectDecorator import SliceableObjectDecorator
|
from cura.GCodeListDecorator import GCodeListDecorator
|
||||||
|
|
||||||
import numpy
|
import numpy
|
||||||
import math
|
import math
|
||||||
|
@ -203,6 +203,7 @@ class GCodeReader(MeshReader):
|
||||||
current_line = 0
|
current_line = 0
|
||||||
for line in file:
|
for line in file:
|
||||||
file_lines += 1
|
file_lines += 1
|
||||||
|
glist.append(line)
|
||||||
file.seek(0)
|
file.seek(0)
|
||||||
|
|
||||||
file_step = max(math.floor(file_lines / 100), 1)
|
file_step = max(math.floor(file_lines / 100), 1)
|
||||||
|
@ -260,7 +261,10 @@ class GCodeReader(MeshReader):
|
||||||
decorator = LayerDataDecorator.LayerDataDecorator()
|
decorator = LayerDataDecorator.LayerDataDecorator()
|
||||||
decorator.setLayerData(layer_mesh)
|
decorator.setLayerData(layer_mesh)
|
||||||
scene_node.addDecorator(decorator)
|
scene_node.addDecorator(decorator)
|
||||||
Application.getInstance().getController().getScene().gcode_list = glist
|
|
||||||
|
gcode_list_decorator = GCodeListDecorator()
|
||||||
|
gcode_list_decorator.setGCodeList(glist)
|
||||||
|
scene_node.addDecorator(gcode_list_decorator)
|
||||||
|
|
||||||
Logger.log("d", "Finished parsing %s" % file_name)
|
Logger.log("d", "Finished parsing %s" % file_name)
|
||||||
self._message.hide()
|
self._message.hide()
|
||||||
|
|
|
@ -106,7 +106,7 @@ Rectangle {
|
||||||
id: saveToButton
|
id: saveToButton
|
||||||
|
|
||||||
tooltip: UM.OutputDeviceManager.activeDeviceDescription;
|
tooltip: UM.OutputDeviceManager.activeDeviceDescription;
|
||||||
enabled: base.backendState == 3 && base.activity == true
|
enabled: (base.backendState == 3 || base.backendState == 5) && base.activity == true
|
||||||
height: UM.Theme.getSize("save_button_save_to_button").height
|
height: UM.Theme.getSize("save_button_save_to_button").height
|
||||||
|
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
@ -181,7 +181,7 @@ Rectangle {
|
||||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
width: UM.Theme.getSize("save_button_save_to_button").height
|
width: UM.Theme.getSize("save_button_save_to_button").height
|
||||||
height: UM.Theme.getSize("save_button_save_to_button").height
|
height: UM.Theme.getSize("save_button_save_to_button").height
|
||||||
enabled: base.backendState == 3 && base.activity == true
|
enabled: (base.backendState == 3 || base.backendState == 5) && base.activity == true
|
||||||
visible: devicesModel.deviceCount > 1
|
visible: devicesModel.deviceCount > 1
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue