Hey everyone,
Can anyone direct me how to make a string attribute from a file name of a imported model?
So for example here is an example path: A:/PROJECTS/MODELS/Cool_Models/Big_Models/Wall_01.FBX
All I want is Wall_01 as a string attribute I can access.
Now I want to switch to a different model on each frame, so I need that string attribute to automatically update with the file name.
Vincent Griffith
Making string attribute from File Name
3331 3 1-
- VGriffith
- Member
- 134 posts
- Joined: Sept. 2018
- Offline
-
- AlexNardini1
- Member
- 46 posts
- Joined: April 2008
- Offline
Hello, with python much easier but I had a wrangle in my network so i did it with vex.
Put this in a wrangle set to "detail" mode:
Its done quick but hope you get an idea.
Once you have a new filename with path and exported in a detail attribute, you can use a details() hscript function inside a file node file parameter for example and load the file stored in that detail attribute,
Put this in a wrangle set to "detail" mode:
string file = " A:/PROJECTS/MODELS/Cool_Models/Big_Models/Wall_01.FBX"; string split[] = split(file, "/"); string path = concat(join(split[:-1], "/"), "/"); string filaname_with_extension[] = split(split[-1], "."); // Update this to load a new fbx filename string filename = filaname_with_extension[0]; string new_filename = concat(path, filename, ".", filaname_with_extension[-1]); s@AAA = new_filename;
Its done quick but hope you get an idea.
Once you have a new filename with path and exported in a detail attribute, you can use a details() hscript function inside a file node file parameter for example and load the file stored in that detail attribute,
Edited by AlexNardini1 - Nov. 9, 2021 15:17:36
-
- VGriffith
- Member
- 134 posts
- Joined: Sept. 2018
- Offline
Found this tutorial online if anybody needs help with this. Tutorial Video... [vimeo.com]
He used the "extract_filename" sop and used this expression to get the file name
He used the "extract_filename" sop and used this expression to get the file name
`details("../extract_filename1//", "filename")`
Edited by VGriffith - Nov. 9, 2021 16:19:51
-
- AlexNardini1
- Member
- 46 posts
- Joined: April 2008
- Offline
-
- Quick Links