bsp Subpackage

Source code: bsp

vgio.quake.bsp.is_bspfile(filename)

Quickly see if a file is a bsp file by checking the magic number.

The filename argument may be a file for file-like object.

Parameters

filename – File to check as string or file-like object.

Returns

True if given file’s magic number is correct.

Bsp Class

class vgio.quake.bsp.Bsp

Factory class for working with bsp files. Will automatically detect the version of the provided file and open it with the correct versioned Bsp object.

Example

Basic usage:

from vgio.quake.bsp import Bsp
b = Bsp.open('example.bsp')
static Bsp.open(file, mode='r')

Open a Bsp object where file can be a path to a file (a string), or a file-like object.

Parameters
  • file – Either the path to the file, a file-like object, or bytes.

  • mode – An optional string that indicates which mode to open the file.

Returns

A Bsp object.