After Effects
More info here
Collection of notes for use and development on 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
Note: may require VC++ runtime 2008 sp1 from Microsoft. (2010) Get it if the plugin does not install.
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 ,"
//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
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
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.
version v.1638406
Note: may require VC++ runtime 2008 sp1 from Microsoft. (2010) Get it if the plugin does not install.
Contains the tif loader, exr loader, png saver command and exr saver commands
Unzip and copy all 3 files together
Native trueSpace will not save png files with an alpha channel
trueSpace will not save exr format images - ?and hdr has issues?
save bitmap to a exr file with or without an alpha channel
RGB no Alpha command
save a bitmap to a png file that supports alpha values
Source code: Clintons3dExtSource.zip
This bug will crash tS if the command is run
var thesel = System.CreateDO("Space 3D Package/Selection Data"); thesel = Node.Value(firstSel, "Selection"); bobobo = thesel.GetSelectedFaceTriangle(0)
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);
The RsSelectionHelper.h file included in the DK has a bug that prevents selections unless something is already selected.
// 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;
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.
A fast version of the Caligari Image Cloud script created by Norm Fortier and based on the SDK height field sample code.
Connectors:
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());
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.
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.
This script demonstrates the use of the Microsoft Speech API using a jscript command node.
Voices:
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.
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
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
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);
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);
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);
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);
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.
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" } ] } ] } }
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;
This script will create a single 4 sided polygon square with uv coordinates assigned. Click the link or picture to download the script
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.
A simple colored cubes generator. It uses a constant color to remove light interactions.
A cube made of vertices. Uses IRdVertexVisualizationStream.
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.
setup offline render hooks for jscript
steps to install offline renderer
// //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"); } }
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:
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.
Script for transferring the camera FOV to an objects position, rotation and scale.
Usage:
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.
Adapted from a 3DBuzz Houdini Tutorial
Notes:
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:
Notes:
Inspired by Blender Animation nodes
Animation Nodes #5: Flipping Out (Tile Flip Example) by Zach Hixson
Notes:
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
Inspired by Blender Animation nodes
Animation Nodes #6: Imminent Collapse (Imploding sphere effect) by Zach Hixson
Usage:
Notes:
Inspired by Blender Animation nodes
Stylish procedural countdown with Animation Nodes by Blenderust
Notes:
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
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')
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.
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.
Template to use as a model for auto installers compatible with the persistent install system.
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
//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);
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;
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);
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
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.
This widget will return a list of mouse intersection points with scene geometry. It's like painting points on the geometry surface.
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.
Use this commands after setting the ContinueAt of the PickSelect node.
Widgets.ReplaceWidget('{5C9008D4-B6B3-4359-9E63-18D2FC228A6E}','/Widgets/Tools/GetPointsWidget','Default','','')
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','','')
//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]); }
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
These widgets adds the ability for scripts to gather vertex and triangle selections from the user without the need to enter point edit mode.
The PickSelect contains a data node with the following connectors
The widgets are only active for 1 object at a time. The first selection will make the object active.
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','','')
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.
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)
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
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.
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.
Collection of script commands that do not add to the undo history.
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) ); }
Node.ReconnectFrom(SourceNode1, SourceNode1Conn, SourceNode2, SourceNode2Conn, Destination, DestinationConn);
===
Get the anim view aspect, 1 - Dope, 2 - FCurve, 3 - Story
Get the plugin status, "PACKAGE_INSTALLED", "PACKAGE_LOADED", "PACKAGE_UNINSTALLED".
This is useful for the View sample based plugins.
Name is from the "Name" field of the Package manager window.
"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.
Creates the MaterialLookupTable in memory. This is the first step to working with the material lookups.
Add a node to the materia lookup in memory or just return it's index in the table
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
save the material lookup table from memory into the Csg operation node
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
from the IRfMaterialListSet
merge materials together returning a translation list of indices for the second object
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.
IRfMaterialListSet expose some functions to scripting
list of material indices given Material List Encapsulator ? maybe also the whole object node?.
get the material node given the index and the Material List Encapsulator ? maybe also the whole object node?.
works with instanced materials
get the material short name given the index and the Material List Encapsulator or Material List Manager, maybe also the whole object node?.
set material will connect a material to the Material List Manager
delete a material but result will disconnect the last material. should work as "expected" on the last material only?
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
get a comma separated list of each triangle's polygon face index, supply the path to the "Shape" or "Editable shape" node
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
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".
fill the supplied mesh's vertices with the desired color
supply the path to the "Shape" or "Editable shape" node and a color
set the color for a single mesh vertex
supply the path to the "Shape" or "Editable shape" node, a vertex index and a color
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
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
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.
copy a value from one source node to another destination node without creating an undo entry
reset a node connector without creating an undo entry
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.
Export a connector and prevent undo - blank undo may be created. Similar to Node.ExportConnector
Loads a material directly into the Material Editor.
RemoveUnusedMaterials will remove orphan materials from the selected node
Get the text content of a script node
Set the text content of a script node
Save xml format of the script node
Load xml format file into the script node
GetNodeValueXXX commands can be used inside toolbar buttons where xxx=Node.Value does not. Also useful inside widget script command nodes.
get integer and float values from a node
Get the text content, color or matrix value from a node
similar to the built in Node.LinkedInputNode command but returns the node at index 0 and the connector of the node
similar to the built in Node.LinkedInputNode command but also returns the connector of the linked node
similar to the built in Node.LinkedOutputNode command but also returns the connector of the linked node
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
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.
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:
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:
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 8 2015: read keyframe data
April 17 2014: point visualization code, source code not up to date