Makeclothes script doesn't put normalTexture in .mhmat file (when exist in BL materials) but instead puts a textureBump which is not exactly same things
Could you correct it ?
Moderator: joepal
def writeMaterialFile(fp, mat, name, outdir):
"""
Write a material (.mhmat) file in the output folder.
Also copies all textures to the output folder
"""
fp.write(
'# MakeHuman Material definition\n' +
'\n' +
'name %sMaterial\n' % name +
'\n' +
'// Color shading attributes\n'
'diffuseColor %.4g %.4g %.4g\n' % tuple(mat.diffuse_intensity * mat.diffuse_color) +
'specularColor %.4g %.4g %.4g\n' % tuple(mat.specular_intensity * mat.specular_color) +
'shininess %.4g\n' % max(0, min(mat.specular_hardness/255, 1)) +
'opacity %.4g\n' % mat.alpha +
'\n' +
'// Textures and properties\n')
useDiffuse = useSpecular = useBump = useNormal = useDisplacement = "false"
for slotNo,mtex in enumerate(mat.texture_slots):
if mtex is None or not mat.use_textures[slotNo]:
continue
tex = mtex.texture
if (tex.type != 'IMAGE' or
tex.image is None):
continue
if tex.image.filepath == "":
raise MHError("Texture %s image must be saved first" % tex.name)
srcpath = tex.image.filepath
texpath = os.path.basename(srcpath).replace(" ","_")
if mtex.use_map_color_diffuse:
fp.write('diffuseTexture %s\n' % texpath)
useDiffuse = "true"
if mtex.use_map_alpha:
useAlpha = "true"
if mtex.use_map_specular:
fp.write('specularTexture %s\n' % texpath)
useSpecular = "true"
#some change is there **********
if mtex.use_map_normal:
if tex.use_normal_map:
fp.write('normalmapTexture %s\n' % texpath)
useNormal = "true"
else:
fp.write('bumpTexture %s\n' % texpath)
useBump = "true"
if mtex.use_map_displacement:
fp.write('displacementTexture %s\n' % texpath)
useDisplacement = "true"
trgpath = os.path.join(outdir, texpath)
print("Copy texture %s => %s" % (srcpath, trgpath))
try:
shutil.copy(srcpath, trgpath)
except FileNotFoundError:
addWarning("Texture\n \"%s\" \nnot found\n" % srcpath)
fp.write(
'# MakeHuman Material definition\n' +
'\n' +
'name %sMaterial\n' % name +
'\n' +
'// Color shading attributes\n'
'diffuseColor %.4g %.4g %.4g\n' % tuple(mat.diffuse_intensity * mat.diffuse_color) +
'specularColor %.4g %.4g %.4g\n' % tuple(mat.specular_intensity * mat.specular_color) +
'shininess %.4g\n' % max(0, min(mat.specular_hardness/255, 1)) +
'opacity %.4g\n' % mat.alpha +
'ambientColor 0.1000 0.1000 0.1000' +
'\n' +
'// Textures and properties\n')
Users browsing this forum: No registered users and 1 guest