we want old direct-file references first, then asset macros, since those plug in the old entries to empty if valid.

This commit is contained in:
AzaezelX 2021-07-29 11:12:07 -05:00
parent 3fad050028
commit b73353a446
6 changed files with 25 additions and 20 deletions

View file

@ -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())
{

View file

@ -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");
}

View file

@ -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);
DEF_IMAGEASSET_BINDS(GuiIconButtonCtrl, Bitmap);

View file

@ -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));

View file

@ -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),

View file

@ -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();
}