Post #794: ![](https://blenderartists.org/user_avatar/blenderartists.org/mmaaxx/48/7990_2.p

📋 Metadata

  • Author: roaoao
  • Date: 2017-08-23 09:36:35
  • Type: answer
  • Quality Score: 8/10
  • Reply to: post_00793

🏷️ Tags

macro pie-menu intermediate solved

  • Macro Editor
  • Pie Menu Editor
  • Python Scripting
  • pme.exec operator

💬 Content

MmAaXx:

I have this problem with this macro.
LINK here
https://www.dropbox.com/s/tjygqdjxxr7b3j6/flood_macro.json?dl=0

Hi, looks like macro operators check context for all items before execution.
In your case dyntopo is turned off at the beginning of the macro that’s why Flood Fill can’t be executed.
To fix the issue you can replace bpy.ops.sculpt.detail_flood_fill() operator with this operator:

bpy.ops.pme.exec(cmd="bpy.ops.sculpt.detail_flood_fill('INVOKE_DEFAULT', True)")

Or just add parentheses and PME will generate code for pme.exec operator automatically:

(bpy.ops.sculpt.detail_flood_fill('INVOKE_DEFAULT', True))

Don’t forget to add ‘INVOKE_DEFAULT’, True arguments when you use pme.exec operator.
‘INVOKE_DEFAUL’ means that the operator will be executed in interactive mode (if supported).
True allows to undo the operator (if supported).

MmAaXx:

Also, is there a way to put a macro inside a pie menu?
thanks!

Yes, select the macro in pie menu’s item Menu tab.


🔗 View on Blender Artists