Skip to content

Commit

Permalink
1_7_1
Browse files Browse the repository at this point in the history
Fixed UE Node color space values and added {blend_file}_{material_name} detection
  • Loading branch information
DigiKrafting committed Jun 26, 2019
1 parent 79caaff commit 7bb913c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"name": "DKS Substance Painter",
"description": "Substance Painter Pipeline",
"author": "DigiKrafting.Studio",
"version": (1, 7, 0),
"version": (1, 7, 1),
"blender": (2, 80, 0),
"location": "Info Toolbar, File -> Import, File -> Export, Menu",
"wiki_url": "https://github.com/DigiKrafting/blender_addon_substance_painter/wiki",
Expand Down
20 changes: 16 additions & 4 deletions dks_sp.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ def dks_sp_get_texture_file(texture_path,mesh_name,mat_name,texture_name,texture
texture_path=bpy.path.relpath(texture_path)+sep
return texture_path+mat_name+'_'+texture_name+'.'+texture_ext
else:
return ""
_blend=dks_sp_get_file_name()
if path.exists(texture_path+_blend+'_'+mat_name+'_'+texture_name+'.'+texture_ext):
if bpy.context.preferences.addons[__package__].preferences.option_relative:
texture_path=bpy.path.relpath(texture_path)+sep
return texture_path+_blend+'_'+mat_name+'_'+texture_name+'.'+texture_ext
else:
return ""

class dks_sp_pbr_nodes(bpy.types.Operator):

Expand Down Expand Up @@ -203,13 +209,14 @@ def execute(self, context):
_material_links.new(node.outputs['Color'], node_mix.inputs['Color1'])

node.image = bpy.data.images.load(_file_Base_Color)
node.image.colorspace_settings.name = 'sRGB'

node_orm=_nodes.new('ShaderNodeTexImage')
node_orm.location = -500,-200
node_orm.name='dks_pbr_texture_orm'

node_orm.image = bpy.data.images.load(_file_ORM)
node_orm.image.colorspace_settings.name = 'Linear'
node_orm.image.colorspace_settings.name = 'Non-Color'

node_sep_rgb=_nodes.new('ShaderNodeSeparateRGB')
node_sep_rgb.location = -200,-200
Expand Down Expand Up @@ -242,6 +249,8 @@ def execute(self, context):
node.image = bpy.data.images.load(_file_Base_Color)
elif _file_Diffuse:
node.image = bpy.data.images.load(_file_Diffuse)

node.image.colorspace_settings.name = 'sRGB'

# Ambient Occlusion

Expand All @@ -250,6 +259,7 @@ def execute(self, context):
node.name='dks_pbr_texture_ao'
_material_links.new(node.outputs['Color'], node_mix.inputs['Color2'])
node.image = bpy.data.images.load(_file_Ambient_occlusion)
node.image.colorspace_settings.name = 'Non-Color'

else:

Expand All @@ -264,6 +274,8 @@ def execute(self, context):
node.image = bpy.data.images.load(_file_Base_Color)
elif _file_Diffuse:
node.image = bpy.data.images.load(_file_Diffuse)

node.image.colorspace_settings.name = 'sRGB'

# Metallic

Expand All @@ -274,7 +286,7 @@ def execute(self, context):
node.name='dks_pbr_texture_metallic'
_material_links.new(node.outputs['Color'], node_shader.inputs['Metallic'])
node.image = bpy.data.images.load(_file_Metallic)
node.image.colorspace_settings.name = 'Linear'
node.image.colorspace_settings.name = 'Non-Color'

# Specular

Expand Down Expand Up @@ -316,7 +328,7 @@ def execute(self, context):
node.name='dks_pbr_texture_roughness'
_material_links.new(node.outputs['Color'], node_shader.inputs['Roughness'])
node.image = bpy.data.images.load(_file_Roughness)
node.image.colorspace_settings.name = 'Linear'
node.image.colorspace_settings.name = 'Non-Color'

# Normal

Expand Down

0 comments on commit 7bb913c

Please sign in to comment.