Developing tS 6.6 (Modeler) PlugIns in a Basic Language

Smart people ~ Great Scripts
User avatar
DesignDevil
Master Chief Petty Officer
Posts: 500
Joined: 22 May 2009, 08:52
Type the number ten into the box: 0
Location: Neuruppin, Germany, Earth.
Contact:

Re: Developing tS 6.6 (Modeler) PlugIns in a Basic Language

Post by DesignDevil »

hahaha ... i know exactly what you mean ...

i have a byword for this (in german) ...

"Fehlender Kaffee, Anwender angehalten"

"missing coffee, user paused" (i hope it is correct translated)
I still use TrueSpace 6.6
Link: My Youtube Channel
Link: www.DesignDevil.de - Plugins, Tutorials and more about TrueSpace 6.6
froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Re: Developing tS 6.6 (Modeler) PlugIns in a Basic Language

Post by froo »

heheheh :)
My wife speaks German; she'll get a kick out of that one!
frank
Senior Chief Petty Officer
Posts: 161
Joined: 28 May 2009, 13:25

Re: Developing tS 6.6 (Modeler) PlugIns in a Basic Language

Post by frank »

Wow... I just keep getting more and more surprises from this forum!!!

DesignDevil... this is similar to something I worked on a while back. I wanted to write plugins in Visual Basic but quickly found out you couldn't export the functions since they aren't CDECL.

I actually went the route of purchasing PowerBASIC, which natively supports this. (Even wrote an object swapping program for facial animation.)

...however, PowerBASIC isn't quite as easy as Visual Basic (which I've used for years). Any way we can get this to work with Visual Basic 6?
EDIT: PowerBASIC isn't as easy in terms of the interface.

Man... this is exciting. I have LOTS of reading to do...
User avatar
DesignDevil
Master Chief Petty Officer
Posts: 500
Joined: 22 May 2009, 08:52
Type the number ten into the box: 0
Location: Neuruppin, Germany, Earth.
Contact:

Re: Developing tS 6.6 (Modeler) PlugIns in a Basic Language

Post by DesignDevil »

I'm sure it is possible for every language which can create DLL's with CDECL function specification.

The problem is "just" to convert the header files with all structures and function calls. They are sometimes a bit wild.

I have used 2 ways. The first thing was to use the header files from the 4.1 Delphi version of the SDK and also the previous created basic version from a FreeBasic User (this was for the 3.x SDK).

I'm sure there are a lot's of issues in my conversion but it is impossible to proof all these functions if they are correct or not. So far it works very well and anytime i found a mistake i correct it and update the package.

I himself don't use Visual Basic and in the moment i have to many things to do and no time for developing plugins. I'm also a bit angry about the very bad written SDK for TS 6.6 and that a lot of functionality is not available or works wrong thrue the SDK (which is very bad). As example: there is no way to find out which tool the user has choosed actualy (i.e. moving, scaling, rotating). Another example: Changing the viewport thrue the SDK functions creates issues with the cage - and manipulation widget.

...and there are a lot more...

So, if you need any help i will do my very best to help you - contact me - i'm always interested to anybody who has the interest to write plugins for tS6.6 (or modeler).
I still use TrueSpace 6.6
Link: My Youtube Channel
Link: www.DesignDevil.de - Plugins, Tutorials and more about TrueSpace 6.6
User avatar
BNG
Chief Warrant Officer
Posts: 684
Joined: 16 Oct 2009, 03:26
Type the number ten into the box: 0
Location: Texas
Contact:

Re: Developing tS 6.6 (Modeler) PlugIns in a Basic Language

Post by BNG »

Thank you very much. I see you've spent a lot of time converting files for FreeBasic. I'm new to writing TSX plugins but would like learn more about making plugins. Thanks again for taking the time to do as much work as you have already. I apreciate it very much.
User avatar
Emmanuel
Chief Warrant Officer
Posts: 650
Joined: 14 Jun 2009, 06:47

Re: Developing tS 6.6 (Modeler) PlugIns in a Basic Language

Post by Emmanuel »

I am giving a first try at building a TSX with DD's FreeBasic tutorial and want to share my experience with you all.

I download DD's package from his website, the FreeBasic compiler and the IDE to write/edit the source code.
The editor is cool. I think building plugins with this toolset should be easier than using C++ and Microsoft Visual Studio.
editor.jpg

Next, I follow each step of DD's tutorial and all runs fine until I reach the page 5 of the FreeBasic SDK.pdf and hit the F5 key to compile the template tsx : wheely
Here, I get a first error message :

wheely.bas(44) error 24: File not found, "..\tsxapi\tsx.bi" in '#Include Once "..\tsxapi\tsx.bi"'

Okay, I copy the tsxapi folder to the root of FreeBasic folder like below :
location of tsx api.jpg
Now, I press F5 again.
The file not found error for tsxapi is gone, but I get an other file not found error, this time looking for a windows.bi file :

Build error(s)
C:\Program Files (x86)\FreeBASIC\fbc -w 3 -s gui -dll -export "wheely.bas" "wheely.rc"
C:\Program Files (x86)\FreeBASIC\tsxapi\tsxMisc.bi(13) error 24: File not found, "windows.bi" in '#Include Once "windows.bi"'


Problem : there is no windows.bi file in the FreeBasic installation nor in DD's package.

Any idea, someone ?
You do not have the required permissions to view the files attached to this post.
User avatar
Emmanuel
Chief Warrant Officer
Posts: 650
Joined: 14 Jun 2009, 06:47

Re: Developing tS 6.6 (Modeler) PlugIns in a Basic Language

Post by Emmanuel »

Okay, I found that the zipped version of FreeBasic Compiler contains the additional files.
The one we should download and unzip is at : http://sourceforge.net/projects/fbc/fil ... p/download
In other words, don't download the Windows 0.23.0 Installer

Now, the editor returns a Make done message :)

I can start my experiments ....
froo
Captain
Posts: 2554
Joined: 22 May 2009, 12:13

Re: Developing tS 6.6 (Modeler) PlugIns in a Basic Language

Post by froo »

Excellent Emmanuel! :bananacheers:
User avatar
Emmanuel
Chief Warrant Officer
Posts: 650
Joined: 14 Jun 2009, 06:47

Re: Developing tS 6.6 (Modeler) PlugIns in a Basic Language

Post by Emmanuel »

Stan made a plugin that allows to measure distance between two objects, but I think there is no tsx yet to measure the distance between two points (vertex). This could be a good challenge for a first plugin using FreeBasic.

Please note that I don't know FreeBasic at all and that I have a very little experience in programming.
So this project should be a good tutorial for all non-programmers.

First, the concept :
User picks up a vertex in point edition mode, then clic a button on the tsx panel to store the first vertex location. Next, pick up an other vertex on the same object or an other one, then clic a button on tsx panel to store the second vertex location.
A third button would return the distance and display it in a field.
An additional feature would be to draw a line showing the distance. This line would disapear on exit.

Now, the design :
measure tsx project.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
Emmanuel
Chief Warrant Officer
Posts: 650
Joined: 14 Jun 2009, 06:47

Re: Developing tS 6.6 (Modeler) PlugIns in a Basic Language

Post by Emmanuel »

Now, I am reading the tsxAPI66 pdf file that comes with the tS6.6/Modeler SDK.

In this file I do a search for the words "ccordinates" and "vertex". I find a command that could to the trick :

tsxDistanceToPoint3f

PURPOSE
Distance between 2 points ‘p’, ‘q’.

SYNTAX
TSXAPIFN float tsxDistanceToPoint3f(const CtsxVector3f& p,const
CtsxVector3f& q)

PARAMETERS
p const CtsxVector3f&: the coordinates of a 3-D point
q const CtsxVector3f&: the coordinates of a 3-D point

RETURNS
float


Since I have to get the point p and q coordinates, I also grab this one :

tsxGNodeGetAxesPosition

PURPOSE
Get the GNode’s position in World coordinates.

SYNTAX
TSXAPIFN CtsxVector3f* tsxGNodeGetAxesPosition(tsxGNODE* pGNode,
CtsxVector3f* posn)

PARAMETERS
pGNode tsxGNODE*: a pointer to a GNode
posn CtsxVector3f*: a pointer to a 3-vector

RETURNS
CtsxVector3f*: 0 if not GNODE, else posn.



I guess tsxGNodeGetAxesPosition will be used to store the location of my two points, assign the locations to two variables (p and q), and tsxDistanceToPoint3f will provide us with the distance between the two points.
Now I have to figure how to put all this together :) ...
Post Reply