0

I would like to sculpt in python using the following operator:

    stroke = {
        "name": "stroke",
        "mouse": mouse,
        "pen_flip" : pen_flip,
        "is_start": True,
        "location": location,
        "size": 50,
        "pressure": 1,
        "time": time
    }

bpy.ops.sculpt.brush_stroke(context_override(), stroke=strokes)

I found the following sources:

https://github.com/christian-vorhemus/procedural-3d-image-generation/blob/master/blenderBackgroundTask.py#L54 https://docs.blender.org/api/current/bpy.ops.sculpt.html https://docs.blender.org/api/current/bpy.types.OperatorStrokeElement.html

The documentation of OperatorStrokeElement is quite poor and I don't understand the meaning of the parameters.

specifically, what is the location? why is it in 3D? I want to specify the location of the viewpoint, I found the location by select in object mode and checked the printed in info:

bpy.ops.view3d.select(deselect_all=True, location=(516, 338))

but I don't know how to add it to stroke options correctly, I've tried both the mouse click and location and nothing has happen (it said "FINISHED" but didn't sculpt it, apparently the location is incorrect)

just to note that I know how to do it manually by interface, I just want to translate it into code

kfirst
  • 1
  • https://blender.stackexchange.com/questions/125211/python-viewplane https://blender.stackexchange.com/questions/93057/make-bgl-2d-drawing-coordinates-stay-relative-to-viewport https://blender.stackexchange.com/questions/76464/how-to-get-the-mouse-coordinates-in-3space-relative-to-the-local-coordinates-of All examples of getting 2D coordinates of the view. Would assume to script would use the global 3d coords of object being sculpted, convert to 2d mouse coords and feed into the stroke option. Might look at answering – batFINGER Oct 13 '20 at 07:00
  • https://blender.stackexchange.com/questions/7582/is-there-a-way-to-save-strokes-while-painting-sculpting .... could be simple if the stroke options are stored in last operator. https://blender.stackexchange.com/a/163130/15543 – batFINGER Oct 13 '20 at 07:02
  • i wasnt even aware that something like this existed .... ha – SHikha Mittal Oct 13 '20 at 10:32

0 Answers0