Pie Menu Editor 1.18.7

HI Roaoao!

I’m planning to buy this addon, but first i should know is it good for what i’m planning to use:
i would like skip using N panel, because all the addons sits there and finally blender turns into a “one-panel-mess” like zbrush’s tool menü before you make your own custom menus…
So it is time to start to make my UI because blender’s default is so outdated (for me).

So can i make popup menus by your addon from other addons?
Here is a concrete example:
There is texture library addon, which loads multiple textures into blender, the can hide and unhide those image sets. Now, can i

  1. make a popup window, which contains this Texture library window (Yellow) or at least the selector panel of it (Red)?
  2. can i put this Green menü also in that popup?
  3. can i create a brush selector pupup on a different shortcut?
  4. can i make these easily or i sould read hours on forums and sould dig into python to finally get it work?

Or can i rebuild this shading window to a popup window for example?

Well, i bought it and will see…

I use the shading menu as a popup so yes for it. For other requests I would say probably yes but the master will give you better answers…
Congrats for your purchase it really worth it! Have fun!

1 Like

Sorry for slow replies guys.
I’m babysitting with my nephews these days :baby:


Try to use this code in Command tab:

bones_to_select = {"Bone", "Bone.001"}; [setattr(b.bone, "select", b.name in bones_to_select) for b in C.object.pose.bones]
3 Likes

Hi, @jay27flow

Yes, with panel tools

Yes, use this code in Command tab:

bpy.ops.wm.toolbar()

Depends on the task. In some cases python knowledge is required.

1 Like

Yes, by using panel tools

1 Like

Hi roaoao.
This is also a rudimentary question, but I’m not sure about Pie Menu Editor’s “if definition”.
For example, I understand that the if syntax is written like this:

if [condition] [execution] [else] [execution 2]
if [condition] [execution] [elif] [condition 2] [execution 2] …

However, in the case of Pie Menu Editor, even if you first write if in the command field as shown in the image, it becomes “Invalid syntax” and you are confused because you do not know the cause of the malfunction.

2019-12-02 14_37_22-Blender

For example, the syntax for the QuickOrigin Add-On that I often use is written like this:
How can I write the following execution processes in order in the command field?

    if bpy.context.object.mode == "EDIT":
        saved_location = bpy.context.scene.cursor.location.copy()
        bpy.ops.view3d.snap_cursor_to_selected()
        bpy.ops.object.mode_set(mode="OBJECT")
        bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
        bpy.context.scene.cursor.location = saved_location
        bpy.ops.object.mode_set(mode="EDIT")
        
    if bpy.context.object.mode == "OBJECT":
        bpy.ops.object.origin_set(type='ORIGIN_CURSOR')

I’m trying to follow along here Pie Menu Editor 1.16.4
for making a context menu with nothing selected and i can’t get it right.

Do i put this line in the poll method?

One line if-else statement should look like this:

[execution] if [condition] [else] [execution 2]

if statement:

[execution] if [condition] [else] None
    if bpy.context.object.mode == "EDIT":
        saved_location = bpy.context.scene.cursor.location.copy()
        bpy.ops.view3d.snap_cursor_to_selected()
        bpy.ops.object.mode_set(mode="OBJECT")
        bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
        bpy.context.scene.cursor.location = saved_location
        bpy.ops.object.mode_set(mode="EDIT")
        
    if bpy.context.object.mode == "OBJECT":
        bpy.ops.object.origin_set(type='ORIGIN_CURSOR')

This code is too long for one-liner code (hard to read) but do-able. Note that you can use only 1024 chars in PME one-liners. Here is the code:

{locals().update(saved_location=bpy.context.scene.cursor.location.copy()), bpy.ops.view3d.snap_cursor_to_selected(), bpy.ops.object.mode_set(mode="OBJECT"), bpy.ops.object.origin_set(type='ORIGIN_CURSOR'), setattr(bpy.context.scene.cursor, "location", saved_location), bpy.ops.object.mode_set(mode="EDIT")} if bpy.context.object.mode == "EDIT" else None; bpy.ops.object.origin_set(type='ORIGIN_CURSOR') if bpy.context.object.mode == "OBJECT" else None

Still it’s better to use external scripts for multi-line code.

4 Likes

Yes, you can use this poll method for the menu:

return not C.selected_objects or not C.active_object

or just:

return not C.selected_objects
3 Likes

I was convinced by various examples of syntax.
I thought that specifying “None” was essential for the if-only syntax.

・ Only 1024 characters can be used with PME One Liner.
I knew this specification for the first time. Thank you for every advice.

Indeed, if there are certain character restrictions, it is a rational idea to execute long code via script. :sweat_smile:

when I try to hide the side panel (in 2.81) this happens:

Traceback (most recent call last):
File “C:\Users\user\AppData\Roaming\Blender Foundation\Blender\2.81\scripts\addons\pie_menu_editor\extra_operators.py”, line 661, in execute
min_x=a.x + 2, min_y=a.y + 2,
File “C:\Program Files\Blender Foundation\Blender 2.81\2.81\scripts\modules\bpy\ops.py”, line 201, in call
ret = op_call(self.idname_py(), None, kw)
TypeError: Converting py args to operator properties: : keyword “min_x” unrecognized

location: :-1

Hi @presha,
Please check the add-on version. This issue should be fixed in PME 1.16.4

1 Like

thanks, 1.16.4 fixed it for me!

Hi.
I came to ask another question because there was something I didn’t understand in the specifications of Pie Menu Editor.
How do I write to Poll_cmd to specify a Panel Group that only appears when a specific tool is selected?

tool = C.workspace.tools.from_space_view3d_mode(C.mode); return tool and tool.idname == “BoxCutter”

By the way, it is displayed in this way of writing, but it was not hidden when other tools were selected. :sweat_smile:

Hi @anminmakura,
Your code works for me. But looks like selecting tools doesn’t update UI. We have to move the mouse over panel in order to trigger poll method.

1 Like

Certainly the ON / OFF toggle now works when the panel is updated!
Thank you for your answer. :sweat_smile:

Hi roaoao,

I tried using panel tools to invoke the default Blender snapping panel with a hotkey. Following that video, this worked but I have an ‘OK’ button below the panel which i have to press to make the panel go away (or i have to click away from the panel). Is there a way to invoke just the snapping panel and have it disappear when I move the cursor away from the panel like with the default blender snapping panel?

Thanks!

Look at the settings on top of your menu, there is three mode ( pie, popup, dialog). You are in dialog mode and you want the popup behavior.

1 Like