Skip to content

Commit

Permalink
Merge branch 'TeamSpen210:dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrthegamedev authored Dec 23, 2022
2 parents 99e7e99 + 80e4f55 commit 4fde43b
Show file tree
Hide file tree
Showing 18 changed files with 124 additions and 113 deletions.
16 changes: 8 additions & 8 deletions fgd/point/comp/comp_prop_cable.fgd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
[
0: "Straight"
1: "Spline Curve"
2: "Catenary "
2: "Catenary"
]

segments(integer) : "Segments" : 2 : "Number of nodes to generate between each cable. Higher values make smoother cables, but produce more faces."
Expand All @@ -27,15 +27,15 @@

coll_segments[engine](integer) : "Collision Segments" : 0
coll_sides[engine](integer) : "Collision Sides" : 0
coll_segments(choices) : "Collision Segments" : -1 : "Number of nodes to generate between each cable. Higher values make smoother cables, but produce more faces." =
coll_segments(choices) : "Collision Segments" : -1 : "Type in the number of convex segments to generate between each cable. Higher values make smoother collision, but produce more convex segments." =
[
-1: "Same as visual geometry"
-1: "[-1] Same as visual geometry"
]
coll_sides(choices) : "Collision Sides" : 0 : "Number of faces for each cylindrical collision section." =
coll_sides(choices) : "Collision Sides" : 0 : "Type in the number of faces for each cylindrical collision section. If set to less than 3 sides, collision will not be generated." =
[
0 : "No collisions"
1 : "No collisions"
2 : "No collisions"
0 : "[0] No collisions"
1 : "[1] No collisions"
2 : "[2] No collisions"
]

material(material) : "Cable Material" : "models/cables/generic_black" : "The material to use for the cable. Must be a model material."
Expand Down Expand Up @@ -75,5 +75,5 @@
drawinfastreflection[since_L4D](boolean) : "Render in Fast Reflections" : 0 : "If enabled, causes this entity/prop to to render in fast water reflections (i.e. when a water material specifies $reflectonlymarkedentities) and in the world impostor pass."
enablelightbounce[since_CSGO](boolean) : "Enable Bounced Lighting" : 0 : "Whether VRAD should create indirect lighting from this prop."

movespeed(integer) readonly: "Speed (unused)" : 1 : "This needs to be greater than zero to show the preview lines."
movespeed(integer) readonly: "Speed (unused)" : 1 : "This key needs to be greater than zero to show the preview in Hammer, ignore it."
]
16 changes: 8 additions & 8 deletions fgd/point/comp/comp_prop_rope.fgd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
[
0: "Straight"
1: "Spline Curve"
2: "Catenary "
2: "Catenary"
]

segments(integer) : "Segments" : 2 : "Number of nodes to generate between each rope. Higher values make smoother ropes, but produce more faces."
Expand All @@ -27,15 +27,15 @@

coll_segments[engine](integer) : "Collision Segments" : 0
coll_sides[engine](integer) : "Collision Sides" : 0
coll_segments(choices) : "Collision Segments" : -1 : "Number of nodes to generate between each rope. Higher values make smoother ropes, but produce more faces." =
coll_segments(choices) : "Collision Segments" : -1 : "Type in the number of convex segments to generate between each rope. Higher values make smoother collision, but produce more convex segments." =
[
-1: "Same as visual geometry"
-1: "[-1] Same as visual geometry"
]
coll_sides(choices) : "Collision Sides" : 0 : "Number of faces for each cylindrical collision section." =
coll_sides(choices) : "Collision Sides" : 0 : "Type in the number of faces for each cylindrical collision section. If set to less than 3 sides, collision will not be generated." =
[
0 : "No collisions"
1 : "No collisions"
2 : "No collisions"
0 : "[0] No collisions"
1 : "[1] No collisions"
2 : "[2] No collisions"
]

