hello,
i can't acces a point normal,
after add a box, and point node with “add normal” i can see the attribute in the spreadsheet, but can't acces in python, for example :
print Mypoint.attribValue(“Nx”)
don't work
but print Mypoint.attribValue(“Pw”) is working.
i'm looking for create normal, acces it, modify it in python.
Any Idea ?
thanks !
access point normal in python
3047 3 0- izo
- Member
- 6 posts
- Joined: 6月 2011
- Offline
- graham
- Member
- 1914 posts
- Joined: 11月 2006
- Offline
You can't access just the x component that way. You need to do Mypoint.attribValue(“N”). If you are in a parameter you could do lvar(“NX”), the Python shortcut to $NX. The pure Python way of the parameter would be hou.pwd().curPoint().attribValue(“N”).
Graham Thompson, Technical Artist @ Rockstar Games
- izo
- Member
- 6 posts
- Joined: 6月 2011
- Offline
- graham
- Member
- 1914 posts
- Joined: 11月 2006
- Offline
Yes. Something like this would work:
normal_attr = geo.findPointAttrib(“N”)
for point in geo.points():
normal = point.attribValue(normal_attr)
normal = somevalue
point.setAttribValue(normal_attr, normal)
Alternatively, and probably faster for lots of points:
vals = list(geo.pointFloatAttribValues(“N”))
# 0 for x, 1 for y, 2 for z.
comp_idx = 0
for i in range(comp_idx, len(vals), 3):
vals = somevalue
geo.setPointFloatAttribValues(“N”, vals)
normal_attr = geo.findPointAttrib(“N”)
for point in geo.points():
normal = point.attribValue(normal_attr)
normal = somevalue
point.setAttribValue(normal_attr, normal)
Alternatively, and probably faster for lots of points:
vals = list(geo.pointFloatAttribValues(“N”))
# 0 for x, 1 for y, 2 for z.
comp_idx = 0
for i in range(comp_idx, len(vals), 3):
vals = somevalue
geo.setPointFloatAttribValues(“N”, vals)
Graham Thompson, Technical Artist @ Rockstar Games
-
- Quick Links