mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-05 21:40:31 +00:00
Implementation of Nils' UI work for updated theming, functionality and style for the editors suite
This commit is contained in:
parent
dc1d6e7d9d
commit
33f35d35d4
908 changed files with 15381 additions and 3065 deletions
|
|
@ -21,6 +21,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Material Editor originally created by Dave Calabrese and Travis Vroman of Gaslight Studios
|
||||
|
||||
$MaterialEditor::emptyMaterialImage = "ToolsModule:unknownImage_image";
|
||||
|
||||
function MaterialEditorGui::establishMaterials(%this)
|
||||
|
|
@ -249,6 +250,266 @@ function MaterialEditorGui::selectMaterialAsset(%this, %assetId)
|
|||
AssetBrowser.editAsset(%assetId);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function MaterialEditorGui::onWake(%this)
|
||||
{
|
||||
%fixedWindow = MaterialEditorPreviewWindow;
|
||||
%fluidWindow = MaterialEditorPropertiesWindow;
|
||||
|
||||
if(EditorSettings.value( "WorldEditor/forceSidebarToSide" ) == 1)
|
||||
{
|
||||
// Let's dock the side panel to the right side
|
||||
%this.docked = false;
|
||||
%this.resizing = true;
|
||||
%this.dockSidePanel();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Let's release the side panel so it can be moved
|
||||
%this.docked = true;
|
||||
%this.resizing = false;
|
||||
%this.releaseSidePanel();
|
||||
}
|
||||
}
|
||||
|
||||
function MaterialEditorGui::maxSize(%this, %window)
|
||||
{
|
||||
// Resize the windows to the max height
|
||||
// and force these to the right side if set
|
||||
if(EditorSettings.value( "WorldEditor/forceSidebarToSide" ) == 1 && %this.resizing == true)
|
||||
{
|
||||
// prevent onResize after a resize
|
||||
%this.resizing = false;
|
||||
|
||||
%fixedWindow = MaterialEditorPreviewWindow;
|
||||
%fluidWindow = MaterialEditorPropertiesWindow;
|
||||
%top = EditorGuiToolbar.extent.y + 6;
|
||||
%bottom = %top + 65 - 6;
|
||||
%maxHeight = Canvas.extent.y - %top - %bottom;
|
||||
|
||||
// --- Fixed window (top) ------------------------------------------------
|
||||
// put it back if it moved
|
||||
%fixedWindow.position.x = Canvas.extent.x - %fixedWindow.extent.x;
|
||||
%fixedWindow.position.y = %top;
|
||||
|
||||
// don't go beyond the canvas
|
||||
if(%fixedWindow.extent.y > %maxHeight)
|
||||
%fixedWindow.extent.y = %maxHeight - %fluidWindow.extent.y;
|
||||
|
||||
%position = %fixedWindow.position.x SPC %fixedWindow.position.y;
|
||||
%extent = %window.extent.x SPC %fixedWindow.extent.y;
|
||||
%fixedWindow.resize(%position.x, %position.y, %extent.x, %extent.y);
|
||||
|
||||
// --- Fluid window (bottom) ---------------------------------------------
|
||||
// position is relative to the top window
|
||||
%position = %fixedWindow.position.x SPC %fixedWindow.extent.y + %top;
|
||||
%extent = %window.extent.x SPC Canvas.extent.y - %fixedWindow.extent.y - %bottom;
|
||||
%fluidWindow.resize(%position.x, %position.y, %extent.x, %extent.y);
|
||||
|
||||
// --- AssetBrowser window ----------------------------------------------
|
||||
if(isObject(AssetBrowserWindow))
|
||||
{
|
||||
// Only resize the AssetBrowser if it's docked
|
||||
if(AssetBrowserWindow.docked == true)
|
||||
{
|
||||
// The width is relative to the sidepanel
|
||||
%browserWidth = Canvas.extent.x - %extent.x;
|
||||
%browserHeight = AssetBrowserWindow.extent.y;
|
||||
%browserPosY = Canvas.extent.y - AssetBrowserWindow.extent.y - 33;
|
||||
AssetBrowserWindow.resize(0, %browserPosY, %browserWidth, %browserHeight);
|
||||
}
|
||||
}
|
||||
// --- Windowed Console --------------------------------------------------
|
||||
if(isObject(windowConsoleControl))
|
||||
{
|
||||
// Only resize the AssetBrowser if it's docked
|
||||
if(windowConsoleControl.docked == true)
|
||||
{
|
||||
// The width is relative to the sidepanel
|
||||
%consoleWidth = Canvas.extent.x - %extent.x;
|
||||
%consoleHeight = windowConsoleControl.extent.y;
|
||||
%consolePosY = Canvas.extent.y - windowConsoleControl.extent.y - 33;
|
||||
windowConsoleControl.resize(0, %consolePosY, %consoleWidth, %consoleHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function MaterialEditorPreviewWindow::onMouseDragged(%this)
|
||||
{
|
||||
%parent = MaterialEditorGui;
|
||||
|
||||
if(%parent.panelHidden == true)
|
||||
{
|
||||
%parent.showSidePanel();
|
||||
}
|
||||
|
||||
if(%parent.resizing == false && %parent.docked == true)
|
||||
{
|
||||
%parent.resizing = true;
|
||||
%parent.maxSize(%this);
|
||||
}
|
||||
}
|
||||
|
||||
function MaterialEditorPropertiesWindow::onMouseDragged(%this)
|
||||
{
|
||||
%parent = MaterialEditorGui;
|
||||
|
||||
if(%parent.panelHidden == true)
|
||||
{
|
||||
%parent.showSidePanel();
|
||||
}
|
||||
|
||||
if(%parent.resizing == false && %parent.docked == true)
|
||||
{
|
||||
%parent.resizing = true;
|
||||
%parent.maxSize(%this);
|
||||
}
|
||||
}
|
||||
|
||||
function MaterialEditorGui::onResize(%this, %newPosition, %newExtent)
|
||||
{
|
||||
// Window to focus on (mostly the fluid window)
|
||||
%window = MaterialEditorPreviewWindow;
|
||||
|
||||
if(%window.panelHidden == true)
|
||||
{
|
||||
%window.showSidePanel();
|
||||
}
|
||||
|
||||
if(%this.resizing == false && %this.docked == true)
|
||||
{
|
||||
// Only resize once
|
||||
%this.resizing = true;
|
||||
%this.maxSize(%window);
|
||||
}
|
||||
}
|
||||
|
||||
function MaterialEditorGui::dockSidePanel()
|
||||
{
|
||||
%parent = MaterialEditorGui;
|
||||
%fixedWindow = MaterialEditorPreviewWindow;
|
||||
%fluidWindow = MaterialEditorPropertiesWindow;
|
||||
|
||||
if(%parent.docked == true)
|
||||
return;
|
||||
|
||||
// Move and resize the window(s)
|
||||
%parent.resizing = true;
|
||||
%parent.maxSize(%fluidWindow);
|
||||
|
||||
%parent.docked = true;
|
||||
%fluidWindow.onMouseDragged();
|
||||
|
||||
// Lock the windows in place
|
||||
%fixedWindow.canCollapse = "0";
|
||||
%fixedWindow.canMove = "0";
|
||||
|
||||
%fluidWindow.canCollapse = "0";
|
||||
%fluidWindow.canMove = "0";
|
||||
|
||||
MaterialEditorGui_UnDockBtn.Visible = "1";
|
||||
MaterialEditorGui_DockBtn.Visible = "0";
|
||||
|
||||
MaterialEditorGui_showBtn.Visible = "0";
|
||||
MaterialEditorGui_hideBtn.Visible = "1";
|
||||
}
|
||||
|
||||
function MaterialEditorGui::releaseSidePanel()
|
||||
{
|
||||
%parent = MaterialEditorGui;
|
||||
%fixedWindow = MaterialEditorPreviewWindow;
|
||||
%fluidWindow = MaterialEditorPropertiesWindow;
|
||||
|
||||
if(%parent.docked == false)
|
||||
return;
|
||||
|
||||
// Unlock the windows so that be moved
|
||||
%fixedWindow.canCollapse = "1";
|
||||
%fixedWindow.canMove = "1";
|
||||
|
||||
%fluidWindow.canCollapse = "1";
|
||||
%fluidWindow.canMove = "1";
|
||||
|
||||
MaterialEditorGui_UnDockBtn.Visible = "0";
|
||||
MaterialEditorGui_DockBtn.Visible = "1";
|
||||
|
||||
MaterialEditorGui_showBtn.Visible = "0";
|
||||
MaterialEditorGui_hideBtn.Visible = "0";
|
||||
|
||||
// Let's do a small resize so it's visually clear we're undocking
|
||||
%position = %fixedWindow.position.x - 6 SPC %fixedWindow.position.y + 6;
|
||||
%extent = %fixedWindow.extent.x SPC %fixedWindow.extent.y;
|
||||
%fixedWindow.resize(%position.x, %position.y, %extent.x, %extent.y);
|
||||
|
||||
%position = %fluidWindow.position.x - 6 SPC %fluidWindow.position.y + 6;
|
||||
%extent = %fluidWindow.extent.x SPC %fluidWindow.extent.y - 12;
|
||||
%fluidWindow.resize(%position.x, %position.y, %extent.x, %extent.y);
|
||||
|
||||
%parent.docked = false;
|
||||
%parent.resizing = false;
|
||||
}
|
||||
|
||||
function MaterialEditorGui::hideSidePanel()
|
||||
{
|
||||
%parent = MaterialEditorGui;
|
||||
%fixedWindow = MaterialEditorPreviewWindow;
|
||||
%fluidWindow = MaterialEditorPropertiesWindow;
|
||||
|
||||
MaterialEditorGui_showBtn.Visible = "1";
|
||||
MaterialEditorGui_hideBtn.Visible = "0";
|
||||
|
||||
// hide the content of the panels
|
||||
%fixedWindow.titleText = %fixedWindow.text;
|
||||
%fluidWindow.titleText = %fluidWindow.text;
|
||||
|
||||
%fixedWindow.text = "";
|
||||
matEd_previewPanel.Visible = "0";
|
||||
matEd_quickPreview_Popup.Visible = "0";
|
||||
|
||||
%fluidWindow.text = "";
|
||||
MaterialEditorGuiContent.Visible = "0";
|
||||
|
||||
// Let's do a resize so that the panel is collapsed to the side
|
||||
%position = Canvas.extent.x - 24 SPC %fixedWindow.position.y;
|
||||
%extent = %fixedWindow.extent.x SPC %fixedWindow.extent.y;
|
||||
%fixedWindow.resize(%position.x, %position.y, %extent.x, %extent.y);
|
||||
|
||||
%position = Canvas.extent.x - 24 SPC %fluidWindow.position.y;
|
||||
%extent = %fluidWindow.extent.x SPC %fluidWindow.extent.y;
|
||||
%fluidWindow.resize(%position.x, %position.y, %extent.x, %extent.y);
|
||||
|
||||
%parent.panelHidden = true;
|
||||
}
|
||||
|
||||
function MaterialEditorGui::showSidePanel()
|
||||
{
|
||||
%parent = MaterialEditorGui;
|
||||
%fixedWindow = MaterialEditorPreviewWindow;
|
||||
%fluidWindow = MaterialEditorPropertiesWindow;
|
||||
|
||||
MaterialEditorGui_showBtn.Visible = "0";
|
||||
MaterialEditorGui_hideBtn.Visible = "1";
|
||||
|
||||
// show the content of the panels
|
||||
// hide the content of the panels
|
||||
%fixedWindow.text = %fixedWindow.titleText;
|
||||
matEd_previewPanel.Visible = "1";
|
||||
matEd_quickPreview_Popup.Visible = "1";
|
||||
|
||||
%fluidWindow.text = %fluidWindow.titleText;
|
||||
MaterialEditorGuiContent.Visible = "1";
|
||||
|
||||
%parent.resizing = true;
|
||||
%parent.maxSize(%fluidWindow);
|
||||
|
||||
%parent.panelHidden = false;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// SubMaterial(Material Target) -- Supports different ways to grab the
|
||||
// material from the dropdown list. We're here either because-
|
||||
|
|
@ -522,8 +783,8 @@ function MaterialEditorGui::isMatEditorMaterial(%this, %material)
|
|||
|
||||
function MaterialEditorGui::setMaterialNotDirty(%this)
|
||||
{
|
||||
%propertyText = "Material Properties";
|
||||
%previewText = "Material Preview";
|
||||
%propertyText = ":: Material Editor - Properties";
|
||||
%previewText = ":: Material Editor - Preview";
|
||||
MaterialEditorPropertiesWindow.text = %propertyText;
|
||||
MaterialEditorPreviewWindow.text = %previewText;
|
||||
|
||||
|
|
@ -533,8 +794,8 @@ function MaterialEditorGui::setMaterialNotDirty(%this)
|
|||
|
||||
function MaterialEditorGui::setMaterialDirty(%this)
|
||||
{
|
||||
%propertyText = "Material Properties *";
|
||||
%previewText = "Material Preview *";
|
||||
%propertyText = ":: Material Editor - Properties *";
|
||||
%previewText = ":: Material Editor - Preview *";
|
||||
MaterialEditorPropertiesWindow.text = %propertyText;
|
||||
MaterialEditorPreviewWindow.text = %previewText;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue