Notifications
Clear all

[Closed] 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…)

21 Replies

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
)

NotifyTimeChange()

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

slidertime=slidertime

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

1 Reply
(@polytools3d)
Joined: 11 months ago

Posts: 0

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);
	
	GetCOREInterface()->SetTime(GetCOREInterface()->GetTime());
	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)
redrawViews()
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

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

Page 1 / 2