Do you know any way to copy the exact attribute color values from the selected vertex to the clipboard? I ask because I would like to use vertex painting as id masks to create textures based on only one material. For this purpose i also created a simple node group that compares 2 colors and returns "1" if they are the same and "0" if they differ. The problem arises when I want to pick color of vertices of a specific part of mesh from the 3d viewport using a pipette - because "Filmic" changes colors, and I have to constantly switch to "Standard" mode to get a color sample for the id mask. The ability to directly copy the rgb or hex values to the clipboard from the selected vertex would probably be the best solution. Thx
This isn't exactly an answer but you might find it useful. You can read the color value from the spreadsheet. Open the Spreadsheet Editor and turn on "Show Only Selected" in the upper right corner. Only rows for the currently selected verts will be shown.
- You can only see 3 digits of the color value, which means it isn't exact.
- The RGB values are displayed in linear space, not sRGB.
- For vertex-domain colors, look under the "Vertex" tab. For corner-domain look under the "Face Corner" tab. All the corners attached to the selected vert will be shown. You can also select a face to see all the corners in that face.
- You can see multiple color attributes if you have them (and other stuff like UV maps too).
This will fetch the color value from the color attribute corresponding to the select vertex. Be mindful that it won't likely work in your case because your vertex colors are stored in the faces corners, so a vertex can have any number of colors associated with it.
import bpy import bmesh import platform import subprocess obj = bpy.context.active_object bm = bmesh.from_edit_mesh(obj.data) def copy2clip(txt): cmd = "echo " + txt.strip() if platform.system() == "Linux": cmd += "|xclip" elif platform.system() == "Darwin": cmd += "|pbcopy" else: cmd += "|clip" return subprocess.check_call(cmd, shell=True) for v in bm.verts: if v.select: idx = v.index bpy.ops.object.editmode_toggle() attribute = obj.data.attributes["Col"] # Name of your vertex color attribute, case-sensitive attribute_value = attribute.data[idx].color print([c for c in attribute_value]) copy2clip(str([c for c in attribute_value])) bpy.ops.object.editmode_toggle() break
Copy to clipboard adapted from this answer
$\begingroup$ Thank you for your answer and explanation. Indeed, it looks like a more complex issue than I thought, because in addition to what you wrote, there may be color attributes with other names, which is also a problem. So it seems that in this case it will be inevitable to change the color management to "standard" $\endgroup$– ZyzioJan 30 at 17:42