SDK University

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.

SDK University // SDK, Plug-in & 3rd Party Area

1  |  

Post by frootee // May 2, 2009, 7:23am

frootee
Total Posts: 2667
pic
I'll try to post some stuff here as I go along; other plugin devs: please feel free to share tips and tricks as well. :)


One issue I ran into the other day was, I was trying to find a Diffuse texture connector. It is not defined in the header files, though it is used.


So, I used the View plugin that comes with the examples. It has a window which provides all the information about the node, including connector GUIDs.

I believe there is a modified version which lets you copy the GUID directly from the window, instead of having to type it into Notepad prior to adding it to the NodeguidSpace3d.h header file.


I added the CONID to the NodeguidSpace3d.h file:



RS_DEFINE_GUID(CON_DIFFUSE_TEXTURE,

0xa2e360c4, 0x94e8, 0x4bda, 0xa2, 0x4d, 0x3f, 0x04, 0xf5, 0x33, 0x51, 0x3d);




so now I can use it whenever I need it.


So, if you cannot find a GUID in the header files, you can use the View plugin to get the information you need.

Post by frootee // May 2, 2009, 7:28am

frootee
Total Posts: 2667
pic
Another useful example is the Rs3DLoader example. It demonstrates the use of

resources in the Visual Studio project. You can use RsObj's as resources. In this example, they are in the BINARY section. I tried to use a different term, RSOBJ, but I had issues. I doubt that really makes a difference; perhaps it was just irony; other things happened that day. Anyways, I reverted back to using BINARY. Maybe that is a special term for Visual Studio. Not sure.


But, you can load these resources as needed, using the SDK function:


FileIOHelper::LoadNodeFromResource()


it is very handy, especially if you know what your RsObj is supposed to look like. Once loaded, you can make changes by accessing the connectors.

Post by robert // May 2, 2009, 7:31am

robert
Total Posts: 609
pic
This thread I'm going to need to keep track of, thanks for sharing. :)

Post by frootee // May 2, 2009, 9:29am

frootee
Total Posts: 2667
pic
In the example files, you'll notice there are files called, RsNodeFactory.cpp,

RsDataFactory.cpp, and RsCmdFactory.cpp


What are these files?


Well, if you create a new node type, you would add its information to the RsNodeFactory.cpp file.


Where?


In the CRsNodeFactory::CreateInstance() and CRsNodeFactory::EnumNodeDesc() sections.


The same applies for the other factories. Each Factory.cpp file has these same functions. So, if you create a custom Command, you add the info to

the CreateInstance and EnumNodeDesc functions.


Now, a word about commands. There are a couple threads in which you can

run your commands. The Master thread's ENUM is 0. This is the default.

However, if you want to use a command which creates a dialog, you really need to use the Interface thread, so you don't tie up truespace processing.


How?


In the CRsCommand::EnumNodeDesc() function, we have:


STDMETHODIMP CRsCmdFactory::EnumCommandDesc(IRsEnumCmdDesc** ppEnumCmdDesc)

{

BEGIN_COMMAND_DESC_MAP()

COMMAND_DESC_ENTRY(IRcLoadFluidsDlgCmd, CRpFluidsPlugin, /* fill object descriptor*/ 0, CMDFLAG_INTERFACE, 0)



END_COMMAND_DESC_MAP()

.....


Notice in this command description entry, I have specified to use the CMDFLAG_INTERFACE enum value.


If you search the sdk header directory, you will find the file containing this enum, along with the other values you can use.

Post by stan // May 2, 2009, 2:52pm

stan
Total Posts: 1240
pic
I believe there is a modified version which lets you copy the GUID directly from the window, instead of having to type it into Notepad prior to adding it to the NodeguidSpace3d.h header file.

that would be the one I made. :rolleyes: its abit rough but it works.
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