[Closed] get amount of NoteTracks in scene maxscript?
Is there a quick way to count the number of notetracks in a scene via maxscript or c++?
Si
c++ only…
using Animatable::EnumerateAllAnimatables find anims which HasNoteTracks, and collect all their note tracks with checking for uniqueness
ha-ha-ha… here is a solution for mxs:
undo off, redraw off
(
c = linear_float()
end = gethandlebyanim c
tracks = #()
for h=1 to end where (anim = getanimbyhandle h) != undefined and hasNoteTracks anim do
(
for k=1 to (numNoteTracks anim) do appendifunique tracks (getNoteTrack anim k)
)
free c
tracks
)
we need to create any animatable (i create a controller) to know the last anim handler index
edited…
there is an easier way:
undo off, redraw off
(
c = linear_float()
end = gethandlebyanim c
tracks = for h=1 to end where iskindof (anim = getanimbyhandle h) DefNoteTrack collect anim
free c
tracks
)
Both functions kill my max scene.
However this one
[b](getproperty trackviewnodes.Anim_Layer_Control_Manager.controller #animlayers).count
[/b]
is giving me 1933 as a result.
Now some questions arise:
#1 Is this function enough to find the amount of NoteTracks or it is missing something?
#2 In order to clear the NoteTracks, which function is better?
(getproperty trackviewnodes.Anim_Layer_Control_Manager.controller#animlayers).count=0;gc()
or
t=trackviewnodes;n=t[#Max_MotionClip_Manager];deleteTrackViewController t n.controller;gc()
or
trackViewNodes[#Max_MotionClip_Manager].track = copy trackViewNodes[#Max_MotionClip_Manager].track;gc()
Looks like C++ is the way to go.
I have a scene with…
theMixer.numMaxMixers() = 140,444
and
AnimLayerManager.getLayerCount() = 1720
and if you run the maxscipt versions it crashes 3dsmax this a bad bloated file. If I delete the above items the maxscript works fine. I think the contents of the Trackview are just too large for maxscript.
In the end I’m just using the C++. As a side note when I delete the above items in a file with only a camera went from 334,344kb to 266kb
Thanks for your help again Dennis
Si