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>2019-09-26 18:20:50 +0300
committerJulien Duroure <julien.duroure@gmail.com>2019-09-26 18:20:50 +0300
commit96036641899e5a9c84b5fd9963b49e6737328d4e (patch)
treed191e41c992de637934759806baa70797a771f34 /io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
parent1a4bf2229bbd17ae557f1890bcf771bc0e5b2e29 (diff)
glTF importer: create only 1 slot by material, if multiple primitive use same material
Diffstat (limited to 'io_scene_gltf2/blender/imp/gltf2_blender_mesh.py')
-rwxr-xr-xio_scene_gltf2/blender/imp/gltf2_blender_mesh.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py b/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
index cfe73058..0ba34dd5 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
@@ -61,9 +61,9 @@ class BlenderMesh():
material = bpy.data.materials[material_name]
try:
- material_idx = materials.index(material)
+ material_idx = materials.index(material.name)
except ValueError:
- materials.append(material)
+ materials.append(material.name)
material_idx = len(materials) - 1
BlenderPrimitive.add_primitive_to_bmesh(gltf, bme, pymesh, prim, material_idx)
@@ -72,8 +72,8 @@ class BlenderMesh():
mesh = bpy.data.meshes.new(name)
BlenderMesh.bmesh_to_mesh(gltf, pymesh, bme, mesh)
bme.free()
- for material in materials:
- mesh.materials.append(material)
+ for name_material in materials:
+ mesh.materials.append(bpy.data.materials[name_material])
mesh.update()
pymesh.blender_name = mesh.name