3dsmax script 使用脚本获取激活材质球所关连的物体

fn GetObjsFromActiveMat  = 
(
	--local Mtls = #()	--所选物体的材质名集合	
	local resultObjs=#()
	local noMatObj = #()	
	
	mat =meditmaterials[activeMeditSlot] 
	refs_objs =refs.dependents mat 	--正常返回的是一个包含材质与物体的数组,但有些材质不知道什么原因,没包含到物体
	resultObjs = for obj in refs_objs where superclassof obj == GeometryClass collect obj
	  
	--如果这个objs =refs.dependents mat没有GeometryClass类的物体,则是直接将选择的物体返回给resultObjs
	if resultObjs.count==0 then resultObjs = Objs
	
	resultOjbs = if resultObjs != undefined then ( join resultObjs  noMatObj)
	return resultOjbs

)

猜你喜欢

转载自blog.csdn.net/weixin_41767230/article/details/106350069