Working autosave, but need help to finalize it
All  1-14  15-19

Previous
Next
 From:  Michael Gibson
11150.15 In reply to 11150.14 
Hi Moi3dFan, I guess during a UI reload (when changing the theme) you can get in the situation that SidePane.htm has not finished loading yet while the Shutdown function is running.

So to guard against an error there try changing the last like of function Shutdown() to this:

code:
if ( moi.ui.sidePane && moi.ui.sidePane.SetAutosaveTimer )
    moi.ui.sidePane.SetAutosaveTimer();


- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Moi3dFan
11150.16 In reply to 11150.15 
The error no longer occurs. But there is a new one.

The setting only works once. The video shows that at first it was 0, then I changed it to 0.1 minute, everything worked as it should. But when I returned 0 minutes, autosave didn't turn off.

EDITED: 14 Nov 2023 by MOI3DFAN

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
11150.17 In reply to 11150.16 
Hii Moi3dFan, I think maybe you're getting multiple timers going.

Probably the very first thing that should be done inside function SetAutosaveTimer() is to clear any previous timer, by doing:

code:
if ( AutosaveTimer )
{
    clearInterval( AutosaveTimer );
    AutosaveTimer = false;
}


If Autosave is 0 then it's probably better to exit out right after that, currently it sets up a timer and then will clear it out at the end.

So maybe more like this:

code:
				function SetAutosaveTimer()
				{
					// Clear any existing timer.
					if ( AutosaveTimer )
					{
						clearInterval( AutosaveTimer );
						AutosaveTimer = false;
					}

					Autosave = moi.command.getOption( 'Autosave', true); // return autosave time (ms) from ini (180000 = 3 min)
					AutosaveIncremental = moi.command.getOption( 'AutosaveIncremental', true); //return AS mode (false)

					// If Autosave is turned off, exit without setting any timer up.
					if ( Autosave == 0 )
						return;

					AutosaveTimer = setInterval(function() {
						if (AutosaveIncremental) { 
							moi.command.execCommand('IncrementalSave');
						} else { 
							moi.command.execCommand('Save');
						}
					}, Autosave);
				}
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Moi3dFan
11150.18 In reply to 11150.17 
It's working! Thanks, how likely is it that autosave will appear in the native version of moi3d v5 beta?
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  Michael Gibson
11150.19 In reply to 11150.18 
Hi Moi3dFan,

re:
> It's working! Thanks, how likely is it that autosave will appear in the native version of moi3d v5 beta?

Not too likely, there are a lot of details to work out for a real version of it.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
 
Show messages: All  1-14  15-19