Skip to content

Commit

Permalink
Update shader.py
Browse files Browse the repository at this point in the history
fixed issue taniwha#76
  • Loading branch information
popos123 authored Jul 28, 2024
1 parent e4caf14 commit 80aaa34
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions shader/shader.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,22 +200,30 @@ def call_update(item, prop, context):
def set_tex(mu, dst, src, context):
try:
if src.index < 0:
raise IndexError # ick, but it works
raise IndexError # ick, but it works
tex = mu.textures[src.index]
if tex.name[-4:] in [".dds", ".png", ".tga", ".mbm"]:
dst.tex = tex.name[:-4]
else:
dst.tex = tex.name
dst.type = tex.type

# Ensure tex.type is 0/1 or True/False
if tex.type in [0, 1]:
dst.type = tex.type
else:
# Convert to a boolean or 0/1
dst.type = bool(tex.type)

except IndexError:
pass

if dst.tex in bpy.data.images:
dst.rgbNorm = not bpy.data.images[dst.tex].muimageprop.convertNorm
dst.scale = src.scale
dst.offset = src.offset
if context.material.node_tree:
call_update(dst, "tex", context)
#other properties are all updated in the one updater
# other properties are all updated in the one updater
call_update(dst, "rgbNorm", context)

def make_shader_prop(muprop, blendprop, context):
Expand Down

0 comments on commit 80aaa34

Please sign in to comment.