expression issue

   4528   7   1
User Avatar
Member
338 posts
Joined: Sept. 2006
Offline
Hi guys,

Im relativly new to expressions in houdini, i come from a maya and mel script background so im not to sure how this works.

Basically im wanting to generate a custom path from some group names.

I have entered this expression into an attributeCreate string. Im really not sure if this is the correct way of writing expressions in houdini. I cant find much in the way of tutorials or examples based on string based expressions.

When i check the geometry spreadSheet it basically outputs the expression and not a result is that normal?

string paths =$ASSETS/locationDressing/level/texture/source
string groupNames =chs(\“../each1/group\”)
groupNames = `strreplace (groupNames, “sgGrp”, “”)`
string compiledPath = paths+groupNames+“_d.rat”
return compiledPath


any help with this would be great, its my first time trying todo this sort of expression.

Thanks
Nick
User Avatar
Member
4270 posts
Joined: July 2005
Offline
niko3d
string paths =$ASSETS/locationDressing/level/texture/source
string groupNames =chs(\“../each1/group\”)
groupNames = `strreplace (groupNames, “sgGrp”, “”)`
string compiledPath = paths+groupNames+“_d.rat”
return compiledPath

Try….

`{
string paths =“$ASSETS/locationDressing/level/texture/source”;
string groupNames =chs(\“../each1/group\”);
groupNames = strreplace (groupNames, “sgGrp”, “”);
string compiledPath = paths+groupNames+“_d.rat”;
return compiledPath;
}`
if(coffees<2,round(float),float)
User Avatar
Member
338 posts
Joined: Sept. 2006
Offline
Would this kind of thing work? I cant seem to get the syntax correct tho.

$ASSETS/“locationDressing/level/texture/source/”`strreplace(`chs(\“../each1/group\”)`,“sgGrp”, “”)`_d.rat

Its probably very simple :¬/
Cheers
Nick
User Avatar
Member
338 posts
Joined: Sept. 2006
Offline
thanks Wolfwood i will give that a try
User Avatar
Member
338 posts
Joined: Sept. 2006
Offline
I get

Bracing error (string)

When i tried that modified version. Which i think was down to some missing backticks


So i put them and now i get

Error: inline (3): Missing RHS in assignment
inline (3): Syntax error in assignment
inline: Error parsing inline function

Rather confused :?
User Avatar
Member
1390 posts
Joined: July 2005
Offline
string groupNames =chs(\“../each1/group\”)

I don't get why you need these back-slashes.. but you probably don't.

string groupNames =chs(“../each1/group”)

this works for me!
cheers,
sy.
User Avatar
Member
4270 posts
Joined: July 2005
Offline
Hahha… Yea you don't need those \'s. I didn't even see em.

I think this would work too…

$ASSETS/locationDressing/level/texture/source/`strreplace(chs(“../each1/group”),“sgGrp”, “”)`_d.rat


or


`“$ASSETS/locationDressing/level/texture/source/”+strreplace(chs(“../each1/group”),“sgGrp”, “”)+“_d.rat”`
if(coffees<2,round(float),float)
User Avatar
Member
338 posts
Joined: Sept. 2006
Offline
Thanks guys :¬) $ASSETS/locationDressing/level/texture/source/`strreplace(chs(“../each1/group”),“sgGrp”, “”)`_d.rat

this one works great i thought it was calculating the channel reference properly as my groups didnt appear. But as soon as i jumped out of the for each node it worked fine Nice one guys :¬)

A weird one this..

string groupNames =chs(\“../each1/group\”) i never added those slashes manually. they appeared when i copied and pasted them?? lol :¬D

Cheers
Nick
  • Quick Links