Can u makes this script working with selecting 2 objects and changing the two objects textures at the same time 🙂 ...
thanks
http://www.scriptspot.com/forums/3ds-max/general-scripting/maxscript-to-batch-render-with-automatic-texture-changesForum topic · Scripts Wanted
By nvidia2014 · 2014-07-05
Can u makes this script working with selecting 2 objects and changing the two objects textures at the same time 🙂 ...
thanks
http://www.scriptspot.com/forums/3ds-max/general-scripting/maxscript-to-batch-render-with-automatic-texture-changes
nvidia2014 · 2014-07-07
thanks miauu .... works fine ...

can u
change the 2nd texture / material property ( MONO CHANNEL OUTPUT To : Alpha Instead Of RGB Intensity ....
will pay / donate to you :)
.
miauu · 2014-07-07
Try this:
(
global rol_worwhite
try(destroyDialog rol_worwhite)catch()
rollout rol_worwhite "miauu"
(
local obj01 = undefined
local obj02 = undefined
local matDir01 = undefined
local matDir02 = undefined
checkButton chkbtn_obj01 "Get first object" width:150
button btn_browse01 "Select folder with textures" width:150
checkButton chkbtn_obj02 "Get second object" width:150 offset:[0,10]
button btn_browse02 "Select folder with textures" width:150
button btn_render "RENDER" enabled:false width:150 offset:[0,10]
on chkbtn_obj01 changed state do
(
if state then
(
if selection.count == 1 and isValidNode selection[1] do obj01 = selection[1]
)
else
(
obj01 = undefined
)
)
on chkbtn_obj02 changed state do
(
if state then
(
if selection.count == 1 and isValidNode selection[1] do obj02 = selection[1]
)
else
(
obj02 = undefined
)
)
on btn_browse01 pressed do
(
dir = getSavePath caption:"Select folder with textures"
if dir != undefined do
(
matDir01 = dir
btn_browse01.tooltip = matDir01
btn_render.enabled = true
)
)
on btn_browse02 pressed do
(
dir = getSavePath caption:"Select folder with textures"
if dir != undefined do
(
matDir02 = dir
btn_browse02.tooltip = matDir02
btn_render.enabled = true
)
)
on btn_render pressed do
(
local curObj = selection[1]
local matFiles01Arr = getFiles (matDir01 + "\\*.bmp") -- get only BMP files
local matFiles02Arr = getFiles (matDir02 + "\\*.png") -- get only PNG files
--
if matFiles01Arr.count == matFiles02Arr.count then
(
renderSceneDialog.close()
local originalOutPath = rendOutputFileName
for m = 1 to matFiles01Arr.count do
(
obj01.material = standardMaterial diffuseMap: (Bitmaptexture fileName:matFiles01Arr[m]) showInViewport:true
obj02.material = standardMaterial diffuseMap: (Bitmaptexture fileName:matFiles02Arr[m] monoOutput:1) showInViewport:true
outputPath = (getfilenamepath originalOutPath) + ( getFilenameFile(filenamefrompath originalOutPath)) + "_" + (m as string) + "_" + (getFilenameType originalOutPath)
rendOutputFileName = outputPath
rendSaveFile = true
-- disable virtual frame buffer
rendShowVFB = false
max quick render
)
)
else
messagebox "The count of the textures in folder01 and folder02 are different" title:""
)
)
createdialog rol_worwhite
)
I've changed the file type of second object to PNG, because Alpha output works with file types that supports alpha. Change it as you need.
.
miauu · 2014-07-05
I don't have time to test the script.
How to use it:
- select first object and press the Get First Object buton. Then select the folder wherer are plaved the textures for the first object.
- select the second object and do the same as for the first
- Important - the count of the textures in both folders(for the first and the second objects) must be the same. For example 101 textures in folder01 and 101 textures in folder02
- Open Render Setup dialog(hotkey F10) and select the width and height of the rendered images, the output path, the base name for rendered images and so on.
-Press the RENDER button.
The script save rendered images in the folder, specified in the Render Setup Dialog.
(
global rol_worwhite
try(destroyDialog rol_worwhite)catch()
rollout rol_worwhite "miauu"
(
local obj01 = undefined
local obj02 = undefined
local matDir01 = undefined
local matDir02 = undefined
checkButton chkbtn_obj01 "Get first object" width:150
button btn_browse01 "Select folder with textures" width:150
checkButton chkbtn_obj02 "Get second object" width:150 offset:[0,10]
button btn_browse02 "Select folder with textures" width:150
button btn_render "RENDER" enabled:false width:150 offset:[0,10]
on chkbtn_obj01 changed state do
(
if state then
(
if selection.count == 1 and isValidNode selection[1] do obj01 = selection[1]
)
else
(
obj01 = undefined
)
)
on chkbtn_obj02 changed state do
(
if state then
(
if selection.count == 1 and isValidNode selection[1] do obj02 = selection[1]
)
else
(
obj02 = undefined
)
)
on btn_browse01 pressed do
(
dir = getSavePath caption:"Select folder with textures"
if dir != undefined do
(
matDir01 = dir
btn_browse01.tooltip = matDir
btn_render.enabled = true
)
)
on btn_browse02 pressed do
(
dir = getSavePath caption:"Select folder with textures"
if dir != undefined do
(
matDir02 = dir
btn_browse02.tooltip = matDir
btn_render.enabled = true
)
)
on btn_render pressed do
(
local curObj = selection[1]
local matFiles01Arr = getFiles (matDir01 + "\\*.bmp") -- get only BMP files
local matFiles02Arr = getFiles (matDir02 + "\\*.bmp") -- get only BMP files
--
if matFiles01Arr.count == matFiles02Arr.count then
(
renderSceneDialog.close()
local originalOutPath = rendOutputFileName
for m = 1 to matFiles01Arr.count do
(
obj01.material = standardMaterial diffuseMap: (Bitmaptexture fileName:matFiles01Arr[m]) showInViewport:true
obj02.material = standardMaterial diffuseMap: (Bitmaptexture fileName:matFiles02Arr[m]) showInViewport:true
outputPath = (getfilenamepath originalOutPath) + ( getFilenameFile(filenamefrompath originalOutPath)) + "_" + (m as string) + "_" + (getFilenameType originalOutPath)
rendOutputFileName = outputPath
rendSaveFile = true
-- disable virtual frame buffer
rendShowVFB = false
max quick render
)
)
else
messagebox "The count of the textures in folder01 and folder02 are different" title:""
)
)
createdialog rol_worwhite
)