Remove cout calls from FBX, LWO and B3D

Fixes #2797
pull/2802/head
RichardTea 2019-12-02 11:56:55 +00:00
parent 6117c3f589
commit 496382982a
4 changed files with 54 additions and 75 deletions

View File

@ -117,20 +117,8 @@ const aiImporterDesc* B3DImporter::GetInfo () const
return &desc;
}
#ifdef DEBUG_B3D
extern "C"{ void _stdcall AllocConsole(); }
#endif
// ------------------------------------------------------------------------------------------------
void B3DImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler){
#ifdef DEBUG_B3D
AllocConsole();
freopen( "conin$","r",stdin );
freopen( "conout$","w",stdout );
freopen( "conout$","w",stderr );
cout<<"Hello world from the B3DImporter!"<<endl;
#endif
std::unique_ptr<IOStream> file( pIOHandler->Open( pFile));
// Check whether we can read from the file
@ -158,7 +146,7 @@ AI_WONT_RETURN void B3DImporter::Oops(){
// ------------------------------------------------------------------------------------------------
AI_WONT_RETURN void B3DImporter::Fail( string str ){
#ifdef DEBUG_B3D
cout<<"Error in B3D file data: "<<str<<endl;
ASSIMP_LOG_ERROR_F("Error in B3D file data: %s", str.c_str());
#endif
throw DeadlyImportError( "B3D Importer - error in B3D file data: "+str );
}
@ -238,7 +226,7 @@ string B3DImporter::ReadChunk(){
tag+=char( ReadByte() );
}
#ifdef DEBUG_B3D
// cout<<"ReadChunk:"<<tag<<endl;
ASSIMP_LOG_DEBUG_F("ReadChunk: %s", tag.c_str());
#endif
unsigned sz=(unsigned)ReadInt();
_stack.push_back( _pos+sz );
@ -398,7 +386,7 @@ void B3DImporter::ReadTRIS( int v0 ){
matid = 0;
} else if (matid < 0 || matid >= (int)_materials.size()) {
#ifdef DEBUG_B3D
cout<<"material id="<<matid<<endl;
ASSIMP_LOG_ERROR_F("material id=%d", matid);
#endif
Fail("Bad material id");
}
@ -418,7 +406,7 @@ void B3DImporter::ReadTRIS( int v0 ){
int i2 = ReadInt() + v0;
if (i0 < 0 || i0 >= (int)_vertices.size() || i1 < 0 || i1 >= (int)_vertices.size() || i2 < 0 || i2 >= (int)_vertices.size()) {
#ifdef DEBUG_B3D
cout<<"Bad triangle index: i0="<<i0<<", i1="<<i1<<", i2="<<i2<<endl;
ASSIMP_LOG_ERROR_F("Bad triangle index: i0=%d, i1=%d, i2=%d", i0, i1, i2);
#endif
Fail("Bad triangle index");
continue;
@ -462,19 +450,13 @@ void B3DImporter::ReadBONE( int id ){
}
Vertex &v = _vertices[vertex];
int i;
for( i=0;i<4;++i ){
for (int i = 0; i < 4; ++i) {
if (!v.weights[i]) {
v.bones[i] = id;
v.weights[i] = weight;
break;
}
}
#ifdef DEBUG_B3D
if( i==4 ){
cout<<"Too many bone weights"<<endl;
}
#endif
}
}

View File

@ -1597,11 +1597,10 @@ namespace Assimp {
aiBone *bone = nullptr;
if (bone_map.count(deformer_name)) {
std::cout << "retrieved bone from lookup " << bone_name.C_Str() << ". Deformer: " << deformer_name
<< std::endl;
ASSIMP_LOG_DEBUG_F("retrieved bone from lookup %s. Deformer:%s", bone_name.C_Str(), deformer_name.c_str());
bone = bone_map[deformer_name];
} else {
std::cout << "created new bone " << bone_name.C_Str() << ". Deformer: " << deformer_name << std::endl;
ASSIMP_LOG_DEBUG_F("created new bone %s. Deformer: %s", bone_name.C_Str(), deformer_name.c_str());
bone = new aiBone();
bone->mName = bone_name;
@ -1648,7 +1647,7 @@ namespace Assimp {
bone_map.insert(std::pair<const std::string, aiBone *>(deformer_name, bone));
}
std::cout << "bone research: Indicies size: " << out_indices.size() << std::endl;
ASSIMP_LOG_DEBUG_F("bone research: Indicies size: %zu", out_indices.size());
// lookup must be populated in case something goes wrong
// this also allocates bones to mesh instance outside

View File

@ -586,7 +586,6 @@ void LWOImporter::GenerateNodeGraph(std::map<uint16_t,aiNode*>& apcNodes)
root->mName.Set("<LWORoot>");
//Set parent of all children, inserting pivots
//std::cout << "Set parent of all children" << std::endl;
std::map<uint16_t, aiNode*> mapPivot;
for (auto itapcNodes = apcNodes.begin(); itapcNodes != apcNodes.end(); ++itapcNodes) {
@ -618,7 +617,6 @@ void LWOImporter::GenerateNodeGraph(std::map<uint16_t,aiNode*>& apcNodes)
}
//Merge pivot map into node map
//std::cout << "Merge pivot map into node map" << std::endl;
for (auto itMapPivot = mapPivot.begin(); itMapPivot != mapPivot.end(); ++itMapPivot) {
apcNodes[itMapPivot->first] = itMapPivot->second;
}

View File

@ -72,7 +72,7 @@ for(LineSplitter splitter(stream);splitter;++splitter) {
if (strtol(splitter[2]) > 5) { .. }
}
std::cout << "Current line is: " << splitter.get_index() << std::endl;
ASSIMP_LOG_DEBUG_F("Current line is: %zu", splitter.get_index());
}
@endcode
*/