Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stroke parameters for sculpting #1

Open
dawnKalo opened this issue Oct 13, 2020 · 2 comments
Open

Stroke parameters for sculpting #1

dawnKalo opened this issue Oct 13, 2020 · 2 comments

Comments

@dawnKalo
Copy link

Hi,

Nice job.
I write scripts in Blender as well for other tasks,
I would like to understand more about the stroke parameters for sculpting:

        stroke = {
            "name": "stroke",
            "mouse": (0,0),
            "pen_flip" : pen_flip,
            "is_start": True if i==0 else False,
            "location": coordinate,
            "size": 50,
            "pressure": 1,
            "time": float(i)
        }

The documentation is quite poor:
https://docs.blender.org/api/current/bpy.types.OperatorStrokeElement.html

Specifically, for location and mouse.
How did you defined the location? according to the viewport or the object location?

When I do it manually in Blender, I don't see the printed script in info as I see in other tasks.

@christian-vorhemus
Copy link
Owner

The location coordinates passed to OperatorStrokeElement are coordinates of viewport. If you start with a standard cube at position (0,0,0) with size (2,2,2) and you apply the following strokes:

stroke1 = {
  "name": "stroke",
  "mouse": (0,0),
  "pen_flip" : False,
  "is_start": True,
  "location": (0,0,1),
  "size": 50,
  "pressure": 10,
  "time": 1.0
}

stroke2 = {
  "name": "stroke",
  "mouse": (0,0),
  "pen_flip" : False,
  "is_start": False,
  "location": (0,1,1),
  "size": 50,
  "pressure": 10,
  "time": 2.0
}

you'll get a deformation along the Y axis on top. If you move the cube to position (2,0,0), apply the transformation (Ctrl + A -> Location) and use the same brush strokes as above, nothing will happen. But if you now set the location of the strokes to (2,0,1) and (2,1,1) respectively, you'll see again the deformation on top.

@yangky11
Copy link

Hi,

Thanks for the explanation! I have a related question about sculpting. For some sculpting tools such as Grab and Snake Hook, you have to click on the shape and then drag your mouse. Is it possible to do this in Python scripts? I tried the sculpting code in this repo, it essentially places strokes as individual points. I'm not sure whether it can work for Grab and Snake Hook.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants