mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-09 23:40:42 +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
|
|
@ -47,14 +47,14 @@
|
|||
|
||||
IMPLEMENT_CONOBJECT(GUIAsset);
|
||||
|
||||
ConsoleType(GUIAssetPtr, TypeGUIAssetPtr, String, ASSET_ID_FIELD_PREFIX)
|
||||
ConsoleType(GUIAssetPtr, TypeGUIAssetPtr, const char*, ASSET_ID_FIELD_PREFIX)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleGetType(TypeGUIAssetPtr)
|
||||
{
|
||||
// Fetch asset Id.
|
||||
return *((StringTableEntry*)dptr);
|
||||
return *((const char**)(dptr));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -67,11 +67,7 @@ ConsoleSetType(TypeGUIAssetPtr)
|
|||
// Yes, so fetch field value.
|
||||
const char* pFieldValue = argv[0];
|
||||
|
||||
// Fetch asset Id.
|
||||
StringTableEntry* assetId = (StringTableEntry*)(dptr);
|
||||
|
||||
// Update asset value.
|
||||
*assetId = StringTable->insert(pFieldValue);
|
||||
*((const char**)dptr) = StringTable->insert(argv[0]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -183,6 +179,50 @@ void GUIAsset::setScriptFile(const char* pScriptFile)
|
|||
refreshAsset();
|
||||
}
|
||||
|
||||
StringTableEntry GUIAsset::getAssetIdByGUIName(StringTableEntry guiName)
|
||||
{
|
||||
StringTableEntry assetId = StringTable->EmptyString();
|
||||
|
||||
AssetQuery* query = new AssetQuery();
|
||||
U32 foundCount = AssetDatabase.findAssetType(query, "GUIAsset");
|
||||
if (foundCount == 0)
|
||||
{
|
||||
//Didn't work, so have us fall back to a placeholder asset
|
||||
assetId = StringTable->insert("Core_Rendering:noMaterial");
|
||||
}
|
||||
else
|
||||
{
|
||||
GuiControl* guiObject;
|
||||
if (!Sim::findObject(guiName, guiObject))
|
||||
return "";
|
||||
|
||||
StringTableEntry guiFile = guiObject->getFilename();
|
||||
|
||||
for (U32 i = 0; i < foundCount; i++)
|
||||
{
|
||||
GUIAsset* guiAsset = AssetDatabase.acquireAsset<GUIAsset>(query->mAssetList[i]);
|
||||
if (guiAsset && guiAsset->getGUIPath() == guiFile)
|
||||
{
|
||||
assetId = guiAsset->getAssetId();
|
||||
AssetDatabase.releaseAsset(query->mAssetList[i]);
|
||||
break;
|
||||
}
|
||||
AssetDatabase.releaseAsset(query->mAssetList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return assetId;
|
||||
}
|
||||
|
||||
#ifdef TORQUE_TOOLS
|
||||
DefineEngineStaticMethod(GUIAsset, getAssetIdByGUIName, const char*, (const char* guiName), (""),
|
||||
"Queries the Asset Database to see if any asset exists that is associated with the provided GUI Name.\n"
|
||||
"@return The AssetId of the associated asset, if any.")
|
||||
{
|
||||
return GUIAsset::getAssetIdByGUIName(StringTable->insert(guiName));
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// GuiInspectorTypeAssetId
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -222,7 +262,7 @@ GuiControl* GuiInspectorTypeGUIAssetPtr::constructEditControl()
|
|||
mSMEdButton->setField("Command", szBuffer);
|
||||
|
||||
char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor";
|
||||
mSMEdButton->setBitmap(bitmapName);
|
||||
mSMEdButton->setBitmap(StringTable->insert(bitmapName));
|
||||
|
||||
mSMEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile");
|
||||
mSMEdButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue