mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-12 19:31:41 +00:00
Added initial implement of Image Types for GFX resource management
Added logic to intercept TSStatic setting shape to try and utilize a shapeAsset if it can find a matching loose file Added lookup logic for getting any textures inside collada files to streamline asset importing logic Fixed modal behavior for Import config and import window Initial implementation of loose file/legacy file importing Adjusted Asset Browser and Asset Import refreshing behavior to queue to improve performance by avoiding multiple refreshes as well as potential infinite loops Fixed volume visibility behavior Fixed physics world viz toggle
This commit is contained in:
parent
e885722093
commit
9c381caea2
21 changed files with 753 additions and 145 deletions
|
|
@ -82,6 +82,24 @@ ConsoleSetType(TypeImageAssetPtr)
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ImplementEnumType(ImageAssetType,
|
||||
"Type of mesh data available in a shape.\n"
|
||||
"@ingroup gameObjects")
|
||||
{ ImageAsset::Albedo, "Albedo", "" },
|
||||
{ ImageAsset::Normal, "Normal", "" },
|
||||
{ ImageAsset::Composite, "Composite", "" },
|
||||
{ ImageAsset::GUI, "GUI", "" },
|
||||
{ ImageAsset::Roughness, "Roughness", "" },
|
||||
{ ImageAsset::AO, "AO", "" },
|
||||
{ ImageAsset::Metalness, "Metalness", "" },
|
||||
{ ImageAsset::Glow, "Glow", "" },
|
||||
{ ImageAsset::Particle, "Particle", "" },
|
||||
{ ImageAsset::Decal, "Decal", "" },
|
||||
|
||||
EndImplementEnumType;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
ImageAsset::ImageAsset() : AssetBase(), mImage(nullptr), mUseMips(true), mIsHDRImage(false), mIsValidImage(false)
|
||||
{
|
||||
mImageFileName = StringTable->EmptyString();
|
||||
|
|
@ -105,6 +123,8 @@ void ImageAsset::initPersistFields()
|
|||
|
||||
addField("useMips", TypeBool, Offset(mUseMips, ImageAsset), "Should the image use mips? (Currently unused).");
|
||||
addField("isHDRImage", TypeBool, Offset(mIsHDRImage, ImageAsset), "Is the image in an HDR format? (Currently unused)");
|
||||
|
||||
addField("imageType", TypeImageAssetType, Offset(mImageType, ImageAsset), "What the main use-case for the image is for.");
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -47,6 +47,23 @@ class ImageAsset : public AssetBase
|
|||
{
|
||||
typedef AssetBase Parent;
|
||||
|
||||
public:
|
||||
/// The different types of image use cases
|
||||
enum ImageTypes
|
||||
{
|
||||
Albedo = 0,
|
||||
Normal = 1,
|
||||
Composite = 2,
|
||||
GUI = 3,
|
||||
Roughness = 4,
|
||||
AO = 5,
|
||||
Metalness = 6,
|
||||
Glow = 7,
|
||||
Particle = 8,
|
||||
Decal = 9,
|
||||
};
|
||||
|
||||
protected:
|
||||
StringTableEntry mImageFileName;
|
||||
|
||||
GFXTexHandle mImage;
|
||||
|
|
@ -55,6 +72,8 @@ class ImageAsset : public AssetBase
|
|||
bool mUseMips;
|
||||
bool mIsHDRImage;
|
||||
|
||||
ImageTypes mImageType;
|
||||
|
||||
public:
|
||||
ImageAsset();
|
||||
virtual ~ImageAsset();
|
||||
|
|
@ -85,5 +104,8 @@ protected:
|
|||
|
||||
DefineConsoleType(TypeImageAssetPtr, ImageAsset)
|
||||
|
||||
typedef ImageAsset::ImageTypes ImageAssetType;
|
||||
DefineEnumType(ImageAssetType);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -171,8 +171,8 @@ void TSStatic::initPersistFields()
|
|||
&TSStatic::_setShapeAsset, &defaultProtectedGetFn,
|
||||
"The source shape asset.");
|
||||
|
||||
addField("shapeName", TypeShapeFilename, Offset( mShapeName, TSStatic ),
|
||||
"%Path and filename of the model file (.DTS, .DAE) to use for this TSStatic.", AbstractClassRep::FieldFlags::FIELD_HideInInspectors );
|
||||
addProtectedField("shapeName", TypeShapeFilename, Offset( mShapeName, TSStatic ), &TSStatic::_setShape, &defaultProtectedGetFn,
|
||||
"%Path and filename of the model file (.DTS, .DAE) to use for this TSStatic."/*, AbstractClassRep::FieldFlags::FIELD_HideInInspectors*/ );
|
||||
|
||||
endGroup("Shape");
|
||||
|
||||
|
|
@ -261,6 +261,27 @@ void TSStatic::initPersistFields()
|
|||
Parent::initPersistFields();
|
||||
}
|
||||
|
||||
bool TSStatic::_setShape(void* obj, const char* index, const char* data)
|
||||
{
|
||||
TSStatic* ts = static_cast<TSStatic*>(obj);// ->setFile(FileName(data));
|
||||
|
||||
//before we continue, lets hit up the Asset Database to see if this file is associated to an asset. If so, we grab the asset instead
|
||||
AssetQuery query;
|
||||
S32 foundAssetcount = AssetDatabase.findAssetLooseFile(&query, data);
|
||||
if (foundAssetcount == 0)
|
||||
{
|
||||
//didn't find any assets. continue as normal
|
||||
ts->mShapeName = StringTable->insert(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
ts->setShapeAsset(query.mAssetList[0]);
|
||||
ts->mShapeName = StringTable->EmptyString();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TSStatic::_setShapeAsset(void* obj, const char* index, const char* data)
|
||||
{
|
||||
TSStatic* ts = static_cast<TSStatic*>(obj);// ->setFile(FileName(data));
|
||||
|
|
@ -539,8 +560,10 @@ void TSStatic::prepCollision()
|
|||
setMaskBits( UpdateCollisionMask );
|
||||
|
||||
// Allow the ShapeInstance to prep its collision if it hasn't already
|
||||
if ( mShapeInstance )
|
||||
if (mShapeInstance)
|
||||
mShapeInstance->prepCollision();
|
||||
else
|
||||
return;
|
||||
|
||||
// Cleanup any old collision data
|
||||
mCollisionDetails.clear();
|
||||
|
|
|
|||
|
|
@ -235,6 +235,7 @@ public:
|
|||
|
||||
DECLARE_CONOBJECT(TSStatic);
|
||||
static void initPersistFields();
|
||||
static bool _setShape(void* obj, const char* index, const char* data);
|
||||
static bool _setShapeAsset(void* obj, const char* index, const char* data);
|
||||
static bool _setFieldSkin( void *object, const char* index, const char* data );
|
||||
static const char *_getFieldSkin( void *object, const char *data );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue