Painting with bpy.ops.paint.image_paint() uses previous stencil color space #117800

Closed
opened 2024-02-04 08:14:43 +01:00 by Bortroy · 4 comments

System Information
Operating system: Windows 10
Graphics card: GeForce GTX 1660 Super

Blender Version
Broken: 3.x, 4.x
Worked: N/A

Short description of error
When painting a stroke with a stencil image with the Python API, using bpy.ops.paint.image_paint(), the previously used color space of the stencil is used to projection paint the stencil, rather than the current color space.

Exact steps for others to reproduce the error

  1. Open the attached example_blend.blend file.
  2. Run the example_script.py module with CTRL + P in the Text Editor.
  3. Swap to the Texture Paint workspace.
  4. Within the 3D Viewport, paint the stencil (Color.png) onto the plane using LEFT MOUSE (see 1 in attached stencils.png). Note this should use sRGB color space setting for the stencil.
  5. In a new location on the plane, paint the stencil onto the plane using CTRL + SHIFT + LEFT MOUSE (as specified in example_script.py; see 2 in attached). The image should be correctly painted using 'sRGB' color space.
  6. Change the Color.png image color space to 'Non-Color'.
  7. In a new location on the plane, paint the stencil using LEFT MOUSE (see 3 in attached). This should correctly paint the image using 'Non-Color' color space.
  8. Change the Color.png image color space back to 'sRGB'.
  9. In a new location on the plane, paint the stencil using CTRL + SHIFT + LEFT MOUSE (see 4 in attached). This should INCORRECTLY paint the image using the previous 'Non-Color' color space, rather than the newly set 'sRGB'.

Any variation of the these steps will have the same effect. Essentially, the bpy.ops.paint.image_paint() operation uses whatever color space was last used for stencil painting, rather than the color space set for the stencil. Note that this is also the case for different images entirely - painting with bpy.ops.paint.image_paint() with a new stencil image will use the color space of the previously painted stencil image.

**System Information** Operating system: Windows 10 Graphics card: GeForce GTX 1660 Super **Blender Version** Broken: 3.x, 4.x Worked: N/A Short description of error When painting a stroke with a stencil image with the Python API, using bpy.ops.paint.image_paint(), the *previously used color space* of the stencil is used to projection paint the stencil, rather than the current color space. **Exact steps for others to reproduce the error** 1. Open the attached example_blend.blend file. 2. Run the example_script.py module with CTRL + P in the Text Editor. 3. Swap to the Texture Paint workspace. 4. Within the 3D Viewport, paint the stencil (Color.png) onto the plane using LEFT MOUSE (see 1 in attached stencils.png). Note this should use sRGB color space setting for the stencil. 5. In a new location on the plane, paint the stencil onto the plane using CTRL + SHIFT + LEFT MOUSE (as specified in example_script.py; see 2 in attached). The image should be correctly painted using 'sRGB' color space. 6. Change the Color.png image color space to 'Non-Color'. 7. In a new location on the plane, paint the stencil using LEFT MOUSE (see 3 in attached). This should correctly paint the image using 'Non-Color' color space. 8. Change the Color.png image color space back to 'sRGB'. 9. In a new location on the plane, paint the stencil using CTRL + SHIFT + LEFT MOUSE (see 4 in attached). This should INCORRECTLY paint the image using the previous 'Non-Color' color space, rather than the newly set 'sRGB'. Any variation of the these steps will have the same effect. Essentially, the bpy.ops.paint.image_paint() operation uses whatever color space was last used for stencil painting, rather than the color space set for the stencil. **Note that this is also the case for different images entirely - painting with bpy.ops.paint.image_paint() with a new stencil image will use the color space of the previously painted stencil image.**
Bortroy added the
Status
Needs Triage
Priority
Normal
Type
Report
labels 2024-02-04 08:14:44 +01:00

Can reproduce, will have to check the code, why this happens though.

Can reproduce, will have to check the code, why this happens though.
Member

This has just been fixed by f23da882e6

@iss , @Bortroy : could you recheck in a fresh build (e.g. the fresh 4.1 build from https://builder.blender.org/download/daily/)?

This has just been fixed by f23da882e63da8db614debe3aa8a7039904ef276 @iss , @Bortroy : could you recheck in a fresh build (e.g. the fresh 4.1 build from https://builder.blender.org/download/daily/)?
Philipp Oeser added
Status
Needs Information from User
and removed
Status
Needs Triage
labels 2024-02-05 09:29:29 +01:00
Author

Can confirm this is all fixed in the latest build - thank you!

Will this also be fixed in the previous LTS versions?

Can confirm this is all fixed in the latest build - thank you! Will this also be fixed in the previous LTS versions?
Member

Can confirm this is all fixed in the latest build - thank you!

Will this also be fixed in the previous LTS versions?

Thx getting back! I have added the fix to #109399 and #100749, will close this report now then.

> Can confirm this is all fixed in the latest build - thank you! > > Will this also be fixed in the previous LTS versions? Thx getting back! I have added the fix to #109399 and #100749, will close this report now then.
Blender Bot added
Status
Archived
and removed
Status
Needs Information from User
labels 2024-02-06 11:40:04 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#117800
No description provided.