Notifications
Clear all
[Closed] fileName without Path
Mar 08, 2014 5:05 pm
hi guys ,
i want change my material name by bitmap filename , like this :
for o in geometry do
(
nMap = o.material.diffusemap.filename
o.material.name = nMap
)
but filename syntax cant get only file name ! actually get filename with path address for example it change my material name to this :
C:\Users\me\Documents\3dsMax\sceneassets\images\BARK5.jpg
i dont want that . i want to change my material name to BARK5 or BARK5.jpg.
can i get only file name ?
thanks
3 Replies
1 Reply
Also you can filter only objects which have assigned material. BTW shapes, proxy etc. types can have material also. So…
fn filterMat material &map = isProperty material #diffusemap and isKindOf (map = getProperty material #diffusemap) Bitmaptex
for o in objects where o.mat != undefined and filterMat o.mat &map do
(
if (string = getProperty map #filename) != undefined do o.mat.name = getFilenameFile string
)
Mar 08, 2014 5:05 pm
o.material.name = getFilenameFile nMap
See the docs here