I create some what a simple mesh Generator still working on it. I added few menus in the tool panel on the left side. Show in object mode.
I was going to work on it more of it. But I got to work on other projects.
import bpy
import mathutils
from bpy.props import *
from mathutils import Vector
Vector = mathutils.Vector
buildingmodels = []
floors = []
sidepaneltype = []
sidepaneltype.append(("0","Front","front"))
sidepaneltype.append(("1","Back","back"))
sidepaneltype.append(("2","Right","right"))
sidepaneltype.append(("2","Left","left"))
sidepaneltype.append(("2","All","all"))
bpy.types.Scene.wallside = EnumProperty(
name="Panel Side",
description="",
items = sidepaneltype, default = '0')
paneltype = []
paneltype.append(("0","Window","window"))
paneltype.append(("0","Door","door"))
paneltype.append(("0","Roof","roof"))
paneltype.append(("0","Ground","ground"))
bpy.types.Scene.buildingpaneltype = EnumProperty(
name="Panel Type",
description="",
items = paneltype, default = '0')
bpy.types.Scene.cureentbuildingfloors = EnumProperty(
name="Floors",
description="",
items = [],
default = '0')
class Buildings(bpy.types.IDPropertyGroup):
name = StringProperty(name="name", description="", maxlen=64, default="")
class BuildingsSettings(bpy.types.IDPropertyGroup):
floors = CollectionProperty(type=Buildings, name="Floor List", description="")
floors_index = IntProperty(name="Floor Index", description="", default=-1, min=-1, max=65535)
class floor:
name = ""
side = []
verts = []
faces = []
class VIEW3D_PT_BuildingGenerator(bpy.types.Panel):
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
bl_label = "Building Gen. Tool"
meshname = "building"
objectname = "building"
bpy.types.Scene.buildingwidth = IntProperty(name="width", description="", default=1, min=0, max=300)
bpy.types.Scene.buildinglength = IntProperty(name="length", description="", default=1, min=0, max=300)
bpy.types.Scene.buildingheight = IntProperty(name="height", description="", default=1, min=0, max=300)
bpy.types.Scene.buildingwalls = IntProperty(name="Wall(s)", description="", default=1, min=1, max=300)
bpy.types.Scene.buildingfloors = IntProperty(name="Floor(s)", description="", default=1, min=1, max=300)
@classmethod
def poll(cls, context):
return context.active_object
def draw(self, context):
layout = self.layout
scene = context.scene
buildingstemplates = scene.buildingstemplates
box1 = layout.box()
box1.operator("object.BuiltBuilding")
box1.operator("object.DestoryBuilding")
for obj in bpy.data.objects:
if obj.type == 'MESH' and obj.name == self.objectname:
box2 = layout.box()
box2.prop(scene,"buildingfloors")
box2.operator("object.CreateBuildingFloors")
layout.template_list(buildingstemplates, "floors", buildingstemplates, "floors_index", rows=4)
if buildingstemplates.floors_index > -1:
box4 = layout.box()
box4.prop(scene,"wallside")
box4.prop(scene,"buildingpaneltype")
box4.operator("object.CreatePanel")
box4.operator("object.CloneBuildingFloors")
box4.operator("object.RemoveFloor")
class OBJECT_OT_BuiltBuilding(bpy.types.Operator):
global exportmessage
bl_idname = "OBJECT_OT_BuiltBuilding"
bl_label = "Create"
__doc__ = ""
def invoke(self, context, event):
scene = context.scene
buildmeshbuilding(context)
return {'FINISHED'}
class OBJECT_OT_DestoryBuilding(bpy.types.Operator):
global exportmessage
bl_idname = "OBJECT_OT_DestoryBuilding"
bl_label = "Delete"
__doc__ = ""
def invoke(self, context, event):
scene = context.scene
DestoryBuilding(context)
return {'FINISHED'}
class OBJECT_OT_CreateBuildingFloors(bpy.types.Operator):
global exportmessage
bl_idname = "OBJECT_OT_CreateBuildingFloors"
bl_label = "Create Floor(s)"
__doc__ = ""
def invoke(self, context, event):
scene = context.scene
print("Creating number of " ,scene.buildingfloors ," floor(s)")
createfloors(context,scene.buildingfloors)
return {'FINISHED'}
class OBJECT_OT_CreatePanel(bpy.types.Operator):
global exportmessage
bl_idname = "OBJECT_OT_CreatePanel"
bl_label = "Create Panel"
__doc__ = ""
def invoke(self, context, event):
scene = context.scene
BuildModelMesh()
return {'FINISHED'}
class OBJECT_OT_RemoveFloor(bpy.types.Operator):
global exportmessage
bl_idname = "OBJECT_OT_RemoveFloor"
bl_label = "Remove Floor"
__doc__ = ""
def invoke(self, context, event):
scene = context.scene
buildingstemplates = context.scene.buildingstemplates
index = buildingstemplates.floors_index
floors.pop(index)
updatebuildingfloorlist(context)
BuildingConfigs()
return {'FINISHED'}
class OBJECT_OT_CloneBuildingFloors(bpy.types.Operator):
global exportmessage
bl_idname = "OBJECT_OT_CloneBuildingFloors"
bl_label = "Clone Floor"
__doc__ = ""
def invoke(self, context, event):
scene = context.scene
updatebuildingfloorlist(context)
return {'FINISHED'}
Part 1