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>2018-12-18 23:31:29 +0300
committerJulien Duroure <julien.duroure@gmail.com>2018-12-18 23:31:29 +0300
commitbf867f50228505710c51eb7d76832415c36d9f74 (patch)
tree0bff37b29027c65fd0dcd9f333772c2619f80532 /io_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py
parent9aa6c8058b32675b2636632d6735f66baf6300b1 (diff)
glTF exporter: various fixes & enhancement
* Fix some Yup conversions * reading material from glTF node group material if exists * Fix normal export * Round transforms near 0 and 1 * Fix exporting from Edit mode * Various image format management
Diffstat (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py')
-rwxr-xr-xio_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py
index 04b67da9..427f07ce 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py
@@ -41,7 +41,7 @@ def gather_material(blender_material, export_settings):
alpha_cutoff=__gather_alpha_cutoff(blender_material, export_settings),
alpha_mode=__gather_alpha_mode(blender_material, export_settings),
double_sided=__gather_double_sided(blender_material, export_settings),
- emissive_factor=__gather_emmissive_factor(blender_material, export_settings),
+ emissive_factor=__gather_emissive_factor(blender_material, export_settings),
emissive_texture=__gather_emissive_texture(blender_material, export_settings),
extensions=__gather_extensions(blender_material, export_settings),
extras=__gather_extras(blender_material, export_settings),
@@ -94,8 +94,10 @@ def __gather_double_sided(blender_material, export_settings):
return None
-def __gather_emmissive_factor(blender_material, export_settings):
+def __gather_emissive_factor(blender_material, export_settings):
emissive_socket = gltf2_blender_get.get_socket_or_texture_slot(blender_material, "Emissive")
+ if emissive_socket is None:
+ emissive_socket = gltf2_blender_get.get_socket_or_texture_slot_old(blender_material, "EmissiveFactor")
if isinstance(emissive_socket, bpy.types.NodeSocket) and not emissive_socket.is_linked:
return list(emissive_socket.default_value)[0:3]
return None
@@ -103,6 +105,8 @@ def __gather_emmissive_factor(blender_material, export_settings):
def __gather_emissive_texture(blender_material, export_settings):
emissive = gltf2_blender_get.get_socket_or_texture_slot(blender_material, "Emissive")
+ if emissive is None:
+ emissive = gltf2_blender_get.get_socket_or_texture_slot_old(blender_material, "Emissive")
return gltf2_blender_gather_texture_info.gather_texture_info((emissive,), export_settings)
@@ -127,15 +131,19 @@ def __gather_name(blender_material, export_settings):
def __gather_normal_texture(blender_material, export_settings):
normal = gltf2_blender_get.get_socket_or_texture_slot(blender_material, "Normal")
+ if normal is None:
+ normal = gltf2_blender_get.get_socket_or_texture_slot_old(blender_material, "Normal")
return gltf2_blender_gather_material_normal_texture_info_class.gather_material_normal_texture_info_class(
(normal,),
export_settings)
def __gather_occlusion_texture(blender_material, export_settings):
- emissive = gltf2_blender_get.get_socket_or_texture_slot(blender_material, "Occlusion")
+ occlusion = gltf2_blender_get.get_socket_or_texture_slot(blender_material, "Occlusion")
+ if occlusion is None:
+ occlusion = gltf2_blender_get.get_socket_or_texture_slot_old(blender_material, "Occlusion")
return gltf2_blender_gather_material_occlusion_texture_info_class.gather_material_occlusion_texture_info_class(
- (emissive,),
+ (occlusion,),
export_settings)