[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2588] branches/geodesic_domes/gui_pkhg .py: strut and hub are now both 'life' ; -)

Peter K.H. Gragert pkhgragert at gmail.com
Sun Nov 6 09:20:00 CET 2011


Revision: 2588
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2588
Author:   pkhg
Date:     2011-11-06 08:19:58 +0000 (Sun, 06 Nov 2011)
Log Message:
-----------
strut and hub are now both 'life' ;-)

Modified Paths:
--------------
    branches/geodesic_domes/gui_pkhg.py

Modified: branches/geodesic_domes/gui_pkhg.py
===================================================================
--- branches/geodesic_domes/gui_pkhg.py	2011-11-06 02:47:04 UTC (rev 2587)
+++ branches/geodesic_domes/gui_pkhg.py	2011-11-06 08:19:58 UTC (rev 2588)
@@ -14,35 +14,11 @@
 last_generated_object = None
 ##for Hub
 bpy.types.Scene.make_a_hub = BoolProperty(name = "HUB?", description = "make a HUB 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 = "STUT?", 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)
-bpy.types.Scene.struttype = BoolProperty(name="Type", description =  "False: nothing done", default = True)
-bpy.types.Scene.width = FloatProperty(name = "width", min = 0.001,max = 2, description="TODO", default = 0.5)
-bpy.types.Scene.height = FloatProperty(name = "height", min = 0.001,max = 2, description="TODO", default = 0.5)
-bpy.types.Scene.length = FloatProperty(name = "length", min = 0.001,max = 2, description="TODO", default = 0.5)
-bpy.types.Scene.widthtog = BoolProperty(name = "widthtog", description="TODO", default = False)
-bpy.types.Scene.heighttog = BoolProperty(name = "heighttog", description="TODO", default = False)
-bpy.types.Scene.lengthtog = BoolProperty(name = "lengthtog", description="TODO", default = False)
-#bpy.types.Scene.meshname = StringProperty(name = "meshname", description = "TODO", default = "Strut_")
-bpy.types.Scene.stretchflag = BoolProperty(name="stretchflag", description = "TODO", default = True)
+bpy.types.Scene.strut_max_number_parts = IntProperty(name = "Max nr parts",min=0,max = 1000, description = "Maximum number of v,e,f", default = 100)
 
-bpy.types.Scene.length = FloatProperty(name = "length", min = 0.001,max = 2, description="TODO", default = 0.5)
-
-bpy.types.Scene.strut_length = FloatProperty(name = "strut_lift", min = 0.001,max = 2, description="TODO", default = 0.5)
-
-bpy.types.Scene.break_quads = BoolProperty(name = "break quads", description = "break quads into tris", default = True)
-
-
-
 ##
 bpy.types.Scene.superformula_um = FloatProperty(name = 'um', min = 0, soft_min=0.1, soft_max=5,max = 10, default =  3)
 bpy.types.Scene.superformula_un1 = FloatProperty(name = 'un1', min = 0, soft_min=0.1, soft_max=5,max = 20, default =  1)
@@ -152,34 +128,10 @@
         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")
-            row.prop(sce,"height")
-            row = layout.row()
-            row.prop(sce,"length")
-            row.prop(sce,"widthtog")
-            row = layout.row()
-            row.prop(sce,"heighttog")
-            row.prop(sce,"lengthtog")
-            row = layout.row()
-            row.prop(sce,"stretchflag")
-            row.prop(sce,"strut_length")
-            col = layout.column()
+            col.prop(sce,"strut_max_number_parts")
             col.label("Make Strut it with selected parametes")
             col.operator(AddStrut.bl_idname,"Try a Strut")
         else:
@@ -356,7 +308,7 @@
         created_vefm_mesh_values.extend(geodesic_choice)
         created_vefm_mesh_values.extend(tmp)
 #PKHG werkt        created_vefm_mesh_values = [geodesic_choice,tmp]
-        print("\n***DBG***>>>>>>>> geodesic created_vefm_mesh_values =",created_vefm_mesh_values)
+#PKHG_DBG        print("\n***DBG***>>>>>>>> geodesic created_vefm_mesh_values =",created_vefm_mesh_values)
         dual = False #PKHG TODO 31-10-2011
         if dual:
             if frequency == 1 and not(which_geodesic == 'Icosahedron'):
@@ -891,80 +843,122 @@
     bl_idname = "mesh.make_strut"
     bl_label = "Generate Strut"
     bl_options = {'REGISTER','UNDO'}
+
+    strut_struttype = BoolProperty(name="Type", description =  "False: nothing done", default = True)
+    strut_width = FloatProperty(name = "width", min = 0.001,max = 4, description="TODO", default = 0.5)
+    strut_height = FloatProperty(name = "height", min = 0.001,max = 4, description="TODO", default = 0.5)
+    strut_length = FloatProperty(name = "length", min = 0.001,max = 4, description="TODO", default = 0.5)
+    strut_widthtog = BoolProperty(name = "widthtog", description="TODO", default = False)
+    strut_heighttog = BoolProperty(name = "heighttog", description="TODO", default = False)
+    strut_lengthtog = BoolProperty(name = "lengthtog", description="TODO", default = False)
+#    strut_meshname = StringProperty(name = "meshname", description = "TODO", default = "Strut_")
+    strut_stretchflag = BoolProperty(name="stretchflag", description = "TODO", default = True)
+    strut_length = FloatProperty(name = "length", min = 0, max = 10, description="TODO", default = 1)
+    strut_lift = FloatProperty(name = "strut_lift", min = -10, max = 10, description="lift the object", default = 0)
+    strut_break_quads = BoolProperty(name = "break quads", description = "break quads into tris", default = False)
     
     @classmethod
     def poll(cls,context):
-        return context.active_object and context.active_object.type == 'MESH'
+        try:
+            res = bpy.data.objects['strut']        
+        except:
+            res = None
+        return res
 
+    def draw(self,context):
+        layout = self.layout
+        col = layout.column()
+#        col.prop(self,"strut_max_number_parts")
+        col.prop(self,"strut_width")
+        col.prop(self,"strut_height")
+        col.prop(self,"strut_length")
+        col.prop(self,"strut_widthtog")
+        col.prop(self,"strut_heighttog")
+        col.prop(self,"strut_lengthtog")
+        col.prop(self,"strut_lift")
+        col.prop(self,"strut_break_quads")
     def execute(self,context):
  
-        struttype = bpy.context.scene.struttype
-        width = bpy.context.scene.width
-        height = bpy.context.scene.height
-        length = bpy.context.scene.length
-        widthtog = bpy.context.scene.widthtog
-        heighttog = bpy.context.scene.heighttog
-        lengthtog = bpy.context.scene.lengthtog
-
-        stretchflag = bpy.context.scene.stretchflag
-        strut_lift = bpy.context.scene.strut_length
-        break_quads = True
-        
-        print("\n-------------- strut tried")
-        obj = context.active_object #PKHGTODO must be mesh!
+        struttype = self.strut_struttype
+        width = self.strut_width
+        height = self.strut_height
+        length = self.strut_length
+        widthtog = self.strut_widthtog
+        heighttog = self.strut_heighttog
+        lengthtog = self.strut_lengthtog
+        stretchflag = self.strut_stretchflag
+        strut_lift = self.strut_lift
+        break_quads = self.strut_break_quads
+#        print("\n-------------- strut tried")
+        obj = bpy.data.objects['strut']
         nr_parts = len(obj.data.vertices)  + len(obj.data.faces)
-        allowed_parts = context.scene.max_number_parts
+        allowed_parts = context.scene.strut_max_number_parts
         if nr_parts > allowed_parts:
             message = "too much vertices and faces,(now) allowed: " + str(allowed_parts) + " in your obj.: " + str(nr_parts) 
             print("\n***Error*** your object has too much parts: ", nr_parts, " now allowed: " , allowed_parts )
             self.report(set(['ERROR']), message)
             return {'FINISHED'}
-#PKHGDBG        print("\n-----------------------------------------obj", obj, obj.name)
-        name = obj.name = 'strut_obj'
-        strut_object = vefm_259.importmesh(name,True)# PKHG??? TODO self.break_quads)
+#PKH_GDBG        print("\n-----------------------------------------obj", obj, obj.name)
+        name = obj.name = 'strut'
+        strut_object = vefm_259.importmesh(name,break_quads)# PKHG??? TODO self.break_quads)
 #PKHG if needed DBG        check_contains(strut_object,"imported",True)
         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)
-#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_label = "Generate HUB"
     bl_options = {'REGISTER','UNDO'}
-    
+
+    hub_width = FloatProperty(name = "width", min = 0.001,max = 2, description="TODO", default = 1)
+    hub_height = FloatProperty(name = "height", min = 0.001,max = 2, description="TODO", default = 1)
+    hub_length = FloatProperty(name = "length", min = 0.001,max = 2, description="TODO", default = 1)
+    hub_widthtog = BoolProperty(name = "widthtog", description="TODO", default = False)
+    hub_heighttog = BoolProperty(name = "heighttog", description="TODO", default = False)
+    hub_lengthtog = BoolProperty(name = "lengthtog", description="TODO", default = False)
+    '''    
     @classmethod

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list