Notifications
Clear all

[Closed] adding mouse functionality to my script in 3ds Max 2014

Hi there all, I am looking for a way to add mouse functionality to my script where a lineShape would follow the mouse. This line shape will react as a slicer to slice either an Editable_Mesh or Editable_Poly. Each time the user clicks on an area of the mesh, the script would use the location of the lineShape object and slice the mesh. Now, I would prefer Editable_Poly, but if I need to use tools such as the mouseTrack, where it only supports an Editable_Mesh, then so be it. Otherwise, I have tried using the MouseTools, but I do not like the fact that you loose the freeMove event after the first click. I need this event to continue so that I can continue moving the lineShape after each click. I then tried the mouseTrack tool, which has almost everything I need, especaily for the fact that it tells me what face was hit, but this tool only happens once. Meaning, once the mouse has collided with the given object, it stops tracking the mouse. Are there any tricks that someone has up there sleeve, where I can have both functionalities, or is it that I can’t have my piece of the cake and eat it to?

3 Replies

use the paint interface. it provides you everything you need.

??? Please excuse my illiterate knowledge with maxscript, but in the documentation, I do not see all of the mouse event handlers that I need. I see that it has mouseUp, but I need something that uses a callback for when the mouse is freely moved (no mouse clicks), mouse left drag, and a mouse left click (preferably after the left mouse button was released), such as mouseUp. To clear things up, using pseudo-code…


on mouseUp do
  get sliceShape location
  from sliceShape's location slice the mesh using polyop.slice
  update lastMousePosition to the current mouse position

on mouseMove do
  get mousePosition
  set mouseOffset by substracting the lastMousePosition from mousePosition
  in coordsys local move sliceShape [mouseOffset.x, mouseOffset.y, 0]

on mouseDown do
  if multi-slice is true then
	set the sliceLoop distance used for multi-slice mode

otherwise, if I misunderstood the paint interface, could you give me an example I use that interface with my above example?

thanks Bob

follow the mxs help: PainterInterface
How To … Develop a Bitmap Painting Tool – 3D Painting

it’s nice and clear example how to get and use mouse events of the paint interface