Skip to main content

Unity Typetree to Python Module code generator

Project description

UnityPyTypetreeCodegen

(WIP) Static TypeTree code analysis and code generation for UnityPy

Used in

Usage

Installation

pip install UnityPyTypetreeCodegen

Generating code

UnityPyTypetreeCodegen --json "path_to_typetree_json_dump" --output "generated_moudle_path"
UnityPyTypetreeCodegen --files "path_to_Assembly-CSharp_and_other_mono_dlls" --output "generated_moudle_path"
  • The emitted module will be structured like this
generated
├── __init__.py
└── Live2D
    └── Cubism
        ├── Core
        │   ├── __init__.py
        │   └── Unmanaged
        │       └── __init__.py
        ├── Framework
        │   ├── __init__.py
        │   ├── Expression
        │   │   └── __init__.py
        │   ├── HarmonicMotion
        │   │   └── __init__.py
        │   ├── Json
        │   │   └── __init__.py
        │   ├── LookAt
        │   │   └── __init__.py
        │   ├── Motion
        │   │   └── __init__.py
        │   ├── MotionFade
        │   │   └── __init__.py
        │   ├── MouthMovement
        │   │   └── __init__.py
        │   ├── Physics
        │   │   └── __init__.py
        │   ├── Pose
        │   │   └── __init__.py
        │   ├── Raycasting
        │   │   └── __init__.py
        │   ├── Tasking
        │   │   └── __init__.py
        │   └── UserData
        │       └── __init__.py
        └── Rendering
            ├── __init__.py
            └── Masking
                └── __init__.py

20 directories, 18 files

Using the generated module

Example usage in rla_transport_defines

env = UnityPy.load(...)
from generated import UTTCGen_AsInstance, UTTCGen_GetClass

for reader in filter(lambda x: x.type == ClassIDType.MonoBehaviour, env.objects):
    name = reader.peek_name()
    if name.startswith("TransportDefine"):        
        from generated.Sekai.Streaming import TransportDefine
        # ...or TransportDefine = UTTCGen_GetClass("Sekai.Streaming.TransportDefine")
        # ...or TransportDefine = UTTCGen_GetClass(reader.read(check_read=False))
        instance = UTTCGen_AsInstance(TransportDefine, reader)                
        print(f'"{name}":({instance.validBones}, {instance.validBlendShapes}),')
        # Possibly modify on the instance itself and saving it is also possible
        instance.validBones[0] = "BadBone"
        instance.save()
env.save()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unitypytypetreecodegen-0.0.9.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unitypytypetreecodegen-0.0.9-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file unitypytypetreecodegen-0.0.9.tar.gz.

File metadata

  • Download URL: unitypytypetreecodegen-0.0.9.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for unitypytypetreecodegen-0.0.9.tar.gz
Algorithm Hash digest
SHA256 f298a6e9873f99e2e719ce23dc03bd52b7dbd2dc05401e3bceae485304521c9a
MD5 9920c19d208956b069c054cc136a21f9
BLAKE2b-256 205a72908556118adf7415a0b381c6ca81f407911452775a83976b2423b12642

See more details on using hashes here.

File details

Details for the file unitypytypetreecodegen-0.0.9-py3-none-any.whl.

File metadata

File hashes

Hashes for unitypytypetreecodegen-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 ec4724d6c03b8ffea5256ca777dd62a94f87cc573c56bd7e543615d658d94edc
MD5 1e000614afcbb4f1c3ee9db815602f3b
BLAKE2b-256 2c38de6bd351f8986fe47ab3603cc368a33f4a2c8bbc30578cf0f0d77fd917da

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page