rRMB Menu

add-ons

(PLyczkowski) #1

Hey, I am creating an RMB Menu addon, as an UI experiment, and maybe it will turn out to be handy.

You can download the current version here: https://drive.google.com/file/d/0B8V1o1Fl0ub1YllmT3pURDY5RHM/edit?usp=sharing

Here it is on Github (Help wanted!) - https://github.com/PLyczkowski/rRMB

The menu makes most sense when you have Blender set up for LMB to select.


21.05.2014 - Not everything is functioning at the moment, because I have insufficient skill to do some of the coding. For instance, first entry is “Place 3D Cursor”, but the operator works only when you actually click on the 3D View. So I guess it needs a way to store the mouse position when you invoke the RMB, and then use it when you choose “Place 3D Cursor”.

Also, I would like to place some of the content from the Sculpt/Texture Paint/Weight Paint/Vertex Paint toolbars into the menu, and I have no idea how to do that. It seems to be possible, as can be seen here - http://youtu.be/nasivDl6T4g?t=12s

Any help is appreciated.

27.05.2014 - 0.2 Release. Features added:

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

03.06.2014 - 0.3 Release. Changes:

  • Added Copy and Paste Object
  • Added Move Origin submenu
  • Added Object Data submenu
  • Generally improved Object Mode menu
  • Added Add Object entries when nothing is selected, as @pitiwazou suggested.

11.06.2014 - 0.4 Release. Changes:

  • Edit menu redone
  • Removed Mode switcher

24.07.2014 - 0.5 Release. Added:

  • Move Origin menu in Edit mode

       <img src="/uploads/default/original/4X/1/8/0/180db95c6f9abcfd7de5923f22b815ff87f7f95d.png" width="468" height="106"><br/>
    
  • Separate entry in Object mode

       <img src="/uploads/default/original/4X/2/5/6/2562536929e38dd8caf3d348fccea536584b3747.png" width="671" height="123"><br/>
    

12.08.2014 - 0.6 Release. Added:

  • Node Editor RMB menu - big thanks to Diego Gangl (Januz) for this.

When no node is selected:

When one or more nodes are selected:

  • Added Align Orientation to Face in Edit Mode > rRMB > Move Origin/Orientation:

https://dl.dropboxusercontent.com/s/vpuup392qb8lh7j/shot_140812_143936.gif

09.06.2015 - 0.62 Release. Changes:

  • Align Orientation to Face is now more appropriately named Align Orientation to Selection.
  • Fixed an error with Align Orientation to Selection that appeared when the object was on a layer other than 1.

(Januz) #2

Cool idea! It’s time to start working on that LMB select again :slight_smile: Suggestions:

  • Add a GPL license header at the top. Usually having no header means full copyright (all rights reserved). You can copy it from any addon.
  • Put this on Github, so we can do pull requests, patches, track issues, etc.

import bpy 
from bpy import *

You don’t need both, leave import bpy and include “bpy.” before all methods/properties that are from the bpy module.

You can check for areas using bpy.context.area.type. Here’s the list of type in the docs: http://www.blender.org/documentation/blender_python_api_2_70_5/bpy.types.Area.html#bpy.types.Area.type


if bpy.context.area.type == "VIEW_3D":
        #Do 3dView stuff

I’d also suggest removing bl_idname in the rRMB class and set bl_labels to something descriptive.

Edit: Best practices from the docs http://www.blender.org/documentation/blender_python_api_2_69_1/info_best_practice.html


(PLyczkowski) #3

@Januz - Thx, on it.


(xrg) #4

I’m not familiar enough with Blender’s Python api to answer any of your questions, but just throwing in my support of this.


(riveter) #5

As a left mouse button user, this is great functionality. I really like being able to quickly place the 3D cursor with the right mouse button.

It would be really cool if you could add Set Origin (ctrl-alt-shift-c).

Set Origin is in the Quick Tools addon. So RMB Menu and Quick Tools is a great combination. I’ve been using it all morning and it’s a major productivity enhancer.


(PLyczkowski) #6

Added GPL and it’s now on Github - https://github.com/PLyczkowski/rRMB

@xrg Thanks.
@riveter Origin commands are under Transform for now.


(swene) #7

Is RMB menu context sensitive? Or is it like quicktools by JonathanW (where you press a shortcut an a menu with handy tools pops up)?


(PLyczkowski) #8

@swene It’s only Mode-sensitive for now.


(Pitiwazou) #9

Really great Addon ! :wink:

The move to Layer dos not work.


(bluecd) #10

Dzieki/Thanx a lot ! Finally sbdy had enough and created most useful feature for the common tasks…


(PLyczkowski) #11

Thx, noted.


(holyenigma74) #12

this is cool i like it,
maybe for edit mode adding recalculate normals and remove doubles.


(bluecd) #13

There is already: under [SPECIALS] item


(burnin) #14

Finally. Glad to see this.

Q: Can this menu (addon) work for other shortcuts? Or be custom tailored?
ie. I’m in Edit mode. Pressing ‘symbol’ (as RMC) opens a menu for pre-selected or pre-defined tools which have another symbol assigned to activate it. In such a way more shortcuts would be possible with visual feedback.
Thank you.

PS
Or how & where could i learn to create such menus/panels/tabs?


(Pitiwazou) #15

You can find two tutorials on the blender cookie web site.

It’s not really complicated to make such menu, but it’s a good idea to change the right clic for something more usefull.


(PLyczkowski) #16

I’m using the provided templates, the existing UI python code (RMB on GUI element>Edit Source), existing addons, tutorials and documentation.


(Pitiwazou) #17

Why not Add the Add menu on the Right clic when the scene is empty ?


Or something like that to be faster.


And Why not add a set origin under the Move 3D cursor ?


(PLyczkowski) #18

@@pitiwazou Add menu options would be great with context sensitive RMB menu - click on object and it displays what can you do with it, click on empty space and it displays what you can add there.


(Tommy5) #19

Hi Pawel,
i have try to do RMB menu addon for 2.5.7…
it is actually modified dynamic space bar script.
It works… but it does not unregister.

I guess i was stuck with keymap stuff, it automatically enables Left select and double-click to set 3d cursor.

I hope that it can help you, or improve your script.
Here is it:
http://www.tommy5.net/blender/right_click_context_menu.py


(BaRe) #20

that’s a very cool addon initiative, i agree with pitiwazou, those menus will greatly improve the workflow and for sure, new user that comes from commercial packages.