Ejemplo n.º 1
0
 def dump(self, vmf: VMF, vis_name: str = 'Collisions') -> None:
     """Dump all the bounding boxes as a set of brushes."""
     visgroup = vmf.create_visgroup(vis_name)
     for name, bb_list in self._by_name.items():
         group = EntityGroup(vmf, shown=False)
         for bbox in bb_list:
             ent = bbox.as_ent(vmf)
             ent['item_id'] = name
             ent.visgroup_ids.add(visgroup.id)
             ent.groups.add(group.id)
             ent.vis_shown = False
             ent.hidden = True
Ejemplo n.º 2
0
def test_vmf() -> None:
    """Verify the positions by generating a VMF."""
    vmf = VMF()
    for shape in SHAPES:
        group = vmf.create_visgroup(
            shape.name.replace('/', '_').replace('fizzler',
                                                 '').replace('__', '_'))
        for pos, angle in shape.points:
            ent = vmf.create_ent(
                'prop_static',
                model='models/props_map_editor/fizzler.mdl',
                origin=pos @ angle,
                angles=angle,
            )
            ent.visgroup_ids.add(group.id)
            ent.vis_shown = False
    print('Dumping shape.vmf')
    with open('shape.vmf', 'w') as f:
        vmf.export(f)