mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Make convex hull decorator respond properly to property change events
Fixes CURA-1460
This commit is contained in:
parent
21e8dd151e
commit
4dffc414fb
1 changed files with 20 additions and 16 deletions
|
@ -27,7 +27,9 @@ class ConvexHullDecorator(SceneNodeDecorator):
|
||||||
# Keep track of the previous parent so we can clear its convex hull when the object is reparented
|
# Keep track of the previous parent so we can clear its convex hull when the object is reparented
|
||||||
self._parent_node = None
|
self._parent_node = None
|
||||||
|
|
||||||
self._profile = None
|
self._global_stack = None
|
||||||
|
Application.getInstance().globalContainerStackChanged.connect(self._onGlobalStackChanged)
|
||||||
|
self._onGlobalStackChanged()
|
||||||
#Application.getInstance().getMachineManager().activeProfileChanged.connect(self._onActiveProfileChanged)
|
#Application.getInstance().getMachineManager().activeProfileChanged.connect(self._onActiveProfileChanged)
|
||||||
#Application.getInstance().getMachineManager().activeMachineInstanceChanged.connect(self._onActiveMachineInstanceChanged)
|
#Application.getInstance().getMachineManager().activeMachineInstanceChanged.connect(self._onActiveMachineInstanceChanged)
|
||||||
#self._onActiveProfileChanged()
|
#self._onActiveProfileChanged()
|
||||||
|
@ -95,28 +97,30 @@ class ConvexHullDecorator(SceneNodeDecorator):
|
||||||
def setConvexHullNode(self, node):
|
def setConvexHullNode(self, node):
|
||||||
self._convex_hull_node = node
|
self._convex_hull_node = node
|
||||||
|
|
||||||
def _onActiveProfileChanged(self):
|
def _onSettingValueChanged(self, key, property_name):
|
||||||
if self._profile:
|
if key == "print_sequence" and property_name == "value":
|
||||||
self._profile.settingValueChanged.disconnect(self._onSettingValueChanged)
|
self._onChanged()
|
||||||
|
|
||||||
self._profile = Application.getInstance().getMachineManager().getWorkingProfile()
|
def _onChanged(self):
|
||||||
|
|
||||||
if self._profile:
|
|
||||||
self._profile.settingValueChanged.connect(self._onSettingValueChanged)
|
|
||||||
|
|
||||||
def _onActiveMachineInstanceChanged(self):
|
|
||||||
if self._convex_hull_job:
|
if self._convex_hull_job:
|
||||||
self._convex_hull_job.cancel()
|
self._convex_hull_job.cancel()
|
||||||
self.setConvexHull(None)
|
self.setConvexHull(None)
|
||||||
|
|
||||||
def _onSettingValueChanged(self, setting):
|
|
||||||
if setting == "print_sequence":
|
|
||||||
if self._convex_hull_job:
|
|
||||||
self._convex_hull_job.cancel()
|
|
||||||
self.setConvexHull(None)
|
|
||||||
|
|
||||||
def _onParentChanged(self, node):
|
def _onParentChanged(self, node):
|
||||||
# Force updating the convex hull of the parent group if the object is in a group
|
# Force updating the convex hull of the parent group if the object is in a group
|
||||||
if self._parent_node and self._parent_node.callDecoration("isGroup"):
|
if self._parent_node and self._parent_node.callDecoration("isGroup"):
|
||||||
self._parent_node.callDecoration("setConvexHull", None)
|
self._parent_node.callDecoration("setConvexHull", None)
|
||||||
self._parent_node = self.getNode().getParent()
|
self._parent_node = self.getNode().getParent()
|
||||||
|
|
||||||
|
def _onGlobalStackChanged(self):
|
||||||
|
if self._global_stack:
|
||||||
|
self._global_stack.propertyChanged.disconnect(self._onSettingValueChanged)
|
||||||
|
self._global_stack.containersChanged.disconnect(self._onChanged)
|
||||||
|
|
||||||
|
self._global_stack = Application.getInstance().getGlobalContainerStack()
|
||||||
|
|
||||||
|
if self._global_stack:
|
||||||
|
self._global_stack.propertyChanged.connect(self._onSettingValueChanged)
|
||||||
|
self._global_stack.containersChanged.connect(self._onChanged)
|
||||||
|
|
||||||
|
self._onChanged()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue