Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'io_scene_gltf2/io/com')
-rwxr-xr-xio_scene_gltf2/io/com/gltf2_io_constants.py5
-rw-r--r--io_scene_gltf2/io/com/gltf2_io_draco_compression_extension.py15
-rw-r--r--io_scene_gltf2/io/com/gltf2_io_variants.py29
3 files changed, 41 insertions, 8 deletions
diff --git a/io_scene_gltf2/io/com/gltf2_io_constants.py b/io_scene_gltf2/io/com/gltf2_io_constants.py
index 19ead516..816220d9 100755
--- a/io_scene_gltf2/io/com/gltf2_io_constants.py
+++ b/io_scene_gltf2/io/com/gltf2_io_constants.py
@@ -118,6 +118,9 @@ class TextureWrap(IntEnum):
MirroredRepeat = 33648
Repeat = 10497
+class BufferViewTarget(IntEnum):
+ ARRAY_BUFFER = 34962
+ ELEMENT_ARRAY_BUFFER = 34963
#################
# LEGACY DEFINES
@@ -145,3 +148,5 @@ GLTF_DATA_TYPE_VEC4 = "VEC4"
GLTF_DATA_TYPE_MAT2 = "MAT2"
GLTF_DATA_TYPE_MAT3 = "MAT3"
GLTF_DATA_TYPE_MAT4 = "MAT4"
+
+GLTF_IOR = 1.5 \ No newline at end of file
diff --git a/io_scene_gltf2/io/com/gltf2_io_draco_compression_extension.py b/io_scene_gltf2/io/com/gltf2_io_draco_compression_extension.py
index 28f06e51..b9f9ccec 100644
--- a/io_scene_gltf2/io/com/gltf2_io_draco_compression_extension.py
+++ b/io_scene_gltf2/io/com/gltf2_io_draco_compression_extension.py
@@ -27,7 +27,7 @@ def dll_path() -> Path:
'darwin': blender_root.parent / 'Resources' / python_lib / python_version / 'site-packages'
}.get(sys.platform)
else:
- path = Path(path)
+ return Path(path)
library_name = {
'win32': '{}.dll'.format(lib_name),
@@ -46,12 +46,11 @@ def dll_exists(quiet=False) -> bool:
Checks whether the DLL path exists.
:return: True if the DLL exists.
"""
- exists = dll_path().exists()
+ path = dll_path()
+ exists = path.exists() and path.is_file()
if quiet is False:
- print("'{}' ".format(dll_path().absolute()) + ("exists, draco mesh compression is available" if exists else
- "{} {} {}".format(
- "does not exist, draco mesh compression not available,",
- "please add it or create environment variable BLENDER_EXTERN_DRACO_LIBRARY_PATH",
- "pointing to the folder"
- )))
+ if exists:
+ print_console('INFO', 'Draco mesh compression is available, use library at %s' % dll_path().absolute())
+ else:
+ print_console('ERROR', 'Draco mesh compression is not available because library could not be found at %s' % dll_path().absolute())
return exists
diff --git a/io_scene_gltf2/io/com/gltf2_io_variants.py b/io_scene_gltf2/io/com/gltf2_io_variants.py
new file mode 100644
index 00000000..3824fee4
--- /dev/null
+++ b/io_scene_gltf2/io/com/gltf2_io_variants.py
@@ -0,0 +1,29 @@
+# SPDX-License-Identifier: Apache-2.0
+# Copyright 2018-2022 The glTF-Blender-IO authors.
+
+from io_scene_gltf2.io.com.gltf2_io import from_dict, from_union, from_none, from_float, from_str, from_list
+from io_scene_gltf2.io.com.gltf2_io import to_float, to_class
+
+class Variant:
+ """defines variant for use with glTF 2.0."""
+ def __init__(self, name, extensions, extras):
+ self.name = name
+ self.extensions = extensions
+ self.extras = extras
+
+ @staticmethod
+ def from_dict(obj):
+ assert isinstance(obj, dict)
+ name = from_union([from_str, from_none], obj.get("name"))
+ extensions = from_union([lambda x: from_dict(lambda x: from_dict(lambda x: x, x), x), from_none],
+ obj.get("extensions"))
+ extras = obj.get("extras")
+ return Variant(name, extensions, extras)
+
+ def to_dict(self):
+ result = {}
+ result["name"] = from_union([from_str, from_none], self.name)
+ result["extensions"] = from_union([lambda x: from_dict(lambda x: from_dict(lambda x: x, x), x), from_none],
+ self.extensions)
+ result["extras"] = self.extras
+ return result