Notifications
Clear all

[Closed] Selecting light targets only

on btn_selectByName_LightTargets pressed do
(
fn target_filt obj = isKindOf obj TargetObject
theTargetObjects = selectByName title:“Select Target objects” buttonText:“OK” filter:target_filt showHidden:true single:false

if theTargetObjects != undefined do
if theTargetObjects.count != 0 then select theTargetObjects else clearSelection()
)

I would like to filter this further so that only light targets show up in the select dialog, not camera targets.

Any thoughts ?

4 Replies
2 Replies
(@denist)
Joined: 11 months ago

Posts: 0

if you want to collect all light targets the easiest and most accurate way to do it is:


for obj in lights where iskindof obj TargetObject collect obj 

(@spica)
Joined: 11 months ago

Posts: 0

Excellent ! thanks !

How about something like this?

(superclassof (refs.dependentNodes obj firstOnly:true)) == Light

So your filter function could look like this:

function lightTargetfilter obj = 
(
(classof obj) == Targetobject AND (superclassof (refs.dependentNodes obj firstOnly:true)) == Light
)
1 Reply
(@spica)
Joined: 11 months ago

Posts: 0

Perfect !!

Thanks a lot PJanssen !