Using strings as filenames

   520   1   0
User Avatar
Member
9 posts
Joined: Sept. 2018
Offline
I can load a file with a file node using an explicit name like building01.fbx. No problem.

But for example, I might want to load building01.fbx or building09.fbx based on the value of an integer. Creating an appropriate string to serve as the filename is no problem. Using that string in a file node… Now there's my problem.

Shy of my relearning Python, is there a simple way to use a string for a file name in a file node?
User Avatar
Member
9 posts
Joined: Sept. 2018
Offline
Got advice from Kenny Lammers (indie-pixel.com)on how to do this. So here's how. I didn't bother with dynamically building a string in this example. That wasn't my challenge. My challenge was how to use a created string as a filename I could use to load a file.

1-Create a detail attribute string and put the string value you want in it - for example s@loadit=“TheModelIWant.fbx”;

2- Any node this attribute is available in will work for this approach. But let's say for this example I wind up with this attribute available in a null node called null1.

3-In a file node use the details (not detail) function to use the string as the filename. You have to surround the whole details function with back ticks. So for this example in a file nodes geometry load field use `details(“../null1/”, “loadit”)`

So that's how to use a string as a filename for a file node.

Thanks Kenny!
  • Quick Links