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

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

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

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

November 22, 2009

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

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
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

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

Mass Export scripts

Export all scripts under the selection to xml files. This is useful for searching all scripts. Visual Studio Code "find in files" works well to see and search all the scripts in one easy location.

Usage:

  1. load the script and ctrl-drag it out of the panel
  2. close all open link editor windows
  3. choose an object - say "Scripts/Commands"
  4. (optional) open an output console for feedback
  5. press run
  6. wait for it to finish without touching the computer
  7. check Export Only Simple to export scripts from simple script command nodes

All the scripts inside the selected node will export as xml files to an ExportedScripts folder in the tS directory. The simple scripts will export to a text file with a "SimpleCommands_" prefix.
The folder structure will reflect the tS hierarchy.
Repeat names will be given a random postfix to differentiate the scripts.

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

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:

pathdata = System.CreateDO("Clintons3D Package/Utility functions");
thedata = pathdata.GetFolderDialog();
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.

Code sample:

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 + ")");

	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

Clintons3D Plugin Ext package

Collection of plugin code that requires external files to operate

Only contains the tif loader at this time

Tiff Loader.zip contains all the required files in one zip archive.

Source code: Clintons3dExtSource.zip

  • Based on LibTIFF v3.6.1, http://www.libtiff.org/
  • Requires jpeg62.dll and libtiff3.dll placed in the same folder as the rsx file
  • Any other code that depends on external files will be added to this rsx plugin
April 28, 2019

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

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 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

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

Clintons3dPlugin.rsx v.1638425 required

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.1638425 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 no effect

Shift no effect

RMB to end the widget and run the ContinueAt script

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 into CustomCommands for c3dc persistent compatibility.

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 for 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

  • 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 );
  • Copy(BSTR bszNode, BSTR bszDestNode ); - this command returns the full path of the new node
  • Delete(BSTR bszNode );
  • 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)
    );
}

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

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
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
June 5, 2013