Post #740: ![](https://blenderartists.org/user_avatar/blenderartists.org/draguu/48/15444_2.

📋 Metadata

🏷️ Tags

pie-menu scripting intermediate solved

  • Pie Menu Editor
  • Python Scripting
  • Import/Export functionality

💬 Content

draguu:

i want to add pie menus import function to a operator

Try this script:

bpy.ops.wm.pm_import(mode='REPLACE', files=[dict(name='my_pie_menus.json')], directory=path)

TeaCrab:

I have a pie menu for creating frequent shader node in the node editor.

I set the poll to:

return C.space_data.tree_type == ‘ShaderNodeTree’

C.space_data.tree_type is available only in Node Editor area _.
_Try this script:

C.area.type == 'NODE_EDITOR' and <i>C.space_data.tree_type == 'ShaderNodeTree'</i>

TeaCrab:

Does the single quote/double quote affect Python’s interpretation of a string?

No, afaik.


🔗 View on Blender Artists