PDA

View Full Version : Particle_Editor


ruchitinfushion
12-10-2010, 03:13 PM
I design this tiny window,
http://i410.photobucket.com/albums/pp186/ruchitinfushion/ParticleEditor.png?t=1291993534
Right now it's not working ,so help me to build cmpltly .
What i want to do is
1)Select some particle
2)put some value in X,Y & Z for Translate,After click execute it will add given value to current value of particle position.
3)And for Instance stuff =>assume particleShape1.pt[3] are having value 2 for objectIndex but i want value 5 for this particle ,so when i put value 5 in ObjectIndex & execute.Instance object will update.

Pyrokinesis
12-12-2010, 07:31 AM
To change the position of a specific particle in your particle system use this syntax (or the corresponding mel ).


# This changes the position of particleShape1[5] to 0,0,0
import maya.cmds as mc
mc.particle('particleShape1', edit=True, order=5, attribute='position', vectorValue=[0, 0, 0])



The order flag is being used to specify the 5th indice in the system.
Similar syntax can be used to change the object index. Use the component editor, select particle, and change an attribute. Make the change and check the script editor for the mel syntax.

Good Luck.

ruchitinfushion
12-12-2010, 04:02 PM
ahh Thanx for reply ..Tell me how can i use this for selected particle.
string $mySel[]=`ls -sl`;
// Result: particle1.pt[2:4] particle1.pt[8] particle1.pt[11] particle1.pt[14] //
now i want to move this above selected particle.Problem is for capturing Id of selected particle.

thematt
12-12-2010, 08:59 PM
use flatten in the ls command should do the trick no?
string $sel[]=`ls -fl -sl`;
cheers

ruchitinfushion
12-13-2010, 07:31 AM
-fl seems very useful ,i think now i can capture particle id easily using tokenize & then for loop.Thank you for help

Pyrokinesis
12-13-2010, 09:25 AM
Cool, a good way to get the particles from what is selected is using filterExpand.


particles = mc.filterExpand(fullPath=True, selectionMask=47)



It seems I may have mislead you with the order flag though, you will want to use the id flag instead.

good luck.

ruchitinfushion
12-14-2010, 02:05 PM
[CODE]
string $MySel[]=`ls -fl -sl`;

int $NumSel = size($MySel);

print $NumSel;

int $i;

for($i=0;$i<$NumSel;$i++){

string $buffer[];

tokenize $MySel[$i] "particle1.pt[] " $buffer;

int $SelectedID=$buffer[$i];

particle -e -id $SelectedID -at position -vv 5 2 5 particleShape1;

print $SelectedID;

}

[CODE]


Don't know why $SelectedID is not updating after loop cmplt.Tel me whts wrong i m doing.seems i doing something wrong in for loop body.


And pyrokinesis thanx much for reply

ruchitinfushion
12-18-2010, 02:09 PM
Friends i found nice way to get list of IDs of selected particle
getParticleAttr (http://www.thnkr.com/wiki/index.php?title=GetParticleAttr) -at id -array true `ls -sl`;

but tell me how can i store in variable??i tried this but it's giving me an error
int $MySel[]=`getParticleAttr -at id -array true `ls -sl``;

ginodauri
12-18-2010, 04:56 PM
string $sel[]=`ls -sl`;
float $part[]=`getParticleAttr -at "id" -array true $sel[0]`;

Two mistakes:

1.you need to use float array
2.ls -sl returns array , and you must use first element in array

CGTalk Moderation
12-18-2010, 04:56 PM
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.