Save and Set Customized Toolbars and Widgets

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

Save and Set Customized Toolbars and Widgets // The Garage

1  |  

Post by trueBlue // Oct 21, 2006, 8:30pm

trueBlue
Total Posts: 1761
pic
This script will save your customized Toolbars.

//IMPORTANT: This script will overwrite the Toolbars rsobj file without warning!
// Backup your original first by renaming it to ToolbarsBAK.rsobj
function Execute(params)
{
rosDir = System.GetMainDir();
RsFileIO.SaveObject(rosDir + '\\Scripts\\preobjects\\Toolbars.rsobj', '/Toolbar Prototypes Encapsulator');
System.Alert("Toolbars have been saved.");
System.Alert("trueSpace7 will now shutdown and Reset to Default Context to save changes.");
RsApp.Reset();
}

Post by Alien // Oct 24, 2006, 2:02am

Alien
Total Posts: 1231
pic
// c:\trueSpace7\tS\Scripts\preobjects\

// This script assumes that this is where you installed trueSpace7.

if you change c:\trueSpace7\tS\ to %vlight_root%\..\ it'll work no matter where the user had installed tS. So in this instance you'd use:

%vlight_root%\..\Scripts\preobjects\

Post by trueBlue // Nov 1, 2006, 8:59am

trueBlue
Total Posts: 1761
pic
There is System.GetMainDir() which should have been used, but I am not sure how to use it yet. You can change the path in the script to where you installed trueSpace7.

Post by trueBlue // Nov 1, 2006, 9:24am

trueBlue
Total Posts: 1761
pic
This script will save your Customized Widgets.

//IMPORTANT: This script will overwrite the Widgets.rsobj file without warning!
// Backup your original first by renaming it to WidgetsBAK.rsobj
function Execute(params)
{
rosDir = System.GetMainDir();
Node.Delete("/Widgets/Active Widgets Layer2/Active Widget");
Node.Delete("/Widgets/Active Widgets Layer2/Active Widget, 1");
Node.Delete("/Widgets/Active Widgets Layer2/Active Widget, 2");
Node.Delete("/Widgets/Active Widgets Layer2/Active Widget, 3");
Node.Delete("/Widgets/Active Widgets Layer2/Active Widget, 4");
Node.Delete("/Widgets/Active Widgets Layer2/Active Widget, 5");
Node.Delete("/Widgets/Active Widgets Layer2/Active Widget, 6");
RsFileIO.SaveObject(rosDir + '\\Scripts\\preobjects\\Widgets.rsobj', '/Widgets');
System.Alert("Widgets have been saved.");
System.Alert("trueSpace7 will now shutdown and Reset to Default Context to save changes.");
RsApp.Reset();
}

Post by tomasb // Nov 3, 2006, 6:34am

tomasb
Total Posts: 261
//IMPORTANT: Backup your original Widgets.rsobj file in the following folder:

// c:\trueSpace7\tS\Scripts\preobjects\

// This script assumes that this is where you installed trueSpace7.

// This script will overwrite this file without warning!

function Execute(params)

{

Node.Select("/Widgets");

RsFileIO.SaveObject('c:\\trueSpace7\\tS\\Scripts\\ preobjects\\Widgets.rsobj', '');

System.Alert("Widgets have been saved.");

System.Alert("trueSpace7 will now shutdown and restart to save changes.");

RsApp.Reset();

}



WARNING:


when saving a widget node, you need to remove content of active widgets encapsulators, otherwise you end with more view /background/... widgets when you reset to default context. When saving widgets, clone the node; delete widgets from insied of active widgets layer1 and 2, and save cloned node.

Post by trueBlue // Nov 3, 2006, 6:42am

trueBlue
Total Posts: 1761
pic
Thanks for this information! Is this true with saving toolbars too? Can you please write a script that does what you are saying?

Post by stan // Nov 3, 2006, 8:38am

stan
Total Posts: 1240
pic
what he means is to copy ,save in library and then delete any widget [or widget component] you don't want to show up in a reset from inside '/Active Widgets Layer1' [or 2]..tencapsulators in active widgets layer1 and 2 or where ever yot custom widget was added,

Post by tomasb // Nov 3, 2006, 11:24am

tomasb
Total Posts: 261
widgets are in two form: template and "active". active widgets are held in active widgets layer1 and 2 - which are render layers used by player view for rendering. if you add a cube inside, you will have cube in widgets space...

when you select object for example, widget subsystem creates delegate from template and put it to layer so renderer can render it.


because not all widgets are automaticaly activated/deactivated (view widget), if you save active widget into rsobj, init.js script activates the widget again - and you will end up with two background handlers and two view widgets.


active toolbars are saved inside windows manager node within project encapsulator, so saving toolbar prototypes is safe..

Post by trueBlue // Nov 3, 2006, 11:31am

trueBlue
Total Posts: 1761
pic
Thanks again tomasb! So will this work by deleting both nodes first? I did a test and these two nodes are recreated after "Resetting the Default context".

//IMPORTANT: Backup your original Widgets.rsobj file in the following folder:
// c:\trueSpace7\tS\Scripts\preobjects\
// This script assumes that this is where you installed trueSpace7.
// This script will overwrite this file without warning!
function Execute(params)
{
Node.Delete("/Widgets/Active Widgets Layer2");
Node.Delete("/Widgets/Active Widgets Layer1");

Node.Select("/Widgets");
RsFileIO.SaveObject('c:\\trueSpace7\\tS\\Scripts\\ preobjects\\Widgets.rsobj', '');
System.Alert("Widgets have been saved.");
System.Alert("trueSpace7 will now shutdown and restart to save changes.");
RsApp.Reset();
}

Post by tomasb // Nov 3, 2006, 12:06pm

tomasb
Total Posts: 261
[COLOR=blue]Thanks again tomasb! So will this work by deleting both nodes first? I did a test and these two nodes are recreated after "Resetting the Default context".




this will cause delete of the layers including lighting for widgets. it is better to inspect these encapsulators and remove everything that exports controlled objects connectors.

Post by trueBlue // Nov 3, 2006, 8:09pm

trueBlue
Total Posts: 1761
pic
this will cause delete of the layers including lighting for widgets. it is better to inspect these encapsulators and remove everything that exports controlled objects connectors.

Thanks for your help tomasb!

Like I said, I deleted Active Widgets Layer1, and Active Widgets Layer2 and "Reseting the default context" does not recreate the lights in either layer. It does however recreate both nodes with active widgets inside, but no lights. Deleting the Default.ctx, starting tS7, shutdown tS7, and starting tS7 recreates the lights inside both layers.
Okay so I learned my lesson the hard way. :o

What I would like to do here is create a script that will safely save a customized widget that will withstand all of the above. tS7 is really cool and I like that I can customize my UI the way I would like.

Can you or somebody from Caligari help me write a script that will correctly and safely save a tS7 user's customized widget?

Post by trueBlue // Nov 4, 2006, 4:05am

trueBlue
Total Posts: 1761
pic
Okay unless there is something else that I do not know, this works for me saving my customized widget. I have updated the script posted earlier.

//IMPORTANT: Backup your original Widgets.rsobj file in the following folder:
// c:\trueSpace7\tS\Scripts\preobjects\
// This script assumes that this is where you installed trueSpace7.
// This script will overwrite this file without warning!
function Execute(params)
{
Node.Delete("/Widgets/Active Widgets Layer1/Active Widget");
Node.Delete("/Widgets/Active Widgets Layer1/Active Widget, 1");
Node.Delete("/Widgets/Active Widgets Layer1/Active Widget, 2");
Node.Delete("/Widgets/Active Widgets Layer1/Active Widget, 3");
Node.Delete("/Widgets/Active Widgets Layer1/Active Widget, 4");
Node.Delete("/Widgets/Active Widgets Layer2/Active Widget");
Node.Delete("/Widgets/Active Widgets Layer2/Active Widget, 1");
Node.Delete("/Widgets/Active Widgets Layer2/Active Widget, 2");
Node.Delete("/Widgets/Active Widgets Layer2/Active Widget, 3");
Node.Delete("/Widgets/Active Widgets Layer2/Active Widget, 4");
Node.Select("/Widgets");
RsFileIO.SaveObject('c:\\trueSpace7\\tS\\Scripts\\ preobjects\\Widgets.rsobj', '');
System.Alert("Widgets have been saved.");
System.Alert("trueSpace7 will now shutdown and restart to save changes.");
RsApp.Reset();
}

Post by tomasb // Nov 4, 2006, 6:13am

tomasb
Total Posts: 261
[COLOR=blue]Okay unless there is something else that I do not know, this works for me saving my customized widget. I have updated the script posted earlier.




this should work :) .

Post by trueBlue // Nov 4, 2006, 6:16am

trueBlue
Total Posts: 1761
pic
Great thank you for the confirmation! :jumpy:

Post by scarroll // Dec 24, 2008, 10:52pm

scarroll
Total Posts: 19
pic
I believe there is a bug in ts7.6. Following a default install, my version returns the string:


"C:\trueSpace76\tS\Rs Main Library Place"


But yet, there is no such folder on my system, rather there is a


"C:\trueSpace76\tS\Rs Main Libraries"


is anyone else experiencing this?

Post by scarroll // Dec 24, 2008, 10:59pm

scarroll
Total Posts: 19
pic
Whoops, my bad, just copied old documentation from the ts7 Designer Guide. Speaking of which, is there an update to this? It mentions to review the "Reference Guide" for all the built in and present scriptable objects in ts, where do I find the "Reference Guide"? Any help, greatly appreciated! :)
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn