Notifications
Clear all

[Closed] converting array

I would like to know it an array #(“box01”, “box02”) can be converted in something like #($box01, $box02). Basically, i would like a method like the getnodebyname which could be applied to a string array and return an array contening the nodes.

Thanks

4 Replies
1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

Why don’t you write it yourself? You already know getNodeByName!

  theNameArray = #("box01", "box02")
  theNodeArray = for i in theNameArray collect getNodeByName i
  

If the node is not in the scene, getNodeByName will return undefined.

Test Scene: New Session with four boxes.

(
NameArray=#(“box01”,“box02”,“box03”,“box04”)
SelArray=#()

for ObjName in NameArray do ( append SelArray (getnodebyname ObjName))

)

SelArray is now an array of nodes…

Keith Morrison

– Beat by 1 min… Bobo’s codes nicer…

Again tahnks.
You’re great people.
I’ll try it…

…and it’s working ! ! ! Thanks

If someone is intersted by this script I can post it.
Let me know.
Basically it deals with the exclusion/inclusion list without to open the modify panel. You can past over lights List to the one selected and access to the most used parameters (on, cast shadow, name, color, hide/show, fat attenuation range hide/show…).
I’m implementing special tools too (based on the one of Blurscript) like “who’s light me” and “who I light”… I know there’s over scripts doing more or less the same, but this one as the avantage not to fill up you working area with big windows. It’s small and provide a quick way to deals with lights.