Added getShapeConstructorFilePath console function on shapeAsset

Fixed typo in import config settings for DuplicateAutoResolution
Converted TSShapeConstructor to utilize assets
Updated shape editor to work with assetified constructors
Converted guiBitmapButtonCtrl to use assets
This commit is contained in:
Areloch 2021-08-02 04:20:27 -05:00
parent 52c83d19e1
commit 88ae8a9665
181 changed files with 2343 additions and 1577 deletions

View file

@ -35,6 +35,9 @@
#include "gfx/gfxDrawUtil.h"
#include "collision/concretePolyList.h"
#include "T3D/assets/ShapeAsset.h"
#include "T3D/assets/ShapeAnimationAsset.h"
#ifdef TORQUE_COLLADA
#include "collision/optimizedPolyList.h"
#include "ts/collada/colladaUtils.h"
@ -399,6 +402,35 @@ bool GuiShapeEdPreview::setObjectModel(const char* modelName)
return true;
}
bool GuiShapeEdPreview::setObjectShapeAsset(const char* assetId)
{
SAFE_DELETE(mModel);
unmountAll();
mThreads.clear();
mActiveThread = -1;
StringTableEntry modelName = StringTable->EmptyString();
if (AssetDatabase.isDeclaredAsset(assetId))
{
StringTableEntry id = StringTable->insert(assetId);
StringTableEntry assetType = AssetDatabase.getAssetType(id);
if (assetType == StringTable->insert("ShapeAsset"))
{
ShapeAsset* asset = AssetDatabase.acquireAsset<ShapeAsset>(id);
modelName = asset->getShapeFilePath();
AssetDatabase.releaseAsset(id);
}
else if (assetType == StringTable->insert("ShapeAnimationAsset"))
{
ShapeAnimationAsset* asset = AssetDatabase.acquireAsset<ShapeAnimationAsset>(id);
modelName = asset->getAnimationPath();
AssetDatabase.releaseAsset(id);
}
}
return setObjectModel(modelName);
}
void GuiShapeEdPreview::_onResourceChanged(const Torque::Path& path)
{
if (path != Torque::Path(mModelName))
@ -1717,6 +1749,14 @@ DefineEngineMethod( GuiShapeEdPreview, setModel, bool, ( const char* shapePath )
return object->setObjectModel( shapePath );
}
DefineEngineMethod(GuiShapeEdPreview, setShapeAsset, bool, (const char* shapeAsset), ,
"Sets the model to be displayed in this control\n\n"
"@param shapeName Name of the model to display.\n"
"@return True if the model was loaded successfully, false otherwise.\n")
{
return object->setObjectShapeAsset(shapeAsset);
}
DefineEngineMethod( GuiShapeEdPreview, fitToShape, void, (),,
"Adjust the camera position and zoom to fit the shape within the view.\n\n" )
{