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:
Areloch 2021-07-19 01:07:08 -05:00
parent 83b0432283
commit 5525f8ecdd
1708 changed files with 19619 additions and 4596 deletions

View file

@ -161,7 +161,9 @@ public:
void setObjectField( const char *fieldName, const char *data );
static GuiInspector* findByObject( SimObject *obj );
static GuiInspector* findByObject( SimObject *obj );
void refresh();
protected:
@ -181,8 +183,6 @@ protected:
SimObjectPtr<GuiInspectorField> mHLField;
String mGroupFilters;
bool mShowCustomFields;
void refresh();
};
#endif

View file

@ -221,7 +221,7 @@ GuiControl* GuiInspectorTypeMaterialName::construct(const char* command)
//temporary static button name
char bitmapName[512] = "tools/materialEditor/gui/change-material-btn";
mBrowseButton->setBitmap( bitmapName );
mBrowseButton->setBitmap( StringTable->insert(bitmapName) );
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
mBrowseButton->registerObject();
@ -327,7 +327,7 @@ GuiControl* GuiInspectorTypeTerrainMaterialName::construct(const char* command)
//temporary static button name
char bitmapName[512] = "tools/gui/images/layers-btn";
mBrowseButton->setBitmap( bitmapName );
mBrowseButton->setBitmap(StringTable->insert(bitmapName) );
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
mBrowseButton->registerObject();
@ -805,7 +805,7 @@ GuiControl* GuiInspectorTypeShapeFilename::constructEditControl()
mShapeEdButton->setField("Command", szBuffer);
char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor";
mShapeEdButton->setBitmap(bitmapName);
mShapeEdButton->setBitmap(StringTable->insert(bitmapName));
mShapeEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile");
mShapeEdButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile");
@ -957,7 +957,7 @@ GuiControl* GuiInspectorTypeRectUV::constructEditControl()
//temporary static button name
char bitmapName[512] = "tools/gui/images/uv-editor-btn";
mBrowseButton->setBitmap( bitmapName );
mBrowseButton->setBitmap(StringTable->insert(bitmapName) );
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
mBrowseButton->registerObject();
@ -1544,7 +1544,7 @@ GuiControl* GuiInspectorTypeBitMask32Helper::constructEditControl()
mButton->setField( "Command", szBuffer );
mButton->setField( "buttonType", "ToggleButton" );
mButton->setDataField( StringTable->insert("Profile"), NULL, "GuiInspectorButtonProfile" );
mButton->setBitmap( "tools/gui/images/arrowBtn" );
mButton->setBitmap(StringTable->insert("tools/gui/images/arrowBtn.png") );
mButton->setStateOn( true );
mButton->setExtent( 16, 16 );
mButton->registerObject();

View file

@ -1347,7 +1347,7 @@ void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect)
bitmapstart.y = mMenuList[i].bounds.point.y + (mMenuList[i].bounds.extent.y - rect.extent.y) / 2;
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapSR(mProfile->mTextureObject, offset + bitmapstart, rect);
drawUtil->drawBitmapSR(mProfile->getBitmapResource(), offset + bitmapstart, rect);
// Should we also draw the text?
if (!mMenuList[i].drawBitmapOnly)

View file

@ -142,7 +142,7 @@ void GuiPopupMenuTextListCtrl::onRenderCell(Point2I offset, Point2I cell, bool s
Point2I bitPos = Point2I(offset.x + mCellSize.y / 2, offset.y + mCellSize.y / 2);
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapSR(mProfile->mTextureObject, bitPos + off, rect);
GFX->getDrawUtil()->drawBitmapSR(mProfile->getBitmapResource(), bitPos + off, rect);
}
}

View file

@ -65,6 +65,7 @@ GuiShapeEdPreview::GuiShapeEdPreview()
mZoomSpeed ( 1.0f ),
mGridDimension( 30, 30 ),
mModel( NULL ),
mModelName(StringTable->EmptyString()),
mRenderGhost( false ),
mRenderNodes( false ),
mRenderBounds( false ),
@ -349,6 +350,8 @@ bool GuiShapeEdPreview::setObjectModel(const char* modelName)
mThreads.clear();
mActiveThread = -1;
ResourceManager::get().getChangedSignal().remove(this, &GuiShapeEdPreview::_onResourceChanged);
if (modelName && modelName[0])
{
Resource<TSShape> model = ResourceManager::get().load( modelName );
@ -382,11 +385,28 @@ bool GuiShapeEdPreview::setObjectModel(const char* modelName)
// the first time recording
mLastRenderTime = Platform::getVirtualMilliseconds();
mModelName = StringTable->insert(modelName);
//Now to reflect changes when the model file is changed.
ResourceManager::get().getChangedSignal().notify(this, &GuiShapeEdPreview::_onResourceChanged);
}
else
{
mModelName = StringTable->EmptyString();
}
return true;
}
void GuiShapeEdPreview::_onResourceChanged(const Torque::Path& path)
{
if (path != Torque::Path(mModelName))
return;
setObjectModel(path.getFullPath());
}
void GuiShapeEdPreview::addThread()
{
if ( mModel )

View file

@ -114,6 +114,7 @@ protected:
bool mRenderColMeshes;
bool mRenderMounts;
TSShapeInstance* mModel;
StringTableEntry mModelName;
LightInfo* mFakeSun;
EulerF mSunRot;
@ -199,6 +200,8 @@ public:
void setCurrentDetail(S32 dl);
bool setObjectModel(const char * modelName);
void _onResourceChanged(const Torque::Path& path);
/// @name Threads
///@{
void addThread();

View file

@ -60,7 +60,7 @@ bool GuiInspectorDynamicGroup::createContent()
addFieldBtn->setControlProfile( dynamic_cast<GuiControlProfile*>(profilePtr) );
// FIXME Hardcoded image
addFieldBtn->setBitmap("tools/gui/images/iconAdd.png");
addFieldBtn->setBitmap(StringTable->insert("tools/gui/images/iconAdd.png"));
char commandBuf[64];
dSprintf(commandBuf, 64, "%d.addDynamicField();", this->getId());

View file

@ -22,6 +22,9 @@
#include "gui/editor/inspector/variableInspector.h"
#include "console/engineAPI.h"
#include "T3D/assets/ShapeAsset.h"
#include "T3D/assets/ImageAsset.h"
#include "T3D/assets/MaterialAsset.h"
GuiVariableInspector::GuiVariableInspector() : mAutoUpdate(true)
{
@ -180,12 +183,12 @@ void GuiVariableInspector::addField(const char* name, const char* label, const c
fieldTypeMask = TypePoint3F;
else if (newField.mFieldTypeName == StringTable->insert("vector2"))
fieldTypeMask = TypePoint2F;
//else if (fieldType == StringTable->insert("material"))
// fieldTypeMask = TypeMaterialName;
else if (newField.mFieldTypeName == StringTable->insert("material"))
fieldTypeMask = TypeMaterialAssetId;
else if (newField.mFieldTypeName == StringTable->insert("image"))
fieldTypeMask = TypeImageFilename;
fieldTypeMask = TypeImageAssetId;
else if (newField.mFieldTypeName == StringTable->insert("shape"))
fieldTypeMask = TypeShapeFilename;
fieldTypeMask = TypeShapeAssetId;
else if (newField.mFieldTypeName == StringTable->insert("bool"))
fieldTypeMask = TypeBool;
else if (newField.mFieldTypeName == StringTable->insert("object"))