You can use a python script. Do you know our pymaxwell tool?
Code: Select allfrom pymaxwell import *
import os
def replaceHDRSky(scenepath,imagepath,outscenepath):
if not os.path.exists(scenepath):
print('Cannot find %s' % scenepath)
return 0
if not os.path.exists(imagepath):
print('Cannot find %s' % imagepath)
return 0
mxs = Cmaxwell(mwcallback)
if not mxs.readMXS('G:/scenes/sky-anim/knots_0001.mxs'):
print('Cannot open %s' % scenepath)
return 0
environment = mxs.getEnvironment()
bitmapFileName,state,sphericalMapping,interpolate,intensity,uTile,vTile,uTileOffset,vTileOffset,ok = environment.getEnvironmentLayer(IBL_LAYER_BACKGROUND)
environment.setEnvironmentLayer(IBL_LAYER_BACKGROUND,imagepath,state,sphericalMapping,interpolate,intensity,uTile,vTile,uTileOffset,vTileOffset)
bitmapFileName,state,sphericalMapping,interpolate,intensity,uTile,vTile,uTileOffset,vTileOffset,ok = environment.getEnvironmentLayer(IBL_LAYER_ILLUMINATION)
environment.setEnvironmentLayer(IBL_LAYER_ILLUMINATION,imagepath,state,sphericalMapping,interpolate,intensity,uTile,vTile,uTileOffset,vTileOffset)
bitmapFileName,state,sphericalMapping,interpolate,intensity,uTile,vTile,uTileOffset,vTileOffset,ok = environment.getEnvironmentLayer(IBL_LAYER_REFLECTION)
environment.setEnvironmentLayer(IBL_LAYER_REFLECTION,imagepath,state,sphericalMapping,interpolate,intensity,uTile,vTile,uTileOffset,vTileOffset)
bitmapFileName,state,sphericalMapping,interpolate,intensity,uTile,vTile,uTileOffset,vTileOffset,ok = environment.getEnvironmentLayer(IBL_LAYER_REFRACTION)
environment.setEnvironmentLayer(IBL_LAYER_REFRACTION,imagepath,state,sphericalMapping,interpolate,intensity,uTile,vTile,uTileOffset,vTileOffset)
environment.enableEnvironment(True)
if not mxs.writeMXS(outscenepath):
print('Cannot save %s' % outscenepath)
return 0
print('%s saved' % outscenepath)
return 1
if __name__ == "__main__":
mxsDir = 'G:/scenes/sky-anim'
hdrDir = 'G:/scenes/sky-anim/hdrs'
mxsOutputDir = 'G:/scenes/sky-anim/output'
if not os.path.exists(mxsOutputDir):
os.mkdir(mxsOutputDir)
mxss = getFilesFromPath(mxsDir,'mxs')
hdrs = getFilesFromPath(hdrDir,'exr')
mxss.sort()
hdrs.sort()
for mxs,sky in zip(mxss,hdrs):
inmxs = os.path.join(mxsDir,mxs)
outmxs = os.path.join(mxsOutputDir,mxs)
sky = os.path.join(hdrDir,sky)
replaceHDRSky(inmxs,sky,outmxs)
If you open pymaxwell.exe, paste this code, and replace mxsDir, hdrDir, mxsOutputDir and the HDR extension 'exr' by the proper ones, you will able to replace X HDR images in X mxs scenes.