Collada plugin for
After Effects

More info here
Plugins and Scripts > trueSpace

Techniques

trueSpace Blog

Collection of notes for use and development on trueSpace

Clintons3dPlugin package for trueSpace

This rsx plugin is used by several scripts from this site. It is used in the unreal scripts to read the binary formats and in the indigo script making it possible to read scene level materials. Several scripts now use the Save-As dialog from this package.

The source code for the plugin can be downloaded from here.
The source assumes to be added into d:\sdk_tS761B8\Examples\
ExamplesPlugin.TopologyExample2 = ImportPSK
ExamplesPlugin.TopologyExample4 = ImportPSA
ExamplesPlugin.TopologyExample5 = import collada
ExamplesPlugin.HelloWorld2 = ExportPSK
ExamplesPlugin.HelloWorld3 = ExportPSA
ExampleDataObject2 = guid for scene materials
ExampleDataObject3 = save as dialog
ExampleDataObject4 = triangle neighbors/polygon functions
compositing nodes
sockets
UtilityDataObject - node connector info, select file folder dialog, save as dialog, set active material, guid for scene materials, point visualization, keyframe data info, window absolute position get and set

Be warned that much of the source code is very rough. I never fully figured out how to use the beta sdk, so it's a messy collection of code that works. Also the source is a little bloated from extra libraries and experimentation.

A version of this rsx plugin comes pre-installed in the Unofficial trueSpace Updates - https://www.united3dartists.com/forum/viewforum.php?f=55

October 6, 2024

  • v1638459
  • fix crash bug when running GetTriangleNeighbor on a primitive
  • command now works with Shape, primitives, Editable shape and Editable shape while in edit mode

October 3, 2024

  • v1638458 - folder dialog initial folder arg

August 29, 2024

  • v1638457 - fix crash bug when material is equal method, index out of range
  • add option ByOrder to MaterialIsEqual

August 28, 2024

  • v1638456
  • Material Display Buffer node - created to update the Materials List script
    note: used guid CON_VIEW3D_D3DMATERIAL to get the proper ME2 Material output
  • material is equal test

August 26, 2024

  • v1638455
  • new no undo history ConRename

August 23, 2024

  • v1638454
  • CopyNodeContent for scripting
  • GetLinkedInputNodeAndConn2 - get node and it's connector linked to the input connector using index
  • GetLinkedOutputNodeAndConn2 - get node and it's connector linked to the output connector using index

July 21, 2024

  • v1638453
  • MaterialLookupTable commands for scripting
  • MaterialList commands exposed for scripting
  • new commands are used in the new unreal t3d import

June 27, 2024 & 28

  • no version change - v1638452
  • expose MergeMaterialLists to script
  • GetPoints widget node "Add" input will provide point snapping behavior

June 26, 2024

  • v1638452
  • MaterialLookupTable exposed to scripting for the csg boolean node

April 17, 2024

  • v1638451
  • new command to get the linked input node and the connector

January 2, 2024

  • v1638450 - forgot to update version number
  • fix crash bug Composite Mix node
  • fix crash bug Image Channel Combiner node

December 29, 2023

  • v1638450
  • update for procedural textures
  • Not compatible with Unofficial Updates dated before December 29, 2023 for YafaRay Rendering

December 3, 2023

  • v1638449
  • fix bad format from data after last key of GetKeyframeData

December 2, 2023

  • v1638448
  • new GetNodeValueInt, GetNodeValueFloat, GetNodeValueString(Color, Matrix)
  • update Copy and Delete to work with empty quotes selection style run

November 11, 2023

  • v1638447
  • GetScriptBody, SetScriptBody - read and write the script text
  • SaveScriptToFile, LoadScriptFromFile - load and save xml file of a script

October 26, 2023

  • v1638446
  • fix bad input crash for GetWindowAspect, SetFrameRect and UpdateFrameRect

October 13, 2023

  • v1638445
  • vertex color crash fix
  • vertex color add checks for camera, lights
  • looks for vertex color compatible materials and if vertexcolorstrength conn make sure value is visible
  • utility SetActiveMaterial2 and RemoveUnusedMaterials

Older Updates

Note: may require VC++ runtime 2008 sp1 from Microsoft. (2010) Get it if the plugin does not install.

November 22, 2009

Triangle Processing

polygon to triangles using Newells Method

feed it a list of vertices space delimited "x1 y1 z1 x2 y2 z2 ..."

get back triangle data "#triangles,i1 j1 k1,i2 j2 k2, ..."

polypoints = "-0.5 -0.5 -0.5 -0.5 -0.5 0.5 -0.5 0.5 0.5 -0.5 0.5 -0.5"
utilitydata = System.CreateDO("Clintons3D Package/Utility functions");
value = utilitydata.PolygonToTriangles(polypoints);
valArr = value.split(",");
for(var i = 0; i < valArr[0]*1; i++) {
	localindices = valArr[i+1].split(" ");

a little sloppy trailing space and comma in each triangle definition
value is "2,0 1 2 ,0 2 3 ,"

triangle neighbors

triangle neighbors diagram
//get triangle neighbors as a space delimited string of triangle indices
utilityFunctions = System.CreateDO("Clintons3D Package/Utility functions");
triangleIndex = 19;
neighborsS = utilityFunctions.GetTriangleNeighbors(firstSelected + "/Editable shape", triangleIndex);

result is "5 20 16", a space delimited list of neighbor indices at each edge of the triangle, -1 indicates no neighbor on that edge

the first value is the triangle index along the edge P1>P2, then P2>P3 and finally P3>P1

triangle edge visibility

meshdata = System.CreateDO("Space 3D Package/Mesh Data");
faceEdgeStream = System.CreateDO('Space 3D Package/Face Edges Stream Data');
meshdata = Node.Value(Node.FirstSelected() + "/Editable shape" ,"Mesh");
faceEdgeStream = meshdata.GetTrianglesStreamByName("Face Edges Stream Data");
triangleIndex = 19;
triangleEdgesS = faceEdgeStream.edges(triangleIndex);

result is the value of 1 to show that the first edge of the triangle is visible. if the second edge was also visible the value would be 1+2=3 and if the third edge was also visible it would be 1+2+4=7

truespace does not store polygon information. it stores triangle edge visibility to give the appearance and behavior of polygons

June 26, 2024

Clintons3dView Plugin package for trueSpace

This rsx plugin is used by the web based ui scripts and the node list view script.

The source code for the plugin can be downloaded from here.

April 15, 2023

  • fixed rename bug in scene view 2 - was limited number of characters
  • v1638414 plugin version
  • 413 version never released

March 25, 2023

  • v1638412
  • fix statistics info panel matrix - added shear

March 22, 2023

  • new scene view 2 window
  • v1638411 - fix scene view 2 crash bug in v1638410
  • hooks into object statistics updated and added for node view and web server

Missing Dates

  • September 7, 2022 v1638409 - multiple upgrades
  • July 30, 2022 v1638408 - web scene view 2

January 19, 2018

version v.1638406

September 8 2016

  • version v.1638403

Note: may require VC++ runtime 2008 sp1 from Microsoft. (2010) Get it if the plugin does not install.

xxx xx, xxxx

Clintons3D Plugin Ext package

Contains the tif loader, exr loader, png saver command and exr saver commands

Unzip and copy all 3 files together

Related Materials nodes

Script Commands

Native trueSpace will not save png files with an alpha channel

trueSpace will not save exr format images - ?and hdr has issues?

SaveEXR and SaveNoAlphaEXR:

save bitmap to a exr file with or without an alpha channel

  • extu = System.CreateDO("Clintons3D Package Ext Depends/Utility functions");
  • var result = extu.SaveEXR(BitmapNode, BitmapConn, FileName, PixelFormat, Compression)
    BitmapNode is the node that has a bitmap connector
    BitmapConn is the name of the connector
    FileName is the full path name of the png file to save
    PixelFormat 1=half float, 2=float
    Compression 0=none, 1=rle, 2=zips, 3=zip, 4=piz
    Result will contain a text message of any errors from the save

RGB no Alpha command

  • extu = System.CreateDO("Clintons3D Package Ext Depends/Utility functions");
  • var result = extu.SaveNoAlphaEXR(BitmapNode, BitmapConn, FileName, PixelFormat, Compression)

SavePNG:

save a bitmap to a png file that supports alpha values

  • extu = System.CreateDO("Clintons3D Package Ext Depends/Utility functions");
  • var result = extu.SavePNG(BitmapNode, BitmapConn, FileName)
    BitmapNode is the node that has a bitmap connector
    BitmapConn is the name of the connector
    FileName is the full path name of the png file to save
    Result will contain a text message of the final status of the save

Source code: Clintons3dExtSource.zip

October 24, 2024

  • version 1638417
  • added filename to the bitmap data in loaders for tif and exr

October 22, 2024

  • version 1638416
  • add support for loading and saving exr files

January 6, 2024

  • repackaged as wont load without supporting dll files

January 5, 2024

  • version 1638415
  • png will only export 32bit images - no more auto-convert to 8bit grayscale or indexed images

October 18, 2023

  • plugin version v1638414
  • add png export that supports alpha values
April 28, 2019

Script Crash Bug GetSelectedFaceTriangle

This bug will crash tS if the command is run

Crash code

	var thesel = System.CreateDO("Space 3D Package/Selection Data");
	thesel = Node.Value(firstSel, "Selection");
	bobobo = thesel.GetSelectedFaceTriangle(0)

Plugin fix

    var thesel = System.CreateDO("Space 3D Package/Selection Data");
    thesel = Node.Value(firstSel, "Selection");
    util = System.CreateDO("Clintons3D Package/Utility functions");
    bobobo = util.GetSelectedFaceTriangle(0);
September 6, 2021

SDK bug

The RsSelectionHelper.h file included in the DK has a bug that prevents selections unless something is already selected.

SelectNode function change in the RsSelectionHelper.h file

    // crashes if no preexisting selection Nov 2011
    //if(spNodeSelection->IsEmpty())
    //	return E_FAIL;
    // Aug 2021 probably because can't replace an empty selection
    if(spNodeSelection->IsEmpty())
        bReplace = false;
September 6, 2021

RsApp.Help()

Command generates xml files that can't be read properly by modern web browsers. Internet Explorer on win7 was used to convert the xml files to html files.

December 18 2023
height node

Height field node

point cloud test

A fast version of the Caligari Image Cloud script created by Norm Fortier and based on the SDK height field sample code.

Connectors:

  • Bitmap - texture image for the mesh faces if they are visible
  • Height field - texture to control the height and color of the points
  • Height segments - vertical resolution of the mesh
  • Method - how the height is generated
    • 0 - average value of the red, blue and green of the pixel
    • 1 - use the blue value
    • 2 - use the green value
    • 3 - use the red value
    • 4 - intensity/luminance (0.3*red + 0.59*green + 0.11*blue)
    • 5 - use the alpha value of the image
  • Multiplier - scale for the displacement values
  • Point alpha - if checked the transparency value of the points is determined by the alpha channel of the image
  • Point size - how large the points are
  • Surface Opacity - how opacity of the mesh faces, 0=invisible
  • Width segments - the horizontal resolution of the mesh

The plugin package is required to use this script. Download the plugin package here.

A bare bones height field node can be created by running a command:
Node.Create('Clintons3D Package/Height field',Space.CurrentScene());

April 17, 2014
material matching

Object scene material guid reader

This script demonstrates how to get the guid for object scene materials which are not available to scripting. Each material inside the scene's material node has a unique id assigned to it that can be read by script. The corresponding id is found inside the meshes "Material List" node. On the node connected to the "Material List Manager". Pass this node to the plugin to get it's id and match it against the "Material Flavor Manager's" "Material ID" connector value.

Select the node connected to the Material List Manager and push the button for the script to display the id in the list view.

By the way the "Material ID" connector on the "Material Flavor Manager" is hidden and can't be seen on the node even though it can be read via script.

Update Feb 2023

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • matid = util.GetMaterialId(MatNode)
    MatNode - the node connected to the Material List Manager
  • System.Trace(matid)

Enhanced Command

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • matNode = util.GetInstancedMaterialNode(MatListNode, index)
    MatListNode - the Material List Manager node
    index - material index of the mesh, connected to Mat Chunk 0, 1, 2 ...
  • System.Trace(matNode)
  • The returned value is the name of the material node inside the scene Materials encapsulator

GetInstancedMaterialNode is really "GetMaterialShortName" - given the Material List encapsulator(or Material List Manager node) and an index value get the short name for the material. Material may be instanced or not.

Use GetMaterialNode to get the full path of the material with the same arguments.

The plugin package is required to use this script. Download the plugin package here.

November 22, 2009

Speech for trueSpace

This script demonstrates the use of the Microsoft Speech API using a jscript command node.

Voices:

  • winXP - Sam
  • Win7 - Anna
  • Win10 - David and Zira
August 14, 2015

Export Scripts

Export all scripts contained in the selected node to js or xml files. This is useful for searching all scripts and editing. Visual Studio Code "find in files" works well to see and search all the scripts in one easy location.

Usage:

  1. Load the script
  2. Options
    • Export Only Simple - The simple script command nodes will export to a single text file with a "SimpleCommands_" prefix.
    • Export as JScript Files - saves js format files, otherwise saves xml format
  3. choose an object - say "/Scripts/Commands"
  4. press Start

All the scripts inside the selected node will export as xml or js files to an ExportedScripts folder in the tS directory. The simple scripts are found in "/Widgets" and "/Physics/Widgets".
The folder structure will reflect the tS hierarchy.
Repeat names will be given a random postfix to differentiate the scripts.

ExportedScripts - xml export of all scripts found in the Unofficial Updates released on Dec 28 2021

November 20, 2023

  • if no selection export all starting from the root

November 11, 2023

  • much faster - no waiting
  • writes js files
  • requires latest rsx plugin v1638447
  • old version

March 30, 2023

  • fix mystery sendkeys bug when running on full tS uu9 scripts

October 28, 2022

  • recreate tS folder structure instead of creating a key file
  • new folder structure allows multiple runs without restarting to organize the files

June 10, 2022

  • add option to export the simple scripts used inside widgets
November 16, 2021

Dump Buttons and Shortcuts to a Web page

This script writes data to a web page from all buttons and shortcuts defined in truespace toolbars. Output results from trueSpace 7.11, 7.61 and 7.61(patched) links are below. The 7.11 dump includes the modelside button information.

  • Has the left and right mouse button commands
  • List of shortcuts
  • shortcut builder tool for use with manually editing the shortcuts file

Missing set keyframe button - tSBridge.SuggestTSStateByAlias("RecordKeyFrameButton"); found inside the tsxapi.dll file.

Import xml file to run in tS v7.11 link

shortcut builder shortcut keys are defined by pressing one button at a time, so CTRL Z would be CTRL then Z

March 18, 2020

Dump Buttons XML script

This script writes data from all buttons defined in truespace toolbars. It can be imported via the a jscript command node. Output results from trueSpace 7.11 and 7.61(patched) links are below. The 7.11 dump includes the modelside button information.

trueSpace7.11 button dump

trueSpace7.61 button dump

Missing set keyframe button - tSBridge.SuggestTSStateByAlias("RecordKeyFrameButton"); found inside the tsxapi.dll file.

December 19, 2015

Save-As Dialog for trueSpace

This script demonstrates the use of a Save-As dialog for scripts.

The plugin package is required to use this script. Download the plugin package here.

Code:

filedata = System.CreateDO('Clintons3d Package/File Save As data');
filedata.SetName("My special (*.bob)~*.BOB~Collada Files (*.dae)~*.DAE~All Files (*.*)~*.*~~");
file = filedata.GetName();

System.Alert(file);

uses "~" as a delimiter between the description and the extension and end the string with 2 ~'s

November 22, 2009

Save As Dialog (v2) for trueSpace

The plugin package is required. Download the plugin package here.

Sample Code:

var fso = new ActiveXObject("Scripting.FileSystemObject");
var util = System.CreateDO("Clintons3D Package/Utility functions");
var folder = "";
var filename = "some preexisting filename";
folder = fso.GetParentFolderName(filename);
filename = fso.GetFileName(filename);
//fso method return of folder or filename is flawed when path is invalid/empty
//causes returned value of plugin to cause tS crash
if(folder=="") folder="";
if(filename=="") filename="";
var defExt = "tga";
var filter = "TGA (*.tga)~*.tga~EXR (*.exr)~*.exr~HDR (*.hdr)~*.hdr~Jpeg (*.jpg)~*.jpg~PNG (*.png)~*.png~TIF (*.tif)~*.tif~All Files (*.*)~*.*~~";
var file = util.FileSaveAsDialog2(folder, filename, filter, defExt);

  • folder - can be blank
  • filename - full path or just file name
  • filter - first item is the default extension shown
  • defExt - can be blank, used if user does not enter an extension
June 21, 2018

Open File Dialog for trueSpace

The plugin package is required. Download the plugin package here.

Sample Code:

var fso = new ActiveXObject("Scripting.FileSystemObject");
var util = System.CreateDO("Clintons3D Package/Utility functions");
var folder = "";
var filename = "";
folder = fso.GetParentFolderName(filename);
filename = fso.GetFileName(filename);
//fso method return of folder or filename is flawed when path is invalid/empty
//causes returned value of plugin to cause tS crash
if(folder=="") folder="";
if(filename=="") filename="";
var defExt = "tga";
var filter = "TGA (*.tga)~*.tga~EXR (*.exr)~*.exr~HDR (*.hdr)~*.hdr~Jpeg (*.jpg)~*.jpg~PNG (*.png)~*.png~TIF (*.tif)~*.tif~All Files (*.*)~*.*~~";
var file = util.FileOpenDialog(folder, filename, filter, defExt);
System.Trace(file);

  • folder - can be blank
  • filename - full path or just file name
  • filter - first item is the default extension shown
  • defExt - can be blank, used if user does not enter an extension
January 3, 2021

Folder Dialog for trueSpace

The plugin package is required to use this script. Download the plugin package here.

Code:

util = System.CreateDO("Clintons3D Package/Utility functions");
thedata = util.GetFolderDialog();
System.Alert(thedata);

October 2024 - GetFolderDialog2

Pass an initial folder. The dialog will open too, but may not scroll directly too the initial folder.

A blank or invalid path will give the default dialog behavior, the same as GetFolderDialog.

Code:

util = System.CreateDO("Clintons3D Package/Utility functions");
thedata = util.GetFolderDialog2("E:\\OpenSource\\DevApplicationUSD");
System.Alert(thedata);

May 19, 2013

Animation utility functions

The plugin package is required. Download the plugin package here.

Sample Code:


        util.GetEditableTrackName(Space.CurrentScene() + "/Cone")
    


    util = System.CreateDO("Clintons3D Package/Utility functions")
    asp = util.GetAnimViewVisible("Project/Windows Manager Space/Frame Window, 2/AnimView Node");
    System.Trace(asp)
    var obj = eval("(" + asp + ")");

    for(var j in obj) {
        System.Trace(j + " = " + obj[j])
        for(k in obj[j]) {
            System.Trace(k + " = " + obj[j][k]);
        }
    }
    
Pass in the "AnimView Node" gives values for the 4 numbers that control the vertical view in the animation curve editor and the visible time start and end. Active tab does not matter.


    util = System.CreateDO("Clintons3D Package/Utility functions")
    util.SetAnimViewVertical("Project/Windows Manager Space/Frame Window, 2/AnimView Node",-40, 40, -50, 50);
Pass in the "AnimView Node" and minimum visible value, maximum visible value, min value and max value to control the zoom of the vertical values in the animation editor FCurve view.


    util = System.CreateDO("Clintons3D Package/Utility functions")
    util.SetAnimVisibleInterval("Project/Windows Manager Space/Frame Window, 2/AnimView Node", 40, 150);
Pass in the "AnimView Node" and minimum visible time and maximum visible time to control the zoom view in the time axis.


    util = System.CreateDO("Clintons3D Package/Utility functions")
    sregion = util.GetSelectionRegion();
    System.Trace(sregion)

    obj = eval("(" + sregion + ")");

    for(j in obj) {
        System.Trace(j + " = " + obj[j])
        for(k in obj[j]) {
            System.Trace(k + " = " + obj[j][k]);
        }
    }
    
Curve editor will give the start and end time of the selected keys and the min and max values. When Dope sheet is active only the start and end times are valid. When Story view is active none of the values are valid.

Note: There is no easy way to get the selected keyframes or to select keyframes.

Feb 1 2022

Keyframe data for trueSpace 7.61

Provides a keyframe data read from a clip nodes AnimData connector. Data is returned in JSON format and gives the value, the attribute, interpolation type and handle information.

The plugin package is required to use this script. Download the plugin package here.

Rotation values returned are the negative of the true values.

GetKeyframeData will return values for the next keyframe at or after the provided time

GetKeyframeData(AnimClipNode, AnimatedAttribute, time);

AnimClipNode - full path to the AnimClip node
AnimatedAttribute - "All_Attributes" will collect all the attributes together and return each with their time. A single attribute will return the data for next time of the attribute. All_Attributes will return the data at the next time of each attribute.
time a float value at or just before the keyframe time to read. a large negative number can be used to get the first keyframe of the animation clip

returns empty string object if not a valid anim clip node, "{}" json => {}

List.length of zero means no key was found after the given time

MinTime and MaxTime are the first and last key times of the clip

Code sample:
outdated, use the JSON function set to read the data instead of eval

function Execute(params)
{
	//function will return values for the next keyframe after the provided time
	//
	//utilitydata.GetKeyframeData("Clip node full path","animated attribute",
	//a time at or before the next keyframe);
	//
	var utilitydata = System.CreateDO("Clintons3D Package/Utility functions");
	var value = utilitydata.GetKeyframeData(Node.FirstSelected()+"/AnimClip","All_Attributes",-90);
	//var value = utilitydata.GetKeyframeData(Node.FirstSelected()+"/AnimClip","Height",-90);
	//var value = utilitydata.GetKeyframeData(Node.FirstSelected()+"/AnimClip","Matrix",-90);
	System.Trace(value);
	System.Info(value);

	var obj = eval("(" + value + ")");
    if(!obj.MinTime) return;//test for invalid result

	System.Trace(obj.MinTime)
	System.Trace(obj.MaxTime)
	System.Trace(obj.AttrCount)

	for(var i=0;i < obj.List.length;i++) {
		System.Trace("AttrName: " + obj.List[i].AttrName)
		System.Trace("time: " + obj.List[i].time)
		for(j=0;j < obj.List[i].channels.length;j++) {
			System.Trace("channel: " + obj.List[i].channels[j].chan)
			System.Trace("value: " + obj.List[i].channels[j].val)
			System.Trace(obj.List[i].channels[j].interp)
			System.Trace(obj.List[i].channels[j].leftAng)
			System.Trace(obj.List[i].channels[j].leftLen)
			System.Trace(obj.List[i].channels[j].rightAng)
			System.Trace(obj.List[i].channels[j].rightLen)
		}
	}

}
sample data:
{
                        {
                            "MinTime": "59",
                            "MaxTime": "251",
                            "AttrCount": "2",
                            "List": [
                                {
                                    "AttrName": "Height",
                                    "time": "132.657",
                                    "channels": [
                                        {
                                            "chan": "data",
                                            "val": "7",
                                            "interp": "INTRPL_BEZIER_AUTO",
                                            "leftAng": "0",
                                            "leftLen": "0.333",
                                            "rightAng": "0",
                                            "rightLen": "0.333"
                                        }
                                    ]
                                },
                                {
                                    "AttrName": "Matrix",
                                    "time": "115",
                                    "channels": [
                                        {
                                            "chan": "tx",
                                            "val": "-4.53261",
                                            "interp": "INTRPL_BEZIER_AUTO",
                                            "leftAng": "0",
                                            "leftLen": "0.333",
                                            "rightAng": "0",
                                            "rightLen": "0.333"
                                        },
                                        {
                                            "chan": "ty",
                                            "val": "3.53165",
                                            "interp": "INTRPL_BEZIER_AUTO",
                                            "leftAng": "0",
                                            "leftLen": "0.333",
                                            "rightAng": "0",
                                            "rightLen": "0.333"
                                        },
                                        {
                                            "chan": "tz",
                                            "val": "5.59386",
                                            "interp": "INTRPL_BEZIER_AUTO",
                                            "leftAng": "0",
                                            "leftLen": "0.333",
                                            "rightAng": "0",
                                            "rightLen": "0.333"
                                        },
                                        {
                                            "chan": "rx",
                                            "val": "0",
                                            "interp": "INTRPL_BEZIER_AUTO",
                                            "leftAng": "0",
                                            "leftLen": "0.333",
                                            "rightAng": "0",
                                            "rightLen": "0.333"
                                        },
                                        {
                                            "chan": "ry",
                                            "val": "-0",
                                            "interp": "INTRPL_BEZIER_AUTO",
                                            "leftAng": "0",
                                            "leftLen": "0.333",
                                            "rightAng": "0",
                                            "rightLen": "0.333"
                                        },
                                        {
                                            "chan": "rz",
                                            "val": "125.499",
                                            "interp": "INTRPL_BEZIER_AUTO",
                                            "leftAng": "0",
                                            "leftLen": "0.333",
                                            "rightAng": "0",
                                            "rightLen": "0.333"
                                        },
                                        {
                                            "chan": "sx",
                                            "val": "0.999983",
                                            "interp": "INTRPL_BEZIER_AUTO",
                                            "leftAng": "0",
                                            "leftLen": "0.333",
                                            "rightAng": "0",
                                            "rightLen": "0.333"
                                        },
                                        {
                                            "chan": "sy",
                                            "val": "0.999983",
                                            "interp": "INTRPL_BEZIER_AUTO",
                                            "leftAng": "0",
                                            "leftLen": "0.333",
                                            "rightAng": "0",
                                            "rightLen": "0.333"
                                        },
                                        {
                                            "chan": "sz",
                                            "val": "0.999988",
                                            "interp": "INTRPL_BEZIER_AUTO",
                                            "leftAng": "0",
                                            "leftLen": "0.333",
                                            "rightAng": "0",
                                            "rightLen": "0.333"
                                        }
                                    ]
                                }
                            ]
                        }
}

February 1, 2022

  • add min and max time for start and end of the clip
  • add attrcount - not really useful
April 8, 2015

Node Connectors info for trueSpace

Provides a list of a node's connectors including the name, type and flags. The first line returned is a header line. The list includes hidden connectors.

The plugin package is required to use this script. Download the plugin package here.

The header line includes the nodes persistentID which is valid while the scene is open

first line heading(connectors[0]) is "script conn name\tconn name\ttype\tflags\t" + persistentID found here

Sample Code:

    var CONFLG_HIDDEN = 32;
    var CONFLG_OUT = 2;
    var CONFLG_IN = 4;

    var utilitydata = System.CreateDO("Clintons3D Package/Utility functions");
    var currentnode = Node.FirstSelected();
    var thedata = utilitydata.GetConnectorData(currentnode);

    var allConnectors = thedata.split("\n");
    for(var i=0; i < allConnectors.length; i++) {
        var connector = allConnectors[i].split("\t");
        if( (connector[3] & CONFLG_HIDDEN) != 0) continue;

        var In = "";
        if((connector[3] & CONFLG_IN) != 0) In = "input  ";
        var Out = "";
        if((connector[3] & CONFLG_OUT) != 0) Out = "output ";

        System.Trace(In + Out + connector[0] + " - " + connector[2]);

    //connector[0] = script connector name
    //connector[1] = connector name
    //connector[2] = connector type
    //connector[3] = flags
    } 
                        
flags:

enum tagRtConFlags
{ CONFLG_DIRTY = 1,
CONFLG_OUT = 2,
CONFLG_IN = 4,
CONFLG_INOUT = 6,
CONFLG_RESERVED = 8,
CONFLG_EXPORTED = 16,
CONFLG_HIDDEN = 32,
CONFLG_CACHING = 64,
CONFLG_NONOTIFY = 128,
CONFLG_CONTROLFLOW = 256,
CONFLG_DISABLECACHING = 512,
CONFLG_REGISTERED = 1024,
CONFLG_CUSTOM = 2048,
CONFLG_TOPOLOGY = 4096,
CONFLG_LOCAL = 8192,
CONFLG_LAST = 8193
} RtConFlags;

May 19, 2013
joint orientation

Square Geometry Creator for trueSpace

This script will create a single 4 sided polygon square with uv coordinates assigned. Click the link or picture to download the script

September 5, 2009
joint orientation

Heads Up Display for trueSpace

This script demonstrates the use of the widget marker sets(IRfMarkerVisualizationDisp and IRiWidgets) to create a working analog/digital clock that always faces the viewer.

June 20, 2010
joint orientation

RGB Color Cube

A simple colored cubes generator. It uses a constant color to remove light interactions.

June 20, 2010
rgb points

RGB Color Points

A cube made of vertices. Uses IRdVertexVisualizationStream.

June 20, 2010

Test Panel Controls

Script adds UI controls, but no way to adjust them for labels, position, size etc. Controls disappear when the aspect is changed. Can make controls persistent by editing the panel.

June 20, 2010

Offline Render hooks

setup offline render hooks for jscript

steps to install offline renderer

  1. open the offline preferences
  2. create the node in the now visible Offline renderers node
  3. now can call the offline script hooks
    //
    //Add Yafaray to offline renderers
    //
    //create/open render preferences node
    ScriptObject.RunCmd("space 3d package/open offline renderer preferences");

    if(!Node.Exists("/Offline renderers/Yafaray")) {
        try {
            Node.Create("Clintons3D Package/Yafaray", "/Offline renderers");
        } catch (err) {
            System.Trace("Error: Clintons3D Package plugin should be installed first");
        }
    }
                    
August 26, 2018

Light Passthrough and Light Attribute Transfer for trueSpace7.61

2 part script for transferring a lights spot angle and color to an objects position, rotation and scale. One script goes inside the light. The other resides at the scene level.

Usage:

  1. Place the lightPassthrough script node inside the light encapsulator.
  2. Export the 2 output connectors, "angleOut" and "colorOut"
  3. Connect the "angleIn" to the outside through the "Angle" connector on the encapsulator.  Skip this step if the light isn't a spot light or the cone angle isn't animated.
  4. Connect the "colorIn" to the outside via the "Color" input connector.
  5. Add the lightAttrTransfer node to the scene level.
  6. Expand the light and connect the angleOut to the spotAngle input of the lightAttrTransfer node.
  7. Connect the colorOut of the light to the lightColor input of the lightAttrTransfer.
  8. Connect the matrixOut of the lightAttrTransfer to an object in the scene.

Now when the scene is exported to collada format the object's transforms will hold the cone angle and color animations for the light. Rotate X will hold the spot angle in degrees. Scale XYZ and Translate XYZ will hold the color values. Translate X is only valid if imported with a scale of 1. If pick whip on scale in After Effects then divide by 100 since AE converts scale 0-1 to 0-100.

Note: There is a script for an Enhanced Collada export that includes light cone and color animation export.

September 16, 2009

Camera FOV Attribute Transfer for trueSpace7.61

Script for transferring the camera FOV to an objects position, rotation and scale.

Usage:

  1. Set camera to "Exp" aspect in the LE
  2. Connect Camera output to the cam input
  3. Connect the MatrixOut to some object in the scene

Now when the scene is exported to collada format the object's transforms will hold the FOV animation for the camera. Rotate X will hold the fov in degrees. Scale X and Translate X will hold an After Effects compatible zoom value. Translate X is only valid if imported with a scale of 1 and the After Effects zoom is via pick whip and multiply by the composition height. If pick whip on scale also divide by 100 since AE converts scale 0-1 to 0-100.

Note: The collada exporter exports the camera fov from model space values and ignores the work space fov value.

Note: There is a script for an Enhanced Collada export that includes the camera's fov animation.

September 16, 2009

Procedural Modeling - Stool

stool

Adapted from a 3DBuzz Houdini Tutorial

Notes:

  • Watchdog responds to all connectors of single script object - one changes and all will send a signal to the watchdog. Maybe better to have changes that require a command script execution be on their own nodes.
  • uses an external mesh object parent for the leg, acting as a pivot for the leg
  • combines meshes via a command script combined with a Csg operation node
  • command node calls second command using ScriptObject.Execute to force synchronous update for truespace items
  • the masterControl node outputs were created via a utility script, Generate Outputs
April 11, 2019

Generate Outputs

generate outputs panel

Utility script that will read an exported scripts xml file, read the input parameters and create a new xml file with corresponding output parameters.

Usage:

  1. use the Export Script button to save an xml file
  2. choose the xml file with the ... button and press Start
  3. a new file is create - filename.xml => filename_Processed.xml
  4. use the Import Script button on the new xml file

Notes:

  • uses "Msxml2.DOMDocument.6.0"
  • each "parameter" will have a corresponding "parameterOUT" connector
  • CDATA is ignored and simply copied to the new file
  • can transfer between script objects and command scripts by editing the first lines after importing (Execute, OnComputeInputs...)
April 11, 2019

Flip Animation Scene

Inspired by Blender Animation nodes

Animation Nodes #5: Flipping Out (Tile Flip Example) by Zach Hixson

flip tile node tree

Notes:

  • torus distance from each tile is used to determine the amount of rotation on a tile
  • GridArray_Cube node is an updated script derived from the soon to be old grid array script utility
  • The distances script object computes distances from each tile to the torus outputing a number array.
  • The Number Array MapRange script object scales the values of the distances number array to result in a rotation in pitch between 0 and 180 degrees for each tile.
  • The FlipCones node performs the rotations of the tiles found inside the GridArray_Cube node using values from the number array output of the MapRange node.
  • The target tiles are defined by selecting the first clone, "meshObj"
April 11, 2019

Look At Demo Object

look at math found: https://docs.microsoft.com/en-us/previous-versions/windows/desktop/bb281710(v%3Dvs.85)

the matrix lookat script function is not working in truespace.

Move either sphere to see the lookat behavior

April 11, 2019

Sphere Collapse Scene

Inspired by Blender Animation nodes

Animation Nodes #6: Imminent Collapse (Imploding sphere effect) by Zach Hixson

Usage:

  1. select the Cube
  2. press the Copy Mesh button to populate the cubes
  3. press the Look at Center button to orient the cubes
  4. press the Select Effector to select the Torus
  5. move the Torus around

Notes:

  • Blender icosphere with 4 sub divs = 642 vertices. truespace set sphere resolution to 8 to match
  • predates the lookat math - instead uses a tailref cube connected to a headref cube via a lookat node
    • the headref is placed at (0,0,0)
    • the tailref is placed at the vertex locations of the larger sphere
    • the tailref rotation is read and copied to the individual cube matrix

Countdown Scene

Inspired by Blender Animation nodes

Stylish procedural countdown with Animation Nodes by Blenderust

Notes:

  • Final mesh output uses a "mesh instancer" node
  • Uses 3 array point accumulators to create the grid of position values for the hexagonal shapes
  • The countdown text and an invisible cube are joined together with a csg node set for intersection mode. The cube is moved to the position of each array point and the csg resulting mesh is read in. If the resulting mesh is not empty, then that hexagon shape moves up.
  • The noise motion comes from a image cloud node
  • The wave image is made from the linearGradient image included in the trueSpace Unofficial Update combined with an image curve node. It is animated using an image crop node.
  • The material uses a vertex shader to blend between the colors.
  • Uses animation of a torus going up and down to control the numbers motion. RsAnim.PutFrame is used to set the time on the torus, then it's z value was read in as a control. PutFrame only effects the one item and does not effect the rest of the scenes animations.

Instancer.RsObj - used to create a single mesh from many copies.

Array Points.RsObj - creates a 1D line of vertices given a count and offset values

Array Points Accumulator.RsObj - same as array points but takes a vertex list input to create 2D and 3D vertex arrays

TCP Sockets client

Communicate with other processes or servers via tcp sockets

util.SocketComm(text message, ip address of socket server, port number on socket server, timeout in ms - 0 means no timeout, true ==> use UDP otherwise use TCP) returns a text response

    function writeOut(val)
    {
        var result = util.SocketComm(val,"127.0.0.1", 5000, 300, false)
        System.Trace(result);
    }

    util = System.CreateDO("Clintons3D Package/Utility functions");

    writeOut('some text to send')
                    

Notes:

TruePause

A pause script node that does not freeze all trueSpace processes while it runs. This makes it possible to use a pause for something like waiting for a file to finish writing.

This is a drop in replacement for the Pause Activity node. PauseTime is in mlliseconds.

true pause script

Note: the pause activity will tend to spam the Log/Output Console with timer messages. Increasing the Period will reduce the frequency of the messages, especially for longer pause times.

March 20, 2024

  • fix bug where long pause will prevent scene item panels in the stack from updating - looking frozen

July 8, 2021

  • undo friendly version
July 1, 2020

Autoload Template

Template to use as a model for auto installers compatible with the persistent install system.

  • based on the quad toolbar installer
  • has checkbox to activate - not needed with new install button format
  • clears recent files list
  • resets toolbars
  • replace buttons and scripts and rename for a new installer

June 9, 2024

  • update for load on demand style scripts

June 28, 2023

  • update to uu9 toolbar resets from trueBlue

October 25, 2022

  • update to the latest toolbar resets from trueBlue

February 8, 2022

  • new format with install button and only auto run when batched

August 28, 2021

  • added latest toolbar resets from trueBlue

September 21, 2020

  • add sample node for widget installations
September 11, 2020

Window Frame Update and Absolute Positioning

Get and set a window frame position and size. Update the frame from values set on the node

developed because the trueSpace mouse listener only gives values relative to the active window

update window from node value

    //set value on the frame node then run this to update the window
    utilitydata = System.CreateDO("Clintons3D Package/Utility functions");
    windowFrame = "Project/Windows Manager Space/Frame Window, 2"
    utilitydata.UpdateFrameRect(windowFrame);
                    

read window position

    utilitydata = System.CreateDO("Clintons3D Package/Utility functions");
    windowFrame = "Project/Windows Manager Space/Frame Window, 2"
    value = utilitydata.GetFrameRect(windowFrame);
    obj = eval("(" + value + ")");
    left = obj.Rectangle.left;
    top = obj.Rectangle.top;
    right = obj.Rectangle.right;
    bottom = obj.Rectangle.bottom;
        //internal measurements? maybe not useful but left in for now
        //left = obj.clientRectangle.left;
        //top = obj.clientRectangle.top;
        //right = obj.clientRectangle.right;
        //bottom = obj.clientRectangle.bottom;

set window position

    utilitydata = System.CreateDO("Clintons3D Package/Utility functions");
    windowFrame = "Project/Windows Manager Space/Frame Window, 2"
    left = 80; top = 90; width = 640; height = 480;
    utilitydata.SetFrameRect(windowFrame, left, top, width, height);
                    

get window aspect

	utilitydata = System.CreateDO("Clintons3D Package/Utility functions");
	var activeWindow = WindowsManager.GetWorkWindow();

	var aspect = utilitydata.GetWindowAspect(activeWindow);
	System.Trace(aspect)

	//aspect 5=anim view, 4=3D, 2=2D, 1=1D

Notes:

  • if a window is snapped to another window, it will move but snap back if the parent window is changed.
  • if won't snap back if the new position is not touching the parent window borders
  • position is relative to the main trueSpace window upper left.
  • set position probably only works on floating windows?
  • position values can be negative
September 11, 2020

Widget Tools Installer

Comes pre-installed in C3D Persistent Install v3 (Get Points Widget, PickFaceWidget2, PickVertexWidget2)

Comes pre-installed Unofficial Updates v10 (Get Points Widget, PickFaceWidget2, PickVertexWidget2)

Installer for the PickSelect script, Get Points Widget, PickFaceWidget, PickFaceWidget2, PickVertexWidget and PickVertexWidget2 described below.

Clintons3dPlugin.rsx v.1638452 required

June 28, 2024

  • updated installer
  • GetPointsWidget updated to use new ctrl snapping option
  • installer options to include each widget

Get Points Widget

This widget will return a list of mouse intersection points with scene geometry. It's like painting points on the geometry surface.

GetPointsWidget

PickSelect

Clintons3dPlugin.rsx v.1638452 required

It uses an updated version of the PickSelect shown below. The new PickSelect has a MinDistance input used to control how close together the points can be in 3D space.

The NodeSelData will contain the last mesh and a colon seperated list of 3D points.

Installation:

  • Place GetPointsWidget inside /Widgets/Tools
  • Place PickSelect inside /Scripts/CustomCommands

Widget Commands:

Use this commands after setting the ContinueAt of the PickSelect node.

Widgets.ReplaceWidget('{5C9008D4-B6B3-4359-9E63-18D2FC228A6E}','/Widgets/Tools/GetPointsWidget','Default','','')

Example

Test Widget
var pickselect = "/Scripts/CustomCommands/PickSelect/data"
if(!Node.Exists(pickselect)) return;
var continueAt = System.ThisOwner() + "/Test Widget2"
Node.Value(pickselect, "ContinueAt") = continueAt;
Widgets.ReplaceWidget('{5C9008D4-B6B3-4359-9E63-18D2FC228A6E}','/Widgets/Tools/GetPointsWidget','Default','','')
Test Widget2
//remove markers
if(Node.Exists("/Widgets/Active Widgets Layer2/Markers"))
    Node.Delete("/Widgets/Active Widgets Layer2/Markers");
var pickselect = "/Scripts/CustomCommands/PickSelect/data"
if(!Node.Exists(pickselect)) return;
//System.Trace(Node.Value(pickselect, "NodeSelData"))
var nodeSelData = Node.Value(pickselect, "NodeSelData");
var nodeSelArr = nodeSelData.split(":");
if(nodeSelArr.length < 2) return;
for(var i=0;i < nodeSelArr.length;i++) {
    System.Trace(nodeSelArr[i]);
}

Widget Interactions:

LMB will get 1 point with each click

LMB drag will 'paint' a series of points

Ctrl snap to the nearest point

Shift no effect

RMB to end the widget and run the ContinueAt script

June 2024

  • ctrl snap to vertices
  • esc to cancel modified from the UU

Triangle and Vertex Pick Widgets

These widgets adds the ability for scripts to gather vertex and triangle selections from the user without the need to enter point edit mode.

PickFaceWidget2

PickVertexWidget2

PickFaceWidget

PickVertexWidget

PickSelect

Clintons3dPlugin.rsx v.1638423 required

pickselect

The PickSelect contains a data node with the following connectors

  • ContinueAt - script that will be run after RMB exiting the widget
  • FaceIndex - index of the last triangle selected
  • HoverColor - the color used in the markers to indicate hover state
  • NodeSelData - a colon delimited string that holds the object name and a list of triangle indices for the PickFaceWidget or a list of vertex indices for the PickVertexWidget.
  • PositionXYZ - the trace point of the selection that intersects the last triangle selected.
  • SelectedColor - the color used to highlight selected triangles/vertices

The widgets are only active for 1 object at a time. The first selection will make the object active.

Installation:

  • Place PickFaceWidget2 and PickVertexWidget2 inside /Widgets/Tools
  • Place PickSelect inside /Scripts/CustomCommands

Widget Commands:

Use these commands after setting the ContinueAt of the PickSelect node.

Widgets.ReplaceWidget('{5C9008D4-B6B3-4359-9E63-18D2FC228A6E}','/Widgets/Tools/PickFaceWidget2','Default','','')

Widgets.ReplaceWidget('{5C9008D4-B6B3-4359-9E63-18D2FC228A6E}','/Widgets/Tools/PickVertexWidget2','Default','','')

Widget Interactions:

LMB will select 1 triangle/vertex for PickfaceWidget and PickVertexWidget

LMB will 'paint' select triangles/vertices for PickfaceWidget2 and PickVertexWidget2

Ctrl + LMB will add to the selection

Shift + LMB will remove from the selection

Ctrl + Shift + LMB will toggle the selection for PickVertexWidget and PickFaceWidget - unreliable and only good for click selections

RMB to end the widget and run the ContinueAt script

"PickFace" really means "PickTriangle"

"PickVertex" is really picking a triangle then getting the vertex of that triangle closest to the intersection point.

October 23, 2020

  • new paint selection widgets PickFaceWidget2, PickVertexWidget2
  • new cursors for triangle and vertex widgets
  • widgets read dot size from the UI
October 13, 2020

Status Line

Status Message autoloader copied from the Unofficial Update. Loads from preobjects.

Updating the status line from script adds to the undo history. This plugin based status line does not.

Set status message with a 5000 mS delay before clearing the message
var util = System.CreateDO("Clintons3D Package/Utility functions");
util.SetStatusMessage("Some message here", 5000);

Clear status message and do not clear the Model status, only clear the workspace ":" status
var util = System.CreateDO("Clintons3D Package/Utility functions");
var clearModelStatus = false;
util.ClearStatusMessage(clearModelStatus)

October 14, 2020

Resource Hacker

Resource Hacker can be used to look inside and change exe and dll files

http://www.angusj.com/resourcehacker/

ts7.exe contains the splash screen image

tSCommon.dll contains button icons and images

WindowsManager.dll contains button icons

October 14, 2020

Wait for file to write

trueSpace will start to write files and immeditely return to running other code. This node is used to wait for the complete write before moving forward to other tasks.

Usage:

  1. var pause = 1000;
  2. var WaitFS = Node.AccessFnSet(System.ThisOwner() + "/WaitForFileToWrite/WaitFS");
  3. WaitFS.SetFileName(filename);
  4. Node.Value(System.ThisOwner() + "/WaitForFileToWrite/TruePause", "PauseTime") = pause;
  5. save the file

PauseTime is how long to wait after the last file update time. Useful for the case where the file is updated several times before the final write. In the sample above, 1000 => 1 sec of no updates is used as an indicator that it's done writing the file.

January 29, 2021

No Undo Commands

Collection of script commands that do not add to the undo history.

Usage:

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • util.xxx(yyy, zzz, ...)
  • the associated nodes and connectors must exist for all these commands. Ex. if you try to delete a non-existent node it will error out

Commands - prefix as shown above

  • ConRename(BSTR bszNode, BSTR bszConnector, BSTR bszNewName );
  • ConRemove(BSTR bszNode, BSTR bszConnector );
  • ConnectTo(BSTR bszNode, BSTR bszConnector, BSTR bszOtherNode, BSTR bszOtherConnector );
  • Disconnect(BSTR bszNode, BSTR bszConnector, BSTR bszOtherNode, BSTR bszOtherConnector );
  • Rename(BSTR bszNode, BSTR newName ); - will fail silently if name is already taken and does not return the new name
  • Copy(BSTR bszNode, BSTR bszDestNode ); - this command returns the full path of the new node
    bszNode='' will copy the first selected node
    bszDestNode='' will use the owner node of the bszNode
  • Delete(BSTR bszNode );
    bszNode='' will delete the first selected node
  • DisconnectAll(BSTR bszNode); - ends up this command is not the same as the script command. The script command removes all connections on 1 connector, this command removes all connections on all connectors of a node.
  • SetNodeValueFloat(BSTR bszNode, BSTR bszConnector, float value );
  • SetNodeValueInt(BSTR bszNode, BSTR bszConnector, int value );
  • SetNodeValueUnsigned(BSTR bszNode, BSTR bszConnector, unsigned int value );
  • SetNodeValueString(BSTR bszNode, BSTR bszConnector, BSTR value );
  • SetNodeValueColor(BSTR bszNode, BSTR bszConnector, float red, float green, float blue, float alpha );
  • SetNodeValueColorRGB8(BSTR bszNode, BSTR bszConnector, unsigned int red, unsigned int green, unsigned int blue );
  • SetNodeValueMatrix(BSTR bszNode, BSTR bszConnector,
    float i00, float i10, float i20, float i30,
    float i01, float i11, float i21, float i31,
    float i02, float i12, float i22, float i32,
    float i03, float i13, float i23, float i33);
    - this command uses the same layout as the matrix.setat command

Easier function to use for SetNodeValueMatrix

function SetNodeValueMatrix(node, conn, matrix)
{
    var util = System.CreateDO("Clintons3D Package/Utility functions")
    util.SetNodeValueMatrix(node, conn, 
            matrix.GetAt(0,0), matrix.GetAt(1,0), matrix.GetAt(2,0), matrix.GetAt(3,0),
            matrix.GetAt(0,1), matrix.GetAt(1,1), matrix.GetAt(2,1), matrix.GetAt(3,1),
            matrix.GetAt(0,2), matrix.GetAt(1,2), matrix.GetAt(2,2), matrix.GetAt(3,2),
            matrix.GetAt(0,3), matrix.GetAt(1,3), matrix.GetAt(2,3), matrix.GetAt(3,3)
    );
}

Equivalent Node.ReconnectFrom

Node.ReconnectFrom(SourceNode1, SourceNode1Conn, SourceNode2, SourceNode2Conn, Destination, DestinationConn);
===

  1. util.ConnectTo(SourceNode2, SourceNode2Conn, Destination, DestinationConn);
  2. util.Disconnect(SourceNode1, SourceNode1Conn, Destination, DestinationConn);

v1638431

  • altered commands so not error out from invalid node:
    ClearStatusMessage, ConnectTo, ConRemove, Delete, Disconnect and DisconnectAll
May 17, 2021

Anim View Aspect

Get the anim view aspect, 1 - Dope, 2 - FCurve, 3 - Story

Usage:

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • ava = util.GetAnimViewAspect("Project/Windows Manager Space/Frame Window, 2/AnimView Node")
Jan 31 2022

Plugin Status

Get the plugin status, "PACKAGE_INSTALLED", "PACKAGE_LOADED", "PACKAGE_UNINSTALLED".
This is useful for the View sample based plugins.

Usage:

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • plugStat = util.GetPluginState("Clintons3d ViewPlugin Package")

Name is from the "Name" field of the Package manager window.

Jan 4 2023

MaterialLookupTable for CSG node, IRdMaterialLookupTable

"Material lookup table data object used for translating material indices"

Can be used when manually setting up booleans in the node editor.

Testing seems to indicate the node name is the short name of the node, not the full path

MergeMaterialLists solves the problems of: What happens when materials repeat? How handle it? Scene instanced materials kindof makes sense but no instancing?
also solves the issue of updating the material index when copying raw material nodes and hooking them up manually.

CreateMaterialLookup:

Creates the MaterialLookupTable in memory. This is the first step to working with the material lookups.

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • util.CreateMaterialLookup(bszNode, bszConn)
    • bszNode, bszConn are the "Csg operation" node and it's "Material A" or "Material B" connector to use as a starting point for the table
    • set params both to "" to create an empty material lookup table

MaterialLookupAddNode:

Add a node to the materia lookup in memory or just return it's index in the table

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • nodeindex = util.MaterialLookupAddNode(bszNode, getnodeindex)
    • bszNode is the name of the mesh node(short name not full path)
    • getnodeindex = true to only read the index for the node, false to add the node and return the index
    • returns the index of the node in the table

AddMaterialLookup:

set a material index translation for the table in memory for the node from the source node material index to the destination boolean material index

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • util.MaterialLookupAddNode(nodeindex, sourceindex, destindex)
    • nodeindex is the index of the node in the material lookup table
    • sourceindex, destindex = original node material index and the new csg material index

AssignMaterialLookupTable:

save the material lookup table from memory into the Csg operation node

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • util.AssignMaterialLookupTable(bszNode, bszConn)
    • bszNode, bszConn are the "Csg operation" node and it's "Material A" or "Material B" connector

GetMaterialLookup:

read material lookup table data from memory

large return numbers indicate invalid values.
when returning the count the values for source and destination index are invalid, otherwise the count is invalid with source and destination containing actual values

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • countsourcedest = util.GetMaterialLookup(nodeindex, lookupindex, getcount)
    • nodeindex is the index of the node in the material lookup table
    • lookupindex is the index of the translation from the source node to csg material index
    • getcount when true will return the count instead of the translation indices
    • returned value is a comma separated list of the number of translation pairs or source index and destination index for the given node index

MergeMaterialLists:

from the IRfMaterialListSet

merge materials together returning a translation list of indices for the second object

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • translations = util.MergeMaterialLists(DestinationNode, NodeToAdd)
    • DestinationNode is the material list encapsulator or the object that contains the material list encapsulator node
    • NodeToAdd is the material list encapsulator or the object that contains the material list encapsulator node to be added to the destination
    • returned value is a comma separated list of translations for the source index and destination index for the node whos materials was added
      format is "original index1, new index1, original index2, new index2..."

This command works with the Material List encapsulator node.
This command will automatically find the node when it's containing node is passed in.
This is true for the node that gets attached to the IRfMaterialListSet and the node whos materials are merged in.

June 26, 2024

MaterialList

IRfMaterialListSet expose some functions to scripting

GetMaterialIndices:

list of material indices given Material List Encapsulator ? maybe also the whole object node?.

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • indicesString = util.GetMaterialIndices(bszNode)
    • bszNode is the Material List Encapsulator ? maybe also the whole object node?
    • indicesString is comma separated list, indicesArr=indicesString.split(",")

GetMaterialNode:

get the material node given the index and the Material List Encapsulator ? maybe also the whole object node?.

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • matNode = util.GetMaterialNode(bszNode, index)
    • bszNode is the Material List Encapsulator ? maybe also the whole object node?
    • index is the material index

works with instanced materials

GetInstancedMaterialNode (really "GetMaterialShortName") :

get the material short name given the index and the Material List Encapsulator or Material List Manager, maybe also the whole object node?.

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • matNode = util.GetInstancedMaterialNode(bszNode, index)
    • bszNode is the Material List Encapsulator or Material List Manager, maybe also the whole object node?
    • index is the material index

SetMaterial:

set material will connect a material to the Material List Manager

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • util.SetMaterial(bszAttachedNode, bszNode, index)
    • bszAttachedNode is the Material List Encapsulator ? maybe also the whole object node?
    • bszNode is the Material encaps node
    • index is the material index of the material to be added

RemoveMaterial:

delete a material but result will disconnect the last material. should work as "expected" on the last material only?

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • util.RemoveMaterial(bszNode, index)
    • bszNode is the Material List Encapsulator ? maybe also the whole object node?
    • index is the material index of the material to be removed

MaterialIsEqual:

compare 2 materials to see if they produce the same appearance
not fully tested, is it appearance or conns and conn values?

testing seems to indicate that only inputs that effect the material appearance are used for the comparison

testing shows this command to be unreliable when used with scene instanced materials

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • util.MaterialIsEqual(byorder, bszNode, index, bszNode2, index2)
    • byorder - true then use GetMaterialGenericByOrder, otherwise GetMaterialGeneric is run
      scene instanced giving a lot of strange results either way, sometimes works sometimes not work
      better to use more direct means to compare scene instanced materials(GetMaterialNode)
    • bszNode is the Material List Encapsulator, maybe can also the whole object node?
    • index is the material index of the material to be compared
    • bszNode2 is the second Material List Encapsulator
    • index2 is the material index of the second material to be compared
July 16, 2024

Mesh Commands

GetFacesUnities:

get a comma separated list of each triangle's polygon face index, supply the path to the "Shape" or "Editable shape" node

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • FacesUnities = util.GetFacesUnities(theMeshNode);

GetVertexTopology:

get a comma separated list of each triangle index that the given vertex is a part of,
supply the path to the "Shape" or "Editable shape" node and a vertex index

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • VertexTopology = util.GetVertexTopology(theMeshNode, index );

Vertex Colors

Requires special material setups to see the vertex colors. Vertex colors will disappear from a mesh if the mesh has geometry added or taken away. They will also disappear on shape changes if the mesh edit settings autotriangulation option is not set to "None".

FillVertexColor:

fill the supplied mesh's vertices with the desired color
supply the path to the "Shape" or "Editable shape" node and a color

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • util.FillVertexColor(theMeshNode, VertexColor, doFloatColor )
    VertexColor is a comma separated string in the form of "red, green, blue"
    doFloatColor is true if using floating point numbers (0 - 1) and false if using integers between 0 and 255

SetVertexColor:

set the color for a single mesh vertex
supply the path to the "Shape" or "Editable shape" node, a vertex index and a color

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • util.SetVertexColor(theMeshNode, vertexIndex, VertexColor, doFloatColor )
    vertexIndex is the index number of the vertex to paint
    VertexColor is a comma separated string in the form of "red, green, blue"
    doFloatColor is true if using floating point numbers (0 - 1) and false if using integers between 0 and 255

GetVertexColor:

get the color of a single vertex in a string of the form "red, green, blue"
supply the path to the "Shape" or "Editable shape" node and a vertex index

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • VertexColor = util.GetVertexColor(theMeshNode, vertexIndex, doFloatColor )
    vertexIndex is the index number of the vertex to paint
    doFloatColor is true will return floating point numbers (0 - 1) and if false will return integers between 0 and 255
    VertexColor will contain a comma separated string in the form of "red, green, blue"

CopyBitmapToVertices:

copy the colors from a bitmap texture onto the mesh vertices
supply the path to the bitmap node, the bitmap connector name, the "Shape" or "Editable shape" node, u and v offsets, wrap/clamp and the uv channel to use

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • CopyBitmapToVertices(BitmapNode, BitmapConn, MeshNode, uOffset, vOffset, wrap, uvChannel);
    BitmapNode is the node that has a bitmap connector
    BitmapConn is the name of the connector
    uOffset and vOffset will be added to the mesh uv values when looking up the bitmap color
    wrap will use repeating uv values when true and clamped values when false
    uvChannel is the uv channel used to read the bitmap colors, it is 1 or 2 and the uv channel must exist in the mesh

Vertex Paint Widget

used with the vertex painting script to apply colors to a mesh using a simple brush
This tool will continuously erase undo history, because running undo during or after using the widget will crash trueSpace.

trueSpace vertex colors do not have alpha value and are internally limited to the integer values between 0 and 255. So floating point values will really be a stepped value multiple of 1/255.

Misc Commands

CopyNodeValue:

copy a value from one source node to another destination node without creating an undo entry

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • util.CopyNodeValue(sourceNode, sourceConnector, destinationNode, destinationConnector )

ConReset:

reset a node connector without creating an undo entry

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • util.ConReset(Node, Connector, Node2, Connector2 );

The ConReset works the same as the original Node.ConReset except it has 2 extra arguements. The second 2 are for reading the default value that will be applied to the first 2. This is needed bacause the default value may be active on an internal node.
If the node connector does not have any internal connections then repeat the first 2 arguments in the second spots.
If the connector has an internal connector trace it back to the node that has the default value and use it in the second set of arguments.

ExportConnector (no undo version):

Export a connector and prevent undo - blank undo may be created. Similar to Node.ExportConnector

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • util.ExportConnector(SourceNode, SourceConn, bConnect, bSetValue)
    SourceNode - the node to export form
    SourceConn - the name of the connector to export
    bConnect - Connect immediately flag, "If true, also connect original connector to connector just created on encapsulator."
    bSetValue - Set value immediately flag, "If true, also transfer value from exported to new connector"
  • The util version does not include the 3rd arguement used in the Node version. based off of IRfEncapsulatorSet::ExportConnector

SetActiveMaterial2

Loads a material directly into the Material Editor.

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • util.SetActiveMaterial2(MaterialNode, ForceCopy)
    MaterialNode - the node that defines the material
    ForceCopy - if true ignore the "Edit picked material directly" option and make a copy of the material to work on

RemoveUnusedMaterials

RemoveUnusedMaterials will remove orphan materials from the selected node

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • util.RemoveUnusedMaterials(MaterialNodeEncaps)
    MaterialNodeEncaps - node that contains the materials ex) "/Project/Space 3D/Materials" for scene instanced materials

