Notifications
Clear all

[Closed] Select by effectsChannel within multiMat or sub map

I’ve written this little tool to select objects by Object ID or by effects
Now I’m looking to dig through multiMaterials and submaps to look for a given effectsChannel.

My thoughts are to somehow collect all of the effectsChannel values (of each material and subs) into an array and then if finditem returns a value then collect the object… make sense? Any hints tips?

Thanks

here is the working macro for anyone who wants it

macroscript SelectByGBuffer 
    category:"MyTools"
    
    (	
    	try (destroyDialog ro_SelGBuff) catch()
    
    	rollout ro_SelGBuff "Select by GBuffer ID"
    	(
    		spinner spn_GBuffID "G Buffer ID: " type:#integer mwidth:70
    		button btn_SelectObjID "Select" width:100
    
    
    		on btn_SelectObjID pressed do
    			(
    				clearselection ()
    				select (for o in objects where o.gbufferChannel == spn_GBuffID.value collect o)
    			)
    	
    		 spinner spn_MattID "Material ID Ch.: " type:#integer mwidth:70
    		button btn_SelectMatID "Select" width:100
    
    
    		on btn_SelectMatID pressed do
    			(
    				clearselection ()
    				allGeo = (for g in objects where g.material != undefined collect g)
    				select (for i in allGeo where i.material.effectsChannel == spn_MattID.value collect i )
    			) 
    		label lab_JCredits01 "By: me"
    		label lab_JCredits02 "---------"
    	)
    	createDialog ro_SelGBuff 180 140
    )