Primitive tsxPython (ptsxpy), another Python interpreter plugin for tS series

free scripts, plugins, models, textures
User avatar
borgcone
Chief Petty Officer
Posts: 113
Joined: 06 May 2018, 21:09
Type the number ten into the box: 10
Location: Japan, or sometimes behind a borg cube

Re: Primitive tsxPython (ptsxpy), another Python interpreter plugin for tS series

Post by borgcone »

Added two movies and link to the scripts for them.


Text and scripts: https://biglode.com/ptsxpy-uforum/viewt ... f=6&t=2360

Already autumn in the northern hemisphere? That is certainly true :-)


Text and scripts: https://biglode.com/ptsxpy-uforum/viewt ... 6&t=108526
borgcone ... or 3DfromNULL at https://biglode.com/ptsxpy
User avatar
borgcone
Chief Petty Officer
Posts: 113
Joined: 06 May 2018, 21:09
Type the number ten into the box: 10
Location: Japan, or sometimes behind a borg cube

Re: Primitive tsxPython (ptsxpy), another Python interpreter plugin for tS series

Post by borgcone »

Added two movies for the first time in about 1.5 years. Animation of inverse kinematics (IK) is very tricky and hard to get a stable solution for each trueSpace version (tS4 - tS6). Material and shading is also difficult to understand the mechanism because tSxAPIxx.doc does not explain everything. I found a solution that uses "internal name" of shaders just within recent weeks.


Walking Robot (2021)
Sample script and brief information: https://biglode.com/ptsxpy-uforum/viewt ... 6&t=309364


Simple material shading (2021)
Sample script and brief information: https://biglode.com/ptsxpy-uforum/viewt ... 6&t=309374
borgcone ... or 3DfromNULL at https://biglode.com/ptsxpy
User avatar
borgcone
Chief Petty Officer
Posts: 113
Joined: 06 May 2018, 21:09
Type the number ten into the box: 10
Location: Japan, or sometimes behind a borg cube

Re: Primitive tsxPython (ptsxpy), another Python interpreter plugin for tS series

Post by borgcone »

Added two short movies. The detailed features of WIDGET, NURBS control points, Scene Editor (Keyframe Editor, KFE) are also undocumented in tsxAPIxx.doc, and cut-and-try was needed to understand how to manipulate them using tsxAPI functions.


Widget sample emulation (2021)
This python script emulates a good old SDK sample C++ code "WdgSample.cpp" including callback functions.
Sample script and brief information: https://biglode.com/ptsxpy-uforum/viewt ... 6&t=309546


Water ripple (2021)
This python script creates a NURBS cylinder like a spider web (i.e. with very small top and very short height) , deforms it as circular wave, makes an animation of that, clones it to several location, and shifts time frame of them.
Sample script and brief information: https://biglode.com/ptsxpy-uforum/viewt ... 6&t=309555
borgcone ... or 3DfromNULL at https://biglode.com/ptsxpy
User avatar
borgcone
Chief Petty Officer
Posts: 113
Joined: 06 May 2018, 21:09
Type the number ten into the box: 10
Location: Japan, or sometimes behind a borg cube

Re: Primitive tsxPython (ptsxpy), another Python interpreter plugin for tS series

Post by borgcone »

Let me introduce 3 new sample scripts for the ptsxpy.


Diamond (2021)
This script creates a shape of diamond cut by deforming a cone with 16 longitudes (i.e. a 16-sided pyramid). Important functions for deforming are TransformVect3f() and PolyhMakeEdge() but most part of code are for searching faces, edges and vertices.
Sample script and brief information: https://biglode.com/ptsxpy-uforum/viewt ... 6&t=309687


Alpha helix and Beta sheet (2021)
Each of three scripts generates a motif appeared in secondary structure of proteins; (1) a flexible (bendable and elastic) alpha-helix using lathe functions and skeleton (2) a beta-sheet of a cylindrical NURBS with squared corners (3) a beta-sheet by blending technique of patches.
Sample script and brief information: https://biglode.com/ptsxpy-uforum/viewt ... 6&t=309709


Simple metaball (2021)
Animation of paints squeezed from tube.
Sample script and brief information: https://biglode.com/ptsxpy-uforum/viewt ... 6&t=310178
borgcone ... or 3DfromNULL at https://biglode.com/ptsxpy
User avatar
Emmanuel
Chief Warrant Officer
Posts: 650
Joined: 14 Jun 2009, 06:47

Re: Primitive tsxPython (ptsxpy), another Python interpreter plugin for tS series

Post by Emmanuel »

Your scripts are awesome. The simple metaball animation reminds me a plugin project that never could be achieved :
A Macro/Sweep animation tool.

