How do I include a new 'Realistic Stone' item in the Add menu, Mesh submenu in this script?
bl_info = {
"name": "Realistic Stone",
"author": "",
"version": (0, 0, 1),
"blender": (2, 79, 0),
"location": "VIEW3D > ADD > Mesh",
"description": "Realistic Stone",
"warning": "",
"wiki_url": "",
"tracker_url": "",
"category": "Add Mesh"}
# Imports
import bpy
from bpy import context
import bmesh
class RealisticStoneStone(bpy.types.Operator):
def execute(self, context):
"""Realistic Stone"""
bl_idname = "mesh.realistic_stone_add"
bl_label = "Realistic Stone"
bl_options = {'REGISTER', 'UNDO', 'PRESET'}
# Mesh - Create Cubic
bpy.ops.mesh.primitive_cube_add(location=(0.00, 0.00, 1.00))
bpy.context.object.scale = (1, 1, 1)
bpy.ops.object.select_all(action='TOGGLE')
Cube = bpy.context.object
Cube.name = 'RealisticStone'
Object = Cube.name = 'RealisticStone'
bpy.context.object.data.name = "RealisticStone"
# Modifier - Multiresolution
bpy.ops.object.modifier_add(type='MULTIRES')
bpy.ops.object.multires_subdivide(modifier="Multires")
bpy.ops.object.multires_subdivide(modifier="Multires")
bpy.ops.object.multires_subdivide(modifier="Multires")
bpy.ops.object.multires_subdivide(modifier="Multires")
bpy.context.object.modifiers["Multires"].show_expanded = False
# Modifier - Displace 1
bpy.ops.object.modifier_add(type='DISPLACE')
bpy.context.object.modifiers["Displace"].strength = 0.5
bpy.ops.texture.new()
bpy.data.textures["Texture.001"].type = 'VORONOI'
bpy.data.textures["Texture.001"].noise_scale = 1
bpy.context.object.modifiers["Displace"].show_expanded = False
# Modifier - Displace 2
bpy.ops.object.modifier_add(type='DISPLACE')
bpy.context.object.modifiers["Displace"].strength = 0.25
bpy.ops.texture.new()
bpy.data.textures["Texture.002"].type = 'CLOUDS'
bpy.data.textures["Texture.002"].noise_depth = 7
bpy.context.object.modifiers["Displace.001"].show_expanded = False
# Modifier - Displace 3
bpy.ops.object.modifier_add(type='DISPLACE')
bpy.context.object.modifiers["Displace"].strength = 0.01
bpy.ops.texture.new()
bpy.data.textures["Texture.003"].type = 'NOISE'
bpy.context.object.modifiers["Displace.002"].show_expanded = False
def invoke(self, context, event):
return self.execute(context)
def draw_item(self, context):
self.layout.operator_context = 'INVOKE_DEFAULT'
self.layout.operator(RealisticStone.bl_idname, text="Realistic Stone", icon="PLUGIN")
def register():
bpy.utils.register_module(__name__)
bpy.types.INFO_MT_mesh_add.append(draw_item)
def unregister():
bpy.utils.unregister_module(__name__)
bpy.types.INFO_MT_mesh_add.remove(draw_item)
if __name__ == '__main__':
register()