+ bsp_local = F"{directory}/{settings.project_name}.bsp"
+ bsp_remote = F"{settings.subdir}/maps/{settings.project_name}.bsp"
+ bsp_packed = F"{settings.subdir}/maps/{settings.project_name}_pack.bsp"
+ packlist = F"{directory}/{settings.project_name}_assets.txt"
+
+ os.makedirs( asset_dir, exist_ok=True )
+ os.makedirs( material_dir, exist_ok=True )
+ os.makedirs( model_dir, exist_ok=True )
+
+ static.FILE = open(F"/tmp/convexer_compile_log.txt","w")
+ static.LOG = []
+
+ sceneinfo = cxr_scene_collect()
+ image_jobs = []
+ qc_jobs = []
+
+ # Collect materials
+ a_materials = set()
+ for brush in sceneinfo['geo']:
+ for ms in brush['object'].material_slots:
+ a_materials.add( ms.material )
+ if ms.material.cxr_data.shader == 'VertexLitGeneric':
+ errmat = ms.material.name
+ errnam = brush['object'].name
+ print( F"Vertex shader {errmat} used on {errnam}")
+ return {'CANCELLED'}
+
+ a_models = set()
+ model_jobs = []
+ for ent in sceneinfo['entities']:
+ if ent['object'] == None: continue
+
+ if ent['classname'] == 'prop_static':
+ obj = ent['object']
+ if isinstance(obj,bpy.types.Collection):
+ target = obj
+ a_models.add( target )
+ model_jobs += [(target, ent['origin'], asset_dir, \
+ settings.project_name, ent['transform'])]
+ else:
+ target = obj.instance_collection
+ if target in a_models:
+ continue
+ a_models.add( target )
+
+ # TODO: Should take into account collection instancing offset
+ model_jobs += [(target, [0,0,0], asset_dir, \
+ settings.project_name, ent['transform'])]
+
+ elif ent['object'].type == 'MESH':
+ for ms in ent['object'].material_slots:
+ a_materials.add( ms.material )
+
+ for mdl in a_models:
+ uid = asset_uid(mdl)
+ qc_jobs += [F'{uid}.qc']
+
+ for obj in mdl.objects:
+ for ms in obj.material_slots: