diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2019-12-06 21:47:06 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2019-12-06 21:47:06 +0300 |
commit | 08352b3af7700c368c777ae7d840c2f80ad360db (patch) | |
tree | bb968c2b89fe9f5717a393797379f7bf2f72d8bd | |
parent | c4519cc9a85ded78815722ffa947789d33d596bf (diff) |
glTF importer: better names for UVMap and VertexColor
6 files changed, 13 insertions, 13 deletions
diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py index 9a381211..a696863e 100755 --- a/io_scene_gltf2/__init__.py +++ b/io_scene_gltf2/__init__.py @@ -15,7 +15,7 @@ bl_info = { 'name': 'glTF 2.0 format', 'author': 'Julien Duroure, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors', - "version": (1, 1, 20), + "version": (1, 1, 21), 'blender': (2, 81, 6), 'location': 'File > Import-Export', 'description': 'Import-Export as glTF 2.0', diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_KHR_materials_pbrSpecularGlossiness.py b/io_scene_gltf2/blender/imp/gltf2_blender_KHR_materials_pbrSpecularGlossiness.py index 7e5e11e4..961b6f7a 100755 --- a/io_scene_gltf2/blender/imp/gltf2_blender_KHR_materials_pbrSpecularGlossiness.py +++ b/io_scene_gltf2/blender/imp/gltf2_blender_KHR_materials_pbrSpecularGlossiness.py @@ -62,7 +62,7 @@ class BlenderKHR_materials_pbrSpecularGlossiness(): else: # Create vertexcolor node to get COLOR_0 data vertexcolor_node = node_tree.nodes.new('ShaderNodeVertexColor') - vertexcolor_node.layer_name = 'COLOR_0' + vertexcolor_node.layer_name = 'Col' vertexcolor_node.location = -500, 0 # links @@ -75,7 +75,7 @@ class BlenderKHR_materials_pbrSpecularGlossiness(): # TODO tree locations # Create vertexcolor / separate / math nodes vertexcolor_node = node_tree.nodes.new('ShaderNodeVertexColor') - vertexcolor_node.layer_name = 'COLOR_0' + vertexcolor_node.layer_name = 'Col' separate_vertex_color = node_tree.nodes.new('ShaderNodeSeparateRGB') math_vc_R = node_tree.nodes.new('ShaderNodeMath') @@ -151,7 +151,7 @@ class BlenderKHR_materials_pbrSpecularGlossiness(): if vertex_color: # Create vertexcolor / separate / math nodes vertexcolor_node = node_tree.nodes.new('ShaderNodeVertexColor') - vertexcolor_node.layer_name = 'COLOR_0' + vertexcolor_node.layer_name = 'Col' vertexcolor_node.location = -2000, 250 separate_vertex_color = node_tree.nodes.new('ShaderNodeSeparateRGB') diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_map_normal.py b/io_scene_gltf2/blender/imp/gltf2_blender_map_normal.py index e59dab6c..a0d19146 100755 --- a/io_scene_gltf2/blender/imp/gltf2_blender_map_normal.py +++ b/io_scene_gltf2/blender/imp/gltf2_blender_map_normal.py @@ -66,7 +66,7 @@ class BlenderNormalMap(): if 'texCoord' in tex_info.extensions['KHR_texture_transform']: texcoord_idx = tex_info.extensions['KHR_texture_transform']['texCoord'] - normalmap_node.uv_map = 'TEXCOORD_%d' % texcoord_idx + normalmap_node.uv_map = 'UVMap' if texcoord_idx == 0 else 'UVMap.%03d' % texcoord_idx # Set strength if pymaterial.normal_texture.scale is not None: diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_material_utils.py b/io_scene_gltf2/blender/imp/gltf2_blender_material_utils.py index c9d81a4f..1d2664ef 100644 --- a/io_scene_gltf2/blender/imp/gltf2_blender_material_utils.py +++ b/io_scene_gltf2/blender/imp/gltf2_blender_material_utils.py @@ -84,7 +84,7 @@ def make_texture_block(gltf, node_tree, tex_info, location, label, name=None, co if 'texCoord' in tex_info.extensions['KHR_texture_transform']: texcoord_idx = tex_info.extensions['KHR_texture_transform']['texCoord'] - uv_map.uv_map = 'TEXCOORD_%d' % texcoord_idx + uv_map.uv_map = 'UVMap' if texcoord_idx == 0 else 'UVMap.%03d' % texcoord_idx # Links node_tree.links.new(mapping.inputs[0], uv_map.outputs[0]) diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py b/io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py index 5f796e51..04e68823 100755 --- a/io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py +++ b/io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py @@ -73,7 +73,7 @@ class BlenderPbr(): else: # Create attribute node to get COLOR_0 data vertexcolor_node = node_tree.nodes.new('ShaderNodeVertexColor') - vertexcolor_node.layer_name = 'COLOR_0' + vertexcolor_node.layer_name = 'Col' vertexcolor_node.location = -500, 0 if nodetype == "principled": @@ -96,7 +96,7 @@ class BlenderPbr(): # TODO tree locations # Create attribute / separate / math nodes vertexcolor_node = node_tree.nodes.new('ShaderNodeVertexColor') - vertexcolor_node.layer_name = 'COLOR_0' + vertexcolor_node.layer_name = 'Col' vc_mult_node = node_tree.nodes.new('ShaderNodeMixRGB') vc_mult_node.blend_type = 'MULTIPLY' @@ -140,7 +140,7 @@ class BlenderPbr(): if vertex_color: # Create attribute / separate / math nodes vertexcolor_node = node_tree.nodes.new('ShaderNodeVertexColor') - vertexcolor_node.layer_name = 'COLOR_0' + vertexcolor_node.layer_name = 'Col' vertexcolor_node.location = -2000, 250 vc_mult_node = node_tree.nodes.new('ShaderNodeMixRGB') diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_primitive.py b/io_scene_gltf2/blender/imp/gltf2_blender_primitive.py index 2a7eec17..58fc9b9c 100755 --- a/io_scene_gltf2/blender/imp/gltf2_blender_primitive.py +++ b/io_scene_gltf2/blender/imp/gltf2_blender_primitive.py @@ -126,10 +126,10 @@ class BlenderPrimitive(): ) break - layer_name = 'COLOR_%d' % set_num + layer_name = 'Col' if set_num == 0 else 'Col.%03d' % set_num layer = BlenderPrimitive.get_layer(bme.loops.layers.color, layer_name) - colors = BinaryData.get_data_from_accessor(gltf, attributes[layer_name], cache=True) + colors = BinaryData.get_data_from_accessor(gltf, attributes['COLOR_%d' % set_num], cache=True) # Check whether Blender takes RGB or RGBA colors (old versions only take RGB) is_rgba = len(colors[0]) == 4 @@ -161,10 +161,10 @@ class BlenderPrimitive(): ) break - layer_name = 'TEXCOORD_%d' % set_num + layer_name = 'UVMap' if set_num == 0 else 'UVMap.%03d' % set_num layer = BlenderPrimitive.get_layer(bme.loops.layers.uv, layer_name) - uvs = BinaryData.get_data_from_accessor(gltf, attributes[layer_name], cache=True) + uvs = BinaryData.get_data_from_accessor(gltf, attributes['TEXCOORD_%d' % set_num], cache=True) for bidx, pidx in vert_idxs: # UV transform |