Forum rules


Please attach an image to your first post so that a thumbnail is generated in the list of topics.



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Randomise Selection script
PostPosted: Fri Jul 30, 2010 4:53 pm 
User avatar
Imperial Guard
Offline

Joined: Tue Jun 23, 2009 11:15 pm

Posts: 621

Location: Auckland, New Zealand
Here's a really quick scripts that randomly deselect part of a selection you make.

They should work on faces, verts, edges, objects, nodes and combinations of anything else that is selectable. I didn't bother with a fancy UI, just paste the code into your script editor and run it, or highlight it from your script editor and middle mouse drag it to your shelf for multiple use.

Code:
{
   global string $gMainProgressBar;  // This is defined on maya startup
   string $currentSelection[] = `ls -selection -flatten`;
   string $deselect[];
   int $i = 0;
   int $numDesel = 0;
   progressBar -edit
       -beginProgress
       -isInterruptable true
       -status "Randomizing..."
       -maxValue `size($currentSelection)`
       $gMainProgressBar;

   for ($each in $currentSelection)
   {
      $i = rand(0,2);
      if ($i == 0) {
         $deselect[$numDesel++] = $each;
      }
   }

   progressBar -edit
           -step 1 $gMainProgressBar;
   
   select -d $deselect;
   
   progressBar -edit
       -endProgress
       $gMainProgressBar;
}


Attachments:
preview.jpg
preview.jpg [ 33.28 KiB | Viewed 2626 times ]

_________________
Oana Croitoru - Web Portfolio
Top
 Profile  
 
 Post subject: Re: Randomise Selection script
PostPosted: Sun Nov 14, 2010 7:05 am 
User avatar
Moderator
Offline

Joined: Sun Feb 17, 2008 10:20 pm

Posts: 1339

Location: Wellington, NZ
Coolio, that could be useful...

_________________
A bus station is where a bus stops. A train station is where a train stops. On my desk I have a workstation.


Top
 Profile  
 
 Post subject: Re: Randomise Selection script
PostPosted: Mon Nov 15, 2010 10:10 am 
User avatar
Imperial Guard
Offline

Joined: Tue Jun 23, 2009 11:15 pm

Posts: 621

Location: Auckland, New Zealand
No problemo.

_________________
Oana Croitoru - Web Portfolio


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

About Us


Contact Us


Advertise on NZCGI

Powered by phpBB® Forum Software © phpBB Group
Logo Design by - Oliver Hilbert Revilo Designs