add some asserts.

pull/1466/head
Kim Kulling 2017-09-30 10:47:23 +02:00
parent 1c76962c98
commit c4e91eb33f
4 changed files with 12 additions and 17 deletions

View File

@ -71,7 +71,6 @@ class AssbinImporter : public BaseImporter
private: private:
bool shortened; bool shortened;
bool compressed; bool compressed;
protected:
public: public:
virtual bool CanRead( virtual bool CanRead(

View File

@ -1096,7 +1096,7 @@ void Converter::SetupNodeMetadata( const Model& model, aiNode& nd )
DirectPropertyMap unparsedProperties = props.GetUnparsedProperties(); DirectPropertyMap unparsedProperties = props.GetUnparsedProperties();
// create metadata on node // create metadata on node
std::size_t numStaticMetaData = 2; const std::size_t numStaticMetaData = 2;
aiMetadata* data = aiMetadata::Alloc( static_cast<unsigned int>(unparsedProperties.size() + numStaticMetaData) ); aiMetadata* data = aiMetadata::Alloc( static_cast<unsigned int>(unparsedProperties.size() + numStaticMetaData) );
nd.mMetaData = data; nd.mMetaData = data;
int index = 0; int index = 0;

View File

@ -62,8 +62,7 @@ class Element;
P: "ShininessExponent", "double", "Number", "",0.5 P: "ShininessExponent", "double", "Number", "",0.5
@endvebatim @endvebatim
*/ */
class Property class Property {
{
protected: protected:
Property(); Property();
@ -78,15 +77,13 @@ public:
}; };
template<typename T> template<typename T>
class TypedProperty : public Property class TypedProperty : public Property {
{
public: public:
explicit TypedProperty(const T& value) explicit TypedProperty(const T& value)
: value(value) : value(value) {
{ // empty
} }
public:
const T& Value() const { const T& Value() const {
return value; return value;
} }
@ -97,21 +94,19 @@ private:
typedef std::fbx_unordered_map<std::string,std::shared_ptr<Property> > DirectPropertyMap; typedef std::fbx_unordered_map<std::string,std::shared_ptr<Property> > DirectPropertyMap;
typedef std::fbx_unordered_map<std::string,const Property*> PropertyMap; typedef std::fbx_unordered_map<std::string,const Property*> PropertyMap;
typedef std::fbx_unordered_map<std::string,const Element*> LazyPropertyMap; typedef std::fbx_unordered_map<std::string,const Element*> LazyPropertyMap;
/** /**
* Represents a property table as can be found in the newer FBX files (Properties60, Properties70) * Represents a property table as can be found in the newer FBX files (Properties60, Properties70)
*/ */
class PropertyTable class PropertyTable {
{
public: public:
// in-memory property table with no source element // in-memory property table with no source element
PropertyTable(); PropertyTable();
PropertyTable(const Element& element, std::shared_ptr<const PropertyTable> templateProps); PropertyTable(const Element& element, std::shared_ptr<const PropertyTable> templateProps);
~PropertyTable(); ~PropertyTable();
public:
const Property* Get(const std::string& name) const; const Property* Get(const std::string& name) const;
// PropertyTable's need not be coupled with FBX elements so this can be NULL // PropertyTable's need not be coupled with FBX elements so this can be NULL
@ -132,7 +127,6 @@ private:
const Element* const element; const Element* const element;
}; };
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
template <typename T> template <typename T>
inline inline

View File

@ -650,12 +650,14 @@ void SMDImporter::ComputeAbsoluteBoneTransformations()
// create output materials // create output materials
void SMDImporter::CreateOutputMaterials() void SMDImporter::CreateOutputMaterials()
{ {
ai_assert( nullptr != pScene );
pScene->mNumMaterials = (unsigned int)aszTextures.size(); pScene->mNumMaterials = (unsigned int)aszTextures.size();
pScene->mMaterials = new aiMaterial*[std::max(1u, pScene->mNumMaterials)]; pScene->mMaterials = new aiMaterial*[std::max(1u, pScene->mNumMaterials)];
for (unsigned int iMat = 0; iMat < pScene->mNumMaterials;++iMat) for (unsigned int iMat = 0; iMat < pScene->mNumMaterials; ++iMat) {
{
aiMaterial* pcMat = new aiMaterial(); aiMaterial* pcMat = new aiMaterial();
ai_assert( nullptr != pcMat );
pScene->mMaterials[iMat] = pcMat; pScene->mMaterials[iMat] = pcMat;
aiString szName; aiString szName;