Also skip empty containers when getting layer height for a quality profile

CURA-4133

On some machines such as UM2, there is no material. Getting the layer
height in this case will result back to the global stack itself, which
is the layer height of the current setting. This is a problem for
"Normal" (or "Fine") quality because it uses the machine's default layer
height.
This commit is contained in:
Lipu Fei 2017-08-09 09:24:02 +02:00
parent 8c6abc85fc
commit ab3d8349b6

View File

@ -108,9 +108,9 @@ class ProfilesModel(InstanceContainersModel):
#Quality has no value for layer height either. Get the layer height from somewhere lower in the stack.
skip_until_container = global_container_stack.material
if not skip_until_container: #No material in stack.
if not skip_until_container or skip_until_container == ContainerRegistry.getInstance().getEmptyInstanceContainer(): #No material in stack.
skip_until_container = global_container_stack.variant
if not skip_until_container: #No variant in stack.
if not skip_until_container or skip_until_container == ContainerRegistry.getInstance().getEmptyInstanceContainer(): #No variant in stack.
skip_until_container = global_container_stack.getBottom()
item["layer_height"] = str(global_container_stack.getRawProperty("layer_height", "value", skip_until_container = skip_until_container.getId())) + unit #Fall through to the currently loaded material.
yield item