Game Development Community

TGB Pro Tools Extending

by smally · in Torque Game Builder · 04/09/2011 (7:42 pm) · 8 replies

Ok, maybe I'm blind here, but could someone please point me to the right area in the codebase for this. I'm adding a new tool to the tileset editor. One that allows me to pan the tileset based on mouse drag position. I've found where in the actual C++ Code to add the skeleton for the functionality, but I can't find where in the script or code, to add the button and to set it's onclick function to setPanTool. I've already made the ConsoleMethod for setPanTool, just like what was made for setEraserTool and the like, and have most if not all of the pan tool coded. So I'm almost there. This is what I get for midnight coding, lol.

Thanks in advance for any pointers, slaps upside the back of my head, etc.

About the author

Most people say that is it is the intellect which makes a great scientist. They are wrong: it is character. -- Albert Einstein


#1
04/09/2011 (9:02 pm)
You might want to start in tgb/tools/levelEditor/, particularly tgb/tools/levelEditor/scripts/toolbar.ed.cs as the root for names to search the other files.

Yes, this is the biggest directory hierarchy in the editor. It's undocumented, badly commented, uses some sort of obtuse messaging system and weird interdependencies back and forth between classes/objects/files. Adding more panels and splitting the object types out among them was not easy, but I did it in the end. Looking at adding things to the toolbar is making me reach for heavy medication ;)
#2
04/09/2011 (9:06 pm)
Well, I know I can add the icon where the others are (tgb/tools/tileLayerEditor), but I'll check that too and see what I can glean from it. Searching for a predefined image like eraserTool didn't help at all in the cs code. Though I thought, maybe it was worth a shot. Searched for it's callback too, didn't find that either. Will let you know if I can surmise a better explanation for where it sits, once I find it. Thanks!
#3
04/09/2011 (9:09 pm)
Look for partial names, look for similar names in strings. It does a lot of funky message-passing to set up the interface. It's downright scary once you get into the individual controls ;)
#4
04/09/2011 (9:17 pm)
Oh, trust me, I know.. lol. It's just one of those things, gotta find it's magic string. :D
#5
04/09/2011 (9:30 pm)
Ok, found it.. tgb/tools/levelEditor/scripts/forms/quickEditClasses/t2dTileLayer.ed.cs ... Easy to miss ;) Thanks for the tip. If anyone is interested in the edit, I'll post a resource for it, when I'm done.
#6
04/10/2011 (11:42 am)
Well, since posting a resource isn't an option for TGB/Torque2D anyone who wants this tool, can contact me if they have a license for the pro version. This does require a source code edit to the tools code base, albiet a small one.
#7
04/10/2011 (4:47 pm)
Why would you think you can't post resources for T2D?
#8
04/10/2011 (4:51 pm)
When I went to post a resource for Torque 2d, in the "Relevant Products" drop down I didn't see anything for Torque 2d or TGB there.. I can post the resources fine on TDN for TGB, and honestly... Think that would be the best place for it, since this requires a code edit, etc.

Screen shot here
www.embermill.com/gg/resourcelistings.png