You can download the distributions of this plugin, Primitive tsxPython (ptsxpy), for trueSpace (tS) series here. Please take a brief look at Requirement, License, and Disclaimer first.
Warning: Almost all methods (functions) have been roughly tested but the project is on "Beta test" stage. Please run at your own risk.
Files
Download Files
Last modified: 2023-04-20
There is no installer for this plugin. The sequence you should do for the installtion is to download, unzip, and copy to a folder under the "tsx" folder of your trueSpace. Please note that one of the downloaded files is used as is in the form of a zip file. Don't unzip python37.zip extracted from a *.zip.zip file.
Step-1. Check your Microsoft runtime library.
Make sure that following runtime library has already been installed in your conputer. If not, search for it in the MS's site and install. It's required for ptsxpy to use the console window.
Microsoft Visual C++ 2017 Redistributable (x86)
Step-2. Select the official Python DLL version Python3 or Python2 you would like to download.
Each of these Python versions has different specification (e.g. print( "Hello!") for Python3 scripts and print "Hello!" for Python2 scripts). In some cases, a single script you wrote can be executed in both the Python 2 and Python 3 environments, but in some cases the execution results may be different or an error may occur in one environment due to the difference of the specification between Python versions. It's safer that you decide exactly which Python version your scripts should run on before proceeding your work.
I use Python3
Step-3. Select Python3 files tab below and download a file.
Python3 files
Step-4. Download the official Python3 file below if you don't have it yet.
If you have already had the same version with below, skip this and select ptsx3py files tab in the upper right.
This file is a copy (distribution) from Python.org. The ptsxpy plugin was tested with this version. Newer Python version might not suit to the plugin. Please read License tab above to know about the Python distributions, and Quick Start tab above to know how to install".
- 5 times. Last downloaded on 2024-08-08 01:29 UTC
Size: 3.56 MB (3,731,444 bytes)
Date: 2023-09-30 00:23 UTC
MD5: 735e0e6efd5826e1486282e3dfdf949a
SHA256: d5576cf1552c12be73da5dc6a4ac1aaede5193a6f1849bb2bcc5b64503e768c1
Step-5. Select ptsx3py files tab in the upper right to download ptsxpy files.
ptsx3py files
Step-6. Download the ptsxpy Main parts for Python 3.
ptsx3py_Main_0.0.14_20210430_130135.zip
0 times.
Size: 2.9 MB (3,038,227 bytes)
Date: 2023-09-30 00:23 UTC
MD5: 90326d5fd3c44cd9e0a8c3cc4d4b841e
SHA256: 6a67f680ea9b78531160ff44199b9434f4b2062eb62650ea88f5fa1d429e08c6
Step-7. Dowmload the ptsxpy parts specific to your trueSpace version.
Select a tab of your trueSpace version and select the file. (If you don't have any trueSpace, search for the free tS7 via the net.)
tS7 Model (tS6.6)
ptsx3py_tS66_0.0.14_20210430_130135.zip
4 times. Last downloaded on 2024-08-08 01:30 UTC
Size: 1.49 MB (1,561,613 bytes)
Date: 2023-09-30 00:23 UTC
MD5: 8f5f731b133c894514ae3c997e34a113
SHA256: 1e2c598c3ab5ae4389f23f6ed76d8324b48df2414798f0ce3d431f604ab0de75
tS6.0
ptsx3py_tS60_0.0.14_20210430_130135.zip
0 times.
Size: 1.48 MB (1,556,133 bytes)
Date: 2023-09-30 00:23 UTC
MD5: 9388e9c08ec52b8b2c06e12d600b6e30
SHA256: df9a954e0b43c1ea5183a7ac7a6f2434de72273536f9c52f68bcf073bd8340be
tS5.1
ptsx3py_tS51_0.0.14_20210430_130135.zip
0 times.
Size: 1.48 MB (1,553,697 bytes)
Date: 2023-09-30 00:23 UTC
MD5: 06e41356de336ebc9c8431b92e1b5363
SHA256: c3a654cbffc5247b375f15811c745a3f19813be51a7004c424c77be17784b5f8
tS4.3
ptsx3py_tS43_0.0.14_20210430_130135.zip
1 times. Last downloaded on 2023-10-30 16:54 UTC
Size: 1.47 MB (1,538,690 bytes)
Date: 2023-09-30 00:23 UTC
MD5: 62bf1e881fe9ef02fd1aa7ceabccd33d
SHA256: cc550d92c78fc8e1d30ad1ce9d928458b610082588d5422fd75ede1765a7568b
Step-8. Check your downloaded files.
Select Quick Start tab to check. There is a table of the necessary files. Compare inside of the downloaded zip files with the table in the page. Don't unzip python37.zip extracted from a *.zip.zip file. After confirming that the necessary files are included in your files, follow the Qucik Start page.
I use Python2
Step-3. Select Python2 files tab below and download a file.
Python2 files
Step-4. Download the official Python2 file below if you don't have it yet.
If you have already had the same version with below, skip this and select ptsx2py files tab in the upper right.
This file is a copy (distribution) from Python.org. The ptsxpy plugin was tested with this version. Newer Python version might not suit to the plugin. Please read License tab above to know about the Python distributions, and Quick Start tab above to know how to install".
- 1 times. Last downloaded on 2024-08-13 02:33 UTC
Size: 1.13 MB (1,181,988 bytes)
Date: 2023-09-30 00:23 UTC
MD5: 157d25a8e54f19837f20446403344d43
SHA256: 6177c163dd59a6a9c5ee6e5a3c7c506442aa447bdcbdc01beae25f5ebb4e8720
Step-5. Select ptsx2py files tab in the upper right to download ptsxpy files.
ptsx2py files
Step-6. Download the ptsxpy Main parts for Python 2.
ptsx2py_Main_0.0.14_20210430_130135.zip
0 times.
Size: 2.9 MB (3,038,227 bytes)
Date: 2023-09-30 00:23 UTC
MD5: 17ace5539de63a40803260cf9ab87f3e
SHA256: bfe5337d4f491a72a2b8755d4946b988414825c229b035cca8438dcf2f568b25
Step-7. Dowmload the ptsxpy parts specific to your trueSpace version.
Select a tab of your trueSpace version and select the file. (If you don't have any trueSpace, search for the free tS7 via the net.)
tS7 Model (tS6.6)
ptsx2py_tS66_0.0.14_20210430_130135.zip
2 times. Last downloaded on 2024-08-13 02:33 UTC
Size: 1.49 MB (1,560,491 bytes)
Date: 2023-09-30 00:23 UTC
MD5: 6ffb1791c36fbf3debd8c5fcb47504a3
SHA256: cb702e447c4784e4ea772b8924330e01c6b28f3155f73602305bcb175f7c716c
tS6.0
ptsx2py_tS60_0.0.14_20210430_130135.zip
0 times.
Size: 1.48 MB (1,555,840 bytes)
Date: 2023-09-30 00:23 UTC
MD5: 5a7bba30fa0d0d9aa774c89088adb329
SHA256: 376fa399775b0352885d80d1b47346027e71a67b53160d84c09ca6995c57db56
tS5.1
ptsx2py_tS51_0.0.14_20210430_130135.zip
0 times.
Size: 1.48 MB (1,554,064 bytes)
Date: 2023-09-30 00:23 UTC
MD5: 2e863233893f80d0440c24d7f2c7dd4e
SHA256: 3472e0a4eca567b03fc7c6aa9905ffed76e7ca51c9416aa6dbe0884f6dbb8f3e
tS4.3
ptsx2py_tS43_0.0.14_20210430_130135.zip
0 times.
Size: 1.47 MB (1,538,436 bytes)
Date: 2023-09-30 00:23 UTC
MD5: 3af8f14c72c9e67fe65e07d604c7f049
SHA256: 6fcd997b1628e87fb9889b74834386577051150072ec92c0a643a0af712f225d
Step-8. Check your downloaded files.
Select Quick Start tab to check. There is a table of the necessary files. Compare inside of the downloaded zip files with the table in the page. Don't unzip python37.zip extracted from a *.zip.zip file. After confirming that the necessary files are included in your files, follow the Qucik Start page.
Change log
Change Log
Last modified: 2023-04-30
0.0.14
- Corrected functions that take one or more "float *" (i.e. pointer to float) as parameter.
UnMatrix3f()
GNodeGetLookAhead()
AViewPickFace()
SobjGetMinMaxTime()
SobjTreeGetMinMaxTime()
FrameGetSplineParameters()
MetaballPrimitiveGetParam()
NCurveSetWeights()
NCurveSetKnots()
NCurveRefineKnotVector()
NCurveFrames()
NPatchSetWeights()
NPatchSetUKnots()
NPatchGetUVProjection()
NPatchRefineKnotVector()
NPatchSetVKnots()
SceneGetMaxMinLuminance()
AnimGetPlayRanges()
- Added to constants to ptsxpydef1.py
tsxNPATCH_POLE_xxxx
tsxPIPE_xxxx
tsxBLEND_LEVEL_xxxx
sxSTITCH_LEVEL_xxxx
0.0.13
- Corrected directory to load dll for tS6.0. (Unchanged for tS4.3, tS5.1, and tS6.6 (Model side of tS7))
0.0.12
- CharArray class - Corrected loaduchar/storeuchar to loadchar/storechar.
- UcharArray class - Added.
- ptsxgp module - Added loadchar() and storechar().
0.0.11
- Corrected number of methods' arguments for patch and surface.
NPatchRefineKnotVector()
NPatchRemoveKnot()
NPatchExtractIsocurve()
NPatchInvert()
BlendSurfConstruct()
StitchSurfConstruct()
- Added a definition for tsxNPatchBuildVisRepAuto() to ptsxpydef1.py. (it was originally defined in tsxnpatch.h of tSxAPI SDK)
tsxNPATCH_VR_DRAG
0.0.10
- RegisterWidgetType(). Changed type of 3rd and 4th argument from C++ pointer to user script side Python function object so that user can specify function in the script.
- CreateWidget(). Changed type of 5th argument from C++ pointer to Python function object so that user can specify function in the script.
- Added to ptsxgp module.
ptsxgp.getpymjrver() Returns Python major version (2 or 3).
ptsxgp.alloc_double() Allocates an array of C++ double (64 bit floatin point value)
ptsxgp.loaddouble() Loads from C++ double.
ptsxgp.storedouble() Stores to C++ double.
- Added to ptsxpydef1.py
Constants:
sizeof_CtsxViewParam
tsxJOINT_DOF_xxxx
tsxSHPARAM_GENERIC
tsxSHPARAM_ENUM
tsxMVFLAG_xxxx
tsxWDG_DRAW = true # draw widget
tsxWDG_NODRAW = false # skip drawing
tsxMTM_xxxx
tsxMTF_xxxx
tsxSELECT_xxxx
Methods:
copyfrom() method to copy from C++ address to the instance (for some classes).
xxxx_p() method to get address of a member in the C++ struct of the instance (for some classes)
adr() method to get C++ address of an element of xxxxArray class instance.
Type checking and value checking in some classes
Classes:
ColorArray
FaceVx
Double
DoubleArray
Long
LongArray
Ulong
Short
Ushort
- Other changes in ptsxpydef1.py
Corrected CtsxSubDivEdge class. At address calculating for load and store, from sizeof_CtsxVector3f to sizeof_CtsxSubDivEdge.
Corrected CtsxSubDivFace class. At address calculating for load and store, from sizeof_short to sizeof_CtsxSubDivFace.
WidgetReg class. The 4th and 5th parameter from C++ pointer to user script side Python function object.
WDG_CALLBACKS class. All 10 callbacks from C++ pointer to user script side Python function object.
Added type checking and value checking in some classes.
0.0.9
- Corrected shader parameter ID definitions (CSPID_xxxxx_xxxxxx) in ptsxdef1.py. Some IDs (CSPID_C_CALTEXTURE_FILTER=85, CSPID_D_CALBUMPMAP_FILTER=220) were missing and the following IDs are misaligned. Newly added them and corrected the misaligned IDs. Added some IDs (246 - 635) for tS5.1 and later tS.
- Changed starting and ending message. "build --> built", "runscriptfile() ended" --> "scriptfilename ended".
- Changed PhysSimGetCenterOfGravity(). It previously returned a tuple to the 2nd argument specified as a list objec. It stores a pointer to CtsxVector3f. User can allocate a memory area using ptsxgp.alloc_long( 1 ), call the function, load the area using ptsxgp.loadptr(), and assign it to a pointer to Vec3f() using Vec3f_p()
0.0.8
- Added zipped python27.dll of Python 2.7.16 to the download page.
- Zipped python27.dll of Python 2.7.15 in the download page in order to keep updated date. The displayed hash codes change.
- Changed the functions that require one or more "char *" for their arguments so that each user script can specify str objects for the visible string arguments and can specify addresses (unsigned long) for the char * arguments.
- Changed the functions that return a visible string pointer so that each script can receive str objects from such functions.
0.0.7
- Removed some obsolete (auxiliary) functions from the ptsxgp module. Please use classes predefined in ptsxdef1.py instead.
ptsxgp.getmainversion()
ptsxgp.getUVfromp()
ptsxgp.getvec3ffromp()
ptsxgp.getax3ffromp()
ptsxgp.getfacefrompp()
ptsxgp.getfacevxfromp()
ptsxgp.getholefrompp()
ptsxgp.getskelpfrompp()
ptsxgp.gettxmx3ffromp()
ptsxgp.getlistfromintarray()
ptsxgp.getimagefromp()
ptsxgp.getucharlistfromp()
ptsxgp.getlatvecfromp()
- Corrected following function so that the last argument receives not a str but a pointer (unsigned integer).
SceneGetShaderParameterName()
- Added a line for initializing "self.num" to each pointer class definition (named xxxx_p) in the ptsxdef1.py so that user can specifiy an index to the pointer class instance.
- Added some definitions of tsxSHCLASS_xxxx for the value 5-8 to ptsxdef1.py.
0.0.6
- Corrected following functions so that each argument receives not a list but a pointer (unsigned integer).
GNodeGetAxesOrientation() 2nd arg.
ParameterValueGetData() 2nd arg.
LatticeGetResolution() 2nd and 3rd arg.
0.0.5
- Corrected CollisionCheckObjWithScene() and FreeCollisionReport() so that two pointer parameters are passed to the API function tsxCollisionCheckTwoObj() correctly.
0.0.4
- Corrected CollisionCheckTwoObj() so that the 5th and 6th arguments are passed to the API function tsxCollisionCheckTwoObj() correctly.
0.0.3
- The first official release.
Requirement
Requirement
Last modified: 2023-04-20
- trueSpace 4, 5, 6, or 7 *1
- Windows PC (64 bit or 32 bit OS) *2
- Microsoft Visual C++ 2017 Runtime Redistributable (x86) *3
- Text editor
*1 Each of ptsxpy distribution does not include trueSpace (tS). At least one tS must be installed in your computer to run this plugin (You may be able to find tS7.6 for free via the internet). The plugin is made to run on tS 4.3, 5.1, 6,0, 6,6 and 6.6 mode of tS7.6 (i.e. Model side of tS7.6). It may run on other versions like 5.2 or 7.5.
*2 Windows Vista SP2, Windows 7 or later. You need to update to SP2 (service pack 2) if your Windows Vista is SP1.
*3 Note that the runtime must be "x86" (for 32 bit) even if your OS is 64 bit. You can download and install the it from Microsoft's site. If a file, ucrtbase.dll, has already been installed in the directory Windows\SysWOW64\ or Windows\System32\ of your computer, the installation of the runtime may be unnecessary.
You can select Python version (2 or 3) at the point of your download.
License
License
Last modified: 2023-04-20
1. Use of the plugin
The version 0.x.x (where "x" is any number) of ptsxpy (this plugin) is developed and maintenanced by the author who holds the intellectual property rights. You (users) can use the distributed files of the version 0.x.x and your own script files freely for both personal and commercial use without any notice to the author, and you don't have to include the author's copyright notice in your own scripts.
The source codes of version 0.x.x of this plugin are not opened to public. Don't try to reverse-engineer, decompile, or disassemble.
2. Difference from Caligari's tsxPython
Each of trueSpace (tS) version has its original Python interpreter, tsxPython, and a script editor in it, and user can manipulate tS using Python language. But the functions are limited. For Example, as far as the author knows, sweep function and bevel function cannot be used from it, or the spec seem not to have been opened to the public at least.
The number of the functions written in the "latest" document TSXPYTHON.DOC ver.4.0 June 1998 was less than 100 though there are actually about 600 thru 1200 (which differs depending on tS version) API functions.
This plugin implements another interpreter to the tS, and user can manipulate using most functions described in tsxAPI documents and header files. Some classes that wrap C/C++ struct and some auxilialy general purpose funtions (e.g. storefloat()) are predefined and help user to use C/C++ resources and tS resources from Python.
3. About the Python DLL
Each distribution of this plugin includes python27.dll or python37.dll. It is not a product of the author of ptsxpy, but a part of Python distributed by Python Software Foundation. Please note that all Python DLL for 2.7.x has the same file name regardless of the tailing number "x" and of 32bit/64bit distribution. The plugin uses a DLL for 32-bit Python 2.7.15. To check the product version of the Python DLL, right-click it, select "Properties", and select "Detail" tab.
If you want to check if the included python27.dll is the legitimate file, please visit the download page of python.org, find "specific release" section, select "Python 2.7.15 (2018-05-01)", and download "Windows x86 MSI installer". After you installed it to your computer, you can find the 32-bit python27.dll in;
- C:\Windows\SysWOW64\python27.dll (if you installed on 64-bit Windows)
- C:\Windows\System32\python27.dll (if you installed on 32-bit Windows)
Then, please compare the size and updated date against the inluded python27.dll. You can check if it is 32-bit dll using the "dumpbin" command of Visual Studio or other tools. The plugin does not use the installed Python using above instrucion. You may uninstall the Python: Right-click the Start button - Programs and Features.
If you want check python37.dll, you need not to install Python 3.7. In this case, download only "Windows x86 embeddable zip file". (Please note that it's not "x86-64". The plugin uses 32 bit DLL)
It's highly recommended that you DON'T download any python DLL from the so-called "download sites" because we can not know where it comes and whether some modifications are done.
Similar but different
The Primitive tsxPython (ptsxpy) has no connection with followings and other similar names;
- Primitive Itch, a trueSpace plugin vender well-known to tS fans.
- Ticker symbols like PTSXQ, PTSX, PTXSPY, etc. used at stock market fields.
The Primitive tsxPython (ptsxpy) has some connections with followings but is not part of them and is not the same with them;
- tsx (or tSx), short for "trueSpace eXtension" named by Caligari corp.
- tsxPython, a Python interpreter bundled in each of Caligari's trueSpace series.
- Python, a programming language.
Trademarks
Python® is a registered trademark of the Python Software Foundation. Microsoft®, Windows®, Excel®, Visual Studio®, and other some terms are registered trademarks or trademarks of Microsoft Corporation in multiple countries.
Disclaimer
Disclaimer
Last modified: 2023-04-20
1. Author's Obligation
The author of ptsxpy will not be held liable for any damage, disadvantages or expenses by using the software. The author has no obligation to provide maintenance, support, updates, enhancements, or modifications.
2. Risks caused by using the ptsxpy
Please bear in mind that trueSpace (tS) may crash or the current tS scene, objects, parameters, or other states may be broken by running the plugin and scripts. It's recommended to save the important scene and objects before loading or running the plugin
3. Specification changes
The specification of the plugin will change. Your scripts or sample scripts may be able to run on the newer version of the plugin. It's recommended to leave ptsxpy major and minor version (x.y of x.y.z) and Python versoin (2 or 3) as a comment line in your scripts so that you and other readers can distinguish whether the script can run on a specific pair of Python and ptsxpy.
4. Risk of the 3rd party scripts
Beware of malicious scripts that destroy your PC. Some functions can easily change memory in your computer. You may get some 3rd party scripts for the plugin via the FORUM, etc.,but don't believe all people are good guys.
The author will take care not to leave bugs that give your computer fatal damages but there are some possibility of doing that accidentally.
Quick Start
Quick Start
Last modified: 2023-04-20
1. Install
(1) Make sure that following runtime library has already been installed in your conputer.
Microsoft Visual C++ 2017 Redistributable (x86)
Note that it must be "x86" (i.e. for 32 bit) even if your OS is 64 bit. You can download and install it from Microsoft's site. If a file, ucrtbase.dll, has already been installed in the directory Windows\SysWOW64\ or Windows\System32\ of your computer, the installation of the runtime may not be unnecessary. You can also check that by right-clicking Windows "Start" - "Programs and Features" (or "Control Panel" - "Programs and Features").
(2) Unzip the downloaded zip files to any folder you like. You will get the following files. Don't unzip python37.zip extracted from a *.zip.zip file.
Contents of zipped Python files
For Python3 scripts | For Python2 scripts | Note |
---|---|---|
python37.dll | python27.dll | Copy of Python Official |
python37.zip | Copy of Python Official. No unzip needed |
Contents of zipped ptsx Main parts files
For Python3 scripts | For Python2 scripts | Note |
---|---|---|
ptsx3cnsl.dll | ptsx2cnsl.dll | Console |
ptsx3py.tsx | ptsx2py.tsx | Main |
ptsxpydef1.py | Pre-defined classes, constants, etc. |
Contents of zipped ptsxpy tS specific parts files
For Python3 scripts | For Python2 scripts | Note |
---|---|---|
ptsx3pysb66.dll | ptsx2pysb66.dll |
for trueSpace 6.6 |
ptsx3pysb60.dll | ptsx2pysb60.dll | for trueSpace 6.0 only |
ptsx3pysb51.dll | ptsx2pysb51.dll | for trueSpace 5.1 only |
ptsx3pysb43.dll | ptsx2pysb43.dll | for trueSpace 4.3 only |
If you want to check the version of each ptsxpy DLL file, right click the file, select "Property", and select "Details" tab. You can also know the version of *.tsx after temporarily renaming to *.dll.
If you want to check the Python DLL files are genuine, please read "About the Python DLL" section in the License tab.
(3) Using File Explorer (Windows Explorer), locate to the directory where tS was installed. (If you forgot it, right click your trueSpace icon and select "Open file location")
(4) Find "tsx" (or "Tsx") folder and locate in it.
For example, you may be in: c:\xxxxxxx\trueSpace761\tS\tsx\
(5) Make a folder in the "tsx" folder, rename it to "ptsx3py" (or "ptsx2py") or any name you like, and move the downloaded and unzipped files to the folder. You need not unzip the python.37.zip.
Warning: Please bear in mind that tS may crash or the current tS scene, objects, parameters, or other states may be broken by running the plugin and scripts. It's recommended to save the important scene and objects before load or run the plugin.
2. Uninstall and partial update
If you would like to uninstall the ptsxpy, just delete the "ptsx3py" (or "ptsx2py") folder that you made at the installation precess. This plugin does not write any Windows registory on its installation.
If you would like to update to newly released version, just replace the files. Before you run your script, you should unload the old ptsxpy3 (or ptsxpy2) icon using Shift drag to trashcan icon, and then load the .tsx file to trueSpace.
3. Load ptsxpy to trueSpace
(1) Start your trueSpace.
(2) Find "Install new trueSpace extension" button ("plug" icon) and click it. A file selection dialog appears.
(3) Locate to the "ptsx3py" (or "ptsx2py") folder, double-click "ptsx3py.tsx" (or "ptsx2py.tsx") or select it and hit Enter key.
(4) The "ptsxpy3" (or "ptsxpy2") icon appears next to the "plug" icon. The Screen shot below is of tS7.6 (Model side)
If you would like to unload the plugin, Shift drag the icon to the trashcan. You can clone the icon by dropping any othre place.
You may load both ptsxpy3 and ptsxpy2 on a tS at the same time and can run script with each Python. However please note that the console window and the tS resources are common for both. You must avoid conflict of them.
4. Run a Python script file
(1) Prepare your script file. For example, create a text file, open it using a text editor, copy following code, save and rename it like "test1.py".
In Python language, the indentation level (i.e. blank preceding to each line) is significant. Please check the documents distributed by python.org: "PEP 8 -- Style Guide for Python Code" )
#------------------------------
# Create and move some cubes.
#------------------------------
import ptsxpy as p
import ptsxgp
import math
x = 0.
for i in range( 5 ):
print( "i=", i )
cb1 = p.CreateCube( 2 , 1., 1., 1. )
p.SceneAddObject( cb1, e_tsxFALSE )
loc = Vec3f( x, 0., 0. )
print( "loc=", loc.prt() )
p.GNodeSetLocation( cb1, loc.p )
x += 2.
p.SceneDraw()
In the example above, p.CreateCube() calls the correcponding C++ side tSxAPI function tsxCreateCube(). You can get information from tSxAPIxx.doc in SDK for each trueSpace version. The module "ptsxgp" and "math" are imported but not used in this example. They are necessary only if you use methods of these module. The "math" is a satandard module of Python and the "ptsxgp" has general purpose functions for user script and "ptsxpydef1.py". The "ptsxpydef1.py" is always imported automatically to user script (please read also the section below).
(2) Click the "ptsxpy" button.
(3) A file selection dialog and a console window (with black background) appear. tS may hide the console window. you can bring it forward later using holding-Alt key and a few times of Tab key.
(4) Locate to the directory where a script you would like to run exists. Double-click your script file (or select and Enter key) to start it.
(5) A message "...ended" comes to the console window when the scripts ended.
Note: It's highly recommended that you manage the combination of the Python major version (2 or 3) and ptsxpy major.minor version (x.y in x.y.z), because the specifications and the implementations of ptsxpy may change in the future. In addition, if you attach the script to a post to the Uesr Forum, etc., you should clearly describe on which tS version the script can run.
KNOWN FATAL BUG: Don't close the (black-and-white) console window using "x" button, Alt F4 key, or Ctrl C key, etc. If you close it with such actions, trueSpace will crash. The console window will close safely when you terminated trueSpace or when you right-clicked the ptsxpy icon and click "OK" button in a message-box.
5. Syntax of functions, predefined classes and constants
In the above sample code, the script is calling some tsxAPI functions like: p.XXXXX( ---- ). The "p" here is an alias of a module "ptsxpy" defined at the beginning of the script. The "XXXXX" here is the part of the name of each tsxAPI function, tsxXXXXX(). If you have the SDK (Software Development Kit) distributed by Caligari corporation for your trueSpace version, you can know the syntax and behavior of them from tsxAPIxx.doc and .h files. The SDK may be found via the net.
The plugin automatically imports a plain text, "ptsxpydef1.py", while it initializes Python. It defines some classes (e.g. Vec3f) and constants (e.g. sizeof_CtsxVector3f). Please don't modify the file. You can add your original classes and constants in each script file or in your file. In the sample script, an instance of Vec3f class is assigned to the variable "loc". The "loc.p" means the pointer to the three float values. The function GNodeSetLocation() receives it as the 2nd parameter, and sets the location of the cube object given to the 1st parameter. The "e_tsxFALSE" is defined in the "ptsxpydef1.py". You need not to write like "ptsxpydef1.e_tsxFALSE" and can omit the module name because the module is imported like "from ptsxpydef1 import *" by the plugin. The "ptsxgp" is a module of general purpose auxiliary functions.There are some ptsxpygp functions used in "ptsxpydef1.py".
Please read also HELP pages and visit FORUM where you can get sample scripts, read tutorials, report bugs, request features, discuss with members, or ask questions. Registration required before submitting your first post.