Post #2534: Thank you so much for the thorough response, but while the codes work separately

๐Ÿ“‹ Metadata

๐Ÿท๏ธ Tags

v1-18-8 macro macro-execution intermediate unsolved

  • Macro Editor
  • Python Scripting

๐Ÿ’ฌ Content

Thank you so much for the thorough response, but while the codes work separately by running them in the console, but I get this error whenever I try to run the full macro:

Traceback (most recent call last):
  File "C:\Users\raphael.barros\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\pie_menu_editor\operators.py", line 2042, in invoke
    return self.execute_menu(context, event)
  File "C:\Users\raphael.barros\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\pie_menu_editor\operators.py", line 1879, in execute_menu
    execute_macro(pm)
  File "C:\Users\raphael.barros\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\pie_menu_editor\macro_utils.py", line 243, in execute_macro
    op('INVOKE_DEFAULT', True, **props)
  File "C:\Users\raphael.barros\Desktop\blender-2.79.0-git.d555c92e3c57-windows64\2.79\scripts\modules\bpy\ops.py", line 195, in __call__
    ret = op_call(self.idname_py(), C_dict, kw, C_exec, C_undo)
RuntimeError: Operator bpy.ops.pme.macro_importar_e_limpar.poll() failed, context is incorrect

location: <unknown location>:-1

The idea of the macro is to โ€œclear and joinโ€ an imported .fbx file that comes with multiple meshes parented to multiple empties, so after I import everything is already selected, but without an active mesh for me to do operations such as join or clear parent). The macro works if I select one object as active before it, so it seems the code that is giving me some trouble is this one:

meshes = [ob for ob in scene.objects if ob.type == 'MESH']; scene.objects.active = meshes[0] if meshes else scene.objects.active;

๐Ÿ”— View on Blender Artists