Notifications
Clear all

[Closed] Callback post post load

Hey guys,

So i’m trying to find out when the scene is completely done loading, and the viewport camera is now movable. This is relevant on our very large files. PostLoad, and PostLoadProcess seams to get me to where the file is loaded into memory, but its before everything is bound to the video card. So even though I’ve been notified that I’m done loading, on our larger files, there’s still sometimes a 5-20 second wait period until the scene binds, draws, and allows controller input.

I’ve tried using the viewport draw callback, which works on the larger files…2nds refresh seems to be the winning number for…reasons *shrug. But on smaller files that hack doesn’t work…and as its a hack, i’d want something a little more reliable.

Is there another callback I could be accessing that would give me more accurate results?

6 Replies

try something like:


callbacks.removescripts id:#load_monitor
global FileLoadMonitor = off
callbacks.addscript #filePostOpen "FileLoadMonitor = on; print #filePostOpen" id:#load_monitor
callbacks.addscript #viewportChange "if FileLoadMonitor do print #viewportChange; FileLoadMonitor = off" id:#load_monitor

add ALL general callbacks, check what one goes last and at right moment…

using an old concept of yours from another post Denis

	fn CallBackTest event: = 
	(
		n = callbacks.notificationParam()
		format "notification:%\n" event 
		ok
	),

notification:#actionItemExecutionStarted
notification:#filePreOpenProcess
notification:#activeViewportChanged
notification:#activeViewportChanged
notification:#animationRangeChange
notification:#animationRangeChange
notification:#activeViewportChanged
notification:#objectXrefPreMerge
notification:#sceneNodeAdded
notification:#mainWindowEnabled
notification:#mainWindowEnabled
notification:#mainWindowEnabled
notification:#mainWindowEnabled
notification:#filePostOpenProcess
notification:#actionItemExecutionEnded

looks like actionItemExecutionEnded is my winner.

It should be noted, that if a user does a ‘Restart’ then you need #actionItemExecutionStarted as end won’t trigger. Also you want to run this after the welcomeScreenDone callback fires.

I don’t see #filePostOpen and #viewportChange callbacks in your list…

notification:#mainWindowEnabled
#filePostOpen
notification:#filePostOpenProcess
#viewportChange
notification:#actionItemExecutionEnded

Sorry, i gave trimmed down list… Here’s the end result with those active.

This also makes sense why sometimes the 2nd viewportchange notification worked for me… the first flag is before the action item fires.

I just wanted to add something here. There is an undocumented callback called

#filePostOpenProcessFinalized

this fires after filePostOpen, but still well before the viewport is active… So actionItemExecution is still the winner. Just figured i’d put this here incase someone else is down this rabbit hole later on, or needs a callback after filepostopen