PDA

View Full Version : Particle count as a Heads up Display


RhythmOfLine
06-21-2009, 02:00 AM
Hey Folks,

So, I guess the name says it all. I am trying to write a script that show the total particle count asa heads up display. This is the script I got so far. I feel I am pretty close, just need to add all the count and get it to display properly. Any help would be much appreciated:


global proc float[] particleCountDisplay ()

{

string $allObjects[];
string $obj;
int $partCount;

string $totalPartCount[];

$allObjects = `ls -type particle`;

for ( $obj in $allObjects )
{
$partCount = `getAttr ($obj + ".count") `;
$totalPartCount = `($obj + " - " + $partCount + "\n")`;
}

return $totalPartCount;

}

headsUpDisplay -section 1
-block 0
-blockSize "medium"
-label "Particle Count"
-labelFontSize "large"
-command "$partCount"
HUDParticleCount;

Wick3dParticle
06-21-2009, 09:11 PM
Hey Shiv,

You were almost there...had just a few things to fix up.

global proc int particleCountDisplay (){

string $allObjects[] = `ls -type particle`;
int $partCount;
int $addPtCounts;

for ( $obj in $allObjects ){
$partCount = `getAttr ($obj + ".count") `;
$addPtCounts += $partCount;

}

return $addPtCounts;

}

if (`headsUpDisplay -exists "HUDParticleCount"`)
{
headsUpDisplay -remove "HUDParticleCount";
}

headsUpDisplay
-section 0
-block 8
-blockSize "small"
-label "Particle Count"
-labelFontSize "large"
-command particleCountDisplay
-ev timeChanged
HUDParticleCount;


~Ilan

RhythmOfLine
06-22-2009, 03:01 AM
Ahh...sweet! thanks a lot, much appreciated! :)

Wick3dParticle
06-22-2009, 03:49 AM
No prob, you're welcome! I also just noticed that the event trigger isnt updating in playblasts. So if you want the data updated at playblast time, swap the -ev timeChanged flag with -attachToRefresh.


~Ilan

RhythmOfLine
06-23-2009, 02:50 AM
thanks a lot once again. the only issue is that when I do use -attachToRefresh it drops the fps below 0 or to a very low value.

also, i would like to delete the UI if its already visible. kinda like toggle on and off. also would want to put the oversample value there as well and using HUD sliders would be a great idea for the oversample attribute. i also want each particle's count to be listed as well when a user selects it. ofcourse the user is going to select the transform node so i'd need to traverse down the hierarchy for the same to grab the shape node. i'll also try to give all this a shot.

thanks a lot for all the help!

cheers :)

CGTalk Moderation
06-23-2009, 02:50 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.