mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
Converts all game, gui editor, and system classes to utilize assets
Processed core, tools and default modules to utilize assets Converted all console types that were string based, such as TypeImageFilename to utilize const char*/the string table, which avoids a lot of type swapping shenanigans and avoids string corruption Removed unneeded MainEditor mockup module Removed some unused/duplicate image assets from the tools
This commit is contained in:
parent
83b0432283
commit
5525f8ecdd
1708 changed files with 19619 additions and 4596 deletions
|
|
@ -114,7 +114,6 @@ TSStatic::TSStatic()
|
|||
|
||||
mTypeMask |= StaticObjectType | StaticShapeObjectType;
|
||||
|
||||
mShapeName = "";
|
||||
mShapeInstance = NULL;
|
||||
|
||||
mPlayAmbient = true;
|
||||
|
|
@ -150,8 +149,7 @@ TSStatic::TSStatic()
|
|||
mAnimOffset = 0.0f;
|
||||
mAnimSpeed = 1.0f;
|
||||
|
||||
mShapeAsset = StringTable->EmptyString();
|
||||
mShapeAssetId = StringTable->EmptyString();
|
||||
INIT_SHAPEASSET(Shape);
|
||||
}
|
||||
|
||||
TSStatic::~TSStatic()
|
||||
|
|
@ -184,13 +182,11 @@ void TSStatic::initPersistFields()
|
|||
"Percent Animation Speed.");
|
||||
addGroup("Shape");
|
||||
|
||||
addProtectedField("shapeAsset", TypeShapeAssetId, Offset(mShapeAssetId, TSStatic),
|
||||
&TSStatic::_setShapeAsset, &defaultProtectedGetFn,
|
||||
"The source shape asset.");
|
||||
INITPERSISTFIELD_SHAPEASSET(Shape, TSStatic, "Model to use for this TSStatic");
|
||||
|
||||
addProtectedField("shapeName", TypeShapeFilename, Offset(mShapeName, TSStatic),
|
||||
&TSStatic::_setShapeName, &defaultProtectedGetFn,
|
||||
"%Path and filename of the model file (.DTS, .DAE) to use for this TSStatic. Legacy field. Any loose files assigned here will attempt to be auto-imported in as an asset.");
|
||||
&TSStatic::_setShapeData, &defaultProtectedGetFn,
|
||||
"%Path and filename of the model file (.DTS, .DAE) to use for this TSStatic. Legacy field. Any loose files assigned here will attempt to be auto-imported in as an asset.", AbstractClassRep::FIELD_HideInInspectors);
|
||||
|
||||
endGroup("Shape");
|
||||
|
||||
|
|
@ -287,50 +283,6 @@ void TSStatic::consoleInit()
|
|||
Con::addVariable("$pref::staticObjectUnfadeableSize", TypeF32, &TSStatic::smStaticObjectUnfadeableSize, "Size of object where if the bounds is at or bigger than this, it will be ignored in the $pref::useStaticObjectFade logic. Useful for very large, distance-important objects.\n");
|
||||
}
|
||||
|
||||
bool TSStatic::_setShapeAsset(void* obj, const char* index, const char* data)
|
||||
{
|
||||
TSStatic* ts = static_cast<TSStatic*>(obj);// ->setFile(FileName(data));
|
||||
|
||||
ts->mShapeAssetId = StringTable->insert(data);
|
||||
|
||||
return ts->setShapeAsset(ts->mShapeAssetId);
|
||||
}
|
||||
|
||||
bool TSStatic::_setShapeName(void* obj, const char* index, const char* data)
|
||||
{
|
||||
TSStatic* ts = static_cast<TSStatic*>(obj);// ->setFile(FileName(data));
|
||||
|
||||
StringTableEntry assetId = ShapeAsset::getAssetIdByFilename(StringTable->insert(data));
|
||||
if (assetId != StringTable->EmptyString())
|
||||
{
|
||||
//Special exception case. If we've defaulted to the 'no shape' mesh, don't save it out, we'll retain the original ids/paths so it doesn't break
|
||||
//the TSStatic
|
||||
if (ts->setShapeAsset(assetId))
|
||||
{
|
||||
if (assetId == StringTable->insert("Core_Rendering:noShape"))
|
||||
{
|
||||
ts->mShapeName = data;
|
||||
ts->mShapeAssetId = StringTable->EmptyString();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ts->mShapeAssetId = assetId;
|
||||
ts->mShapeName = StringTable->EmptyString();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ts->mShapeAsset = StringTable->EmptyString();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TSStatic::_setFieldSkin(void* object, const char* index, const char* data)
|
||||
{
|
||||
TSStatic* ts = static_cast<TSStatic*>(object);
|
||||
|
|
@ -425,34 +377,6 @@ bool TSStatic::onAdd()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool TSStatic::setShapeAsset(const StringTableEntry shapeAssetId)
|
||||
{
|
||||
if (!mShapeAsset.isNull())
|
||||
{
|
||||
mShapeAsset->getChangedSignal().remove(this, &TSStatic::_onAssetChanged);
|
||||
}
|
||||
|
||||
if (ShapeAsset::getAssetById(shapeAssetId, &mShapeAsset))
|
||||
{
|
||||
//Special exception case. If we've defaulted to the 'no shape' mesh, don't save it out, we'll retain the original ids/paths so it doesn't break
|
||||
//the TSStatic
|
||||
if (mShapeAsset.getAssetId() != StringTable->insert("Core_Rendering:noshape"))
|
||||
{
|
||||
mShapeName = StringTable->EmptyString();
|
||||
|
||||
mShapeAsset->getChangedSignal().notify(this, &TSStatic::_onAssetChanged);
|
||||
}
|
||||
|
||||
_createShape();
|
||||
|
||||
setMaskBits(-1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TSStatic::_createShape()
|
||||
{
|
||||
// Cleanup before we create.
|
||||
|
|
@ -674,9 +598,6 @@ void TSStatic::onRemove()
|
|||
if (isClientObject())
|
||||
mCubeReflector.unregisterReflector();
|
||||
|
||||
if(!mShapeAsset.isNull())
|
||||
mShapeAsset->getChangedSignal().remove(this, &TSStatic::_onAssetChanged);
|
||||
|
||||
Parent::onRemove();
|
||||
}
|
||||
|
||||
|
|
@ -689,7 +610,7 @@ void TSStatic::_onResourceChanged(const Torque::Path& path)
|
|||
_updateShouldTick();
|
||||
}
|
||||
|
||||
void TSStatic::_onAssetChanged()
|
||||
void TSStatic::onShapeChanged()
|
||||
{
|
||||
_createShape();
|
||||
_updateShouldTick();
|
||||
|
|
@ -1037,8 +958,7 @@ U32 TSStatic::packUpdate(NetConnection* con, U32 mask, BitStream* stream)
|
|||
|
||||
if (stream->writeFlag(mask & AdvancedStaticOptionsMask))
|
||||
{
|
||||
stream->writeString(mShapeAsset.getAssetId());
|
||||
stream->writeString(mShapeName);
|
||||
PACK_SHAPEASSET(con, Shape);
|
||||
|
||||
stream->write((U32)mDecalType);
|
||||
|
||||
|
|
@ -1153,11 +1073,7 @@ void TSStatic::unpackUpdate(NetConnection* con, BitStream* stream)
|
|||
|
||||
if (stream->readFlag()) // AdvancedStaticOptionsMask
|
||||
{
|
||||
char buffer[256];
|
||||
stream->readString(buffer);
|
||||
setShapeAsset(StringTable->insert(buffer));
|
||||
|
||||
mShapeName = stream->readSTString();
|
||||
UNPACK_SHAPEASSET(con, Shape);
|
||||
|
||||
stream->read((U32*)&mDecalType);
|
||||
|
||||
|
|
@ -1676,7 +1592,7 @@ void TSStatic::updateMaterials()
|
|||
|
||||
String path;
|
||||
if (mShapeAsset->isAssetValid())
|
||||
path = mShapeAsset->getShapeFilename();
|
||||
path = mShapeAsset->getShapeFileName();
|
||||
else
|
||||
path = mShapeName;
|
||||
|
||||
|
|
@ -1709,9 +1625,8 @@ void TSStatic::updateMaterials()
|
|||
|
||||
void TSStatic::getUtilizedAssets(Vector<StringTableEntry>* usedAssetsList)
|
||||
{
|
||||
if(!mShapeAsset.isNull() && mShapeAsset->getAssetId() != StringTable->insert("Core_Rendering:noShape"))
|
||||
if(!mShapeAsset.isNull() && mShapeAsset->getAssetId() != ShapeAsset::smNoShapeAssetFallback)
|
||||
usedAssetsList->push_back_unique(mShapeAsset->getAssetId());
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
|
@ -1874,7 +1789,7 @@ DefineEngineMethod(TSStatic, changeMaterial, void, (const char* mapTo, Material*
|
|||
return;
|
||||
}
|
||||
|
||||
TSMaterialList* shapeMaterialList = object->getShape()->materialList;
|
||||
TSMaterialList* shapeMaterialList = object->getShapeResource()->materialList;
|
||||
|
||||
// Check the mapTo name exists for this shape
|
||||
S32 matIndex = shapeMaterialList->getMaterialNameList().find_next(String(mapTo));
|
||||
|
|
@ -1914,7 +1829,7 @@ DefineEngineMethod(TSStatic, getModelFile, const char*, (), ,
|
|||
"@endtsexample\n"
|
||||
)
|
||||
{
|
||||
return object->getShapeFileName();
|
||||
return object->getShape();
|
||||
}
|
||||
|
||||
void TSStatic::set_special_typing()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue