non-hero props
[convexer.git] / __init__.py
index 0932670c221c7f5adc57cba228af3574ec503c85..f8747467157eb627bba10d62dffc6d63fcc32a66 100644 (file)
@@ -89,11 +89,11 @@ def cxr_ui(_,context):
          blf.draw(0,ln[:-1])
          py += 16
 
-   if CXR_PREVIEW_OPERATOR.LASTERR != None:
-      blf.position(0,2,80,0)
-      blf.size(0,50,48)
-      blf.color(0,1.0,0.2,0.2,0.9)
-      blf.draw(0,"This is a stoopid error\nWIthiuawdnaw")
+   #if CXR_PREVIEW_OPERATOR.LASTERR != None:
+   #   blf.position(0,2,80,0)
+   #   blf.size(0,50,48)
+   #   blf.color(0,1.0,0.2,0.2,0.9)
+   #   blf.draw(0,"Invalid geometry")
 
    # Something is off with TIMER,
    # this forces the viewport to redraw before we can continue with our
@@ -154,7 +154,7 @@ def cxr_jobs_update_graph(jobs):
          else: colour = colourwait
 
          px = (cur + (i)*sfsub) * sf
-         px1 = (cur + (i+1.0)*sfsub) * sf - 0.003
+         px1 = (cur + (i+1.0)*sfsub) * sf
          i += 1
 
          verts += [(px,0), (px, h), (px1, 0.0), (px1,h)]
@@ -470,8 +470,8 @@ def libcxr_line_callback( p0,p1,colour ):
 libnbvtf = None
 
 # Constants
-NBVTF_IMAGE_FORMAT_RGBA8888 = 0
-NBVTF_IMAGE_FORMAT_RGB888 = 2
+NBVTF_IMAGE_FORMAT_ABGR8888 = 1
+NBVTF_IMAGE_FORMAT_BGR888 = 3
 NBVTF_IMAGE_FORMAT_DXT1 = 13
 NBVTF_IMAGE_FORMAT_DXT5 = 15
 NBVTF_TEXTUREFLAGS_CLAMPS = 0x00000004
@@ -561,26 +561,31 @@ def ent_lights(context):
    kvs = cxr_baseclass([ent_origin],\
    {
       "_distance": (0.0 if obj.data.cxr_data.realtime else -1.0),
-      "_light": [int(pow(obj.data.color[i],1.0/2.2)*255.0) for i in range(3)] +\
-                [int(obj.data.energy * bpy.context.scene.cxr_data.light_scale)],
       "_lightHDR": '-1 -1 -1 1',
       "_lightscaleHDR": 1
    })
-
-   if obj.data.type == 'SPOT':
-      kvs['_cone'] = obj.data.spot_size*(57.295779513/2.0)
-      kvs['_inner_cone'] = (1.0-obj.data.spot_blend)*kvs['_cone']
       
-      # Blenders spotlights are -z forward
+   light_base = [(pow(obj.data.color[i],1.0/2.2)*255.0) for i in range(3)] +\
+                [obj.data.energy * bpy.context.scene.cxr_data.light_scale]
+
+   if obj.data.type == 'SPOT' or obj.data.type == 'SUN':
+      # Blenders directional lights are -z forward
       # Source is +x, however, it seems to use a completely different system.
       # Since we dont care about roll for spotlights, we just take the
       # pitch and yaw via trig
 
       _,mtx_rot,_ = obj.matrix_world.decompose()
       fwd = mtx_rot @ mathutils.Vector((0,0,-1))
+      dir_pitch = math.asin(fwd[2]) * 57.295779513
+      dir_yaw = math.atan2(fwd[1],fwd[0]) * 57.295779513
+
+   if obj.data.type == 'SPOT':
+      kvs['_light'] = [ int(x) for x in light_base ]
+      kvs['_cone'] = obj.data.spot_size*(57.295779513/2.0)
+      kvs['_inner_cone'] = (1.0-obj.data.spot_blend)*kvs['_cone']
       
-      kvs['pitch'] = math.asin(fwd[2]) * 57.295779513
-      kvs['angles'] = [ 0.0, math.atan2(fwd[1],fwd[0]) * 57.295779513, 0.0 ]
+      kvs['pitch'] = dir_pitch
+      kvs['angles'] = [ 0, dir_yaw, 0 ]
       kvs['_quadratic_attn'] = 0.0  # Source spotlights + quadratic falloff look
                                     # Really bad...
                                     #
