Cleans up ShapeAsset of some unnecessary/redundant elements like extra material and animations tracking

Removed the old SHAPE_ASSET macros
Implements AssetRef struct that acts as a universal wrapper for an templated AssetPtr and AssetId pair
Adds Type handling for AssetRef for ShapeAsset to unify handling in classes that utilize a shapeAsset, so assigning an assetPtr or an assetId will keep a record of the assignment in the event the assetPtr is invalid.
Update all classes that utilized the old SHAPE_ASSET macros to utilize the AssetRef struct and updated the class code to utilize it to provide much more clean and concise code that isn't blocked behind macro definitions
Added a new example class: shapeDatablockExample which allows render of a simple shape object utilizing a simple example datablock.
This commit is contained in:
JeffR 2026-05-31 01:19:26 -05:00
parent c2c5674fe9
commit b44158cb89
52 changed files with 1860 additions and 1086 deletions

View file

@ -176,8 +176,6 @@ protected:
void interpolateTick(F32 delta) override;
void advanceTime(F32 dt) override;
void onDynamicModified(const char* slotName, const char* newValue) override;
/// Start or stop processing ticks depending on our state.
void _updateShouldTick();
@ -196,7 +194,7 @@ protected:
Convex* mConvexList;
DECLARE_SHAPEASSET_NET_REFACTOR(TSStatic, Shape, AdvancedStaticOptionsMask)
AssetRef<ShapeAsset> mShapeAssetRef;
U32 mShapeHash;
Vector<S32> mCollisionDetails;
@ -244,7 +242,7 @@ public:
DECLARE_CATEGORY("Object \t Simple");
static void initPersistFields();
/// returns the shape asset used for this object
StringTableEntry getTypeHint() const override { return (mShapeAsset.notNull()) ? mShapeAsset->getAssetName(): StringTable->EmptyString(); }
StringTableEntry getTypeHint() const override { return (mShapeAssetRef.notNull()) ? mShapeAssetRef.assetPtr->getAssetName(): StringTable->EmptyString(); }
static void consoleInit();
static bool _setFieldSkin(void* object, const char* index, const char* data);
static const char* _getFieldSkin(void* object, const char* data);
@ -289,6 +287,8 @@ public:
void getUtilizedAssets(Vector<StringTableEntry>* usedAssetsList) override;
const AssetPtr<ShapeAsset>& getShapeAsset() const { return mShapeAssetRef.assetPtr; }
private:
void onStaticModified(const char* slotName, const char* newValue = NULL) override;
protected: