OD_CopyPaste for trueSpace

User avatar
clintonman
Captain
Posts: 5430
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

OD_CopyPaste for trueSpace

Post by clintonman »

copypaste01.jpg
mesh "copied" from from Blender and "pasted" into trueSpace modelside(tS6)
note that the fancy cube mesh pasted in with all sorts of flipped faces, but the monkey and torus came in without any trouble

TODO:
handle material ids
uvs
delete and replace action
and make the copy portion of the script

made of a few pieces

open source info for copypaste
really it reads/writes a temp file not a true copy and paste to the clipboard
https://github.com/heimlich1024/OD_CopyPasteExternal" onclick="window.open(this.href);return false;

python mesher from
https://www.quantumchamaeleon.com/Mesher/mesher.html" onclick="window.open(this.href);return false;

python source code for the parts missing from trueSpace
https://www.python.org/download/releases/1.5/" onclick="window.open(this.href);return false;
Clinton Reese

http://clintons3d.com
User avatar
Draise
Captain
Posts: 3198
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: OD_CopyPaste for trueSpace

Post by Draise »

This is black magic. Too much. Clinton! Slow down!!

Awesome work.
User avatar
clintonman
Captain
Posts: 5430
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: OD_CopyPaste for trueSpace

Post by clintonman »

copypaste02.jpg
original mesh and round trip result from Blender and Lightwave
The meshes from both Blender and Lightwave had the appearance of flipped faces. Going into PE mode and the flipped look disappeared on it's own.

It does not export uvs. No way to read them with python. It does import uvs.
Python delete doesn't work so a new mesh is created instead of replaced
No material import because Mesher doesn't support it. Python material creation is also buggy and does not read material for a face so, no material support
Mesher supports 1 uv map
Only way to get mesh size to match is to freeze truespace mesh scale in workspace:
1 axis tool, 2 normalize scale, 3 exit axis tool, 4 flatten axis => no scale and applied to vertices of the mesh

Does anyone know of a "freeze scale" for modelspace(ts6) ?
Is scale available in modelspace? Size isn't the same thing as scale.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5430
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: OD_CopyPaste for trueSpace

Post by clintonman »

Forgot to mention, I think the mesh results will be better with more normal meshes. This sample has all sorts of complex polygon shapes.

I'll put together a package soon...

Edit: Also forgot to say the autofix by pe mode only works if done immediately. I took one model into workspace first and it got a little messy.
Clinton Reese

http://clintons3d.com
stan
Master Chief Petty Officer
Posts: 580
Joined: 21 May 2009, 17:20

Re: OD_CopyPaste for trueSpace

Post by stan »

TSXAPIFN CtsxTxmx3f * tsxPolyhGetVxTxmx (tsxPOLYHEDRON *pPolyh, CtsxTxmx3f *pTxmx)
Get the Vertex Transformation Matrix. Returns pTxmx, if valid operation. Note: This matrix includes scaling and shearing terms, so it is not guaranteed to be orthogonal. Use `tsxUnMatrix3f' before inverting.

TSXAPIFN void tsxPolyhSetVxTxmx (tsxPOLYHEDRON *pPolyh, CtsxTxmx3f *pTxmx)
ptr to Array. May be 0. Copies a new Vertex Transformation Matrix into pPolyh.

TSXAPIFN void tsxUnMatrix3f (const CtsxTxmx3f &Txmx, CtsxTxmx3f &Rot, float *pScaleShear=0)
Extract the pure rotation matrix (Rot) and scaling/shearing factors from a Transformation Matrix (Txmx). If specified, pScaleShear must be float[6], and is assigned as follows: { Sx, Sy, Sz, Sxy, Sxz, Syz }.


Clinton, there is scale in the modelside ts66 api

Does anyone know of a "freeze scale" for modelspace(ts6) ?
you might be able to make a ts66 version.
User avatar
clintonman
Captain
Posts: 5430
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: OD_CopyPaste for trueSpace

Post by clintonman »

Thanks for that. Looks like the only way for perfect operation is to create a plugin instead of a script.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5430
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: OD_CopyPaste for trueSpace

Post by clintonman »

Attached is a working package.
unzip and copy the Lib folder and the trueSpace_CopyPasteExternal.py file into the trueSpace folder. For tS76 that would be "C:\trueSpace761\tS\". Should work with versions 5,6,7. For tS4 you would have to get the older Mesher version made for it.
Attachments
OD_CopyPaste.zip
(54.52 KiB) Downloaded 243 times
Clinton Reese

http://clintons3d.com
User avatar
seppgirty
Master Chief Petty Officer
Posts: 354
Joined: 22 May 2009, 03:34
Type the number ten into the box: 0
Location: pittsburgh Pa.
Contact:

Re: OD_CopyPaste for trueSpace

Post by seppgirty »

I know this is a little late but this package contains "scale normalizer" for TS 6.6
Attachments
20040831_gameSpaceTorqueProject.zip
(94.23 KiB) Downloaded 225 times
truespace 3.2, 5.2, 6.6, ani-pack, flash plugin,........ you can check out my films athttp://www.chaosbrosfilms.com
User avatar
clintonman
Captain
Posts: 5430
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: OD_CopyPaste for trueSpace

Post by clintonman »

That's a good/only option for a tS6 and earlier user or someone who doesn't want to use workspace to normalize the scale. Just have to avoid the shearing bug.

I'm half way done with a workspace version of the copy/paste. It supports material indices, a second uv and will be able to replace the selected mesh when pasting. I did the modelspace first because the original code was in python and modelspace has proper support for polygons via the Mesher.dll making it possible to create a mesh in trueSpace python. Workspace disadvantage is poor polygon support in script and plugins. If the polygon triangulation code didn't already exist in my fbx plugin source code I wouldn't do it or the copypaste would be limited to triangles and quads.
Clinton Reese

http://clintons3d.com
stan
Master Chief Petty Officer
Posts: 580
Joined: 21 May 2009, 17:20

Re: OD_CopyPaste for trueSpace

Post by stan »

https://www.quantumchamaeleon.com/tsPython/" onclick="window.open(this.href);return false;
I put this link here ..it shows how to add functionality to ts python.
Post Reply