From b73353a4469c17aac2e84260eb4a9d97e8d05667 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Thu, 29 Jul 2021 11:12:07 -0500 Subject: [PATCH] we want old direct-file references first, then asset macros, since those plug in the old entries to empty if valid. --- Engine/source/T3D/fx/groundCover.cpp | 17 +++++++++++------ Engine/source/gfx/sim/cubemapData.cpp | 18 +++++++++--------- .../source/gui/buttons/guiIconButtonCtrl.cpp | 4 ++-- Engine/source/gui/controls/guiPopUpCtrl.cpp | 2 +- Engine/source/gui/controls/guiPopUpCtrlEx.cpp | 2 +- Engine/source/gui/core/guiTypes.cpp | 2 +- 6 files changed, 25 insertions(+), 20 deletions(-) diff --git a/Engine/source/T3D/fx/groundCover.cpp b/Engine/source/T3D/fx/groundCover.cpp index 7f87cd0f9..6d486e8ba 100644 --- a/Engine/source/T3D/fx/groundCover.cpp +++ b/Engine/source/T3D/fx/groundCover.cpp @@ -49,6 +49,7 @@ #include "materials/matInstance.h" #include "renderInstance/renderDeferredMgr.h" #include "console/engineAPI.h" +#include "T3D/assets/MaterialAsset.h" /// This is used for rendering ground cover billboards. GFXImplementVertexFormat( GCVertex ) @@ -856,8 +857,12 @@ void GroundCover::unpackUpdate( NetConnection *connection, BitStream *stream ) void GroundCover::_initMaterial() { - if (!mMaterialInst) - return; + SAFE_DELETE(mMaterialInst); + + if (mMaterialAsset.notNull() && mMaterialAsset->getStatus() == MaterialAsset::Ok) + mMaterialInst = mMaterial->createMatInstance(); + else + mMaterialInst = MATMGR->createMatInstance("WarningMaterial"); // Add our special feature that makes it all work... FeatureSet features = MATMGR->getDefaultFeatures(); @@ -962,10 +967,10 @@ void GroundCover::_initialize( U32 cellCount, U32 cellPlacementCount ) if(mat) { GFXTexHandle tex; - if (mat->mDiffuseMapName[0] != StringTable->EmptyString()) - tex = GFXTexHandle(mat->mDiffuseMapName[0], &GFXStaticTextureSRGBProfile, "GroundCover texture aspect ratio check"); - else if (!mat->mDiffuseMapAsset[0].isNull()) - tex = mat->mDiffuseMapAsset[0]->getTexture(&GFXStaticTextureSRGBProfile); + if (mat->getDiffuseMapResource(0)) + tex = mat->getDiffuseMapResource(0); + else if (mat->getDiffuseMap(0) != StringTable->EmptyString()) + tex = GFXTexHandle(mat->getDiffuseMap(0), &GFXStaticTextureSRGBProfile, "GroundCover texture aspect ratio check"); if(tex.isValid()) { diff --git a/Engine/source/gfx/sim/cubemapData.cpp b/Engine/source/gfx/sim/cubemapData.cpp index db7e6f2aa..a6833de5c 100644 --- a/Engine/source/gfx/sim/cubemapData.cpp +++ b/Engine/source/gfx/sim/cubemapData.cpp @@ -76,15 +76,6 @@ ConsoleDocClass( CubemapData, void CubemapData::initPersistFields() { - INITPERSISTFIELD_IMAGEASSET_ARRAY(CubeMapFace, 6, CubemapData, "@brief The 6 cubemap face textures for a static cubemap.\n\n" - "They are in the following order:\n" - " - cubeFace[0] is -X\n" - " - cubeFace[1] is +X\n" - " - cubeFace[2] is -Z\n" - " - cubeFace[3] is +Z\n" - " - cubeFace[4] is -Y\n" - " - cubeFace[5] is +Y\n"); - addProtectedField( "cubeFace", TypeStringFilename, Offset(mCubeMapFaceName, CubemapData), _setCubeMapFaceData, defaultProtectedGetFn, 6, "@brief The 6 cubemap face textures for a static cubemap.\n\n" "They are in the following order:\n" @@ -95,6 +86,15 @@ void CubemapData::initPersistFields() " - cubeFace[4] is -Y\n" " - cubeFace[5] is +Y\n", AbstractClassRep::FIELD_HideInInspectors ); + INITPERSISTFIELD_IMAGEASSET_ARRAY(CubeMapFace, 6, CubemapData, "@brief The 6 cubemap face textures for a static cubemap.\n\n" + "They are in the following order:\n" + " - cubeFace[0] is -X\n" + " - cubeFace[1] is +X\n" + " - cubeFace[2] is -Z\n" + " - cubeFace[3] is +Z\n" + " - cubeFace[4] is -Y\n" + " - cubeFace[5] is +Y\n"); + INITPERSISTFIELD_IMAGEASSET(CubeMap, CubemapData, "@brief Cubemap dds Image Asset.\n\n"); } diff --git a/Engine/source/gui/buttons/guiIconButtonCtrl.cpp b/Engine/source/gui/buttons/guiIconButtonCtrl.cpp index bd64a803c..c0fb939ff 100644 --- a/Engine/source/gui/buttons/guiIconButtonCtrl.cpp +++ b/Engine/source/gui/buttons/guiIconButtonCtrl.cpp @@ -123,8 +123,8 @@ void GuiIconButtonCtrl::initPersistFields() { addField( "buttonMargin", TypePoint2I, Offset( mButtonMargin, GuiIconButtonCtrl ),"Margin area around the button.\n"); - INITPERSISTFIELD_IMAGEASSET(Bitmap, GuiIconButtonCtrl, "Bitmap file for the icon to display on the button.\n"); addProtectedField( "iconBitmap", TypeImageFilename, Offset( mBitmapName, GuiIconButtonCtrl ), &_setBitmapData, &defaultProtectedGetFn, "Bitmap file for the icon to display on the button.\n", AbstractClassRep::FIELD_HideInInspectors); + INITPERSISTFIELD_IMAGEASSET(Bitmap, GuiIconButtonCtrl, "Bitmap file for the icon to display on the button.\n"); addField( "iconLocation", TYPEID< IconLocation >(), Offset( mIconLocation, GuiIconButtonCtrl ),"Where to place the icon on the control. Options are 0 (None), 1 (Left), 2 (Right), 3 (Center).\n"); addField( "sizeIconToButton", TypeBool, Offset( mFitBitmapToButton, GuiIconButtonCtrl ),"If true, the icon will be scaled to be the same size as the button.\n"); @@ -412,4 +412,4 @@ void GuiIconButtonCtrl::renderBitmapArray(RectI &bounds, S32 state) } } -DEF_IMAGEASSET_BINDS(GuiIconButtonCtrl, Bitmap); \ No newline at end of file +DEF_IMAGEASSET_BINDS(GuiIconButtonCtrl, Bitmap); diff --git a/Engine/source/gui/controls/guiPopUpCtrl.cpp b/Engine/source/gui/controls/guiPopUpCtrl.cpp index f4042b903..c18b10c75 100644 --- a/Engine/source/gui/controls/guiPopUpCtrl.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrl.cpp @@ -301,8 +301,8 @@ void GuiPopUpMenuCtrl::initPersistFields(void) addField("sbUsesNAColor", TypeBool, Offset(mRenderScrollInNA, GuiPopUpMenuCtrl)); addField("reverseTextList", TypeBool, Offset(mReverseTextList, GuiPopUpMenuCtrl)); - addProtectedField("bitmapAsset", TypeImageAssetId, Offset(mBitmapAssetId, GuiPopUpMenuCtrl), _setBitmaps, defaultProtectedGetFn, ""); addProtectedField("bitmap", TypeImageFilename, Offset(mBitmapName, GuiPopUpMenuCtrl), _setBitmaps, defaultProtectedGetFn, ""); + addProtectedField("bitmapAsset", TypeImageAssetId, Offset(mBitmapAssetId, GuiPopUpMenuCtrl), _setBitmaps, defaultProtectedGetFn, ""); addField("bitmapBounds", TypePoint2I, Offset(mBitmapBounds, GuiPopUpMenuCtrl)); diff --git a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp index af6802621..5cbd1e3bc 100644 --- a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp @@ -353,8 +353,8 @@ void GuiPopUpMenuCtrlEx::initPersistFields(void) addField("sbUsesNAColor", TypeBool, Offset(mRenderScrollInNA, GuiPopUpMenuCtrlEx), "Deprecated" "@internal"); addField("reverseTextList", TypeBool, Offset(mReverseTextList, GuiPopUpMenuCtrlEx), "Reverses text list if popup extends up, instead of down"); - addProtectedField("bitmapAsset", TypeImageAssetId, Offset(mBitmapAssetId, GuiPopUpMenuCtrlEx), _setBitmaps, &defaultProtectedGetFn, "Name of bitmap asset to use"); addProtectedField("bitmap", TypeImageFilename, Offset(mBitmapName, GuiPopUpMenuCtrlEx), _setBitmaps, &defaultProtectedGetFn, "File name of bitmap to use"); + addProtectedField("bitmapAsset", TypeImageAssetId, Offset(mBitmapAssetId, GuiPopUpMenuCtrlEx), _setBitmaps, &defaultProtectedGetFn, "Name of bitmap asset to use"); addField("bitmapBounds", TypePoint2I, Offset(mBitmapBounds, GuiPopUpMenuCtrlEx), "Boundaries of bitmap displayed"); addField("hotTrackCallback", TypeBool, Offset(mHotTrackItems, GuiPopUpMenuCtrlEx), diff --git a/Engine/source/gui/core/guiTypes.cpp b/Engine/source/gui/core/guiTypes.cpp index fe5cd54f0..59fc8b854 100644 --- a/Engine/source/gui/core/guiTypes.cpp +++ b/Engine/source/gui/core/guiTypes.cpp @@ -91,8 +91,8 @@ void GuiCursor::initPersistFields() addField("hotSpot", TypePoint2I, Offset(mHotSpot, GuiCursor), "The location of the cursor's hot spot (which pixel carries the click)."); addField("renderOffset",TypePoint2F, Offset(mRenderOffset, GuiCursor), "Offset of the bitmap, where 0 signifies left edge of the bitmap, 1, the right. Similarly for the Y-component."); - INITPERSISTFIELD_IMAGEASSET(Bitmap, GuiCursor, "name of the bitmap for the cursor."); addProtectedField("bitmapName", TypeImageFilename, Offset(mBitmapName, GuiCursor), _setBitmapData, &defaultProtectedGetFn, "File name of the bitmap for the cursor."); + INITPERSISTFIELD_IMAGEASSET(Bitmap, GuiCursor, "name of the bitmap for the cursor."); Parent::initPersistFields(); }