@@ -589,36 +594,79 @@ def ent_lights(context):
       kvs['_linear_attn'] = 1.0
    
    elif obj.data.type == 'POINT':
+      kvs['_light'] = [ int(x) for x in light_base]
       kvs['_quadratic_attn'] = 1.0
       kvs['_linear_attn'] = 0.0
    
    elif obj.data.type == 'SUN':
-      pass # TODO
+      light_base[3] *= 300.0 * 5
+      kvs['_light'] = [ int(x) for x in light_base ]
+
+      ambient = bpy.context.scene.world.color
+      kvs['_ambient'] = [int(pow(ambient[i],1.0/2.2)*255.0) for i in range(3)] +\
+                        [80 * 5]
+      kvs['_ambientHDR'] = [-1,-1,-1,1]
+      kvs['_AmbientScaleHDR'] = 1
+      kvs['pitch'] = dir_pitch
+      kvs['angles'] = [ dir_pitch, dir_yaw, 0.0 ]
+      kvs['SunSpreadAngle'] = 0
 
    return kvs
 
 def ent_prop(context):
-   kvs = {}
    if isinstance( context['object'], bpy.types.Collection ):
-      kvs['angles'] = [0,180,0]
-      kvs['enablelightbounce'] = 1
-      kvs['disableshadows'] = 0
-      kvs['fademindist'] = -1
-      kvs['fadescale'] = 1
-      kvs['model'] = F"{asset_path('models',context['object'])}.mdl".lower()
-      kvs['renderamt'] = 255
-      kvs['rendercolor'] = [255, 255, 255]
-      kvs['skin'] = 0
-      kvs['solid'] = 6
-      kvs['uniformscale'] = 1.0
-
+      kvs = {}
+      target = context['object']
       pos = mathutils.Vector(context['origin'])
       pos += mathutils.Vector(context['transform']['offset'])
 
       kvs['origin'] = [pos[1],-pos[0],pos[2]]
+      kvs['angles'] = [0,180,0]
+   else:
+      kvs = cxr_baseclass([ent_origin],{})
+      target = context['object'].instance_collection
+
+      obj = context['object']
+      euler = [ a*57.295779513 for a in obj.rotation_euler ]
+      angle = [0,0,0]
+      angle[0] = euler[1]
+      angle[1] = euler[2] + 180.0 # Dunno...
+      angle[2] = euler[0]
+      
+      kvs['angles'] = angle
+
+
+   kvs['enablelightbounce'] = 1
+   kvs['disableshadows'] = 0
+   kvs['fademindist'] = -1
+   kvs['fadescale'] = 1
+   kvs['model'] = F"{asset_path('models',target)}.mdl".lower()
+   kvs['renderamt'] = 255
+   kvs['rendercolor'] = [255, 255, 255]
+   kvs['skin'] = 0
+   kvs['solid'] = 6
+   kvs['uniformscale'] = 1.0
 
    return kvs
 
+def ent_sky_camera(context):
+   settings = bpy.context.scene.cxr_data
+   scale = settings.scale_factor / settings.skybox_scale_factor
+
+   kvs = {
+      "origin": [_ for _ in context['transform']['offset']],
+      "angles": [ 0, 0, 0 ],
+      "fogcolor": [255, 255, 255],
+      "fogcolor2": [255, 255, 255],
+      "fogdir": [1,0,0],
+      "fogend": 2000.0,
+      "fogmaxdensity": 1,
+      "fogstart": 500.0,
+      "HDRColorScale": 1.0,
+      "scale": scale
+   }
+   return kvs
+
 def ent_cubemap(context):
    obj = context['object']
    return cxr_baseclass([ent_origin], {"cubemapsize": obj.data.cxr_data.size})
@@ -697,7 +745,7 @@ def cxr_intrinsic_classname(obj):
       return {
          'SPOT': "light_spot",
          'POINT': "light",
-         'SUN': "light_directional" }[ obj.data.type ]
+         'SUN': "light_environment" }[ obj.data.type ]
    
    elif obj.type == 'LIGHT_PROBE':
       return "env_cubemap"
