Skip to content

Commit ba8d856

Browse files
committed
Tidy up some code
1 parent 8eb8438 commit ba8d856

2 files changed

Lines changed: 13 additions & 19 deletions

File tree

src/hammeraddons/propcombine.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ class CollType(Enum):
5252

5353
@attrs.frozen
5454
class QC:
55+
"""The relevant we need from a QC."""
5556
path: str # QC path.
56-
ref_smd: str # Location of main visible geometry.
57-
phy_smd: Optional[str] # Relative location of collision model, or None
57+
ref_smd: str # Absolute location of main visible geometry.
58+
phy_smd: Optional[str] # Absolute location of collision model, or None
5859
ref_scale: float # Scale of main model.
5960
phy_scale: float # Scale of collision model.
6061
is_concave: bool # If the collision model is known to be concave.
@@ -150,10 +151,6 @@ def make_collision_brush(origin: Vec, angles: Angle, brush: BModel) -> Callable[
150151
"""Produce a collision checker using a brush entity."""
151152
# Transpose the angles, giving us the inverse transform.
152153
inv_angles = Matrix.from_angle(angles).transpose()
153-
# brushes = {
154-
# br for leaf in brush.node.iter_leafs()
155-
# for br in leaf.brushes
156-
# }
157154

158155
def check(point: Vec) -> bool:
159156
"""Check if the given position is inside the volume."""
@@ -336,7 +333,6 @@ async def compile_func(
336333
offset = Vec(prop.x, prop.y, prop.z)
337334
rot_matrix = Matrix.from_angle(prop.pit, prop.yaw, prop.rol)
338335

339-
340336
ref_mesh.append_model(child_ref, rot_matrix, offset, scale * qc.ref_scale)
341337

342338
if has_coll and child_coll is not None:
@@ -345,9 +341,9 @@ async def compile_func(
345341
matrix = Matrix()
346342

347343
# Set the scale
348-
matrix[0,0] = phy_scale.x
349-
matrix[1,1] = phy_scale.y
350-
matrix[2,2] = phy_scale.z
344+
matrix[0, 0] = phy_scale.x
345+
matrix[1, 1] = phy_scale.y
346+
matrix[2, 2] = phy_scale.z
351347

352348
# Rotate the matrix
353349
matrix @= rot_matrix
@@ -1271,15 +1267,15 @@ def get_grouping_key(prop: StaticProp) -> Optional[tuple]:
12711267
pack_models=pack_models,
12721268
) as compiler:
12731269
async def do_combine(group: List[StaticProp]) -> None:
1274-
nonlocal group_count
1270+
"""Task run to combine one prop."""
12751271
grouped_prop = await combine_group(compiler, group, get_model, volume_tolerance)
12761272
rejected.difference_update(group)
12771273
final_props.append(grouped_prop)
1278-
group_count += 1
12791274

12801275
async with trio.open_nursery() as nursery:
12811276
for group_ in grouper:
12821277
nursery.start_soon(do_combine, group_)
1278+
group_count += 1
12831279

12841280
final_props.extend(rejected)
12851281

transforms/p2_antline.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
If the one of the target entities is a prop_indicator_panel, it also
55
toggles that.
66
"""
7-
from typing import List, Set
8-
97
from srctools import Entity, Output
108
from srctools.logger import get_logger
119

@@ -48,15 +46,15 @@ def comp_antlines(ctx: Context):
4846
# These are the names, not the ents themselves.
4947

5048
# Or brush ents holding overlays.
51-
ind_overlays = set() # type: Set[str]
52-
ind_toggles = set() # type: Set[str]
49+
ind_overlays: set[str] = set()
50+
ind_toggles: set[str] = set()
5351
# These need the right inputs.
54-
ind_panel_tim = set() # type: Set[str]
55-
ind_panel_check = set() # type: Set[str]
52+
ind_panel_tim: set[str] = set()
53+
ind_panel_check: set[str] = set()
5654

5755
# Panels without an indicator set - we can use
5856
# these instead of a texturetoggle.
59-
unused_panels = [] # type: List[Entity]
57+
unused_panels: list[Entity] = []
6058

6159
for ind_ent in ctx.vmf.search(ind_name):
6260
cls = ind_ent['classname']

0 commit comments

Comments
 (0)