[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31088] branches/soc-2010-leifandersen: 1.
Leif Andersen
leif.a.andersen at gmail.com
Fri Aug 6 04:24:07 CEST 2010
Revision: 31088
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31088
Author: leifandersen
Date: 2010-08-06 04:24:05 +0200 (Fri, 06 Aug 2010)
Log Message:
-----------
1. As usual, the hash takes more into account (mballs now)
2. Added several more tests...almost through...
Modified Paths:
--------------
branches/soc-2010-leifandersen/release/scripts/op/tests_hash.py
branches/soc-2010-leifandersen/tests/python/MeshPrimitives_example.py
branches/soc-2010-leifandersen/tests/python/MeshPrimitives_example.py.blend
branches/soc-2010-leifandersen/tests/python/Mesh_example.py
branches/soc-2010-leifandersen/tests/python/Mesh_example.py.blend
branches/soc-2010-leifandersen/tests/python/MetaBall_example.py
branches/soc-2010-leifandersen/tests/python/MetaBall_example.py.blend
branches/soc-2010-leifandersen/tests/python/Modifier_example.py
branches/soc-2010-leifandersen/tests/python/Modifier_example.py.blend
branches/soc-2010-leifandersen/tests/python/NMesh_example.py
branches/soc-2010-leifandersen/tests/python/NMesh_example.py.blend
branches/soc-2010-leifandersen/tests/python/Object_example.py
branches/soc-2010-leifandersen/tests/python/Object_example.py.blend
branches/soc-2010-leifandersen/tests/python/hashfile.txt
Modified: branches/soc-2010-leifandersen/release/scripts/op/tests_hash.py
===================================================================
--- branches/soc-2010-leifandersen/release/scripts/op/tests_hash.py 2010-08-06 01:40:54 UTC (rev 31087)
+++ branches/soc-2010-leifandersen/release/scripts/op/tests_hash.py 2010-08-06 02:24:05 UTC (rev 31088)
@@ -45,6 +45,10 @@
hashcode += hash(num)
for group in ob.vertex_groups:
hashcode += hash(group.name)
+ for mod in ob.modifiers:
+ hashcode += hash(mod.type)
+ hashcode += hash(mod.name)
+ hashcode += hash(mod.levels)
if ob.soft_body != None:
sb = ob.soft_body
hashcode += hash(sb.speed)
@@ -312,6 +316,31 @@
hashcode += hash(tx.users)
hashcode += hash(tx.width)
hashcode += hash(tx.word_spacing)
+ if ob.type == 'META':
+ mb = ob.data
+ hashcode += hash(mb.auto_texspace)
+ hashcode += hash(mb.bl_rna.name)
+ hashcode += hash(mb.flag)
+ hashcode += hash(mb.name)
+ hashcode += hash(mb.render_size)
+ hashcode += hash(mb.wire_size)
+ for num in mb.texspace_loc:
+ hashcode += hash(num)
+ for num in mb.texspace_size:
+ hashcode += hash(num)
+ for material in mb.materials:
+ hashcode += hash(material.name)
+ hashcode += hash(mb.threshold)
+ for el in mb.elements:
+ hashcode += hash(el.size_x)
+ hashcode += hash(el.size_y)
+ hashcode += hash(el.size_z)
+ for num in el.rotation:
+ hashcode += hash(num)
+ hashcode += hash(el.negative)
+ hashcode += hash(el.hide)
+ hashcode += hash(el.stiffness)
+ hashcode += hash(el.type)
if ob.type == 'ARMATURE':
am = ob.data
hashcode += hash(am.auto_ik)
Modified: branches/soc-2010-leifandersen/tests/python/MeshPrimitives_example.py
===================================================================
--- branches/soc-2010-leifandersen/tests/python/MeshPrimitives_example.py 2010-08-06 01:40:54 UTC (rev 31087)
+++ branches/soc-2010-leifandersen/tests/python/MeshPrimitives_example.py 2010-08-06 02:24:05 UTC (rev 31088)
@@ -23,7 +23,10 @@
bpy.ops.tests.hash()
self.assertEquals(self.hash_start, tests.hashfile.last_hash)
- # Insert Here
+ bpy.ops.mesh.primitive_cube_add() # Create an object, a primitive cube mesh, and link it to the scene
+ ob = bpy.data.objects['Cube']
+ ob.scale = (2, 2, 2) # Scale up the mesh
+ bpy.context.scene.update() # Update the scene
bpy.ops.tests.hash()
self.assertEquals(self.hash_end, tests.hashfile.last_hash)
Modified: branches/soc-2010-leifandersen/tests/python/MeshPrimitives_example.py.blend
===================================================================
(Binary files differ)
Modified: branches/soc-2010-leifandersen/tests/python/Mesh_example.py
===================================================================
--- branches/soc-2010-leifandersen/tests/python/Mesh_example.py 2010-08-06 01:40:54 UTC (rev 31087)
+++ branches/soc-2010-leifandersen/tests/python/Mesh_example.py 2010-08-06 02:24:05 UTC (rev 31088)
@@ -23,8 +23,29 @@
bpy.ops.tests.hash()
self.assertEquals(self.hash_start, tests.hashfile.last_hash)
- # Insert Here
+ # define vertices and faces for a pyramid
+ coords=[ [-1,-1,-1], [1,-1,-1], [1,1,-1], [-1,1,-1], [0,0,1] ]
+ faces= [ [3,2,1,0], [0,1,4], [1,2,4], [2,3,4], [3,0,4] ]
+ me = bpy.data.meshes.new('myMesh') # create a new mesh
+ me.add_geometry(len(coords), 0, len(faces)) # add vertices, edges, and faces to mesh
+ i = 0
+ for vert in me.verts:
+ vert.co = coords[i]
+ i+=1
+ i = 0
+ for face in me.faces:
+ if len(faces[i]) == 4:
+ face.verts_raw = faces[i]
+ elif len(faces[i]) == 3:
+ face.verts = faces[i]
+ i+=1
+ mc = bpy.data.materials.new("myColor") # enable vertex colors
+ mc.diffuse_color = (255, 255, 255) # make each vertex a different color
+ ob = bpy.data.objects.new("myObj", me) # create an object, link mesh to object
+ sc = bpy.context.scene
+ sc.objects.link(ob) # link object to current scene
+
bpy.ops.tests.hash()
self.assertEquals(self.hash_end, tests.hashfile.last_hash)
Modified: branches/soc-2010-leifandersen/tests/python/Mesh_example.py.blend
===================================================================
(Binary files differ)
Modified: branches/soc-2010-leifandersen/tests/python/MetaBall_example.py
===================================================================
--- branches/soc-2010-leifandersen/tests/python/MetaBall_example.py 2010-08-06 01:40:54 UTC (rev 31087)
+++ branches/soc-2010-leifandersen/tests/python/MetaBall_example.py 2010-08-06 02:24:05 UTC (rev 31088)
@@ -23,7 +23,11 @@
bpy.ops.tests.hash()
self.assertEquals(self.hash_start, tests.hashfile.last_hash)
- # Insert Here
+ bpy.ops.object.metaball_add()
+ mb = bpy.data.metaballs['Meta']
+ ob = bpy.data.objects.new("Mball", mb)
+ sc = bpy.context.scene
+ sc.objects.link(ob)
bpy.ops.tests.hash()
self.assertEquals(self.hash_end, tests.hashfile.last_hash)
Modified: branches/soc-2010-leifandersen/tests/python/MetaBall_example.py.blend
===================================================================
(Binary files differ)
Modified: branches/soc-2010-leifandersen/tests/python/Modifier_example.py
===================================================================
--- branches/soc-2010-leifandersen/tests/python/Modifier_example.py 2010-08-06 01:40:54 UTC (rev 31087)
+++ branches/soc-2010-leifandersen/tests/python/Modifier_example.py 2010-08-06 02:24:05 UTC (rev 31088)
@@ -23,7 +23,13 @@
bpy.ops.tests.hash()
self.assertEquals(self.hash_start, tests.hashfile.last_hash)
- # Insert Here
+ ob = bpy.data.objects['Cube'] # retrieve an object
+ mods = ob.modifiers # get the object's modifiers
+ for mod in mods:
+ print(mod,mod.name) # print each modifier and its name
+ mod = mods.new('myMod', 'SUBSURF') # add a new subsurf modifier
+ mod.levels = 3 # set subsurf subdivision levels to 3
+ bpy.context.scene.update()
bpy.ops.tests.hash()
self.assertEquals(self.hash_end, tests.hashfile.last_hash)
Modified: branches/soc-2010-leifandersen/tests/python/Modifier_example.py.blend
===================================================================
(Binary files differ)
Modified: branches/soc-2010-leifandersen/tests/python/NMesh_example.py
===================================================================
--- branches/soc-2010-leifandersen/tests/python/NMesh_example.py 2010-08-06 01:40:54 UTC (rev 31087)
+++ branches/soc-2010-leifandersen/tests/python/NMesh_example.py 2010-08-06 02:24:05 UTC (rev 31088)
@@ -23,8 +23,20 @@
bpy.ops.tests.hash()
self.assertEquals(self.hash_start, tests.hashfile.last_hash)
- # Insert Here
+ me = bpy.data.meshes['Cube'] # get the mesh data called "Cube"
+ if not me.materials: # if there are no materials ...
+ bpy.ops.material.new() # create one ..
+ newmat = bpy.data.materials['Material']
+ print(me.materials) # print the list of materials
+ mat = me.materials[0] # grab the first material in the list
+ mat.diffuse_color = (1.0, mat.diffuse_color[1], mat.diffuse_color[2]) # redefine its red component
+ for v in me.verts:
+ v.co[0] *= 2.5 # loop the list of vertices
+ v.co[1] *= 5.0 # multiply the coordinates
+ v.co[2] *= 2.5
+ bpy.context.scene.update()
+
bpy.ops.tests.hash()
self.assertEquals(self.hash_end, tests.hashfile.last_hash)
Modified: branches/soc-2010-leifandersen/tests/python/NMesh_example.py.blend
===================================================================
(Binary files differ)
Modified: branches/soc-2010-leifandersen/tests/python/Object_example.py
===================================================================
--- branches/soc-2010-leifandersen/tests/python/Object_example.py 2010-08-06 01:40:54 UTC (rev 31087)
+++ branches/soc-2010-leifandersen/tests/python/Object_example.py 2010-08-06 02:24:05 UTC (rev 31088)
@@ -23,8 +23,13 @@
bpy.ops.tests.hash()
self.assertEquals(self.hash_start, tests.hashfile.last_hash)
- # Insert Here
-
+ scene = bpy.context.scene # get the current scene
+ cam = bpy.data.cameras.new("orth") # make ortho camera data object
+ ob = bpy.data.objects.new("Camera", cam) # make camera object
+ scene.objects.link(ob) # link the object into the scene
+ ob.location = (0.0, -5.0, 1.0) # position the object in the scene
+ scene.update() # redraw the scene to show the updates.
+
bpy.ops.tests.hash()
self.assertEquals(self.hash_end, tests.hashfile.last_hash)
Modified: branches/soc-2010-leifandersen/tests/python/Object_example.py.blend
===================================================================
(Binary files differ)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list