Changelog
Version 2.3.4
Added
srctools.choreo, for parsing choreographed scenes.Allow passing
FrozenVectoVMF.make_prism()/make_hollow().Fix bare strings on the end of CRLF lines eating the
\r.Escape characters like “ when exporting VMFs and BSPs. This isn’t supported by regular Source, but can be added by other branches.
Added
Keyvalues.line_num, to allow reporting the source location in exceptions.Keyvalues.export()is now deprecated, useserialise()instead.Allow passing VMF settings via keyword arguments - the
map_infodictionary parameter is now deprecated.Allow directly passing enums to set VMF keyvalues and fixups, if the
valueis itself a valid value.Parse Strata Source’s other VMF additions - viewport configuration, brush face vertices and instance visibility.
Add
Tokenizer.plus_operator, allowing + to be parsed as an operator for FGDs but still be valid inside bare strings elsewhere. These are common ingameinfo.txt.Add
Solid.is_cordonto replacecordon_solid, better representing its boolean nature.Fix #29: Fix
0x03characters causing an early EOF in the tokeniser.Preserve passed in key casing in
find_key()/find_block()’s return values.
Version 2.3.17
Added
Keyvalues.serialise(), a replacement forexport().Fix + and = being parsed as part of a bare string if not the first character.
Fix keyvalue-type snippets causing a parse error for code coming after them.
Include filename/line number in missing snippet errors.
Version 2.3.16
Fix entity keyvalues being lowercased when parsed from files.
Add “snippets” to FGD parsing, allowing reuse of descriptions and other small pieces of data.
Allow VMTs to use
/* */comments.#24: Fixed incorrect
matrix.inverse()being calculated. PR by Ozxybox.Allow omitting file/line number parameters for TokenSyntaxError.
Allow passing
PrismFacetoVMF.add_brush().Parse Strata Source’s VMF displacement data.
Remove negative zeros when formatting vector and angle values.
Expand
Angle/Matrix.from_basis()to pick the orientation if less than 2 vectors are provided.Add
vmf.Side.from_normal(), which generates a VMF face pointing in an arbitary direction.Add
vmf.Solid.point_inside(), which checks if a point is inside or outside a brush.
Version 2.3.15
HammerAddons#237: FGD model helpers should override each other.
Fix #20: VTF.compute_mipmaps() not working for cubemaps.
Correctly handle .vvd/.vtx etc files being packed as
MODEL <srctools.const.FileType.GENERIC.Improve performance of pure-Python VTF save/loading code.
Add
Vec.clamped(), for applying min/max bounds to a vector.Fix
Entity.make_unique()renaming entities with numeric suffixes which were already unique.
Version 2.3.14
Drop support for Python 3.7.
Fix VMT parsing not handling Proxies { style braces.
Add Cythonised versions of
conv_int(), :py:func`~srctools.conv_float` and :py:func`~srctools.conv_bool`.Added a
repr()forsrctools.vmf.Entity.Automatically clean up up empty sets when removing entities from
VMF.by_classand.by_target.Fixed saving/loading issues with a number of VTF formats.
Version 2.3.13
Renamed
NO_FLASHLIGHTinbsp.StaticPropFlagstoNO_SHADOW_DEPTHto reflect the actual behaviour of the flag, added the realNO_FLASHLIGHTdefine.Add
Tokenizer.preserve_comments, which producesCOMMENTtokens instead of discarding them.Fix #18: Incorrect module/function names in logging messages (via @ENDERZOMBI102).
Fix
srctools.mdl.Model.apply_patches()not applying material proxies from the parent.Use
surrogateescapewhen eonciding/decoding BSP data, to allow values to round-trip.
Version 2.3.12
Handle the special
$gender“variable” in WAV filenames.Add
prop_door_rotatingclass resource function.Remove
weapon_scriptclass resource function, instead use a direct resource in the FGD.Use py:func:!typing_extensions.deprecated to mark functions and methods which should not be used.
Version 2.3.11
Include the docs and tests in the source distribution.
Add support for detecting and packing weapon scripts.
Make custom model gibs inherit skinset when packing.
Add
srctools.bsp.BModel.clear_physics(), to delete physics data for a brush model.Add
srctools.keyvalues.LeafKeyvalueError, raised when block-only operations are attempted on leaf keyvalues. This improves the messages raised and makes them consistent.Fix
srctools.vtf.Frameindexing behaviour. It would access totally incorrect pixels.Correctly read/write L4D2’s BSP format.
Version 2.3.10
Fix
srctools.vtf.Frame.copy_from()not clearing cached unparsed file data. If the VTF was parsed from a file, this could case changes to be overwritten with the original data.Add
srctools.vtf.Frame.fill(), for filling a frame with a constant colour.Add support for Chaos non-uniform static prop scaling (by @ozxybox).
Correctly handle non-float numeric values being passed to various
srctools.mathoperations.Compute the total vertex count for parsed models.
Version 2.3.9
Fix Cython version of
Vec.join()using a default ofx y z, notx, y, z.Improve internal FGD database format to allow parsing entities as they are required. For best efficiency, use
EntityDef.engine_def()instead ofFGD.engine_dbase()if possible.Fix a few bugs with instance collapsing.
Version 2.3.8
Fix
srctools.loggerdiscardingtrio.MultiError(or its backport) if it bubbles up to the toplevel.Tweak VMF
localise()andtranslate()type hints to allowFrozenVecas the origin.Make movement and rotation of displacements work correctly.
Handle pitch keyvalues correctly when instancing, only rotating if it is a specific type.
Changed
srctools.instancing.collapse_one()to use the entclass database directly, deprecating thefgdparameter as a result.Fix
BSP.surfedgesincorrectly using edge0, which may cause a single invisible triangle in maps.
Version 2.3.7
Removed some unusable constructor parameters from
srctools.vmf.VMF, since they required passing in an object which requires the not-yet-constructedVMFas a parameter.Renamed
srctools.fgd.KeyValuestoKVDef, so it is not confused with KV1 trees.Replace
on_errorcallback insrctools.logger.init_logging()witherror, which now takes just anBaseException.SurfaceProphas been rewritten to useattrsto simplify code.Add
srctools.run.send_engine_command(), which executes console commands in a running Source game.VecandFrozenVecno longer inherits fromtyping.SupportsRound, since typeshed updated the overloads forround()to permit zero-arg calls to return a non-inttype.Permit VMFs to accept frozen math classes directly as keyvalues.
Fix multiplying vectors and
Vec.norm_mask()not producingFrozenVec.Parse errors in
BSP.entsare more informative and verbose.Add an additional callback parameter to
PackList.pack_into_zip()to finely control which files are packed.Implement vector and angle stringification manually, to ensure
.0prefixes are always removed.Use
FrozenVecandFrozenAnglein thedmxmodule instead ofnamedtuple()subclasses.Upgrade
srctools.dmx.Timeto a full class instead of atyping.NewType.Fix packlist logic inadvertently discarding
skinsetkeyvalue hints when packing models.Change behaviour of DMX
nameandidattributes to match game logic.nameis actually a regular attribute, but the uuid has a unique type and so can coexist with an attribute of the same name.Add support for Black Mesa’s static prop format.
Support integer values for soundscript channels, instead of just
CHAN_constants.Add a distinct exception (
RootEscapeError) for when../paths go above the root of a filesystem.
Version 2.3.6
Add ability to specify resources used in entities to the FGD file, move internal class resource definitions to the Hammer Addons repository.
Added new
srctools.fgd.EntityDef.get_resources()method, replacingfgd.entclass_*()methods.When parsing VMF outputs, assume extraneous commas are part of the parameter.
Add
FrozenVec,FrozenAngleandFrozenMatrix- immutable versions of the existing classes. This is a far better version ofVec_tuple, which is now deprecated.Build Python 3.11 wheels.
Drop dependency on
atomicwrites, it is no longer being maintained.
Version 2.3.5
Expand on documentation, build into explicit docs files.
Fix
srctools.logging.LoggerAdapter.log()being invalid in Python 3.7.Make
srctools.fgdwork when reloaded.Remove blank
srctools.choreomodule.Disable iterating on
srctools.math.Matrix, this is not useful.Add iterable parameter to
srctools.dmx.Attribute.array(), for constructing arrays with values.Fix DMX
booltofloatconversions mistakenly returningintinstead.Remove useless
header_lenattribute fromsrctools.vpk.VPK.Rename
srctools.property_parser.Propertytosrctools.keyvalues.Keyvalues, as well asNoKeyErrorandKeyValError.Allow parsing
srctools.fgd.IODeftypes which normally are not allowed for I/O. This will be substituted when exporting.Use
__class__.__name__in reprs, to better support subclasses.Issue #14: Disable some size checks on LZMA decompression, so more TF2 maps can be parsed.
Version 2.3.4
Add public submodules to
__all__.Disable escapes when parsing gameinfo files.
Add unprefixed
vtxfiles tosrctools.mdl.MDL_EXTS.Skip empty folder/extension dicts when writing VPK files.
Clean up VPK fileinfo dicts when deleting files.
Default
srctools.fgd.IODeftosrctools.fgd.ValueTypes.VOID.Sort tags when exporting FGDs, to make it determinstic.
Version 2.3.3
Writing out soundscript/particle cache can be non-atomic.
Vendor code from deprecated
chunk.Chunkstandard library class.Fix bad use of builtin generics.
Version 2.3.2
Make particle systems use a cache file for the manifest too.
Make
srctools.fgd.FGD.engine_db()actually cache and copy the database.Automatically add the
updatefolder to searchpath precedence, fixing TeamSpen210/HammerAddons#164.Make DMX scalar type deduction more strict (removing iterable -> vec support), making it typesafe.
Add
srctools.math.Matrix.from_angstr().
Version 2.3.1
Fix
srctools.vmf.Output.combine()not handlingtimescorrectly.srctools.math.quickhull()is now public.Restrict
srctools.bsp.Overlay.min_cpu,max_cpu,min_gpuandmax_gputo valid values.Test against Python 3.11.
Read/write the
LEAFMINDISTTOWATERlump data intosrctools.bsp.VisLeaf.min_water_dist.Read/write the
LEAFWATERDATAlump.Copy flags when copying
srctools.bsp.TexInfofrom an existing source.srctools.tokenizer.Tokenizernow handles universal newlines conversion.Disallow newlines in keyvalues keys when parsing by default. This catches syntax errors earlier.
More
srctools.game.Gamegameinfo.txtfields are now optional.
Version 2.3.0
Postcompiler code has been moved to HammerAddons.
Fix raw sound filenames not stripping special characters from the start when packing.
Allow
srctools.dmx.Colorto omit alpha when parsed from strings, and roound/clamp values.Handle INFRA’s altered
srctools.bsp.Primitivelump.Read soundscripts and breakable chunk files with code page 1252.
Handle TF2’s LZMA compressed lumps.
Detect various alternate versions of
srctools.bsp.StaticProplumps, and parse them.srctools.vmf.Entitynow directly implementscollections.abc.MutableMapping. Direct access to theEntity.keysdictis deprecated.Correctly handle proxy blocks in
VMTpatch shaders.DMX stub and null elements use an immutable subclass, instead of having elements be None-able.
Disallow entities to have a blank classname.
Elide long arrays in element reprs.
Add some additional logs when finding propcombine models fails.
Clean up
srctools.Property.build()API.Make error messages more clear when
Tokenizer.error()is used directly with aToken.Include potential variables in
KeyErrorfromsrctools.vmf.EntityFixup.substitute().Remove support for deprecated
imghdrmodule.Upgrade plugin finding logic to ensure each source is mounted under a persistent ID.
Add missing
srctools.bsp.Primitive.dynamic_shadows.Deprecate
srctools.AtomicWriter, use theatomicwritesmodule.srctools._class_resourcesis now only imported when required.Use Cython when building, instead of including sources.
srctools.vmf.Entity.fixupwill instantiate theEntityFixupobject only when actually required.
Version 2.2.5
Restore
srctools.dmx.Attribute.iter_str()etc method’s ability to iterate scalars.Suppress warnings in
Property.copy().
Version 2.2.4
Fix behaviour of
Property.__getitem__()andProperty.__setitem__().Improve performance of
VPKparsing.Add support for Portal Revolution’s
FGDhelper tweaks.Add option to collapse and remove IO proxies entirely.
Fix
ModelCompilercreating directories with relative paths.Pass through unknown model flag bits unchanged.
Fix VPK ascii check.
Handle VMF groups correctly.
Add
Vec.bbox_intersect().Add
srctools.dmx.Attribute.iter_str()etc methods for iterating converted values. Directly iterating theAttributeis deprecated.Add
srctools.dmx.Attribute.append(),extend()andclear_array()methods.Fix corruption from mistaken deduplication of
srctools.bsp.VisLeafandPrimitivelumps.
Version 2.2.3
Fix use of builtin generics.
Version 2.2.2
Document some known particle manifest paths.
Handle double-spacing in animation particle options.
Improve type hints in
srctools.smd.
Version 2.2.1
Version 2.2.0
Make
srctools.compiler.mdl_compilergeneric, to allow typechecking results.Add
srctools.particles.DMX attributes may now be copied using the
copymodule, and also tested for equality.srctools.sndscript.Soundnow lazily creates operator stack keyvalue objects.srctools.packlist.PackListnow can pack particle systems, and generate particle manifests.Animation events which spawn particles are also detected.
Version 2.1.0
Fix
%-formatted logs breaking whensrctools.loggeris used.Add
Property.extend(), instead of using+or<Property.append()with a block. That usage is deprecated.Deprecate creating root properties with
name=None.srctools.filesys.FileSystemChainis no longer generic, this is not useful.Add functions which embed a Keyvalues1 tree in a DMX tree.