Notifications
Clear all

[Closed] fileName without Path

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
(@gazybara)
Joined: 11 months ago

Posts: 0

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
)

thanks alot josef