GetScriptBody

Get the text content of a script node

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • text = util.GetScriptBody(ScriptNode)
    ScriptNode - command, object or function set node path

SetScriptBody

Set the text content of a script node

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • util.SetScriptBody(ScriptNode, text)
    ScriptNode - command, object or function set node path
    text - content of the script code

SaveScriptToFile

Save xml format of the script node

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • util.SaveScriptToFile(ScriptNode, filename)
    ScriptNode - command, object or function set node path
    filename - xml file to write to

LoadScriptFromFile

Load xml format file into the script node

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • util.SaveScriptToFile(ScriptNode, filename)
    ScriptNode - command, object or function set node path
    filename - xml file to read from

GetNodeValueXXX commands can be used inside toolbar buttons where xxx=Node.Value does not. Also useful inside widget script command nodes.

GetNodeValueInt, GetNodeValueFloat

get integer and float values from a node

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • intVal = util.GetNodeValueInt(theNode, theConn)
    fltVal = util.GetNodeValueFloat(theNode, theConn)
  • GetNodeValueInt can be used to read a boolean connector value

GetNodeValueString

Get the text content, color or matrix value from a node

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • strVal = util.GetNodeValueString(theNode, theConn)
  • Color conn will return a comma separated string in the form of "red, green, blue"
  • matrix conn will return a comma separated string in the column matrix form of "m00, m01, m02...m33"
  • use matrix.SetAt(0, 0, m00)... matrix.SetAt(3, 3, m33)

GetLinkedInputNodeAndConn:

similar to the built in Node.LinkedInputNode command but returns the node at index 0 and the connector of the node

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • result = util.GetLinkedInputNodeAndConn(theNode, theNodeConnector )
  • result will be tab seperated text = "linked input node [tab] linked input node output connector"
  • invalid values will return an empty string

GetLinkedInputNodeAndConn2:

similar to the built in Node.LinkedInputNode command but also returns the connector of the linked node

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • result = util.GetLinkedInputNodeAndConn2(theNode, theNodeConnector, index )
  • result will be tab seperated text = "linked input node [tab] linked input node output connector"
  • invalid values will return an empty string

GetLinkedOutputNodeAndConn2:

similar to the built in Node.LinkedOutputNode command but also returns the connector of the linked node

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • result = util.GetLinkedOutputNodeAndConn2(theNode, theNodeConnector, index )
  • result will be tab seperated text = "linked input node [tab] linked input node output connector"
  • invalid values will return an empty string

GetLinkedOutputNodeAndConn2 has the same bugs as the Node.GetLinkedOutputNode and requires special processing. Also not that if the node is selected it may be connected to a "Widget" on the WldMatrix output.

for(var i=0; i< Node.LinkedOutputNodeCount(firstsel, "WldMatrix");i++) {
    var outnode = Node.LinkedOutputNode(firstsel, "WldMatrix", i);
    if(outnode && Node.Exists(outnode)) {
        System.Trace(i + " " + outnode );
        result = util.GetLinkedOutputNodeAndConn2(firstsel, "WldMatrix", i+1)
        System.Trace("result " + result)
    }
}

,:

will copy the contents of one node into another

  • util = System.CreateDO("Clintons3D Package/Utility functions");
  • result = util.CopyNodeContent(destinationEncapsNode, sourceEncapsNode, bCopySrcCons )
  • bCopySrcCons - when true it will copy all the node connectors and their values

The plan is to use this with a new discovery. Node.Create for a kernel DummyEncaps will not be selectable in the 3D view. Used for Kernel Object and the result is selectable. So make new unselectable script that does not depend on widget additions.

Jan 19, 2023

Procedural Room

room

Room uses booleans to cut out holes for the door and the window. The script has controls for size and for which wall the window and door appear.

Notes:

  • all csg nodes are at the same heirarchy level
  • each csg node has a render attribute so the door, window and previous steps of the booleans can be hidden
  • units are in inches and feet
June 18, 2021

Custom Watchdog

setup setup exp

Exp aspect above far right shows the result of adding one of each of the input types, BoolVal, IntVal, MatrixVal, NumVal, StrVal and StrEnumVal. Timeout and SingleShot are only used during setup.

Truespace watchdogs can be unreliable. This is an alternative means to setup a watchdog behavior type node.

Setup:

  • Single Shot - watchdog will only run 1 time. It will need to be activated for every run.
  • Timeout - amount of time that will go by before stopping the watchdog. -1=never timeout
  • Boolean, Integer, Matrix, Number, String, String Enum - create inputs for the different types of connectors
  • Remove Unused - if added inputs are not connected remove them (not really all that useful)
  • Flatten - remove nodes used to build the watchdog

