Notifications
Clear all

[Closed] adjust simple function

I have to remove all notetrack and retimers from selection, I have function which find and replace specific controller for another and it work just fine for all controllers with two small exceptions: retimers and notetracks:) Irony. I have no idea why it won’t work. Can anybody take a look in it? It would be fantastic, because I stuck whit this and I’m so close to finish this.

code is:

fn controllerObj trackClass: mode: =
(
local arr = #()
case mode of
(
#selection:
(
if selection.count != 0 do
(
for s in selection where (getClassInstances trackClass target:s).count != 0 do append arr s
)
)
#objects:
(
if (ctrls = getClassInstances trackClass).count != 0 do
(
local temp = #()
for c in ctrls do
(
for n in (refs.dependentNodes c) do appendIfUnique temp n.name
)
if temp.count != 0 do for s in temp do append arr (getNodeByName s)
)
)
) ; arr
)

fn replaceController nodes whichCtrl: withCtrl: = if nodes.count != 0 do
(
for o in nodes where (ctrls = getClassInstances whichCtrl target:o).count != 0 do
(
for c in ctrls do
(
execute ((exprForMAXObject c)+” = createInstance “+ withCtrl as string)
)
)
)

arr = controllerObj trackClass:retimer mode:#selection

replaceController arr whichCtrl:retimer withCtrl:linear_float

9 Replies

Nice functions. Who is the author ?
At first U reguested to works with a controller, then multiple controllers.
I’m currently busy maybe someone can help you with “the third” request.
BTW on this forum U need to put your code inside “CODE” tags or paste code then select it and
press “#” sign on above menu strip

so is it some way to check if there are notetracks on scene, best – in selection?

quite the opposite… because it can’t work with notetracks you are pretty far.
if you know that all notetracks belong to nodes only, it’s easier to search in all objects. if notetracks might be anywhere it’s much more complicated.

so is it some function, is it possible to do it quick:
find notetracks if is anywhere?

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

no. it’s not possible with a function above.

and can I replace somehow retimers to?

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

what is retimer?

Retimers:
http://docs.autodesk.com/3DSMAX/15/ENU/MAXScript-Help/index.html?url=files/GUID-CE344EBA-D3A9-4DC2-8196-BD933941FD0B.htm,topicNumber=d30e540428

ok, so regarding to notetrack I noticed some interesting issue. I can create notetrack for any controller in max2013 but when I save scene and open scene again all notetracks no longer exist, why? Its very strange.

I tried with this one but won’t work:

mcMan = TrackViewNodes[5]
while (numNoteTRacks mcMan > 0) do messagebox “Notetracks”