Commit 7ce48cd4 authored by dylan grafmyre's avatar dylan grafmyre
Browse files

list more for gen bspzip, since bsp cannot be used witgh gmod

parent 69af4022
......@@ -12,14 +12,19 @@ ARGP = argparse.ArgumentParser()
ARGP.add_argument('vmf', type=argparse.FileType())
ARGP.add_argument('--pack-used-local', action='store_true')
ARGP.add_argument('--verbose', '-v', action='store_true')
ARGP.add_argument('--list', '--ls', '-l', action='store_true')
def emit_item(path):
def emit_item(argp, path):
if not os.path.exists(path):
raise RuntimeWarning('file missing: %r', path)
def emit_material(name, dedupe):
if argp.list:
# bspzip src\ndst\n pairs
def emit_material(argp, name, dedupe):
material_lower = 'materials/{}'.format(name.lower())
if material_lower in dedupe:
LOGGER.debug('material removd by de-dupe: %r %r', name, material_lower)
......@@ -35,9 +40,9 @@ def emit_material(name, dedupe):
for ext in ['vtf', 'vmt']:
material_ext = '{}.{}'.format(path, ext)
emit_item(argp, material_ext)
def emit_model(path, dedupe):
def emit_model(argp, path, dedupe):
model_lower = path.lower()
if model_lower in dedupe:
LOGGER.debug('model removd by de-dupe: %r %r', path, model_lower)
......@@ -53,10 +58,10 @@ def emit_model(path, dedupe):
model_base = os.path.splitext(path)[0]
for ext in ['dx80.vtx', 'dx90.vtx', 'mdl', 'phy', 'sw.vtx', 'vvd']:
model_ext = '{}.{}'.format(model_base, ext)
emit_item(argp, model_ext)
for material in pyvmf.mdl_materials(path):
emit_material(material, dedupe)
emit_material(argp, material, dedupe)
def main(argp=None, argv=None):
if argp is None:
......@@ -75,10 +80,10 @@ def main(argp=None, argv=None):
dedupe = set()
for prop in vmf.iter_props():
model = prop.attributes['model']
emit_model(model, dedupe)
emit_model(argp, model, dedupe)
for leaf, material in vmf.iter_materials():
emit_material(material, dedupe)
emit_material(argp, material, dedupe)
return 0
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment