Category Archives: Uncategorized

trueSpace Script ComboBox Control

var scriptListUI = System.CreateDO(“Common Data Package/String Enum Data”);

//scriptListUI.SetComboCtrlStyle(1);// CBS_SIMPLE, same as 0 or 0 has no meaning
//scriptListUI.SetComboCtrlStyle(2);// CBS_DROPDOWN – can type in the dropdown field
scriptListUI.SetComboCtrlStyle(3);// CBS_DROPDOWNLIST – cannot type in the dropdown field
//scriptListUI.SetComboCtrlStyle(256+3);// CBS_DROPDOWNLIST CBS_SORT

http://www.jasinskionline.com/WindowsApi/ref/other/classes/combobox.html
Const CBS_AUTOHSCROLL = &H40
Const CBS_DISABLENOSCROLL = &H800
Const CBS_DROPDOWN = &H2
Const CBS_DROPDOWNLIST = &H3
Const CBS_HASSTRINGS = &H200
Const CBS_LOWERCASE = &H4000
Const CBS_NOINTEGRALHEIGHT = &H400
Const CBS_OEMCONVERT = &H80
Const CBS_OWNERDRAWFIXED = &H10
Const CBS_OWNERDRAWVARIABLE = &H20
Const CBS_SIMPLE = &H1
Const CBS_SORT = &H100
Const CBS_UPPERCASE = &H2000

trueSpace Bridge

tS7.6 bridge runs in both directions
tS7.61 only runs from model to workspace

no tSBridge in the SDK so no rsx plugin is possible

3D view does not synchronize, camera view does

tS7.6 sync speed from workspace to modelspace is slower than the reverse direction

tSBridge.AnimationFrame = 11; updates the model time and object if it is animated in model
tSBridge.PutActiveFrame(”, 10); updates the model time but not the object animated position, seems meant to be used as a first step to autokey motion animation

Desktop option “Support Model Procedural Animation” updates the BridgeLoop connector and I think it is the SetBridgeHalfLoop command
from sdk docs, “allows you to make an action with object in Modeler e.g. move a 3D object, then execute a script action in workspace and at the same time synchronize the scene with again Modeler”
Probably won’t work because 7.61 only syncs in one direction.

Huge BUG: If multiple objects are selected when opening a new Model view, they will be duplicated multiple times.

If any objects have default Wokspace naming like “Cube, 1” and “Torus, 5” they will be renamed instantly to Model default names “Cube,1” and “Torus,1”. The space is removed after the comma.

HUGE BUG: Anything to do with Python will make tS unstable and crash it when closing a Model view. Open the Python editor, close it and close Model view for an instant crash. Run a python script without opening the editor instant crash when close Model view, even if the python script is empty.

tS Shader VectorFromToComponents

The built in shader components, VectorFromComponents and VectorToComponents have XYZ and W connectors. The W seems to have an effect on the XYZ values, like its a kind of pre-multiplied alpha. The following HLSL scripts use pure XYZ vector math without the W.

Vector3ToComponents

void NewFunction(in RtFloat3 Vector3, out RtFloat X, out RtFloat Y, out RtFloat Z)
{
	X = Vector3.x;
	Y = Vector3.y;
	Z = Vector3.z;
}

Vector3FromComponents

void NewFunction(in RtFloat X, in RtFloat Y, in RtFloat Z, out RtFloat3 Vector3)
{
	Vector3.x = X;
	Vector3.y = Y;
	Vector3.z = Z;
}

Widget Notes

The UI-Widgets Package library has a couple of nodes.

Widget shortcut – can assign shortcuts to the widget as a whole
Widget toolbar – opens a toolbar when the widget is active and closes it along with the widget

The shortcuts only seems to work with simple lower case characters, numbers and some lower case symbols.
The toolbar only works with 1 toolbar at a time. More than one and they sit on top of each other. It seems to open the toolbar near the mouse position.

KeyfilterOut can be connected to the KeyfilterIn to make combinations. For example the Ctrl state nodes KeyfilterOut can be connected to a Mouse LDrag KeyfilterIn and the result is LDrag won’t do anything unless the Ctrl button is also pressed.

Keyboard button state node Key name input can be set to ascii characters and values found in the shortcut_description.txt found in the Scripts folder. Upper case or lower case does not matter. Shifted non-alpha-numerics do not work and are ignored.

