Vertex Paint: Add set vertex colors option to lock alpha #111002

Merged
Philipp Oeser merged 5 commits from lichtwerk/blender:110014 into main 2023-08-11 10:39:20 +02:00
Member

It is a common practice in gamedev to rely on coding various data into
the alpha channel of the mesh and there was no way to preserve that when
using the Set Vertex Colors operator (would always sets the Alpha component to '1').

Now add an "Affect Alpha" option (similar to what we have for brushes)
and when that is disabled, existing alpha is locked.

Fixes #110014

It is a common practice in gamedev to rely on coding various data into the alpha channel of the mesh and there was no way to preserve that when using the `Set Vertex Colors` operator (would always sets the Alpha component to '1'). Now add an "Affect Alpha" option (similar to what we have for brushes) and when that is disabled, existing alpha is locked. Fixes #110014
Philipp Oeser added 1 commit 2023-08-10 13:58:54 +02:00
fbbe31618f Fix #110014: Set Vertex Colors always sets the Alpha component to '1'
It is a common practice in gamedev to rely on coding various data into
the alpha channel of the mesh and there was no way to preserve that when
using the `Set Vertex Colors` operator.

Now add an "Affect Alpha" option (similar to what we have for brushes)
and when that is disabled, existing alpha is locked.
Philipp Oeser added this to the Sculpt, Paint & Texture project 2023-08-10 13:59:07 +02:00
Philipp Oeser added the
Interest
Modeling
label 2023-08-10 13:59:18 +02:00
Philipp Oeser requested review from Julien Kaspar 2023-08-10 13:59:26 +02:00
Philipp Oeser requested review from Hans Goudey 2023-08-10 13:59:34 +02:00
Philipp Oeser requested review from Campbell Barton 2023-08-10 13:59:45 +02:00
Member

Works fine. The only issue I see is that the redo panel cannot undo the new alpha color that was set.
So if the "Affect Alpha" was disabled when executing the operation and then the option is toggled, it will properly fill the alpha as well.
But when "Affect Alpha" was enabled it will fill the Alpha and toggling the option will not undo this result.

Works fine. The only issue I see is that the redo panel cannot undo the new alpha color that was set. So if the "Affect Alpha" was disabled when executing the operation and then the option is toggled, it will properly fill the alpha as well. But when "Affect Alpha" was enabled it will fill the Alpha and toggling the option will not undo this result.
Author
Member

Works fine. The only issue I see is that the redo panel cannot undo the new alpha color that was set.
So if the "Affect Alpha" was disabled when executing the operation and then the option is toggled, it will properly fill the alpha as well.
But when "Affect Alpha" was enabled it will fill the Alpha and toggling the option will not undo this result.

I think I see what is going on, this needs special sculpt undo handling (similar to what transform_active_color is doing -- or using it directly).

> Works fine. The only issue I see is that the redo panel cannot undo the new alpha color that was set. > So if the "Affect Alpha" was disabled when executing the operation and then the option is toggled, it will properly fill the alpha as well. > But when "Affect Alpha" was enabled it will fill the Alpha and toggling the option will not undo this result. I think I see what is going on, this needs special sculpt undo handling (similar to what `transform_active_color` is doing -- or using it directly).
Philipp Oeser changed title from Fix #110014: Set Vertex Colors always sets the Alpha component to '1' to WIP: Fix #110014: Set Vertex Colors always sets the Alpha component to '1' 2023-08-10 15:29:00 +02:00
Hans Goudey approved these changes 2023-08-10 16:13:31 +02:00
Hans Goudey left a comment
Member

Seems reasonable! As far as I can tell this is more of a new feature than a bug fix, might be nice for the commit title to reflect that. Also, what is making the PR WIP? Generally that means it's not ready for review.

Seems reasonable! As far as I can tell this is more of a new feature than a bug fix, might be nice for the commit title to reflect that. Also, what is making the PR WIP? Generally that means it's not ready for review.
@ -2250,0 +2261,4 @@
"affect_alpha",
true,
"Affect Alpha",
"When this is disabled, lock existing alpha when setting vertex colors");
Member

