rRMB Menu

Thanks for that! It’s already helping.

+1 very usefull !

someone can tell me where can we found the list of the commands to pyt in the custom menu please ?

This kind of command :

layout.operator(“view3d.snap_cursor_to_selected”, text=“Cursor to Selected”)

Hover over a button, read python tooltip. Or - find a menu entry in the source code. Or run an operator, read it’s name in the info window console (drag topmost window down).

Yes, I know this ^^
I wanted to know if a website with the listing exist.

I made list of commands on this .py > https://www.dropbox.com/s/5sd7nzu3t44ufki/commandes_blender.py

It should be usefull ^^

http://www.pasteall.org/pic/70754

If we could implement also sth like above, w/ eg. SHIFT+RMB ??

0.2 Release. Features added:

  • Mode selection.
  • Mode specific menus for armatures, curves and text.

0.3 Release. Changes:

  • Added Copy and Paste Object
  • Added Move Origin submenu
  • Added Object Data submenu
  • Generally improved Object Mode menu

Update:

  • Added Add Object entries when nothing is selected, as @pitiwazou suggested.

@PLyckowski

I just wanted to say a big thank you for your initiative:) I would have considered myself a right-click die hard until I recently started playing with this. You’ve completely won me over, it’s incredibly fast and intuitive. I agree with what others have said, this would be extremely useful for beginners or those migrating from other packages.

@pitiwazou

great suggestions that have really worked out well in version 0.3 :slight_smile: Also I wanted to compliment you on your Blender lounge videos, they’ve filled a lot of holes in my knowledge… thanks!

Good to hear. Yup, the Object mode and the nothing-selected sections are proving to be very beneficent for the UX IMO. Don’t get used to the Edit mode categories though - they are taken straight from current Blender, and will be re-sorted.

I just tested the addon and it work really well, especially the object mode. I would love the display menu to be added with x-ray, wire and so on.
Also, I am not sure if i like the Apply an Clear Transform menus, at the end they are hotkeyed quite well. Anyway, awesome job so far.

Thanks.

They are, but think about new users and discoverability it provides (I’m doing this addon as a UI experiment to be potentially used in master).

It’s possible but it will use the location the user clicks in the menu, not where the mouse originally was when the menu was opened. You can achieve a different behavior only if you re-write the cursor3d operator in python (project 2d to 3d and raycast).

import bpy

class SimpleOp(bpy.types.Operator):
    bl_idname = "view3d.cursor3d_deferred"
    bl_label = "Set 3D Cursor (Deferred)"
    bl_options = {'REGISTER', 'UNDO'}
    
    def execute(self, context):
        bpy.ops.wm.call_menu(name="OBJECT_MT_simple_custom_menu")
        return {'FINISHED'}

class SimpleCustomMenu(bpy.types.Menu):
    bl_label = "Simple Custom Menu"
    bl_idname = "OBJECT_MT_simple_custom_menu"

    def draw(self, context):
        layout = self.layout

        layout.label("Click below menu item")
        layout.label("to set 3D Cursor. But note:")
        layout.label("It is placed at menu click location!")
        col = layout.column()
        col.operator_context = 'INVOKE_DEFAULT'
        col.operator("view3d.cursor3d")

def register():
    bpy.utils.register_module(__name__)

def unregister():
    bpy.utils.unregister_module(__name__)

if __name__ == "__main__":
    register()

(Run and invoke Set Cursor 3D (Deferred) operator via spacebar menu in 3D View)

0.4 Release. Changes:

  • Edit menu redone
  • Removed Mode switcher

Some of the operator names in vanilla Blender are a bit incomprehensible, so they were improved in rRMB Menu to boost discoverability (which is one of the main goals of this addon). So if you can’t find your favorite function, check if it’s not under another name.

The reasoning for removing the mode switcher: the rRMB menu introduces new functionality. Having the mode switcher in the rRMB menu would duplicate functionality. And there are pie menus incoming.

I’ll have to try the second option then.

Hi Pawel,

Didnt know you were into writing addons yourself! Hope youre having fun.

Ok, so, I personally would not go the “rewriting cursor3d” route CoDEmanX suggested.
I would create a main operator with a modal loop running indefinitely (use ‘return PASS_THROUGH’ for it to pass events to Blender after you handle them),
to monitor the mouse position (‘MOUSEMOVE’ event) and store this value the moment the user presses the right mouse button (‘RIGHTMOUSE’ event).
Then when the user chooses “Place 3D cursor” in the RMB-menu, use “context.window.cursor_warp(x, y)” to put the mouse cursor back to the coordinates you stored,
and invoke view3d.cursor3d() from there. That should work.
It has the sideeffect of moving the mouse cursor to the new 3d cursor screen position, but that might even be a beneficial side effect in my opinion.

I can code it for you if you want me to show you how in more detail; you have always been helping out bugtesting my stuff so Id be glad to return the favour.

And in the future, if you need Python coding pointers, feel free to email me about it!

And might I suggest a method for contextual behaviour based on the object or mesh element under the mouse pointer.

It is “slightly” hackish; lets call it a workaround. :smiley:

Use a modal loop as suggested in my previous post. Detect the RIGHTMOUSE event. Make a note of the list of selected objects in the scene. Invoke bpy.ops.view3d.select(extend=False, toggle=True, location=(mx, my)) on mouse coords (contained in the RIGHTMOUSE event) to select (or deselect, its all about that ‘toggle’ keyword) the object under the mouse pointer. Compare the new selected objects list to the old one. From this deduct the object just selected/deselected or None if no change. This gives you the object under the mouse. Dont forget to call bpy.ops.view3d.select() again to clean up after you.
For mesh elements make a note of “selcount = mesh.total_vert_sel + mesh.total_edge_sel + mesh.total_face_sel” (total selected mesh elements) and compare this value before and after calling bpy.ops.view3d.select(). If values are equal, the mouse pointer is not over a mesh element (cause nothing got selected/deselected). If second value is greater than the first, use bmesh and “bm.select_history[-1]” to get the last selected element (which is under the mouse pointer). Dont forget to deselect after to clean up. If new total elements is smaller, trick is to call bpy.ops.view3d.select() again first, which reselects the deselected element, and only then read out bm.select_history[-1] to get the element under the mouse pointer.

Once again, I could show you how to code it, but I suspect you might want to have a stab at it yourself first…

Hey Gert! Yeah, I try to write addons - mostly UI tweaking like this one.

Thanks for the help. I’ll try to code it like you described myself, probably fail, and then ask for assistance : )

Uh, this all sounded really cool until I realized I do all my 3d navigation with the RMB(hate using the mMMB), hehe :stuck_out_tongue: Really well implemented though, not your fault we have our own weird UI customizations :slight_smile:

Heya Pawel,

I’ve been using this for a while, it’s very nice! I wondered if it was possible to add a ‘Rename Mesh’ option. It’s a hassle to have to press N and then scroll up and down the long list looking for the Item panel, but I suppose that might need more elaborate scripting than you’re experienced with?