Point Helper with Axis Tripod with Different Coloured Axes

When you create a point helper with axis tripod, the x,y,z axis are all the same colour as thecreated object.
I think Autodesk dropped the ball by not colour coding the three axis (x,y,z)

Is there a way to script a new version that that has red,green,blue on the point helper?

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Sen's picture

Thank , but ...

Not the same for me in 3dsmax 2011 : 

 

Now the box is solid , and I don't see the dot . Box is very little . Here the 2 helpers are same size .

It's not my code, it's Bobo code Wink . I just change shape coordinate and UI here for match request ... 

barigazy's picture

I write this in max2013 and

I write this in max2013 and works fine, look as your manipulator.
If you want to fix this in max2011 then create the box-shape like XYZ axis.
See my code as example: store your Point3 values in array, then use my "makeManipulator" function.

barigazy

barigazy's picture

Also is better to

Also is better to use
addGizmoText text position flags unselColor selColor
Your XYZ letters are nor oriented correctly.

barigazy

Sen's picture

 XYZ letters are oriented

Smile XYZ letters are oriented like as I wish it . With the code you can change this easily .

Sorry , english is not my native language but I am not the requester . I just put some lines of code and supplement Bobo's code .

I have the feeling that you take to me for the requester ? You suggest me many things , read this topic , make this change , optimize this line ...

I don't want to fix or change anything , I just try to help Mark .

Yes every code can be optimize or change , there are many ways for scripting . After Mark make all change he wish , optimize .....

And for me make a function is great but not necessary here . For comprehension on how to construct gizmo shape is better line to line than array .

Simpler is the code , better is comprehension for start , no ? 

I am not a pro scripter , I am new to maxscript (only few months ) and always learn .

Thank 

barigazy's picture

---

Ok never mind, if you say so. Discussion stop here.

barigazy

barigazy's picture

shorter version

I optimized your version a bit :)

plugin simpleManipulator NewPointManipulator
name:"NewPoint"
classID:#(0x1d07159b, 0x5a572228)
category:"Manipulators"
(
	fn makeManipulator size newPoints: =
	(
		local gizShape = manip.makeGizmoShape()
		for i = 1 to newPoints.count do
		(
			if newPoints[i] == "newShape" then gizShape.startNewLine()
			else gizShape.AddPoint (newPoints[i]*size)
		)
		gizShape
	)
	local X_PointsArr = #([0,0,0], [6,0,0], [5,-0.5,0], [6,0,0], [5,0.5,0], "newShape", [6.2,0,0], [6.5,0,0.3], "newShape", [6.2,0,0.3], [6.5,0,0])
	local Y_PointsArr = #([0,0,0], [0,6,0], [-.5,5,0], [0,6,0], [.5,5,0], "newShape", [0,6.2,0], [0,6.2,.15], "newShape", [0,6.2,.15], [0,6.05,.3], "newShape", [0,6.2,.15], [0,6.35,.3])
	local Z_PointsArr = #([0,0,0], [0,0,6], [-.5,0,5], [0,0,6], [.5,0,5], "newShape", [0,-0.15,6.5], [0,0.15,6.5], [0,-0.15,6.2],[0,-0.15,6.2],[0,0.15,6.2])
 
	parameters main rollout:paramRollout
	( 
		size type:#float   animatable:false  ui:spn_size default: 1
		showXaxis type:#boolean animatable:false ui:CHK_showXaxis  default:true
		showYaxis type:#boolean animatable:false ui:CHK_showYaxis default:true
		showZaxis type:#boolean animatable:false ui:CHK_showZaxis default:true
		showBox type:#boolean animatable:false ui:CHK_showBox default:true
		xColor type:#color animatable:false default:red 
		yColor type:#color animatable:false default:green
		zColor type:#color animatable:false  default:blue
		labelColor type:#color animatable:false default:yellow
	)
	rollout paramRollout "Parameters"
	(
		spinner  spn_size "Size :"  range:[0.01, 10000.0, 1.0] align:#center
		label LB2blank 
		checkbox CHK_showXaxis " X axis " checked:true
		checkbox CHK_showYaxis " Y axis" checked:true
		checkbox CHK_showZaxis  " Z axis"checked:true
		label LB1blank  
		checkbox CHK_showBox " Box" checked:true  
	)
	on canManipulate target return false
	tool create
	(
		on mousePoint click do
		(
			case click of
			(
				1: 
				(
					theTM = matrix3 1
					theTM.row4 = gridPoint
					nodeTM = theTM
				)
				2: #stop
			)
		)
		on mouseMove click do (if click == 2 do size = size = length gridDist)
	)
	on updateGizmos do
	(
		local redColor =xColor/255.0
		local greenColor =  yColor/255.0
		local blueColor = zColor/255.0
		local yellowColor = labelColor/255.0
		local flags = 0, giz
		this.clearGizmos()
		this.addGizmoMarker #dot [0,0,0] flags yellowColor greenColor
		if showXaxis do
		(
			giz = makeManipulator size newPoints:X_PointsArr
			this.addGizmoShape giz flags redColor redColor
		)
		If showYaxis do
		(  
			giz = makeManipulator size newPoints:Y_PointsArr
			this.addGizmoShape giz flags greenColor greenColor
		)  
		if showZaxis do
		(
			giz = makeManipulator size newPoints:Z_PointsArr
			this.addGizmoShape giz flags blueColor blueColor
		)  
		if showBox do
		(
			giz = manip.makeBox [0,0,0] size size size 1	1	1
			this.addGizmoMesh giz flags greenColor greenColor
		)
		return "NewPoint"
	)
)

