Developing tS 6.6 (Modeler) PlugIns in a Basic Language

Smart people ~ Great Scripts
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 »

Back into FbEdit, the FreeBasic editor, I think I will try to build my tsx using DD's wheely as template.

I open wheely.rc file.

In the central column of the user interface, I see a tree with two folders : Dialog and Misc.
A double clic on IDD_DLG1 in the Dialog folder opens the visual editor of the plugin panel. Here, I can edit the panel according to my project's design.

Next, I clic on "Ressource files". I can see that this stores the plugin icon. I draw an icon in Photoshop, save it in BMP format, create a folder to store it and all future files of this plugin, and replace the bicycle icon with my new one.

In "Stringtable", I find the plugin name. Here again, I modify it and type my plugin name : Distance 1.0

Finally, I clic in the menu File>Save_As, and name my file Distance.rc
FbEdit modif rc.jpg
You do not have the required permissions to view the files attached to this post.
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 »

tsxGNodeGetAxesPosition: Get the GNode’s position in World coordinates.

That means you can find out the position of your object in the world or - more exactly - it gives you the position of the origin axes of this object in the world!
I still use TrueSpace 6.6
Link: My Youtube Channel
Link: www.DesignDevil.de - Plugins, Tutorials and more about TrueSpace 6.6
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 »

DesignDevil wrote:tsxGNodeGetAxesPosition: Get the GNode’s position in World coordinates.

That means you can find out the position of your object in the world or - more exactly - it gives you the position of the origin axes of this object in the world!
Hello DD, and thanks for the input.
Do you mean that this command may not give the position of a selected vertex ?
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 »

Yep, correct.

The problem (or solution) is to know how the points (vertecies) are arranged to create a object in tS.

First: You have a object, maybe a cube.This Object is a GNode Type, which means it is a named pointer, to get access to it. The object contains a list (array) of faces - for our cube example a array of 6 indizes (0-5 = 6 sides). Every face has a Vertex list added (also a array) where the vertecies are stored. All these lists are just simple numbers so as if you would give every thing in the world a number.

Example: object -> 0 -> face -> 0 -> vertex -> 0,1,2,3 | face -> 1 -> vertex -> 5,6,7,8 ...and so on.

If you are in point edit mode and a vertex is selected than you have a few things to do. First you have to be sure that only ONE and only a vertex is selected (not a edge, face etc.) At next you have to find out which one and i can not remember that there is a function for it?!? Maybe i'm wrong but i think you have to go this way:

You setup a CallBack to be informed about a selection in Point Edit Mode. I'm not really sure but i think every time this callback is called you get a GNode (which object is selected) and (i think) a list of the selected vertecies, edges and/or faces.

Now you can program your rules (just one vertex can be selected etc...what ever)

Further going: you have now to transform the vertex coordinates of your selected points into world coordinates by applying the world transformation matrix from the GNode object. You also have to do this for the other vertex. The result should be 2 points in the 3d world (or 2 vectors) and now you can calculate what ever you want.

Remember that the vertex points are just positions relative to the GNode Axis (or the origin of the object). Back to our example. The cube has a origin (his axis). These axis are anywhere in 3D Space. Relative to these axis (normaly the axis are in the center of the object) are the vertex points which builds edges and the edges builds faces ... etc.

If we say that the cube ist 1,1,1 in size, then the first vertex could be at position 0.5, 0.5, 0.5 - the oposite vertex must be -0.5, -0.5, -0.5

...i hope that this helps a little bit and i'm proud that anyone use my tutorial and my sdk translation. :) Feel free all the time to ask any question that you have.
I still use TrueSpace 6.6
Link: My Youtube Channel
Link: www.DesignDevil.de - Plugins, Tutorials and more about TrueSpace 6.6
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 »

Ouch! This seems more difficult than what I thought :?

In the SDK I can see an other command called tsxAViewPickVertex. Perhaps this one would allow to pick up the point directly rather than through an object...
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 »

Yes (and no) ... this is more something like a collision check between the mouse position and the nearest vertex under the mouse. But it is a good example for my description. The returned parameter by this function are:

ppPolyh - Polyhedron whose vertex was picked
pVxIndex - index of picked vertexin pPolyh

ppPolyh means that this is a pointer to a pPolyh object which means it is a GNode object and his type is Polyhedron (this is for example a nurbs object can not have a vertex)

The trueSpace sdk is really bad written (in my eyes and i have a lot of experience in programming). To learn the internals of the structure of tS is very difficult. Well, there are a lot of informations in the sdk documentation but you have to read it very, very, very, very, very carefully - really...

As a tip (i startet with this): look at the example codes (no matter if they are in C++) and try to understand what and why they do what they do.

btw, i have icq and skype if you need more detailed help.
I still use TrueSpace 6.6
Link: My Youtube Channel
Link: www.DesignDevil.de - Plugins, Tutorials and more about TrueSpace 6.6
stan
Master Chief Petty Officer
Posts: 580
Joined: 21 May 2009, 17:20

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

Post by stan »

Emmanuel, use : tsxPointsGetAxesPosition (&locp); to get position of selection
this to move in one direction: tsxPointsTranslate (&loct, e_tsxWorldFrame);

actually I have been working on that improvement you asked for, some of it anyway..will send it to you when its ready..
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 »

@stan - this is great and also a good example that the sdk is bad written. I never knew this function until now - this is much, much more easier - fantastic.
I still use TrueSpace 6.6
Link: My Youtube Channel
Link: www.DesignDevil.de - Plugins, Tutorials and more about TrueSpace 6.6
stan
Master Chief Petty Officer
Posts: 580
Joined: 21 May 2009, 17:20

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

Post by stan »

DD, it's part of tsxPointEdit.h

they will get the axis of any selection or translale it.
User avatar
bitkar
Captain
Posts: 1963
Joined: 16 Mar 2010, 07:14
Type the number ten into the box: 0
Location: Czech Republic
Contact:

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

Post by bitkar »

good to know that there is some modeler development going on! keep it up guys, good luck!
Michal aka bitkar
tS freak since tS2 (1998) and forever (tS7.61 modeler)
Post Reply