Notifications
Clear all

[Closed] CgTalk Maxscript Challenge 021: "More Information?"

hey guys, this thread inspired me to make a lil infoFloater wich shows you the parameters of the picked obj in scripter friendly format. nothing fancy but usefull imo


try(closeRolloutFloater InfoRO)catch()
sleep 0.1

CurSelection=""

fn UpdateInfo = ()


rollout Stats "Statistics" (
	label TriCountlbl "Triangle Count . . . . ." width:90 pos:[180,5]
	label Tricount "NIL" width:90 pos:(TriCountlbl.pos+[80,0])

	label VertCountlbl "Vertex Count . . . . ." width:90 pos:(TriCountlbl.pos+[0,17])
	label Vertcount "NIL" width:90 pos:(VertCountlbl.pos+[80,0])
	
	label Class1lbl "Class . . . . . . . . . ." width:90 pos:[5,5]
	label Class1 "NIL" width:90 pos:(Class1lbl.pos+[80,0])
	
	label SuperClass1lbl "SuperClass . . . . ." width:90 pos:(Class1lbl.pos+[0,17])
	label SuperClass1 "NIL" width:90 pos:(SuperClass1lbl.pos+[80,0])
)


rollout InfoLister "Maxscript Properties" (

	pickbutton pck "Pick Object"
	
	edittext MSProperties "Class" width:190 height:18 pos:[20,35]
	edittext NodeProperties "Node" width:190 height:18
	
	edittext ModProperties "Mods" width:230 height:18 pos:(MSProperties.pos+[(MSProperties.width+15),0])
	
	on InfoLister open do (
		UpdateInfo()
		
		InfoLister.NodeProperties.pos=(MSProperties.pos+[0,(MSProperties.height+15)])
		
		InfoLister.height=(InfoLister.MSProperties.height+InfoLister.NodeProperties.height+60)
	)
	
	on pck picked obj do(
			Curselection=obj
			UpdateInfo()
			select obj
		
			InfoLister.NodeProperties.pos=(MSProperties.pos+[0,(MSProperties.height+15)])
	)
)



InfoRO = newRolloutFloater "Informator" 480 190
addRollout Stats InfoRO
addRollout InfoLister InfoRO


fn UpdateInfo = (
	if Curselection != undefined and CurSelection != "" do(
		
		if (SuperClassOf CurSelection) == GeometryClass then(
			--TriCount
			Stats.TriCount.text=(GetNumfaces CurSelection.mesh)as string
			--VertCount
			Stats.VertCount.text=(GetNumVerts CurSelection.mesh)as string
		)else(
			--TriCount
			Stats.TriCount.text=0 as string
			--VertCount
			Stats.VertCount.text=0 as string
		)
		--ClassOf
		Stats.Class1.text=(classof CurSelection)as string
		--SuperClassOf
		Stats.SuperClass1.text=(superclassof CurSelection)as string
		

		--MaxScript Properties
		local MSProps="" as stringstream
			InfoLister.MSProperties.height=18
		for i in (getPropNames CurSelection) do (
			i=("#" + (i as string))
			local MSProps2=replace (i as string) 1 1 "$." 
	
			format "%
" MSProps2 to:MSProps
			InfoLister.MSProperties.height=InfoLister.MSProperties.height+12
		)
		InfoLister.MSProperties.text= MSProps	


		--Node Properties
		local MSProps="" as stringstream
			InfoLister.NodeProperties.height=18
		for i in (getPropNames (classof(superclassof CurSelection))) do (
			i=("#" + (i as string))
			local MSProps2=replace (i as string) 1 1 "$." 
	
			format "%
" MSProps2 to:MSProps
			InfoLister.NodeProperties.height=InfoLister.NodeProperties.height+12
		)
		InfoLister.NodeProperties.text= MSProps	


		--modifiers Properties
		local MSProps="" as stringstream
			InfoLister.ModProperties.height=18
		for i in (CurSelection.modifiers) do (
			for L in (getPropNames i) do(
				L=("#" + (L as string))
				local MSProps2=replace (L as string) 1 1 ("$.modifiers[#"+i.name+"]." )
	
				format "%
" MSProps2 to:MSProps
				InfoLister.ModProperties.height=InfoLister.ModProperties.height+12
			)
		)
		InfoLister.ModProperties.text= MSProps

	
	)
	try(InfoLister.height=(InfoLister.MSProperties.height+InfoLister.NodeProperties.height+60)	)catch()
)

Page 2 / 2