[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29168] branches/soc-2010-leifandersen: 1.

Leif Andersen leif.a.andersen at gmail.com
Wed Jun 2 22:32:07 CEST 2010


Revision: 29168
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29168
Author:   leifandersen
Date:     2010-06-02 22:32:07 +0200 (Wed, 02 Jun 2010)

Log Message:
-----------
1.  The segfault no longer happens.  Still not 100% sure why it was happening though (more like 50%).  Thus, scenes.py hashtest is working again.

2.  Also, the build module is up and running.  Although, I plan on changing that to read a script somehow.

3.  Relative paths is working, as well as input, thanks to ideasman42, thus the very first prototype of hashchanger has been added.

Modified Paths:
--------------
    branches/soc-2010-leifandersen/release/scripts/modules/tests/build/mesh.py
    branches/soc-2010-leifandersen/tests/hashtests/hashchanger.py
    branches/soc-2010-leifandersen/tests/hashtests/scenehashes.txt
    branches/soc-2010-leifandersen/tests/hashtests/scenes.py

Modified: branches/soc-2010-leifandersen/release/scripts/modules/tests/build/mesh.py
===================================================================
--- branches/soc-2010-leifandersen/release/scripts/modules/tests/build/mesh.py	2010-06-02 19:45:18 UTC (rev 29167)
+++ branches/soc-2010-leifandersen/release/scripts/modules/tests/build/mesh.py	2010-06-02 20:32:07 UTC (rev 29168)
@@ -18,3 +18,4 @@
     cube.faces[4].verts_raw = [2,3,7,6]
     cube.faces[5].verts_raw = [1,3,7,5]
     bpy.data.objects.new(object_name, cube)
+    return bpy.data.objects[object_name]

Modified: branches/soc-2010-leifandersen/tests/hashtests/hashchanger.py
===================================================================
--- branches/soc-2010-leifandersen/tests/hashtests/hashchanger.py	2010-06-02 19:45:18 UTC (rev 29167)
+++ branches/soc-2010-leifandersen/tests/hashtests/hashchanger.py	2010-06-02 20:32:07 UTC (rev 29168)
@@ -1,40 +1,33 @@
-import bpy
-from rna_prop_ui import PropertyPanel
+import tests
 
-class Path:
-    __slots__ = 'path'
+path = input("Please enter the file you would like to edit: ")
+data = tests.hashfile.read(path)
 
-class TESTS_header(bpy.types.Header):
-    bl_space_type = 'PROPERTIES'
-    bl_region_type = 'UI'
-    def draw(self, context):
-        layout = self.layout
-        
+print("Please choose which hash you would like to change: ")
 
-class TESTS_hashfile(bpy.types.Panel):
-    bl_label = "Hashfile operations"
-    bl_space_type = 'PROPERTIES'
-    bl_region_type = 'WINDOW'
-    path = Path()
-    def draw(self, context):
-        layout = self.layout
-        row = layout.row()
-        row.label("foo")
-        row.prop_enum(path, path)
-    
-classes = [
-TESTS_header,
-TESTS_hashfile]
-    
-def register():
-    register = bpy.types.register
-    for c in classes:
-        register(c)
+i = 1
+for tuple in data:
+    print(str(i) + ': ' + tuple[0])
+    i+=1
 
-def unregister():
-    unregister = bpy.types.unregister
-    for c in classes:
-        unregister(c)
-    
-if __name__ == '__main__':
-    register()
\ No newline at end of file
+changer = -1
+while changer < 0 or changer >= len(data):
+    try:
+        changer = int(input(": ")) - 1
+        if changer < 0 or changer >= len(data):
+            print("Please pick a number in the list: ")
+            i = 1
+            for tuple in data:
+                print(str(i) + ': ' + tuple[0])
+                i+=1
+    except ValueError:
+        print("Please enter a number")
+
+print("The current hashcode for that value is: " + str(data[changer][1]))
+try:
+    hashcode = int(input("Please enter the number you would like to change it with, or nothing to make no change: "))
+    data[changer][1] = hashcode
+    tests.hashfile.write(path, data)
+    print("Done")
+except ValueError:
+    print("No Change made, exciting")

Modified: branches/soc-2010-leifandersen/tests/hashtests/scenehashes.txt
===================================================================
--- branches/soc-2010-leifandersen/tests/hashtests/scenehashes.txt	2010-06-02 19:45:18 UTC (rev 29167)
+++ branches/soc-2010-leifandersen/tests/hashtests/scenehashes.txt	2010-06-02 20:32:07 UTC (rev 29168)
@@ -1,2 +1,3 @@
 empty_scene = -1504849438355502056
 empty_mesh = 3297148919719683587
+cube_mesh = 6456748997015240834

Modified: branches/soc-2010-leifandersen/tests/hashtests/scenes.py
===================================================================
--- branches/soc-2010-leifandersen/tests/hashtests/scenes.py	2010-06-02 19:45:18 UTC (rev 29167)
+++ branches/soc-2010-leifandersen/tests/hashtests/scenes.py	2010-06-02 20:32:07 UTC (rev 29168)
@@ -25,10 +25,10 @@
 
 # A list of all of the hash codes
 # TODO:  Add an easier way to update?
-path = "/home/leif/blender-svn/soc-2010-leifandersen/tests/hashtests/scenehashes.txt"
+path = "scenehashes.txt"
 
-empty_scene = -1504849438355502056
-empty_mesh = 3297148919719683587
+empty_scene = 0
+empty_mesh = 0
 cube_mesh = 0
 
 class TestEmptyScene(unittest.TestCase):
@@ -47,8 +47,8 @@
         self.assertEquals(empty_mesh, hashcode(bpy.data.scenes[0]))
 
     def test_cube_mesh_scene(self):
-        cube = tests.build.mesh.cube("Cube")
-        bpy.data.scenes[0].objects.link(cube)
+        tests.build.mesh.cube("Cube")
+        bpy.data.scenes[0].objects.link(bpy.data.objects['Cube'])
         self.assertEquals(cube_mesh, hashcode(bpy.data.scenes[0]))
 
 def rand_pos_int():
@@ -73,4 +73,5 @@
     hashlist = tests.hashfile.read(path)
     empty_scene = hashlist[0][1]
     empty_mesh = hashlist[1][1]
-    unittest.TextTestRunner(verbosity=2).run(suite())
\ No newline at end of file
+    cube_mesh = hashlist[2][1]
+    unittest.TextTestRunner(verbosity=2).run(suite())





More information about the Bf-blender-cvs mailing list