David Gary Posted January 15, 2004 Share Posted January 15, 2004 Hey Simon! Very very useful HDA! I've understand how it works, it's very simple! Congratulations! :) A suggestion: Why not use an internal variable (incrementing at each loop), that could be used through expressions within the SOPs that are between forloop and forloopend ( analoguous to the features of a copy SOP) ? It's just a little more code to write ( declare and increment a variable in your calback command, two more lines...). I see many applications for that. It is soon going to be a universal HDA! Quote Link to comment Share on other sites More sharing options...
edward Posted January 16, 2004 Share Posted January 16, 2004 Yeah, a loop counter variable would be very useful. Here's my changes attached. The OTL is already embedded. You'll have to copy it out using the Operator Type Manager if you want to re-use it. I won't bother until I see what you guys think. PS. I think I also fixed an off by one bug in it as well. forloop.zip Quote Link to comment Share on other sites More sharing options...
David Gary Posted January 16, 2004 Author Share Posted January 16, 2004 With a SwitchSOP which is equivalent to a switch/if-else statement (SwitchSOP with NullSOP for if), a ForLoop SOP, Houdini becomes more procedural than ever. I like it! We've got almost all the programming structures in the modeling process. It could be generalized to COP and CHOP... I'm going to do some fractal art with all that! And completely generalized L-Systems. Quote Link to comment Share on other sites More sharing options...
sibarrick Posted January 17, 2004 Share Posted January 17, 2004 Feel free to amend it at will, i'll add the suggested variable. The only reason I left it out was because I felt it was more efficient to use attributes that increment rather than global variables, these can be added "inside" the loop. That way it is stored with the geometry. Also, when you increment a variable sometimes you need to use varchange to get it to recook and that can slow things up a bit. Anyway I'll put it as an option. You're right about the off by one bug, wasn't really something I checked it was more the fact that it could be done so simply with an hda that i was impressed with. All it really needs is now is an "on cook" event so that it can be triggered without any user intervention. I've RFE'd it with Sesi, but if you think it is useful write to them and RFE it too, that way it is more likely to happen. Of course they might even create a proper subnet to do it with all the bells and whistles you can think of.. Quote Link to comment Share on other sites More sharing options...
edward Posted January 17, 2004 Share Posted January 17, 2004 Yeah, that's how I added the variable. It's a detail attribute called "loopcnt" that has a variable mapping to LOOPCNT. So if you look at the hip file I posted, it simply uses $LOOPCNT to create the point group by expression. It would have helped if I could have used it directly in a Group field but that would probably require creating something that param() could use (like in a real loop sop) which isn't possible(?). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.