After setup connect the inputs in the Exp aspect.

If Timeout is used, the TimeoutDetected will fire off after the time is up.

Use Defaults aspect to activate, deactive and set the period for the watchdog

For normal operation the Activate/Deactivate would be run via code. This is one of the differences from the standard watchdog in that it needs to be activated.

April 19, 2024

RSX Plugin History

May 30, 2023

  • v1638443
  • utility GetSelectedFaceTriangle replacement for built in command of the same name that crashes tS

May 15, 2023

  • v1638442 - this is the plugin version found in the Unofficial Updates v9
  • fix GetTriangleNeighbors to work with active pe selections - was a crash bug
  • fix PolygonToTriangles function which would fail when the polygon normal had equal x and y values

March 17, 2023

  • v1638441
  • fix some mesh based utilites so they work properly when a point edit selection is active
  • GetVertexColor, CopyBitmapToVertices, FillVertexColor, GetVertexTopology, GetFacesUnities, SetVertexColor
  • vertex paint widget - pe mode changes had no effect
  • dll file added copyright and author information

February 18, 2023

  • v1638440
  • fix bug in status message timeout

February 10, 2023

  • v1638439
  • vertex paint crash bug

February 6, 2023

  • v1638438
  • fix issue with vertex color paint widget switching from gray view to color view
  • fixed major undo issue with vert color widget - was clearing history to avoid crashes
  • note that the above fix required adding an RsApp.Undo to the widget closing script - odd fix to stop frozen tS
  • new GetMaterialId command to replace old SetName, GetName
  • new GetInstancedMaterialNode makes get material id obsolete

