Notifications
Clear all

[Closed] quick way to find object with a CA in scene without looping

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.

4 Replies

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
	for ref in (refs.dependents n) do (
		format "	%
" ref
		for ref in (refs.dependents ref) do (
			format "		%
" ref
		)
	)
)
test:test
	Sphere
		$Sphere:Sphere01 @ [0.000000,0.000000,0.000000]
		ReferenceTarget:ReferenceTarget
OK

 JHN

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

Hmmm… Doesn’t seem to work if the custom attribute is applied to an xref’s “actualBaseObject”. Bummer.

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.