+
+ # Process entity data
+ # ==================================================================
+ node.offset = entdata_length
+
+ if classtype != 'k_classtype_none':
+ disptype = classtype
+ else:
+ disptype = objt
+
+ s000 = F" [{uid: 3}/{header.node_count-1}]" + " |"*(depth-1)
+ s001 = F" L {obj.name}"
+ s002 = s000+s001
+ s003 = F"{disptype}"
+ s004 = ""
+ if classtype == 'k_classtype_skin':
+ s004 = F"-> {armature_def['obj'].cv_data.uid}"
+
+ scmp = F"{s002:<32} {s003:<16} {s004}"
+ print( scmp )
+
+ if classtype == 'k_classtype_INSTANCE' or \
+ classtype == 'k_classtype_BONE' or \
+ classtype == 'k_classtype_SKELETON' or \
+ classtype == 'k_classtype_SKIN':
+ print( "ERROR: user classtype cannot be _INSTANCE or _BONE" )
+ node.classtype = 0
+ node.offset = 0
+
+ elif classtype == 'k_classtype_skin':
+ node.classtype = 12
+
+ armature = armature_def['obj']
+ entdata_length += sizeof( classtype_skin )
+
+ skin = classtype_skin()
+ skin.skeleton = armature.cv_data.uid
+ entdata_buffer += [skin]
+
+ elif classtype == 'k_classtype_skeleton':
+ node.classtype = 11
+ entdata_length += sizeof( classtype_skeleton )
+
+ skeleton = classtype_skeleton()
+ skeleton.anim_start = 0
+ skeleton.anim_count = 0
+
+ entdata_buffer += [skeleton]
+
+ elif classtype == 'k_classtype_bone':
+ node.classtype = 10
+ entdata_length += sizeof( classtype_bone )
+
+ bone = classtype_bone()
+ bone.use_deform = node_def['deform']
+ entdata_buffer += [bone]
+
+ elif classtype == 'k_classtype_gate':
+ node.classtype = 1
+ entdata_length += sizeof( classtype_gate )
+
+ gate = classtype_gate()
+ gate.target = 0
+ if obj.cv_data.target != None:
+ gate.target = obj.cv_data.target.cv_data.uid
+
+ if obj.type == 'MESH':
+ gate.dims[0] = obj.data.cv_data.v0[0]
+ gate.dims[1] = obj.data.cv_data.v0[1]
+ gate.dims[2] = obj.data.cv_data.v0[2]
+ else:
+ gate.dims[0] = obj.cv_data.v0[0]
+ gate.dims[1] = obj.cv_data.v0[1]
+ gate.dims[2] = obj.cv_data.v0[2]
+
+ entdata_buffer += [gate]
+
+ elif classtype == 'k_classtype_block':
+ node.classtype = 2
+ entdata_length += sizeof( classtype_block )
+
+ source = obj.data.cv_data
+
+ block = classtype_block()
+ block.bbx[0][0] = source.v0[0]
+ block.bbx[0][1] = source.v0[2]
+ block.bbx[0][2] = -source.v1[1]
+
+ block.bbx[1][0] = source.v1[0]
+ block.bbx[1][1] = source.v1[2]
+ block.bbx[1][2] = -source.v0[1]
+ entdata_buffer += [block]
+
+ elif classtype == 'k_classtype_spawn':
+ node.classtype = 3
+
+ elif classtype == 'k_classtype_water':
+ node.classtype = 4
+
+ elif classtype == 'k_classtype_car_path':
+ node.classtype = 5
+ entdata_length += sizeof( classtype_car_path )
+
+ pn = classtype_car_path()
+ pn.target = 0
+ pn.target1 = 0
+
+ if obj.cv_data.target != None:
+ pn.target = obj.cv_data.target.cv_data.uid
+ if obj.cv_data.target1 != None:
+ 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]
+
+ elif classtype == 'k_classtype_capsule':
+ node.classtype = 7
+
+ elif classtype == 'k_classtype_route_node':
+ node.classtype = 8
+ entdata_length += sizeof( classtype_route_node )
+
+ rn = classtype_route_node()
+ if obj.cv_data.target != None:
+ rn.target = obj.cv_data.target.cv_data.uid
+ if obj.cv_data.target1 != None:
+ rn.target1 = obj.cv_data.target1.cv_data.uid
+
+ entdata_buffer += [rn]
+
+ elif classtype == 'k_classtype_route':
+ node.classtype = 9
+ entdata_length += sizeof( classtype_route )
+ r = classtype_route()
+ r.pstr_name = emplace_string("not-implemented")
+ r.colour[0] = obj.cv_data.colour[0]
+ r.colour[1] = obj.cv_data.colour[1]
+ r.colour[2] = obj.cv_data.colour[2]
+
+ if obj.cv_data.target != None:
+ r.id_start = obj.cv_data.target.cv_data.uid
+
+ entdata_buffer += [r]
+
+ # classtype == 'k_classtype_none':
+ else:
+ node.classtype = 0
+ node.offset = 0
+