Hey there!
I can’t seem to get Texture Painting to work and can’t find any examples of drawing a dot or a line. I believe it’s something to do with my stroke data. I was able to get Sculpting working with a similar script, and if I change the image tool type in the script below from DRAW to FILL it does fill the object’s texture.
Any ideas what I’m doing wrong?
def context_override():
for window in bpy.context.window_manager.windows:
screen = window.screen
for area in screen.areas:
if area.type == 'VIEW_3D':
for region in area.regions:
if region.type == 'WINDOW':
return {'window': window, 'screen': screen, 'area': area, 'region': region, 'scene': bpy.context.scene}
bpy.ops.object.mode_set(mode='TEXTURE_PAINT')
bpy.data.objects['An object'].select_set(True)
bpy.ops.paint.brush_select(image_tool='DRAW')
strokes = [{
"name": "",
"location": (0, 0, 0),
"mouse": (0, 0),
"mouse_event": (0,0),
"x_tilt": 0,
"y_tilt": 0,
"size": 100,
"pressure": 1,
"pen_flip": False,
"time": 0,
"is_start": True
}]
bpy.ops.paint.image_paint(context_override(), stroke=strokes)