Skip to content

Instantly share code, notes, and snippets.

@loonghao
Last active March 4, 2020 11:45
Show Gist options
  • Save loonghao/54704c86a187b979caa295b05b3dc119 to your computer and use it in GitHub Desktop.
Save loonghao/54704c86a187b979caa295b05b3dc119 to your computer and use it in GitHub Desktop.
Export houdini point attribute
import hou
import json
from pprint import pprint
node = hou.selectedNodes()[0]
for frame in range(810, 1510):
geo = node.geometryAtFrame(frame)
filename = r"c:\cgfx_rnd\point_data\{}.{}.json".format(node.name(), frame)
print filename
with open(filename, "w") as json_object:
data = {}
for point in geo.iterPoints():
data[point.number()] = {
attrib.name(): point.attribValue(attrib)
for attrib in geo.pointAttribs()
}
json.dump(data, json_object, indent=4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment