mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-08 21:24:34 +00:00
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:
parent
c2c5674fe9
commit
b44158cb89
52 changed files with 1860 additions and 1086 deletions
|
|
@ -66,11 +66,12 @@ class GuiObjectView : public GuiTSCtrl, protected AssetPtrCallback
|
|||
|
||||
/// @}
|
||||
|
||||
/// @name Model
|
||||
/// @name Shape
|
||||
/// @{
|
||||
|
||||
///Model loaded for display.
|
||||
DECLARE_SHAPEASSET_REFACTOR(GuiObjectView, Model)
|
||||
///Shape loaded for display.
|
||||
///
|
||||
AssetRef<ShapeAsset> mShapeAssetRef;
|
||||
|
||||
TSShapeInstance* mModelInstance;
|
||||
/// Name of skin to use on model.
|
||||
|
|
@ -102,7 +103,7 @@ class GuiObjectView : public GuiTSCtrl, protected AssetPtrCallback
|
|||
/// @{
|
||||
|
||||
///Model to mount to the primary model.
|
||||
DECLARE_SHAPEASSET_REFACTOR(GuiObjectView, MountedModel)
|
||||
AssetRef<ShapeAsset> mMountedShapeAssetRef;
|
||||
TSShapeInstance* mMountedModelInstance;
|
||||
|
||||
///
|
||||
|
|
@ -176,8 +177,11 @@ class GuiObjectView : public GuiTSCtrl, protected AssetPtrCallback
|
|||
/// Set the skin to use on the primary model.
|
||||
void setSkin( const String& name );
|
||||
|
||||
/// Set the model to show in this view.
|
||||
bool setObjectModel( const String& modelName );
|
||||
/// Set the shape to show in this view.
|
||||
bool setObjectShape( const String& assetId );
|
||||
|
||||
/// Get the shape currently shown in this view.
|
||||
StringTableEntry getObjectShapeId() const { return mShapeAssetRef.assetId; }
|
||||
|
||||
/// @}
|
||||
|
||||
|
|
@ -210,7 +214,8 @@ class GuiObjectView : public GuiTSCtrl, protected AssetPtrCallback
|
|||
void setMountNode( const String& nodeName );
|
||||
|
||||
///
|
||||
bool setMountedObject( const String& modelName );
|
||||
bool setMountedShape( const String& assetId );
|
||||
StringTableEntry getMountedShapeId() const { return mMountedShapeAssetRef.assetId; }
|
||||
|
||||
/// @}
|
||||
|
||||
|
|
@ -274,11 +279,11 @@ class GuiObjectView : public GuiTSCtrl, protected AssetPtrCallback
|
|||
protected:
|
||||
void onAssetRefreshed(AssetPtrBase* pAssetPtrBase) override
|
||||
{
|
||||
if (getModel())
|
||||
setObjectModel(_getModelAssetId());
|
||||
if (mShapeAssetRef.notNull())
|
||||
setObjectShape(mShapeAssetRef.assetId);
|
||||
|
||||
if (getMountedModel())
|
||||
setMountedObject(_getMountedModelAssetId());
|
||||
if (mMountedShapeAssetRef.notNull())
|
||||
setMountedShape(mMountedShapeAssetRef.assetId);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue