Cura/plugins/SimulationView
Ghostkeeper a379e01f1d
Fix layer view being greyed out after reslicing gives same current layer
This fixes a very old bug in Cura where sometimes after re-slicing it would display the layer as if you've been going horizontal through the path slider, even if you never touched the horizontal path slider.
This was caused by a tracking flag in the SimulationPass, _switching_layers. This bit of state in the SimulationPass was tracking whether the user is going through the vertical layer slider (True) or the horizontal path slider (False). If False, the nozzle mesh is drawn and lower layers get drawn in a shadowy shader. The state of this flag was being updated on every render by looking at whether the previous render has the same current layer number but a different path index. If so, it changed to False, meaning that it assumes you're going through the paths on a layer and things get shadowy.
However if you slice a different object such that the number of layers stay the same (or at least the current layer) but the number of paths on a layer change (e.g. by reducing Maximum Resolution, or by loading a different model that happens to be equally tall) then it would falsely think you were going through the horizontal path slider.

This change effectively resets this state flag when any layer data is changed in the scene. So if you re-slice, it always goes back to _switching_layers = True.

The side effect is that if you were going through the paths of a layer and you re-slice, you won't end up on the same path even if the number of paths on your current layer didn't change due to the reslice. But I think that is more towards what the user would accept a re-slice to do anyway.

I decided to take a look into this bug because I'm making a script to automatically refresh the screenshots of the Settings Guide plug-in. This script frequently hits cases like this, and it's easier to fix this bug than to work around it in my script.
2021-03-06 15:48:32 +01:00
..
resources Make UI changes in the Simulation View for adapting the color gradient 2017-11-26 21:21:18 +01:00
__init__.py No longer create two instances of the setting view. 2018-11-05 11:48:19 +01:00
layers.shader Format spacing 2020-05-07 14:10:45 +02:00
layers3d.shader Add colour scheme for line width 2021-02-19 10:10:16 +01:00
layers3d_shadow.shader Layerview can now deal with visibility extruder nrs. 4+ 2020-05-06 18:03:32 +02:00
layers_shadow.shader Layerview can now deal with visibility extruder nrs. 4+ 2020-05-06 18:03:32 +02:00
LayerSlider.qml Cleanup: remove warnings for non-existing margins 2019-11-12 14:51:48 +01:00
NozzleNode.py Remove a bunch of unused imports 2019-11-08 13:38:42 +01:00
PathSlider.qml Update simulation slider handle position after width change 2019-10-28 09:59:30 +01:00
plugin.json Up the SDK version to 7.4.0 2020-10-22 11:29:25 +02:00
SimulationPass.py Fix layer view being greyed out after reslicing gives same current layer 2021-03-06 15:48:32 +01:00
SimulationSliderLabel.qml Refactor: simplify SimulationSliderLabel font metrics 2019-11-12 14:56:56 +01:00
SimulationView.py Add colour scheme for line width 2021-02-19 10:10:16 +01:00
simulationview_composite.shader GLES shader fixes 2018-03-29 21:07:51 +02:00
SimulationViewMainComponent.qml Merge branch 'master' into CURA-6854_align_layer_label_top_bottom 2019-11-01 10:51:21 +01:00
SimulationViewMenuComponent.qml Add colour scheme for line width 2021-02-19 10:10:16 +01:00
SimulationViewProxy.py Add colour scheme for line width 2021-02-19 10:10:16 +01:00