mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Fixes cleanup handling on guiBitmapButtonCtrl and guiGameSettingsCtrl to release the bound textures like other GUI controls when they sleep, avoiding a texture object leak.
Fixes a call for UINavigation to getPageCount that was erroneously referencing the pageStack Fixes fetch and binding of the image for display when using the uvEditor
This commit is contained in:
parent
53aea82614
commit
67d8448915
5 changed files with 35 additions and 2 deletions
|
|
@ -201,6 +201,9 @@ void GuiBitmapButtonCtrl::onSleep()
|
||||||
mTextures[ i ].mTextureInactive = NULL;
|
mTextures[ i ].mTextureInactive = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mBitmapAsset.notNull())
|
||||||
|
mBitmap = NULL;
|
||||||
|
|
||||||
Parent::onSleep();
|
Parent::onSleep();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -511,8 +511,25 @@ bool GuiGameSettingsCtrl::onWake()
|
||||||
if( !Parent::onWake() )
|
if( !Parent::onWake() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
_setNextBitmap(getNextBitmap());
|
||||||
|
_setPreviousBitmap(getPreviousBitmap());
|
||||||
|
_setKeybindBitmap(getKeybindBitmap());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GuiGameSettingsCtrl::onSleep()
|
||||||
|
{
|
||||||
|
if (mNextBitmapAsset.notNull())
|
||||||
|
mNextBitmap = NULL;
|
||||||
|
if (mPreviousBitmapAsset.notNull())
|
||||||
|
mPreviousBitmap = NULL;
|
||||||
|
if (mKeybindBitmapAsset.notNull())
|
||||||
|
mKeybindBitmap = NULL;
|
||||||
|
|
||||||
|
Parent::onSleep();
|
||||||
|
}
|
||||||
|
|
||||||
void GuiGameSettingsCtrl::activate()
|
void GuiGameSettingsCtrl::activate()
|
||||||
{
|
{
|
||||||
if(isSelected() && isEnabled() && (mScriptCallback != StringTable->EmptyString()))
|
if(isSelected() && isEnabled() && (mScriptCallback != StringTable->EmptyString()))
|
||||||
|
|
|
||||||
|
|
@ -245,6 +245,8 @@ public:
|
||||||
/// Callback when the control wakes up.
|
/// Callback when the control wakes up.
|
||||||
bool onWake();
|
bool onWake();
|
||||||
|
|
||||||
|
void onSleep();
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
virtual void onMouseMove(const GuiEvent& event);
|
virtual void onMouseMove(const GuiEvent& event);
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ function UINavigation::pushPage(%this, %newPage, %callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
//don't re-add pages
|
//don't re-add pages
|
||||||
if(%this.pageStack.getPageCount() != 0 &&
|
if(%this.getPageCount() != 0 &&
|
||||||
%this.pageStack.getIndexFromKey(%newPage) != -1)
|
%this.pageStack.getIndexFromKey(%newPage) != -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -499,6 +499,15 @@ function UVEditor::showDialog( %this, %applyCallback, %obj, %uv)
|
||||||
|
|
||||||
// Get the preview bitmap. Code copied from Material Selector.
|
// Get the preview bitmap. Code copied from Material Selector.
|
||||||
%material = %obj.material;
|
%material = %obj.material;
|
||||||
|
if(!isObject(%material))
|
||||||
|
{
|
||||||
|
%matAssetId = %obj.materialAsset;
|
||||||
|
if(%matAssetId !$= "")
|
||||||
|
{
|
||||||
|
%matAssetDef = AssetDatabase.acquireAsset(%matAssetId);
|
||||||
|
%material = %matAssetDef.materialDefinitionName;
|
||||||
|
}
|
||||||
|
}
|
||||||
if( %material.getToneMap(0) $= "" && %material.getDiffuseMap(0) $= "" && !isObject(%material.cubemap) )
|
if( %material.getToneMap(0) $= "" && %material.getDiffuseMap(0) $= "" && !isObject(%material.cubemap) )
|
||||||
{
|
{
|
||||||
%previewImage = "core/images/warnmat";
|
%previewImage = "core/images/warnmat";
|
||||||
|
|
@ -507,13 +516,14 @@ function UVEditor::showDialog( %this, %applyCallback, %obj, %uv)
|
||||||
{
|
{
|
||||||
if( %material.toneMap[0] !$= "" )
|
if( %material.toneMap[0] !$= "" )
|
||||||
%previewImage = %material.getToneMap(0);
|
%previewImage = %material.getToneMap(0);
|
||||||
|
else if( %material.getDiffuseMapAsset(0) !$= "" )
|
||||||
|
%previewImage = %material.getDiffuseMapAsset(0);
|
||||||
else if( %material.getDiffuseMap(0) !$= "" )
|
else if( %material.getDiffuseMap(0) !$= "" )
|
||||||
%previewImage = %material.getDiffuseMap(0);
|
%previewImage = %material.getDiffuseMap(0);
|
||||||
else if( %material.cubemap.cubeFace[0] !$= "" )
|
else if( %material.cubemap.cubeFace[0] !$= "" )
|
||||||
%previewImage = %material.cubemap.cubeFace[0];
|
%previewImage = %material.cubemap.cubeFace[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
UVEditor-->bitmapPreview.setBitmap(getAssetPreviewImage(%previewImage));
|
|
||||||
|
|
||||||
// Set up the color popup
|
// Set up the color popup
|
||||||
%popup = UVEditor-->colorPopup;
|
%popup = UVEditor-->colorPopup;
|
||||||
|
|
@ -535,6 +545,7 @@ function UVEditor::showDialog( %this, %applyCallback, %obj, %uv)
|
||||||
|
|
||||||
Canvas.pushDialog(UVEditorOverlay);
|
Canvas.pushDialog(UVEditorOverlay);
|
||||||
UVEditor.setVisible(1);
|
UVEditor.setVisible(1);
|
||||||
|
UVEditor-->bitmapPreview.setBitmap(getAssetPreviewImage(%previewImage));
|
||||||
}
|
}
|
||||||
|
|
||||||
function UVEditor::hideDialog( %this )
|
function UVEditor::hideDialog( %this )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue