PDA

View Full Version : Maxscript nonlinear evaluation problem!


stuh505
04-08-2006, 01:53 AM
I have spent several hours very confused over this bug. I have finally realized that it is NOT a bug in my code, but a bug in the Max API functions....this particular bug is resulting in NON-LINEAR evaluation of commands!!

I find this pretty shocking...

Given this particular function, it will sometimes evaluate properly but many times it won't. If the commands are called individually one at a time from the listener they work fine, but when called in a program they do not work. It is not an issue with having the proper object selected or anything like that.

Under the exact same circumstances it can be evaluated multiple times being called from the listener with different results. If you evaluate it on an object and it does not work, evaluate again and it usually does work the second time. Some objects work the first time.

If I put a "convert to poly" command after it, it frequently is converted BEFORE some of the other lines have executed (or finished executing).

I have tried to force it into working by placing sleep commands but they also seem to interrupt the computations non-linearly...if anyone can find a solution to make this work I would be much obliged

"flattenMapNoParams()" is what causes the problem



fn test obj=
(
uvmod = unwrap_uvw()
addModifier obj uvmod
obj.unwrap_uvw.flattenMapNoParams()
obj.unwrap_uvw.pack 0 0.02 true false false
convertToPoly obj
)

ajohnson
04-08-2006, 09:20 PM
I found that the "flattenMapNoParams" function doesn't appear to work unless the target object is selected. Is there any possibility that the difference you're seeing is due to the object(s) being selected or not being selected? If that's the case, you could always throw a "select obj" at the start of the function.

Good luck.

stuh505
04-09-2006, 02:24 AM
I found that the "flattenMapNoParams" function doesn't appear to work unless the target object is selected. Is there any possibility that the difference you're seeing is due to the object(s) being selected or not being selected? If that's the case, you could always throw a "select obj" at the start of the function.

Good luck.


This is an issue with some of the other uvw_unwrap commands but it is not the issue that I am having. Like I said it works fine whether or not it is selected...but if it is executed quickly AFTER another line or quickly BEFORE a line, that other line will somehow interfere with it's evaluation and cause it to fail.

ajohnson
04-09-2006, 03:04 AM
Gotcha -- I should have read a bit more carefully. That said, I'm having a hard time replicating a problem other than the selection issue that I mentioned, which does indeed crop up for me. You mentioned that you get different results... specifically, what types of different results are you getting (script error, unexpected uvw result, etc)?

kees
04-09-2006, 03:52 PM
Maybe its because when running a script, certain things are automatically disabled (like viewport redrawing).

For the heck of it, try putting a 'forceCompleteRedraw()' in front (or after) of the line that doesn't work and see if that helps.

-Kees

stuh505
04-09-2006, 04:40 PM
Yes that was it!!


Thanks Kees!

CGTalk Moderation
04-09-2006, 04:40 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.