Game Development Community

Print objects that have no material to console

by Jon Wilsdon · in Torque Game Engine Advanced · 10/10/2006 (3:57 pm) · 1 replies

The question came up in this forum post about what could cause materials to be showing up as the 'No Material' so I decided to post a short snippet we added to the engine to help us debug and notice any materials that are improperly assigned. The following will print out to the console the material name, and the model name that is trying to call that material.

In tsShapeInstance.cpp around line 345 in the TSShapeInstance::initMatInstances() function:

right after:

      if( matInst )
      {
         matInst->init( sgData, (GFXVertexFlags)getGFXVertFlags( tsVertex ) );
      }

add:

      else {
         Con::errorf( "** MATERIAL %s on %s/%s DOES NOT EXIST", mMaterialList->getMaterialName( i ), hShape.getFilePath(), hShape.getFileName() );
      }