Page MenuHome

NodeWrangler Principled BSDF Auto Setup

Authored by Florian Meyer (testscreenings) on Jul 6 2017, 3:09 PM.



This adds an Operator for automatic texture setup for the Principled BSDF

It is relativly context aware:
If no texture is connected

a file dialog opens to select a folder

if a texture is connected

the folder of that texture is used

if more than one texture collection is present in the folder

the textures can be filtered down using a commen base name
the base name component is either lifted from the node label of the principled bsdf
or can be entered in popup or file selector

The only thing i could not get to work was calling it from the shift-space menu.
(link to my full copy in dropbox: )

Diff Detail

Event Timeline

Greg Zaal (gregzaal) requested changes to this revision.Jul 6 2017, 6:43 PM

Some small comments inline, but otherwise it's nice :) One major issue though with how users should select textures...

As it is now, they have to manually type the basename in. This is a pain for several reasons but also limited. So rather do something like the NWAddMultipleImages class does where the users selects multiple files - this allows the user to leave out one of the maps if they wish (e.g. to use normal instead of bump) and to use maps with different basenames. Maybe ignore the idea of basenames entirely and just look at the last few characters of the filename (up to a separator) to determine the map type.



There is a function for this already: get_nodes_links(context) which returns (tree.nodes, tree.links) for the active tree


We prefer to stick to pep8 convention: space after #, and capitalized. I know we're not consistent about this but at least a space will make it easier to read.

So this should be: # Check every node in tree...

Do for all comments of course.




I don't think it is - see the NWAddMultipleImages class


metal surely? No double l


Should specular and reflection maps not be used for the specular input? I often see both spec map and rough/gloss map in the same material.


Add norm


Bump should be supported too

This revision now requires changes to proceed.Jul 6 2017, 6:43 PM
Florian Meyer (testscreenings) edited edge metadata.

I think i have rewritten most (maybe all) according to your recommendations.
It now always just opens a file dialog to allow picking of files.

I added displacement and specular
also it now smartly pick for bump or normal map

The lists with the abbreviations may need some more thoughts.

  • fixed matal one l issue
  • added auto invert node for glossy roghness maps
  • naming list for map selection should be ok now
Florian Meyer (testscreenings) marked 9 inline comments as done.Jul 10 2017, 6:16 PM

Maybe i should move the tags into the addonprefs so they become user editable?

Maybe i should move the tags into the addonprefs so they become user editable?

No harm in it, but I don't think anyone would need to change this, nor would they think to look in the user preferences to do so. If they really need to change it they can just edit the code, or rename their files. But eh, not against the idea.

Nice work on this :) commiting now...

This revision is now accepted and ready to land.Jul 11 2017, 10:49 AM