What does a plugin n00b need?

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.

What does a plugin n00b need? // SDK, Plug-in & 3rd Party Area

1  2  |  

Post by jayr // Sep 3, 2008, 9:18am

jayr
Total Posts: 1074
pic
lol - I cannot afford visual studio even with the discount just now, so I'm kinda stuck... hopefully soon.

hopefully by then there will be some tutorials out on how to do this thing.


i've just downloaded the free version for now till i get mor familiar with the coding, i won't be making any plugins for a loooong time yet.:(

Post by frootee // Sep 3, 2008, 9:35am

frootee
Total Posts: 2667
pic
Hi Wes. Sorry about that.


LE = Link Editor.

The LE icon is in the same set of icons as the plugin manager:


Click and drag the plugin icon. A flyout window of icons appears.


The LE should be the third icon down. It is dark grey, with some lighter grey boxes in it.


Select the LE icon. The LE window will appear.


This is the '2D View' of your scene.


Back in the main truespace window, select the 'Library' tab.

You will most likely have to add the System-Scripts library:


In the bottom of the truespace window, there is an icon which looks like a folder with a magnifying glass on it. That is the 'library browser'. Click that.


Scroll to the bottom of this window, and double click System-Scripts.


The library tab will now have the system scripts library loaded.


The 2nd icon in the top row is a jscript command. Click and drag that to the Link Editor (LE) window.


Click the orange square to go 'inside' the jscript command.

Make sure you have selected the Methods tab, to enter the view where you can enter your code.


In this view, type the following:


Node.


Notice that a list of available functions for Node appears.

Continue typing to get:


Node.Create('


When you type this, you will see a dropdown list of available nodes which truespace knows exists.


Scroll down to the Examples Package section. You will see that Height field is an available node, since the plugin has 'registered' that node with the system.


Highlight this item, and hit enter. The string will be copied to the methods view for you.


The entire string will look like this:


Node.Create('Examples Package/Fluid Sim Mesh Node' , Space.CurrentScene() );


The Space.CurrentScene() portion is the owner (encapsulator) for the newly created object.

This function returns the string representing the current scene. For more info check out the Space

documentation.


Here is the documentation page for that particular command. Note the prefix: IRi. Basically this means

you can use it in script as an 'action', if you will.


Check the docs for the IRi items. Try them in the script view as well, by typing in their root-level name.

You will see they react the same way, displaying their available functions and properties.


sdk_tS76PublicBeta3/Doc/structIRiNodeItem.html#2a67870bfe6c6fdada10b42020c 56d62


HTH!


Froo

Post by weshowe // Sep 3, 2008, 4:18pm

weshowe
Total Posts: 23
pic
Froo:


Thanks for taking the time to respond. I carefully followed you instructions up until I had "Node.Create('Examples Package/Height field', Space.CurrentScene());" inside the Execute() function.


I feel dumb, but then I was unable to make it do anything. I think this is why they do not let programmers write manuals, because they miss important little details.


I also looked at the documentation page you cited. All this tells me I have some more study to do to connect up all the dots. So far I have managed to execute a command MessageBox() and compile and execute code that calls GetOpenFileName() and reads a mesh file.


I think I have code that will add a cube to the scene, but cannot figure out how to link that to the scene. If I can figure that out, I should be able to do all three things in sequence and have a file importer (well, substituting disk content ofr the cube). If I can do one, I have source for several other formats I can add.


At any rate, I am closer than I was a few days ago, prior to the release of the SDK Beta 3 package.


<* Wes *>

Post by frootee // Sep 3, 2008, 5:01pm

frootee
Total Posts: 2667
pic
Hi Wes. Oh wait a minute... Height Field.. no bad example. You have to do more to that; that example is actually incomplete. That's why 'nothing happened'.


The mesh that is created needs to be encapsulated with a Transform node. That needs to be fixed in the example. That's why you do not see anything in the 3D Space. However, I suspect, if you look in the Link Editor window after executing your command, you will see a node called Height field.


So here's another thing to investigate: Use the topology example. The topology example is complete. At the command prompt, type this, then press the Enter key: examplesplugin.topologyexample


Then look in the Link Editor (LE). You will see the Topology Example node. Click the orange square to go inside that node. You will see two items: A sphere2 node, and a Transform node. Also notice that some of the connectors are solid red (input) or blue (output), or a red / blue circle outlining a white solid circle. These connectors are Exported up one level.


So click the Developer tab at the top of the LE. You'll see lines now connecting the exported connectors to the 'outside world'. This is how the heightfield example is supposed to look, in order to see the height field in 3D. SO....


Compare the heightfield and topology examples to see what is required to complete the height field example in code.


To do it manually, you can open another LE window, and copy the height field node from the new LE window to the other LE window (the one where you are inside the topology example). Now, select the line connecting the Sphere2 Mesh to the outside world, and drag it away from the node. Then release the mouse button. You have just disconnected that connector from the outside world.


Finally, right click on the word 'Mesh' of the height field example, and select 'Export'. The height field mesh connector is now exported. You should see the height field now.

Post by Asem // Sep 3, 2008, 8:05pm

Asem
Total Posts: 255
Is IUnknown and any of its kind like a anything goes type of object?

Post by frootee // Sep 4, 2008, 1:14am

frootee
Total Posts: 2667
pic
Hi Asem. in COM programming, IUnknown is the most generic interface from which all interfaces are derived. Check this out:


http://en.wikipedia.org/wiki/IUnknown

Post by weshowe // Sep 4, 2008, 5:15pm

weshowe
Total Posts: 23
pic
Thanks again, Froo. I guess I need to test before I start modifying things this time.


I noticed a chunk of the source for the topology demo, where a cube was referenced, had been commented out. I don't think that will impede me, because this is just a testbed for me. I just now have to get myself psyched up for another go at this in the next few days.


<* Wes *>

Post by frootee // Sep 4, 2008, 6:01pm

frootee
Total Posts: 2667
pic
no prob wes. A great place to get up to speed on the LE /scripting/plugins is at the Tuesday Night scriptor meetings. :)

Post by weshowe // Sep 5, 2008, 6:40pm

weshowe
Total Posts: 23
pic
We'll see. I'm more interested in making toolsets from C/C++ code.

I did play a little tonight and got the (unmodified) topology example working, so (tomorrow maybe) I will move my code over to there and try to hook it up. If I can get my personal proof-of-concept working, I can tackle making a plugin of it's own from the sample shell.


<* Wes *>
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