Typo in the volume points python code.
x /= reduce
y /= reduce
z /= reduce
bounds = geo.boundingBox()
bmin = bounds.minvec()
bmax = bounds.maxvec()
bstep = hou.Vector3((bmax[0] - bmin[0]) / x, (bmax[1] - bmin[1]) / y, (bmax[2] - bmin[2]) / z)
geo.clear()
for i in xrange(x): #<<<======
for j in range(y):
for k in range(z):
p = geo.createPoint()
p.setPosition((bmin[0] + (i*bstep[0]),bmin[1] + (j*bstep[1]),bmin[2] + (k*bstep[2])))
Fixing produced a float to int casting error.
Didn't take long to fix, I'm going to create a PR for this. Here's the updated version of the volumepoints.py
if isinstance(geo, hou.Geometry):
for prim in geo.prims():
if isinstance(prim, hou.Volume):
if prim.stringAttribValue('name') == name :
return prim;
raise hou.Error("Cannot find Volume with name of : %s" % name )
return None
raise hou.Error("Error: geo parameter is not of Geometry type")
return None
# This code is called when instances of this SOP cook.
node = hou.pwd()
geo = node.geometry()
volumename = node.parm("parm_volumename").evalAsString()
volume = FindNamedVolume(geo,volumename)
reduce = node.parm("parm_reduce").evalAsInt()
x = volume.resolution()[0]
y = volume.resolution()[1]
z = volume.resolution()[2]
x = x // reduce
y = y // reduce
z = z // reduce
bounds = geo.boundingBox()
bmin = bounds.minvec()
bmax = bounds.maxvec()
bstep = hou.Vector3((bmax[0] - bmin[0]) / x, (bmax[1] - bmin[1]) / y, (bmax[2] - bmin[2]) / z)
geo.clear()
for i in range(x):
for j in range(y):
for k in range(z):
p = geo.createPoint()
p.setPosition((bmin[0] + (i*bstep[0]),bmin[1] + (j*bstep[1]),bmin[2] + (k*bstep[2])))
Typo in the volume points python code.
Fixing produced a float to int casting error.
Didn't take long to fix, I'm going to create a PR for this. Here's the updated version of the volumepoints.py