|
Hi everybody,
I have created a small script using timer of max rollout clause and DotNet timer. Which I would call on #nodeCreated callback in final script.
It works fine in all the objects creation except when creating objects with .target or bone objects in which next object is automatically created by max.
Like, Target Camera, Target lights, bones etc. (But works with Biped.)
Here’s the code.
-----------max rollout timer-----------
(
rollout rol_ “”
(
timer tim “” interval:1000
on tim tick do
(
toPrint = if $ != undefined then $.name
print toPrint
if toPrint != undefined then tim.active = false
)
)
createDialog rol_ 50 0
-------close the rollout to stop the timer
)
------DotNet timer---------
/*(
global tim
local toPrint
local myFn
fn myFn =
(
toPrint = if $ != undefined then $.name
print toPrint
)
tim = dotNetObject “System.Windows.Forms.Timer”
dotnet.addEventHandler tim “tick” myFn
tim.interval = 1000
tim.start()
--tim.stop()
--copy and paste tim.stop() in listener to stop the time or restart max.
)*/
(I don’t know why attachments are not uploaded. So I have to paste code here.)
Regards,
Tushar
|
|
|
|
Please see this post for help with attachments.
If you post code, always enclose it in [ code ]...[ /code ] tags (without the spaces) - otherwise the forum display can screw with the code making it impossible to cut’n’paste.
I suspect it’s to do with the creation method (internally) - until the object is fully created it does not have a “name” property, hence the exception.
if $ != undefined then
try
toPrint = $.name
catch
(toPrint = "Unknown") print toPrint
Max 4.2 through 2012 (SP2+SAP).
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.
|
|
|