Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bpy
- # clear all visible
- bpy.ops.object.select_all(action='SELECT')
- bpy.ops.object.delete(use_global=False)
- # PLY file name
- name = "robot"
- #impoprt PLY
- bpy.ops.wm.ply_import(
- filepath="path-to-file/%s.ply" % name,
- import_colors="LINEAR",
- import_attributes=True
- )
- # doc:
- # https://docs.blender.org/api/current/bpy.ops.wm.html
- # create the color attribute on the object's geometry
- bpy.ops.geometry.color_attribute_add(name="Color")
- # store ref to mesh
- mesh = bpy.data.objects[name]
- #create geometry node
- geom_node = mesh.modifiers.new('geom_node',type='NODES')
- #Create a pointer to the node tree
- tree = bpy.data.node_groups[0]
- #Set that tree to your modifier
- mesh.modifiers['geom_node'].node_group = tree
- #set the "Color" attribute as the output of the Geometry node
- geom_node["Socket_2_attribute_name"] = "Color"
Add Comment
Please, Sign In to add comment