[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2585] branches/geodesic_domes/gui_pkhg .py: hub possibility added
Peter K.H. Gragert
pkhgragert at gmail.com
Fri Nov 4 11:34:18 CET 2011
Revision: 2585
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2585
Author: pkhg
Date: 2011-11-04 10:34:18 +0000 (Fri, 04 Nov 2011)
Log Message:
-----------
hub possibility added
Modified Paths:
--------------
branches/geodesic_domes/gui_pkhg.py
Modified: branches/geodesic_domes/gui_pkhg.py
===================================================================
--- branches/geodesic_domes/gui_pkhg.py 2011-11-04 10:33:51 UTC (rev 2584)
+++ branches/geodesic_domes/gui_pkhg.py 2011-11-04 10:34:18 UTC (rev 2585)
@@ -11,6 +11,16 @@
#globals
created_vefm_mesh_values = None
+##for Hub
+bpy.types.Scene.make_a_hub = BoolProperty(name = "Make a hub?", description = "make a strut out of an selected mesh", default = False)
+bpy.types.Scene.hub_width = FloatProperty(name = "width", min = 0.001,max = 2, description="TODO", default = 1)
+bpy.types.Scene.hub_height = FloatProperty(name = "height", min = 0.001,max = 2, description="TODO", default = 1)
+bpy.types.Scene.hub_length = FloatProperty(name = "length", min = 0.001,max = 2, description="TODO", default = 1)
+bpy.types.Scene.hub_widthtog = BoolProperty(name = "widthtog", description="TODO", default = False)
+bpy.types.Scene.hub_heighttog = BoolProperty(name = "heighttog", description="TODO", default = False)
+bpy.types.Scene.hub_lengthtog = BoolProperty(name = "lengthtog", description="TODO", default = False)
+
+
## for Strut
bpy.types.Scene.make_a_strut = BoolProperty(name = "Make a strut?", description = "make a strut out of an selected mesh", default = False)
bpy.types.Scene.max_number_parts = IntProperty(name = "Max nr parts",min=0,max = 1000, description = "Maximum number of v,e,f", default = 100)
@@ -124,7 +134,7 @@
'7':'Apply sform',
}
result = posible_types[chosen_type]
- print("\n***INFO*** >>>>>chosen type =",result)
+#PKHG print("\n***INFO*** >>>>>chosen type =",result)
return result
class Geodesic_Domes_panel(bpy.types.Panel):
@@ -136,10 +146,25 @@
def draw(self,context):
sce = context.scene
layout = self.layout
- col = layout.column()
- col.prop(sce,"make_a_strut")
- if sce.make_a_strut:
+ row = layout.row()
+ row.prop(sce,"make_a_hub")
+ row.prop(sce,"make_a_strut")
+ if sce.make_a_hub:
col = layout.column()
+ col.label("'hub_to_use' object needed!")
+ row = layout.row()
+ row.prop(sce,"hub_width")
+ row.prop(sce,"hub_height")
+ row = layout.row()
+ row.prop(sce,"hub_length")
+ row.prop(sce,"hub_widthtog")
+ row = layout.row()
+ row.prop(sce,"hub_heighttog")
+ row.prop(sce,"hub_lengthtog")
+ col = layout.column()
+ col.operator(AddHub.bl_idname,"make it so")
+ elif sce.make_a_strut:
+ col = layout.column()
col.prop(sce,"max_number_parts")
row = layout.row()
row.prop(sce,"width")
@@ -157,6 +182,7 @@
col.label("Make Strut it with selected parametes")
col.operator(AddStrut.bl_idname,"Try a Strut")
else:
+ col = layout.column()
col.label(" ")
col.label("sform parameters")
row = layout.row()
@@ -880,20 +906,17 @@
vturn = sce.superformula_vturn
utwist = sce.superformula_utwist
vtwist = sce.superformula_vtwist
- superformparam = [um,un1,un2,un3,ua,ub,vm,vn1,vn2,\
- vn3,va,vb,uact,vact,\
- uturn*pi,vturn*pi,\
- utwist,vtwist]
+ superformparam = [um,un1,un2,un3,ua,ub,vm,vn1,vn2,vn3,va,vb,\
+ uact,vact,uturn*pi,vturn*pi,utwist,vtwist]
class AddStrut(bpy.types.Operator):
bl_idname = "mesh.make_strut"
bl_label = "Generate Strut"
bl_options = {'REGISTER','UNDO'}
-
@classmethod
def poll(cls,context):
- return context.active_object
+ return context.active_object and context.active_object.type == 'MESH'
def execute(self,context):
@@ -925,6 +948,46 @@
strut = forms_259.strut(strut_object,struttype,width,height,length,widthtog,heighttog,lengthtog,name,stretchflag,strut_lift)
vefm_259.vefm_add_object(strut)
bpy.context.active_object.location = (0,0,0)
- bpy.context.scene.objects.active = obj
- obj.select = True
+#PKHG??? bpy.context.scene.objects.active = obj
+#PKHG??? obj.select = True
return {'FINISHED'}
+
+class AddHub(bpy.types.Operator):
+ bl_idname = "mesh.make_hub"
+ bl_label = "Generate Strut"
+ bl_options = {'REGISTER','UNDO'}
+
+ @classmethod
+ def poll(cls,context):
+ res = False
+ hub_obj = bpy.data.objects['hub_to_use']
+ if hub_obj:
+ res = context.active_object and context.active_object.type == 'MESH'
+ else:
+ res = False
+ return res
+
+
+
+ def execute(self,context):
+ objlist = [obj.name for obj in bpy.data.objects]
+ if 'hub_to_use' in objlist:
+ hubtype = True
+ width = bpy.context.scene.hub_width
+ height = bpy.context.scene.hub_height
+ length = bpy.context.scene.hub_length
+ widthtog = bpy.context.scene.hub_widthtog
+ heighttog = bpy.context.scene.hub_heighttog
+ lengthtog = bpy.context.scene.hub_lengthtog
+ break_quads = False
+
+ print("\n-------------- hubtried")
+ base_name = context.active_object.name
+ hub_obj = vefm_259.importmesh(base_name,break_quads)
+ hub = vefm_259.hub(hub_obj, hubtype,width,height,length,widthtog,heighttog,lengthtog,'hub_to_use')
+ vefm_259.vefm_add_object(hub)
+ bpy.context.active_object.location = (0,0,0)
+ else:
+ message = "make a mesh with name: hub_to_use"
+ self.report(set(['ERROR']),message)
+ return {'FINISHED'}
More information about the Bf-extensions-cvs
mailing list