Jump to content

Managing String attributes


Recommended Posts

Hello guys,

 

I'm struggling with something at this time. 

 

My problem is : I have a bunch of geometries all imported into my houdini scene in one alembic cache. I have about a hundred fruits (each one are made of two or three basic objects stored in the alembic) I want to extract them from the alembic cache and combine the basic objects so I can get at the end every single fruit combined. 

 

So my idea is to tag every geometry so the rbg fratured object knows how to fracture the hole thing. every basic object of the banana_01 will get the tag banana_01, those of peach_01 will get peach_01 and so on.

 

So I used the object merge node to extract the geometries. From here I activated the create Per Point path option to create a string attribute (wich is called objname by default) that hold the full path of my object. At this point, I get something like that : 

 

objname =/obj/fruitball_abc/fruitPack_BDD_cherry_01_cherry_01_hi/fruitPack_BDD_cherry_01_cherry_01_hiShape/fruitPack_BDD_cherry_01_cherry_01_hiShape

 

 

Now is my question :)

 

How can I do in the attributeCreate node to get this attribute, split every part that I don't need and reinject it in the freshly new created attribute.

 

created attribute = cherry_01

 

I tried some expression and python stuff but I'm not really cumfortable with the hou module and houdini expression and I didn't find some string splitting function.It feels quite easy to do I guess but I can't figure it out.

 

If someone have an answer. It will be greatly appreciated.

 

 

thanks

 

Pierre 

Link to comment
Share on other sites

Thanks Remi.

 

that's exactly what I'm looking for. 

 

With that being said, A quick other question. I paste what you did on my scene and it doesn't seem to work, like Houdini doesn't want to evaluate it. The attribute channel is red on your file and it's not on mine. 

 

Am I doing something wrong by just copy/paste your expression ? 

 

 

Edit : by importing my alembic in your file. it seems to works. I definitly think I did something wrong. But what ! maybe you can tell me !

 

EDIT 2 : Ok I got it ! for the ones who wanna know. you have to alt + LMB on the parameter to set an expression/key on the string parameter before typing any python stuff in it.

 

 

Thanks again Remi ;)

Edited by Pilou
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...