Merge pull request #21399 from Ultimaker/CURA-12853-add-message-painting-in-compatibility-mode

CURA-12853 add message painting in compatibility mode
This commit is contained in:
HellAholic 2026-03-03 12:04:34 +01:00 committed by GitHub
commit 6ff17121e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 27 additions and 1 deletions

View file

@ -21,6 +21,7 @@ from UM.Scene.Camera import Camera
from UM.Scene.SceneNode import SceneNode
from UM.Scene.Selection import Selection
from UM.Tool import Tool
from UM.View.GL.OpenGLContext import OpenGLContext
from cura.CuraApplication import CuraApplication
from cura.PickingPass import PickingPass
@ -44,6 +45,7 @@ class PaintTool(Tool):
MULTIPLE_SELECTION = 0 # Multiple objects are selected, wait until there is only one
PREPARING_MODEL = 1 # Model is being prepared (UV-unwrapping, texture generation)
READY = 2 # Ready to paint !
NOT_SUPPORTED = 3 # Painting is not supported (due to OpenGL compatibility mode)
def __init__(self, view: PaintView) -> None:
super().__init__()
@ -72,7 +74,9 @@ class PaintTool(Tool):
self._last_world_coords: Optional[numpy.ndarray] = None
self._state: PaintTool.Paint.State = PaintTool.Paint.State.MULTIPLE_SELECTION
legacy_opengl = OpenGLContext.isLegacyOpenGL()
self._state: PaintTool.Paint.State = PaintTool.Paint.State.NOT_SUPPORTED if legacy_opengl else\
PaintTool.Paint.State.MULTIPLE_SELECTION
self._prepare_texture_job: Optional[PrepareTextureJob] = None
self.setExposedProperties("PaintType", "BrushSize", "BrushColor", "BrushShape", "BrushExtruder", "State", "CanUndo", "CanRedo")
@ -413,11 +417,17 @@ class PaintTool(Tool):
self._updateState()
def _updateActiveView(self) -> None:
if self._state == PaintTool.Paint.State.NOT_SUPPORTED:
return
has_painted_object = self._view.hasPaintedObject()
stage_is_prepare = self._controller.getActiveStage().stageId == "PrepareStage"
self.setActiveView("PaintTool" if has_painted_object and stage_is_prepare else None)
def _updateState(self):
if self._state == PaintTool.Paint.State.NOT_SUPPORTED:
return
painted_object = self._view.getPaintedObject()
if painted_object is not None and self._controller.getActiveTool() == self:
if painted_object.callDecoration("getPaintTexture") is not None and painted_object.getMeshData().hasUVCoordinates():

View file

@ -332,4 +332,20 @@ Item
horizontalAlignment: Text.AlignHCenter
}
}
Rectangle
{
id: warningLegacyOpenGLItem
anchors.fill: parent
color: UM.Theme.getColor("main_background")
visible: UM.Controller.properties.getValue("State") === Cura.PaintToolState.NOT_SUPPORTED
UM.Label
{
anchors.fill: parent
text: catalog.i18nc("@label", "Painting is not available on this device. Your graphics card or drivers do not fully support it. Updating your graphics drivers may enable this feature.")
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
}
}