I have pre-defined the material I want my addon to use when drawing with the grease pencil. I am drawing on grayscale images, so I need a bright color to show up while drawing, in addition to after the strokes are created. (In Blender 2.79 this was solved as described here.)
I cannot find this referenced anywhere in the 2.8 manuals, but it must be possible, so I hope I’ve just missed something.
# Create material for grease pencil gp_mat = bpy.data.materials.new("my_gp_material") gp_mat.use_nodes = True BSDF_node = gp_mat.node_tree.nodes["Principled BSDF"] BSDF_node.inputs["Base Color"].default_value = (0, 1, 0, 1) # Set up grease pencil bpy.ops.object.gpencil_add(type='EMPTY') bpy.ops.object.mode_set(mode='PAINT_GPENCIL') # Assign the material to the grease pencil for drawing ### WHAT GOES HERE?? # Draw, using the material defined bpy.ops.gpencil.draw(wait_for_input=False)
Thank you for your help!