Error on first time running script, fine after rerunning.

Error on first time running script, fine after rerunning.

chad_voller
Participant Participant
995 Views
6 Replies
Message 1 of 7

Error on first time running script, fine after rerunning.

chad_voller
Participant
Participant

SOLVED on my end.

As the title says, when I run my maxscript for the first time after a max restart, I get an error message. If I rerun the script, it works fine from then on out. The problem is when it errors out the first time, it made it part way through the processing of the object, so it messes up the material IDs on it. The script is supposed to take a selection's multi/sub-object material and combine it with another, and then assign that combined multi/sub-object material to the objects selected, and all of their instances found in the scene.

0 Likes
Accepted solutions (1)
996 Views
6 Replies
Replies (6)
Message 2 of 7

denisT.MaxDoctor
Advisor
Advisor

 

As I see it, the addNewSubMats function is passed the oldMat parameter, which may be undefined at the beginning. But you are trying to get its name, expecting it to be some valid material. You should check this case...

But of course, it could also be something else. So along with the problem always provide all popup messages and the maxscript listener output.

0 Likes
Message 3 of 7

chad_voller
Participant
Participant
Accepted solution

I moved the lines having to do with addInstancesToSel, to be located after it returns from the other functions, instead of being inside of one of those functions, and that seems to have fixed the issue.

0 Likes
Message 4 of 7

denisT.MaxDoctor
Advisor
Advisor

@chad_voller wrote:

I moved the lines having to do with addInstancesToSel, to be located after it returns from the other functions, instead of being inside of one of those functions, and that seems to have fixed the issue.


That was most likely the issue, but what I noticed above should also be fixed.

0 Likes
Message 5 of 7

chad_voller
Participant
Participant

I'll look into it, I appreciate the advice!

0 Likes
Message 6 of 7

hagen.deloss
Alumni
Alumni

Hi @chad_voller @Anonymous ,

 

Do you think one of these outcomes could be marked as a solution here, or was the issue inconclusive? 

 



Hagen Deloss
Community Manager | Media & Entertainment
Installation & Licensing forums | Contact product support | Autodesk AREA


 

0 Likes
Message 7 of 7

chad_voller
Participant
Participant

I fixed it on my end, I should have tried what I did before posting.

0 Likes