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:
authorJulien Duroure <julien.duroure@gmail.com>2021-02-25 21:08:53 +0300
committerJulien Duroure <julien.duroure@gmail.com>2021-02-25 21:08:53 +0300
commit8d24537a6e9c6e39f7d18d1bf3f4d162a85edd11 (patch)
treefb99c9635d5f902e4fb5b2853a143d0c2b6f8882 /io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives.py
parent37af7e130b99865575f1fa2315ef806f815b0f42 (diff)
gltf exporter: new feature: export 'Loose Points' and 'Loose Edges'
Diffstat (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives.py')
-rwxr-xr-xio_scene_gltf2/blender/exp/gltf2_blender_gather_primitives.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives.py
index 8678db83..9f9b949a 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives.py
@@ -1,4 +1,4 @@
-# Copyright 2018-2019 The glTF-Blender-IO authors.
+# Copyright 2018-2021 The glTF-Blender-IO authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -54,7 +54,7 @@ def gather_primitives(
material_idx = internal_primitive['material']
material = None
- if export_settings['gltf_materials'] == "EXPORT":
+ if export_settings['gltf_materials'] == "EXPORT" and material_idx is not None:
blender_material = None
if material_names:
i = material_idx if material_idx < len(material_names) else -1
@@ -73,7 +73,7 @@ def gather_primitives(
extras=None,
indices=internal_primitive['indices'],
material=material,
- mode=None,
+ mode=internal_primitive['mode'],
targets=internal_primitive['targets']
)
primitives.append(primitive)
@@ -101,7 +101,8 @@ def __gather_cache_primitives(
primitive = {
"attributes": __gather_attributes(internal_primitive, blender_mesh, modifiers, export_settings),
"indices": __gather_indices(internal_primitive, blender_mesh, modifiers, export_settings),
- "material": internal_primitive['material'],
+ "mode": internal_primitive.get('mode'),
+ "material": internal_primitive.get('material'),
"targets": __gather_targets(internal_primitive, blender_mesh, modifiers, export_settings)
}
primitives.append(primitive)
@@ -109,7 +110,9 @@ def __gather_cache_primitives(
return primitives
def __gather_indices(blender_primitive, blender_mesh, modifiers, export_settings):
- indices = blender_primitive['indices']
+ indices = blender_primitive.get('indices')
+ if indices is None:
+ return None
# NOTE: Values used by some graphics APIs as "primitive restart" values are disallowed.
# Specifically, the values 65535 (in UINT16) and 4294967295 (in UINT32) cannot be used as indices.