Hi guys
Im almost copy&paste code from Interactive Tools for Blender 2.8
My test code to make a Bridge Edge Loops:
import bpy
import bmesh
class SmartConnect(bpy.types.Operator):
bl_idname = "mesh.smart_connect"
bl_label = "SmartConnect"
bl_description = "Context Sensitive Connect"
bl_options = {'REGISTER', 'UNDO'}
def smart_connect(self):
bpy.ops.mesh.bridge_edge_loops("INVOKE_DEFAULT")
def execute(self, context):
self.smart_connect()
return{'FINISHED'}
Class SmartConnect are registered in init.py file, so addon are properly installed to blender and basiсally it works.
But bpy.ops.mesh.bridge_edge_loops(“INVOKE_DEFAULT”) - make a bridge as expected but didnt show redu pop-up panel as normal operation called from Mesh menu.
Comparing to Maxivz tools, for his function CS Bevel:
class CSBevel(bpy.types.Operator):
bl_idname = "mesh.cs_bevel"
bl_label = "CS Bevel"
bl_description = "Context Sensitive Bevels and Inset"
bl_options = {'REGISTER', 'UNDO'}
def smart_hard_ops(self):
selectionMode = (tuple(bpy.context.scene.tool_settings.mesh_select_mode))
#if Vertex is selected
if selectionMode[0]:
bpy.ops.mesh.bevel('INVOKE_DEFAULT',vertex_only=True)
#if Edge is selected
elif selectionMode[1]:
bpy.ops.mesh.bevel('INVOKE_DEFAULT',vertex_only=False)
elif selectionMode[2]:
#if Face is selected
bpy.ops.mesh.inset('INVOKE_DEFAULT')
def execute(self, context):
self.smart_hard_ops()
return{'FINISHED'}
In his case bevel for face (which would be Inset operation) will properly call pop-up redu panel.