diff options
Diffstat (limited to 'io_scene_gltf2/io/com/gltf2_io_constants.py')
-rwxr-xr-x | io_scene_gltf2/io/com/gltf2_io_constants.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/io_scene_gltf2/io/com/gltf2_io_constants.py b/io_scene_gltf2/io/com/gltf2_io_constants.py index 873e004e..983fe9ab 100755 --- a/io_scene_gltf2/io/com/gltf2_io_constants.py +++ b/io_scene_gltf2/io/com/gltf2_io_constants.py @@ -35,6 +35,18 @@ class ComponentType(IntEnum): }[component_type] @classmethod + def to_numpy_dtype(cls, component_type): + import numpy as np + return { + ComponentType.Byte: np.int8, + ComponentType.UnsignedByte: np.uint8, + ComponentType.Short: np.int16, + ComponentType.UnsignedShort: np.uint16, + ComponentType.UnsignedInt: np.uint32, + ComponentType.Float: np.float32, + }[component_type] + + @classmethod def from_legacy_define(cls, type_define): return { GLTF_COMPONENT_TYPE_BYTE: ComponentType.Byte, |