_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
# 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
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 )
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
#