Sometimes, you need to know which nodes of a particular type exist, because you want to do something to all nodes of type X, and you'd like to script that, because you, like me, can't be bothered to do it all by hand. Yes, I believe laziness is a virtue :) Often, you can make these kinds of changes in the Attribute Spreadsheet, but sometimes you just can't. Changing the location of a file texture for example is not possible in the Attribute spreadsheet.
In many cases, it's really quite simple, and here's an example that turns of vertex display on all meshes (something that does show up in the Attribute Spreadsheet, but I'm too lazy to go look for it).
string $meshes[] = `ls -typ "mesh"`;
string $tmp;
for ($tmp in $meshes) {
setAttr ($tmp + ".displayVertices") 0;
}
Here's something that I use a lot when I have to render a scene that a customer sent me without all the file textures. I get a list of all nodes of the type file and then do something to them, like set all their names to the same texture so that the scene will render without missing texture errors. I know that the nodeType I'm looking for is file because it says so in the Attribute Editor, simple enough. Or I could use the nodeType command.
Replacing all file textures looks like this:
string $fileNodes[] = `ls -typ "file"`;
string $tmp;
for ($tmp in $fileNodes) {
setAttr -type "string" ($tmp + ".fileTextureName") "myTexture1.iff";
}
This is all simple enough. You can do the same thing for any kind of node.
But what if you want to do something to all mental ray materials, who all have different nodeTypes? Should you list them all and then go over each individual type? That almost feels like doing it by hand again, and that's precisely what I didn't want to do.
I'll use a feature that's not very widely used as far as I know: lsThroughFilter in stead of ls -type. Before I can use lsThroughFilter, I have to set up a filter first. A filter is a node, but it does not get saved with the scene. You can select them and see their attributes in the Attribute Editor.
Heres how to create one for all mental ray materials.
string $renderFilter = `createNode objectRenderFilter`;
setAttr -type "string" ( $renderFilter + ".annotation") "mental ray Materials";
addAttr -ln "nodeClassification" -dt "string" $renderFilter;
setAttr -e-keyable true ($renderFilter+ ".nodeClassification");
setAttr -type "string" ( $renderFilter + ".nodeClassification") ",rendernode/mentalray/material";
print `lsThroughFilter -na $renderFilter -sort byName -reverse false`;
If you want to know what other types exist, take a look at objectNameFilter, objectAttrFilter, objectScriptFilter, objectMultiFilter, objectRenderFilter, objectTypeFilter, objectBinFilter, selectionListOperator
Take care,
Michiel Duvekot





Subscribe
AWesome. How do you filter for user created custom nodes via the API.
All you can filter for are the sub-types that the node inherited from:
kPluginLocatorNode
Which still returns ALL plugin locator nodes. How do you discretely only find "my" nodes. The only thing I have seen is some form of RTTI which breaks the idea behind MFn* classes no?
Just curious how this is solved in the wild.
Posted by: Alexander Morano | 08/04/2011 at 12:05 AM
otto wolff anthroposophic medicine http://dailybooth.com/Pink_Viagra/23300043#979 - female viagra bio sports medicine clinics
maternal fetal medicine maine http://dailybooth.com/Pink_Viagra/23300046#487 - saint francis internal medicine
alternative medicine lies http://dailybooth.com/Pink_Viagra/23300056#273 - free trial female viagra canadian pharmacy medicine metanx
wal mart 4 dollar medicine list http://dailybooth.com/Pink_Viagra/23300058#941 - how does female viagra work libido century cabinet medicine
morris center sports medicine evans http://dailybooth.com/Pink_Viagra/23300070#497 - link university illinois pharmacy chicago
buffers in medicine http://dailybooth.com/Pink_Viagra/23300073#247 - is there a female viagra their wedding make up medicine hat
pcos and traditional chinese medicine http://dailybooth.com/Pink_Viagra/23300080#752 - milium pharm
disadvantages of using herbal medicine http://dailybooth.com/Pink_Viagra/23300085#753 - link jacobson internal medicine issaquah
toll free telephone for teva pharm http://dailybooth.com/Pink_Viagra/23300089#266 - name of female viagra in mumbai optometrist medicine hat
marijauna medicine http://dailybooth.com/Pink_Viagra/23300094#771 - medicine dropper holder
bestlife pharmacy the scottish medicines consortium
alternative medicine for diverticulitis slim corner medicine cabinet
massachusetts practice of pharmacy pharmacy purchasing committee description
cvs pharmacy cigarettes kroger pharmacy madison wv
internet pharmacy diet drugs medicine colleges in houston texas
newborns and medicine sexuality in medicine
oh pharmacy requirements dog medicine cosequin ds
f m pharmacy new york viagra college ma pharmacy
uc davis sports medicine openning a herbal medicine business
tibetan energy medicine training new medicines for osteoarthiritis
Posted by: rkindusrows | 13/02/2012 at 10:29 AM
24 hour pharmacy's honolulu hawaii http://www.youtube.com/watch?v=HXS-RTzFk8c#717 - albuterol hcpcs code isomers green medicine buddha statue
american osteopathic board of internal medicine http://www.youtube.com/watch?v=pyqpT9zMN28#521 - headache overdose buy albuterol quality market pharmacy
art sports medicine daniel selstad http://www.youtube.com/watch?v=KROJ87tMTtY#283 - albuterol heart attack symptoms asthma whats the best anxiety depression medicine
anal insertion medicine http://www.youtube.com/watch?v=8mcXgCgXjeQ#622 - albuterol heart damage possible illegal pharmacy
webkinz at drug city pharmacy http://www.youtube.com/watch?v=VOULP_YN9-M#806 - albuterol heart rate increase doses walker's pharmacy madisonville tx
gestational diabetes obstetrics medicine http://www.youtube.com/watch?v=boGL1IuYHWY#603 - albuterol cost proair hfa chapel hill family medicine
international online pharmacy consultation http://www.youtube.com/watch?v=mHaoYoOcoxE#255 - albuterol hfa coupons inhaler alternative medicine organisations
frameless medicine cabinets http://www.youtube.com/watch?v=sj8iK1-76xA#399 - albuterol hfa inhaler coupon patient owning a pharmacy
ariel pedersen and pharmacy http://www.youtube.com/watch?v=8Ebg3lBYI-8#095 - coupons for albuterol inhalers hfa gynefix coil online pharmacy
pharmacy p l activity http://www.youtube.com/watch?v=oAAZEjx38qs#682 - hfa albuterol alternatives mdi canada canadian in montreal pharmacy quebec
cvs pharmacy pgh north side alternative medicine practioners
automated pharmacy system manufacturer the sullivan group emergency medicine risk
alternative medicine tampa fl business broker pharmacy
administration of medicine cvs pharmacy ypsilanti mi
pharmacy technician legislation hb 1250 ultrasonic medicine
citadal medicine pharm rxl
medicine management pdf icos and medicine
nylon pharmacies de garde weaver corner pharmacy
no prescription pharmacy diazepam walgreens pharmacy tech test
pain relief pharmacy online bostick's prescription pharmacy piketon
Posted by: catyhopiuex | 14/02/2012 at 09:24 AM