본문 바로가기

Script/MaxScript

Pos2VertexColor for Foliage Animation wip

 



global selectObject = $selection
global vColor

rollout Pos2VertexColor "Pos2VertexColor" width:380 height:330
(
	button Pos2VertexColor_Btn "Pos2VertexColor" width:123  height:34
	--button PivotCheck_Btn "PivotCheck" width:123  height:34
	button UnitSetup_Btn "UnitSetup" width:123  height:34
	button VertexColor_Check_Btn "VertexColorCheck" width:123  height:34

	
	fn Pos2VertexColor =
	(
		if selectObject != undefined then
		(
			for m =1 to  selectObject.count do
			(								
				a = selectObject[m]
				setCommandPanelTaskMode #modify
				subObjectLevel =1
				
 			-- avoid minus value
				MeshPivot  = (a.pivot+50)*0.1

				for i=1 to a.verts.count do
				(
					a.EditablePoly.Setselection #Vertex #{i}
					a.setVertexColor (color MeshPivot[1] MeshPivot[2] MeshPivot[3] ) #vertexcolor
					vColor = a.getVertexColor #vertexcolor
									
				)
				print  vColor
				
				 
			)
		)
	
		if $ == undefined then
		(
			messagebox "please select Object"
		)	
	)
	
	fn get2VertexColor =
	(
		if selectObject != undefined then
		(
			a = selectObject 
			getVertColor a 1
	
			
			
			
		)
	)
			
		
	fn timeCheck = 
	(
		t=timeStamp()
		format "%ms\n" (timeStamp()-t)
	)
		

	on Pos2VertexColor_Btn pressed do 
	(
		Pos2VertexColor()
		timeCheck()
	)
	
	
	on VertexColor_Check_Btn pressed do 
	(
		get2VertexColor()
		timeCheck()
		
	)
	

)
createdialog Pos2VertexColor








 

'Script > MaxScript' 카테고리의 다른 글

FBX EXPORTER & Anim for Unity  (0) 2020.05.07
pos2zero  (0) 2019.10.11
Random_Scatter_Surface  (0) 2019.10.11
TRI,VERTEX Viewport Count  (0) 2019.10.11