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:
authorflorianfelix <florianfelixmeyer@gmail.com>2017-07-11 16:30:49 +0300
committerflorianfelix <florianfelixmeyer@gmail.com>2017-07-11 16:30:49 +0300
commit53439abc3f5b7105c89c29769586bb61bcc7cc2e (patch)
tree9c076189e486e87154525b385240ae1e1e17c3a1 /node_wrangler.py
parenta85e4c87bac01642c8d64d7196c966445d13c623 (diff)
Add user prefs for tag lists
Diffstat (limited to 'node_wrangler.py')
-rw-r--r--node_wrangler.py84
1 files changed, 74 insertions, 10 deletions
diff --git a/node_wrangler.py b/node_wrangler.py
index 5df13dbc..22939b8b 100644
--- a/node_wrangler.py
+++ b/node_wrangler.py
@@ -18,7 +18,7 @@
bl_info = {
"name": "Node Wrangler",
- "author": "Bartek Skorupa, Greg Zaal, Sebastian Koenig, Christian Brinkmann, Florian Meyer",
+ "author": "Bartek Skorupa, Greg Zaal, Sebastian Koenig, Christian Brinkmann",
"version": (3, 35),
"blender": (2, 79, 0),
"location": "Node Editor Toolbar or Ctrl-Space",
@@ -988,6 +988,44 @@ def get_nodes_links(context):
return tree.nodes, tree.links
+# Principled prefs
+class NWPrincipledPreferences(bpy.types.PropertyGroup):
+ base_color = StringProperty(
+ name='Base Color',
+ default='diffuse diff albedo base col color',
+ description='Naming Components for Base Color maps')
+ sss_color = StringProperty(
+ name='Subsurface Color',
+ default='sss subsurface',
+ description='Naming Components for Subsurface Color maps')
+ metallic = StringProperty(
+ name='Metallic',
+ default='metallic metalness metal mtl',
+ description='Naming Components for metallness maps')
+ specular = StringProperty(
+ name='Specular',
+ default='specularity specular spec spc',
+ description='Naming Components for Specular maps')
+ normal = StringProperty(
+ name='Normal',
+ default='normal nor nrm nrml norm',
+ description='Naming Components for Normal maps')
+ bump = StringProperty(
+ name='Bump',
+ default='bump bmp',
+ description='Naming Components for bump maps')
+ rough = StringProperty(
+ name='Roughness',
+ default='roughness rough rgh',
+ description='Naming Components for roughness maps')
+ gloss = StringProperty(
+ name='Gloss',
+ default='gloss glossy glossyness',
+ description='Naming Components for glossy maps')
+ displacement = StringProperty(
+ name='Displacement',
+ default='displacement disp dsp height',
+ description='Naming Components for bump maps')
# Addon prefs
class NWNodeWrangler(bpy.types.AddonPreferences):
@@ -1021,6 +1059,12 @@ class NWNodeWrangler(bpy.types.AddonPreferences):
default="",
description="Show only hotkeys that have this text in their name"
)
+ show_principled_lists = BoolProperty(
+ name="Show Principled naming tags",
+ default=False,
+ description="Expand this box into a list of all naming tags for principled texture setup"
+ )
+ principled_tags = bpy.props.PointerProperty(type=NWPrincipledPreferences)
def draw(self, context):
layout = self.layout
@@ -1054,6 +1098,24 @@ class NWNodeWrangler(bpy.types.AddonPreferences):
keystr = "Ctrl " + keystr
row.label(keystr)
+ box = layout.box()
+ col = box.column(align=True)
+ col.prop(self, "show_principled_lists", text='Show tags for Principled auto setup', toggle=True)
+ if self.show_principled_lists:
+ tags = self.principled_tags
+
+ col.prop(tags, "base_color")
+ col.prop(tags, "sss_color")
+ col.prop(tags, "metallic")
+ col.prop(tags, "specular")
+ col.prop(tags, "rough")
+ col.prop(tags, "gloss")
+ col.prop(tags, "normal")
+ col.prop(tags, "bump")
+ col.prop(tags, "displacement")
+
+
+
def nw_check(context):
space = context.space_data
valid_trees = ["ShaderNodeTree", "CompositorNodeTree", "TextureNodeTree"]
@@ -2626,19 +2688,21 @@ class NWAddPrincipledSetup(Operator, NWBase, ImportHelper):
# Filter textures names for texturetypes in filenames
# [Socket Name, [abbreviations and keyword list], Filename placeholder]
- normal_abbr = ['normal', 'nor', 'nrm', 'nrml', 'norm']
- bump_abbr = ['bump', 'bmp']
- gloss_abbr = ['gloss', 'glossy', 'glossyness']
- rough_abbr = ['roughness', 'rough', 'rgh']
+ tags = context.user_preferences.addons[__name__].preferences.principled_tags
+ normal_abbr = tags.normal.split(' ')
+ bump_abbr = tags.bump.split(' ')
+ gloss_abbr = tags.gloss.split(' ')
+ rough_abbr = tags.rough.split(' ')
socketnames = [
- ['Displacement', ['displacement', 'disp', 'dsp', 'height'], None],
- ['Base Color', ['diffuse', 'diff', 'albedo', 'base', 'col', 'color'], None],
- ['Subsurface Color', ['sss', 'subsurface'], None],
- ['Metallic', ['metallic', 'metalness', 'metal', 'mtl'], None],
- ['Specular', ['specularity', 'specular', 'spec', 'spc'], None],
+ ['Displacement', tags.displacement.split(' '), None],
+ ['Base Color', tags.base_color.split(' '), None],
+ ['Subsurface Color', tags.sss_color.split(' '), None],
+ ['Metallic', tags.metallic.split(' '), None],
+ ['Specular', tags.specular.split(' '), None],
['Roughness', rough_abbr + gloss_abbr, None],
['Normal', normal_abbr + bump_abbr, None],
]
+
# Look through texture_types and set value as filename of first matched file
def match_files_to_socket_names():
for sname in socketnames: