Game Development Community

[BUG T3D1.1B1] TSStatic::onAdd() - Shape creation failed! - LOGGED

by Guy Allard · in Torque 3D Professional · 04/29/2010 (8:55 am) · 6 replies

Remote clients connecting to a server give the following error in the clients console for every TSStatic in the level:

*** Phase 2: Download Ghost Objects
TSStatic::onAdd() - Shape creation failed!

Despite claiming that the creation has failed, the shapes show up just fine.

#1
06/22/2010 (6:49 am)
experiencing exactly the same issue. No problems running local client/server. We only see this on the dedicated server.

Running the game locally has no errors of this kind however a locally connected client to a dedicated server as well as any remote connection all see this in the client log.
#2
06/22/2010 (6:58 am)
I've seen this consistently happen in 1.01 but doesn't appear to cause any problems (aside from spamming the console). Also in a dedicated client / server environment.
#3
06/22/2010 (3:24 pm)
It makes the load up slower and let's face it, none of us want errors spamming anything ;-)
#4
07/01/2010 (7:19 pm)
Logged: TQA-492
#5
10/29/2010 (3:23 pm)
I found a solution that worked for us with this error. My team is using AFX 2.0 for T3D 1.1 Beta 1.

Searching the entire engine code, that error is only produced in one spot, in TSStatic::onAdd()
// Setup the shape.
   if ( !_createShape() )
   {
      Con::errorf( "TSStatic::onAdd() - Shape creation failed!" );
      return false;
   }
I traced into _createShape() and found that the failing error came in the lines
if (  isClientObject() && 
         !mShape->preloadMaterialList(mShape.getPath()) && 
         NetConnection::filesWereDownloaded() )
      return false;
You can see there that preloadMaterialList() is really the function that fails and that it is only called if isClientObject() succeeds, which is why the error of this thread only crops up in pure clients. Further investigation showed the object that failed for us had a material defined that used a texture which was named different from the material name inside the model file. Even though we used "mapTo" it didn't matter since the code still looks for a tex file with the same name as the mat name in the model. Once we changed the tex file name to match and updated the diffuseMap field of the material definition accordingly, the errors were gone.

Ex:
The material name in the model was someMatName.
The material def looked like this:
singleton Material(MAT_someMatName)
{
	mapTo = "someMatName";

	diffuseMap[0] = "someOtherName";
};
and the text file was someOtherName.png.

So we renamed the tex file to someMatName.png and changed the diffuse line to
diffuseMap[0] = "someMatName";
and...voila!
#6
09/22/2011 (8:43 am)
@GG - Is there a fix coming for this still? I have like 300 models throwing this error and I don't really want to edit each one!

EDIT: As I'm going through this (even though I don't want to!) I've found that the model and the texture need to be in the same directory also, maybe the materials.cs file too.