Also I suggest you to read this MXS HELP TOPIC if you not already.
http://docs.autodesk.com/3DSMAX/15/ENU/MAXScript-Help/index.html?url=fil...

barigazy

Sen's picture

Like This ?

Thank barigazy to point this link . And another big big thank to Bobo .
But I should thank it thousand times more still , forall than he makes and made

barigazy's picture

Very cool. More important is

Very cool. More important is that you learn how to create scripted helper (ei. manipulator). Maybe you can post the code (because this is en interesting and not common topic).

barigazy

Sen's picture

Code

Code is the same as your link . I just made minor adjustement for the request by Mark pigott .

plugin simpleManipulator NewPointManipulator
	  name:"NewPoint"
	  classID:#(0x1d07159b, 0x5a572228)
	  category:"Manipulators"
  (	
	  parameters main rollout:paramRollout
	  ( 
	    size type:#float   animatable:false  ui:spn_size default: 1
		  showXaxis type:#boolean animatable:false ui:CHK_showXaxis  default:true
		  showYaxis type:#boolean animatable:false ui:CHK_showYaxis default:true
		  showZaxis type:#boolean animatable:false ui:CHK_showZaxis default:true
		  showBox type:#boolean animatable:false ui:CHK_showBox default:true
		xColor type:#color animatable:false default:red 
		yColor type:#color animatable:false default:green
		zColor type:#color animatable:false  default:blue
 		labelColor type:#color animatable:false default:yellow
	  )
 
		rollout paramRollout "Parameters"
		(
		Spinner  spn_size "Size :"  range:[0.01, 10000.0, 1.0] align:#center
			label LB2blank 
		checkbox CHK_showXaxis " X axis " checked:true
		checkbox CHK_showYaxis " Y axis" checked:true
		checkbox CHK_showZaxis  " Z axis"checked:true
			label LB1blank  
		checkbox CHK_showBox " Box" checked:true	  
		)	  
 
	on canManipulate target return false
		  tool create
		  (
			  on mousePoint click do
				 case click of
				 (
					1: 
					(
					  theTM = matrix3 1
					  theTM.row4 = gridPoint
					  nodeTM = theTM
					)
					2: #stop
				 )
			  on mouseMove click do
			  (
				  case click of
				  (
					  2: (
						  size = length gridDist
					      )
				  )
			  )  
		  )	 
 
	  on updateGizmos do
	  (		 	
		local redColor =	xColor/255.0
		local greenColor =  yColor/255.0
		local blueColor = zColor/255.0		
		local yellowColor = labelColor/255.0	
 
		this.clearGizmos()
		local flags = 0 				  	
		this.addGizmoMarker #dot [0,0,0] flags yellowColor greenColor 
					  if showXaxis do
					  (
					  local giz = manip.makeGizmoShape() 
 
					  giz.AddPoint ([0,0,0] * size)
					  giz.AddPoint ([6,0,0] * size)		
					  giz.AddPoint ([5,-0.5,0] * size) 
					  giz.AddPoint ([6,0,0] * size)
					  giz.AddPoint ([5,0.5,0] * size)		  
					  this.addGizmoShape giz flags redColor redColor 
 
						  local giz = manip.makeGizmoShape() 
						  giz.AddPoint ([6.2,0,0] * size)
						  giz.AddPoint ([6.5,0,0.3] * size)
						  this.addGizmoShape giz flags redColor redColor
 
						  local giz = manip.makeGizmoShape() 
						  giz.AddPoint ([6.2,0,0.3] * size)
						  giz.AddPoint ([6.5,0,0] * size)
						  this.addGizmoShape giz flags redColor redColor
					  )		  
					  If showYaxis do
					  (		  
					  local giz = manip.makeGizmoShape()
					  giz.AddPoint ([0,0,0] * size)
					  giz.AddPoint ([0,6,0] * size)
					  giz.AddPoint ([-0.5,5,0] * size)
					  giz.AddPoint ([0,6,0] * size)
					  giz.AddPoint ([0.5,5,0] * size)		  
					  this.addGizmoShape giz flags greenColor greenColor 
 
						  local giz = manip.makeGizmoShape() 
						  giz.AddPoint ([0,6.2,0] * size)
						  giz.AddPoint ([0,6.2,0.15] * size)
						  this.addGizmoShape giz flags  greenColor greenColor
 
						  local giz = manip.makeGizmoShape() 
						  giz.AddPoint ([0,6.2,0.15] * size)
						  giz.AddPoint ([0,6.05,0.3] * size)
						  this.addGizmoShape giz flags greenColor greenColor
 
						  local giz = manip.makeGizmoShape() 
						  giz.AddPoint ([0,6.2,0.15] * size)
						  giz.AddPoint ([0,6.35,0.3] * size)
						  this.addGizmoShape giz flags greenColor greenColor	
					  )  						  
					if showZaxis do
					(
					  local giz = manip.makeGizmoShape() 
					  giz.AddPoint ([0,0,0] * size)
					  giz.AddPoint ([0,0,6] * size)
					  giz.AddPoint ([-0.5,0,5] * size)
					  giz.AddPoint ([0,0,6] * size)			
					  giz.AddPoint ([0.5,0,5] * size)			  
					  this.addGizmoShape giz flags blueColor blueColor 	
 
							  local giz = manip.makeGizmoShape() 
							  giz.AddPoint ([0,-0.15,6.5] * size)
							  giz.AddPoint ([0,0.15,6.5]  * size)
							  giz.AddPoint ([0,-0.15,6.2]  * size)
							  giz.AddPoint ([0,0.15,6.2]  * size)
							  this.addGizmoShape giz flags blueColor blueColor
					)			
			if showBox do
			(
			local giz = manip.makeGizmoShape() 
 
			  giz.AddPoint ([-1,-1,-1] * size) 
			  giz.AddPoint ([-1,1,-1] * size)	
			  giz.AddPoint ([1,1,-1] * size)
			  giz.AddPoint ([1,-1,-1] * size)
			  giz.AddPoint ([-1,-1,-1] * size)
 
			  giz.AddPoint ([-1,-1,1] * size) 
			  giz.AddPoint ([-1,1,1] * size)	
			  giz.AddPoint ([1,1,1] * size)
			  giz.AddPoint ([1,-1,1] * size)
			  giz.AddPoint ([-1,-1,1] * size)
 
			  giz.AddPoint ([-1,-1,-1] * size)
			  giz.AddPoint ([-1,-1,1] * size)			  
 
			  giz.AddPoint ([-1,1,1] * size)
			  giz.AddPoint ([-1,1,-1] * size)
 
			  giz.AddPoint ([1,1,-1] * size)
			  giz.AddPoint ([1,1,1] * size)
 
			  giz.AddPoint ([1,-1,1] * size)
			  giz.AddPoint ([1,-1,-1] * size)			  
		  this.addGizmoShape giz flags greenColor greenColor			
			)			
		  return "NewPoint"
	  )	 
  )
barigazy's picture

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.