Exemplo n.º 1
0
 def n_check_data(self, n_data):
     TestBaseGeometry.n_check_data(self, n_data)
     n_geom = n_data.roots[0].children[0]
     nose.tools.assert_equal(n_geom.data.has_vertex_colors, True)
     nose.tools.assert_equal(len(n_geom.data.vertex_colors), 8)
     for i, vert in enumerate(n_geom.data.vertex_colors):
         self.n_check_vert(i, vert)
Exemplo n.º 2
0
 def b_check_object(self, b_obj):
     TestBaseGeometry.b_check_object(self, b_obj)
     b_mesh = b_obj.data
     nose.tools.assert_equal(len(b_mesh.vertex_colors), 1)
     nose.tools.assert_equal(b_mesh.vertex_colors[0].name, 'VertexColor')
     b_meshcolor = b_obj.data.vertex_colors["VertexColor"].data
     for b_col_index, b_meshcolor in enumerate(b_meshcolor): #b_faces: 0-11          
         self.b_check_vert(b_col_index, b_meshcolor)
    def b_create_object(self):
        b_obj = TestBaseGeometry.b_create_object(self)
        
        bpy.ops.mesh.primitive_uv_sphere_add()
        
        b_coll = bpy.data.objects["Sphere"]
        b_coll.data.show_double_sided = False
        b_coll.name = "CollisionSphere"
        b_coll = bpy.data.objects["CollisionSphere"]
        b_coll.draw_type = 'WIRE'
        
        #Physics
        b_coll.game.use_collision_bounds = True
        b_coll.game.collision_bounds_type = 'SPHERE'
        
        b_coll.nifcollision.use_blender_properties = True
        b_coll.nifcollision.motion_system = "MO_SYS_FIXED"
        b_coll.nifcollision.oblivion_layer = "OL_STATIC"
        b_coll.nifcollision.quality_type = "MO_QUAL_FIXED"
        b_coll.nifcollision.col_filer = 0
        b_coll.nifcollision.havok_material = "HAV_MAT_WOOD"

        b_coll.select = True
            
        #bpy.ops.wm.save_mainfile(filepath="test/autoblend/" + self.n_name)
        return b_obj 
Exemplo n.º 4
0
    def b_create_object(self):

        b_obj = TestBaseGeometry.b_create_object(self)
        b_obj.name = self.b_name
        b_obj.draw_bounds_type = "BOX"
        b_obj.draw_type = "BOUNDS"

        return b_obj
 def b_create_object(self):
     b_obj = TestBaseGeometry.b_create_object(self)
     b_coll = TestBaseGeometry.b_create_object(self, "CollisionBox")
     b_coll.draw_type = 'WIRE'
     
     #Physics
     b_coll.game.use_collision_bounds = True
     b_coll.game.collision_bounds_type = 'BOX'
     
     b_coll.nifcollision.use_blender_properties = True
     b_coll.nifcollision.motion_system = "MO_SYS_FIXED"
     b_coll.nifcollision.oblivion_layer = "OL_STATIC"
     b_coll.nifcollision.quality_type = "MO_QUAL_FIXED"
     b_coll.nifcollision.col_filter = 0
     b_coll.nifcollision.havok_material = "HAV_MAT_WOOD"
     
     b_coll.select = True
         
     #bpy.ops.wm.save_mainfile(filepath="test/autoblend/" + self.n_name)
     return b_obj 
Exemplo n.º 6
0
 def b_create_object(self):
     b_obj = TestBaseGeometry.b_create_object(self)
     
     #we like working with tris's, quad faces are silly, just like yours :P
     bpy.ops.object.editmode_toggle()
     bpy.ops.mesh.quads_convert_to_tris() 
     bpy.ops.object.editmode_toggle()
     
     #add base vertex col layer
     bpy.ops.mesh.vertex_color_add()
     b_obj.data.vertex_colors[0].name = "VertexColor"
     
     #iterate over each face, then set the vert color through lookup, 
     for face_index, face in enumerate(self.b_faces): #nif_faces: 0-11 
         for vert_index, n_vert in enumerate(face): #nif_verts: 0-7
             b_meshcolor = b_obj.data.vertex_colors["VertexColor"].data[face_index]
             b_color = getattr(b_meshcolor, "color%s" % (vert_index + 1))
             b_color.r = self.vertcol[n_vert][0]
             b_color.g = self.vertcol[n_vert][1]
             b_color.b = self.vertcol[n_vert][2]
     
     #bpy.ops.wm.save_mainfile(filepath="test/autoblend/" + self.n_name)        
     return b_obj
 def b_create_object(self):
     b_obj = TestBaseGeometry.b_create_object(self, self.b_name)
     
     bpy.ops.mesh.primitive_cylinder_add(vertices=8,radius=1.2,depth=2)
     
     b_coll = bpy.context.active_object
     b_coll.data.show_double_sided = False
     b_coll.name = "CollisionCapsule"
     b_coll = bpy.data.objects["CollisionCapsule"]
     b_coll.draw_type = 'WIRE'
     
     #Physics
     b_coll.game.use_collision_bounds = True
     b_coll.game.collision_bounds_type = 'CAPSULE'
     
     b_coll.nifcollision.use_blender_properties = True
     b_coll.nifcollision.motion_system = "MO_SYS_FIXED"
     b_coll.nifcollision.oblivion_layer = "OL_STATIC"
     b_coll.nifcollision.quality_type = "MO_QUAL_FIXED"
     b_coll.nifcollision.col_filer = 0
     b_coll.nifcollision.havok_material = "HAV_MAT_WOOD"
         
     #bpy.ops.wm.save_mainfile(filepath="test/autoblend/" + self.n_name)
     return b_obj