[Closed] MouseTrack Exception in Max 2010..?
Hello,
I am getting a Dotnet Event Handler Exception in Max 2010 using Mousetrack in 1 function, but not another, when they are being used the same way. This method works just fine in Max 2012 however… It only erorrs when I try to RightClick to end the tool.
Can I not put the mousetrack inside another function? Or would this mousetrack somehow mess with my other mouse track, which is not running?
I can put my objPlacer_BoundsPlacer() in a Try/Catch, which doesnt give the error then, but
my track tool doesn’t cancel then.
fn objPlacer_BoundsPlacer sonObject cloneType alignNormal =
(
painter_CloneType = cloneType
painter_sonObject = sonObject
painter_alignNormal = alignNormal
fn painter_MouseTrack msg ir obj faceNum shift ctrl alt =
(
code.......
)
mouseTrack on:geometry trackCallback:painter_MouseTrack
)
Well I have a solution for now, but I’d still like to know if theres a better way/reason.
I just put a Try/Catch around the MouseTrack, then in my Abort/RightClick Msg block
I added a max move after the #abort.
I don’t get the error anymore and it ends the tool properly… :curious:
the piece of code that you showed doesn’t tell anything about a reason of crash. The problem is in area <…>
using of try/catch is only temporary solution for an one-time-used script. it’s not a solution for the tool.
Well I won’t post all of my code since its long and the bulk of it shouldn’t mess with it.
But I have my msg’s setup as follows
fn painter_MouseTrack msg ir obj faceNum shift ctrl alt =
(
local mousePos
local theNormal
case msg of
(
#mouseAbort: ()
--Mouse Moving/Placing Object on Surface
#freeMove:
(
)
ect...
)
if msg == #mouseAbort then
(
print "aborted"
#abort
)
else #continue
)
the mousetrack function that you showed can’t crash. because there is nothing (or not shown) that might it cause.
but there is some shady argument that you use in mousetrack call. you are using on:geometry extra argument.
the ‘on’ argument has to specify the node for IntersectRay function. IntersectRay is not mapped. If you don’t have a variable geometry or it’s not a node it has to be ignored… but who knows.
you have Dotnet Event Handler Exception error… without dotnet objects or controls this message doesn’t make sense. How does you mousetrack function interact with dotnet?
I am calling this script from a C# UI. However, I’m doing all of this the same way with another script thats almost the exact same, but it works just fine. That’s why its so odd…
Edit: Although, the other script is using a specific object at first, and not Geometry. Although, I AM passing it Geometry or a single object, but from another variable… so I could try that instead and see.
Naw, that didn’t work, sending a different variable over… :shrug:
I hate doing Try()Catch(), but it works for now. If you really want to know though, I can PM you (Denis) and you can checkout the file and see if you find anything.
Are you trying to do somethig like this – see the attached picture?
Is this variable is global?
Eh… sorta, but its more complex.
I am having to use MouseTrack + another function that gets call when you move the mouse, and that function modifies geometry/does vert/edge/face calculations to use for snapping and such.
Im also doing another intersect check inside that other function. So theres multiple intersection checks happening all the time, but I have to, because of limitations with EditableMesh using most all Intersect methods.
Also because I have to have overlapping geo when running mouseTrack(),