Jump to content
sorrowriser

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

 

Share this post


Link to post
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. 

add_to_group.hiplc

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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?

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×