Skip to content

Commit aaa5645

Browse files
committed
classes.generated - add legacy patch type hints
1 parent 8ae4389 commit aaa5645

File tree

1 file changed

+60
-1
lines changed

1 file changed

+60
-1
lines changed

UnityPy/classes/generated.py

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from __future__ import annotations
33

44
from abc import ABC
5-
from typing import List, Optional, Tuple, TypeVar, Union
5+
from typing import List, Optional, Tuple, TypeVar, Union, TYPE_CHECKING
66

77
from attrs import define as attrs_define
88

@@ -2041,6 +2041,10 @@ class Pipeline(Component):
20412041
class Renderer(Component):
20422042
m_GameObject: PPtr[GameObject]
20432043

2044+
if TYPE_CHECKING:
2045+
from .legacy_patch.Renderer import export as _export
2046+
export = _export
2047+
20442048

20452049
@unitypy_define
20462050
class BillboardRenderer(Renderer):
@@ -2744,6 +2748,32 @@ class GameObject(EditorExtension):
27442748
m_Name: str
27452749
m_Tag: int
27462750

2751+
if TYPE_CHECKING:
2752+
from .legacy_patch.GameObject import (
2753+
_GameObject_Components, _GameObject_GetComponent
2754+
)
2755+
from ..enums import ClassIDType
2756+
2757+
m_Components = property(_GameObject_Components)
2758+
m_Animator = property(
2759+
lambda self: _GameObject_GetComponent(self, ClassIDType.Animator)
2760+
)
2761+
m_Animation = property(
2762+
lambda self: _GameObject_GetComponent(self, ClassIDType.Animation)
2763+
)
2764+
m_Transform = property(
2765+
lambda self: _GameObject_GetComponent(self, ClassIDType.Transform)
2766+
)
2767+
m_MeshRenderer = property(
2768+
lambda self: _GameObject_GetComponent(self, ClassIDType.MeshRenderer)
2769+
)
2770+
m_SkinnedMeshRenderer = property(
2771+
lambda self: _GameObject_GetComponent(self, ClassIDType.SkinnedMeshRenderer)
2772+
)
2773+
m_MeshFilter = property(
2774+
lambda self: _GameObject_GetComponent(self, ClassIDType.MeshFilter)
2775+
)
2776+
27472777

27482778
@unitypy_define
27492779
class NamedObject(EditorExtension, ABC):
@@ -4054,6 +4084,11 @@ class AudioClip(SampleClip):
40544084
m_Type: Optional[int] = None
40554085
m_UseHardware: Optional[bool] = None
40564086

4087+
if TYPE_CHECKING:
4088+
from .legacy_patch.AudioClip import _AudioClip_extension, _AudioClip_samples
4089+
extension = property(_AudioClip_extension)
4090+
samples = property(_AudioClip_samples)
4091+
40574092

40584093
@unitypy_define
40594094
class Avatar(NamedObject):
@@ -4451,6 +4486,10 @@ class Mesh(NamedObject):
44514486
m_VertexData: Optional[VertexData] = None
44524487
m_Vertices: Optional[List[Vector3f]] = None
44534488

4489+
if TYPE_CHECKING:
4490+
from .legacy_patch.Mesh import _Mesh_export
4491+
export = _Mesh_export
4492+
44544493

44554494
@unitypy_define
44564495
class Motion(NamedObject, ABC):
@@ -4657,6 +4696,10 @@ class Shader(NamedObject):
46574696
platforms: Optional[List[int]] = None
46584697
stageCounts: Optional[List[int]] = None
46594698

4699+
if TYPE_CHECKING:
4700+
from .legacy_patch.Shader import _Shader_export
4701+
export = _Shader_export
4702+
46604703

46614704
@unitypy_define
46624705
class ShaderVariantCollection(NamedObject):
@@ -4691,6 +4734,10 @@ class Sprite(NamedObject):
46914734
m_ScriptableObjects: Optional[List[PPtr[MonoBehaviour]]] = None
46924735
m_SpriteAtlas: Optional[PPtr[SpriteAtlas]] = None
46934736

4737+
if TYPE_CHECKING:
4738+
from .legacy_patch.Sprite import _Sprite_image
4739+
image = property(_Sprite_image)
4740+
46944741

46954742
@unitypy_define
46964743
class SpriteAtlas(NamedObject):
@@ -4988,6 +5035,14 @@ class Texture2D(Texture):
49885035
m_StreamingMipmaps: Optional[bool] = None
49895036
m_StreamingMipmapsPriority: Optional[int] = None
49905037

5038+
if TYPE_CHECKING:
5039+
from .legacy_patch.Texture2D import (
5040+
_Texture2d_get_image, _Texture2D_get_image_data, _Texture2d_set_image
5041+
)
5042+
image = property(_Texture2d_get_image, _Texture2d_set_image)
5043+
set_image = _Texture2d_set_image
5044+
get_image_data = _Texture2D_get_image_data
5045+
49915046

49925047
@unitypy_define
49935048
class Cubemap(Texture2D):
@@ -5043,6 +5098,10 @@ class Texture2DArray(Texture):
50435098
m_StreamData: Optional[StreamingInfo] = None
50445099
m_UsageMode: Optional[int] = None
50455100

5101+
if TYPE_CHECKING:
5102+
from legacy_patch.Texture2DArray import _Texture2DArray_get_images
5103+
images = property(_Texture2DArray_get_images)
5104+
50465105

50475106
@unitypy_define
50485107
class Texture3D(Texture):

0 commit comments

Comments
 (0)