UI descriptions of booleans should generally be phrased to describe what the option does when it's turned on, i.e. "Chane the alpha channel of colors"

https://wiki.blender.org/wiki/Human_Interface_Guidelines/Tooltips

I think that's clear enough, it's not a complex idea

UI descriptions of booleans should generally be phrased to describe what the option does when it's turned on, i.e. "Chane the alpha channel of colors" https://wiki.blender.org/wiki/Human_Interface_Guidelines/Tooltips I think that's clear enough, it's not a complex idea
lichtwerk marked this conversation as resolved
Philipp Oeser added 1 commit 2023-08-10 16:34:23 +02:00
9a122529c5 proper (needs special sculpt) undo
this is basically using the undo strategy from transform_active_color
(16cb13b8a0).

NOTE: it would be even possible to use transform_active_color() all the
way, but this would require more refactoring and additionally, current
code in fill_mesh_color() does a cast which alters Alpha mode (not sure
if this is desired even, but wouldnt want to change this behavior with
this patch) which does not happen in transform_active_color() -- I think
it would be best to look at this separately and possibly unify code at a
later point.
Philipp Oeser added 1 commit 2023-08-10 16:41:20 +02:00
Philipp Oeser changed title from WIP: Fix #110014: Set Vertex Colors always sets the Alpha component to '1' to Vertex Paint Set Vertex Colors: add option to lock alpha 2023-08-10 16:46:06 +02:00
Author
Member

Seems reasonable! As far as I can tell this is more of a new feature than a bug fix, might be nice for the commit title to reflect that.

Changed

Also, what is making the PR WIP? Generally that means it's not ready for review.

This was because of the Undo issue (also see @JulienKaspar comment), would be nice if you could check that again.

>Seems reasonable! As far as I can tell this is more of a new feature than a bug fix, might be nice for the commit title to reflect that. Changed >Also, what is making the PR WIP? Generally that means it's not ready for review. This was because of the Undo issue (also see @JulienKaspar comment), would be nice if you could check that again.
Philipp Oeser requested review from Hans Goudey 2023-08-10 16:46:35 +02:00
Julien Kaspar approved these changes 2023-08-10 17:01:32 +02:00
Julien Kaspar left a comment
Member

Works like expected to me.

Works like expected to me.
Campbell Barton approved these changes 2023-08-11 00:50:40 +02:00
Campbell Barton reviewed 2023-08-11 00:57:09 +02:00
@ -2249,1 +2277,4 @@
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna,
"affect_alpha",

Prefer calling this "alpha", as we have for bpy.data.images.new(..) & IMAGE_OT_tile_add... or use_alpha.

Prefer calling this "alpha", as we have for `bpy.data.images.new(..)` & `IMAGE_OT_tile_add`... or `use_alpha`.
lichtwerk marked this conversation as resolved
Hans Goudey approved these changes 2023-08-11 07:51:18 +02:00
Hans Goudey reviewed 2023-08-11 07:53:19 +02:00
@ -2250,0 +2280,4 @@
"affect_alpha",
true,
"Affect Alpha",
"Set to full Alpha, lock existing alpha when disabled");
Member

Sorry to be picky, the grammar isn't quite right here though, since these are two sentences separated with a comma, which is also a bit awkward. What about something more like "Set color completely opaque instead of reusing existing alpha"?

Sorry to be picky, the grammar isn't quite right here though, since these are two sentences separated with a comma, which is also a bit awkward. What about something more like "Set color completely opaque instead of reusing existing alpha"?
lichtwerk marked this conversation as resolved
Hans Goudey changed title from Vertex Paint Set Vertex Colors: add option to lock alpha to Vertex Paint: Add set vertex colors option to lock alpha 2023-08-11 07:53:49 +02:00
Philipp Oeser added 2 commits 2023-08-11 10:35:52 +02:00
Philipp Oeser merged commit 3c26f84225 into main 2023-08-11 10:39:20 +02:00
Philipp Oeser deleted branch 110014 2023-08-11 10:39:21 +02:00
Julien Kaspar removed this from the Sculpt, Paint & Texture project 2023-08-25 11:35:34 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
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
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
4 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#111002
No description provided.