6.6 sdk

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

6.6 sdk // SDK, Plug-in & 3rd Party Area

1  |  

Post by remnar // Sep 11, 2008, 11:34pm

remnar
Total Posts: 105
Hello, just wondering if there is still any support for the older SDK? It's the only one I understand and can work with at the moment. I have a issue where I'm recording key frames from a start frame to end frame where start frame isn't always 0 but it creates a key frame there anyway messin up the animation. If questions about this previous SDK can be asked, then I'll go into my code details later. I posted a picture of what's going on.

Post by Emmanuel // Sep 12, 2008, 12:04am

Emmanuel
Total Posts: 439
pic
Perhaps the solution is to manage with clips.


I think the "clips" system that came in tS6.6 version was designed to bypass the trueSpace KFE problem with unwanted keyframes at frame 0.


If you want the animation to play from frame 200 with no keyframe at frame 0 making interferences, you must "encapsulate" the anim into a clip first.


What do you think ?

Post by remnar // Sep 12, 2008, 2:51am

remnar
Total Posts: 105
That's exactly what I'm doing. However there is no direct way to create a clip in the SDK. What the documentation explained is that renaming an active clip will essentially move the animation to that clip. If there is another animation being recorded, it creates a new "NoName" clip. I'm using clips to separate a cleanup routine. If there is no user abort, the animation clip will get a name. If there is a user abort, the clip will get a different name then be deleted.

My code basically does the following:

startframe = 49
endframe = 99
//Check if the object has an animation script attached (can't be animated w/o one).
if (tsxSobjEmptyScript(obj) = e_tsxTRUE) then
tsxSobjCreateScript(obj)

tsxGNodeGetSize(obj, v) // get the data, like size into variable v

frame = startframe
loop from startFrame to endFrame
interpolation from current state to new state, so I will use a float value in d for this:
if userCheckReverse then
d = (frame - endframe) / (startframe - endframe) // between 1 and 0
else
d = (frame - startframe) / (endframe - startframe) // between 0 and 1
v1 gets input from user then math is applied depending on user options, so in this example, subtraction. v1 = v - userinput for each xyz values.
v2 = interpolate between v and v1 at d.
tsxAnimSetActiveFrame(obj, frame) // set the active frame for the obj.
tsxGNodeSetSize(obj, v2) // set the new size.
tsxSobjSetFrame(obj, e_tsxKFT_SCALE); // set the key frame type.
frame = frame + 1
if frame > endframe then break out of loop.
end loop

// create new clip by renaming default active one
activeClip = tsxClipsGetActiveClipName(obj)
if (activeClip is not empty) then // it's empty if no animation
tsxClipsRenameClip(obj, activeClip, "PMAnimClip")

tsxAnimSetPlayRanges(startframe, endframe);
tsxAnimSetActiveTime(startframe);
tsxAnimSetPlayMode(e_tsxPLAY_SCENE)
clean up any allocations
end program

Edit: I just thought of something. I could record keys from 0 to number of total frames - 1, then use tsxClipsShiftClip to move it where it should go, in this example, I move it to 49. Can you say "DOH!!!"?

Post by remnar // Sep 12, 2008, 3:36am

remnar
Total Posts: 105
I tried this out, and it works! Thanks for your input, all I had to do is record from 0 to number of frames, using that iteration when setting the frame number, then moving the new clip.

Post by remnar // Sep 14, 2008, 7:13pm

remnar
Total Posts: 105
I have stumbled onto another problem with clips and animation. Using Scatter, if you just animate the objects matrix data (position, rotation, scale) there is no problem and new clips are made like they are supposed to. However if you create an animation using the Gradient color option, which animates the colors onto a tsxMATERIAL pointer, it seems the clip functions in the SDK doesn't work on it. Yet when I look at the Scene Editor, it tells a different story. If I call the clip function for the object pointer (the object that has the animated material painted on it), that clip does get renamed. However if I create an additional animation and rename the "NoName" clip, no new clip shows up in the Scene Editor (plus the animation gets blended into the same clip) and yet no errors are reported from the functions (returns tsxERR_SUCCESS). If I try calling the clip functions using the material pointer, nothing happens and still no errors reported. And the objects in the scene editor show the "NoName" clip. Do I have to treat the animated material differently when using clips or is this another Truespace 6.6 bug?

Edit: I have found the problem and was able to prevent it from happening. After recording a material animation to a clip, that clip becomes the active clip instead of the new "NoName" clip, which is auto generated when making a new animation. So when I animated the matrix data (position, rotation, size), it was going to the material animation clip instead of the "NoName" clip. So I just put a line of code tsxClipsActivateClip(obj, "NoName") before anything gets recorded and that fixed the problem. I am posting this stuff for people who may still be making plugins for modelspace. It is frustrating to run into these issues, then a few minutes later figure it out for myself lol. If I'm spamming the forums, I'll stop. I post a lot because I wanted some feed back. It's too quiet. I'm the only one squaking.

