Antonioya
(Antonioya)
1
Hi,
I know how to get grease pencil using…:
gp = bpy.data.grease_pencil[0]
But, if I have several grease pencil layers, how can I get the current index or element?
something like:
i
idx = getcurrentPencil ????
gp = bpy.data.grease_pencil[idx]
Thanks,
Antonio
CoDEmanX
(CoDEmanX)
2
If there’s an active object, it is used for the GPencil, otherwise the scene (keep that in mind!).
The active layer can be retrieved via GreasePencil.layers.active,
here’s an example access path:
bpy.context.object.grease_pencil.layers.active.frames[0].strokes[0].points[0].co
Antonioya
(Antonioya)
3
Thanks CoDEmanX!
This is what I need:
bpy.context.scene.grease_pencil.layers
Antonio