Merge pull request #539 from Azaezel/alpha40/perturbedPrefabs

crash fixes
This commit is contained in:
Brian Roberts 2021-08-18 00:12:04 -05:00 committed by GitHub
commit 773a90f1ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 10 deletions

View file

@ -172,9 +172,7 @@ void LevelAsset::loadAsset()
if (previewImageAssetId != StringTable->EmptyString()) if (previewImageAssetId != StringTable->EmptyString())
{ {
mPreviewImageAssetId = previewImageAssetId; mPreviewImageAssetId = previewImageAssetId;
mPreviewImageAsset = mPreviewImageAssetId;
AssetPtr<ImageAsset> previewImgAsset = mPreviewImageAssetId;
mPreviewImageAsset = previewImgAsset;
} }
} }

View file

@ -202,7 +202,7 @@ void DecalData::initPersistFields()
"grid; use #textureCoords to manually specify UV coordinates for " "grid; use #textureCoords to manually specify UV coordinates for "
"irregular sized frames." ); "irregular sized frames." );
addField( "textureCoords", TypeRectF, Offset( texRect, DecalData ), MAX_TEXCOORD_COUNT, addField( "textureCoords", TypeRectUV, Offset( texRect, DecalData ), MAX_TEXCOORD_COUNT,
"@brief An array of RectFs (topleft.x topleft.y extent.x extent.y) " "@brief An array of RectFs (topleft.x topleft.y extent.x extent.y) "
"representing the UV coordinates for each frame in the imagemap.\n\n" "representing the UV coordinates for each frame in the imagemap.\n\n"
"@note This field should only be set if the imagemap frames are " "@note This field should only be set if the imagemap frames are "
@ -313,7 +313,9 @@ void DecalData::_initMaterial()
{ {
SAFE_DELETE( matInst ); SAFE_DELETE( matInst );
if (mMaterialAsset.notNull()) _setMaterial(getMaterial());
if (mMaterialAsset.notNull() && mMaterialAsset->getStatus() == MaterialAsset::Ok)
{ {
matInst = getMaterialResource()->createMatInstance(); matInst = getMaterialResource()->createMatInstance();
} }

View file

@ -71,6 +71,8 @@ Prefab::Prefab()
mNetFlags.clear(Ghostable); mNetFlags.clear(Ghostable);
mTypeMask |= StaticObjectType; mTypeMask |= StaticObjectType;
mFilename = StringTable->EmptyString();
} }
Prefab::~Prefab() Prefab::~Prefab()
@ -558,6 +560,7 @@ bool Prefab::buildExportPolyList(ColladaUtils::ExportData* exportData, const Box
void Prefab::getUtilizedAssets(Vector<StringTableEntry>* usedAssetsList) void Prefab::getUtilizedAssets(Vector<StringTableEntry>* usedAssetsList)
{ {
if (!mChildGroup) return;
Vector<SceneObject*> foundObjects; Vector<SceneObject*> foundObjects;
mChildGroup->findObjectByType(foundObjects); mChildGroup->findObjectByType(foundObjects);

View file

@ -98,23 +98,23 @@ public:
/// Asset configuration. /// Asset configuration.
inline void setAssetName(const char* pAssetName) { if (mpOwningAssetManager == NULL) mpAssetDefinition->mAssetName = StringTable->insert(pAssetName); } inline void setAssetName(const char* pAssetName) { if (mpOwningAssetManager == NULL) mpAssetDefinition->mAssetName = StringTable->insert(pAssetName); }
inline StringTableEntry getAssetName(void) const { return mpAssetDefinition->mAssetName; } inline StringTableEntry getAssetName(void) const { return mpAssetDefinition ? mpAssetDefinition->mAssetName : StringTable->EmptyString(); }
void setAssetDescription(const char* pAssetDescription); void setAssetDescription(const char* pAssetDescription);
inline StringTableEntry getAssetDescription(void) const { return mpAssetDefinition->mAssetDescription; } inline StringTableEntry getAssetDescription(void) const { return mpAssetDefinition ? mpAssetDefinition->mAssetDescription : StringTable->EmptyString(); }
void setAssetCategory(const char* pAssetCategory); void setAssetCategory(const char* pAssetCategory);
inline StringTableEntry getAssetCategory(void) const { return mpAssetDefinition->mAssetCategory; } inline StringTableEntry getAssetCategory(void) const { return mpAssetDefinition ? mpAssetDefinition->mAssetCategory : StringTable->EmptyString(); }
void setAssetAutoUnload(const bool autoUnload); void setAssetAutoUnload(const bool autoUnload);
inline bool getAssetAutoUnload(void) const { return mpAssetDefinition->mAssetAutoUnload; } inline bool getAssetAutoUnload(void) const { return mpAssetDefinition->mAssetAutoUnload; }
void setAssetInternal(const bool assetInternal); void setAssetInternal(const bool assetInternal);
inline bool getAssetInternal(void) const { return mpAssetDefinition->mAssetInternal; } inline bool getAssetInternal(void) const { return mpAssetDefinition->mAssetInternal; }
inline bool getAssetPrivate(void) const { return mpAssetDefinition->mAssetPrivate; } inline bool getAssetPrivate(void) const { return mpAssetDefinition->mAssetPrivate; }
inline StringTableEntry getAssetType(void) const { return mpAssetDefinition->mAssetType; } inline StringTableEntry getAssetType(void) const { return mpAssetDefinition ? mpAssetDefinition->mAssetType: StringTable->EmptyString(); }
inline S32 getAcquiredReferenceCount(void) const { return mAcquireReferenceCount; } inline S32 getAcquiredReferenceCount(void) const { return mAcquireReferenceCount; }
inline bool getOwned(void) const { return mpOwningAssetManager != NULL; } inline bool getOwned(void) const { return mpOwningAssetManager != NULL; }
// Asset Id is only available once registered with the asset manager. // Asset Id is only available once registered with the asset manager.
inline StringTableEntry getAssetId(void) const { return mpAssetDefinition->mAssetId; } inline StringTableEntry getAssetId(void) const { return mpAssetDefinition ? mpAssetDefinition->mAssetId : StringTable->EmptyString(); }
/// Expanding/Collapsing asset paths is only available once registered with the asset manager. /// Expanding/Collapsing asset paths is only available once registered with the asset manager.
StringTableEntry expandAssetFilePath(const char* pAssetFilePath) const; StringTableEntry expandAssetFilePath(const char* pAssetFilePath) const;