Post #854: ![](https://blenderartists.org/user_avatar/blenderartists.org/frankieh/48/670768

📋 Metadata

  • Author: roaoao
  • Date: 2017-09-15 11:30:48
  • Type: answer
  • Quality Score: 8/10
  • Reply to: post_00853

🏷️ Tags

pie-menu hotkeys intermediate solved

  • Pie Menu Editor
  • Python Scripting
  • Custom tab
  • Command tab

💬 Content

FrankieH:

I’m trying to put autokey frame toggle on a pie, I put “bpy.context.scene.tool_settings.use_keyframe_insert_auto = not bpy.context.scene.tool_settings.use_keyframe_insert_auto” under the command and it works, the problem is the UI doesn’t update and the button is wrong until I mouse over the animation window. Any ideas how to force an update?

To update the UI you can use this code:

from pie_menu_editor import ui; ui.tag_redraw(True)

In your case:

bpy.context.scene.tool_settings.use_keyframe_insert_auto = not bpy.context.scene.tool_settings.use_keyframe_insert_auto; from pie_menu_editor import ui; ui.tag_redraw(True)

FrankieH:

Edit, I’m also struggling to get the ui layout and scenes list added to a pie menu (from the top left part of the screen)

To change screen layout you can use this menu:

If you want to display screen layouts as a drop-down list use this code in Cutom tab:

L.template_ID(C.window, "screen", new="screen.new", unlink="screen.delete")

Switch scene code (Command tab):

C.screen.scene = D.scenes["Scene"]

Scene drop-down list (Custom tab):

L.template_ID(C.screen, "scene", new="scene.new", unlink="scene.delete")

🔗 View on Blender Artists