@@ -952,6 +1000,12 @@ def cxr_scene_collect():
    if 'skybox' in bpy.data.collections:
       _collect( bpy.data.collections['skybox'], transform_sky )
 
+      sceneinfo['entities'] += [{
+         "object": None,
+         "transform": transform_sky,
+         "classname": "sky_camera"
+      }]
+
    return sceneinfo
 
 # Write VMF out to file (JOB HANDLER)
@@ -966,7 +1020,7 @@ def cxr_export_vmf(sceneinfo, output_vmf):
       vmfinfo.mapversion = 4
       
       #TODO: These need to be in options...
-      vmfinfo.skyname = b"sky_csgo_night02b"
+      vmfinfo.skyname = bpy.context.scene.cxr_data.skyname.encode('utf-8')
       vmfinfo.detailvbsp = b"detail.vbsp"
       vmfinfo.detailmaterial = b"detail/detailsprites"
       vmfinfo.lightmap_scale = 12
@@ -979,6 +1033,8 @@ def cxr_export_vmf(sceneinfo, output_vmf):
 
       def _buildsolid( cmd ):
          nonlocal m
+         
+         print( F"{vmfinfo.brush_count} :: {cmd['object'].name}" )
 
          baked = mesh_cxr_format( cmd['object'] )
          world = libcxr_decompose.call( baked, None )
@@ -1023,7 +1079,9 @@ def cxr_export_vmf(sceneinfo, output_vmf):
                m.kv( kv[0], ' '.join([str(_) for _ in kv[2]]) )
             else: m.kv( kv[0], str(kv[2]) )
          
-         if not isinstance( obj, bpy.types.Collection ):
+         if obj == None:
+            pass
+         elif not isinstance( obj, bpy.types.Collection ):
             if obj.type == 'MESH':
                if not _buildsolid( ent ):
                   cxr_batch_lines()
@@ -1046,10 +1104,10 @@ def compile_image(img):
 
    dims = img.cxr_data.export_res
    fmt = { 
-      'RGBA': NBVTF_IMAGE_FORMAT_RGBA8888,
+      'RGBA': NBVTF_IMAGE_FORMAT_ABGR8888,
       'DXT1': NBVTF_IMAGE_FORMAT_DXT1,
       'DXT5': NBVTF_IMAGE_FORMAT_DXT5,
-      'RGB': NBVTF_IMAGE_FORMAT_RGB888
+      'RGB': NBVTF_IMAGE_FORMAT_BGR888
    }[ img.cxr_data.fmt ]
 
    mipmap = img.cxr_data.mipmap
@@ -1231,8 +1289,13 @@ def cxr_export_modelsrc( mdl, origin, asset_dir, project_name, transform ):
 
    # Collect materials to be compiled, and temp rename for export
    mat_dict = {}
-
+   
+   vphys = None
    for obj in mdl.objects:
+      if obj.name == F"{mdl.name}_phy":
+         vphys = obj
+         continue
+
       obj.select_set(state=True)
       for ms in obj.material_slots:
          if ms.material != None:
@@ -1249,6 +1312,18 @@ def cxr_export_modelsrc( mdl, origin, asset_dir, project_name, transform ):
       bake_space_transform=False
    )
    
+   bpy.ops.object.select_all(action='DESELECT')
+   
+   if vphys != None:
+      vphys.select_set(state=True)
+      bpy.ops.export_scene.fbx( filepath=F'{asset_dir}/{uid}_phy.fbx',\
+         check_existing=False,
+         use_selection=True,
+         apply_unit_scale=False,
+         bake_space_transform=False
+      )
+      bpy.ops.object.select_all(action='DESELECT')
+
    # Fix material names back to original
    for mat in mat_dict:
       mat.name = mat_dict[mat]
@@ -1264,8 +1339,13 @@ def cxr_export_modelsrc( mdl, origin, asset_dir, project_name, transform ):
       o.write(F'$body _ "{uid}_ref.fbx"\n')
       o.write(F'$staticprop\n')
       o.write(F'$origin {origin[0]} {origin[1]} {origin[2]}\n')
