-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
CURA-12544 saving and loading painted files in cura #20656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Erwan MATHIEU (wawanbreton)
merged 28 commits into
CURA-12543_painting_ux
from
CURA-12544_saving-and-loading-painted-files-in-Cura
Jun 19, 2025
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
a0d2d6f
Add setting for retract/unretract during travel move
wawanbreton 86d096b
Merge remote-tracking branch 'origin/main' into CURA-11978_retract-an…
wawanbreton 8502284
Disable retract during travel for printers that handle retraction
wawanbreton 5670419
Merge branch 'main' into CURA-11978_retract-and-unretract-in-a-travel
HellAholic cf362f4
Merge branch 'main' into CURA-11978_retract-and-unretract-in-a-travel
HellAholic 3adf94c
move settings to experimental category
HellAholic c5a8a21
Merge branch 'main' into CURA-11978_retract-and-unretract-in-a-travel
wawanbreton d9b5069
Merge branch 'main' into CURA-11978_retract-and-unretract-in-a-travel
wawanbreton 86777ac
Add new travel types and display z-hops
wawanbreton e1d579c
Display legend tooltip for travel types
wawanbreton b298fa6
Merge remote-tracking branch 'origin/main' into CURA-12544_saving-and…
wawanbreton 96d2caf
Load UV coordinates from 3MF file
wawanbreton 50ea216
Store UV coordinates to 3MF file
wawanbreton 5873222
Merge remote-tracking branch 'origin/CURA-12543_painting_ux' into CUR…
wawanbreton f076413
Store painted texture to 3MF file
wawanbreton 57f811a
Load painted texture from 3MF file
wawanbreton 5a4b5bf
Allow properly duplicating painted models
wawanbreton 21443fa
Merge remote-tracking branch 'origin/CURA-12543_painting_ux' into CUR…
wawanbreton b358b93
Use proper English word for "plane"
wawanbreton 4ff78c8
Merge branch 'main' into CURA-12544_saving-and-loading-painted-files-…
wawanbreton 2390067
Restore basic themes
wawanbreton 864ccbc
Merge remote-tracking branch 'origin/CURA-12543_painting_ux' into CUR…
wawanbreton 851d472
Restore original themes
wawanbreton 4caba52
Basically working multipurpose painting
wawanbreton 960d2a2
Optimized application of stroke
wawanbreton 810638a
Merge remote-tracking branch 'origin/CURA-12543_painting_ux' into CUR…
wawanbreton 7cca040
Merge remote-tracking branch 'origin/CURA-12544_saving-and-loading-pa…
wawanbreton 2f2ae62
Merge pull request #20711 from Ultimaker/CURA-12566_save-proper-data-…
wawanbreton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,47 @@ | ||
| import copy | ||
|
|
||
| from typing import Optional, Dict | ||
|
|
||
| from PyQt6.QtGui import QImage | ||
|
|
||
| import UM.View.GL.Texture | ||
| from UM.Scene.SceneNodeDecorator import SceneNodeDecorator | ||
| from UM.View.GL.OpenGL import OpenGL | ||
| from UM.View.GL.Texture import Texture | ||
|
|
||
|
|
||
| # FIXME: When the texture UV-unwrapping is done, these two values will need to be set to a proper value (suggest 4096 for both). | ||
| TEXTURE_WIDTH = 512 | ||
| TEXTURE_HEIGHT = 512 | ||
|
|
||
| class SliceableObjectDecorator(SceneNodeDecorator): | ||
| def __init__(self) -> None: | ||
| super().__init__() | ||
| self._paint_texture = None | ||
| self._texture_data_mapping: Dict[str, tuple[int, int]] = {} | ||
|
|
||
| def isSliceable(self) -> bool: | ||
| return True | ||
|
|
||
| def getPaintTexture(self, create_if_required: bool = True) -> Optional[UM.View.GL.Texture.Texture]: | ||
| if self._paint_texture is None and create_if_required: | ||
| self._paint_texture = OpenGL.getInstance().createTexture(TEXTURE_WIDTH, TEXTURE_HEIGHT) | ||
| image = QImage(TEXTURE_WIDTH, TEXTURE_HEIGHT, QImage.Format.Format_RGB32) | ||
| image.fill(0) | ||
| self._paint_texture.setImage(image) | ||
| return self._paint_texture | ||
|
|
||
| def setPaintTexture(self, texture: UM.View.GL.Texture) -> None: | ||
| self._paint_texture = texture | ||
|
|
||
| def getTextureDataMapping(self) -> Dict[str, tuple[int, int]]: | ||
| return self._texture_data_mapping | ||
|
|
||
| def setTextureDataMapping(self, mapping: Dict[str, tuple[int, int]]) -> None: | ||
| self._texture_data_mapping = mapping | ||
|
|
||
| def __deepcopy__(self, memo) -> "SliceableObjectDecorator": | ||
| return type(self)() | ||
| copied_decorator = SliceableObjectDecorator() | ||
| copied_decorator.setPaintTexture(copy.deepcopy(self.getPaintTexture())) | ||
| copied_decorator.setTextureDataMapping(copy.deepcopy(self.getTextureDataMapping())) | ||
| return copied_decorator | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.