ScriptSpot is a diverse online community of artists and developers who come together to find and share scripts that empower their creativity with 3ds Max. Our users come from all parts of the world and work in everything from visual effects to gaming, architecture, students or hobbyists.
thanks barigazy, now it worked perfectly in 3dsmax2013. I did not realize that the script WILL NOT WORK if you don`t have already a map named with the sufix (wood_SPEC.tga and wood_NORM.tga) inside the same folder of the original texture (wood.tga).
This works fine in max2014
U need to write exact sufix name in text boxes for Specular and Normal map (not diffuse). Also in your folder if you have map "Wood" U need also "Wood_sufix" for specular and normal bump ("Wood_SPEC" and "Wood_NORM")
Script creates Bitmaptexture in specularlevel slot named "filename + _SPEC" and Normal Bump map where in Normal Map slot U can find Bitmaptexture named "filename + _NORM"
try(destroyDialog ::renameMaps)catch()
rollout renameMaps "rename Maps"(
local slots = #("Diffuse Map", "Specular Map", "Normal Map")
local sufix = #("_DIFF", "_SPEC", "_NORM")
local appendPath = pathConfig.appendPath
group " _Sufix : "(
edittext et_diff "Diffuse :" pos:[10,25] width:180 height:17 text:sufix[1]
edittext et_spec "Specular :" pos:[10,45] width:180 height:17 text:sufix[2]
edittext et_norm "Normal :" pos:[10,65] width:180 height:17 text:sufix[3])
group " Add && Rename : "(
checkbox cb_spec "Add Specular Map" pos:[10,110] checked:on
checkbox cb_bump "Add Normal Bump" pos:[10,130] checked:on
spinner spn_amount "Bump Amount: " pos:[10,150] fieldwidth:60 range:[-999,999,100] type:#integer
)
button btn_doit "DO THE JOB!" pos:[4,170] width:192 height:35
on cb_bump changed state do spn_amount.enabled = state
on btn_doit pressed do(ifselection.count == 0 then messageBox "Select Some Object!" title:"Warning" beep:off else(
sufix = #(et_diff.text, et_spec.text, et_norm.text) ; array = #()for node in selection where node.mat != undefined do(if(material = getClassInstances Standardmaterial target:node).count != 0 do(for mat in material where mat.filterMapAmount != 17 do(if mat.diffuseMap != undefined and isKindOf mat.diffuseMap bitmapTex do(
string = getFilenameFile mat.diffuseMap.filename
mat.diffuseMap.name = string + sufix[1]
ext = getFilenameType mat.diffuseMap.filename
path = getFilenamePath mat.diffuseMap.filename
if cb_spec.checked and doesFileExist (file = appendPath path (string + sufix[2] + ext))do(
mat.specularLevelMap = Bitmaptexture name:(string + sufix[2]) fileName:file
)if cb_bump.checked and doesFileExist (file = appendPath path (string + sufix[3] + ext))do(
mat.bumpMap = Normal_Bump normal_map:(Bitmaptexture name:(string + sufix[3]) fileName:file)
mat.bumpMapAmount = spn_amount.value
))
mat.filterMapAmount = 17
append array mat
)array.filterMapAmount = 100)))))
createDialog renameMaps 200210 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)
Thanks for taking your time to help me, i really don`t know how to thank you!
This is the perfect idea for a script, this is what i really wanted and need, but unfortunately, it did not worked my friend, i selected the object and clicked on the button DO THE JOB, but nothing happenned.
I am using 3dsmax 2009 64 bit, and the object i want to rename its maps has a multi-subobject material.
I can`t make any suggestions because i really don`t understand too much about maxscript.
But if you could help me untill we make this script work, i would be very grateful.
Ok, i tested it on 3dsmax 2013 64 bit, it works, however, one thing is missing.
it copies the diffuse map to specular / bump slot, fine, however, what it changes, is the name of the submaterial to use the sufix, however, it does not change the bitmap name, like texture_SPEC.tga, it remains texture.tga in both slots (diffuse and specular).
If you could correct it for me, i would be very grateful, if not, i will also thank you for all this help you gave me.
If I undertand you correctley.
U have scene with some objects which have assigned material (Standard or Multimaterial with Standard submaterials) that have already assigned DiffuseMap (Bitmap Texture for example "wood.jpg"). Now you want to assigne in specular level slot new bitmap texture which is located in the same folder where is "wood.jpg" but map with sufix "_SPEC" ei. "wood_SPEC.jpg". Same for the bump map but with sufix "_NORM".
if I'm right then previous code is not useful at all and your explanation of what you want to accomplish is not well formulated.
Comments
thanks barigazy, now it
thanks barigazy, now it worked perfectly in 3dsmax2013. I did not realize that the script WILL NOT WORK if you don`t have already a map named with the sufix (wood_SPEC.tga and wood_NORM.tga) inside the same folder of the original texture (wood.tga).
I will credit you on my game!
...
I saw the logic only that way. You can add also other map types to the same folder and adjust the script to work with theses also.
bga
...
I did'nt test this.
bga
Thanks my friend, thanks for
Thanks my friend, thanks for trying to help me and sorry for taking your time.
Unfortunately, it did not work my friend, nothing happened.
I think i will go for the manual way instead of scripting.
Thanks.
...
This works fine in max2014
U need to write exact sufix name in text boxes for Specular and Normal map (not diffuse). Also in your folder if you have map "Wood" U need also "Wood_sufix" for specular and normal bump ("Wood_SPEC" and "Wood_NORM")
Script creates Bitmaptexture in specularlevel slot named "filename + _SPEC" and Normal Bump map where in Normal Map slot U can find Bitmaptexture named "filename + _NORM"
bga
...
Adjust this example to suit your needs
bga
Hi my dear
Hi my dear friend,
WOW!
Thanks for taking your time to help me, i really don`t know how to thank you!
This is the perfect idea for a script, this is what i really wanted and need, but unfortunately, it did not worked my friend, i selected the object and clicked on the button DO THE JOB, but nothing happenned.
I am using 3dsmax 2009 64 bit, and the object i want to rename its maps has a multi-subobject material.
I can`t make any suggestions because i really don`t understand too much about maxscript.
But if you could help me untill we make this script work, i would be very grateful.
Best Regards,
Nidal Nijm.
...
Not understan.Can you explain a bit more?
bga
Hi man, Ok, i tested it on
Hi man,
Ok, i tested it on 3dsmax 2013 64 bit, it works, however, one thing is missing.
it copies the diffuse map to specular / bump slot, fine, however, what it changes, is the name of the submaterial to use the sufix, however, it does not change the bitmap name, like texture_SPEC.tga, it remains texture.tga in both slots (diffuse and specular).
If you could correct it for me, i would be very grateful, if not, i will also thank you for all this help you gave me.
...
If I undertand you correctley.
U have scene with some objects which have assigned material (Standard or Multimaterial with Standard submaterials) that have already assigned DiffuseMap (Bitmap Texture for example "wood.jpg"). Now you want to assigne in specular level slot new bitmap texture which is located in the same folder where is "wood.jpg" but map with sufix "_SPEC" ei. "wood_SPEC.jpg". Same for the bump map but with sufix "_NORM".
if I'm right then previous code is not useful at all and your explanation of what you want to accomplish is not well formulated.
bga