Post #1468: fj

πŸ“‹ Metadata

🏷️ Tags

macro hotkeys advanced solved

  • Macro Operator
  • Command tab
  • Python Scripting
  • Hotkey Configuration

πŸ’¬ Content

fjg3d:

In sculpt mode with dyntopo, I’d like to have a hotkey that will

  • switch to constant detail mode
  • draw wire frame
  • bring up the detail sampler
  • then turn off wire frame after the detail sampler was used

How could I set something like this up? I’m guessing modal, but I don’t know enough about them. Setting it up as a macro (without the last part turning the wireframe off) throws an error.

Yes, in this case you need to use Macro Operator. The problem is that Detail Sampler (and macros that uses the sampler) requires Constant Detail Mode. So you need to change Detail Type Mode before calling the macro.

Create a macro with 3 slots:

bpy.context.object.show_wire = True
bpy.ops.sculpt.sample_detail_size()
bpy.context.object.show_wire = False

Use the macro in Command tab:

bpy.context.scene.tool_settings.sculpt.detail_type_method = 'CONSTANT'; open_menu("My Macro Operator")

Or if you want to restore Detail Type Method:

s = bpy.context.scene.tool_settings.sculpt; m = s.detail_type_method; s.detail_type_method = 'CONSTANT'; open_menu("My Macro Operator"); s.detail_type_method = m

πŸ”— View on Blender Artists