Skip to content

Commit 15bab7a

Browse files
committed
Version 0.0.2
1 parent aa0aef9 commit 15bab7a

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@ UnityPyTypetreeCodegen
55
Used in
66
- https://github.com/mos9527/UnityPyLive2DExtractor
77
- Uses generated classes in https://github.com/mos9527/UnityPyLive2DExtractor/tree/main/UnityPyLive2DExtractor/generated
8-
8+
- https://github.com/mos9527/sssekai/
9+
- Used for AppHash in https://github.com/mos9527/sssekai/tree/main/sssekai/generated
10+
- https://github.com/mos9527/sssekai_blender_io/
11+
- Used for TransportDefine in https://github.com/mos9527/sssekai_blender_io/tree/master/scripts/rla_transport_defines/generated
912
## Usage
10-
TODO.
13+
Example usage in `rla_transport_defines`
14+
```python
15+
from generated.Sekai.Streaming import TransportDefine
16+
from generated import UTTCGen_AsInstance
17+
18+
for reader in filter(lambda x: x.type == ClassIDType.MonoBehaviour, env.objects):
19+
name = reader.peek_name()
20+
if name.startswith("TransportDefine"):
21+
instance = UTTCGen_AsInstance(reader, "Sekai.Streaming.TransportDefine")
22+
# ...or `instance = UTTCGen_AsInstance(reader)` is `m_Script` field is accessible
23+
instance : TransportDefine
24+
print(f'"{name}":({instance.validBones}, {instance.validBlendShapes}),')
25+
# Possibly modify on the instance itself and saving it is also possible
26+
instance.validBones[0] = "BadBone"
27+
instance.save()
28+
29+
```

UnityPyTypetreeCodegen/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = (0, 0, 1)
1+
__version__ = (0, 0, 2)

UnityPyTypetreeCodegen/__main__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ def UTTCGen_AsInstance(src: MonoBehaviour | ObjectReader, fullname: str = None)
181181

182182

183183
def translate_name(m_Name: str, **kwargs):
184+
"""A la https://github.com/K0lb3/UnityPy/blob/b811a2942297b5d8107e9a10249df80a87492282/UnityPy/helpers/TypeTreeNode.py#L361.
185+
With extra handling for templated/generic types and reserved keywords.
186+
"""
184187
NG = "<>|`="
185188
m_Name = m_Name.replace("<>", "__generic_") # Generic templates
186189
m_Name = m_Name.replace("<", "_").replace(">", "_") # Templated

0 commit comments

Comments
 (0)