From 0b0fcd7087816944c83697ed535ac0e460b6e4ae Mon Sep 17 00:00:00 2001 From: Augs Date: Tue, 24 Jul 2018 22:48:16 +0100 Subject: [PATCH] Fixed some export bugs --- BlenderCOL.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/BlenderCOL.py b/BlenderCOL.py index 5a74a37..0860377 100644 --- a/BlenderCOL.py +++ b/BlenderCOL.py @@ -189,7 +189,7 @@ class ImportCOL(Operator, ExportHelper): #Operator that exports the collision mo mesh = bpy.data.meshes.new("mesh") # add a new mesh - obj = bpy.data.objects.new("MyObject", mesh) # add a new object using the mesh + obj = bpy.data.objects.new("CollisionObj", mesh) # add a new object using the mesh scene = bpy.context.scene scene.objects.link(obj) # put the object into the scene (link) @@ -267,11 +267,13 @@ class ExportCOL(Operator, ExportHelper): #Operator that exports the collision mo ) def execute(self, context): # execute() is called by blender when running the operator. - bpy.ops.object.mode_set (mode = 'OBJECT') #Set mode to be object mode VertexList = [] #Store a list of verticies Triangles = [] #List of triangles, each containing indicies of verticies IndexOffset = 0 #Since each object starts their vertex indicies at 0, we need to shift these indicies once we add elements to the vertex list from various objects for Obj in bpy.context.scene.objects: #for all objects + Obj.mode_set(mode = 'OBJECT') #Set mode to be object mode + if Obj.type != 'MESH': + continue bm = bmesh.new() #Define new bmesh MyMesh = Obj.to_mesh(context.scene, True, 'PREVIEW')#make a copy of the object we can modify freely bm.from_mesh(MyMesh) #Add the above copy into the bmesh