Jump to content

Copy text and change text based on the ID


NoaX

Recommended Posts

Hi everyone today I have a simple problem that I don't have the experience working with text in Houdini to Solve,

1. I've created a grid, randomly selected a couple points using a group. I then fed this group to a copy to points.

2. The group of points being copied too are being enumerated so that they have an unique ID. 

3. The font is entering the loop, receiving the ID and now displaying it's ID number.

4. Desired result: Per unique ID, I need to be able to say 'if id = 0, then text = 'apple,' just as a random example. I will of course also use the ID number to delete or blast things down the

pipeline.

 

Thank you in advance.

File: uniquetext.hipnc

 

uniqueid2.thumb.png.3d097cbf05ed0182196dc219384e5dc1.png

uniquetext.hipnc

Edited by NoaX
Link to comment
Share on other sites

1 hour ago, Librarian said:

If you check Add text attributes @NoaX

 

Getting the ID, is not problem. However I can't get the ID to equal a string:

 

for example: 

"if(@id == 1) {
    v@Cd = set(0,1,0); 
    s@stringAttrib = "hello world";
}"

 

 

result.thumb.PNG.b2720173f52b3a65d4ae58ad81a67036.PNG

 

Link to comment
Share on other sites

You could use an array as a detail  attribute and look for the matching Id ?

 

s[]@test={'Alpha','Bravo','Tango'};

And to read it back:

string read[] = s[]@test;

s@a = read[0];
s@b = read[1];
s@c = read[2];

 

for(int i=0; i<len(read);i++)
{
    printf("read = " + "%c\n", read);
}

 

 

Happy new year Houdini people!

________________________________________________________________

Vincent Thomas   (VFX and Art since 1998)
Senior Env and Lighting  artist & Houdini generalist & Creative Concepts

 http://fr.linkedin.com/in/vincentthomas

 

happynewyear_2021_vince.jpg

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...