mirror of
https://github.com/blender/blender-addons.git
synced 2025-08-16 15:35:05 +00:00
Fix Node Wrangler issues with texturecan texture imports
Before this change, if you tried to "Add Principled Setup" for some texturecan.com materials, Node Wrangler used e.g. `metal_0010_normal_directx_1k.png` for the normal map. However Blender wants OpenGL style normal maps. With this change it now correctly picks `metal_0010_normal_opengl_1k.png`. Additionally, this change adds a (very) short README with instructions for how to run the Node Wrangler tests. Pull Request #104445
This commit is contained in:

committed by
Brecht Van Lommel

parent
ad26f1f421
commit
dda85f9ac5
5
node_wrangler/README.md
Normal file
5
node_wrangler/README.md
Normal file
@ -0,0 +1,5 @@
|
||||
# Running Tests
|
||||
|
||||
```
|
||||
./util_test.py
|
||||
```
|
@ -153,10 +153,13 @@ def match_files_to_socket_names(files, sockets):
|
||||
|
||||
for sname in sockets:
|
||||
for name, tag_list in names_to_tag_lists.items():
|
||||
if sname[0] == "Normal" and "dx" in tag_list:
|
||||
if sname[0] == "Normal":
|
||||
# Blender wants GL normals, not DX (DirectX) ones:
|
||||
# https://www.reddit.com/r/blender/comments/rbuaua/texture_contains_normaldx_and_normalgl_files/
|
||||
continue
|
||||
if 'dx' in tag_list:
|
||||
continue
|
||||
if 'directx' in tag_list:
|
||||
continue
|
||||
|
||||
matches = set(sname[1]).intersection(set(tag_list))
|
||||
if matches:
|
||||
|
@ -225,6 +225,34 @@ class TestPutFileNamesInSockets(unittest.TestCase):
|
||||
},
|
||||
)
|
||||
|
||||
def test_texturecan(self):
|
||||
"""Texture from: https://www.texturecan.com/details/67/"""
|
||||
|
||||
files = [
|
||||
MockFile("metal_0010_ao_1k.jpg"),
|
||||
MockFile("metal_0010_color_1k.jpg"),
|
||||
MockFile("metal_0010_height_1k.png"),
|
||||
MockFile("metal_0010_metallic_1k.jpg"),
|
||||
MockFile("metal_0010_normal_directx_1k.png"),
|
||||
MockFile("metal_0010_normal_opengl_1k.png"),
|
||||
MockFile("metal_0010_roughness_1k.jpg"),
|
||||
]
|
||||
sockets = sockets_fixture()
|
||||
match_files_to_socket_names(files, sockets)
|
||||
|
||||
assert_sockets(
|
||||
self,
|
||||
sockets,
|
||||
{
|
||||
"Ambient Occlusion": "metal_0010_ao_1k.jpg",
|
||||
"Base Color": "metal_0010_color_1k.jpg",
|
||||
"Displacement": "metal_0010_height_1k.png",
|
||||
"Metallic": "metal_0010_metallic_1k.jpg",
|
||||
"Normal": "metal_0010_normal_opengl_1k.png",
|
||||
"Roughness": "metal_0010_roughness_1k.jpg",
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(verbosity=2)
|
||||
|
Reference in New Issue
Block a user