mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
suppress create warnings from unknown types
This commit is contained in:
parent
d3a082ffde
commit
6b03618a46
@ -29,6 +29,8 @@ WritableFactory *BamReader::_factory = (WritableFactory*)0L;
|
|||||||
BamReader *const BamReader::Null = (BamReader*)0L;
|
BamReader *const BamReader::Null = (BamReader*)0L;
|
||||||
WritableFactory *const BamReader::NullFactory = (WritableFactory*)0L;
|
WritableFactory *const BamReader::NullFactory = (WritableFactory*)0L;
|
||||||
|
|
||||||
|
BamReader::NewTypes BamReader::_new_types;
|
||||||
|
|
||||||
const int BamReader::_cur_major = _bam_major_ver;
|
const int BamReader::_cur_major = _bam_major_ver;
|
||||||
const int BamReader::_cur_minor = _bam_minor_ver;
|
const int BamReader::_cur_minor = _bam_minor_ver;
|
||||||
|
|
||||||
@ -365,6 +367,7 @@ read_handle(DatagramIterator &scan) {
|
|||||||
bam_cat.warning()
|
bam_cat.warning()
|
||||||
<< "Bam file contains objects of unknown type: " << type << "\n";
|
<< "Bam file contains objects of unknown type: " << type << "\n";
|
||||||
new_type = true;
|
new_type = true;
|
||||||
|
_new_types.insert(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now pick up the derivation information.
|
// Now pick up the derivation information.
|
||||||
@ -745,10 +748,25 @@ p_read_object() {
|
|||||||
<< "Unable to create an object of type " << type << endl;
|
<< "Unable to create an object of type " << type << endl;
|
||||||
|
|
||||||
} else if (object->get_type() != type) {
|
} else if (object->get_type() != type) {
|
||||||
bam_cat.warning()
|
if (_new_types.find(type) != _new_types.end()) {
|
||||||
<< "Attempted to create a " << type.get_name() \
|
// This was a type we hadn't heard of before, so it's not
|
||||||
<< " but a " << object->get_type() \
|
// really surprising we didn't know how to create it.
|
||||||
<< " was created instead." << endl;
|
// Suppress the warning (make it a debug statement instead).
|
||||||
|
if (bam_cat.is_debug()) {
|
||||||
|
bam_cat.warning()
|
||||||
|
<< "Attempted to create a " << type.get_name() \
|
||||||
|
<< " but a " << object->get_type() \
|
||||||
|
<< " was created instead." << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// This was a normal type that we should have known how to
|
||||||
|
// create. Report the error.
|
||||||
|
bam_cat.warning()
|
||||||
|
<< "Attempted to create a " << type.get_name() \
|
||||||
|
<< " but a " << object->get_type() \
|
||||||
|
<< " was created instead." << endl;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (bam_cat.is_spam()) {
|
if (bam_cat.is_spam()) {
|
||||||
|
@ -195,6 +195,13 @@ private:
|
|||||||
PTAMap _pta_map;
|
PTAMap _pta_map;
|
||||||
int _pta_id;
|
int _pta_id;
|
||||||
|
|
||||||
|
// This is used internally to record all of the new types created
|
||||||
|
// on-the-fly to satisfy bam requirements. We keep track of this
|
||||||
|
// just so we can suppress warning messages from attempts to create
|
||||||
|
// objects of these types.
|
||||||
|
typedef pset<TypeHandle> NewTypes;
|
||||||
|
static NewTypes _new_types;
|
||||||
|
|
||||||
int _file_major, _file_minor;
|
int _file_major, _file_minor;
|
||||||
static const int _cur_major;
|
static const int _cur_major;
|
||||||
static const int _cur_minor;
|
static const int _cur_minor;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user