Jump to content

How to add points to the group node at certain Frames?


Recommended Posts

Hi there!

I'm new to houdini and tring to understand the logic behind it. I'm tring to add points to the group node. But i want to control this. Like at frame 1, add the points 100 95 22. But at frame 10, add points 200 46 8 to the previous selection. At frame 20 add point 45 564 89 etc. Is there a way to achieve this directly in group node with "expressions" maybe?

Note; My scene contains nothing so its useless to share a hip i guess. I just add a sphere, scatter points and add group node. And sorry for my english, its not my main language.

 

Thanks

 

Link to comment
Share on other sites

You can arbitrarily add points to groups using VEX in an AttributeWrangle.

int ary_point_candidates[] = {};
if (@Frame == 10) {
    ary_point_candidates = {1,15,34,12,7};
}

if (@Frame == 100) {
    ary_point_candidates = {51,19,7,32,33};
}

int l = len(ary_point_candidates);
if (l > 0) {
    foreach (int i; ary_point_candidates){
        setpointgroup(geoself(),"my_group",i,1,"set");  
    }
}

post-12295-0-03207200-1454940124_thumb.j

Edited by Atom
Link to comment
Share on other sites

Hi,

 

I don't think you can do this directly in group SOP. you can, however, do it with group SOP and a switch SOP. see the attachment. it is not the only way how to do that but I think it is the most straightforward one. 

 

Thanks for the quick reply davpe!!! Really appericiate it.

You can arbitrarily add points to groups using VEX in an AttributeWrangle.

int ary_point_candidates[] = {};
if (@Frame == 10) {
    ary_point_candidates = {1,15,34,12,7};
}

if (@Frame == 100) {
    ary_point_candidates = {51,19,7,32,33};
}

int l = len(ary_point_candidates);
if (l > 0) {
    foreach (int i; ary_point_candidates){
        setpointgroup(geoself(),"my_group",i,1,"set");  
    }
}

Thanks for the reply atom. I tried this code on a wrangle node but got no chance. Wondering what am i doing wrong? When i check, i see no group created for example. I see you create a group in vex( am i right?) from the points you selected but i got no chance of accessing to those points/group.

Thanks anyway

Link to comment
Share on other sites

Did you change the Wrangle to run over Detail as shown in the image?

Yes i changed it. But now what i notice is; i can see it creates that group at giving frames( 10 for this example) and deletes it at frame 11 immediately. Next it creates that group at frame 100, and deletes it again one frame after. Its not keeping these grups. That happens at houdini 15. With houdini 14, nothing happens. Any ideas?

Link to comment
Share on other sites

Yes i changed it. But now what i notice is; i can see it creates that group at giving frames( 10 for this example) and deletes it at frame 11 immediately. Next it creates that group at frame 100, and deletes it again one frame after. Its not keeping these grups. That happens at houdini 15. With houdini 14, nothing happens. Any ideas?

 

Wrangles handle attributes a bit differently in 15 than they do in 14 - so I'm guessing the issue is with "@Frame", which should be different for H14 (not sure what though, as my Wrangle knowledge is very limited). 

 

However, that won't fix the first part of your question; instead of having a single statement that says "If the frame is equal to 100", you would need to have two statements, such as "If the frame number is greater than 100 and if the frame number is less than 200, then do this..."

Edited by LukeLetellier
Link to comment
Share on other sites

Remember, you control the lists. So make the list grow as needed. The second time you need to add point numbers, simply include the numbers from the last list as well.

int ary_point_candidates[] = {};

if (@Frame > 10) {
    ary_point_candidates = {1,2,3,4};
}
if (@Frame > 100) {
    ary_point_candidates = {1,2,3,4,5,6,7,8};
}

int l = len(ary_point_candidates);
if (l > 0) {
    foreach (int i; ary_point_candidates){
        setpointgroup(geoself(),"my_group",i,1,"set");  
    }
}

Go ahead and upgrade to H15. On H14 you may be able to substitute `$F` for @Frame.

if (`$F` > 10)
Edited by Atom
Link to comment
Share on other sites

 

Remember, you control the lists. So make the list grow as needed. The second time you need to add point numbers, simply include the numbers from the last list as well.

int ary_point_candidates[] = {};

if (@Frame > 10) {
    ary_point_candidates = {1,2,3,4};
}
if (@Frame > 100) {
    ary_point_candidates = {1,2,3,4,5,6,7,8};
}

int l = len(ary_point_candidates);
if (l > 0) {
    foreach (int i; ary_point_candidates){
        setpointgroup(geoself(),"my_group",i,1,"set");  
    }
}

Go ahead and upgrade to H15. On H14 you may be able to substitute `$F` for @Frame.

if (`$F` > 10)

Thanks atom, now it works like charm in H15. Now i need to understand this code to get whats going on really :lol:

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