Improves handling of rendering guiPopupCtrls where if the height extent is taller than the bitmap array height, it'll adjust the height to recenter the displayed bitmap elements.

Streamlined the toolbar for the gui and world editors to utilize a stack, making the behavior and manipulation of toolbar elements significantly more consistent.
Added Settings and Asset Browser buttons to both gui and world editor toolbars for easier access.
Moved all tool toolbars over to work with the stack system to make them more consistent and better formatting
Added saving of asset browser's last position and extent so it remembers it on load.
Added editor setting to close the asset browser after completing a drag-n-drop action.
Added keybind to editor keybind list, making space toggle the asset browser
This commit is contained in:
Areloch 2021-09-01 01:12:16 -05:00
parent ef6efbf738
commit 683c438b09
20 changed files with 341 additions and 215 deletions

View file

@ -1,5 +1,3 @@
new SimGroup(AssetBrowserPreviewCache);
//AssetBrowser.addToolbarButton
function AssetBrowser::addToolbarButton(%this)
{
@ -30,11 +28,8 @@ function AssetBrowser::addToolbarButton(%this)
EWToolsToolbar.setExtent((25 + 8) * (ToolsToolbarArray.getCount()) + 12 SPC "33");
}
//
function AssetBrowser::onAdd(%this)
{
}
function AssetBrowser::onWake(%this)
function AssetBrowser::initialize(%this)
{
// manage preview array
if(!isObject(AssetPreviewArray))
@ -65,6 +60,30 @@ function AssetBrowser::onWake(%this)
AssetBrowser-->filterAssetsButton.setActive(true);
}
function AssetBrowser::onAdd(%this)
{
}
function AssetBrowser::onWake(%this)
{
%this.initialize();
}
function AssetBrowser::onDialogPop(%this)
{
%lastPosExt = AssetBrowserWindow.position SPC AssetBrowserWindow.extent;
EditorSettings.setValue("Assets/Browser/LastPosExt", %lastPosExt);
}
function AssetBrowser::restoreLastPosExt(%this)
{
%lastPosExt = EditorSettings.value("Assets/Browser/LastPosExt", "");
if(%lastPosExt !$= "")
{
AssetBrowserWindow.resize(getWord(%lastPosExt, 0), getWord(%lastPosExt, 1), getWord(%lastPosExt, 2), getWord(%lastPosExt, 3));
}
}
function contentTreeTabBook::onTabSelected(%this, %tabText, %tabIndex)
{
if(%tabText $= "Content")
@ -271,6 +290,7 @@ function AssetBrowser::showDialog( %this, %AssetTypeFilter, %selectCallback, %ta
Canvas.popDialog(AssetBrowser);
Canvas.pushDialog(AssetBrowser);
AssetBrowser.setVisible(1);
AssetBrowserWindow.setVisible(1);
AssetBrowserWindow.selectWindow();
@ -299,6 +319,8 @@ function AssetBrowser::showDialog( %this, %AssetTypeFilter, %selectCallback, %ta
}
AssetBrowser.loadDirectories();
AssetBrowser.restoreLastPosExt();
}
function AssetBrowser::hideDialog( %this )
@ -311,6 +333,18 @@ function AssetBrowser::hideDialog( %this )
Canvas.popDialog(AssetBrowser);
}
function AssetBrowser::toggleDialog( %this )
{
if(AssetBrowser.isAwake())
{
AssetBrowser.hideDialog();
}
else
{
AssetBrowser.showDialog();
}
}
function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName )
{
if(!isObject(%this.previewData))
@ -2402,6 +2436,11 @@ function EWorldEditor::onControlDropped( %this, %payload, %position )
%buildCommand = AssetBrowser @ ".on" @ %assetType @ "EditorDropped(" @ %assetDef @ ",\"" @ %position @ "\");";
}
eval(%buildCommand);
if(EditorSettings.value("AssetManagement/Assets/closeBrowserOnDragAction", false))
{
AssetBrowser.hideDialog();
}
}
EWorldEditor.isDirty = true;