Fix infill mesh defaults not visible when changing per object settings

The problem: When infill mesh is set, wall_thickness and
top_bottom_thickness are added to the settings. Then these settings are
set to visible on the visibility_handler.
It appears however, that the visibility_handler considers all added
settings to be visible. It thus concludes that no UI update is necessary
because the settings are already added.
This commit is contained in:
Nino van Hooff 2020-03-12 13:25:29 +01:00
parent d01286a340
commit ce12827879
2 changed files with 8 additions and 4 deletions

View file

@ -159,7 +159,7 @@ Item
} }
} }
Column // Settings Dialog Column // List of selected Settings to override for the selected object
{ {
// This is to ensure that the panel is first increasing in size up to 200 and then shows a scrollbar. // This is to ensure that the panel is first increasing in size up to 200 and then shows a scrollbar.
// It kinda looks ugly otherwise (big panel, no content on it) // It kinda looks ugly otherwise (big panel, no content on it)

View file

@ -82,6 +82,7 @@ class PerObjectSettingsTool(Tool):
selected_object.addDecorator(SettingOverrideDecorator()) selected_object.addDecorator(SettingOverrideDecorator())
stack = selected_object.callDecoration("getStack") stack = selected_object.callDecoration("getStack")
settings_visibility_changed = False
settings = stack.getTop() settings = stack.getTop()
for property_key in ["infill_mesh", "cutting_mesh", "support_mesh", "anti_overhang_mesh"]: for property_key in ["infill_mesh", "cutting_mesh", "support_mesh", "anti_overhang_mesh"]:
if property_key != mesh_type: if property_key != mesh_type:
@ -103,11 +104,14 @@ class PerObjectSettingsTool(Tool):
new_instance.setProperty("value", 0) new_instance.setProperty("value", 0)
new_instance.resetState() # Ensure that the state is not seen as a user state. new_instance.resetState() # Ensure that the state is not seen as a user state.
settings.addInstance(new_instance) settings.addInstance(new_instance)
visible = self.visibility_handler.getVisible() settings_visibility_changed = True
visible.add(property_key)
self.visibility_handler.setVisible(visible)
elif old_mesh_type == "infill_mesh" and settings.getInstance(property_key) and settings.getProperty(property_key, "value") == 0: elif old_mesh_type == "infill_mesh" and settings.getInstance(property_key) and settings.getProperty(property_key, "value") == 0:
settings.removeInstance(property_key) settings.removeInstance(property_key)
settings_visibility_changed = True
if settings_visibility_changed:
self.visibility_handler.forceVisibilityChanged()
self.propertyChanged.emit() self.propertyChanged.emit()
return True return True