Need help translating a little maxscript to c++


#7

3dsmax 2012 x64.
I get this error:

-- Error occurred in deleteAllNoteTracks(); filename: C:\Development\maxscripts\scripts\; position: 91; line: 3
--  Frame:
--   DefNoteTrack: undefined
-- Type error: getClassInstances requires MAXClass, got: undefined


#8

there are many stupid bugs in max… there is one of them.
you have to force registering the DefNoteTrack class…
the way of doing it from mxs is:


 (notetrack "").classid
 

after calling this magic spell you will get the DefNoteTrack class

so the delete all tracks function has to be:


fn deleteAllNoteTracks = 
(
	if DefNoteTrack == undefined do (notetrack "").classid
	for nt in (getClassInstances DefNoteTrack asTrackViewPick:on) do
	(
		while (numNoteTracks nt.client) > 0 do deleteNoteTrack nt.client (getNoteTrack nt.client 1)
	)
)


#9

that did make it run, but on my comp it still takes so long that I cancelled (it maxed my ram), I do not have too much ram on my computer at home…

I’ve uploaded the file here:

http://stigatle.net/uploads/filewithbug.zip

Ignore the missing maps etc, there’s just a cube in there, nothing else.
If you expand the trackview, and look at the tracks there you will find the thousands of note tracks.

Please give the script a try on the scene, I’d like to know how it works on your end.


#10

i don’t see any note track here. can you save file for max 2010… i don’t have debugger for 2012


#11

You can grab the file here:
[u]http://stigatle.net/uploads/filewithbug2010.zip[/u]

added a screenshot of trackview so that you see where the note tracks are located.

thanks again! :slight_smile:


#12

in your sample file only Max_MotionClip_Manager has 8,305,440 note tracks! How did you do it?


#13

we have no clue as to what is causing it (and never got a answer from autodesk support as to why it happens), it also seems to multiply on each save.
And it follows the scene when we merge and so on, kinda acts like a virus in our scenes.

It also brings down the renderfarm due to the RAM it occupies etc, causing major havoc.


#14

i will try to fix it because it’s very interesting for me. i haven’t seen it before.
but if you find what causes the problem please let me know.

the number of note tracks is a problem but not the issue. the problem is that all these tracks have very weird referencing…


#15

would be awesome if you could help on the solution.
As I stated it’s very important to us to find a way to fix it.

We’ve had this problem before, but the script could handle it at the time, but now it’s grown to such a massive amount of notes that it has major problems with fixing it.

I got some help earlier today from a colleague of mine with implementing it as c++,
we almost had it when I had to leave work today, but we’ll continue on it tomorrow morning to see if we can make it run.

I will obviously post any information regarding this here, because it might help someone else later.


#16

I think is an old bug related to biped

In my case I have biped removed, and the notes seems trapped inside a missing track

deleteTrackViewController to remove the whole track, should work,
if nothing relevant… in that motion mixer track


#17

yes… i’m looking in this direction. i just want to keep as much data as possible


#18

well…


  trackViewNodes[#Max_MotionClip_Manager].track = copy trackViewNodes[#Max_MotionClip_Manager].track
-- and of course
gc()

 does do the trick.

there is no any other note tracks in the scene.

#19

but i still don’t understand the mechanics of notes number growing.
does it happen on save, or merge, or load a new file?


#20

It’s not very very clear, but Autodesk was aware of these bugs:
http://forums.cgarchitect.com/35748-max-file-grew-too-big-pls-help-2.html#post317594

they had other solution,[don’t know if it would work in this case though]:

for i = 1 to theMixer.numMaxMixers() do
(
theMixer.removeMaxMixer 1 false 1

)


#21

thanks denist ,this solves our problem!
and it took a fraction of a second to “clean” the scene!

If I ever meet you I’ll buy a beer.


#22

and your favorite Norwegian food for beer. :wink: What is it? Some sort of dry and salt fish?


#23

I’ll change the topic to reflect the replies, and tag this as solved.

Thank you all for helping with this!


#24

thank you very much mate ! you saved my life :slight_smile:


#25

Thanks very much ! This script saved me from dispair.


#26

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.