[Addon] Wazou's RMB Pie Menu

Yes it’s possible, you need to copy the code for the pie and convert it.

It’s not so complicated.

Look my code :wink:

Just wanted to say thanks for sharing your menu.

I ended up changing my mouse selection from blender’s default to LMB selection to work with it xD Although I have left it at alt+RMB, keeping the cursor at sigcle-click RMB. Woks good with the shift+RMB Retopo pie, I found.

Cheers!

A option to change the shortcuts will be very good :wink:

I just modified a bit to get more options:


bl_info = {
    "name": "Addon Create Hole",
    "author": "Cédric Lepiller",
    "version": (0, 2),
    "blender": (2, 71, 0),
    "location": "View3D > Tools",
    "description": "This Operator create a hole on a selection",
    "warning": "",
    "wiki_url": "",
    "category": "Tools"}
    
import bpy


#Create Hole
class CreateHole(bpy.types.Operator):                  
    """This Operator create a hole on a selection"""                   
    bl_idname = "object.createhole"                     
    bl_label = "Create Hole"   
    bl_options = {'REGISTER', 'UNDO'}     

    @classmethod                                     
    def poll(cls, context):                         
        return context.active_object is not None 

    divide = bpy.props.IntProperty(name="Subdivide", description="How often?", default=0, min=0, soft_max=5, step=1)  
    size = bpy.props.IntProperty(name="Size", description="How often?", default=1, min=1, soft_max=10, step=1)  
    inset = bpy.props.IntProperty(name="Inset", description="How often?", default=1, min=1, soft_max=10, step=1)  
    close = bpy.props.BoolProperty(name="Close Hole",  description="close or open Hole", default=True)  

    def execute(self, context):                     

        for i in range(self.divide):
            bpy.ops.mesh.subdivide(number_cuts=1)
              
        bpy.ops.mesh.extrude_region_move()

        for i in range(self.size):        
            bpy.ops.transform.resize(value=(0.8, 0.8, 0.8))

        bpy.ops.mesh.looptools_circle() 

        bpy.ops.mesh.extrude_region_move()

        for i in range(self.inset):
            bpy.ops.transform.resize(value=(0.8, 0.8, 0.8))

        for i in range(self.close):
            bpy.ops.mesh.delete(type='FACE')
        return {'FINISHED'}
    
##################################


#Class Panel
class PanelCreateHole(bpy.types.Panel):
    bl_label = "Create Hole"
    bl_idname = "OBJECT_PT_Create_hole"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'
    bl_category = "Tools" 


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


        layout.operator("object.createhole")




def register():
    bpy.utils.register_class(PanelCreateHole)
    bpy.utils.register_class(CreateHole)


def unregister():
    bpy.utils.unregister_class(PanelCreateHole)
    bpy.utils.unregister_class(CreateHole)


if __name__ == "__main__":
    register()    

(…need Looptools Addon)

Nice !

I think we could also add those parameters with a modal and mouse event, for example, X direction =size, Y direction = Inset.

I will add this code to my RMB pie menu

If nothing is selected > the code adds an object to the cursor
If a mesh is selected > the code adds an object to his location
If face(s) are selected > the code adds object(s) to the location of the faces an use their orientation

http://pitiwazou.com/screenshots/2015-11-24_10-07-16.gif

http://pitiwazou.com/screenshots/2015-11-24_00-41-47.gif

http://pitiwazou.com/screenshots/2015-11-24_01-20-55.gif

That works with the orientation non applied and if the mesh is parented ^^

http://pitiwazou.com/screenshots/2015-11-24_11-56-25.gif

This is really great… thank you.

Looks great! , I have been thinking about something like this. Great work!

I added an automatic selection to scale the inserted meshes.

http://pitiwazou.com/screenshots/2015-11-24_14-03-37.gif

http://pitiwazou.com/screenshots/2015-11-25_00-02-40.gif

Great!
In combination with your: add object with fix value of vertices 4/6/8/10…etc., will be a hugh timesaver.
Or do you want to make the primitive changeable like the dafault one?

Yes I will add those custom primitives.

Blender v2.76b

v0.2.2, downloaded from https://github.com/pitiwazou/Scripts-Blender/tree/Older-Scripts

IndentationError: expected an indented block

Traceback (most recent call last):
  File "/Applications/blender-2.76b-OSX_10.6-x86_64/blender.app/Contents/MacOS/../Resources/2.76/scripts/modules/addon_utils.py", line 324, in enable
    mod = __import__(module_name)
  File "/Users/knightknight/Library/Application Support/Blender/2.76/scripts/addons/Wazou_RMB_Pie_Menu.py", line 969
    pie.operator("object.subsurf2", text="Add Subsurf", icon='MOD_SUBSURF')
      ^
IndentationError: expected an indented block

Fixed, thx :wink:

Found another one…

Traceback (most recent call last):
  File "/Applications/blender-2.76b-OSX_10.6-x86_64/blender.app/Contents/MacOS/../Resources/2.76/scripts/modules/addon_utils.py", line 324, in enable
    mod = __import__(module_name)
  File "/Users/knightknight/Library/Application Support/Blender/2.76/scripts/addons/Wazou_RMB_Pie_Menu.py", line 1076
    pie.operator("object.subsurf2", text="Add Subsurf", icon='MOD_SUBSURF')
      ^
IndentationError: expected an indented block

Same code, same error, sorry :frowning:

I fixed it.

No problem pitiwazou, letting you know about the bugs is the least I could do! All working :slight_smile:

Awesome, anyway to change it to Left mouse button?

Open the sxcript it’s at the bottom in the keymaps.