+      
+      if vphys != None:
+         o.write(F'$collisionmodel "{uid}_phy.fbx"\n')
+         o.write("{\n")
+         o.write(" $concave\n")
+         o.write("}\n")
 
-      #TODO: vphys
       o.write(F'$cdmaterials {project_name}\n')
       o.write(F'$sequence idle {uid}_ref.fbx\n')
 
@@ -1352,7 +1432,8 @@ class CXR_PREVIEW_OPERATOR(bpy.types.Operator):
                "No-Candidate",\
                "Internal-Fail",\
                "Non-Coplanar",\
-               "Non-Convex Polygon"]\
+               "Non-Convex Polygon",\
+               "Bad Result"]\
                [err.value]
 
          if static.RUNNING:
@@ -1563,21 +1644,52 @@ class CXR_COMPILER_CHAIN(bpy.types.Operator):
          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 isinstance(ent['object'],bpy.types.Collection): continue
-
-            if ent['object'].type == 'MESH':
+            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 )
-         
-         # TODO.. this  should just be in the entity loop
-         for hero in sceneinfo['heros']:
-            uid = asset_uid(hero['collection'])
+            
+         for mdl in a_models:
+            uid = asset_uid(mdl)
             qc_jobs += [F'{uid}.qc']
-            for obj in hero['collection'].objects:
+
+            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:
@@ -1596,89 +1708,91 @@ class CXR_COMPILER_CHAIN(bpy.types.Operator):
          # Convexer jobs
          static.JOBID = 0
          static.JOBINFO = []
-
-         static.JOBINFO += [{ 
-            "title": "Convexer",
-            "w": 20,
-            "colour": (1.0,0.3,0.1,1.0),
-            "exec": cxr_export_vmf,
-            "jobs": [(sceneinfo,output_vmf)]
-         }]
          
