query all non-default attributes that have been added to a particle

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 11 November 2009   #1
query all non-default attributes that have been added to a particle

I want to know if there is a way to query all of a particles attributes...but only ones created or added (so all attributes other then the default ones)

The only thing I can think of is to get all the attrs of a fresh newly created particle and then use that list to compare against all the attributes of the other particle.

Basically I want to be able to select a particle and get all the custom attributes the user has added including the rgb or opacity or any of the attributes in the "add Dynamic Attribute" list under the particle tab.........any ideas?




{
*edit* this looks like it will return all the possible attributes i'd want...now i would just have to compare these to a list of the default attributes.

$ppd = `particle -q -perParticleDouble particle1`;
$ppv = `particle -q -perParticleVector particle1`;


does anyone know of a better or more efficient way?
}


{
**edit 2** Heres what I've come up with:

$ppd1 = `nParticle -q -perParticleDouble nParticle1`;
$ppv1 = `nParticle -q -perParticleVector nParticle1`;
$ppAll1 = `sort (stringArrayCatenate($ppd1, $ppv1))`;

$ppd2 = `nParticle -q -perParticleDouble nParticle2`;
$ppv2 = `nParticle -q -perParticleVector nParticle2`;
$ppAll2 = `sort (stringArrayCatenate($ppd2, $ppv2))`;


for($each in $ppAll2){
int $found = stringArrayContains($each, $ppAll1);
if (!$found){
print ("no -- " + $each + "\n");
}
}

}
__________________
http://kielgnebba.com/

Last edited by rxgeez : 11 November 2009 at 03:07 AM.
 
Old 12 December 2009   #2
You could use a convention where all of your added attributes contain an identifiable string within them that is not in any of the default attributes. Then sort based on that string.
For the standard added attributes like rgbPP, you could simply compare against a list.
 
Old 12 December 2009   #3
yeah thanks for the response....but I'd like to be able to get all those attributes from any particle in any scene.

Basically the main reason for this is I'm writing a tool that would ultimately create a template txt file that would contain all the attrs, expressions, connections, ect of a selected particle so that it can be recreated at anytime.



I managed to come up with something that works for me. A combination of 3 commands:

//get all float pp attrs
string $ppdAttrsDefault[] = `nParticle -q -perParticleDouble nParticleShape1`;

//get all vector pp attrs
string $ppvAttrsDefault[] = `nParticle -q -perParticleVector nParticleShape1`;

//get all scalar attrs
string $scalarAttrsDefault[] = `listAttr -output nParticleShape1`;
__________________
http://kielgnebba.com/
 
Old 12 December 2009   #4
cmds.listAttr(userDefined=1) (python syntax)

check out the docs for more info.
__________________
From Russia, with love @ stooch.tv
 
Old 12 December 2009   #5
Oh. Perhaps create the particle setup as you want it to be, with the attributes and connections required, then save it as a .ma file. It is a text file that maya is able to read to recreate your scene at any time in the future.
 
Old 12 December 2009   #6
Thread automatically closed

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.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 12:46 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.