trueSpace 7.61 Beta 8 - Model python samples

Post Reply
User avatar
trueBlue
Captain
Posts: 4155
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

trueSpace 7.61 Beta 8 - Model python samples

Post by trueBlue »

Copied from Clinton's Blog
http://clintons3d.com/wp/?p=57

The python samples don’t work for trueSpace7.61 unless you copy the contents of the PythonScripts folder into the tS folder. The other option is to add 2 lines to the top of your python script:
import sys
sys.path.append(‘PythonScripts’)
This tells python to look inside the PythonScripts folder for modules to load.

Sample scenes:
C:\trueSpace761\tS\Projects\Tutorials\Library\scenes.scl

User avatar
trueBlue
Captain
Posts: 4155
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: trueSpace 7.61 Beta 8 - Model python samples

Post by trueBlue »

EntryPoint.RsScn Model and Workspace (view's) sync Onload with the EntryPoint camera.
Note: Camera has an Assigned script in the PythonScripts folder named EntryPoint.py
The EntryPoint.py file may not be needed as it is saved with the scene.
Also saved with the Play and AutoRun enabled.
This Camera also has a script that synchronizes Workspace with Model run by a Watch Dog Event, hooked up to it's FOV and WldMatrix.
With the EntryPoint camera selected, in Workspace select Set Camera and in Model, select View From Object.

Model's Script Manager
Scene
import sys
sys.path.append('PythonScripts')

EntryPoint 'Camera'
# Camera object
# this function is called when you click on 'Play' icon
def ontimestarted():
me.Select() # ! select as current obj!!!

#Look through a camera
doc.ActiveView.ViewMode = trueSpace.e_tsxVM_CAMERA

# this function is called when you click on 'Stop' icon
def ontimestopped():
doc.ActiveView.ViewMode = 0
pass

WIP Notes(may change as more testing needed)
Bridge set to Auto:
Assigning python scripts, to the Scene in the Script Manager with the main window set to Workspace and a new Model 3D Window, can crash trueSpace7.61 when closing the Model 3D Window, unless the Bridge is set to On and Full Merge.
However as soon as you switch the Bridge to another setting, trueSpace will crash.
Workaround: Create a new scene in Model and Close trueSpace.

Using, Assigning python scripts, and switching layouts can crash trueSpace7.61.
Workaround: To avoid crashing when using the Script Manager and switching layouts, the Bridge must be set to On and Full Merge. Workspace materials do not(?) get messed up. Way more testing on this
However as soon as you switch the Bridge to another setting, trueSpace will crash.
Workaround: Create a new scene in Model and Close trueSpace.
Attachments
EntryPoint.RsScn
(590.27 KiB) Downloaded 134 times

Post Reply