mightcouldb1 Posted March 30, 2010 Share Posted March 30, 2010 For example, you are coloring a bunch of particles based on their y-position. You want to find the maximum y-position across the entire simulation and make it a value of 1(via fit range), and the minimum y-position for a value of 0. I usually eyeball the values in the details view while I'm scrubbing the timeline trying to find max and min values. If I was making a digital asset I wouldn't want the user to take this step. How can I iterate over all of these values and sort them? Quote Link to comment Share on other sites More sharing options...
static Posted March 30, 2010 Share Posted March 30, 2010 (edited) You could do it in python, ie: geo = node.geometry() # replace node with hou.pwd() in an expression attr_name = "myAttr" max = 0 for pt in geo.points(): attr = pt.attribValue(attr_name) if attr > max: max = attr return max This is designed to be used in an expression most of the time... which doesn't use def statements See the following for more info: hou.Point class Python parameter expressions Edited March 30, 2010 by static Quote Link to comment Share on other sites More sharing options...
aracid Posted March 30, 2010 Share Posted March 30, 2010 Hey man What I did was use the attrib promote SOP and the promotion method to being either "maximum" or/and "minimum", and stored that into a details attribute on the object, and used the details expression to fetch the result from within the point SOP. I used the time shift because then u don't have to lock ur sim, unfortunately that requires it too sim the whole sequence before u can start messing with it, i wouldnt say its the most elegant solution, but it should work height.hip Quote Link to comment Share on other sites More sharing options...
johner Posted March 31, 2010 Share Posted March 31, 2010 (edited) One more approach... Since you want to work with the values of attributes over time, I would probably use CHOPs. Namely, a geometry CHOP set to "Animated" to pull in the values of y across the time range (forcing evaluation of the particles for the entire range, but can't be helped if you're looking for maxima and minima). Then a Math CHOP to combine all the particle Y channels, set to Maximum or Minimum, which will yield the highest or lowest particle y values at any given time. Then a Constant CHOP set to the "icmax" or "icmin" expression of those values to find the max or min across the entire time range. The problem with TimeShift is you have to know the frame at which the particles are at their limits, which could be tough to know ahead of time. See attached. height_CHOPs.hip Edited March 31, 2010 by johner Quote Link to comment Share on other sites More sharing options...
mightcouldb1 Posted March 31, 2010 Author Share Posted March 31, 2010 These are all great solutions. It's nice to see some different approaches! Thank you all! 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.