Python method Set Pivot to unmasked has no effect #73859
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#73859
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Win 10
Graphics card: NVidia GTX 1060
Blender Version
2.83 Master
Short description of error
I call this line of Python code in the invoke method of an operator in sculpt mode, the move tool is selected:
bpy.ops.sculpt.set_pivot_position(mode='UNMASKED')
But the gizmo doesnt move to the unmasked area of the mesh. When I do the same operation using the UI (Toolbar: Set Pivot) it works.
I debugged the Blender code and the function
static int sculpt_set_pivot_position_invoke(bContext *C, wmOperator *op, const wmEvent *event)
isn't executed for the Python call.
Operators like the mask_flood_fill can be called for they have exec-API callback - does set_pivot_position need an exec-callback as well so that it can be called by Python?
Added subscriber: @Jayanam
Added subscriber: @mano-wii
Changed status from 'Needs Triage' to: 'Needs User Info'
We require steps to reproduce the problem.
This facilitates the investigation process.
@mano-wii
to invoke the set_pivot_position operator
Nothing happens, it is not invoked.
Changed status from 'Needs User Info' to: 'Needs Triage'
Added subscriber: @JacquesLucke
Changed status from 'Needs Triage' to: 'Needs User Info'
It seems to work when you do this:
bpy.ops.sculpt.set_pivot_position('INVOKE_DEFAULT', mode='UNMASKED')
. Does this solve your issue?Changed status from 'Needs User Info' to: 'Archived'
The problem is that this operator does not have an exec callback.
You can work around the problem by specifying the context
'INVOKE_DEFAULT'
.https://docs.blender.org/api/current/bpy.ops.html#execution-context
Thanks for the report, but this is not considered a bug. Closing as this bug tracker is only for bugs and errors.
For user requests and feedback, please use other channels: https://wiki.blender.org/wiki/Communication/Contact#User_Feedback_and_Requests
Added subscriber: @brecht
Changed status from 'Archived' to: 'Confirmed'
I consider this a bug, there's no way a user of the Python API can know this without looking at the source code.
It should call invoke instead of exec automatically in this case.
This operator could also get an
exec
callback, there's only very few types of operators that need onlyinvoke
and noexec
.@JacquesLucke Basically yes, but then we have two possibilities: The API documentation has to be changed, or the first parameter has to be used internally - I guess the second solution is better cause other Python method calls don't need this parameter either.
Or even better, as I mentioned in the issue, the operator should get an exec-API callback.
Added subscriber: @PabloDobarro
I'll put the code in the
exec
method and pass the mouse position frominvoke
toexec
using new properties on the operator.@JacquesLucke : Ok, just to let you know, I applied the diff, compiled and it works in my operator and from the Python Console as well.
This issue was referenced by blender/blender@d54a4a32f3
Changed status from 'Confirmed' to: 'Resolved'