X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=blender_export.py;h=8424753135935754e843bddc6d6f53b79329069c;hb=1c97cb161f885ad24d3356d92c8f4fd0e252bc61;hp=05f687a42530d0b9b670fcc6b54621b10f32bcb1;hpb=6d66c67945f84476d6ac75a0497007cc30bcf58c;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/blender_export.py b/blender_export.py index 05f687a..8424753 100644 --- a/blender_export.py +++ b/blender_export.py @@ -96,14 +96,16 @@ class classtype_car_path(Structure): _fields_ = [("target",c_uint32), ("target1",c_uint32)] +class classtype_instance(Structure): + _pack_ = 1 + _fields_ = [("pstr_file",c_uint32)] + # Exporter # ============================================================================== def write_model(name): print( F"Create mode {name}" ) - collection = bpy.data.collections[name] - header = mdl_header() header.identifier = 0xABCD0000 header.version = 0 @@ -179,6 +181,8 @@ def write_model(name): # Do exporting # print( " assigning ids" ) + collection = bpy.data.collections[name] + header.node_count = 1 for obj in collection.all_objects: obj.cv_data.uid = header.node_count @@ -210,11 +214,7 @@ def write_model(name): node.offset = entdata_length classtype = obj.cv_data.classtype - if classtype == 'k_classtype_none': - node.classtype = 0 - node.offset = 0 - - elif classtype == 'k_classtype_gate': + if classtype == 'k_classtype_gate': node.classtype = 1 entdata_length += sizeof( classtype_gate ) @@ -260,6 +260,20 @@ def write_model(name): pn.target1 = obj.cv_data.target1.cv_data.uid entdata_buffer += [pn] + elif obj.is_instancer: + target = obj.instance_collection + + node.classtype = 6 + entdata_length += sizeof( classtype_instance ) + + inst = classtype_instance() + inst.pstr_file = emplace_string( F"models/{target.name}.mdl" ) + entdata_buffer += [inst] + + # classtype == 'k_classtype_none': + else: + node.classtype = 0 + node.offset = 0 # Process meshes #