glTF exporter: Do not export special attributes, used internally by Blender

This commit is contained in:
Julien Duroure 2022-11-02 19:10:34 +01:00
parent c4dddb88e7
commit addeb64f82
3 changed files with 16 additions and 2 deletions

View File

@ -4,7 +4,7 @@
bl_info = {
'name': 'glTF 2.0 format',
'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
"version": (3, 4, 43),
"version": (3, 4, 44),
'blender': (3, 3, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',

View File

@ -3,4 +3,12 @@
BLENDER_IOR = 1.45
BLENDER_SPECULAR = 0.5
BLENDER_SPECULAR_TINT = 0.0
BLENDER_SPECULAR_TINT = 0.0
SPECIAL_ATTRIBUTES = {
".select_vert",
".select_edge",
".select_poly",
"material_index"
}

View File

@ -9,6 +9,7 @@ from ...io.com.gltf2_io_debug import print_console
from io_scene_gltf2.blender.exp import gltf2_blender_gather_skins
from io_scene_gltf2.io.com import gltf2_io_constants
from io_scene_gltf2.blender.com import gltf2_blender_conversion
from io_scene_gltf2.blender.com import gltf2_blender_default
def extract_primitives(blender_mesh, uuid_for_skined_data, blender_vertex_groups, modifiers, export_settings):
@ -137,6 +138,11 @@ class PrimitiveCreator:
def define_attributes(self):
# Manage attributes + COLOR_0
for blender_attribute_index, blender_attribute in enumerate(self.blender_mesh.attributes):
# Excluse special attributes (used internally by Blender)
if blender_attribute.name in gltf2_blender_default.SPECIAL_ATTRIBUTES:
continue
attr = {}
attr['blender_attribute_index'] = blender_attribute_index
attr['blender_name'] = blender_attribute.name