Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-06-23 19:32:53 +0300
committerHans Goudey <h.goudey@me.com>2022-06-25 00:04:19 +0300
commit81eac17737da467b3c10974c4dc03dd85e0fc622 (patch)
tree5851fce9e4fa7be7e6c587bd53a523304d0d1cf0 /release
parent0af840470450f3d9e7d88e351fa33d4a5fcc11d9 (diff)
Fix T98975: Broken vertex paint mode operators
All of the operators in vertex paint mode didn't work properly with the new color attribute system. They only worked on byte color type attributes on the face corner domain. Since there are four possible combinations of domains and types now, it mostly ended up being simpler to convert the code to C++ and use the geometry component API for retrieving attributes, interpolating between domains, etc. The code changes ended up being fairly large, but the result should be simpler now. Differential Revision: https://developer.blender.org/D15261
Diffstat (limited to 'release')
-rw-r--r--release/scripts/startup/bl_operators/vertexpaint_dirt.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/release/scripts/startup/bl_operators/vertexpaint_dirt.py b/release/scripts/startup/bl_operators/vertexpaint_dirt.py
index 8089a65960c..1a7394e03af 100644
--- a/release/scripts/startup/bl_operators/vertexpaint_dirt.py
+++ b/release/scripts/startup/bl_operators/vertexpaint_dirt.py
@@ -4,15 +4,10 @@
# <pep8 compliant>
-def get_vcolor_layer_data(me):
- for lay in me.vertex_colors:
- if lay.active:
- return lay.data
-
- lay = me.vertex_colors.new()
- lay.active = True
- return lay.data
-
+def ensure_active_color_attribute(me):
+ if me.attributes.active_color:
+ return me.attributes.active_color
+ return me.color_attributes.new("Color", 'BYTE_COLOR', 'FACE_CORNER')
def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean, dirt_only, normalize):
from mathutils import Vector
@@ -101,17 +96,21 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean,
else:
tone_range = 1.0 / tone_range
- active_col_layer = get_vcolor_layer_data(me)
- if not active_col_layer:
+ active_color_attribute = ensure_active_color_attribute(me)
+ if not active_color_attribute:
return {'CANCELLED'}
+ point_domain = active_color_attribute.domain == 'POINT'
+
+ attribute_data = active_color_attribute.data
+
use_paint_mask = me.use_paint_mask
for i, p in enumerate(me.polygons):
if not use_paint_mask or p.select:
for loop_index in p.loop_indices:
loop = me.loops[loop_index]
v = loop.vertex_index
- col = active_col_layer[loop_index].color
+ col = attribute_data[v if point_domain else loop_index].color
tone = vert_tone[v]
tone = (tone - min_tone) * tone_range