Resetting the reset.js

Smart people ~ Great Scripts
Post Reply
stan
Master Chief Petty Officer
Posts: 497
Joined: 21 May 2009, 17:20

Resetting the reset.js

Post by stan » 30 Sep 2019, 13:44

I've never liked the reset icon or used it in all these years but recently found an edited version can open your own saved ctx file after a system crash. It's a simple edit. I just added the RsFileIO.LoadSystem('<default>') line from the init.js with my ctx value in it to the reset.js..
Here it is in full so you can just create a new reset.js by copy and paste. Of course you must save a ctx with a different name than defaut.ctx when you like your setup to the main directory where the default.ctx resides.. mine is '/default - tools6.ctx'
After truspace opens after crash reset, you then need only go click on the reset icon and your custom version will be restored..

As you can see it is the first line in the script.

Code: Select all

  
   if(!RsFileIO.LoadSystem(System.GetMainDir() + '/default - tools6.ctx'))
{
    rosDir = System.GetMainDir();
    Node.Create('Common Data Package/Preferences', 'Kernel Node');
    ProjectSpace = Node.Create('Common Data Package/Project', 'Kernel Node');
    Node.Create('{9E5400F5-9C69-42bc-ABE3-BBA684E8AE6F}', 'Kernel Node');
    Node.Create('{D4696108-F702-419A-A1D9-3B3E8554FA6D}', 'Kernel Node');
    SceneObj = Node.Create('{859D237E-B8ED-484D-93E1-F80B1BE8AA21}', ProjectSpace);
	  scene = Space.CurrentScene();
    Node.Create('{33E29A20-97F4-4308-9756-E927AC15FC53}', 'Kernel Node');
    WindowsManager.CreateMainFrame();
    ScriptObject.ImportScripts(0);
    ScriptObject.UpdatePck(0);
    D3DView.CreateD3DRenderer();
    D3DView.RendererUpdateFromNode('');
    Net.NtSetCDefaultServerAddr('tpportal.caligari.com');
    Net.NtSetCDefaultServerPort(1109);
    Net.NtSetServerPortRange(1109, 1114);
    Space.NewScene();
    Library2.CreateMainLibrary(rosDir + '\\RS Main Libraries');
    RsFileIO.LoadObject( rosDir + '\\scripts\\preObjects\\Toolbars.rsobj', '/');
    RsFileIO.LoadObject( rosDir + '\\scripts\\preObjects\\Widgets.rsobj', '/');
    RsFileIO.LoadObject( rosDir + '\\scripts\\preObjects\\AvatarMgr.rsobj', '/');
    RsFileIO.LoadObject( rosDir + '\\scripts\\preObjects\\ModelingPreferences.rsobj', '/Preferences/');
    RsFileIO.LoadObject( rosDir + '\\scripts\\preObjects\\DesktopPreferences.rsobj', '/Preferences/');
    RsFileIO.LoadObject( rosDir + '\\scripts\\preObjects\\ShrinkWrapPreferences.rsobj', '/Preferences/');
    RsFileIO.LoadObject( rosDir + '\\scripts\\preObjects\\UVEditorPreferences.rsobj', '/Preferences/');
    RsFileIO.LoadObject( rosDir + '\\scripts\\preObjects\\HairPreferences.rsobj', '/Preferences/');
    RsFileIO.LoadObject( rosDir + '\\scripts\\preObjects\\Primitives.rsobj', '/Preferences/');
    RsFileIO.LoadObject( rosDir + '\\scripts\\preObjects\\Lights.rsobj', '/Preferences/');
    RsFileIO.LoadObject( rosDir + '\\scripts\\preObjects\\Cameras.rsobj', '/Preferences/');
    RsFileIO.LoadObject( rosDir + '\\scripts\\preObjects\\Snapping.rsobj', '/Preferences/');
    RsFileIO.LoadObject( rosDir + '\\scripts\\preObjects\\CePreferences.rsobj', '/Preferences/');
    RsFileIO.LoadObject( rosDir + '\\scripts\\preObjects\\ImportExport.rsobj', '/Preferences/');
    RsFileIO.LoadObject( rosDir + '\\scripts\\preObjects\\PhysMovePref.rsobj', '/Preferences/');
    RsFileIO.LoadObject( rosDir + '\\scripts\\preObjects\\Physics.rsobj', '/');
    Node.Create('{17135BC2-3A21-4E56-A757-A7564C649F0F}', 'Kernel Node');
    if ( !WindowsManager.LoadLayout('\\default_layout.rsl'))
    {
          WindowsManager.CreateWindowFromCLSID('default', 'default', 'default', scene, 1);
          WindowsManager.IncludeTS7Window();
          WindowsManager.CreateMainToolBar();
          WindowsManager.CreateNavigationToolBar();
    }

    Widgets.ActivateWidget('/Widgets/Tools/ViewWidget','Default', '', '');
    Widgets.ActivateWidget('/Widgets/Tools/Background','Default', '', '');
    Widgets.ReplaceWidget('{5C9008D4-B6B3-4359-9E63-18D2FC228A6E}','/Widgets/Edit/Default context','Default','','Dummy');
    Widgets.SetWidgetGroupDependency('{5C9008D4-B6B3-4359-9E63-18D2FC228A6E}','{E8913C00-9A2A-43cf-8238-27B4BFB50A1F}');
    Widgets.SetWidgetGroupDependency('{5C9008D4-B6B3-4359-9E63-18D2FC228A6E}','{88839603-7F98-41f0-96AC-BE94E801CFF3}');
    Widgets.SetWidgetGroupDependency('{E8913C00-9A2A-43cf-8238-27B4BFB50A1F}','{88839603-7F98-41f0-96AC-BE94E801CFF3}');
    UserInterface.OpenPreferencesPanelViewExWithFlag('', '','/Preferences/Desktop',3, 1, 0, 4);
    LE.DefaultPlacement();
}
RsApp.SetCachingMode('always', true);
D3DView.RendererUpdateFromNode('');
WindowsManager.Activate();
tSBridge.DeleteTmpTextures();
 
As a note I tried it in the init.js but there it won't save things you are working on like scripts or your unsaved scene at the time of the crash. :bananadevil:

Post Reply