Hi!
Can somebody please tell me whats the expression to get a channel value from the currently processed input operator of an operators input list?
I mean those lists that usually operators like merge, switch, etc. have.
Thank you and greetings!
Get value from ...
1831 6 1-
- TubeSmokeGuy
- Member
- 26 posts
- Joined: Nov. 2019
- Offline
-
- TubeSmokeGuy
- Member
- 26 posts
- Joined: Nov. 2019
- Offline
-
- eaniix
- Member
- 68 posts
- Joined: Nov. 2021
- Offline
-
- TubeSmokeGuy
- Member
- 26 posts
- Joined: Nov. 2019
- Offline
-
- eaniix
- Member
- 68 posts
- Joined: Nov. 2021
- Offline
here's a solution using VEX and hscript
create spare parameter for the first string and input hscript expression
set wrangle to detail and place a wrangle after each file-node to write the attributes for each input.
as an example a file with the following path
as long as you dont delete any of the attributes you can then call them at any point in the stream. the easiest way to to do that is to rightclick into the channel you want the attribute to sample -> reference -> scene data -> find node with attribute (not itself, will error) -> attributes -> global -> attribute
since only one item gets processed with the switch, you automatically only have the attributes for the processed stream. if you want to use this with a merge, you could just change the wrangle type to points or prims and write point/prim attributes instead to keep track of the different inputs.
i dont know if there is a way with vex or hscript to go a certain number of nodes up the stream so you only need one wrangle after the switch but then again you would have to make sure you have the same amount of nodes in each stream before the switch. if you have a manageable amount of file nodes i think the solution above should work just fine.
hope this helps!
string inputnode = chs('inputnode'); //get nodename connected to input 1 via opinput expression string fullpath = '../' + inputnode + '/file'; //recreate relative path s@filepath = chs(fullpath); //write to attribute string filepathblocks[] = split(s@filepath, "/"); //split path into array using "/" as separator s@filename = filepathblocks[-1]; //write filename from last item of array, with filetype string filenameblocks[] = split(s@filename, "."); //split filename into array using "." as separator s@filetype = filenameblocks[-1]; //write filetype from last item of array int filetypelength = strlen(@filetype) + 1; //calculate length of filetype (number of characters) s@filename = s@filename[:-filetypelength]; //remove filetype from filename
create spare parameter for the first string and input hscript expression
`opinput(".", 0)`
set wrangle to detail and place a wrangle after each file-node to write the attributes for each input.
as an example a file with the following path
X:/Assets/Models/Skull/skull.objwould result in the following attributesfilename = skull filepath = X:/Assets/Models/Skull/skull.obj filetype = obj
as long as you dont delete any of the attributes you can then call them at any point in the stream. the easiest way to to do that is to rightclick into the channel you want the attribute to sample -> reference -> scene data -> find node with attribute (not itself, will error) -> attributes -> global -> attribute
since only one item gets processed with the switch, you automatically only have the attributes for the processed stream. if you want to use this with a merge, you could just change the wrangle type to points or prims and write point/prim attributes instead to keep track of the different inputs.
i dont know if there is a way with vex or hscript to go a certain number of nodes up the stream so you only need one wrangle after the switch but then again you would have to make sure you have the same amount of nodes in each stream before the switch. if you have a manageable amount of file nodes i think the solution above should work just fine.
hope this helps!
Edited by eaniix - Aug. 16, 2023 11:16:39
-
- TubeSmokeGuy
- Member
- 26 posts
- Joined: Nov. 2019
- Offline
-
- Fenolis
- Member
- 152 posts
- Joined: Aug. 2012
- Offline
-
- Quick Links


