Showing posts with label name. Show all posts
Showing posts with label name. Show all posts

Friday 31 January 2020

Getting the name of the parent node

Sometimes you'll need the name of the parent/container node that you're working in. It might be a "car_01" or something like that.

What you need to do is trick a wrangle into using houdiniscript. We do this by creating a parameter/channel and then typing in the script we wish to run, enclosed with backticks ` `

opname is the function we want to run and .. will get us up a level.
so in the wrangle use

s@string_name=chs("whatever");

hit the create-channel-box button, then type this in it

`opname("..")`

you now have a string value of the parent node that you could strip/atoi, whatever.

Tuesday 16 April 2019

Check names for duplicates

point wrangle snippet from Mike

int find = findattribval(0,"point","name",s@name);
int count = findattribvalcount(0,"point","name",s@name);
i@find = find;
i@count = count;

Wednesday 3 April 2019

match, finding a string in a wrangle. Wildcards.

in Blast nodes you can use wildcards * all over the place
eg. @name=*something
will kill anything with "something" in it's name attribute. It's a little different when you want to select things in this manner in a wrangle. We use the "match" function to do this-


if(match("*stick*",@name)){

s@value="yeah!";


}

Here we look for the string "stick" in the attribute "name". On success, we make "value" equal to "yeah!".