-         if len(image_jobs) > 0:
-            static.JOBINFO += [{
-               "title": "Textures",
-               "w": 40,
-               "colour": (0.1,1.0,0.3,1.0),
-               "exec": compile_image,
-               "jobs": image_jobs
-            }]
-
-         # FBX stage
-
-         if len(sceneinfo['heros']) > 0:
-            static.JOBINFO += [{
-               "title": "Batches",
-               "w": 25,
-               "colour": (0.5,0.5,1.0,1.0),
-               "exec": cxr_export_modelsrc,
-               "jobs": [(h['collection'], h['origin'], asset_dir, \
-                     settings.project_name, h['transform']) for h in \
-                     sceneinfo['heros']]
+         if settings.comp_vmf:
+            static.JOBINFO += [{ 
+               "title": "Convexer",
+               "w": 20,
+               "colour": (1.0,0.3,0.1,1.0),
+               "exec": cxr_export_vmf,
+               "jobs": [(sceneinfo,output_vmf)]
             }]
          
-         # VBSP stage
+         if settings.comp_textures:
+            if len(image_jobs) > 0:
+               static.JOBINFO += [{
+                  "title": "Textures",
+                  "w": 40,
+                  "colour": (0.1,1.0,0.3,1.0),
+                  "exec": compile_image,
+                  "jobs": image_jobs
+               }]
+
          game = 'z:'+settings.subdir.replace('/','\\')
          args = [ \
              '-game', game, settings.project_name
          ]
+
+         # FBX stage
+         if settings.comp_models:
+            if len(model_jobs) > 0:
+               static.JOBINFO += [{
+                  "title": "Batches",
+                  "w": 25,
+                  "colour": (0.5,0.5,1.0,1.0),
+                  "exec": cxr_export_modelsrc,
+                  "jobs": model_jobs
+               }]
          
-         if len(qc_jobs) > 0:
+            if len(qc_jobs) > 0:
+               static.JOBINFO += [{
+                  "title": "StudioMDL",
+                  "w": 20,
+                  "colour": (0.8,0.1,0.1,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:
             static.JOBINFO += [{
-               "title": "StudioMDL",
-               "w": 20,
-               "colour": (0.8,0.1,0.1,1.0),
-               "exec": "studiomdl",
-               "jobs": [[settings[F'exe_studiomdl']] + [\
-                     '-nop4', '-game', game, qc] for qc in qc_jobs],
-               "cwd": asset_dir
+               "title": "VBSP",
+               "w": 25,
+               "colour": (0.1,0.2,1.0,1.0),
+               "exec": "vbsp",
+               "jobs": [[settings[F'exe_vbsp']] + args],
+               "cwd": directory
+            }]
+            
+            static.JOBINFO += [{
+               "title": "VVIS",
+               "w": 25,
+               "colour": (0.9,0.5,0.5,1.0),
+               "exec": "vvis",
+               "jobs": [[settings[F'exe_vvis']] + ['-fast'] + args ],
+               "cwd": directory
+            }]
+            
+            vrad_opt = settings.opt_vrad.split()
+            static.JOBINFO += [{
+               "title": "VRAD",
+               "w": 25,
+               "colour": (0.9,0.2,0.3,1.0),
+               "exec": "vrad",
+               "jobs": [[settings[F'exe_vrad']] + vrad_opt + args ],
+               "cwd": directory
             }]
 
-         static.JOBINFO += [{
-            "title": "VBSP",
-            "w": 25,
-            "colour": (0.1,0.2,1.0,1.0),
-            "exec": "vbsp",
-            "jobs": [[settings[F'exe_vbsp']] + args],
-            "cwd": directory
-         }]
-         
-         static.JOBINFO += [{
-            "title": "VVIS",
-            "w": 25,
-            "colour": (0.9,0.5,0.5,1.0),
-            "exec": "vvis",
-            "jobs": [[settings[F'exe_vvis']] + args],
-            "cwd": directory
-         }]
-         
-         static.JOBINFO += [{
-            "title": "VRAD",
-            "w": 25,
-            "colour": (0.9,0.2,0.3,1.0),
-            "exec": "vrad",
-            "jobs": [[settings[F'exe_vrad']] + args],
-            "cwd": directory
-         }]
-
-         static.JOBINFO += [{
-            "title": "CXR",
-            "w": 5,
-            "colour": (0.0,1.0,0.4,1.0),
-            "exec": cxr_patchmap,
-            "jobs": [(F"{directory}/{settings.project_name}.bsp",\
-                      F"{settings.subdir}/maps/{settings.project_name}.bsp")]
-         }]
+            static.JOBINFO += [{
+               "title": "CXR",
+               "w": 5,
+               "colour": (0.0,1.0,0.4,1.0),
+               "exec": cxr_patchmap,
+               "jobs": [(F"{directory}/{settings.project_name}.bsp",\
+                         F"{settings.subdir}/maps/{settings.project_name}.bsp")]
+            }]
 
          static.USER_EXIT=False
          static.TIMER=wm.event_timer_add(0.1,window=context.window)
@@ -1707,6 +1821,40 @@ class CXR_RESET_HASHES(bpy.types.Operator):
 
       return {'FINISHED'}
 
+class CXR_COMPILE_MATERIAL(bpy.types.Operator):
+   bl_idname="convexer.matcomp"
+   bl_label="Recompile Material"
+
+   def execute(_,context):
+      active_obj = bpy.context.active_object
+      active_mat = active_obj.active_material
+      
+      #TODO: reduce code dupe (L1663)
+      for pair in compile_material(active_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']
+            prop.cxr_data.flags = flags
+
+            compile_image( prop )
+
+      settings = bpy.context.scene.cxr_data
+      with open(F'{settings.subdir}/cfg/convexer_mat_update.cfg','w') as o:
+         o.write(F'mat_reloadmaterial {asset_name(active_mat)}')
+
+      # TODO: Move this
+      with open(F'{settings.subdir}/cfg/convexer.cfg','w') as o:
+         o.write('sv_cheats 1\n')
+         o.write('mp_warmup_pausetimer 1\n')
+         o.write('bot_kick\n')
+         o.write('alias cxr_reload "exec convexer_mat_update"\n')
+
+      return {'FINISHED'}
+
 # Convexer panels 
 # ------------------------------------------------------------------------------
 
@@ -1752,6 +1900,8 @@ class CXR_INTERFACE(bpy.types.Panel):
 
       _.layout.prop(settings, "debug")
       _.layout.prop(settings, "scale_factor")
+      _.layout.prop(settings, "skybox_scale_factor")
+      _.layout.prop(settings, "skyname" )
       _.layout.prop(settings, "lightmap_scale")
       _.layout.prop(settings, "light_scale" )
       _.layout.prop(settings, "image_quality" )
@@ -1767,6 +1917,14 @@ class CXR_INTERFACE(bpy.types.Panel):
       box.prop(settings, "exe_vbsp")
       box.prop(settings, "exe_vvis")
       box.prop(settings, "exe_vrad")
+      box.prop(settings, "opt_vrad")
+
+      box = box.box()
+      row = box.row()
+      row.prop(settings,"comp_vmf")
+      row.prop(settings,"comp_textures")
+      row.prop(settings,"comp_models")
+      row.prop(settings,"comp_compile")
       
       text = "Compile" if CXR_COMPILER_CHAIN.TIMER == None else "Cancel"
       row = box.row()
@@ -1792,10 +1950,11 @@ class CXR_MATERIAL_PANEL(bpy.types.Panel):
       info = material_info( active_material )
 
       _.layout.label(text=F"{info['name']} @{info['res'][0]}x{info['res'][1]}")
-      _.layout.prop( properties, "shader" )
+      row = _.layout.row()
+      row.prop( properties, "shader" )
+      row.operator( "convexer.matcomp" )
 
-      for xk in info:
-         _.layout.label(text=F"{xk}:={info[xk]}")
+      #for xk in info: _.layout.label(text=F"{xk}:={info[xk]}")
       
       def _mtex( name, img, uiParent ):
          nonlocal properties
@@ -2059,14 +2218,15 @@ class CXR_SCENE_SETTINGS(bpy.types.PropertyGroup):
    exe_vvis: bpy.props.StringProperty( name="vvis" )
    opt_vvis: bpy.props.StringProperty( name="args" )
    exe_vrad: bpy.props.StringProperty( name="vrad" )
-   opt_vrad: bpy.props.StringProperty( name="args" )
+   opt_vrad: bpy.props.StringProperty( name="args", \
+         default="-reflectivityScale 0.35 -aoscale 1.4 -final -textureshadows -hdr -StaticPropLighting -StaticPropPolys" )
 
    debug: bpy.props.BoolProperty(name="Debug",default=False)
    scale_factor: bpy.props.FloatProperty( name="VMF Scale factor", \
          default=32.0,min=1.0)
    skybox_scale_factor: bpy.props.FloatProperty( name="Sky Scale factor", \
          default=1.0,min=0.01)
-
+   skyname: bpy.props.StringProperty(name="Skyname",default="sky_csgo_night02b")
    skybox_offset: bpy.props.FloatProperty(name="Sky offset",default=-4096.0)
    light_scale: bpy.props.FloatProperty(name="Light Scale",default=1.0/5.0)
    include_names: bpy.props.BoolProperty(name="Append original file names",\
@@ -2076,13 +2236,18 @@ class CXR_SCENE_SETTINGS(bpy.types.PropertyGroup):
    image_quality: bpy.props.IntProperty(name="Texture Quality (0-18)",\
          default=8, min=0, max=18 )
 
+   comp_vmf: bpy.props.BoolProperty(name="VMF",default=True)
+   comp_models: bpy.props.BoolProperty(name="Models",default=True)
+   comp_textures: bpy.props.BoolProperty(name="Textures",default=True)
+   comp_compile: bpy.props.BoolProperty(name="Compile",default=True)
 
 classes = [ CXR_RELOAD, CXR_DEV_OPERATOR, CXR_INTERFACE, \
             CXR_MATERIAL_PANEL, CXR_IMAGE_SETTINGS,\
             CXR_MODEL_SETTINGS, CXR_ENTITY_SETTINGS, CXR_CUBEMAP_SETTINGS,\
             CXR_LIGHT_SETTINGS, CXR_SCENE_SETTINGS, CXR_DETECT_COMPILERS,\
             CXR_ENTITY_PANEL, CXR_LIGHT_PANEL, CXR_PREVIEW_OPERATOR,\
-            CXR_VIEW3D, CXR_COMPILER_CHAIN, CXR_RESET_HASHES ]
+            CXR_VIEW3D, CXR_COMPILER_CHAIN, CXR_RESET_HASHES,\
+            CXR_COMPILE_MATERIAL]
 
 vmt_param_dynamic_class = None