Skip to content

Commit 0739479

Browse files
committed
Going EX
1 parent 22d23e7 commit 0739479

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

UnityPyTypetreeCodegen/__main__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def UTTCGen_GetClass(src: MonoBehaviour | str) -> Type:
148148
return UTTCG_Classes.get(src, None)
149149
150150
T = TypeVar("T")
151-
def UTTCGen_AsInstance(cls : Type[T], src: MonoBehaviour | ObjectReader) -> T:
151+
def UTTCGen_AsInstance(cls : Type[T], src: MonoBehaviour | ObjectReader, check_read : bool = True) -> T:
152152
"""Instantiate a class from the typetree definition and the raw data.
153153
154154
In most cases, this is the function you want to use.
@@ -157,13 +157,14 @@ def UTTCGen_AsInstance(cls : Type[T], src: MonoBehaviour | ObjectReader) -> T:
157157
Args:
158158
cls: The class to instantiate. This should be a class that has been decorated with the UTTCGen decorator.
159159
src (MonoBehaviour | ObjectReader): The MonoBehaviour instance or ObjectReader to read from.
160+
check_read (bool): Whether to check if all fields are read. Defaults to True.
160161
161162
Returns:
162163
An instance of the class defined by the typetree.
163164
"""
164165
if isinstance(src, MonoBehaviour):
165166
src = src.object_reader
166-
raw_def = src.read_typetree(cls.__typetree__, check_read=False)
167+
raw_def = src.read_typetree(cls.__typetree__, check_read=check_read)
167168
instance = cls(object_reader=src, **raw_def)
168169
return instance
169170
''',
@@ -220,7 +221,6 @@ def translate_name(m_Name: str, **kwargs):
220221
from UnityPy import classes as UnityBuiltin
221222
from TypeTreeGeneratorAPI import TypeTreeNode
222223
from logging import getLogger
223-
from coloredlogs import install
224224

225225
import os, shutil
226226
from typing import Dict, List

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"License :: OSI Approved :: Apache Software License",
2222
"Operating System :: OS Independent",
2323
],
24-
install_requires=["typetreegeneratorapi", "UnityPy>=1.21"],
24+
install_requires=["TypeTreeGeneratorAPIEx", "UnityPy>=1.21"],
2525
entry_points={
2626
"console_scripts": [
2727
"UnityPyTypetreeCodegen = UnityPyTypetreeCodegen.__main__:__main__"

0 commit comments

Comments
 (0)