Skip to content

Instantly share code, notes, and snippets.

@blender8r
Created January 5, 2023 00:20
Show Gist options
  • Select an option

  • Save blender8r/05c45eace1ce9e5db723aeb952bf003c to your computer and use it in GitHub Desktop.

Select an option

Save blender8r/05c45eace1ce9e5db723aeb952bf003c to your computer and use it in GitHub Desktop.
Framework for accessing grease pencil data in Blender using Python
import bpy
sel_obj = None
sel_objs = bpy.context.selected_objects
if sel_objs:
sel_obj = sel_objs[0]
if sel_obj and sel_obj.type=='GPENCIL':
gpencil = sel_obj.data
print(gpencil.is_stroke_vertex_mode)
for gp_layer in gpencil.layers:
for gp_frame in gp_layer.frames:
for gp_stroke in gp_frame.strokes:
for gp_point in gp_stroke.points:
print(gp_point.co)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment