検索 - User list
Full Version: How to add variable in File node name
Root » Houdini Indie and Apprentice » How to add variable in File node name
tosiho19
Hi, What's the best way to add variable in File node.
I have files that need to be load depending of the frame. I created wrangle with list of file name. But I don't know how to "send " my names into file node name attribute.
Anyone can help with this? Thx

string fileName[] = {'$HIP/file/F001.obj', '$HIP/file/F025.obj', '$HIP/file/F75.obj'};
s@fileName = fileName[@Frame-1];
Enivob
There is a global variable called $F. This holds the current frame number. You can use the back tick character to execute hScript inside a text field, so something like this may work for you.

Type this into the Geometry File name:
$HIP/my_geo/the_file_`padzero(4,$F)`.obj
The obvious flaw is that is won't work with your array of filenames, because those files name have no common zero padding. This type of filename creation is used more often when trying to load a sequence over time.
tosiho19
Thanks @Enivob, However using $F doesn't really solve my problem as I need to load files with different names.
Enivob
Another way is to place your wrangle in detail mode and fetch the value of the attribute using a function, instead of a direct reference to the attribute name.

Type this into the Geometry File name: (adjust the path to match the path to your wrangle)
`details("/obj/geo1/File_List/","fileName")`
Notice the backticks. They are required for the function to be evaluated.
jsmack
This type of task is also more or less what tops was made for. It might be overkill for certain trivial cases, but it scales in complexity better than using sop attributes.
tosiho19
@Enivob, Thanks! that's what I was looking for, but I didn't know how to properly write the function
TangheStudent
Hello,

It seems that after the 19.5 update, I'm no longer able to use backticks in filenames ?
Pressing the name of the field doesn’t change what is rop doesn't render when I put

$JOB/render/$HIPNAME/render_`@pdg_index`.$F4.jpg

As name, but renders fine if I just put $JOB/render/$HIPNAME/render.$F4.jpg
jsmack
TangheStudent
Hello,

It seems that after the 19.5 update, I'm no longer able to use backticks in filenames ?
Pressing the name of the field doesn’t change what is rop doesn't render when I put

$JOB/render/$HIPNAME/render_`@pdg_index`.$F4.jpg

As name, but renders fine if I just put $JOB/render/$HIPNAME/render.$F4.jpg

Are you evaluating a topnetwork?
TangheStudent
If I Dirty and cook the node, it gets stuck when it arrives at the saving.
This doesn't happen if I don't use `@pdg_index`.

Am I missing a step ?

The clicking of the name not showing me the path it points to also doesnt work with just.

$JOB/geo/boat.obj
Burk
Enivob
Another way is to place your wrangle in detail mode and fetch the value of the attribute using a function, instead of a direct reference to the attribute name.

Type this into the Geometry File name: (adjust the path to match the path to your wrangle)
`details("/obj/geo1/File_List/","fileName")`
Notice the backticks. They are required for the function to be evaluated.
Dude, I have been looking at people recommending this code all morning thinking those were quote marks (yeah, I'm not too observant.) Thank you for pointing out they were backticks.
Not all heroes wear capes.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB