vray_ in materials name - remove - script?

I have searched the forum, but haven’t found anything… but maybe I have searched with the wrong search phrase… so don’t judge me. :slight_smile:

is there a way to delete the vray_ addition in the material names?
I have to export many fbx files for importing in cinema and if you convert the model in cinema to corona, then you have funny names in materials… “crn_vray_material_02”
if I could batch delete the vray_ addition in max it would be great, in cinema there’s no way to do that…

thanks coder for a solution.

themaxxer

Try this:


for m in scenematerials where matchPattern m.name pattern:"*vray_*" == true do (
newName = replace m.name 4 5 ""
m.name = newName
)​

This will remove 5 letters starting from the 4th on materials that contain the “vray_” pattern. If the “vray_” part is located elsewhere in the material name, you should change the “4” (starting index) and “5” (length) values.

EDIT: Uploading a little script, which can mass edit materials.
MassMaterialNameEditor.7z (1.12 KB)