January 29, 2023

  • v1638437
  • added no-undo ExportConnector
  • fix vertex paint bugs and design issues - add new profile, fill shortcut to widget
  • fix CopyBitmapToVertices math and use of uv2
  • removed OpenNL used in uv unwrap - never worked well
  • removed mongoose web server - old test code

January 21, 2023

  • v1638436
  • fix crash bug when exit vertex paint without painting
  • fix vertex paint brush scaling with the mesh

January 19, 2023

  • v1638435
  • some new mesh and misc commands
  • vertex colors widgets and commands

Jan 4, 2023

  • v1638434
  • add GetPluginStatus

Feb 3, 2022

  • v1638433
  • update keykeyframedata format
  • new GetEditableTrackName
  • note: could not find any way to get the active clip on the active track

Feb 1, 2022, Feb 2, 2022

  • v1638433
  • get keyframe data added min and max times
  • new GetSelectionRegion
  • new GetAnimViewVisible
  • new SetAnimViewVertical
  • new SetAnimVisibleInterval

Jan 31, 2022

  • v1638432
  • get view aspect for anim view

Dec 11, 2021

  • v1638431
  • fix image cloud color option
  • remove errors for "no undo" script commands - fail silently like the original Node commands

September 6, 2021

  • v.1638430
  • rectangle selection widget improvements - frustum bounding box culling
  • fix bug in sdk file RsSelectionHelper.h - documented below

