Refactor object reload to handle 3mf files #898
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When a 3MF file that has multiple models inside is loaded, Cura will alert if the file has been modified and asks if the user wants to reload id. When that happen, all objects from that file where being replaced by the first model in the file.
Another minor issue was that when reloading, Cura would read the same file multiple times, one for each model.
! Important: This PR Requires Ultimaker/Cura#16610
Type of change
How Has This Been Tested?
Confirmed other filetypes where not affected by the refactor:
Opened a OBJ file and reloaded.
Opened STL file and reloaded.
Opened gcode file, and reloaded.
Loaded a 3MF file with multiple models into Cura, verified the name of the models in the app are the model name in the file.
Updated the 3MF file changing the mesh for the models but keeping the names. Clicked the message asking to reload the file and confirmed meshes are updated.
Updated the 3MF file removing one of the models, clicked the message asking to reload and confirmed it works as before and keep the mesh in the scene.
Updated the 3MF file, adding a new mesh into it, clicked the message asking to reload and confirmed it works as before and the new mesh is NOT loaded in the scene{1}.
{1}: This should be an improvement, as the newly added model should be loaded when we reload a file. However I couldn't find a simple way to do that at the moment and will try to fix it in a later improvement.
Test Configuration:
Checklist: