diff --git a/Engine/source/gui/buttons/guiCheckBoxCtrl.cpp b/Engine/source/gui/buttons/guiCheckBoxCtrl.cpp index 93e51168b..ffb63dfb9 100644 --- a/Engine/source/gui/buttons/guiCheckBoxCtrl.cpp +++ b/Engine/source/gui/buttons/guiCheckBoxCtrl.cpp @@ -134,7 +134,7 @@ void GuiCheckBoxCtrl::onRender(Point2I offset, const RectI &updateRect) } xOffset = mProfile->mBitmapArrayRects[0].extent.x + 2 + mIndent; S32 y = (getHeight() - mProfile->mBitmapArrayRects[0].extent.y) / 2; - GFX->getDrawUtil()->drawBitmapSR(mProfile->getBitmapResource(), offset + Point2I(mIndent, y), mProfile->mBitmapArrayRects[index]); + GFX->getDrawUtil()->drawBitmapSR(mProfile->getBitmap(), offset + Point2I(mIndent, y), mProfile->mBitmapArrayRects[index]); } if(mButtonText[0] != '\0') diff --git a/Engine/source/gui/containers/guiFormCtrl.cpp b/Engine/source/gui/containers/guiFormCtrl.cpp index 3bf3289f4..8fd333071 100644 --- a/Engine/source/gui/containers/guiFormCtrl.cpp +++ b/Engine/source/gui/containers/guiFormCtrl.cpp @@ -277,7 +277,7 @@ void GuiFormCtrl::onRender(Point2I offset, const RectI &updateRect) Point2I barOffset(barStart, barTop); // Draw the start of the bar... - GFX->getDrawUtil()->drawBitmapStretchSR(mProfile->getBitmapResource(),RectI(barOffset, mProfile->mBitmapArrayRects[2].extent), mProfile->mBitmapArrayRects[2] ); + GFX->getDrawUtil()->drawBitmapStretchSR(mProfile->getBitmap(),RectI(barOffset, mProfile->mBitmapArrayRects[2].extent), mProfile->mBitmapArrayRects[2] ); // Now draw the middle... barOffset.x += mProfile->mBitmapArrayRects[2].extent.x; @@ -291,7 +291,7 @@ void GuiFormCtrl::onRender(Point2I offset, const RectI &updateRect) foo.inset(1,0); GFX->getDrawUtil()->drawBitmapStretchSR( - mProfile->getBitmapResource(), + mProfile->getBitmap(), RectI(barOffset, Point2I(barMiddleSize, mProfile->mBitmapArrayRects[3].extent.y)), foo ); @@ -300,7 +300,7 @@ void GuiFormCtrl::onRender(Point2I offset, const RectI &updateRect) // And the end barOffset.x += barMiddleSize; - GFX->getDrawUtil()->drawBitmapStretchSR( mProfile->getBitmapResource(), RectI(barOffset, mProfile->mBitmapArrayRects[4].extent), + GFX->getDrawUtil()->drawBitmapStretchSR( mProfile->getBitmap(), RectI(barOffset, mProfile->mBitmapArrayRects[4].extent), mProfile->mBitmapArrayRects[4]); GFX->getDrawUtil()->setBitmapModulation((mMouseOver ? mProfile->mFontColorHL : mProfile->mFontColor)); diff --git a/Engine/source/gui/containers/guiPaneCtrl.cpp b/Engine/source/gui/containers/guiPaneCtrl.cpp index d646e2f44..e5d3d70fa 100644 --- a/Engine/source/gui/containers/guiPaneCtrl.cpp +++ b/Engine/source/gui/containers/guiPaneCtrl.cpp @@ -193,7 +193,7 @@ void GuiPaneControl::onRender(Point2I offset, const RectI &updateRect) GFX->getDrawUtil()->clearBitmapModulation(); GFX->getDrawUtil()->drawBitmapStretchSR( - mProfile->getBitmapResource(), + mProfile->getBitmap(), RectI(offset, mProfile->mBitmapArrayRects[idx].extent), mProfile->mBitmapArrayRects[idx] ); @@ -226,7 +226,7 @@ void GuiPaneControl::onRender(Point2I offset, const RectI &updateRect) // Draw the start of the bar... GFX->getDrawUtil()->drawBitmapStretchSR( - mProfile->getBitmapResource(), + mProfile->getBitmap(), RectI(barOffset, mProfile->mBitmapArrayRects[2].extent), mProfile->mBitmapArrayRects[2] ); @@ -243,7 +243,7 @@ void GuiPaneControl::onRender(Point2I offset, const RectI &updateRect) foo.inset(1,0); GFX->getDrawUtil()->drawBitmapStretchSR( - mProfile->getBitmapResource(), + mProfile->getBitmap(), RectI(barOffset, Point2I(barMiddleSize, mProfile->mBitmapArrayRects[3].extent.y)), foo ); @@ -253,7 +253,7 @@ void GuiPaneControl::onRender(Point2I offset, const RectI &updateRect) barOffset.x += barMiddleSize; GFX->getDrawUtil()->drawBitmapStretchSR( - mProfile->getBitmapResource(), + mProfile->getBitmap(), RectI(barOffset, mProfile->mBitmapArrayRects[4].extent), mProfile->mBitmapArrayRects[4] ); diff --git a/Engine/source/gui/containers/guiScrollCtrl.cpp b/Engine/source/gui/containers/guiScrollCtrl.cpp index c9f6d384f..d60060e7b 100644 --- a/Engine/source/gui/containers/guiScrollCtrl.cpp +++ b/Engine/source/gui/containers/guiScrollCtrl.cpp @@ -148,7 +148,7 @@ bool GuiScrollCtrl::onWake() if (! Parent::onWake()) return false; - mTextureObject = mProfile->getBitmapResource(); + mTextureObject = mProfile->getBitmap(); if (mTextureObject && (mProfile->constructBitmapArray() >= (U32)BmpStates * (U32)BmpCount)) { mBitmapBounds = mProfile->mBitmapArrayRects.address(); diff --git a/Engine/source/gui/containers/guiWindowCtrl.cpp b/Engine/source/gui/containers/guiWindowCtrl.cpp index bda7b0bfc..9100e7fe9 100644 --- a/Engine/source/gui/containers/guiWindowCtrl.cpp +++ b/Engine/source/gui/containers/guiWindowCtrl.cpp @@ -696,7 +696,7 @@ bool GuiWindowCtrl::onWake() return false; } - mTextureObject = mProfile->getBitmapResource(); + mTextureObject = mProfile->getBitmap(); mBitmapBounds = mProfile->mBitmapArrayRects.address(); S32 buttonHeight = mBitmapBounds[(U32)BmpStates * (U32)BmpClose].extent.y; diff --git a/Engine/source/gui/controls/guiBitmapBorderCtrl.cpp b/Engine/source/gui/controls/guiBitmapBorderCtrl.cpp index 05d0fea47..e0997215c 100644 --- a/Engine/source/gui/controls/guiBitmapBorderCtrl.cpp +++ b/Engine/source/gui/controls/guiBitmapBorderCtrl.cpp @@ -132,7 +132,7 @@ bool GuiBitmapBorderCtrl::onWake() //get the texture for the close, minimize, and maximize buttons mBitmapBounds = NULL; - mTextureObject = mProfile->getBitmapResource(); + mTextureObject = mProfile->getBitmap(); if( mProfile->constructBitmapArray() >= NumBitmaps ) mBitmapBounds = mProfile->mBitmapArrayRects.address(); else diff --git a/Engine/source/gui/controls/guiGameListMenuCtrl.cpp b/Engine/source/gui/controls/guiGameListMenuCtrl.cpp index 4637a2285..0ea73a883 100644 --- a/Engine/source/gui/controls/guiGameListMenuCtrl.cpp +++ b/Engine/source/gui/controls/guiGameListMenuCtrl.cpp @@ -205,7 +205,7 @@ void GuiGameListMenuCtrl::onRenderListOption(Row* row, Point2I currentOffset) arrowOffset.y = currentOffset.y + arrowOffsetY; drawer->clearBitmapModulation(); - drawer->drawBitmapStretchSR(profile->getBitmapResource(), RectI(arrowOffset, arrowExtent), profile->getBitmapArrayRect((U32)iconIndex)); + drawer->drawBitmapStretchSR(profile->getBitmap(), RectI(arrowOffset, arrowExtent), profile->getBitmapArrayRect((U32)iconIndex)); // render the right arrow bool arrowOnR = (isRowSelected || isRowHighlighted) && (row->mWrapOptions || (row->mSelectedOption < row->mOptions.size() - 1)); @@ -214,7 +214,7 @@ void GuiGameListMenuCtrl::onRenderListOption(Row* row, Point2I currentOffset) arrowOffset.y = currentOffset.y + arrowOffsetY; drawer->clearBitmapModulation(); - drawer->drawBitmapStretchSR(profile->getBitmapResource(), RectI(arrowOffset, arrowExtent), profile->getBitmapArrayRect((U32)iconIndex)); + drawer->drawBitmapStretchSR(profile->getBitmap(), RectI(arrowOffset, arrowExtent), profile->getBitmapArrayRect((U32)iconIndex)); } // get the appropriate font color @@ -1758,7 +1758,7 @@ bool GuiGameListMenuProfile::onAdd() // We can't call enforceConstraints() here because incRefCount initializes // some of the things to enforce. Do a basic sanity check here instead. - U32 assetStatus = ImageAsset::getAssetErrCode(mBitmapAsset); + U32 assetStatus = ImageAsset::getAssetErrCode(getBitmapAsset()); if (assetStatus != AssetBase::Ok && assetStatus != AssetBase::UsingFallback) { Con::errorf( "GuiGameListMenuProfile: %s can't be created without a bitmap. Please add a 'Bitmap' property to the object definition.", getName() ); diff --git a/Engine/source/gui/controls/guiGameListOptionsCtrl.cpp b/Engine/source/gui/controls/guiGameListOptionsCtrl.cpp index f4d40ebe6..7793eb586 100644 --- a/Engine/source/gui/controls/guiGameListOptionsCtrl.cpp +++ b/Engine/source/gui/controls/guiGameListOptionsCtrl.cpp @@ -111,7 +111,7 @@ void GuiGameListOptionsCtrl::onRender(Point2I offset, const RectI &updateRect) arrowOffset.y = currentOffset.y + arrowOffsetY; drawer->clearBitmapModulation(); - drawer->drawBitmapStretchSR(profile->getBitmapResource(), RectI(arrowOffset, arrowExtent), profile->getBitmapArrayRect((U32)iconIndex)); + drawer->drawBitmapStretchSR(profile->getBitmap(), RectI(arrowOffset, arrowExtent), profile->getBitmapArrayRect((U32)iconIndex)); // render the right arrow bool arrowOnR = (isRowSelected || isRowHighlighted) && (myRow->mWrapOptions || (myRow->mSelectedOption < myRow->mOptions.size() - 1)); @@ -120,7 +120,7 @@ void GuiGameListOptionsCtrl::onRender(Point2I offset, const RectI &updateRect) arrowOffset.y = currentOffset.y + arrowOffsetY; drawer->clearBitmapModulation(); - drawer->drawBitmapStretchSR(profile->getBitmapResource(), RectI(arrowOffset, arrowExtent), profile->getBitmapArrayRect((U32)iconIndex)); + drawer->drawBitmapStretchSR(profile->getBitmap(), RectI(arrowOffset, arrowExtent), profile->getBitmapArrayRect((U32)iconIndex)); } // get the appropriate font color diff --git a/Engine/source/gui/controls/guiSliderCtrl.cpp b/Engine/source/gui/controls/guiSliderCtrl.cpp index c5f4a90b6..4ab0d6850 100644 --- a/Engine/source/gui/controls/guiSliderCtrl.cpp +++ b/Engine/source/gui/controls/guiSliderCtrl.cpp @@ -432,9 +432,9 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect) drawUtil->clearBitmapModulation(); //left border - drawUtil->drawBitmapSR(mProfile->getBitmapResource(), Point2I(offset.x,offset.y), mBitmapBounds[SliderLineLeft]); + drawUtil->drawBitmapSR(mProfile->getBitmap(), Point2I(offset.x,offset.y), mBitmapBounds[SliderLineLeft]); //right border - drawUtil->drawBitmapSR(mProfile->getBitmapResource(), Point2I(offset.x + getWidth() - mBitmapBounds[SliderLineRight].extent.x, offset.y), mBitmapBounds[SliderLineRight]); + drawUtil->drawBitmapSR(mProfile->getBitmap(), Point2I(offset.x + getWidth() - mBitmapBounds[SliderLineRight].extent.x, offset.y), mBitmapBounds[SliderLineRight]); //draw our center piece to our slider control's border and stretch it @@ -448,11 +448,11 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect) stretchRect = mBitmapBounds[SliderLineCenter]; stretchRect.inset(1,0); - drawUtil->drawBitmapStretchSR(mProfile->getBitmapResource(), destRect, stretchRect); + drawUtil->drawBitmapStretchSR(mProfile->getBitmap(), destRect, stretchRect); //draw our control slider button thumb.point += pos; - drawUtil->drawBitmapSR(mProfile->getBitmapResource(),Point2I(thumb.point.x,offset.y ),mBitmapBounds[index]); + drawUtil->drawBitmapSR(mProfile->getBitmap(),Point2I(thumb.point.x,offset.y ),mBitmapBounds[index]); } else if (getWidth() >= getHeight()) diff --git a/Engine/source/gui/controls/guiTreeViewCtrl.cpp b/Engine/source/gui/controls/guiTreeViewCtrl.cpp index e1589aed5..3b95dd059 100644 --- a/Engine/source/gui/controls/guiTreeViewCtrl.cpp +++ b/Engine/source/gui/controls/guiTreeViewCtrl.cpp @@ -3781,7 +3781,7 @@ void GuiTreeViewCtrl::onRenderCell(Point2I offset, Point2I cell, bool, bool ) if( ( bitmap >= 0 ) && ( bitmap < mProfile->mBitmapArrayRects.size() ) ) { if( drawBitmap ) - drawer->drawBitmapSR( mProfile->getBitmapResource(), drawRect.point, mProfile->mBitmapArrayRects[bitmap] ); + drawer->drawBitmapSR( mProfile->getBitmap(), drawRect.point, mProfile->mBitmapArrayRects[bitmap] ); newOffset = mProfile->mBitmapArrayRects[bitmap].extent.x; } diff --git a/Engine/source/gui/core/guiDefaultControlRender.cpp b/Engine/source/gui/core/guiDefaultControlRender.cpp index f5389968e..ff4bc1071 100644 --- a/Engine/source/gui/core/guiDefaultControlRender.cpp +++ b/Engine/source/gui/core/guiDefaultControlRender.cpp @@ -173,14 +173,14 @@ void renderBorder( const RectI &bounds, GuiControlProfile *profile ) // Draw all corners first. //top left border - drawer->drawBitmapSR(profile->getBitmapResource(),Point2I(bounds.point.x,bounds.point.y),mBitmapBounds[BorderTopLeft]); + drawer->drawBitmapSR(profile->getBitmap(),Point2I(bounds.point.x,bounds.point.y),mBitmapBounds[BorderTopLeft]); //top right border - drawer->drawBitmapSR(profile->getBitmapResource(),Point2I(bounds.point.x + bounds.extent.x - mBitmapBounds[BorderTopRight].extent.x,bounds.point.y),mBitmapBounds[BorderTopRight]); + drawer->drawBitmapSR(profile->getBitmap(),Point2I(bounds.point.x + bounds.extent.x - mBitmapBounds[BorderTopRight].extent.x,bounds.point.y),mBitmapBounds[BorderTopRight]); //bottom left border - drawer->drawBitmapSR(profile->getBitmapResource(),Point2I(bounds.point.x,bounds.point.y + bounds.extent.y - mBitmapBounds[BorderBottomLeft].extent.y),mBitmapBounds[BorderBottomLeft]); + drawer->drawBitmapSR(profile->getBitmap(),Point2I(bounds.point.x,bounds.point.y + bounds.extent.y - mBitmapBounds[BorderBottomLeft].extent.y),mBitmapBounds[BorderBottomLeft]); //bottom right border - drawer->drawBitmapSR(profile->getBitmapResource(),Point2I( + drawer->drawBitmapSR(profile->getBitmap(),Point2I( bounds.point.x + bounds.extent.x - mBitmapBounds[BorderBottomRight].extent.x, bounds.point.y + bounds.extent.y - mBitmapBounds[BorderBottomRight].extent.y), mBitmapBounds[BorderBottomRight]); @@ -198,7 +198,7 @@ void renderBorder( const RectI &bounds, GuiControlProfile *profile ) stretchRect = mBitmapBounds[BorderTop]; stretchRect.inset(1,0); //draw it - drawer->drawBitmapStretchSR(profile->getBitmapResource(),destRect,stretchRect); + drawer->drawBitmapStretchSR(profile->getBitmap(),destRect,stretchRect); //bottom line stretch destRect.point.x = bounds.point.x + mBitmapBounds[BorderBottomLeft].extent.x; destRect.extent.x = bounds.extent.x - mBitmapBounds[BorderBottomRight].extent.x - mBitmapBounds[BorderBottomLeft].extent.x; @@ -208,7 +208,7 @@ void renderBorder( const RectI &bounds, GuiControlProfile *profile ) stretchRect = mBitmapBounds[BorderBottom]; stretchRect.inset(1,0); //draw it - drawer->drawBitmapStretchSR(profile->getBitmapResource(),destRect,stretchRect); + drawer->drawBitmapStretchSR(profile->getBitmap(),destRect,stretchRect); //left line stretch destRect.point.x = bounds.point.x; destRect.extent.x = mBitmapBounds[BorderLeft].extent.x; @@ -218,7 +218,7 @@ void renderBorder( const RectI &bounds, GuiControlProfile *profile ) stretchRect = mBitmapBounds[BorderLeft]; stretchRect.inset(0,1); //draw it - drawer->drawBitmapStretchSR(profile->getBitmapResource(),destRect,stretchRect); + drawer->drawBitmapStretchSR(profile->getBitmap(),destRect,stretchRect); //right line stretch destRect.point.x = bounds.point.x + bounds.extent.x - mBitmapBounds[BorderRight].extent.x; destRect.extent.x = mBitmapBounds[BorderRight].extent.x; @@ -228,7 +228,7 @@ void renderBorder( const RectI &bounds, GuiControlProfile *profile ) stretchRect = mBitmapBounds[BorderRight]; stretchRect.inset(0,1); //draw it - drawer->drawBitmapStretchSR(profile->getBitmapResource(),destRect,stretchRect); + drawer->drawBitmapStretchSR(profile->getBitmap(),destRect,stretchRect); // End drawing sides and top stretched borders break; @@ -288,14 +288,14 @@ void renderSizableBitmapBordersFilled( const RectI &bounds, S32 baseMultiplier, // Draw all corners first. //top left border - drawer->drawBitmapSR(profile->getBitmapResource(),Point2I(bounds.point.x,bounds.point.y),mBitmapBounds[borderTopLeft]); + drawer->drawBitmapSR(profile->getBitmap(),Point2I(bounds.point.x,bounds.point.y),mBitmapBounds[borderTopLeft]); //top right border - drawer->drawBitmapSR(profile->getBitmapResource(),Point2I(bounds.point.x + bounds.extent.x - mBitmapBounds[borderTopRight].extent.x,bounds.point.y),mBitmapBounds[borderTopRight]); + drawer->drawBitmapSR(profile->getBitmap(),Point2I(bounds.point.x + bounds.extent.x - mBitmapBounds[borderTopRight].extent.x,bounds.point.y),mBitmapBounds[borderTopRight]); //bottom left border - drawer->drawBitmapSR(profile->getBitmapResource(),Point2I(bounds.point.x,bounds.point.y + bounds.extent.y - mBitmapBounds[borderBottomLeft].extent.y),mBitmapBounds[borderBottomLeft]); + drawer->drawBitmapSR(profile->getBitmap(),Point2I(bounds.point.x,bounds.point.y + bounds.extent.y - mBitmapBounds[borderBottomLeft].extent.y),mBitmapBounds[borderBottomLeft]); //bottom right border - drawer->drawBitmapSR(profile->getBitmapResource(),Point2I( + drawer->drawBitmapSR(profile->getBitmap(),Point2I( bounds.point.x + bounds.extent.x - mBitmapBounds[borderBottomRight].extent.x, bounds.point.y + bounds.extent.y - mBitmapBounds[borderBottomRight].extent.y), mBitmapBounds[borderBottomRight]); @@ -313,7 +313,7 @@ void renderSizableBitmapBordersFilled( const RectI &bounds, S32 baseMultiplier, stretchRect = mBitmapBounds[borderTop]; stretchRect.inset(1,0); //draw it - drawer->drawBitmapStretchSR(profile->getBitmapResource(),destRect,stretchRect); + drawer->drawBitmapStretchSR(profile->getBitmap(),destRect,stretchRect); //bottom line stretch destRect.point.x = bounds.point.x + mBitmapBounds[borderBottomLeft].extent.x; destRect.extent.x = bounds.extent.x - mBitmapBounds[borderBottomRight].extent.x - mBitmapBounds[borderBottomLeft].extent.x; @@ -323,7 +323,7 @@ void renderSizableBitmapBordersFilled( const RectI &bounds, S32 baseMultiplier, stretchRect = mBitmapBounds[borderBottom]; stretchRect.inset(1,0); //draw it - drawer->drawBitmapStretchSR(profile->getBitmapResource(),destRect,stretchRect); + drawer->drawBitmapStretchSR(profile->getBitmap(),destRect,stretchRect); //left line stretch destRect.point.x = bounds.point.x; destRect.extent.x = mBitmapBounds[borderLeft].extent.x; @@ -333,7 +333,7 @@ void renderSizableBitmapBordersFilled( const RectI &bounds, S32 baseMultiplier, stretchRect = mBitmapBounds[borderLeft]; stretchRect.inset(0,1); //draw it - drawer->drawBitmapStretchSR(profile->getBitmapResource(),destRect,stretchRect); + drawer->drawBitmapStretchSR(profile->getBitmap(),destRect,stretchRect); //right line stretch destRect.point.x = bounds.point.x + bounds.extent.x - mBitmapBounds[borderRight].extent.x; destRect.extent.x = mBitmapBounds[borderRight].extent.x; @@ -343,7 +343,7 @@ void renderSizableBitmapBordersFilled( const RectI &bounds, S32 baseMultiplier, stretchRect = mBitmapBounds[borderRight]; stretchRect.inset(0,1); //draw it - drawer->drawBitmapStretchSR(profile->getBitmapResource(),destRect,stretchRect); + drawer->drawBitmapStretchSR(profile->getBitmap(),destRect,stretchRect); //fill stretch destRect.point.x = bounds.point.x + mBitmapBounds[borderLeft].extent.x; destRect.extent.x = (bounds.extent.x) - mBitmapBounds[borderLeft].extent.x - mBitmapBounds[borderRight].extent.x; @@ -353,7 +353,7 @@ void renderSizableBitmapBordersFilled( const RectI &bounds, S32 baseMultiplier, stretchRect = mBitmapBounds[fill]; stretchRect.inset(1,1); //draw it - drawer->drawBitmapStretchSR(profile->getBitmapResource(),destRect,stretchRect); + drawer->drawBitmapStretchSR(profile->getBitmap(),destRect,stretchRect); // End drawing sides and top stretched borders } @@ -388,14 +388,14 @@ void renderSizableBitmapBordersFilledIndex( const RectI &bounds, S32 startIndex, // Draw all corners first. //top left border - drawer->drawBitmapSR(profile->getBitmapResource(),Point2I(bounds.point.x,bounds.point.y),mBitmapBounds[borderTopLeft]); + drawer->drawBitmapSR(profile->getBitmap(),Point2I(bounds.point.x,bounds.point.y),mBitmapBounds[borderTopLeft]); //top right border - drawer->drawBitmapSR(profile->getBitmapResource(),Point2I(bounds.point.x + bounds.extent.x - mBitmapBounds[borderTopRight].extent.x,bounds.point.y),mBitmapBounds[borderTopRight]); + drawer->drawBitmapSR(profile->getBitmap(),Point2I(bounds.point.x + bounds.extent.x - mBitmapBounds[borderTopRight].extent.x,bounds.point.y),mBitmapBounds[borderTopRight]); //bottom left border - drawer->drawBitmapSR(profile->getBitmapResource(),Point2I(bounds.point.x,bounds.point.y + bounds.extent.y - mBitmapBounds[borderBottomLeft].extent.y),mBitmapBounds[borderBottomLeft]); + drawer->drawBitmapSR(profile->getBitmap(),Point2I(bounds.point.x,bounds.point.y + bounds.extent.y - mBitmapBounds[borderBottomLeft].extent.y),mBitmapBounds[borderBottomLeft]); //bottom right border - drawer->drawBitmapSR(profile->getBitmapResource(),Point2I( + drawer->drawBitmapSR(profile->getBitmap(),Point2I( bounds.point.x + bounds.extent.x - mBitmapBounds[borderBottomRight].extent.x, bounds.point.y + bounds.extent.y - mBitmapBounds[borderBottomRight].extent.y), mBitmapBounds[borderBottomRight]); @@ -413,7 +413,7 @@ void renderSizableBitmapBordersFilledIndex( const RectI &bounds, S32 startIndex, stretchRect = mBitmapBounds[borderTop]; stretchRect.inset(1,0); //draw it - drawer->drawBitmapStretchSR(profile->getBitmapResource(),destRect,stretchRect); + drawer->drawBitmapStretchSR(profile->getBitmap(),destRect,stretchRect); //bottom line stretch destRect.point.x = bounds.point.x + mBitmapBounds[borderBottomLeft].extent.x; destRect.extent.x = bounds.extent.x - mBitmapBounds[borderBottomRight].extent.x - mBitmapBounds[borderBottomLeft].extent.x; @@ -423,7 +423,7 @@ void renderSizableBitmapBordersFilledIndex( const RectI &bounds, S32 startIndex, stretchRect = mBitmapBounds[borderBottom]; stretchRect.inset(1,0); //draw it - drawer->drawBitmapStretchSR(profile->getBitmapResource(),destRect,stretchRect); + drawer->drawBitmapStretchSR(profile->getBitmap(),destRect,stretchRect); //left line stretch destRect.point.x = bounds.point.x; destRect.extent.x = mBitmapBounds[borderLeft].extent.x; @@ -433,7 +433,7 @@ void renderSizableBitmapBordersFilledIndex( const RectI &bounds, S32 startIndex, stretchRect = mBitmapBounds[borderLeft]; stretchRect.inset(0,1); //draw it - drawer->drawBitmapStretchSR(profile->getBitmapResource(),destRect,stretchRect); + drawer->drawBitmapStretchSR(profile->getBitmap(),destRect,stretchRect); //left line stretch destRect.point.x = bounds.point.x + bounds.extent.x - mBitmapBounds[borderRight].extent.x; destRect.extent.x = mBitmapBounds[borderRight].extent.x; @@ -443,7 +443,7 @@ void renderSizableBitmapBordersFilledIndex( const RectI &bounds, S32 startIndex, stretchRect = mBitmapBounds[borderRight]; stretchRect.inset(0,1); //draw it - drawer->drawBitmapStretchSR(profile->getBitmapResource(),destRect,stretchRect); + drawer->drawBitmapStretchSR(profile->getBitmap(),destRect,stretchRect); //fill stretch destRect.point.x = bounds.point.x + mBitmapBounds[borderLeft].extent.x; destRect.extent.x = (bounds.extent.x) - mBitmapBounds[borderLeft].extent.x - mBitmapBounds[borderRight].extent.x; @@ -453,7 +453,7 @@ void renderSizableBitmapBordersFilledIndex( const RectI &bounds, S32 startIndex, stretchRect = mBitmapBounds[fill]; stretchRect.inset(1,1); //draw it - drawer->drawBitmapStretchSR(profile->getBitmapResource(),destRect,stretchRect); + drawer->drawBitmapStretchSR(profile->getBitmap(),destRect,stretchRect); // End drawing sides and top stretched borders } @@ -484,9 +484,9 @@ void renderFixedBitmapBordersFilled( const RectI &bounds, S32 baseMultiplier, Gu // Draw all corners first. //left border - drawer->drawBitmapSR(profile->getBitmapResource(),Point2I(bounds.point.x,bounds.point.y),mBitmapBounds[borderLeft]); + drawer->drawBitmapSR(profile->getBitmap(),Point2I(bounds.point.x,bounds.point.y),mBitmapBounds[borderLeft]); //right border - drawer->drawBitmapSR(profile->getBitmapResource(),Point2I(bounds.point.x + bounds.extent.x - mBitmapBounds[borderRight].extent.x,bounds.point.y),mBitmapBounds[borderRight]); + drawer->drawBitmapSR(profile->getBitmap(),Point2I(bounds.point.x + bounds.extent.x - mBitmapBounds[borderRight].extent.x,bounds.point.y),mBitmapBounds[borderRight]); // End drawing corners @@ -501,7 +501,7 @@ void renderFixedBitmapBordersFilled( const RectI &bounds, S32 baseMultiplier, Gu stretchRect = mBitmapBounds[fill]; stretchRect.inset(1,0); //draw it - drawer->drawBitmapStretchSR(profile->getBitmapResource(),destRect,stretchRect); + drawer->drawBitmapStretchSR(profile->getBitmap(),destRect,stretchRect); // End drawing fill } @@ -529,9 +529,9 @@ void renderFixedBitmapBordersFilledIndex( const RectI &bounds, S32 startIndex, G // Draw all corners first. //left border - drawer->drawBitmapSR(profile->getBitmapResource(),Point2I(bounds.point.x,bounds.point.y),mBitmapBounds[borderLeft]); + drawer->drawBitmapSR(profile->getBitmap(),Point2I(bounds.point.x,bounds.point.y),mBitmapBounds[borderLeft]); //right border - drawer->drawBitmapSR(profile->getBitmapResource(),Point2I(bounds.point.x + bounds.extent.x - mBitmapBounds[borderRight].extent.x,bounds.point.y),mBitmapBounds[borderRight]); + drawer->drawBitmapSR(profile->getBitmap(),Point2I(bounds.point.x + bounds.extent.x - mBitmapBounds[borderRight].extent.x,bounds.point.y),mBitmapBounds[borderRight]); // End drawing corners @@ -546,7 +546,7 @@ void renderFixedBitmapBordersFilledIndex( const RectI &bounds, S32 startIndex, G stretchRect = mBitmapBounds[fill]; stretchRect.inset(1,0); //draw it - drawer->drawBitmapStretchSR(profile->getBitmapResource(),destRect,stretchRect); + drawer->drawBitmapStretchSR(profile->getBitmap(),destRect,stretchRect); // End drawing fill } diff --git a/Engine/source/gui/core/guiTypes.cpp b/Engine/source/gui/core/guiTypes.cpp index db85c628a..ce1382203 100644 --- a/Engine/source/gui/core/guiTypes.cpp +++ b/Engine/source/gui/core/guiTypes.cpp @@ -179,7 +179,7 @@ void GuiControlProfile::setBitmapHandle(GFXTexHandle handle) { mBitmap = handle; - _setBitmap(StringTable->insert("texhandle")); + mBitmapName = "texhandle"; } bool GuiControlProfile::protectedSetBitmap( void *object, const char *index, const char *data ) @@ -196,16 +196,17 @@ bool GuiControlProfile::protectedSetBitmap( void *object, const char *index, con profile->mBitmapArrayRects.clear(); profile->mBitmap = nullptr; - if (profile->getBitmap() != StringTable->EmptyString()) + if (profile->mBitmapName != StringTable->EmptyString()) { - if (profile->mBitmapAsset.notNull() && profile->getBitmap() != StringTable->insert("texHandle")) + if (profile->mBitmapAsset.notNull() && profile->mBitmapName != StringTable->insert("texHandle")) { - profile->mBitmap.set(profile->mBitmapAsset->getImageFile(), profile->mBitmapProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__)); + profile->mBitmap = profile->getBitmap(); + profile->mBitmapName = profile->mBitmapAsset->getImageFile(); } //verify the bitmap if (!profile->mBitmap) - Con::errorf("(%s) - Failed to load profile bitmap (%s)", profile->getName(), profile->getBitmap()); + Con::errorf("(%s) - Failed to load profile bitmap (%s)", profile->getName(), profile->getBitmapAsset().getAssetId()); // If we've got a special border, make sure it's usable. //if( profile->mBorder == -1 || profile->mBorder == -2 ) @@ -271,7 +272,9 @@ GuiControlProfile::GuiControlProfile(void) : mMouseOverSelected = false; // bitmap members - INIT_ASSET(Bitmap); + mBitmap = NULL; + mBitmapName = StringTable->EmptyString(); + mUseBitmapArray = false; mChildrenProfileName = NULL; @@ -438,7 +441,7 @@ void GuiControlProfile::initPersistFields() "Texture to use for rendering control.", AbstractClassRep::FIELD_HideInInspectors); #endif - addProtectedField("bitmapAsset", TypeImageAssetId, Offset(mBitmapAssetId, GuiControlProfile), + addProtectedField("bitmapAsset", TypeImageAssetPtrRefactor, Offset(mBitmapAsset, GuiControlProfile), &GuiControlProfile::protectedSetBitmap, &defaultProtectedGetFn, "Texture to use for rendering control."); @@ -546,15 +549,12 @@ S32 GuiControlProfile::constructBitmapArray() if( mBitmap.isNull() ) { - if (!_setBitmap(getBitmap())) - return 0; - - if (getBitmap() != StringTable->EmptyString() && mBitmapName != StringTable->insert("texhandle")) + if (mBitmapAsset.notNull() && mBitmapName != StringTable->insert("texhandle")) { - mBitmap.set(getBitmap(), mBitmapProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__)); + mBitmap = getBitmap(); } - if (getBitmap() == StringTable->EmptyString() || mBitmap.isNull()) + if (mBitmapAsset.isNull() || mBitmap.isNull()) return 0; } @@ -564,8 +564,8 @@ S32 GuiControlProfile::constructBitmapArray() ColorI sepColor; if ( !bmp || !bmp->getColor( 0, 0, sepColor ) ) { - Con::errorf("Failed to create bitmap array from %s for profile %s - couldn't ascertain seperator color!", getBitmap(), getName()); - AssertFatal( false, avar("Failed to create bitmap array from %s for profile %s - couldn't ascertain seperator color!", getBitmap(), getName())); + Con::errorf("Failed to create bitmap array from %s for profile %s - couldn't ascertain seperator color!", getBitmapAsset().getAssetId(), getName()); + AssertFatal( false, avar("Failed to create bitmap array from %s for profile %s - couldn't ascertain seperator color!", getBitmapAsset().getAssetId(), getName())); return 0; } @@ -640,20 +640,16 @@ void GuiControlProfile::incLoadCount() if( mFont == NULL ) loadFont(); - // - if (getBitmap() != StringTable->EmptyString()) + if (mBitmapAsset.notNull() && mBitmapName != StringTable->insert("texHandle")) { - if (mBitmapAsset.notNull() && getBitmap() != StringTable->insert("texHandle")) - { - mBitmap.set(mBitmapAsset->getImageFile(), mBitmapProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__)); - } - - //verify the bitmap - if (!mBitmap) - Con::errorf("(%s) - Failed to load profile bitmap (%s)", getName(), getBitmap()); - - constructBitmapArray(); + mBitmap = getBitmap(); } + + //verify the bitmap + if (!mBitmap) + Con::errorf("(%s) - Failed to load profile bitmap (%s)", getName(), getBitmapAsset().getAssetId()); + + constructBitmapArray(); } mLoadCount ++; @@ -676,7 +672,7 @@ void GuiControlProfile::decLoadCount() getId(), getClassName(), getName(), getInternalName() ); #endif - StringTableEntry bitmapName = getBitmap(); + StringTableEntry bitmapName = getBitmapAsset().getAssetId(); if(bitmapName == StringTable->EmptyString() || bitmapName == StringTable->insert("texhandle")) mBitmap = NULL; } @@ -704,15 +700,15 @@ DefineEngineMethod( GuiControlProfile, getStringWidth, S32, (const char* string) DefineEngineMethod(GuiControlProfile, getBitmap, const char*, (), , "get name") { - return object->getBitmap(); + return object->getBitmapAsset()->getImageFile(); } DefineEngineMethod(GuiControlProfile, getBitmapAsset, const char*, (), , "") { - return object->mBitmapAssetId; + return object->getBitmapAsset().getAssetId(); } -DefineEngineMethod(GuiControlProfile, setBitmap, bool, (const char* map), , "") +DefineEngineMethod(GuiControlProfile, setBitmap, void, (const char* map), , "") { - return object->_setBitmap(StringTable->insert(map)); + object->_setBitmap(StringTable->insert(map)); } //----------------------------------------------------------------------------- diff --git a/Engine/source/gui/core/guiTypes.h b/Engine/source/gui/core/guiTypes.h index 7acb37fd7..4ede98303 100644 --- a/Engine/source/gui/core/guiTypes.h +++ b/Engine/source/gui/core/guiTypes.h @@ -457,105 +457,11 @@ public: ///< Bitmap for the bitmap of the control /// public: - GFXTexHandle mBitmap = NULL; - StringTableEntry mBitmapName; - StringTableEntry mBitmapAssetId; - AssetPtr mBitmapAsset; - GFXTextureProfile* mBitmapProfile = &GFXDefaultGUIProfile; -public: - const StringTableEntry getBitmapFile() const { return mBitmapName; } - void setBitmapFile(const FileName& _in) { mBitmapName = StringTable->insert(_in.c_str()); } - const AssetPtr& getBitmapAsset() const { return mBitmapAsset; } - void setBitmapAsset(const AssetPtr& _in) { mBitmapAsset = _in; } - - bool _setBitmap(StringTableEntry _in) - { - if (mBitmapAssetId != _in || mBitmapName != _in) - { - if (_in == StringTable->EmptyString()) - { - mBitmapName = StringTable->EmptyString(); - mBitmapAssetId = StringTable->EmptyString(); - mBitmapAsset = NULL; - mBitmap.free(); - mBitmap = NULL; - return true; - } - else if (_in[0] == '$' || _in[0] == '#') - { - mBitmapName = _in; - mBitmapAssetId = StringTable->EmptyString(); - mBitmapAsset = NULL; - mBitmap.free(); - mBitmap = NULL; - return true; - } - - if (AssetDatabase.isDeclaredAsset(_in)) - { - mBitmapAssetId = _in; - - U32 assetState = ImageAsset::getAssetById(mBitmapAssetId, &mBitmapAsset); - - if (ImageAsset::Ok == assetState) - { - mBitmapName = StringTable->EmptyString(); - } - } - else - { - StringTableEntry assetId = ImageAsset::getAssetIdByFilename(_in); - if (assetId != StringTable->EmptyString()) - { - mBitmapAssetId = assetId; - if (ImageAsset::getAssetById(mBitmapAssetId, &mBitmapAsset) == ImageAsset::Ok) - { - mBitmapName = StringTable->EmptyString(); - } - } - else - { - mBitmapName = _in; - mBitmapAssetId = StringTable->EmptyString(); - mBitmapAsset = NULL; - } - } - } - if (getBitmap() != StringTable->EmptyString() && mBitmapName != StringTable->insert("texhandle")) - { - } - else - { - mBitmap.free(); - mBitmap = NULL; - } - - if (getBitmap() != StringTable->EmptyString() && mBitmapAsset.notNull() && mBitmapAsset->getStatus() != ImageAsset::Ok) - { - Con::errorf("%s(%s)::_set%s() - image asset failure \"%s\" due to [%s]", macroText(className), getName(), macroText(name), _in, ImageAsset::getAssetErrstrn(mBitmapAsset->getStatus()).c_str()); - return false; - } - return true; - } - - const StringTableEntry getBitmap() const - { - if (mBitmapAsset && (mBitmapAsset->getImageFile() != StringTable->EmptyString())) - return Platform::makeRelativePathName(mBitmapAsset->getImageFile(), Platform::getMainDotCsDir()); - else if (mBitmapAssetId != StringTable->EmptyString()) - return mBitmapAssetId; - else if (mBitmapName != StringTable->EmptyString()) - return StringTable->insert(Platform::makeRelativePathName(mBitmapName, Platform::getMainDotCsDir())); - else - return StringTable->EmptyString(); - } - GFXTexHandle getBitmapResource() - { - return mBitmap; - } - DECLARE_ASSET_SETGET(GuiControlProfile, Bitmap); - void onBitmapChanged() {} + DECLARE_IMAGEASSET_REFACTOR(GuiControlProfile, Bitmap, GFXDefaultGUIProfile) + + GFXTexHandle mBitmap; + StringTableEntry mBitmapName; bool mUseBitmapArray; ///< Flag to use the bitmap array or to fallback to non-array rendering Vector mBitmapArrayRects; ///< Used for controls which use an array of bitmaps such as checkboxes diff --git a/Engine/source/gui/editor/guiMenuBar.cpp b/Engine/source/gui/editor/guiMenuBar.cpp index cae69d291..e71ce80e6 100644 --- a/Engine/source/gui/editor/guiMenuBar.cpp +++ b/Engine/source/gui/editor/guiMenuBar.cpp @@ -409,7 +409,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->getBitmapResource(), offset + bitmapstart, rect); + drawUtil->drawBitmapSR(mProfile->getBitmap(), offset + bitmapstart, rect); // Should we also draw the text? if (!mMenuList[i].drawBitmapOnly) diff --git a/Engine/source/gui/editor/guiPopupMenuCtrl.cpp b/Engine/source/gui/editor/guiPopupMenuCtrl.cpp index 2a72c09b0..572c0ab08 100644 --- a/Engine/source/gui/editor/guiPopupMenuCtrl.cpp +++ b/Engine/source/gui/editor/guiPopupMenuCtrl.cpp @@ -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->getBitmapResource(), bitPos + off, rect); + GFX->getDrawUtil()->drawBitmapSR(mProfile->getBitmap(), bitPos + off, rect); } } diff --git a/Engine/source/gui/game/guiProgressBitmapCtrl.cpp b/Engine/source/gui/game/guiProgressBitmapCtrl.cpp index 7cdda0f03..183634028 100644 --- a/Engine/source/gui/game/guiProgressBitmapCtrl.cpp +++ b/Engine/source/gui/game/guiProgressBitmapCtrl.cpp @@ -220,14 +220,14 @@ void GuiProgressBitmapCtrl::onRender(Point2I offset, const RectI &updateRect) //drawing stretch bitmap RectI progressRect = ctrlRect; progressRect.extent.x = width; - drawUtil->drawBitmapStretchSR(mProfile->getBitmapResource(), progressRect, mProfile->mBitmapArrayRects[0]); + drawUtil->drawBitmapStretchSR(mProfile->getBitmap(), progressRect, mProfile->mBitmapArrayRects[0]); } } else if(mNumberOfBitmaps >= 3) { //drawing left-end bitmap RectI progressRectLeft(ctrlRect.point.x, ctrlRect.point.y, mDim, mDim); - drawUtil->drawBitmapStretchSR(mProfile->getBitmapResource(), progressRectLeft, mProfile->mBitmapArrayRects[0]); + drawUtil->drawBitmapStretchSR(mProfile->getBitmap(), progressRectLeft, mProfile->mBitmapArrayRects[0]); //draw the progress with image S32 width = (S32)((F32)(getWidth()) * mProgress); @@ -239,11 +239,11 @@ void GuiProgressBitmapCtrl::onRender(Point2I offset, const RectI &updateRect) progressRect.extent.x = (width - mDim - mDim); if (progressRect.extent.x < 0) progressRect.extent.x = 0; - drawUtil->drawBitmapStretchSR(mProfile->getBitmapResource(), progressRect, mProfile->mBitmapArrayRects[1]); + drawUtil->drawBitmapStretchSR(mProfile->getBitmap(), progressRect, mProfile->mBitmapArrayRects[1]); //drawing right-end bitmap RectI progressRectRight(progressRect.point.x + progressRect.extent.x, ctrlRect.point.y, mDim, mDim ); - drawUtil->drawBitmapStretchSR(mProfile->getBitmapResource(), progressRectRight, mProfile->mBitmapArrayRects[2]); + drawUtil->drawBitmapStretchSR(mProfile->getBitmap(), progressRectRight, mProfile->mBitmapArrayRects[2]); } } else