[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2749] branches/geodesic_domes/ geodesic_domes/third_domes_panel.py: A merge with my local version (PKHG) is done, the changes of meta-androcto should not be lost.

Peter K.H. Gragert pkhgragert at gmail.com
Wed Dec 7 07:53:25 CET 2011


Revision: 2749
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2749
Author:   pkhg
Date:     2011-12-07 06:53:15 +0000 (Wed, 07 Dec 2011)
Log Message:
-----------
A merge with my local version (PKHG) is done, the changes of meta-androcto should not be lost.

to be easy able to make shapekeys, intermediate info is written to a file
the write statement is already included the read is done but not yet
built in, will follow soon (after today probably).

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

Modified: branches/geodesic_domes/geodesic_domes/third_domes_panel.py
===================================================================
--- branches/geodesic_domes/geodesic_domes/third_domes_panel.py	2011-12-07 00:22:02 UTC (rev 2748)
+++ branches/geodesic_domes/geodesic_domes/third_domes_panel.py	2011-12-07 06:53:15 UTC (rev 2749)
@@ -21,6 +21,25 @@
 basegeodesic = None
 imported_hubmesh_to_use = None
 ########global end######
+def write_object(filename = "c://tmp//tmp_geodesic"):
+    file = open(filename, "w", encoding="utf8", newline="\n")
+    fw = file.write
+    me_verts  = bpy.context.active_object.data.vertices
+    fw('verts = [\n')
+    for v in me_verts:
+        fw('(%.6f,%.6f,%.6f),\n' % v.co[:])
+    fw("]\nfaces = [\n")
+    me_faces = bpy.context.active_object.data.faces
+    for f in me_faces:
+        nr_vertices = len(f.vertices)
+        if nr_vertices  == 3:
+            fw('(%d,%d,%d),\n' % f.vertices[:])
+        elif nr_vertices == 4:
+            fw('(%d,%d,%d,%d),\n' % f.vertices[:])
+    fw("]\n")
+    file.close()
+
+
 #PKHG checking objects
 def check_contains(cl,name , print_value = True):
     dir_class = dir(cl)
@@ -69,6 +88,14 @@
     bl_idname = "mesh.generate_geodesic_dome"
     bl_description = "Create object dependent on selection"
     bl_options = {'REGISTER','UNDO'}
+#PKHG for shapkeys try to make a copy of the actual object!
+    instant_copy = BoolProperty(name = "Instant Copy", description = "copy THIS object",\
+                                default = False)
+    instant_copy_filename = StringProperty(name = "prefix temp. filename", \
+         description = "needed to save inbetween mesh for shapekeys",\
+                        default = "c://tmp//tmp_geodesic")
+    instant_copy_counter = IntProperty(name = "tmp counter",
+       description = "to save several files" , default = 0)
 
     mainpages = EnumProperty(
     name="Menu",
@@ -370,7 +397,14 @@
     def draw(self,context):
         sce = context.scene
         layout = self.layout
-        col = layout.column()
+        row = layout.row()
+        row.label("to save a copy NOW:")
+        row.prop(self,'instant_copy')
+        row = layout.row()
+        row.prop(self,"instant_copy_counter")
+        row.prop(self,"instant_copy_filename")
+        
+        col = layout.column()        
         col.prop(self,"mainpages")
         which_mainpages = self.mainpages
         if which_mainpages == 'Main':
@@ -423,7 +457,17 @@
                 row.prop(self, "vpart")
                 row = layout.row()
                 row.prop(self, "ugap")
+                row.prop(self, "vgap")
                 row = layout.row()
+                row.prop(self, "uphase")
+                row.prop(self, "vphase")
+                row = layout.row()
+                row.prop(self, "uexp")
+                row.prop(self, "vexp")
+                row = layout.row()
+                row.prop(self, "usuper")
+                row.prop(self, "vsuper")
+                row = layout.row()
                 row.prop(self, "vgap")
                 row = layout.row()
 #                row.prop(self, "uphase")
@@ -668,6 +712,8 @@
                 mesh = vefm_259.mesh()                
                 vefm_259.finalfill(basegeodesic,mesh) #always! for hexifiy etc. necessarry!!!                     
                 vefm_259.vefm_add_object(mesh)
+#PKHG_TEST                if self.instant_copy:                                         
+                    
                 last_generated_object = context.active_object
                 last_generated_object.location  = (0,0,0)
                 context.scene.objects.active = last_generated_object
@@ -836,6 +882,20 @@
                 obj = bpy.data.objects[-1]
                 obj.name = self.fmeshname
                 obj.location = (0,0,0)
+        if self.instant_copy:
+            self.instant_copy = False
+            print("try to save data")
+            tmp = self.instant_copy_filename + str(self.instant_copy_counter) + ".txt"
+            try:
+                write_object(tmp)
+                message = tmp + " WRITTEN"
+            except:
+                message = tmp + " FAILED"
+            context.scene.error_message = message
+            bpy.ops.object.dialog_operator('INVOKE_DEFAULT')
+    
+#PKHG_INFO the next lines do not w            
+#            bpy.ops.object.duplicate_move()
         return {'FINISHED'}
 
     def invoke(self, context, event):



More information about the Bf-extensions-cvs mailing list