material(material) : "Rope Material" : "models/cables/generic_black" : "The material to use for the rope. Must be a model material."
Expand Down Expand Up @@ -77,5 +77,5 @@
drawinfastreflection[since_L4D](boolean) : "Render in Fast Reflections" : 0 : "If enabled, causes this entity/prop to to render in fast water reflections (i.e. when a water material specifies $reflectonlymarkedentities) and in the world impostor pass."
enablelightbounce[since_CSGO](boolean) : "Enable Bounced Lighting" : 0 : "Whether VRAD should create indirect lighting from this prop."

movespeed(integer) readonly: "Speed (unused)" : 1 : "This needs to be greater than zero to show the preview lines."
movespeed(integer) readonly: "Speed (unused)" : 1 : "This key needs to be greater than zero to show the preview in Hammer, ignore it."
]
15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[tool.isort]
sections=["FUTURE", "TYPING", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
known_thirdparty = ["srctools"]
extra_standard_library = ["importlib_resources"]
known_typing = ["typing", "typing_extensions"]
no_lines_before = ["TYPING", "FRAMEWORK", "STDLIB"]
multi_line_output = 5 # hanging grid grouped
line_length = 95
lines_after_imports = 2
use_parentheses = true
order_by_type = true
include_trailing_comma = true
from_first = true
combine_as_imports = true
src_paths = ["src"]
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
attrs >= 21.4.0
typing_extensions >= 4.2.0
srctools >= 2.3.6
srctools >= 2.3.7
trio >= 0.20.0
trio-typing>=0.7.0
4 changes: 3 additions & 1 deletion src/hammeraddons/acache.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
If another task tries retrieving while it's already being computed, the second waits for the existing
task.
"""
from typing import Generic, Iterator, TypeVar, Awaitable, Callable, Dict, Union, Tuple
from typing import Awaitable, Callable, Dict, Generic, Iterator, Tuple, TypeVar, Union
from typing_extensions import ParamSpec

import trio


KeyT = TypeVar('KeyT')
ValueT = TypeVar('ValueT')
Args = ParamSpec('Args')
Expand Down
12 changes: 4 additions & 8 deletions src/hammeraddons/bsp_transform/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""Transformations that can be applied to the BSP file."""
from typing import Awaitable, Callable, Dict, FrozenSet, List, Mapping, Optional, Tuple
from pathlib import Path
from typing import FrozenSet, Optional, Callable, Awaitable, Dict, Mapping, Tuple, List
import inspect

from srctools import EmptyMapping, FileSystem, Keyvalues, VMF, Output, Entity, FGD, conv_bool
from srctools import FGD, VMF, EmptyMapping, Entity, FileSystem, Keyvalues, Output, conv_bool
from srctools.bsp import BSP
from srctools.game import Game
from srctools.logger import get_logger
from srctools.packlist import PackList
from srctools.game import Game


LOGGER = get_logger(__name__, 'bsp_trans')
Expand Down Expand Up @@ -217,11 +217,7 @@ def _load() -> None:
This loads the transformations. We do it in a function to allow discarding
the output.
"""
from . import (
globals,
instancing,
packing,
)
from . import globals, instancing, packing


_load()
8 changes: 4 additions & 4 deletions src/hammeraddons/bsp_transform/globals.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""Apply transformations that work on (almost) all entities."""
import itertools
from typing import List, Tuple, Dict
from typing import Dict, List, Tuple
from collections import defaultdict
import itertools

from srctools.logger import get_logger
from srctools import Output
from srctools.logger import get_logger
from srctools.packlist import FileType

from hammeraddons.bsp_transform import trans, Context
from hammeraddons.bsp_transform import Context, trans


LOGGER = get_logger(__name__)
Expand Down
3 changes: 2 additions & 1 deletion src/hammeraddons/bsp_transform/instancing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
from srctools import Entity
from srctools.logger import get_logger

from hammeraddons.bsp_transform import trans, Context
from hammeraddons.bsp_transform import Context, trans


LOGGER = get_logger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions src/hammeraddons/bsp_transform/packing.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""Transformations for packing and precaching resources."""
from typing import Dict, Set
import os
from typing import Set, Dict

from srctools import Entity
from srctools.logger import get_logger
from srctools.packlist import FileType, unify_path

from hammeraddons.bsp_transform import check_control_enabled, trans, Context
from hammeraddons.bsp_transform import Context, check_control_enabled, trans


LOGGER = get_logger(__name__, 'trans.packing')
Expand Down
2 changes: 1 addition & 1 deletion src/hammeraddons/compare_datadesc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from srctools.fgd import EntityDef

from unify_fgd import load_database, expand_tags, match_tags
from unify_fgd import expand_tags, load_database, match_tags

repo_root = Path(__file__).parents[2]

Expand Down
15 changes: 7 additions & 8 deletions src/hammeraddons/config.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
"""Handles user configuration common to the different scripts."""
from typing import Callable, Dict, Iterator, Optional, Pattern as re_Pattern, Set, Union
from typing_extensions import Final, TypeAlias
from pathlib import Path
from typing import Callable, Iterator, Optional, Set, Dict, Union, Pattern as re_Pattern
from typing_extensions import TypeAlias, Final
import re
import fnmatch
import re
import sys

import attrs

from srctools import AtomicWriter, Keyvalues, logger
from srctools.filesys import FileSystem, FileSystemChain, RawFileSystem, VPKFileSystem
from srctools.game import Game
from srctools import Keyvalues, logger, AtomicWriter
from srctools.filesys import FileSystemChain, FileSystem, RawFileSystem, VPKFileSystem
import attrs

from .plugin import BUILTIN as BUILTIN_PLUGIN, PluginFinder, Source as PluginSource
from .props_config import Opt, Options
from .plugin import Source as PluginSource, PluginFinder, BUILTIN as BUILTIN_PLUGIN


LOGGER = logger.get_logger(__name__)
Expand Down
10 changes: 5 additions & 5 deletions src/hammeraddons/mdl_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
Each comes with a key, used to identify a previously compiled version.
We can then reuse already compiled versions.
"""
from typing import Any, Awaitable, Callable, Generic, Hashable, List, Set, Tuple, TypeVar
from pathlib import Path
import os
import pickle
import tempfile
import random
from typing import Awaitable, Callable, Tuple, Set, TypeVar, Hashable, Generic, Any, List
from pathlib import Path
import tempfile

from srctools import logger, AtomicWriter
from srctools import AtomicWriter, logger
from srctools.game import Game
from srctools.mdl import MDL_EXTS
from srctools.packlist import PackList

import trio

from hammeraddons.acache import ACache
from hammeraddons.bsp_transform import Context


LOGGER = logger.get_logger(__name__)
ModelKey = TypeVar('ModelKey', bound=Hashable)
InT = TypeVar('InT')
Expand Down
8 changes: 4 additions & 4 deletions src/hammeraddons/move_shim.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
Implement deprecation warnings while keeping that functional.
"""
from typing import Optional, Union, Sequence, Dict
from importlib.abc import MetaPathFinder, Loader
from typing import Dict, Optional, Sequence, Union
from importlib.abc import Loader, MetaPathFinder
from importlib.machinery import ModuleSpec
from importlib.util import spec_from_loader, module_from_spec
from importlib.util import module_from_spec, spec_from_loader
import sys
import types
import warnings

from hammeraddons import bsp_transform, mdl_compiler, plugin, propcombine, config, props_config
from hammeraddons import bsp_transform, config, mdl_compiler, plugin, propcombine, props_config


moves: Dict[str, types.ModuleType] = {
Expand Down
12 changes: 6 additions & 6 deletions src/hammeraddons/plugin.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
"""Logic for loading all the code in arbitary locations for plugin purposes."""
from pathlib import Path
from typing import Callable, Dict, Iterable, Iterator, Optional, Sequence, Set, Tuple, Union
from typing_extensions import Final
from collections import deque
from importlib.util import spec_from_loader
from importlib.abc import MetaPathFinder
from importlib.machinery import ModuleSpec, SourceFileLoader
from typing import Callable, Dict, Union, Optional, Set, Sequence, Tuple, Iterable, Iterator
from typing_extensions import Final
from importlib.util import spec_from_loader
from pathlib import Path
import importlib
import types

import attrs

from srctools import Keyvalues
from srctools.logger import get_logger
import attrs


LOGGER = get_logger(__name__)
BUILTIN: Final = 'builtin'
Expand Down
20 changes: 11 additions & 9 deletions src/hammeraddons/postcompiler.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
"""Runs before VRAD, to run operations on the final BSP."""
import re
from pathlib import Path
import sys
import warnings
from collections import defaultdict
from pathlib import Path

from srctools.logger import Formatter, init_logging
import trio # Registers MultiError traceback hook

from srctools.logger import init_logging, Formatter

# Put the logs in the executable folders.
LOGGER = init_logging(Path(sys.argv[0]).with_name('postcompiler.log'))
warnings.filterwarnings(category=DeprecationWarning, module='srctools', action='once')

from typing import Dict, List, Optional
from collections import defaultdict
from logging import FileHandler
import argparse
import os
from logging import FileHandler
from typing import List, Dict, Optional
import re

from srctools import __version__ as version_lib, conv_bool
from srctools.filesys import ZipFileSystem
from srctools.fgd import FGD
from srctools.bsp import BSP
from srctools.fgd import FGD
from srctools.filesys import ZipFileSystem
from srctools.packlist import PackList

from hammeraddons import __version__ as version_haddons, config, propcombine
from hammeraddons.bsp_transform import run_transformations
from hammeraddons import propcombine, config, __version__ as version_haddons
from hammeraddons.move_shim import install as install_depmodule_hook


install_depmodule_hook()


Expand Down
36 changes: 18 additions & 18 deletions src/hammeraddons/propcombine.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,37 @@
This merges static props together, so they can be drawn with a single
draw call.
"""
from typing import (
Callable, Dict, FrozenSet, Iterable, Iterator, List, MutableMapping, Optional, Set, Tuple,
Union,
)
from collections import defaultdict
from enum import Enum
from pathlib import Path
from tempfile import TemporaryDirectory
import fnmatch
import itertools
import operator
import os
import re
import shutil
import itertools
from collections import defaultdict
from enum import Enum
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import (
Optional, Tuple, Callable,
FrozenSet, Dict, List, Set,
Iterator, Union, MutableMapping, Iterable,
)

from srctools import VMF, Entity, conv_int, FileSystemChain, Keyvalues, KeyValError, bool_as_int
from srctools.math import Vec, Angle, Matrix, quickhull
from srctools.tokenizer import Tokenizer, Token
from srctools import (
VMF, Entity, FileSystemChain, KeyValError, Keyvalues, bool_as_int, conv_int,
)
from srctools.bsp import BSP, BModel, StaticProp, StaticPropFlags, VisLeaf
from srctools.game import Game
from srctools.logger import get_logger
from srctools.math import Angle, Matrix, Vec, quickhull
from srctools.mdl import MDL_EXTS, Model
from srctools.packlist import PackList
from srctools.bsp import BSP, StaticProp, StaticPropFlags, BModel, VisLeaf
from srctools.mdl import Model, MDL_EXTS
from srctools.smd import Bone, Mesh, Triangle, Vertex

import trio
from srctools.tokenizer import Token, Tokenizer
import attrs
import trio

from .mdl_compiler import ModelCompiler
from .acache import ACache
from .mdl_compiler import ModelCompiler


LOGGER = get_logger(__name__)
Expand Down
Loading

0 comments on commit 4fde43b

Please sign in to comment.