View Full Version : Find object by a certain given attr?

02 February 2008, 07:20 AM
Hi,everyone. I wonder if there is any method to find a object which has a certain custom attribute .

Let's say , I create a sphere and add an attr named "Test" (this attr is only used for find this sphere.). then , maybe some reference or import things. Now, I've many objects in my scene , but how can I select the just sphere I made before. Since the sphere name may changed by referencing , I guess it can be done by using the attr name "Test". But I don't know how.

Any and all helps and suggestions will be greatly appreciated!

02 February 2008, 08:33 AM
I think you have to parse through all you objects and check this attr:

something like this....
string $shapeName[] = `cone`;
if (`attributeExists "scaleX" $shapeName[0]`) {
print "Attribute exists\n";
} else {
print "Attribute does not exist\n";

otherwise check out

"lsThroughFilter" with "itemFilterAttr -byNameString"

02 February 2008, 09:25 AM
Hi, GiantG .Thank you very much!

btw: your image2object scripts is very nice!

CGTalk Moderation
02 February 2008, 09:25 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.