Pie Menu Editor 1.18.7

I am drawing a button in the custom tab because it is conditional:
L.operator(“test.test”, text = “test”, icon = “FILE_FOLDER”)

Can I set the icon to be a custom PME one?

It is possible to create pie menus that only works when curves, gpencil is selected and different pie menus when mesh, object is selected? With the same key.

Make a pie and change its “keymap names” click the + if you need more

37%20PM%20001

I try this but dont work

Maybe you have the wrong context? I have 2 pies one for ‘MESH’ and one for ‘OBJECT’ they use the same keymap and it works fine

Yes, use custom_icon() function:

L.operator("test.test", text="test", icon_value=custom_icon("icon_file_name_without_ext"))

Try to use Object non-modal keymap and a poll method. Something like this:

Curves and gpencil:

return C.object and C.object.type in ('CURVE', 'GPENCIL')

Mesh objects:

return C.object and C.object.type == 'MESH'
1 Like

Wow thats been bugging me since i first installed PME, never thought to ask lol

Thank You roaoao! Works great!

Is possible to make pies for lattice?

FIY:

When i change icon in terminal i have lots of error like this:

ERROR (bke.icons): c:\b\win64_cmake_vs2017\win64_cmake_vs2017\blender.git\source\blender\blenkernel\intern\icons.c:688 BKE_icon_get: no icon for icon ID: 787

Sure, you can find all object types here.

Thanks, will try to fix.

1 Like

recently i saw an addon for changing colors of topbar depending on the mode you are in ,

i tried to replicate same with pme , and i got this ,

import bpy
if  bpy.context.scene.tool_settings.use_keyframe_insert_auto == True:
    
    bpy.context.preferences.themes['Default'].topbar.space.header= [1,1,0,1]

else:
    bpy.context.preferences.themes['Default'].topbar.space.header= [1,0,0,1]

now i dont understand is , where should i add this code? as a macro ? or as a stack key or as a modal operator ,
let me know what do you think

One way is creating a PME prop:

1 Add a Property - call it autokey or something. Show advanced settings.
2 Getter:

return C.scene.tool_settings.use_keyframe_insert_auto

3 Setter:

C.scene.tool_settings.use_keyframe_insert_auto = value

4 On Update:

h = C.preferences.themes['Default'].topbar.space.header; h[:] = [1,1,0,1] if props().autokey else [1,0,0,1]

5 On Init:

# Same code as On Update

You then need to toggle this prop for the On Update function to trigger. Using the default button in the UI won’t work.
You can access the prop as props().autokey and use it anywhere in the PME menus

Edit:
Or you can use this in On Update to get the default header color on startup:

h = C.preferences.themes['Default'].topbar.space.header; h[:] = (0.137254, 0.137254, 0.137254, 1.0)
1 Like

I cannot find out what the code for “drag action = scale” is when using the transform tool.

image

bpy.ops.wm.tool_set_by_id(name=“builtin.transform”)
this activates the tool itself but if I try to store the command after switching to “scale” in debug mode all I get is this:

bpy.ops.view3d.rotate()

Is there a way to find out the command?

Try this code:

C.workspace.tools.from_space_view3d_mode(C.mode).gizmo_group_properties("TRANSFORM_GGT_gizmo").drag_action = 'SCALE'

many thanks, works perfectly :slight_smile:

is there a way to find out the code by myself without being a coder btw?

Yes, you can find the code in sources:

Enable Developer Extras in Edit > Preferences > Interface > Display.
Click RMB to open context menu for Drag Action button.
Select Edit Source and open text editor in Blender:

...
props = tool.gizmo_group_properties("TRANSFORM_GGT_gizmo")
layout.prop(props, "drag_action")
...

In most cases this should be enough to find the code:

tool.gizmo_group_properties("TRANSFORM_GGT_gizmo").drag_action

But in this case you need to know how to find the active tool:

tool = C.workspace.tools.from_space_view3d_mode(C.mode)
1 Like

Many thanks, now I can find it out by myself … I hope :wink:

I just bought this and I’m getting an error on install :frowning:

What info do I need to give to have it diagnosed?

Hi, please post a screenshot with the error.