mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-28 15:55:39 +00:00
Adjusts the setup of the AB preview buttons so we initialize the fields in the new block rather than risking the button being asleep while trying to set bitmaps.
This commit is contained in:
parent
199ca6b3af
commit
56db8cadd0
1 changed files with 42 additions and 53 deletions
|
|
@ -686,22 +686,7 @@ function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName )
|
||||||
%tooltip = %assetName;
|
%tooltip = %assetName;
|
||||||
|
|
||||||
%textBottomPad = 20;
|
%textBottomPad = 20;
|
||||||
|
|
||||||
%previewButton = new GuiIconButtonCtrl()
|
|
||||||
{
|
|
||||||
class = "AssetBrowserPreviewButton";
|
|
||||||
useMouseEvents = true;
|
|
||||||
iconLocation = "Center";
|
|
||||||
sizeIconToButton = true;
|
|
||||||
makeIconSquare = true;
|
|
||||||
textLocation = "Bottom";
|
|
||||||
extent = %previewSize.x SPC %previewSize.y + %textBottomPad;
|
|
||||||
buttonType = "RadioButton";
|
|
||||||
buttonMargin = "0 -10";
|
|
||||||
profile = ToolsGuiDefaultIconBtnProfile;
|
|
||||||
assetBrowser = %this;
|
|
||||||
};
|
|
||||||
|
|
||||||
%previewScaleSize = %this-->previewSlider.getValue();
|
%previewScaleSize = %this-->previewSlider.getValue();
|
||||||
|
|
||||||
if(%previewScaleSize $= "")
|
if(%previewScaleSize $= "")
|
||||||
|
|
@ -710,29 +695,6 @@ function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName )
|
||||||
%this-->previewSlider.setValue(1);
|
%this-->previewSlider.setValue(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(%previewScaleSize == 0 || startsWith(%this.dirHandler.currentAddress, "Creator"))
|
|
||||||
{
|
|
||||||
%previewButton.iconLocation = "Left";
|
|
||||||
%previewButton.textLocation = "Right";
|
|
||||||
%previewButton.setextent(160,34);
|
|
||||||
%previewButton.buttonMargin = "8 8";
|
|
||||||
%previewButton.textMargin = "6";
|
|
||||||
|
|
||||||
%this.previewListMode = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
%size = %previewSize.x * %previewScaleSize;
|
|
||||||
%previewButton.setextent(%size,%size + %textBottomPad);
|
|
||||||
|
|
||||||
%this.previewListMode = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//%previewButton.extent = %previewSize.x + %previewBounds SPC %previewSize.y + %previewBounds + 24;
|
|
||||||
%previewButton.assetName = %assetName;
|
|
||||||
%previewButton.moduleName = %moduleName;
|
|
||||||
%previewButton.assetType = %assetType;
|
|
||||||
|
|
||||||
if(%this.selectMode)
|
if(%this.selectMode)
|
||||||
{
|
{
|
||||||
%doubleClickCommand = %this @ ".selectAsset( "@ %this @ ".selectedAsset );";
|
%doubleClickCommand = %this @ ".selectAsset( "@ %this @ ".selectedAsset );";
|
||||||
|
|
@ -754,22 +716,49 @@ function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName )
|
||||||
|
|
||||||
if(%this.previewData.doubleClickCommand !$= "")
|
if(%this.previewData.doubleClickCommand !$= "")
|
||||||
%doubleClickCommand = %this.previewData.doubleClickCommand;
|
%doubleClickCommand = %this.previewData.doubleClickCommand;
|
||||||
|
|
||||||
|
%previewButton = new GuiIconButtonCtrl()
|
||||||
|
{
|
||||||
|
class = "AssetBrowserPreviewButton";
|
||||||
|
useMouseEvents = true;
|
||||||
|
iconLocation = "Center";
|
||||||
|
sizeIconToButton = true;
|
||||||
|
makeIconSquare = true;
|
||||||
|
textLocation = "Bottom";
|
||||||
|
extent = %previewSize.x SPC %previewSize.y + %textBottomPad;
|
||||||
|
buttonType = "RadioButton";
|
||||||
|
buttonMargin = "0 -10";
|
||||||
|
profile = ToolsGuiDefaultIconBtnProfile;
|
||||||
|
tooltip = %this.previewData.tooltip;
|
||||||
|
assetBrowser = %this;
|
||||||
|
assetName = %assetName;
|
||||||
|
moduleName = %moduleName;
|
||||||
|
assetType = %assetType;
|
||||||
|
bitmapAsset = %this.previewData.previewImage;
|
||||||
|
Command = %this @ ".updateSelection( $ThisControl.assetName, $ThisControl.moduleName );";
|
||||||
|
altCommand = %doubleClickCommand;
|
||||||
|
text = %this.previewData.assetName;
|
||||||
|
originalAssetName = %this.previewData.assetName;
|
||||||
|
};
|
||||||
|
|
||||||
%previewButton.assetName = %assetName;
|
if(%previewScaleSize == 0 || startsWith(%this.dirHandler.currentAddress, "Creator"))
|
||||||
%previewButton.moduleName = %moduleName;
|
{
|
||||||
%previewButton.assetType = %assetType;
|
%previewButton.iconLocation = "Left";
|
||||||
%previewButton.assetBrowser = %this;
|
%previewButton.textLocation = "Right";
|
||||||
|
%previewButton.setextent(160,34);
|
||||||
|
%previewButton.buttonMargin = "8 8";
|
||||||
|
%previewButton.textMargin = "6";
|
||||||
|
|
||||||
|
%this.previewListMode = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
%size = %previewSize.x * %previewScaleSize;
|
||||||
|
%previewButton.setextent(%size,%size + %textBottomPad);
|
||||||
|
|
||||||
|
%this.previewListMode = false;
|
||||||
|
}
|
||||||
|
|
||||||
%previewButton.setBitmap(%this.previewData.previewImage);
|
|
||||||
|
|
||||||
%previewButton.profile = "AssetBrowserPreview" @ %previewButton.assetType;
|
|
||||||
%previewButton.tooltip = %this.previewData.tooltip;
|
|
||||||
%previewButton.Command = %this @ ".updateSelection( $ThisControl.assetName, $ThisControl.moduleName );";
|
|
||||||
%previewButton.altCommand = %doubleClickCommand;
|
|
||||||
|
|
||||||
%previewButton.text = %this.previewData.assetName;
|
|
||||||
%previewButton.text.originalAssetName = %this.previewData.assetName;
|
|
||||||
|
|
||||||
// add to the gui control array
|
// add to the gui control array
|
||||||
%this-->assetList.add(%previewButton);
|
%this-->assetList.add(%previewButton);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue