Fix T52195: Sculpt from Python fails

When calling sculpt from Python,
setting 3D 'location' but not 2D 'mouse' stopped working in 2.78.

Now check if the operator is running non-interactively and
skip the mouse-over check.
This commit is contained in:
Campbell Barton 2017-07-29 05:59:17 +10:00
parent e2a7e1e494
commit f3782c0a9e
Notes: blender-bot 2023-02-14 19:36:37 +01:00
Referenced by issue blender/blender-addons#52195, Sculpt API can no longer be used to draw strokes via python
1 changed files with 5 additions and 2 deletions

View File

@ -4656,8 +4656,11 @@ static bool sculpt_stroke_test_start(bContext *C, struct wmOperator *op,
const float mouse[2])
{
/* Don't start the stroke until mouse goes over the mesh.
* note: mouse will only be null when re-executing the saved stroke. */
if (!mouse || over_mesh(C, op, mouse[0], mouse[1])) {
* note: mouse will only be null when re-executing the saved stroke.
* We have exception for 'exec' strokes since they may not set 'mouse', only 'location', see: T52195. */
if (((op->flag & OP_IS_INVOKE) == 0) ||
(mouse == NULL) || over_mesh(C, op, mouse[0], mouse[1]))
{
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;