August 18, 2021

  • v.1638429
  • Status Message will work in CustomCommands as well as root

May 17, 2021

  • v.1638428
  • "no undo" versions of various script commands

February 6, 2021

  • v.1638427
  • commands for status line updates - no effect on undo system

January 3, 2021

  • v.1638426
  • new open file dialog

December 11, 2020

  • v.1638425
  • new get points widget

October 27, 2020

  • v.1638424
  • fix unselectable to work properly with grouped items - was only looking at top group not child nodes
  • remove trueBlue mod for unselectable

October 23, 2020

  • v.1638423
  • new paint style triangle and vertex pick widgets
  • triangle and vertex pick widgets read dot size from UI

October 13, 2020

  • pick triangle and vertex widgets
  • v.1638422

October 5, 2020

  • add string type check for lock selection widget
  • NURBS code memory initialization issues fixed, manually create knots and weights for curves and patches
  • use Polyline function to create NURBS curve data
  • v.1638421

September 29, 2020 - re-release

  • altered lock selection widget to look at the node and the node conn value as well as looking at the exported conn value
  • NURBS - debug lies, the weight values for cps have to be set, debug mode was making it's own default values
  • fixed some non-sense NURBS code for knots that was hidden by debug default fill ins

September 28, 2020

  • update lock selection widget to look for lock connector instead of lock node
  • version v.1638420
  • NURBS primitives - box, sphere, cone/cylinder, torus
  • NURBS node to convert control points input into NURBS patch output
  • NURBS circle and half circle

September 21, 2020

  • version v.1638419
  • lock selection widget
  • rectangle widget
  • rectangle select code

September 11, 2020

  • version v.1638417
  • update frame window from frame node values
  • get and set window position and size

April 5, 2020

  • update/fix normalmap node
  • Node.Create("Clintons3D Package/Bump2Normal",Space.CurrentScene());
  • version v.1638415 - oops no new number

January 18, 2020

  • add normals generation node
  • Node.Create("Clintons3D Package/Mesh Normals", Space.CurrentScene());
  • version v.1638415

October 15, 2019

  • update sockets processing to include udp and timeout parameters
  • still version v.1638414 - forgot to update

August 25, 2019

  • plugin version v.1638414
  • collada import fixes
  • add node persistentID to the Node Connectors Info

April 30, 2019

  • plugin version v.1638413
  • updated composite nodes - all are fast now, added new Resample Node
  • sockets processing - for use with 3Delight python NSI system

June 21, 2018

  • flipped the horizontal orientation for the procedural textures
  • new file dialog
  • plugin version v.1638412

May 22, 2018

  • render engine hooks for renderman, indigo and yafaray
  • added procedural texture generation
  • updated the folder dialog
  • version v.1638411

May 31, 2017

  • improved triangle neighbors function
  • polygons to triangles function
  • version v.1638408

April 8, 2017

  • keyframe data returns empty object if nothing found or no keys after time
  • version v.1638407

May 29 2016

  • version v.1638406
  • speed increase for some compositing nodes
  • started sane naming for compositing node files

August 17, 2015

  • fix save as dialog for reliability and compatibility with windows 10

April 8 2015: read keyframe data

April 17 2014: point visualization code, source code not up to date

March 23 2014:

  • added a version of the psk importer that produces standard skeletons
  • mongoose webserver code for ui experimentation
  • simple uv unwrap code
  • version 1638405 - April 6 2014
June 5, 2013