Notifications
Clear all

[Closed] Adjust bitmap filename padding from code (C# or MaxScript)?

When you write a bitmap from 3ds max, it adds padding to the end of the filename. For instance, if I try to write “leather-diffuse.png” to disk, I instead end up with leather-diffuse0000.png.

Is there any way to remove this padding (“0000”) via code, either using C# or Maxscript? Alternately, is there any way to know what file was actually written to?

Code example:

[...]
bitmapInfo.SetName(bitmapPath); //should be [path]/leather-diffuse.png
var openResult = bitmap.OpenOutput(bitmapInfo);
var writeResult = bitmap.Write(bitmapInfo, 0);
var closeResult = bitmap.Close(bitmapInfo, (int)BitmapClose.BMM_CLOSE_COMPLETE);
var deleteResult = Max.Global.TheManager.DelBitmap(bitmap);
Max.Log("File info: " + bitmap.BitmapInfo.PathEx.String + ", " + bitmap.BitmapInfo.Name); //Outputs [path]/leather-diffuse.png

However, with all this, I end up with a file called leather-diffuse0000.png. This doesn’t match the bitmapInfo or any other info I can find. So I have no way programmatically to link leather-diffuse.png with leather-diffuse0000.png, other than assuming it will always add exactly four zeroes. But this will be delivered as a plugin to our modelers, so I have no way of knowing if they have changed some setting that might affect this padding on their machine.