ScriptSpot

Forum topic · General Scripting

Copy bitmap path and add an appendix

By Walli · 2008-12-09

Description

Hi,

I am new to Max script so I am sure that I simply miss something obvious :-(

I use the following code to copy a bitmap texture from one slot to another:

meditMaterials[1].opacityMap = meditMaterials[1].diffuseMap

This works fine, but sometimes I want to add an appendix to the filename, so I wanted to use the following code:

basis = meditMaterials[1].specularMap.fileName


anhang = "_a"


komplett = basis+anhang


meditMaterials[1].specularLevelMap.fileName = komplett

This also works - but just almost. As the script does about the same what you normaly could do manualy via rightclick and Copy/Instance, there is one quirk.
The script takes the original name, adds the appendix _a and puts it into the new slot. But as this is a instance, the original path also is changed and gets the appendix.

What do I have to do, that the “original” bitmap filename stays untouched and only the copy gets the appendix.

 

thanks,
Walli

Comments (1)

Walli · 2008-12-09

okay, I think I found out myself:

basis = meditMaterials[1].specularMap.fileName
anhang = "_a"
komplett = basis+anhang
meditMaterials[1].specularLevelMap = Bitmaptexture fileName:komplett