Skip to content
Snippets Groups Projects
export_3ds.py 33.7 KiB
Newer Older
  • Learn to ignore specific revisions
  •     #for ob in empty_objects:
        #	name_to_id[ob.name]= len(name_to_id)
        """
    
        # Create object chunks for all meshes:
        i = 0
    
        for ob, blender_mesh, matrix in mesh_objects:
    
            # create a new object chunk
            object_chunk = _3ds_chunk(OBJECT)
    
            # set the object name
            object_chunk.add_variable("name", _3ds_string(sane_name(ob.name)))
    
            # make a mesh chunk out of the mesh:
    
            object_chunk.add_subchunk(make_mesh_chunk(blender_mesh, matrix, materialDict))
    
            object_info.add_subchunk(object_chunk)
    
            ''' # COMMENTED OUT FOR 2.42 RELEASE!! CRASHES 3DS MAX
            # make a kf object node for the object:
            kfdata.add_subchunk(make_kf_obj_node(ob, name_to_id))
            '''
            if not blender_mesh.users:
                bpy.data.meshes.remove(blender_mesh)
    # 		blender_mesh.vertices = None
    
    
    
        # Create chunks for all empties:
        ''' # COMMENTED OUT FOR 2.42 RELEASE!! CRASHES 3DS MAX
        for ob in empty_objects:
            # Empties only require a kf object node:
            kfdata.add_subchunk(make_kf_obj_node(ob, name_to_id))
            pass
        '''
    
        # Add main object info chunk to primary chunk:
        primary.add_subchunk(object_info)
    
        ''' # COMMENTED OUT FOR 2.42 RELEASE!! CRASHES 3DS MAX
        # Add main keyframe data chunk to primary chunk:
        primary.add_subchunk(kfdata)
        '''
    
        # At this point, the chunk hierarchy is completely built.
    
        # Check the size:
        primary.get_size()
        # Open the file for writing:
        file = open(filepath, 'wb')
    
        # Recursively write the chunks to file:
        primary.write(file)
    
        # Close the file:
        file.close()
    
        # Clear name mapping vars, could make locals too
        name_unique[:] = []
        name_mapping.clear()
    
        # Debugging only: report the exporting time:
    # 	Blender.Window.WaitCursor(0)
        print("3ds export time: %.2f" % (time.clock() - time1))
    
        # Debugging only: dump the chunk hierarchy:
        #primary.dump()