Broadcast Time Changed


Do you know how (or do you have an idea) to broadcast ‘time changed’ without actually changing the time? (sdk, mxs, any way…)


What about starting and cancelling animation?

fn NotifyTimeChange =
	local _realTimePlayback = realTimePlayback
	realTimePlayback = true
	fn time_callback = (format "currentTime: %\n" currentTime;stopAnimation())
	registerTimeCallback time_callback
	playAnimation immediateReturn:false		
	unregisterTimeCallback time_callback
	realTimePlayback = _realTimePlayback



I assume the obvious doesn’t do what you need. :thinking:



this one doesn’t call “time changed”…

NotifyTimeChange() above doesn’t work either.


What is “time changed” ?

delete objects

s = geosphere radius:100 wirecolor:green
for k=1 to 10 do
	p = point size:20 wirecolor:orange
	c = p.controller = transform_script()
	c.addnode #mesh s
	c.addconstant #id k
	c.setexpression "transmatrix (getvert mesh.mesh id * mesh.objecttransform)" 

tp = Taper()
addmodifier s tp
animate on at time 100 tp.amount = -1

you can see when you change Taper amount manually the transform scripts doesn’t update, because the only TimeChanged event is held for this type of controls


I would have had a really hard time figuring out that this was what you were after.


another simple way to test is to register time change callback and found a method to fire it without changing time

fn time_callback = (format "time changed\n")
registerTimeCallback time_callback
-- unregisterTimeCallback time_callback


There seems to be some things that do fire the Time Callback but don’t update the controllers and other that do update the controllers but don’t fire the Time Callback, which is a bit weird.

For instance slidertime= slidertime fires the Time Callback but don’t update the controller time, $.pos=$.pos (among others) updates the controller but don’t fire the Time Callback.

One thing that do both is to set the Frame Rate from the Time Configuration dialog, so perhaps there is a notification that could be called.

Open the Time Configuration dialog and in the Frame Rate section click on the selected radio button, which won’t change the frame rate but will fire both, the Time Callback and the controller Time event.

Unfortunately, setting the frame rate from the SDK doesn’t work the same way, but perhaps it is a good place to look for.


this fires it (well it triggers your callback up there ^^^^)…

def_visible_primitive(invoke_time_change, "invoke_time_change");

Value* invoke_time_change_cf(Value** arg_list, int count)
	enum args {  knum_args };

	check_arg_count(invoke_time_change, knum_args, count);
	return &ok;


This one doesn’t trigger time change callback, but somehow updates helpers positions.

g = (dotNetClass "Autodesk.Max.GlobalInterface").Instance
g.coreinterface14.scene.FlagFGAnimated (int currenttime)


This is what I did at the beginning, but unfortunately (and unexpectedly) it doesn’t work for most constraint and scripts controllers that I want to update in one go.


It works in my case! Thank. I will investigate this solution more closely and will report …


isn’t that just enumerating the scene with


and sending something like…



unfortunately not … most scripts and constraints are ‘protected’ from the dependency loop and use RefTargMonitors … so they quite often ignore simple notifications (REFMSG_CHANGE).


I don’t know any constraint that uses RefTargMonitor


If you need to update the scripted controllers instead of calling the time callback, wouldn’t this work?

mapped fn UpdateControllers ctrl = ctrl.update()
UpdateControllers (getclassinstances transform_script)


this was my next option … but getclassinstances for large and complex scenes can be slow (and it it slow) and it takes a significant amount of time to find all controls and update them. Which makes a problem to update on spinner dragging for example.


it might be INodeMonitor or INodeTransformMonitor… if geometry used it can be RefTargMonitor. Which is better parctice to use than direct reference or node.


This update issue is inherent in any script controller class. So another problem is finding all instances of all script controller classes.