Skip to content

[CURA-12543] Painting UI #20640

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

Open
wants to merge 47 commits into
base: main
Choose a base branch
from
Open

[CURA-12543] Painting UI #20640

wants to merge 47 commits into from

Conversation

rburema
Copy link
Member

@rburema rburema commented May 28, 2025

Tool (and view) to be used for paint-on-anything. Quite rudimentary for the moment, but should allow for smooth painting. Note that this doesn't do UV-unwrapping or assigning the textures properly yet, so for now you can only tests it on models that load properly with textures (so just OBJ with attached UV-coords for now). Needless to say, the paint doesn't do anything yet. -- For all of those things, see the other branches that may now be floating around.

  • Select brush-color, brush-size, brush-shape (paint-type is left for when we actually implement the different things you'd be able to do with this).
  • Paint by selecting the model, selecting the paint tool (which will show the paint-view) then dragging over the model (where they have a texture).
  • Undo/redo with (shift-)control-L (Z is taken for the overall undo).

Backend PR (needed for all of this): Ultimaker/Uranium#999
Engine: Ultimaker/CuraEngine#2239

rburema and others added 15 commits May 20, 2025 15:52
…feature.

Currently replacing the 'disabled' batch until we can get it to switch out on command (when we have the painting stage/tool/... pluging up and running.

part of CURA-12543
Should be able to paint pixels now if the tools is active, and the model loaded is with UV-coords (that rules out our current impl. of 3MF at the moment -- use OBJ instead), and you position the model outside of the build-plate so the paint-shadr that is temporarily replacing the 'disabled' one is showing.

Will need a lot of extra features and optimizations still!

part of CURA-12543
Just enought so that the truly ugly things are out of it.

part of CURA-12543
Also typing. The way it now works is way too slow though, and it doesn't add 'inbetween' the moude-move-positions yet. Also several other things of course.

part of CURA-12543
The most important thing to make it work is actually notifying the scene that something has changed -- the rest are just refactorings and (hopefully) optimizations.

part of CURA-12543
…-image by pen instead.

This also simplifies things nicely.

part of CURA-12543
…A-12544_saving-and-loading-painted-files-in-Cura
Also fix missing pen-shape I suppose.

part of CURA-12543
Copy link
Contributor

github-actions bot commented May 28, 2025

Test Results

23 953 tests   23 951 ✅  48s ⏱️
     1 suites       2 💤
     1 files         0 ❌

Results for commit 4aea580.

♻️ This comment has been updated with latest results.

@jellespijker jellespijker requested a review from Copilot May 31, 2025 14:17
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new Paint Tool for Cura that allows users to select brush properties and paint on models with textures. Key changes include adding new plugin files for the Paint Tool UI and shader, integrating a new PaintView for rendering strokes, and implementing core painting functionality in PaintTool.py.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
plugins/SolidView/SolidView.py Refactored overhang preference usage to improve consistency
plugins/PaintTool/plugin.json Added plugin metadata for the new Paint Tool
plugins/PaintTool/paint.shader Added shader definitions for painting with support for multiple GLSL versions
plugins/PaintTool/init.py Registered the Paint Tool and associated view
plugins/PaintTool/PaintView.py Implemented the view for painting with stroke management and texture updates
plugins/PaintTool/PaintTool.qml Created the UI for selecting brush properties and actions
plugins/PaintTool/PaintTool.py Added core painting logic and event handling for brush strokes
Comments suppressed due to low confidence (1)

plugins/PaintTool/PaintTool.py:241

  • The '_selection_pass' variable is referenced for face selection and stroke rendering but is never initialized, which will prevent the painting functionality from working. Consider initializing '_selection_pass' appropriately or revising the reference if a different selection mechanism was intended.
if not self._selection_pass:

Copy link
Contributor

@wawanbreton wawanbreton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, this is much smaller than I would have expected ! And the calculations look very much like the ones in the engine.
Some remarks/suggestions, nothing huge. I'll make other UX remarks in the ticket.

rburema and others added 6 commits June 4, 2025 21:00
Refactoring that part to up top caused the problem I think -- getSelectedObject(0) over getAllSelectedObjects()[0] is clearly the better call in this case anyway.

part of CURA-12543
…ry pt equal to corner.

This shouldn't happen on a well UV-mapped, manifold mesh -- well, unless someone manages to click exactly on one of the triangle corners. Better to get this fixed now then to run into floating point shenanigans later.

part of CURA-12543
This code is expandable into the real solution later, see the TODO left in the code by this commit.

part of CURA-12543
CURA-12544
The word in French to describe a geometric flat surface if "plan", which is a valid word in English but it doesn't have the same meaning, this got me confused. So replacing "plan" by "plane" because we are actually dealing with a geometrical "plane" (although it doesn't fly).
CURA-12544
Mistakenly commited after applying the daily rotated colors
Copy link
Contributor

@wawanbreton wawanbreton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes, looks good 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants