Delete the path from filename

Hi,

I wander if I could delete the path name from the filename. I need it in particular case when I have bitmap in the same folder as max file. For example I have this property a.diffuseMap.bitmap.filename ="d://folder//folder//bitmap.jpg" and I want to change it to a.diffuseMap.bitmap.filename ="bitmap.jpg". When I'm trying to do it in script it doesn't change. What I do wrong?

Thanks for any help.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
begginnerscripter's picture

It sorted thank to you, guys!

It sorted thank to you, guys!

murdemotion's picture

how did you sorted ?

hello there .

im having a same problem that you mantioned about your first post about file paths . but my problem is about hdri file missing.

this max file worked another computer earlier and given me to work on it .
but i need it to upload over internet to render farm. but render farms plugin giving me this error about vrayhdr hdri file missing.

so te material isnt in the material browser and when im searched in the asset tracking there is no such file. but its there somewhere .

and i need to strip its path to upload on internet.

or i need to change it's file path .

i didnt know anything about maxscript.

can you guys help me
is there any simple 2 column script or smth. about changing path ?

thanks.

Anubis's picture

we can use relative paths w/o

we can use relative paths w/o problems,
just use <Bitmaptexture>.filename (not <Bitmap>.filename)

file = filenameFromPath m.diffuseMap.filename
m.diffuseMap.filename = file

my recent MAXScripts RSS (archive here)

shanghalf's picture

Delete the path from filename

let me try :)

you need to provide the full path string except if there s a suitable bitnap ( same name ) within any of your bitmap path ( declared in config >> user path )

you could also parse your path string with the following function

filenameFromPath
Returns the file name and extension of a full file name, useful for labeling file buttons in rollout panels.

getFilenamePath
Returns the directory path part of a full file name.

getFilenameFile
Returns the file name part of a full file name.

getFilenameType
Returns the type extension part of a full file name.

file="g:\\subdir1\\subdir2\\myImage.jpg"
filenameFromPath file -- returns: "myImage.jpg"
getFilenamePath file -- returns: "g:\subdir1\subdir2\"
getFilenameFile file -- returns: "myImage"
getFilenameType file -- returns: ".jpg"

also you could add a new folder in your user path

with pathConfig struct reffer to script doc

shanghalf

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.