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

@ -1910,11 +1910,11 @@ const char* GuiConvexEditorCtrl::getSelectedFaceMaterial()
if (mConvexSEL->mSurfaceUVs[mFaceSEL].matID == 0)
{
return mConvexSEL->mMaterialName;
return mConvexSEL->getMaterial();
}
else
{
return mConvexSEL->mSurfaceTextures[mConvexSEL->mSurfaceUVs[mFaceSEL].matID - 1].materialName;
return mConvexSEL->mSurfaceTextures[mConvexSEL->mSurfaceUVs[mFaceSEL].matID - 1].getMaterial();
}
}
@ -1978,7 +1978,7 @@ void GuiConvexEditorCtrl::setSelectedFaceMaterial(const char* materialName)
{
for (U32 i = 0; i < mConvexSEL->mSurfaceTextures.size(); i++)
{
if (!String::compare(mConvexSEL->mSurfaceTextures[i].materialName, materialName))
if (!String::compare(mConvexSEL->mSurfaceTextures[i].getMaterial(), materialName))
{
//found a match
mConvexSEL->mSurfaceUVs[mFaceSEL].matID = i + 1;
@ -1990,7 +1990,7 @@ void GuiConvexEditorCtrl::setSelectedFaceMaterial(const char* materialName)
{
//add a new one
ConvexShape::surfaceMaterial newMat;
newMat.materialName = materialName;
newMat._setMaterial(materialName);
mConvexSEL->mSurfaceTextures.push_back(newMat);

View file

@ -59,8 +59,8 @@ ConsoleDocClass( GuiMissionAreaCtrl,
GuiMissionAreaCtrl::GuiMissionAreaCtrl()
{
mHandleBitmap = StringTable->EmptyString();
mHandleTexture = NULL;
INIT_IMAGEASSET(HandleBitmap);
mHandleTextureSize = Point2I::Zero;
mHandleTextureHalfSize = Point2F::Zero;
@ -89,8 +89,7 @@ void GuiMissionAreaCtrl::initPersistFields()
{
addField( "squareBitmap", TypeBool, Offset(mSquareBitmap, GuiMissionAreaCtrl));
addField( "handleBitmap", TypeFilename, Offset( mHandleBitmap, GuiMissionAreaCtrl ),
"Bitmap file for the mission area handles.\n");
INITPERSISTFIELD_IMAGEASSET(HandleBitmap, GuiMissionAreaCtrl, "Bitmap for the mission area handles.\n");
addField( "missionBoundsColor", TypeColorI, Offset(mMissionBoundsColor, GuiMissionAreaCtrl));
addField( "cameraColor", TypeColorI, Offset(mCameraColor, GuiMissionAreaCtrl));
@ -114,15 +113,13 @@ bool GuiMissionAreaCtrl::onAdd()
desc.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
mBlendStateBlock = GFX->createStateBlock( desc );
if (*mHandleBitmap)
if (!mHandleBitmap.isNull())
{
mHandleTexture = GFXTexHandle( mHandleBitmap, &GFXTexturePersistentSRGBProfile, avar("%s() - mHandleTexture (line %d)", __FUNCTION__, __LINE__) );
mHandleTextureSize = Point2I( mHandleTexture->getWidth(), mHandleTexture->getHeight() );
mHandleTextureSize = Point2I(mHandleBitmap->getWidth(), mHandleBitmap->getHeight() );
mHandleTextureHalfSize = Point2F(mHandleTextureSize.x, mHandleTextureSize.y) * 0.5f;
}
else
{
mHandleTexture = NULL;
mHandleTextureSize = Point2I::Zero;
mHandleTextureHalfSize = Point2F::Zero;
}
@ -159,7 +156,7 @@ bool GuiMissionAreaCtrl::onWake()
void GuiMissionAreaCtrl::onSleep()
{
mTextureObject = NULL;
mBitmap = NULL;
mMissionArea = 0;
mTerrainBlock = 0;
@ -420,7 +417,7 @@ void GuiMissionAreaCtrl::setArea(const RectI & area)
void GuiMissionAreaCtrl::drawHandle(const Point2F & pos)
{
Point2F pnt(pos.x-mHandleTextureHalfSize.x, pos.y-mHandleTextureHalfSize.y);
GFX->getDrawUtil()->drawBitmap(mHandleTexture, pnt);
GFX->getDrawUtil()->drawBitmap(mHandleBitmap, pnt);
}
void GuiMissionAreaCtrl::drawHandles(RectI & box)
@ -604,7 +601,7 @@ void GuiMissionAreaCtrl::onRender(Point2I offset, const RectI & updateRect)
GFXDrawUtil *drawer = GFX->getDrawUtil();
drawer->clearBitmapModulation();
drawer->drawBitmapStretch(mTextureObject, rect, GFXBitmapFlip_Y, GFXTextureFilterLinear, false);
drawer->drawBitmapStretch(mBitmap, rect, GFXBitmapFlip_Y, GFXTextureFilterLinear, false);
GFX->setStateBlock(mSolidStateBlock);
drawer->clearBitmapModulation();

View file

@ -63,8 +63,9 @@ protected:
GFXStateBlockRef mBlendStateBlock;
GFXStateBlockRef mSolidStateBlock;
StringTableEntry mHandleBitmap;
GFXTexHandle mHandleTexture;
DECLARE_IMAGEASSET(GuiMissionAreaCtrl, HandleBitmap, onHandleBitmapChanged, GFXTexturePersistentSRGBProfile);
DECLARE_IMAGEASSET_SETGET(GuiMissionAreaCtrl, HandleBitmap);
Point2I mHandleTextureSize;
Point2F mHandleTextureHalfSize;
@ -109,6 +110,8 @@ protected:
bool testWithinHandle(const Point2I & testPoint, S32 handleX, S32 handleY);
S32 getHitHandles(const Point2I & mousePnt, const RectI & box);
void onHandleBitmapChanged() {}
public:
GuiMissionAreaCtrl();
virtual ~GuiMissionAreaCtrl();

View file

@ -1807,9 +1807,11 @@ WorldEditor::WorldEditor()
mRenderPopupBackground = true;
mPopupBackgroundColor.set(100,100,100);
mPopupTextColor.set(255,255,0);
mSelectHandle = StringTable->insert("tools/worldEditor/images/SelectHandle");
mDefaultHandle = StringTable->insert("tools/worldEditor/images/DefaultHandle");
mLockedHandle = StringTable->insert("tools/worldEditor/images/LockedHandle");
mSelectHandleAssetId = StringTable->insert("ToolsModule:SelectHandle");
mDefaultHandleAssetId = StringTable->insert("ToolsModule:DefaultHandle");
mLockedHandleAssetId = StringTable->insert("ToolsModule:LockedHandle");
mObjectTextColor.set(255,255,255);
mObjectsUseBoxCenter = true;
@ -1894,9 +1896,9 @@ bool WorldEditor::onAdd()
// create the default class entry
mDefaultClassEntry.mName = 0;
mDefaultClassEntry.mIgnoreCollision = false;
mDefaultClassEntry.mDefaultHandle = GFXTexHandle(mDefaultHandle, &GFXStaticTextureSRGBProfile, avar("%s() - mDefaultClassEntry.mDefaultHandle (line %d)", __FUNCTION__, __LINE__));
mDefaultClassEntry.mSelectHandle = GFXTexHandle(mSelectHandle, &GFXStaticTextureSRGBProfile, avar("%s() - mDefaultClassEntry.mSelectHandle (line %d)", __FUNCTION__, __LINE__));
mDefaultClassEntry.mLockedHandle = GFXTexHandle(mLockedHandle, &GFXStaticTextureSRGBProfile, avar("%s() - mDefaultClassEntry.mLockedHandle (line %d)", __FUNCTION__, __LINE__));
mDefaultClassEntry.mDefaultHandle = mDefaultHandle;
mDefaultClassEntry.mSelectHandle = mSelectHandle;
mDefaultClassEntry.mLockedHandle = mLockedHandle;
if(!(mDefaultClassEntry.mDefaultHandle && mDefaultClassEntry.mSelectHandle && mDefaultClassEntry.mLockedHandle))
return false;
@ -2826,9 +2828,10 @@ void WorldEditor::initPersistFields()
addField( "renderObjText", TypeBool, Offset(mRenderObjText, WorldEditor) );
addField( "renderObjHandle", TypeBool, Offset(mRenderObjHandle, WorldEditor) );
addField( "renderSelectionBox", TypeBool, Offset(mRenderSelectionBox, WorldEditor) );
addField( "selectHandle", TypeFilename, Offset(mSelectHandle, WorldEditor) );
addField( "defaultHandle", TypeFilename, Offset(mDefaultHandle, WorldEditor) );
addField( "lockedHandle", TypeFilename, Offset(mLockedHandle, WorldEditor) );
INITPERSISTFIELD_IMAGEASSET(SelectHandle, WorldEditor, "");
INITPERSISTFIELD_IMAGEASSET(DefaultHandle, WorldEditor, "");
INITPERSISTFIELD_IMAGEASSET(LockedHandle, WorldEditor, "");
endGroup( "Rendering" );

View file

@ -327,9 +327,14 @@ class WorldEditor : public EditTSCtrl
bool mRenderPopupBackground;
ColorI mPopupBackgroundColor;
ColorI mPopupTextColor;
StringTableEntry mSelectHandle;
StringTableEntry mDefaultHandle;
StringTableEntry mLockedHandle;
DECLARE_IMAGEASSET(WorldEditor, SelectHandle, onSelectHandleChanged, GFXStaticTextureSRGBProfile);
DECLARE_IMAGEASSET_SETGET(WorldEditor, SelectHandle);
DECLARE_IMAGEASSET(WorldEditor, DefaultHandle, onDefaultHandleChanged, GFXStaticTextureSRGBProfile);
DECLARE_IMAGEASSET_SETGET(WorldEditor, DefaultHandle);
DECLARE_IMAGEASSET(WorldEditor, LockedHandle, onLockedHandleChanged, GFXStaticTextureSRGBProfile);
DECLARE_IMAGEASSET_SETGET(WorldEditor, LockedHandle);
ColorI mObjectTextColor;
bool mObjectsUseBoxCenter;
ColorI mObjSelectColor;
@ -420,6 +425,10 @@ class WorldEditor : public EditTSCtrl
void setEditorTool(EditorTool*);
EditorTool* getActiveEditorTool() { return mActiveEditorTool; }
void onSelectHandleChanged() {}
void onDefaultHandleChanged() {}
void onLockedHandleChanged() {}
};
typedef WorldEditor::DropType WorldEditorDropType;