+ 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:
+ a_materials.add( ms.material )
+ if ms.material.cxr_data.shader == 'LightMappedGeneric' or \
+ ms.material.cxr_data.shader == 'WorldVertexTransition':
+
+ errmat = ms.material.name
+ errnam = obj.name
+ print( F"Lightmapped shader {errmat} used on {errnam}")
+ return {'CANCELLED'}
+
+ # Collect images
+ for mat in a_materials:
+ for pair in compile_material(mat):
+ decl = pair[0]
+ pdef = pair[1]
+ prop = pair[2]
+
+ if isinstance(prop,bpy.types.Image):
+ flags = 0
+ if 'flags' in pdef: flags = pdef['flags']
+ if prop not in image_jobs:
+ image_jobs += [(prop,)]
+ prop.cxr_data.flags = flags
+
+ # Create packlist
+ with open( packlist, "w" ) as fp:
+
+ for mat in a_materials:
+ if mat.cxr_data.shader == 'Builtin': continue
+ fp.write(F"{asset_path('materials',mat)}.vmt\n")
+ fp.write(F"{cxr_winepath(asset_full_path('materials',mat))}.vmt\n")
+
+ for img_job in image_jobs:
+ img = img_job[0]
+ fp.write(F"{asset_path('materials',img)}.vtf\n")
+ fp.write(F"{cxr_winepath(asset_full_path('materials',img))}.vtf\n")
+
+ for mdl in a_models:
+ local = asset_path('models',mdl)
+ winep = cxr_winepath(asset_full_path('models',mdl))
+
+ fp.write(F"{local}.vvd\n")
+ fp.write(F"{winep}.vvd\n")
+ fp.write(F"{local}.dx90.vtx\n")
+ fp.write(F"{winep}.dx90.vtx\n")
+ fp.write(F"{local}.mdl\n")
+ fp.write(F"{winep}.mdl\n")
+ fp.write(F"{local}.vvd\n")
+ fp.write(F"{winep}.vvd\n")
+
+ if cxr_modelsrc_vphys(mdl):
+ fp.write(F"{local}.phy\n")
+ fp.write(F"{winep}.phy\n")
+
+ # Convexer jobs
+ static.JOBID = 0
+ static.JOBINFO = []
+
+ if settings.comp_vmf:
+ static.JOBINFO += [{
+ "title": "Convexer",
+ "w": 20,
+ "colour": (0.863, 0.078, 0.235,1.0),
+ "exec": cxr_export_vmf,
+ "jobs": [(sceneinfo,output_vmf)]
+ }]
+
+ if settings.comp_textures:
+ if len(image_jobs) > 0:
+ static.JOBINFO += [{
+ "title": "Textures",
+ "w": 40,
+ "colour": (1.000, 0.271, 0.000,1.0),
+ "exec": compile_image,
+ "jobs": image_jobs
+ }]
+
+ game = cxr_winepath( settings.subdir )
+ args = [ \
+ '-game', game, settings.project_name
+ ]
+
+ # FBX stage
+ if settings.comp_models:
+ if len(model_jobs) > 0:
+ static.JOBINFO += [{
+ "title": "Batches",
+ "w": 25,
+ "colour": (1.000, 0.647, 0.000,1.0),
+ "exec": cxr_export_modelsrc,
+ "jobs": model_jobs
+ }]
+
+ if len(qc_jobs) > 0:
+ static.JOBINFO += [{
+ "title": "StudioMDL",
+ "w": 20,
+ "colour": (1.000, 0.843, 0.000, 1.0),
+ "exec": "studiomdl",
+ "jobs": [[settings[F'exe_studiomdl']] + [\
+ '-nop4', '-game', game, qc] for qc in qc_jobs],
+ "cwd": asset_dir
+ }]
+
+ # VBSP stage
+ if settings.comp_compile:
+ if not settings.opt_vbsp.startswith( 'disable' ):
+ vbsp_opt = settings.opt_vbsp.split()
+ static.JOBINFO += [{
+ "title": "VBSP",
+ "w": 25,
+ "colour": (0.678, 1.000, 0.184,1.0),
+ "exec": "vbsp",
+ "jobs": [[settings[F'exe_vbsp']] + vbsp_opt + args],
+ "cwd": directory
+ }]
+
+ if not settings.opt_vvis.startswith( 'disable' ):
+ vvis_opt = settings.opt_vvis.split()
+ static.JOBINFO += [{
+ "title": "VVIS",
+ "w": 25,
+ "colour": (0.000, 1.000, 0.498,1.0),
+ "exec": "vvis",
+ "jobs": [[settings[F'exe_vvis']] + vvis_opt + args ],
+ "cwd": directory
+ }]
+
+ if not settings.opt_vrad.startswith( 'disable' ):
+ vrad_opt = settings.opt_vrad.split()
+ static.JOBINFO += [{
+ "title": "VRAD",
+ "w": 25,
+ "colour": (0.125, 0.698, 0.667,1.0),
+ "exec": "vrad",
+ "jobs": [[settings[F'exe_vrad']] + vrad_opt + args ],
+ "cwd": directory
+ }]
+
+ static.JOBINFO += [{
+ "title": "CXR",
+ "w": 5,
+ "colour": (0.118, 0.565, 1.000,1.0),
+ "exec": cxr_patchmap,
+ "jobs": [(bsp_local,bsp_remote)]
+ }]
+
+ if settings.comp_pack:
+ static.JOBINFO += [{
+ "title": "Pack",
+ "w": 5,
+ "colour": (0.541, 0.169, 0.886,1.0),
+ "exec": "bspzip",
+ "jobs": [[cxr_compiler_path("bspzip"), '-addlist', \
+ cxr_winepath(bsp_remote),
+ cxr_winepath(packlist),
+ cxr_winepath(bsp_packed) ]],
+ "cwd": directory
+ }]
+
+ if len(static.JOBINFO) == 0:
+ return {'CANCELLED'}