PDA

View Full Version : quick way to find object with a CA in scene without looping


luigi
04-08-2009, 11:00 AM
hi i was wondering if is an quick way to dinf what object got a certain CA , custom attributes aplayed in scene.

I just out a few CA in the baseobject of in scene , and i was thinkingif will be a way quicker that lop true al the objects in scene and change if the got the CA in the baseobject. if an easy way to find obejct with ca in scene, i was thinkign probably reference will do.

ZeBoxx2
04-08-2009, 11:20 AM
So you have some CA on an object..

myCA = attributes test (
parameters main (
test type:#float default:123
)
)
mySphere = sphere()
custAttributes.add mySphere myCA
<AttributeDef:test>
$Sphere:Sphere01 @ [0.000000,0.000000,0.000000]
true


and you want to check which objects are using it? Something a la...

for n in (getClassInstances myCA) do (
format "%\n" n
for ref in (refs.dependents n) do (
format "\t%\n" ref
for ref in (refs.dependents ref) do (
format "\t\t%\n" ref
)
)
)
test:test
Sphere
$Sphere:Sphere01 @ [0.000000,0.000000,0.000000]
ReferenceTarget:ReferenceTarget
OK

JHN
04-08-2009, 01:26 PM
Funny, was just doing something similar.


fn findCANodes =
(
clearArray = #()
theNodes = for m in (getClassInstances emptymodifier) where m.name == "nodeList" collect (refs.dependentNodes m)[1]
for n in theNodes do appendIfUnique clearArray n
clearArray
) -- end findCANodes


This one is name based I know this, but that works in my particular case.

-Johan

JHaywood
04-08-2009, 11:40 PM
Hmmm... Doesn't seem to work if the custom attribute is applied to an xref's "actualBaseObject". Bummer.

luigi
04-09-2009, 12:06 AM
thanks alot guys ,John , are you refering to xref scene obejcts or xref object with ca in the baseobject.???
I put alot of ca in baseobject , but i found lately the ca slow down the speed in trackview :( , but i have already report it , hopefully will get fix soon.

CGTalk Moderation
04-09-2009, 12:06 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.