[Closed] Get Vertex Color from Mesh
Hi Guy,
i have a newbie question. I have look here at other Treads, but i don´t unterstand. How can i get a the Vertex Color of Vertex[24] from a Mesh?
my_color = my_mesh.getVertexcolor[24] ( don´t work )
mfg
hot chip
hi AnoPrkl,
thank you for help. I have convert my Poly Object to a Mesh Object, but it comes a error message: “vertex index out of range”
for i=1 to vertex_anzahl do (
vertex_farbe = getVertColor th_mesh i
)
and what must i do, when my mesh is a editable Poly, because my mesh is a editable Poly Object.
mfg
hot chip
You can use,
$.SetVertexColor (color 128 128 128) #VertexColor
This is for an EditablePoly Object, but you have to be in sub-object level 1 I believe with the vertex selected, otherwise it doesn’t work.
Hope that helps.
hi matthew
thank you. How can i say Vertex 24 for example, and i must read all Vertex of Poly-Object and check if the Color Red, Green or Blue.
That command works on the selected vertex.
So you would loop through all the verts like…
(
local theMesh = selection[1]
setCommandPanelTaskMode #modify
subObjectLevel = 1
For v = 1 to theMesh.mesh.verts.count do
(
theMesh.EditablePoly.SetSelection #Vertex #{v}
local theVertColor = theMesh.getVertexColor #VertexColor
print theVertColor
)
)
[QUOTE=thorsten hartmann]
check MXS Help:
Editable_Poly Mapping Methods
Vertex Colors
polyop.getVertsByColor
polyop.setVertColor
the Vertex Color Channel is Map Channel #0
(
n = converttopoly (box())
polyop.setvertcolor n 0 #{1,4} red
polyop.setvertcolor n 0 #{2,5,7} blue
polyop.setvertcolor n 0 #{3} green
polyop.setvertcolor n 0 #{6,8} black
format "red:%
" (polyop.getvertsbycolor n red 0 0 0 channel:0)
format "blue:%
" (polyop.getvertsbycolor n blue 0 0 0 channel:0)
format "green:%
" (polyop.getvertsbycolor n green 0 0 0 channel:0)
)
[color=white][font=Verdana][/color][/font]
Hi Denis,
thank you to the code. From time to time, i understand more and more.