The Axis slider widget node has in invalid value in the XRangeHi and YRangeHi connectors. It acts like the value is set to 0.0 They must be changed from the 100.00 value indicated to some other value before it will work. Other widget nodes may have the same issue.

tS WindowsManager Notes

WindowsManager.CloseToolbar operates on the ID not the Prototype of the toolbar

WindowsManager.OpenToolbarFromPrototype(“Main”, 100, 100, 0, 0); uses the Prototype not the ID these values 100,100 is location, 0,0 are dummy size to just fit the toolbar

//frame snapping constants
//_WindowsManager.h
//enum _tagRtWindowCorner
//} 	RtWindowCorner;
WINDOW_CORNER_TOP	= 0
WINDOW_CORNER_BOTTOM	= 1
WINDOW_CORNER_LEFT	= 2
WINDOW_CORNER_RIGHT	= 3
WINDOW_CORNER_CENTER	= 4
WINDOW_CORNER_VERTICAL_CENTER	= 5
WINDOW_CORNER_HORIZONTAL_CENTER	= 6
WINDOW_CORNER_CLIENT_CENTER	= 7
WINDOW_CORNER_CLIENT_VERTICAL_CENTER	= 8
WINDOW_CORNER_CLIENT_HORIZONTAL_CENTER	= 9
WINDOW_CORNER_LEFT_TOP	= 10
WINDOW_CORNER_LEFT_BOTTOM	= 11
WINDOW_CORNER_RIGHT_TOP	= 12
WINDOW_CORNER_RIGHT_BOTTOM	= 13
WINDOW_CORNER_CLIENT_TOP	= 14
WINDOW_CORNER_CLIENT_BOTTOM	= 15
WINDOW_CORNER_CLIENT_LEFT	= 16
WINDOW_CORNER_CLIENT_RIGHT	= 17
WINDOW_CORNER_CLIENT_LEFT_TOP	= 18
WINDOW_CORNER_CLIENT_LEFT_BOTTOM	= 19
WINDOW_CORNER_CLIENT_RIGHT_TOP	= 20
WINDOW_CORNER_CLIENT_RIGHT_BOTTOM	= 21
WINDOW_CORNER_TITLEBAR_RIGHT_TOP	= 22

//only seems to work for actual corners, and offsets set to 0
//WINDOW_CORNER_CLIENT is target and source is WINDOW_CORNER
//snaps the source frame to the target, the second to the first
//HRESULT STDMETHODCALLTYPE SnapFrameToFrameEx( 
//            /* [in] */ BSTR bszFrameTarget,
//            /* [in] */ BSTR bszFrameSource,
//            /* [in] */ VARIANT iFrameTargetCorner,
//            /* [in] */ VARIANT iFrameSourceCorner,
//            /* [in] */ VARIANT iOffsetX,
//            /* [in] */ VARIANT iOffsetY)

//can not figure this one out at all, same args except no offsets
//STDMETHODCALLTYPE SnapFrameToFrame( 

Saving and Loading Toolbars

If you try to save a toolbar to disk it will save as empty without any buttons. Workaround is to create the toolbar in the Toolbar Prototypes Encapsulator then save the Toolbar Prototypes Encapsulator to disk. Reload into trueSpace in a different location and remove all the toolbars except for the toolbar of interest, optionally rename the encapsulator and save to disk. Now loading this encapsulated toolbar won’t loose the buttons.

trueSpace Toolbar Button Bug?

When a script is called from a toolbar button using ScriptObject.Execute, the script will not be able to read node connection values, Node.Value If the same script is called from a toolbar button using Activity.Run then it can read the values without an error.

As noted in another post the Node.Value will also fail inside a script function set. The fix is to use RsApp.RunScriptBuffer

GlobalFS = Node.AccessFnSet("Scripts/CustomCommands/Global Function Set");GlobalFS.Parent();

will fail when run from a toolbar button because GlobalFS.Parent() has a Node.Value in it.

cmd='GlobalFS = Node.AccessFnSet("Scripts/CustomCommands/Global Function Set");GlobalFS.Parent();';RsApp.RunScriptBuffer(cmd);

wrapped in a script buffer command and it works