[Closed] get camera in XRef scene ?
Hello, do some one know,
how to get the name of cameras in the XrefScene ?
I tried bellow to get the node name in the XRefScene.
for i = 1 to xrefs.getXRefFileCount() do(
aXref = xrefs.getXRefFile i
aXrefObj = aXref.tree.children
for q = 1 to aXrefObj.count do(
print aXref.tree.children[q].children
)
)
I wanted to get the name of camera only.
And also I don`t know how to get the hole list of nodes in xRefScene.
In script above, I have to dig down using “.children[q].children[p].children…”
If someone know the good way to do, please help me.
thank you
try this to collect all objects in your xrefscene:
fn addChildrenToArray theChildren theArray =
(
for c in theChildren do
(
append theArray c
addChildrenToArray c.children theArray
)
)
obj = (xrefs.getxrefFile 1).tree
xrefObjArray = #()
addChildrenToArray obj.children xrefObjArray
-- print xrefObjArray
you can replace “for c in theChildren do” by “for c in theChildren where isKindOf c camera do” to filter for camera only.
Hope this helps
hello, David thank you for your help!
The thing I wanted to do was cleared by your script !
to go far,
I tried to get hole nodes in xrefScene, but couldn`t make it…
the code you taught me, the part of loop to get all nodes in xRefScene,
append theArray c
addChildrenToArray c.children theArray
this loop didnt work good… hmm, but why??
one I thought is, the function wont work in self.