Need help creating new t2d object..
by Jason Booth · in Torque Game Builder · 03/01/2006 (9:38 pm) · 4 replies
So, it appears as if the docs on this are woefully out of date, and I've tried everything I can think of, the debugger doesn't seem to be working correctly, and what I'm doing shouldn't be anything difficult to do; which is hopefully where someone on this forum can chime in.
All I've done so far is to make a copy of t2dStaticSprite.h and t2dStaticSprite.cc and rename all instances of t2dStaticSprite to 2tdShapeTexture. I've added this to my project and gotten t2d to compile. I can create my new object from the console without error. However, once I add it to the scene graph, I get an access violation.
I've tried tracing this in the debugger, but it doesn't seem to be following the actual lines in the code that it's executing. It seems to jump around as if it's really looking at some other piece of code instead of whats on the screen, which is more than odd. It seems to be crashing in the physics code after it's added to the scene, but again, stepping through the routines it doesn't even seem to be following the actual code being displayed on the screen, stopping on blank lines and jumping over whole blocks of code it shouldn't. So I figure I can't trust the debugger at all.
The tutorials that exist say that you have to add new object types to a GUID list in the base datablock file; but this GUID mapping no longer seems to exist. I've searched through the code base for references to t2dStaticSprite in case objects need to be included or mapped somewhere else in the code, but there arn't any additional references to this object.
I haven't change a single thing with the class except it's name. It compiles fine. It should just work.
I've posted on this forum before about this and not recieved any responses; so I'm hoping that someone out there can answer this question and has just missed the first two threads. Anyone!?!?!
All I've done so far is to make a copy of t2dStaticSprite.h and t2dStaticSprite.cc and rename all instances of t2dStaticSprite to 2tdShapeTexture. I've added this to my project and gotten t2d to compile. I can create my new object from the console without error. However, once I add it to the scene graph, I get an access violation.
I've tried tracing this in the debugger, but it doesn't seem to be following the actual lines in the code that it's executing. It seems to jump around as if it's really looking at some other piece of code instead of whats on the screen, which is more than odd. It seems to be crashing in the physics code after it's added to the scene, but again, stepping through the routines it doesn't even seem to be following the actual code being displayed on the screen, stopping on blank lines and jumping over whole blocks of code it shouldn't. So I figure I can't trust the debugger at all.
The tutorials that exist say that you have to add new object types to a GUID list in the base datablock file; but this GUID mapping no longer seems to exist. I've searched through the code base for references to t2dStaticSprite in case objects need to be included or mapped somewhere else in the code, but there arn't any additional references to this object.
I haven't change a single thing with the class except it's name. It compiles fine. It should just work.
I've posted on this forum before about this and not recieved any responses; so I'm hoping that someone out there can answer this question and has just missed the first two threads. Anyone!?!?!
About the author
#2
03/01/2006 (10:58 pm)
Thanks Matt, but I'm still stuck on the first step of that tutorial. The first thing you do is copy t2dStaticSprite and replace references to t2dStaticSprite with your class name. It compiles, links, and you can even create (just not display) the new object. it just doesn't work when added to the scene graph, and it should be EXACTLY like a t2dStaticSprite. Thats what I don't understand. It's exactly the same code.
#3
I just tried this article again by simply copying the complete article references from the bottom of the article, compiling them and creating a "t2dItemIcon"; all is fine apart from a minor warning that is created in the "transferDatablock()" call. I'll fix that up soon.
I would suggest simply copying the complete code listings from the bottom of the file to see if that works.
Hope this helps,
- Melv.
03/02/2006 (1:07 am)
I updated that article last Saturday. Only minor edits were required (remove the GUID items) to get it working so I think "woefully out of date" is quite harsh. ;)I just tried this article again by simply copying the complete article references from the bottom of the article, compiling them and creating a "t2dItemIcon"; all is fine apart from a minor warning that is created in the "transferDatablock()" call. I'll fix that up soon.
Quote:I've tried tracing this in the debugger, but it doesn't seem to be following the actual lines in the code that it's executing. It seems to jump around as if it's really looking at some other piece of code instead of whats on the screen, which is more than odd. It seems to be crashing in the physics code after it's added to the scene, but again, stepping through the routines it doesn't even seem to be following the actual code being displayed on the screen, stopping on blank lines and jumping over whole blocks of code it shouldn't. So I figure I can't trust the debugger at all.It sounds to me like you've got other problems unrelated to this article. Have you tried a clean/rebuild? Can you debug the standard static sprite?
Quote:I'm still stuck on the first step of that tutorial. The first thing you do is copy t2dStaticSprite and replace references to t2dStaticSprite with your class namePerhaps I need to go through the tutorial step by step (when I can get time) as this doesn't sound completely correct. If you do this, then you'll still have the "t2dStaticSpriteDatablock" in there which is a duplicate and won't compile. This would need changing to "t2dItemIconDatablock".
I would suggest simply copying the complete code listings from the bottom of the file to see if that works.
Hope this helps,
- Melv.
#4
I didn't have any problems creating custom object. I think I already have my own version of your t2dShapeTexture and it works fine (although the code is a bit rough as I later didn't use it anymore, console methods would have to added for instance).
If you want you can try it. I don't think, I've done anything fancy.
www.unet.univie.ac.at/~a0402917/extStaticSprite.h
www.unet.univie.ac.at/~a0402917/extStaticSprite.cc
-Michael
03/02/2006 (3:42 am)
Hi,I didn't have any problems creating custom object. I think I already have my own version of your t2dShapeTexture and it works fine (although the code is a bit rough as I later didn't use it anymore, console methods would have to added for instance).
If you want you can try it. I don't think, I've done anything fancy.
www.unet.univie.ac.at/~a0402917/extStaticSprite.h
www.unet.univie.ac.at/~a0402917/extStaticSprite.cc
-Michael
Torque Owner Matt Harpold