//clear status line
if(Node.Exists("/Status Line")) {
if(!Node.ConExists("Status Line", "Model"))
Node.ConCreate("Status Line", "Model", "string", 4);
Node.Value("/Status Line","Model") = "";
}
Category Archives: tS Scripting
trueSpace + Wacom incompatible
Windows 10, Windows 7 + Wacom ET-0405-U (Graphire?) will interfere with the script editor causing slowdown when opening, editing and closing a script.
Workaround is to go to the Windows Control Panel > Human Interface Devices and disable the wacom driver: specifically the Wacom HID Pen
Windows10 – open device manager and disable
- Human Interface Devices > Wacom HID Pen
- Mice and other pointing devices > Wacom Mouse
truespace 7.5 alpha10 notes
original source – printed emails from tS beta testing, processed with FreeOCR from http://www.paperfile.net/
Defined set of general purpose array data objects for scripting:
Universal Array Data.
Int Array Data.
Number Array Data.
String Array Data.
Boolean Array Data.
All are defined in Common Data package.
You can create single-dimensional as well as multidimensional arrays using these data objects.
Universal Array Data can store items of any type (primitives like int, bool, or rosetta data types), but it is slower and more memory consuming than specialized types (e.g. Int Array Data), so choose the right type carefully.
Samples
// Create simple array by adding items
a = System.CreateDO(“Common Data Package\Universal Array Data”);
a.Add(“first string”);
a.Add(“second string”);
a.Add(6.56);
// Create 2 dimensional integer array
a = System.CreateDO(“Common Data Package\Int Array Data”)
a.SetDim(2);
a.SetSize(10, 10);
for (i = O; i < 10; i++)
for (j = 0;j<10;j++)
a.SetAt(i,j, 50);
ts7.5 beta16 notes
original source – printed emails from tS beta testing, processed with FreeOCR from http://www.paperfile.net/
WindowsManager.MoveWindow name item enhanced about possibility to work with working area size or the whole window size.
Example:
WindowsManager.MoveWindow(idWindow, -1, -1, Width, Height, WorkAreaSize, -1, -1);
truespace open debug view
if(!DebugViewFound("Project/Windows Manager Space")) CmdPrompt.DebugView('Windows Manager Space', 0); } function NodeSubObject(root, index) { return root + "/" + Node.SubObject(root, index); } function DebugViewFound() { var WMS = "Project/Windows Manager Space"; var numwindows = Node.SubObjectCount(WMS); for(var winIndex=0; winIndex < numwindows; winIndex++) { var currentWindow = NodeSubObject(WMS, winIndex); if(Node.SubObjectCount(currentWindow) < 1) continue; var shortname = Node.ShortName(NodeSubObject(currentWindow, 0)); if( shortname == "LogOutput") return true; } return false; }
button notes
general notes for scripting buttons
var tbbutt = Node.Create(‘Windows Manager Package/Toolbar Button Item’, mytoolbar);
Node.Value(tbbutt, “ControlID2D”) = “{2BBC850E-6EEF-4364-9265-A4A606AE464B}”;//must be this guid
Node.Value(tbbutt, “ControlID3D”) = “{2BBC850E-6EEF-4364-9265-A4A606AE464B}”;
//Node.Value(tbbutt ,”Package”) = “{E0C3ABBA-AA1C-4A09-8089-9ED4A8AC63B9}”;//needed for menu button
Node.Value(tbbutt, “Menu”) = false;
Node.Value(tbbutt, “Name”) = theframeSN;
//Node.Value(tbbutt ,”Preview2D”) = 303;//needed for image button
//Node.Value(tbbutt ,”Preview3D”) = 303;
var tbbutt2 = Node.Rename(tbbutt, theframeSN + “Button”);
truespace misc sdk notes from the wiki
RsApp.Help()
- creates some xml documentation files RsCmdDoc.xml and RsNodeDoc.xml
- RsImport.ExportCollada(‘filename’,’list of nodes’) – will export a collada file via script
- Widgets.Rotate == rotate about origin (0,0,0) then offset back to original position
- WindowsManager.MoveWindow name item enhanced about possibility to work with working area size or the whole window size.
* Example: o WindowsManager.MoveWindow(idWindow, -1, -1, Width, Height, WorkAreaSize, -1, -1);
trueSpace Python Notes(copied from wiki)
The python samples don’t work for trueSpace7.61 unless you copy the contents of the PythonScripts folder into the tS folder. The other option is to add 2 lines to the top of your python script:
import sys
sys.path.append(‘PythonScripts’)
This tells python to look inside the PythonScripts folder for modules to load.
Bug: GetMaterial(matidx), the object get material function always returns None.
Tutorials on the Wayback Machine, look at the early years:
http://web.archive.org/web/20040415000000*/http://www.3dfuel.com
trueSpace Scripting Matrix
Matrix multiplication
myMatrix.LoadIdentity();
rollMatrix.LoadIdentity();
yawMatrix.LoadIdentity();
yawMatrix.SetYaw(22);
rollMatrix.SetRoll(13);
last rotation
myMatrix.SetPitch(-90);// myMatrix = -90 deg pitch
(this is the second rotation)
myMatrix.Mult(rollMatrix);// rollMatrix * myMatrix => myMatrix
(this is the first rotation)
myMatrix.Mult(yawMatrix);// yawMatrix * myMatrix => myMatrix
myMatrix is yaw 22 deg then roll 13 deg then pitch -90 deg
Local matrix from world matrices
theMatrix = Node.Value(bindgroup + "/" + subNode, "WldMatrix");
parentMatrix = Node.Value(bindParent, "WldMatrix");
parInvert = parentMatrix.Invert();
theMatrix.Mult(parInvert);
//now theMatrix contains local instead of world
trueSpace Scripting Selection
Space.Select() – select multiple nodes from text string separated by semi colons, node paths in the list must not have leading spaces
Node.Selection() – returns a selection list with a semicolon delimination, but has leading spaces in each nodes path so needs to be adjusted to work with Space.Select
sel = Node.Selection(); selArray = sel.split(";"); re = /^\s/; // whitespace in first character position sel = selArray[0].replace(re,""); if(selArray.length > 1) for(i=1;i<selArray.length;i++) sel = sel + ";" + selArray[i].replace(re,"");
Node.Select – select one node
Space.Unselect()