Notifications
Clear all

[Closed] on mouse click function? or on selection?

try this:


  global theObject, clickno
  global pickedFaces = #()
  
  theObject = selection[1]
  clickno = 0
  
  fn pickFaces msg ir obj faceNum shift ctrl alt =
  (
  	if clickno >= 2 do return true	
  	if faceNum != undefined do
 		setFaceSelection theObject ( meshop.getPolysUsingFace theObject #{faceNum} as array )
  		
  	case msg of (
  		#freemove : #continue
  		#mouseAbort : return false
  		#mousePoint :	(
 		 		 	format "clickno: %
" clickNo
 		 		 	if faceNum != pickedFaces[1] do
 		 		 	(
 		 		 		clickno += 1
 		 		 		append pickedFaces (meshop.getPolysUsingFace theObject #{faceNum} as array)
 		 		 	)
 		 		 	#continue
 						)
  		#mouseMove : #continue 
  	)
  )
  
  if theObject != undefined and classOf theObject == Editable_Mesh then (
  	
  	max modify mode
  	subobjectlevel = 4
  	mousetrack on:theObject prompt:"Pick 2 faces
" trackCallBack:pickFaces
  	
  	format "polys picked: %
" pickedFaces
  )
  else messageBox "Please select an Editable Mesh object first" title:"Pick Object"
  

That will return an array which will contain 2 more arrays holding the faces that make up the first 2 mesh ‘polygons’ that were clicked. It will not work on editable poly objects due to limitations in mouse track, but you can use the face arrays to convert the selections afterwards. Hope that helps!

Check out Calros; post in this thread: http://forums.cgsociety.org/showthread.php?t=287132

“one way to craete your own call backs is to use a timer in a rollout. the rollout could be outside of the monitors ress so it’s not visible to the user.
the timer allows you to run script commands every time the timer ticks the intervals between ticks can pe specified in milli seconds. it can also be enbled and disabled. or yo can just distroy the rollout.

to many of this can get slow, but i’ve mannage to make some preaty nice call backs with it.
cheers
Los.”

May be just what you’re looking for.

cool thanks guys

cool thanks guys

Page 2 / 2