In order to get a grip on this stuff i ripped out what i thought was not important from
add_mesh_torus.py located in .blender\scripts\op in order to get a basic
GUI going on.
# ##### BEGIN GPL LICENSE BLOCK #####
# go read it.
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import bpy
import mathutils
from bpy.props import *
#from math import cos, sin, pi
class AddTree(bpy.types.Operator):
'''Add a tree mesh'''
bl_idname = "mesh.primitive_tree_add"
bl_label = "Add Tree"
bl_options = {'REGISTER', 'UNDO'}
# Trunk
trunk_base_radius = FloatProperty(name="Trunk Base Radius",
description="Radius of the Trunk Base",
default=1.0, min=0.1, max=5.0)
trunk_end_radius = IntProperty(name="End Radius",
description="Radius of end of the trunk",
default=50, min=1, max=100)
trunk_segments = IntProperty(name="Trunk Segments",
description="Number of segments from the base to terminator",
default=3, min=1, max=10)
trunk_num_branches = IntProperty(name="Number Trunk Branches",
description="Number of branches attached to the trunk",
default=1, min=0, max=10)
trunk_height = FloatProperty(name="Trunk Height",
description="The z location of the trunk_end",
default=6.0, min=1.0, max=13.0)
# Branch
branch_base_thickness = IntProperty(name="Branch Base Thickness",
description="Thickness of the base of the branch, as a percentage of the area it is connecting to",
default=80, min=1, max=100)
branch_length = FloatProperty(name="Standard Branch Length",
description="Used to state the modal length, other parameters provide a way to deviate from it",
default=2.0, min=0.1, max=5.0)
branch_end_thickness = IntProperty(name="Branch End Thickness",
description="Thickness of the end of the branch, as a percentage of the branch base",
default=80, min=1, max=100)
branch_subbranches = IntProperty(name="Number of sub branches",
description="Number of branches along this branch",
default=1, min=0, max=20)
branch_segments = IntProperty(name="Branch Segments",
description="Number of segments along the branch",
default=3, min=1, max=10)
branch_segment_variation = IntProperty(name="segment randomfactor",
description="The randomization factor per branch",
default=6, min=0, max=100)
# Foliage
leaf_count = IntProperty(name="Leaf quantity",
description="The number of leaves per branch",
default=10, min=0, max=200)
leaf_count_randomization = IntProperty(name="leaf randomfactor",
description="The randomization factor per branch",
default=6, min=0, max=100)
leaf_size = FloatProperty(name="Leaf Size",
description="Size of leaf using a float type",
default=1.0, min=0.1, max=3.0)
leaf_size_randomization = IntProperty(name="Leaf size randomization",
description="Percentage to deviate from modal size",
default=1, min=-20, max=20)
# def execute(self, context):
# props = self.properties
# import add_object_utils
# add_object_utils.add_object_data(context, mesh, operator=self)
# return {'FINISHED'}
def menu_func(self, context):
self.layout.operator(AddTree.bl_idname, text="Tree", icon='MESH_DONUT')
def register():
bpy.types.register(AddTree)
bpy.types.INFO_MT_mesh_add.append(menu_func)
def unregister():
bpy.types.unregister(AddTree)
bpy.types.INFO_MT_mesh_add.remove(menu_func)
if __name__ == "__main__":
register()
perhaps some brighter mind can point me to a tutorial on the GUI side,
i’m constructing the rest of the script now, some tips would be appreciated