+ # caches
+ sr_compile.string_cache = {}
+ sr_compile.mesh_cache = {}
+ sr_compile.material_cache = {}
+ sr_compile.texture_cache = {}
+
+ # compiled data
+ sr_compile.mesh_data = bytearray()
+ sr_compile.submesh_data = bytearray()
+ sr_compile.vertex_data = bytearray()
+ sr_compile.indice_data = bytearray()
+ sr_compile.bone_data = bytearray()
+ sr_compile.material_data = bytearray()
+ sr_compile.armature_data = bytearray()
+ sr_compile.anim_data = bytearray()
+ sr_compile.keyframe_data = bytearray()
+ sr_compile.texture_data = bytearray()
+
+ # just bytes not structures
+ sr_compile.string_data = bytearray()
+ sr_compile.pack_data = bytearray()
+
+ # variable
+ sr_compile.entity_data = {}
+ sr_compile.entity_info = {}
+
+ print( F"[SR] assign entity ID's" )
+ sr_compile.entities = {}
+ sr_compile.entity_ids = {}
+
+ mesh_count = 0
+ for obj in collection.all_objects: #{
+ if obj.type == 'MESH': mesh_count += 1
+
+ ent_type = obj_ent_type( obj )
+ if ent_type == 'none': continue
+
+ if ent_type not in sr_compile.entities: sr_compile.entities[ent_type] = []
+ sr_compile.entity_ids[obj.name] = len( sr_compile.entities[ent_type] )
+ sr_compile.entities[ent_type] += [obj]
+ #}
+
+ print( F"[SR] Compiling geometry" )
+ i=0
+ for obj in collection.all_objects:#{
+ if obj.type == 'MESH':#{
+ i+=1
+ print( F'[SR] {i: 3}/{mesh_count} {obj.name:<40}', end='\r' )
+ sr_compile_mesh( obj )
+ #}
+ #}
+
+ checkpoint_count = 0
+ pathindice_count = 0
+ audio_clip_count = 0
+
+ for ent_type, arr in sr_compile.entities.items():#{
+ print(F"[SR] Compiling {len(arr)} {ent_type}{'s' if len(arr)>1 else ''}")
+
+ for i in range(len(arr)):#{
+ obj = arr[i]
+
+ print( F"[SR] {i+1: 3}/{len(arr)} {obj.name:<40} ",end='\r' )
+
+ if ent_type == 'mdl_armature': sr_compile_armature(obj)
+ elif ent_type == 'ent_light': #{
+ light = ent_light()
+ compile_obj_transform( obj, light.transform )
+ light.daytime = obj.data.SR_data.daytime
+ if obj.data.type == 'POINT':#{
+ light.type = 0