Skip to content

Commit 7bb913c

Browse files
committed
1_7_1
Fixed UE Node color space values and added {blend_file}_{material_name} detection
1 parent 79caaff commit 7bb913c

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"name": "DKS Substance Painter",
2121
"description": "Substance Painter Pipeline",
2222
"author": "DigiKrafting.Studio",
23-
"version": (1, 7, 0),
23+
"version": (1, 7, 1),
2424
"blender": (2, 80, 0),
2525
"location": "Info Toolbar, File -> Import, File -> Export, Menu",
2626
"wiki_url": "https://github.com/DigiKrafting/blender_addon_substance_painter/wiki",

dks_sp.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,13 @@ def dks_sp_get_texture_file(texture_path,mesh_name,mat_name,texture_name,texture
5858
texture_path=bpy.path.relpath(texture_path)+sep
5959
return texture_path+mat_name+'_'+texture_name+'.'+texture_ext
6060
else:
61-
return ""
61+
_blend=dks_sp_get_file_name()
62+
if path.exists(texture_path+_blend+'_'+mat_name+'_'+texture_name+'.'+texture_ext):
63+
if bpy.context.preferences.addons[__package__].preferences.option_relative:
64+
texture_path=bpy.path.relpath(texture_path)+sep
65+
return texture_path+_blend+'_'+mat_name+'_'+texture_name+'.'+texture_ext
66+
else:
67+
return ""
6268

6369
class dks_sp_pbr_nodes(bpy.types.Operator):
6470

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

205211
node.image = bpy.data.images.load(_file_Base_Color)
212+
node.image.colorspace_settings.name = 'sRGB'
206213

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

211218
node_orm.image = bpy.data.images.load(_file_ORM)
212-
node_orm.image.colorspace_settings.name = 'Linear'
219+
node_orm.image.colorspace_settings.name = 'Non-Color'
213220

214221
node_sep_rgb=_nodes.new('ShaderNodeSeparateRGB')
215222
node_sep_rgb.location = -200,-200
@@ -242,6 +249,8 @@ def execute(self, context):
242249
node.image = bpy.data.images.load(_file_Base_Color)
243250
elif _file_Diffuse:
244251
node.image = bpy.data.images.load(_file_Diffuse)
252+
253+
node.image.colorspace_settings.name = 'sRGB'
245254

246255
# Ambient Occlusion
247256

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

254264
else:
255265

@@ -264,6 +274,8 @@ def execute(self, context):
264274
node.image = bpy.data.images.load(_file_Base_Color)
265275
elif _file_Diffuse:
266276
node.image = bpy.data.images.load(_file_Diffuse)
277+
278+
node.image.colorspace_settings.name = 'sRGB'
267279

268280
# Metallic
269281

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

279291
# Specular
280292

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

321333
# Normal
322334

0 commit comments

Comments
 (0)