Skip to content

Commit 50264e7

Browse files
committed
Compatiblity functions
1 parent de48a37 commit 50264e7

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

demosys/resources/data.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ class DataFiles(BaseRegistry):
6565
def __init__(self):
6666
super().__init__()
6767

68+
def get(self, path: str, cls=Data, mode='binary', **kwargs) -> Data:
69+
"""Compatibility function for the old resource system"""
70+
return self.load(path, cls=cls, mode=mode, **kwargs)
71+
6872
def load(self, path: str, cls=Data, mode='binary', **kwargs) -> Data:
6973
"""
7074
Load Data object or get existing

demosys/resources/scenes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ def __init__(self):
3030
import_string(loader) for loader in settings.SCENE_LOADERS
3131
]
3232

33+
def get(self, path: Union[str, Path], **kwargs) -> Scene:
34+
"""Compatibility function for the old resource system"""
35+
return self.load(path, **kwargs)
36+
3337
def load(self, path: Union[str, Path], **kwargs) -> Scene:
3438
"""
3539
Get or create a scene object.

demosys/resources/shaders.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ class Shaders(BaseRegistry):
2525
def __init__(self):
2626
super().__init__()
2727

28+
def get(self, path: Union[str, Path], **kwargs) -> ShaderProgram:
29+
"""Compatibility method with the old resource system"""
30+
return self.load(path, **kwargs)
31+
2832
def load(self, path: Union[str, Path], **kwargs) -> ShaderProgram:
2933
"""
3034
load shader program or return an exiting program.

demosys/resources/textures.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ class Textures(BaseRegistry):
2727
def __init__(self):
2828
super().__init__()
2929

30+
def get(self, path: Union[str, Path], cls=Texture2D, **kwargs) -> Union[Texture2D, TextureArray]:
31+
"""Compatibility with old resource system"""
32+
return self.load(path, cls=cls, **kwargs)
33+
3034
def load(self, path: Union[str, Path], cls=Texture2D, **kwargs) -> Union[Texture2D, TextureArray]:
3135
"""
3236
Get or create a texture object.

0 commit comments

Comments
 (0)