mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 22:54:01 -06:00
Changing settings in extruder stack now also triggers reslice
CURA-1689
This commit is contained in:
parent
02d2acd317
commit
9672b3360c
2 changed files with 24 additions and 0 deletions
|
@ -66,6 +66,12 @@ class ExtruderManager(QObject):
|
||||||
self._active_extruder_index = index
|
self._active_extruder_index = index
|
||||||
self.activeExtruderChanged.emit()
|
self.activeExtruderChanged.emit()
|
||||||
|
|
||||||
|
def getActiveExtruderStack(self):
|
||||||
|
try:
|
||||||
|
return self._extruder_trains[UM.Application.getInstance().getGlobalContainerStack().getBottom().getId()][str(self._active_extruder_index)]
|
||||||
|
except AttributeError:
|
||||||
|
return None
|
||||||
|
|
||||||
## Adds all extruders of a specific machine definition to the extruder
|
## Adds all extruders of a specific machine definition to the extruder
|
||||||
# manager.
|
# manager.
|
||||||
#
|
#
|
||||||
|
|
|
@ -12,6 +12,8 @@ from UM.PluginRegistry import PluginRegistry
|
||||||
from UM.Resources import Resources
|
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 cura.ExtruderManager import ExtruderManager
|
||||||
|
|
||||||
from cura.OneAtATimeIterator import OneAtATimeIterator
|
from cura.OneAtATimeIterator import OneAtATimeIterator
|
||||||
from . import ProcessSlicedLayersJob
|
from . import ProcessSlicedLayersJob
|
||||||
from . import ProcessGCodeJob
|
from . import ProcessGCodeJob
|
||||||
|
@ -59,6 +61,10 @@ class CuraEngineBackend(Backend):
|
||||||
Application.getInstance().globalContainerStackChanged.connect(self._onGlobalStackChanged)
|
Application.getInstance().globalContainerStackChanged.connect(self._onGlobalStackChanged)
|
||||||
self._onGlobalStackChanged()
|
self._onGlobalStackChanged()
|
||||||
|
|
||||||
|
self._active_extruder_stack = None
|
||||||
|
ExtruderManager.getInstance().activeExtruderChanged.connect(self._onActiveExtruderChanged)
|
||||||
|
self._onActiveExtruderChanged()
|
||||||
|
|
||||||
#When you update a setting and other settings get changed through inheritance, many propertyChanged signals are fired.
|
#When you update a setting and other settings get changed through inheritance, many propertyChanged signals are fired.
|
||||||
#This timer will group them up, and only slice for the last setting changed signal.
|
#This timer will group them up, and only slice for the last setting changed signal.
|
||||||
#TODO: Properly group propertyChanged signals by whether they are triggered by the same user interaction.
|
#TODO: Properly group propertyChanged signals by whether they are triggered by the same user interaction.
|
||||||
|
@ -367,4 +373,16 @@ class CuraEngineBackend(Backend):
|
||||||
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)
|
||||||
|
self._onActiveExtruderChanged()
|
||||||
self._onChanged()
|
self._onChanged()
|
||||||
|
|
||||||
|
def _onActiveExtruderChanged(self):
|
||||||
|
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 = ExtruderManager.getInstance().getActiveExtruderStack()
|
||||||
|
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._onChanged()
|
Loading…
Add table
Add a link
Reference in a new issue