Implementation of Nils' UI work for updated theming, functionality and style for the editors suite

This commit is contained in:
Areloch 2023-09-08 22:44:18 -05:00
parent dc1d6e7d9d
commit 33f35d35d4
908 changed files with 15381 additions and 3065 deletions

View file

@ -40,6 +40,7 @@ $guiContent = new GuiMeshRoadEditorCtrl(MeshRoadEditorGui,EditorGuiGroup) {
HoverNodeColor = "255 255 255 255";
new GuiWindowCollapseCtrl(MeshRoadEditorTreeWindow) {
canCollapse = "0";
internalName = "";
canSaveDynamicFields = "0";
Enabled = "1";
@ -47,10 +48,10 @@ $guiContent = new GuiMeshRoadEditorCtrl(MeshRoadEditorGui,EditorGuiGroup) {
Profile = "ToolsGuiWindowProfile";
HorizSizing = "windowRelative";
VertSizing = "windowRelative";
Position = getWord($pref::Video::mode, 0) - 209
SPC getWord(EditorGuiToolbar.extent, 1) - 1;
Extent = "210 167";
MinExtent = "210 100";
Position = getWord($pref::Video::mode, 0) - 360
SPC getWord(EditorGuiToolbar.extent, 1) + 6;
Extent = "360 300";
MinExtent = "300 100";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
@ -63,16 +64,16 @@ $guiContent = new GuiMeshRoadEditorCtrl(MeshRoadEditorGui,EditorGuiGroup) {
AnchorRight = "0";
resizeWidth = "1";
resizeHeight = "1";
canMove = "1";
canMove = "0";
canClose = "0";
canMinimize = "0";
canMaximize = "0";
minSize = "50 50";
closeCommand = "EditorGui.setEditor( WorldEditorInspectorPlugin );";
EdgeSnap = "1";
text = "Mesh Roads";
text = ":: Mesh Road Editor - Roads";
new GuiContainer(){
new GuiContainer(MeshRoadEditorRoadsPanel){
profile = "ToolsGuiDefaultProfile";
Position = "5 25";
Extent = "200 120";
@ -140,8 +141,102 @@ $guiContent = new GuiMeshRoadEditorCtrl(MeshRoadEditorGui,EditorGuiGroup) {
};
};
};
// window / panel buttons
new GuiBitmapButtonCtrl(MeshRoadEditorGui_UnDockBtn) {
canSaveDynamicFields = "0";
internalName = "";
Enabled = "1";
isContainer = "0";
Profile = "ToolsGuiButtonProfile";
HorizSizing = "left";
VertSizing = "bottom";
Position = "330 1";
Extent = "18 18";
MinExtent = "8 8";
canSave = "1";
Visible = "0";
Command = "MeshRoadEditorGui.releaseSidePanel();";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Detach Sidepanel";
hovertime = "1000";
bitmapAsset = "ToolsModule:panel_undock_n_image";
text = "";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
};
new GuiBitmapButtonCtrl(MeshRoadEditorGui_DockBtn) {
canSaveDynamicFields = "0";
internalName = "";
Enabled = "1";
isContainer = "0";
Profile = "ToolsGuiButtonProfile";
HorizSizing = "left";
VertSizing = "bottom";
Position = "330 1";
Extent = "18 18";
MinExtent = "8 8";
canSave = "1";
Visible = "0";
Command = "MeshRoadEditorGui.dockSidePanel();";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Dock Sidepanel";
hovertime = "1000";
bitmapAsset = "ToolsModule:panel_dock_n_image";
text = "";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
};
new GuiBitmapButtonCtrl(MeshRoadEditorGui_HideBtn) {
canSaveDynamicFields = "0";
internalName = "";
Enabled = "1";
isContainer = "0";
Profile = "ToolsGuiButtonProfile";
HorizSizing = "left";
VertSizing = "bottom";
Position = "312 1";
Extent = "18 18";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
Command = "MeshRoadEditorGui.hideSidePanel();";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Hide Sidepanel";
hovertime = "1000";
bitmapAsset = "ToolsModule:panel_hide_n_image";
text = "";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
};
new GuiBitmapButtonCtrl(MeshRoadEditorGui_ShowBtn) {
canSaveDynamicFields = "0";
internalName = "";
Enabled = "1";
isContainer = "0";
Profile = "ToolsGuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "4 1";
Extent = "18 18";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
Command = "MeshRoadEditorGui.showSidePanel();";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Show Sidepanel";
hovertime = "1000";
bitmapAsset = "ToolsModule:panel_show_n_image";
text = "";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
};
};
new GuiWindowCollapseCtrl(MeshRoadEditorOptionsWindow) {
canCollapse = "0";
internalName = "Window";
canSaveDynamicFields = "0";
Enabled = "1";
@ -149,10 +244,10 @@ $guiContent = new GuiMeshRoadEditorCtrl(MeshRoadEditorGui,EditorGuiGroup) {
Profile = "ToolsGuiWindowProfile";
HorizSizing = "windowRelative";
VertSizing = "windowRelative";
Position = getWord($pref::Video::mode, 0) - 209
SPC getWord(EditorGuiToolbar.extent, 1) + getWord(MeshRoadEditorTreeWindow.extent, 1) - 2;
Extent = "210 530";
MinExtent = "210 298";
Position = getWord($pref::Video::mode, 0) - 360
SPC getWord(EditorGuiToolbar.extent, 1) + getWord(MeshRoadEditorTreeWindow.extent, 1) + 6;
Extent = "360" SPC getWord($pref::Video::mode, 1) - getWord(MeshRoadEditorTreeWindow.extent, 1) - getWord(EditorGuiToolbar.extent, 1) - 65;
MinExtent = "300 240";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
@ -165,16 +260,16 @@ $guiContent = new GuiMeshRoadEditorCtrl(MeshRoadEditorGui,EditorGuiGroup) {
AnchorRight = "0";
resizeWidth = "1";
resizeHeight = "1";
canMove = "1";
canMove = "0";
canClose = "0";
canMinimize = "0";
canMaximize = "0";
minSize = "50 50";
closeCommand = "EditorGui.setEditor( WorldEditorPlugin );";
EdgeSnap = "1";
text = "Properties";
text = ":: Mesh Road Editor - Properties";
new GuiContainer(){ //Node Properties
new GuiContainer(MeshRoadNodesPanel){ //Node Properties
isContainer = "1";
Profile = "inspectorStyleRolloutDarkProfile";
HorizSizing = "width";
@ -185,7 +280,7 @@ $guiContent = new GuiMeshRoadEditorCtrl(MeshRoadEditorGui,EditorGuiGroup) {
Margin = "3 3 3 3";
new GuiTextCtrl(){
Profile = "ToolsGuiDefaultProfile";
Profile = "EditorTextProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "5 0";
@ -266,7 +361,7 @@ $guiContent = new GuiMeshRoadEditorCtrl(MeshRoadEditorGui,EditorGuiGroup) {
AltCommand = "MeshRoadEditorGui.editNodeDetails();";
};
};
new GuiContainer(){ //Mesh Road Properties
new GuiContainer(MeshRoadPropertiesPanel){ //Mesh Road Properties
isContainer = "1";
Profile = "inspectorStyleRolloutDarkProfile";
HorizSizing = "width";
@ -277,7 +372,7 @@ $guiContent = new GuiMeshRoadEditorCtrl(MeshRoadEditorGui,EditorGuiGroup) {
Margin = "0 0 3 3";
new GuiTextCtrl(){
Profile = "ToolsGuiDefaultProfile";
Profile = "EditorTextProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "5 0";
@ -285,7 +380,7 @@ $guiContent = new GuiMeshRoadEditorCtrl(MeshRoadEditorGui,EditorGuiGroup) {
text = "Mesh Road Properties";
};
};
new GuiScrollCtrl() {
new GuiScrollCtrl(MeshRoadInspectorPanel) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "1";
@ -336,21 +431,21 @@ $guiContent = new GuiMeshRoadEditorCtrl(MeshRoadEditorGui,EditorGuiGroup) {
dividerMargin = "5";
};
};
new GuiMLTextCtrl(MeshFieldInfoControl) {
new GuiMLTextCtrl(MeshRoadFieldInfoControl) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "GuiInspectorFieldInfoMLTextProfile";
HorizSizing = "width";
VertSizing = "top";
Position = "1 485";
Extent = "202 42";
position = "8" SPC getWord(MeshRoadEditorOptionsWindow.extent, 1) - 40;
Extent = "320 42";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
lineSpacing = "2";
lineSpacing = "1";
allowColorChars = "0";
maxChars = "-1";
useURLMouseCursor = "0";

View file

@ -27,11 +27,275 @@ $MeshRoad::showRoad = true;
$MeshRoad::showRoadProfile = false;
$MeshRoad::breakAngle = 3.0;
// MeshRoadEditorGui Script Methods
//-----------------------------------------------------------------------------
function MeshRoadEditorGui::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 = MeshRoadEditorTreeWindow;
%fluidWindow = MeshRoadEditorOptionsWindow;
%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 MeshRoadEditorTreeWindow::onMouseDragged(%this)
{
%parent = MeshRoadEditorGui;
if(%parent.panelHidden == true)
{
%parent.showSidePanel();
}
if(%parent.resizing == false && %parent.docked == true)
{
%parent.resizing = true;
%parent.maxSize(%this);
}
}
function MeshRoadEditorOptionsWindow::onMouseDragged(%this)
{
%parent = MeshRoadEditorGui;
if(%parent.panelHidden == true)
{
%parent.showSidePanel();
}
if(%parent.resizing == false && %parent.docked == true)
{
%parent.resizing = true;
%parent.maxSize(%this);
}
}
function MeshRoadEditorGui::onResize(%this, %newPosition, %newExtent)
{
// Window to focus on (mostly the fluid window)
%window = MeshRoadEditorOptionsWindow;
if(%window.panelHidden == true)
{
%window.showSidePanel();
}
if(%this.resizing == false && %this.docked == true)
{
// Only resize once
%this.resizing = true;
%this.maxSize(%window);
}
}
function MeshRoadEditorGui::dockSidePanel()
{
%parent = MeshRoadEditorGui;
%fixedWindow = MeshRoadEditorTreeWindow;
%fluidWindow = MeshRoadEditorOptionsWindow;
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";
MeshRoadEditorGui_UnDockBtn.Visible = "1";
MeshRoadEditorGui_DockBtn.Visible = "0";
MeshRoadEditorGui_showBtn.Visible = "0";
MeshRoadEditorGui_hideBtn.Visible = "1";
}
function MeshRoadEditorGui::releaseSidePanel()
{
%parent = MeshRoadEditorGui;
%fixedWindow = MeshRoadEditorTreeWindow;
%fluidWindow = MeshRoadEditorOptionsWindow;
if(%parent.docked == false)
return;
// Unlock the windows so that be moved
%fixedWindow.canCollapse = "1";
%fixedWindow.canMove = "1";
%fluidWindow.canCollapse = "1";
%fluidWindow.canMove = "1";
MeshRoadEditorGui_UnDockBtn.Visible = "0";
MeshRoadEditorGui_DockBtn.Visible = "1";
MeshRoadEditorGui_showBtn.Visible = "0";
MeshRoadEditorGui_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 MeshRoadEditorGui::hideSidePanel()
{
%parent = MeshRoadEditorGui;
%fixedWindow = MeshRoadEditorTreeWindow;
%fluidWindow = MeshRoadEditorOptionsWindow;
MeshRoadEditorGui_showBtn.Visible = "1";
MeshRoadEditorGui_hideBtn.Visible = "0";
// hide the content of the panels
%fixedWindow.titleText = %fixedWindow.text;
%fluidWindow.titleText = %fluidWindow.text;
%fixedWindow.text = "";
MeshRoadEditorRoadsPanel.Visible = "0";
%fluidWindow.text = "";
MeshRoadNodesPanel.Visible = "0";
MeshRoadPropertiesPanel.Visible = "0";
MeshRoadInspectorPanel.Visible = "0";
MeshRoadFieldInfoControl.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 MeshRoadEditorGui::showSidePanel()
{
%parent = MeshRoadEditorGui;
%fixedWindow = MeshRoadEditorTreeWindow;
%fluidWindow = MeshRoadEditorOptionsWindow;
MeshRoadEditorGui_showBtn.Visible = "0";
MeshRoadEditorGui_hideBtn.Visible = "1";
// show the content of the panels
// hide the content of the panels
%fixedWindow.text = %fixedWindow.titleText;
MeshRoadEditorRoadsPanel.Visible = "1";
%fluidWindow.text = %fluidWindow.titleText;
MeshRoadNodesPanel.Visible = "1";
MeshRoadPropertiesPanel.Visible = "1";
MeshRoadInspectorPanel.Visible = "1";
MeshRoadFieldInfoControl.Visible = "1";
%parent.resizing = true;
%parent.maxSize(%fluidWindow);
%parent.panelHidden = false;
}
//------------------------------------------------------------------------------
function MeshRoadEditorGui::onWake( %this )
{
$MeshRoad::EditorOpen = true;
// Maximize windows when set ------------------------------------
%fixedWindow = MeshRoadEditorTreeWindow;
%fluidWindow = MeshRoadEditorOptionsWindow;
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();
}
// --------------------------------------------------------------
%count = EWorldEditor.getSelectionSize();
for ( %i = 0; %i < %count; %i++ )
{
@ -123,7 +387,6 @@ function MeshRoadEditorGui::onNodeSelected( %this, %nodeIdx )
}
}
function MeshRoadEditorGui::onNodeModified( %this, %nodeIdx )
{
MeshRoadEditorOptionsWindow-->position.setValue( %this.getNodePosition() );
@ -134,7 +397,6 @@ function MeshRoadEditorGui::onNodeModified( %this, %nodeIdx )
function MeshRoadEditorGui::editNodeDetails( %this )
{
%this.setNodePosition( MeshRoadEditorOptionsWindow-->position.getText() );
%this.setNodeNormal( MeshRoadEditorOptionsWindow-->rotation.getText() );
%this.setNodeWidth( MeshRoadEditorOptionsWindow-->width.getText() );
@ -172,7 +434,7 @@ function MeshRoadInspector::inspect( %this, %obj )
if ( isObject( %obj ) )
%name = %obj.getName();
else
MeshFieldInfoControl.setText( "" );
MeshRoadFieldInfoControl.setText( "" );
//RiverInspectorNameEdit.setValue( %name );
Parent::inspect( %this, %obj );
@ -186,7 +448,7 @@ function MeshRoadInspector::onInspectorFieldModified( %this, %object, %fieldName
function MeshRoadInspector::onFieldSelected( %this, %fieldName, %fieldTypeStr, %fieldDoc )
{
MeshFieldInfoControl.setText( "<font:Arial Bold:14>" @ %fieldName @ "<font:Arial Italic:14> (" @ %fieldTypeStr @ ") " NL "<font:Arial:14>" @ %fieldDoc );
MeshRoadFieldInfoControl.setText( "<font:" @ $Gui::fontTypeBold @ ":16>" @ %fieldName @ "<font:" @ $Gui::fontTypeItalic @ ":16> (" @ %fieldTypeStr @ ") " NL "<font:" @ $Gui::fontTypeRegular @ ":16>" @ %fieldDoc );
}
function MeshRoadTreeView::onInspect(%this, %obj)