can anyone help me find a way to select the face of an object by vertex color
Welcome to BA
While not possible in vanilla Blender, there are some workarounds. For example, this script:
Or this, updated, script:
Thereās also this add-on:
And this add-on:
Of the two add-ons, the second one will probably work better, as the first one seems to be having some kind of error, and the second one is a 2.8+ specific fork.
thanks Joseph for such a good welcome in the community!!!
Iām trying to select polygons with a specific color!! I want to note that object is imported from quill.and therefore I want to give different shaders to different parts!
i tried your script and nothing happens :((( maybe iām doing something wrong
P.S.
this add-on is not active for purchase
Thatās unfortunate I havenāt actually personally used that script, I will download it and give it a shot, see if I can figure it out.
Iām sure you can try
trying to find it! but no results
In case anyone else stumbles across this thread
In 3.6.3 at least, in Geometry Nodes
Add-> Geometry-> Read-> Named Attribute
allows access to āColā or any piece of data in your modelās spreadsheet.
Two years later, none of these links work or produce a result in Blender 4.0ā¦
I donāt think geo nodes solutions work for me, because I just need a selection.
Ah right, the new toolsā¦ ok, but regardless if I input āColā as suggested above or āAttributeā as some other places I found suggest, the following setup always selects everything:
Anyone know what I am doing wrong?
Also, sharing this involves a number of extra steps (and even requires an add-on like this just to save the node only to a new file, right?)ā¦ but attempting to modify those python scripts are even more difficultā¦ I tried looking up bmesh but itās above my head so far.
Go read this.
You canāt use Attribute statistics in this case as it outputs a constant and you need fields.
Whatās wrong with my suggestion?
I didnāt notice that Attribute Statistic didnāt have field outputs (since it has field inputs)ā¦ and Capture Attribute doesnāt seem to have the inputs required.
Your suggestion doesnāt grab the target color from the selection, I think? Besides, I donāt like the convoluted process of sharing and re-using geometry nodes. Maybe if they could be saved in the equivalent of a .gn file (like with .py).
But Iām not doing too well in Python eitherā¦ loops.layers.color.items in Bmesh/BMFace seems to have 0 length even though I have baked down a color attribute on my mesh and I can see it in both the details panel and the viewport.
I was doing some code hacking with python a few months ago involving vertex color assignment; Iāll see if I can backtrack my findings on that and see if selection was something Iād worked out.
(I definitely would want to avoid resorting to geonodes for such a thing.)
ETA - you might find this useful.
Ok, finally managed to make thisā¦
Some notes for anyone who finds this in the future:
- Blender can record vertex color in two different ways (which is what made finding examples of code that worked so difficult). Iāve only tested the first way here since thatās what I had, so the other branch of the code might not work.
- You wonāt actually see your selection, because update_edit_mesh throws an error for some reason, and none of the other ways of updating that I found seems to work, but the selection is getting made.
- The code might be slow because Iām looping through everything twice. I couldnāt figure out the numpy selection optimizations people were doing, and not having an easy way to get the selected things seem to be a long standing issue.
Funny that you mention that thread, as it was also one that I was going through this summer trying to determine a pathway to getting some code to work.
Iām normally not one to invoke the term āman-splainingā, but that thread was a perfect example of it unfortunately.