Skip to content
Snippets Groups Projects
Commit 2f3f7881 authored by Ghost's avatar Ghost
Browse files

Edits to bsshader import and export

parent a7c0c082
No related branches found
No related tags found
No related merge requests found
......@@ -109,8 +109,8 @@ class TextureHelper():
bsshader.texture_set = texset
if self.basemtex:
texset.textures[0] = self.texture_writer.export_texture_filename(self.basemtex.texture)
if self.bumpmtex:
texset.textures[1] = self.texture_writer.export_texture_filename(self.bumpmtex.texture)
if self.normalmtex:
texset.textures[1] = self.texture_writer.export_texture_filename(self.normalmtex.texture)
if self.glowmtex:
texset.textures[2] = self.texture_writer.export_texture_filename(self.glowmtex.texture)
......
......@@ -156,9 +156,9 @@ class Texture():
if baseTexFile:
self.import_diffuse_texture(b_mat, baseTexFile)
bumpTexFile = bsShaderProperty.texture_set.textures[1].decode()
if bumpTexFile:
self.import_bump_texture(b_mat, bumpTexFile)
normalTexFile = bsShaderProperty.texture_set.textures[1].decode()
if normalTexFile:
self.import_normalmap_texture(b_mat, normalTexFile)
glowTexFile = bsShaderProperty.texture_set.textures[2].decode()
if glowTexFile:
......@@ -292,10 +292,17 @@ class Texture():
def import_normalmap_texture(self, b_mat, n_textureDesc):
normalmap_texture = n_textureDesc.normal_map_texture
try:
normalmap_texture = n_textureDesc.normal_map_texture
except:
normalmap_texture = n_textureDesc
b_mat_texslot = b_mat.texture_slots.add()
b_mat_texslot.texture = self.textureloader.import_texture_source(normalmap_texture.source)
try:
b_mat_texslot.texture = self.textureloader.import_texture_source(normalmap_texture.source)
except:
b_mat_texslot.texture = self.textureloader.import_texture_source(normalmap_texture)
b_mat_texslot.use = True
# Influence mapping
......@@ -303,13 +310,20 @@ class Texture():
# Mapping
b_mat_texslot.texture_coords = 'UV'
b_mat_texslot.uv_layer = self.get_uv_layer_name(normalmap_texture.uv_set)
try:
b_mat_texslot.uv_layer = self.get_uv_layer_name(normalmap_texture.uv_set)
except:
b_mat_texslot.uv_layer = self.get_uv_layer_name(0)
# Influence
b_mat_texslot.use_map_color_diffuse = False
b_mat_texslot.use_map_normal = True
b_mat_texslot.blend_type = self.get_b_blend_type_from_n_apply_mode(
n_textureDesc.apply_mode)
try:
b_mat_texslot.blend_type = self.get_b_blend_type_from_n_apply_mode(
n_textureDesc.apply_mode)
except:
b_mat_texslot.blend_type = self.get_b_blend_type_from_n_apply_mode(
n_textureDesc)
if(self.nif_import.ni_alpha_prop):
b_mat_texslot.use_map_alpha = True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment