Merge pull request #1249 from Azaezel/alpha41/refreshrevamp

hot editing tsstatics crashfix
This commit is contained in:
Brian Roberts 2024-04-07 14:26:15 -05:00 committed by GitHub
commit f0e7a27c16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 13 additions and 24 deletions

View file

@ -318,8 +318,6 @@ void ImageAsset::_onResourceChanged(const Torque::Path& path)
return; return;
refreshAsset(); refreshAsset();
onAssetRefresh();
} }
void ImageAsset::setImageFileName(const char* pScriptFile) void ImageAsset::setImageFileName(const char* pScriptFile)

View file

@ -151,7 +151,7 @@ public:
static U32 getAssetById(StringTableEntry assetId, AssetPtr<ImageAsset>* imageAsset); static U32 getAssetById(StringTableEntry assetId, AssetPtr<ImageAsset>* imageAsset);
static U32 getAssetById(String assetId, AssetPtr<ImageAsset>* imageAsset) { return getAssetById(assetId.c_str(), imageAsset); }; static U32 getAssetById(String assetId, AssetPtr<ImageAsset>* imageAsset) { return getAssetById(assetId.c_str(), imageAsset); };
U32 load(); U32 load() override;
protected: protected:
void initializeAsset(void) override; void initializeAsset(void) override;

View file

@ -111,7 +111,7 @@ public:
void setBakedSceneFile(const char* pBakedSceneFile); void setBakedSceneFile(const char* pBakedSceneFile);
inline StringTableEntry getBakedSceneFile(void) const { return mBakedSceneFile; }; inline StringTableEntry getBakedSceneFile(void) const { return mBakedSceneFile; };
SimObjectId load(); U32 load() override { return Ok; };
protected: protected:
static bool setLevelFile(void *obj, const char *index, const char *data) { static_cast<LevelAsset*>(obj)->setLevelFile(data); return false; } static bool setLevelFile(void *obj, const char *index, const char *data) { static_cast<LevelAsset*>(obj)->setLevelFile(data); return false; }

View file

@ -104,7 +104,7 @@ public:
static void initPersistFields(); static void initPersistFields();
void copyTo(SimObject* object) override; void copyTo(SimObject* object) override;
U32 load(); U32 load() override;
StringTableEntry getMaterialDefinitionName() { return mMatDefinitionName; } StringTableEntry getMaterialDefinitionName() { return mMatDefinitionName; }
SimObjectPtr<Material> getMaterialDefinition() { return mMaterialDefinition; } SimObjectPtr<Material> getMaterialDefinition() { return mMaterialDefinition; }

View file

@ -304,8 +304,6 @@ void ShapeAsset::_onResourceChanged(const Torque::Path &path)
return; return;
refreshAsset(); refreshAsset();
onAssetRefresh();
} }
U32 ShapeAsset::load() U32 ShapeAsset::load()
@ -419,9 +417,10 @@ U32 ShapeAsset::load()
} }
} }
mLoadedState = Ok;
mChangeSignal.trigger(); mChangeSignal.trigger();
mLoadedState = Ok;
return mLoadedState; return mLoadedState;
} }
@ -534,6 +533,8 @@ void ShapeAsset::onAssetRefresh(void)
// Update. // Update.
if(!Platform::isFullPath(mFileName)) if(!Platform::isFullPath(mFileName))
mFilePath = getOwned() ? expandAssetFilePath(mFileName) : mFilePath; mFilePath = getOwned() ? expandAssetFilePath(mFileName) : mFilePath;
load();
} }
void ShapeAsset::SplitSequencePathAndName(String& srcPath, String& srcName) void ShapeAsset::SplitSequencePathAndName(String& srcPath, String& srcName)

View file

@ -132,7 +132,7 @@ public:
/// Declare Console Object. /// Declare Console Object.
DECLARE_CONOBJECT(ShapeAsset); DECLARE_CONOBJECT(ShapeAsset);
U32 load(); U32 load() override;
TSShape* getShape() { return mShape; } TSShape* getShape() { return mShape; }

View file

@ -156,7 +156,7 @@ public:
DECLARE_CONOBJECT(SoundAsset); DECLARE_CONOBJECT(SoundAsset);
static bool _setSoundFile(void* object, const char* index, const char* data); static bool _setSoundFile(void* object, const char* index, const char* data);
U32 load(); U32 load() override;
inline StringTableEntry getSoundPath(const U32 slotId = 0) const { return mSoundPath[slotId]; }; inline StringTableEntry getSoundPath(const U32 slotId = 0) const { return mSoundPath[slotId]; };
SFXProfile* getSfxProfile(const U32 slotId = 0) { return &mSFXProfile[slotId]; } SFXProfile* getSfxProfile(const U32 slotId = 0) { return &mSFXProfile[slotId]; }
SFXPlayList* getSfxPlaylist() { return &mPlaylist; } SFXPlayList* getSfxPlaylist() { return &mPlaylist; }

View file

@ -82,7 +82,7 @@ public:
inline Resource<TerrainFile> getTerrainResource(void) const { return mTerrainFile; }; inline Resource<TerrainFile> getTerrainResource(void) const { return mTerrainFile; };
U32 load(); U32 load() override;
static bool getAssetByFilename(StringTableEntry fileName, AssetPtr<TerrainAsset>* shapeAsset); static bool getAssetByFilename(StringTableEntry fileName, AssetPtr<TerrainAsset>* shapeAsset);
static StringTableEntry getAssetIdByFilename(StringTableEntry fileName); static StringTableEntry getAssetIdByFilename(StringTableEntry fileName);

View file

@ -89,7 +89,7 @@ public:
static void initPersistFields(); static void initPersistFields();
void copyTo(SimObject* object) override; void copyTo(SimObject* object) override;
U32 load(); U32 load() override;
StringTableEntry getMaterialDefinitionName() { return mMatDefinitionName; } StringTableEntry getMaterialDefinitionName() { return mMatDefinitionName; }
SimObjectPtr<TerrainMaterial> getMaterialDefinition() { return mMaterialDefinition; } SimObjectPtr<TerrainMaterial> getMaterialDefinition() { return mMaterialDefinition; }

View file

@ -389,7 +389,7 @@ bool TSStatic::_createShape()
SAFE_DELETE(mPhysicsRep); SAFE_DELETE(mPhysicsRep);
SAFE_DELETE(mShapeInstance); SAFE_DELETE(mShapeInstance);
mAmbientThread = NULL; mAmbientThread = NULL;
mShape = NULL; //mShape = NULL;
U32 assetStatus = ShapeAsset::getAssetErrCode(mShapeAsset); U32 assetStatus = ShapeAsset::getAssetErrCode(mShapeAsset);
if (assetStatus == AssetBase::Ok || assetStatus == AssetBase::UsingFallback) if (assetStatus == AssetBase::Ok || assetStatus == AssetBase::UsingFallback)
@ -606,15 +606,6 @@ void TSStatic::onRemove()
Parent::onRemove(); Parent::onRemove();
} }
void TSStatic::_onResourceChanged(const Torque::Path& path)
{
if (path != Path(mShapeName))
return;
_createShape();
_updateShouldTick();
}
void TSStatic::onShapeChanged() void TSStatic::onShapeChanged()
{ {
_createShape(); _createShape();

View file

@ -169,7 +169,6 @@ protected:
void _renderNormals(ObjectRenderInst* ri, SceneRenderState* state, BaseMatInstance* overrideMat); void _renderNormals(ObjectRenderInst* ri, SceneRenderState* state, BaseMatInstance* overrideMat);
void _onResourceChanged(const Torque::Path& path);
void onShapeChanged(); void onShapeChanged();
// ProcessObject // ProcessObject

View file

@ -91,7 +91,7 @@ public:
return mErrCodeStrings[errCode]; return mErrCodeStrings[errCode];
}; };
U32 getStatus() { return mLoadedState; }; U32 getStatus() { return mLoadedState; };
U32 load() { return NotLoaded; }; virtual U32 load() { return NotLoaded; };
AssetBase(); AssetBase();
virtual ~AssetBase(); virtual ~AssetBase();