Post #3006: ![](https://blenderartists.org/user_avatar/blenderartists.org/panosz/48/31678_2.

📋 Metadata

  • Author: roaoao
  • Date: 2020-02-03 15:44:31
  • Type: answer
  • Quality Score: 8/10
  • Reply to: post_03005

🏷️ Tags

macro hotkeys advanced solved

  • Macro Editor
  • Python Scripting

💬 Content

panosz:

I’m trying to use this with Dynamic Paint modifier. It works for each object separately but, do you think is possible to use one command to assign the modifier at both objects, the selected one as Canvas and the active one as Brush?

Yes, try something like this:

ao = C.active_object; sos = C.selected_objects; so = len(sos) > 1 and (sos[0] if ao is sos[1] else sos[1]); bpy.ops.object.modifier_add(dict(object=so), type='DYNAMIC_PAINT'); bpy.ops.object.modifier_add(dict(object=ao), type='DYNAMIC_PAINT'); bpy.ops.dpaint.type_toggle(dict(object=so), type='CANVAS'); ao.modifiers[-1].ui_type = 'BRUSH'; bpy.ops.dpaint.type_toggle(dict(object=ao), type='BRUSH')

❤️ 2 likes


🔗 View on Blender Artists