Post by Emmanuel // Sep 15, 2008, 12:18am

Emmanuel
Total Posts: 439
pic
It is good to post your remarks and reports about the various problems you encounter along your development.

A forum is an archive everyone can dig into during several years and your experience is valuable for all.


Since Workspace SDK is much more complex to learn than Modeler one and Modeler offers still offer more tools than Workspace, it sounds logical that people interested in plugins development will continue to study 6.6 sdk.

Post by remnar // Sep 18, 2008, 12:16pm

remnar
Total Posts: 105
A long time ago, I put into the Scatter readme document about the following bug: When Scatter main form is open, left clicking and dragging the yellow part of a widget (and afterward any other part) during primitive object creation causes the cursor to jump and stick to the middle of the screen.


Today I found the reason. I found it by isolating code when the form opens. It lead me to the tsxOnDestroyCB function. Within the callback function it calls (of type tsxOnDestroyCallbackFP), I compare the tsxSOBJ with objects the plugin may have loaded, then update or clean up as needed. I isolated the code up to the first few lines which caused the problem:


if (tsxCheckAbort() = e_tsxTRUE) then begin

tsxOnDestroyCB(tsxMain.tsxid, nil);

exit;

end;


The code within the block isn't triggered while messing with a object creation widget. So the problem is the tsxCheckAbort function itself. In fact I've been having problems with this function not returning True in cases where it should. However that is not the issue here. What I've discovered, is that the moment you click on a object primitive icon in Truespace, the call back function gets called over and over non stop while it is on and when you're creating a object. Somehow the constant calling of tsxCheckAbort so many times a second while handling the object create widget, causes the mouse to get stuck in the center of the window.


Now the question, why did I have this check abort function being called in the first place? The reason is while developing scatter for 6.5 (and possibly previous versions) that even though I have code in the form to turn off the callback, sometimes it wouldn't turn off immediately and would cause a problem when Truespace was shutting down. So calling that function there and shutting down the call back from within worked at the time, but introduced that mouse move bug that still is a problem in 6.6, but no longer because I'm taking it out. Therefore if the call back function is still operational during a shutdown, I'll find another way to shut it down. (probably in a dll release routine).

Post by remnar // Sep 24, 2008, 12:05pm

remnar
Total Posts: 105
I believe there is a bug with tsxPathToMacro function. It used to work in Ts 4.3. However the following code generates an access violation.

tsxPATH* path;
path = tsxPathCreate(); // path = NULL
tsxPathFromPolygon(&path, (tsxPOLYHEDRON*)tsxGetCurrentSelection());
tsxPathToMacro(path);

The current selection is a 2d flat polyhedron object with 3 vertices. The tsxPathToMacro function generates the access violation wether or not I initialized the path variable with tsxPathCreate or NULL. I'd like this to work so I can apply the macro to another object and call the macro sweep function.

Post by v3rd3 // Sep 25, 2008, 10:35am

v3rd3
Total Posts: 388
Where can one get the 6.6 sdk?

Post by remnar // Sep 25, 2008, 3:05pm

remnar
Total Posts: 105
http://www.caligari.com/download/tsx.asp?Cate=DTSX

Post by remnar // Sep 28, 2008, 12:48am

remnar
Total Posts: 105
I found another issue today. What I want to do is rotate a profile so it's one vertex is pointing in the same vector as an edge it's sitting on. So I been researching on how to do this. Since I am totally clueless with the math I can't seem to get to work, I figured I use some sloppy trickery to do the same thing. The trick is to select the edge, get the axes orientation, convert that to a rotation which I can use the number to figure out how to rotate the profile correctly. However, in my tests, I found that if I manually select an edge and look at the rotation, it is vastly different than the rotation I'm getting out of tsxPointsGetAxesOrientation and tsxAxesToEuler. The manual data I'm getting looking at the info panel is correct. If I rotate a cube, the axes is correctly aligned. But if I apply the orientation from the function to the object I'm testing, it's in some weird orientation that's not aligned. What I'm doing to select the edge via code is I have a custom function to get all the edges, then I plug one of those edges into a separate edge array, then call tsxPolyhSelectEdges(obj, 1, sedgearray) (it works I already tested) then call tsxPointsGetAxesOrientation, then tsxPointsClear(), then tsxAxesToEuler. Why would I get different data doing it this way as apposed to doing it manually? I couldn't be selecting a wrong edge because I've already tested in the scene to see if the edge is being selected with the code and it is. I wouldn't have to rely on these buggy SDK functions if I had some 3d math genius helping me out lol.
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn