fxGenericObject for TGEA 1.8.1
by Jaimi McEntire · 05/01/2009 (12:32 pm) · 9 comments
Download File
fxGenericObject is a sample class that shows how to create a complete, networkable, rendered object. This is similar to Melv May's fxRenderObject, but since it's a complete rewrite, I didn't presume to use the same name.
The purpose of this code is to create a simple and easy to read class that people can use to create their own new objects. This object is not very spectacular graphically - It shows a cube or a sphere, depending on whether a texture is set or not.
To use the object, download the attached file, and move the two included files (fxGenericObject.cpp and fxGenericObject.h) into the Engine/Source/T3D/fx directory. Then open your solution, and add these two files to the Source/T3D/fx folder.
In addition to this, You'll need to make a couple of script changes to make this work:
Open the file Tools/MissionEditor/Scripts/Editors/creator.ed.cs, and add this to the the environment tree (you can create a new group if you want, but this is simpler):
for example, here's my Environment items, with fxGenericObject last:
Be sure to place it last and increment the index number.
now that you have it on the menu, you'll need to provide a Builder, so the editor can construct it. To do this, open up Tools/MissionEditor/Gui/ObjectBuilderGui.ed.gui, and add this function:
Once you've done that, it will appear in the menu under "environment" in the creator.
Drop the object in - and you will see it create a yellow sphere. If you supply a texture, it will draw a textured cube instead.
The C++ code is documented internally. Comments and suggestions are always welcome, I hope this helps.
fxGenericObject is a sample class that shows how to create a complete, networkable, rendered object. This is similar to Melv May's fxRenderObject, but since it's a complete rewrite, I didn't presume to use the same name.
The purpose of this code is to create a simple and easy to read class that people can use to create their own new objects. This object is not very spectacular graphically - It shows a cube or a sphere, depending on whether a texture is set or not.
To use the object, download the attached file, and move the two included files (fxGenericObject.cpp and fxGenericObject.h) into the Engine/Source/T3D/fx directory. Then open your solution, and add these two files to the Source/T3D/fx folder.
In addition to this, You'll need to make a couple of script changes to make this work:
Open the file Tools/MissionEditor/Scripts/Editors/creator.ed.cs, and add this to the the environment tree (you can create a new group if you want, but this is simpler):
for example, here's my Environment items, with fxGenericObject last:
%Environment_Item[18] = "Atlas";
%Environment_Item[19] = "twSurfaceReference";
%Environment_Item[20] = "fxGenericObject"; // Added fxGenericObject Be sure to place it last and increment the index number.
now that you have it on the menu, you'll need to provide a Builder, so the editor can construct it. To do this, open up Tools/MissionEditor/Gui/ObjectBuilderGui.ed.gui, and add this function:
function ObjectBuilderGui::buildfxGenericObject(%this)
{
%this.className = "fxGenericObject";
// You could add fields here to get the editor to prompt you at add time.
%this.process();
}Once you've done that, it will appear in the menu under "environment" in the creator.
Drop the object in - and you will see it create a yellow sphere. If you supply a texture, it will draw a textured cube instead.
The C++ code is documented internally. Comments and suggestions are always welcome, I hope this helps.
About the author
Recent Blogs
• Replicator Updates for TGEA 1.8.1• GuiLensFlareHud - Lens flares and white out for TGEA 1.8.1
• GuiStatusCtrl - *Updated* Display Field Name, Values, Status Bar for any field or method on any named object. TGEA and (new! TGE 1.52)
• Bitmap Channel Embedder
• Updated GuiObjectView for TGEA 1.7.1 and 1.8.0
#2
05/01/2009 (5:30 pm)
Groovy, thanks!
#3
05/02/2009 (11:20 am)
Thanks a lot for sharing! I bet I'll learn from this resource once I'm back to TGEA.
#4
05/02/2009 (2:03 pm)
folks who are interested in this might also enjoy my "happy squiggle ball" tutorial.
#5
05/02/2009 (9:23 pm)
Indeed, I've seen this tutorial before (and bookmarked it) but didn't read it yet.
#6
05/03/2009 (10:57 pm)
Nice work.
#7
06/14/2009 (6:25 pm)
The link to the file is dead.
#8
06/16/2009 (6:06 am)
It should be back up now.
#9
02/08/2011 (6:16 pm)
Looks like the link is dead again. 
Torque 3D Owner Caylo Gypsyblood