Adding an object manually (Add/Mesh/Cone for example) gives the user the ability to set various parameters of the cone (Vertices, Radii, Depth…) interactively.
But calling bpy.ops.mesh.primitive_cone_add() doesn’t seem to give the user those same options.
Is there a way to add a cone (and other primitives) from an operator and still have it allow the user to modify those parameters of the new object?
Here’s a simple Add-On that attempts to do this, but the Cone does not offer the same parameters as when created from Add/Mesh/Cone.
bl_info = {
"version": "0.1",
"name": "Create Cone",
'author': 'Bob',
"category": "Blender Experiments"
}
import bpy
from bpy.props import *
class CREATE_OT_cone(bpy.types.Operator):
bl_idname = "create.cone"
bl_label = "Create Cone"
bl_description = ("Add a new primitive cone")
def execute(self, context):
bpy.ops.mesh.primitive_cone_add()
return{'FINISHED'}
class CreateConePanel(bpy.types.Panel):
bl_label = "Add Cone"
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
bl_category = "Add Object"
def draw(self, context):
row = self.layout.row()
row.operator("create.cone")
def register():
print ("Registering ", __name__)
bpy.utils.register_module(__name__)
def unregister():
print ("Unregistering ", __name__)
bpy.utils.unregister_module(__name__)
if __name__ == "__main__":
register()
Does this require using “invoke” or “modal” or a special return type (“RUNNING_MODAL”)?