Stringing strings

   5525   7   0
User Avatar
Member
132 posts
Joined: July 2005
Offline
As usual with Houdini the more I learn the more I learn I need to learn… if that makes any sense. :?

I'm trying to make a “sprite maker” otl and would like the option to have either a static sprite or an animated sprite.

I have an “image file” parameter linked to my attribcreate SOP. In the attribcreate I have the type set to “string.”

In my string I'm entering:

`chs(“../../spritemap”)`.`padzero(4,$F%chs(“../..spritefileanimrangev”))`.`chs(“../../horsepopspritefileext”)`

====================================

My parameters allow me to enter the name of the file:

csprites/spritetestanim
====================================
And the frame range (uv)

1 50
====================================
And the extension (which is a pull-down type menu)

rla, rgb, tiff, etc

====================================

I'm not getting any images. I'll be troubleshooting some other things before I completely rule them out. But right now it seems like its is not possible to string “stings” together like this.

`chs(“filebase”)`.`padzero(4,$F%ch(“lastframe”))`.`chs(“extension”)`

Is there another way I shoud be combining multiple strings?

:?:
User Avatar
Member
8050 posts
Joined: July 2005
Offline
That should work. Perhaps there's some bit of syntax that's wrong. In a textport, cd into your sop and then do echo <expression> to see what it gives you.
User Avatar
Member
132 posts
Joined: July 2005
Offline
SteveOng came to my aid once again….

One of my biggest problems was not being able to see how Houdini was evaluating my strings. I was going into a textport and typing:

echo `my string` and getting no result. The key was getting down to the sop level in my textport to troubleshoot.

Once I was in /obj/myotl/myobj/mysop/ and ran the echo `my string` command I was finally able to see what was and what wasnt working. The final string came out to be:

`strcat(chs(“../../horsepopspritemapalpha”),chs(“../../dot”))``strcat(padzero(4,(rand($ID)*100+$F)%chs(“../../horsepopspritefileanimrangev”)),chs(“../../dot”))``chs(“../../horsepopspritefileext”)`

This allows me to have 3 seperate inputs into the same string, seperated when necessary by periods (.)

One issue I had was when I entered “.” the string didnt know how to evaluate it. So I went into my otl and made an invisible string parameter named dot and set the default value to “.” In my string I would type chs(“../../dot”) to return a “.”

Ultimately I'm now able to load a sprite into my otl, specify whether or not it's animated, set the frame range, and have that looping frame range attached to each sprite, offset by that sprites $ID. It's excellent. I also hooked up a cop network to procedurally generate sprites using the new noise generators. All in all this is becoming a great otl! I'm able to create sprite images, render sprite images, attach them to particles, as well as affect a multitude of parameters seperated under tabs for “source geo” “particles” “sprites” and “sprite images”


Thanks for all your help!
User Avatar
Member
132 posts
Joined: July 2005
Offline
SteveOng came to my aid once again….

One of my biggest problems was not being able to see how Houdini was evaluating my strings. I was going into a textport and typing:

echo `my string` and getting no result. The key was getting down to the sop level in my textport to troubleshoot.

Once I was in /obj/myotl/myobj/mysop/ and ran the echo `my string` command I was finally able to see what was and what wasnt working. The final string came out to be:

`strcat(chs(“../../horsepopspritemapalpha”),chs(“../../dot”))``strcat(padzero(4,(rand($ID)*100+$F)%chs(“../../horsepopspritefileanimrangev”)),chs(“../../dot”))``chs(“../../horsepopspritefileext”)`

This allows me to have 3 seperate inputs into the same string, seperated when necessary by periods (.)

One issue I had was when I entered “.” the string didnt know how to evaluate it. So I went into my otl and made an invisible string parameter named dot and set the default value to “.” In my string I would type chs(“../../dot”) to return a “.”

Ultimately I'm now able to load a sprite into my otl, specify whether or not it's animated, set the frame range, and have that looping frame range attached to each sprite, offset by that sprites $ID. It's excellent. I also hooked up a cop network to procedurally generate sprites using the new noise generators. All in all this is becoming a great otl! I'm able to create sprite images, render sprite images, attach them to particles, as well as affect a multitude of parameters seperated under tabs for “source geo” “particles” “sprites” and “sprite images”


Thanks for all your help!
User Avatar
Member
132 posts
Joined: July 2005
Offline
SteveOng came to my aid once again….

One of my biggest problems was not being able to see how Houdini was evaluating my strings. I was going into a textport and typing:

echo `my string` and getting no result. The key was getting down to the sop level in my textport to troubleshoot.

Once I was in /obj/myotl/myobj/mysop/ and ran the echo `my string` command I was finally able to see what was and what wasnt working. The final string came out to be:

`strcat(chs(“../../horsepopspritemapalpha”),chs(“../../dot”))``strcat(padzero(4,(rand($ID)*100+$F)%chs(“../../horsepopspritefileanimrangev”)),chs(“../../dot”))``chs(“../../horsepopspritefileext”)`

This allows me to have 3 seperate inputs into the same string, seperated when necessary by periods (.)

One issue I had was when I entered “.” the string didnt know how to evaluate it. So I went into my otl and made an invisible string parameter named dot and set the default value to “.” In my string I would type chs(“../../dot”) to return a “.”

Ultimately I'm now able to load a sprite into my otl, specify whether or not it's animated, set the frame range, and have that looping frame range attached to each sprite, offset by that sprites $ID. It's excellent. I also hooked up a cop network to procedurally generate sprites using the new noise generators. All in all this is becoming a great otl! I'm able to create sprite images, render sprite images, attach them to particles, as well as affect a multitude of parameters seperated under tabs for “source geo” “particles” “sprites” and “sprite images”


Thanks for all your help!
User Avatar
Member
132 posts
Joined: July 2005
Offline
Sorry for the multiple entries here. Got a little trigger happy. Just noticed somebody else responded with the same suggestion Steve had. Thanks Edward! Thats exactly what was wrong – my syntax was a little off and I had no way of seeing how Houdini was evaluating the string. Thanks again!
User Avatar
Member
1634 posts
Joined: July 2005
Offline
Hey the_squid,

You're very welcome! I realised earlier when testing that strcat() is not needed so your original expression would have worked except for a typo.

Glad things are working.

Cheers!
steven
User Avatar
Member
132 posts
Joined: July 2005
Offline
It was fun using strcat()

But yeah, this would work too:

`chs(“../../horsepopspritemapalpha”)``chs(“../../dot”))``(padzero(4,(rand($ID)*100+$F)%chs(“../../horsepopspritefileanimrangev”))``chs(“../../dot”))``chs(“../../horsepopspritefileext”)`
  • Quick Links