Basically the idea is to use Modeler's Macro/Sweep PE tool and the paths library to make an animation of a "growing" face : instead of making the sweep at once, trueSpace would build, along the path, a new segment of the selected face at every frame. The object will look like having a growing arm. With metaballs or SubDivision, this may allow to simulate growing organics, somehow the way snail's tentacles/eyes behave !

Do you think ptsxpy could handle such an animation ?
Macro-Sweep animation.jpg
User avatar
borgcone
Chief Petty Officer
Posts: 113
Joined: 06 May 2018, 21:09
Type the number ten into the box: 10
Location: Japan, or sometimes behind a borg cube

Re: Primitive tsxPython (ptsxpy), another Python interpreter plugin for tS series

Post by borgcone »

Thank you for your interest.
Emmanuel wrote: 22 Nov 2021, 15:52 ... a new segment of the selected face at every frame. The object will look like having a growing arm. ... Do you think ptsxpy could handle such an animation ?
Unfortunately, Caligari tSx API seems not to be able to do such sweep animation as far as I tried. We can specify e_tsxKFT_SWEEP to SobjSetFrame() since tSx API for tS5.0 (or 4.3) but the created animation works only in the points selected mode of tS6.6 as the API document says;
e_tsxKFT_SWEEP, // floor move, rotate, and scale (valid only for selected floor of active sweep)

(Besides, unlike move/rotate, key frames are NOT complemented by minor frames automatically for e_tsxKFT_SWEEP and we must calculate the complement to get a smooth animation even if tS can do sweep animation.)

In order to do the sweep animation with tSx API, perhaps it's necessary to make the final form (completely swept to many sections) first, fold all sections like an old folding camera by moving all vertices to the "root", mark the time as 0, and move all sections other than the floor in a unit time, move all sections other than 1st and 2nd floors in next unit time, move other than three...

By the way, my "Glass Slide (2001)" (the 3rd YouTube image in this topic's 1st page) uses the tSx API's incompleteness of sweep animation. The script makes something like a course of a "roller coaster" by repeating single segment sweep, time frame advancing, and camera rotation/translation to the top face's normal. As a result, the camera runs on the "STATIC" course (i.e. the course has no sweep animation) in the shape of a text "trueSpace".
Drawing "t" from the viewpoint z=infinite.
Drawing "t" from the viewpoint z=infinite.
slide_5b.jpg (23.99 KiB) Viewed 2340 times
Emmanuel wrote: 22 Nov 2021, 15:52 With metaballs or SubDivision, this may allow to simulate growing organics, somehow the way snail's tentacles/eyes behave !
To submit such "growing" animations to the Caligari "3D Animation Contest" was one of my motive to develop the ptsxpy in about 2000. I soon noticed tS5 (trial version) takes all night to do repetitive hundreds single sweep though. It was not a matter whether it can do sweep animation or not. :)
borgcone ... or 3DfromNULL at https://biglode.com/ptsxpy
User avatar
borgcone
Chief Petty Officer
Posts: 113
Joined: 06 May 2018, 21:09
Type the number ten into the box: 10
Location: Japan, or sometimes behind a borg cube

Re: Primitive tsxPython (ptsxpy), another Python interpreter plugin for tS series

Post by borgcone »

Emmanuel wrote: 22 Nov 2021, 15:52 ... simulate growing organics, somehow the way snail's tentacles/eyes behave !
Probably the easiest way to make an animation of growing organics or snail's tentacles/eyes using the ptsxpy might be to move/rotate latitudes of a NURBS cylinder. In case of swept polyhedrons, it would be too complicated work for scripts to select vertices in a latitude, but NURBS's latitudes can be selected easier (though multiple objects are needed for "branch") by scripts. In the image below, the bending was not done by script but by hand. The ptsxpy and scripts can do the same action.
NURBS1a.jpg
NURBS1a.jpg (41.25 KiB) Viewed 2317 times
One of sample script to animate moving/sizing NURBS cylinder's latitude on ptsxpy is "Water ripple (2021)" posted above on 13 Apr 2021.
In addition, metaball animations are a bit tricky and difficult to control because gathering many elements causes honest but unexpected/unreasonable expands.

----Added lines below later in the same day.
I made a experimental script for the growing NURBS above. The NURBS has initially 50 latitudes and short height. The growing point in this example is its foot (like a hair or savanna antelopes' horn?). For simulating apical growth like a botanical vine, you should just reverse the top and bottom.


----Added below on Nov 30 2021.
Experimentally, made also a script that generates an animation of a retractable snail's eye. It's does not sweep but creates and deforms a NURBS cylinder.
borgcone ... or 3DfromNULL at https://biglode.com/ptsxpy
Post Reply