Is there a way to be able to select vertices based on a give vertex color assigned to them?
What I need, basically, is to paint vertex colors over a terrain; select vertices, that painted in a particular color, and then split the terrain mesh.
Does Blender have such ability or maybe there is a script available?
Thanks.
anyone, pls? or do I need to post into Blender news?
I m looking for the same kind of script…
seen something like this using particules somewhere !
go to python forum and ask there for a script 2.5
or for particule painting for terrain versus height color !
but don’t remember where !
happy 2.5
hey motorsep! I just did a script that select all face with black vertex color.
select_black_faces.blend (172 KB)
Test it ,maybe it can help
open the file
select the mesh
enter edit mode
and press alt-p in the text area…
this looks it is for 2.49 do you have it for 2.5 ?
thanks happy 2.5
suggestion
open a thread in python and ask some help to port in 2.5
there will probably people ready to help with this!
good luck happy 2.5
Thanks Benny_Flex, will try that!
import bpy
from mathutils import Color
threshold = .1
obj = bpy.context.object
bpy.ops.object.mode_set(mode="OBJECT")
colors = obj.data.vertex_colors.active.data
selected_polygons = list(filter(lambda p: p.select, obj.data.polygons))
if len(selected_polygons):
p = selected_polygons[0]
r = g = b = 0
for i in p.loop_indices:
c = colors[i].color
r += c[0]
g += c[1]
b += c[2]
r /= p.loop_total
g /= p.loop_total
b /= p.loop_total
target = Color((r, g, b))
for p in obj.data.polygons:
r = g = b = 0
for i in p.loop_indices:
c = colors[i].color
r += c[0]
g += c[1]
b += c[2]
r /= p.loop_total
g /= p.loop_total
b /= p.loop_total
source = Color((r, g, b))
print(target, source)
if (abs(source.r - target.r) < threshold and
abs(source.g - target.g) < threshold and
abs(source.b - target.b) < threshold):
p.select = True
bpy.ops.object.editmode_toggle()
Hi for this problem, I have made an addon which you can buy. This addon makes it pretty easy withing shift + G menu.
Smilex55, does the most recent version 1.1 work in 2.93, if not do you plan on upgrading?
Thanks for this–Totally worth €1!