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

@ -97,6 +97,10 @@ GuiMeshRoadEditorCtrl::GuiMeshRoadEditorCtrl()
mHoverNodeColor( 255,255,255,255 ),
mHasCopied( false )
{
INIT_MATERIALASSET(TopMaterial);
INIT_MATERIALASSET(BottomMaterial);
INIT_MATERIALASSET(SideMaterial);
mTopMaterialAssetId = Con::getVariable("$MeshRoadEditor::defaultTopMaterialAsset");
mBottomMaterialAssetId = Con::getVariable("$MeshRoadEditor::defaultBottomMaterialAsset");
mSideMaterialAssetId = Con::getVariable("$MeshRoadEditor::defaultSideMaterialAsset");
@ -205,10 +209,6 @@ bool GuiMeshRoadEditorCtrl::onAdd()
desc.zEnable = true;
mZEnableSB = GFX->createStateBlock(desc);
bindMaterialAsset(TopMaterial);
bindMaterialAsset(BottomMaterial);
bindMaterialAsset(SideMaterial);
return true;
}
@ -222,9 +222,9 @@ void GuiMeshRoadEditorCtrl::initPersistFields()
addField( "HoverNodeColor", TypeColorI, Offset( mHoverNodeColor, GuiMeshRoadEditorCtrl ) );
addField( "isDirty", TypeBool, Offset( mIsDirty, GuiMeshRoadEditorCtrl ) );
addField("topMaterial", TypeMaterialAssetId, Offset(mTopMaterialAssetId, GuiMeshRoadEditorCtrl), "Default Material used by the Mesh Road Editor on upper surface road creation.");
addField("bottomMaterial", TypeMaterialAssetId, Offset(mBottomMaterialAssetId, GuiMeshRoadEditorCtrl), "Default Material used by the Mesh Road Editor on bottom surface road creation.");
addField("sideMaterial", TypeMaterialAssetId, Offset(mSideMaterialAssetId, GuiMeshRoadEditorCtrl), "Default Material used by the Mesh Road Editor on side surface road creation.");
INITPERSISTFIELD_MATERIALASSET(TopMaterial, GuiMeshRoadEditorCtrl, "Default Material used by the Mesh Road Editor on upper surface road creation.");
INITPERSISTFIELD_MATERIALASSET(BottomMaterial, GuiMeshRoadEditorCtrl, "Default Material used by the Mesh Road Editor on bottom surface road creation.");
INITPERSISTFIELD_MATERIALASSET(SideMaterial, GuiMeshRoadEditorCtrl, "Default Material used by the Mesh Road Editor on side surface road creation.");
//addField( "MoveNodeCursor", TYPEID< SimObject >(), Offset( mMoveNodeCursor, GuiMeshRoadEditorCtrl) );
//addField( "AddNodeCursor", TYPEID< SimObject >(), Offset( mAddNodeCursor, GuiMeshRoadEditorCtrl) );
@ -627,11 +627,11 @@ void GuiMeshRoadEditorCtrl::on3DMouseDown(const Gui3DMouseEvent & event)
MeshRoad *newRoad = new MeshRoad;
if(mTopMaterialAsset.notNull())
newRoad->setTopMaterialAssetId(mTopMaterialAssetId);
newRoad->_setTopMaterial(mTopMaterialAssetId);
if (mBottomMaterialAsset.notNull())
newRoad->setBottomMaterialAssetId(mBottomMaterialAssetId);
newRoad->_setBottomMaterial(mBottomMaterialAssetId);
if (mSideMaterialAsset.notNull())
newRoad->setSideMaterialAssetId(mSideMaterialAssetId);
newRoad->_setSideMaterial(mSideMaterialAssetId);
newRoad->registerObject();

View file

@ -159,13 +159,14 @@ class GuiMeshRoadEditorCtrl : public EditTSCtrl
bool mHasCopied;
public:
StringTableEntry mTopMaterialAssetId;
StringTableEntry mBottomMaterialAssetId;
StringTableEntry mSideMaterialAssetId;
DECLARE_MATERIALASSET(GuiMeshRoadEditorCtrl, TopMaterial);
DECLARE_MATERIALASSET_SETGET(GuiMeshRoadEditorCtrl, TopMaterial);
AssetPtr<MaterialAsset> mTopMaterialAsset;
AssetPtr<MaterialAsset> mBottomMaterialAsset;
AssetPtr<MaterialAsset> mSideMaterialAsset;
DECLARE_MATERIALASSET(GuiMeshRoadEditorCtrl, BottomMaterial);
DECLARE_MATERIALASSET_SETGET(GuiMeshRoadEditorCtrl, BottomMaterial);
DECLARE_MATERIALASSET(GuiMeshRoadEditorCtrl, SideMaterial);
DECLARE_MATERIALASSET_SETGET(GuiMeshRoadEditorCtrl, SideMaterial);
};
class GuiMeshRoadEditorUndoAction : public UndoAction

View file

@ -108,7 +108,7 @@ void GuiRoadEditorUndoAction::undo()
nodes.merge( road->mNodes );
// Restore the Road properties saved in the UndoAction
road->setMaterialAssetId(materialAssetId);
road->_setMaterial(materialAssetId);
road->mBreakAngle = breakAngle;
road->mSegmentsPerBatch = segmentsPerBatch;
road->mTextureLength = textureLength;
@ -153,8 +153,6 @@ bool GuiRoadEditorCtrl::onAdd()
mZDisableSB = GFX->createStateBlock(desc);
bindMaterialAsset(Material);
return true;
}
@ -166,7 +164,7 @@ void GuiRoadEditorCtrl::initPersistFields()
addField( "HoverNodeColor", TypeColorI, Offset( mHoverNodeColor, GuiRoadEditorCtrl ) );
addField( "isDirty", TypeBool, Offset( mIsDirty, GuiRoadEditorCtrl ) );
addField("material", TypeMaterialAssetId, Offset(mMaterialAssetId, GuiRoadEditorCtrl), "Default Material used by the Road Editor on road creation.");
INITPERSISTFIELD_MATERIALASSET(Material, GuiRoadEditorCtrl, "Default Material used by the Road Editor on road creation.");
//addField( "MoveNodeCursor", TYPEID< SimObject >(), Offset( mMoveNodeCursor, GuiRoadEditorCtrl) );
//addField( "AddNodeCursor", TYPEID< SimObject >(), Offset( mAddNodeCursor, GuiRoadEditorCtrl) );
@ -409,7 +407,7 @@ void GuiRoadEditorCtrl::on3DMouseDown(const Gui3DMouseEvent & event)
DecalRoad *newRoad = new DecalRoad;
if (mMaterialAsset.notNull())
newRoad->setMaterialAssetId(mMaterialAssetId);
newRoad->_setMaterial(mMaterialAssetId);
newRoad->registerObject();

View file

@ -103,8 +103,9 @@ class GuiRoadEditorCtrl : public EditTSCtrl
public:
StringTableEntry mMaterialAssetId;
AssetPtr<MaterialAsset> mMaterialAsset;
DECLARE_MATERIALASSET(GuiRoadEditorCtrl, Material);
DECLARE_MATERIALASSET_SETGET(GuiRoadEditorCtrl, Material);
protected:
void _drawRoadSpline( DecalRoad *road, const ColorI &color );