Skip to content

Commit

Permalink
4.x UI makeover TorqueGameEngines#8: Scripts & GUI changes
Browse files Browse the repository at this point in the history
  • Loading branch information
StudioDimSum committed Dec 6, 2022
1 parent 64f2120 commit d7cb7fe
Show file tree
Hide file tree
Showing 10 changed files with 554 additions and 23 deletions.
4 changes: 2 additions & 2 deletions Templates/BaseGame/game/tools/VPathEditor/GUI/VPathEditor.gui
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ new VPathEditor(EVPathEditor) {
Profile = "GuiButtonProfile";
HorizSizing = "left";
VertSizing = "bottom";
position = "193 4";
position = "339 4";
Extent = "16 16";
MinExtent = "8 2";
canSave = "1";
Expand All @@ -171,7 +171,7 @@ new VPathEditor(EVPathEditor) {
Profile = "GuiButtonProfile";
HorizSizing = "left";
VertSizing = "bottom";
position = "176 3";
position = "322 3";
Extent = "17 17";
MinExtent = "8 2";
canSave = "1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ function DecalEditorGui::showSidePanel()
DecalEditorGui_hideBtn.Visible = "1";

// show the content of the panels
// hide the content of the panels
%fixedWindow.text = %fixedWindow.titleText;
DecalEditorTabBook.Visible = "1";

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="mission_file_image"
imageFile="@assetFile=mission_file.png"
UseMips="true"
isHDRImage="false"
imageType="Albedo" />
101 changes: 97 additions & 4 deletions Templates/BaseGame/game/tools/riverEditor/RiverEditorGui.gui
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ $guiContent = new GuiRiverEditorCtrl(RiverEditorGui, EditorGuiGroup) {
};

*/
new GuiContainer(){
new GuiContainer(RiverEditorTreeWPanel){
profile = "ToolsGuiDefaultProfile";
Position = "5 25";
Extent = "200 120";
Expand Down Expand Up @@ -191,6 +191,99 @@ $guiContent = new GuiRiverEditorCtrl(RiverEditorGui, EditorGuiGroup) {
};
};
};
// window / panel buttons
new GuiBitmapButtonCtrl(RiverEditorGui_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 = "RiverEditorGui.releaseSidePanel();";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Detach Sidepanel";
hovertime = "1000";
bitmapAsset = "ToolsModule:panel_undock_n_image";
text = "";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
};
new GuiBitmapButtonCtrl(RiverEditorGui_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 = "RiverEditorGui.dockSidePanel();";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Dock Sidepanel";
hovertime = "1000";
bitmapAsset = "ToolsModule:panel_dock_n_image";
text = "";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
};
new GuiBitmapButtonCtrl(RiverEditorGui_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 = "RiverEditorGui.hideSidePanel();";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Hide Sidepanel";
hovertime = "1000";
bitmapAsset = "ToolsModule:panel_hide_n_image";
text = "";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
};
new GuiBitmapButtonCtrl(RiverEditorGui_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 = "RiverEditorGui.showSidePanel();";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Show Sidepanel";
hovertime = "1000";
bitmapAsset = "ToolsModule:panel_show_n_image";
text = "";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
};
};
new GuiWindowCollapseCtrl(RiverEditorOptionsWindow) {
canCollapse = "0";
Expand Down Expand Up @@ -225,7 +318,7 @@ $guiContent = new GuiRiverEditorCtrl(RiverEditorGui, EditorGuiGroup) {
EdgeSnap = "1";
text = ":: River Editor - Properties";

new GuiContainer(){ //Node Properties
new GuiContainer(RiverEditorOptionsPanel){ //Node Properties
isContainer = "1";
Profile = "inspectorStyleRolloutDarkProfile";
HorizSizing = "width";
Expand Down Expand Up @@ -317,7 +410,7 @@ $guiContent = new GuiRiverEditorCtrl(RiverEditorGui, EditorGuiGroup) {
AltCommand = "RiverEditorGui.editNodeDetails();";
};
};
new GuiContainer(){ //River Properties
new GuiContainer(RiverEditorPropPanel){ //River Properties
isContainer = "1";
Profile = "inspectorStyleRolloutDarkProfile";
HorizSizing = "width";
Expand All @@ -337,7 +430,7 @@ $guiContent = new GuiRiverEditorCtrl(RiverEditorGui, EditorGuiGroup) {
};
};

new GuiScrollCtrl() {
new GuiScrollCtrl(RiverEditorPropScroll) {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "1";
Expand Down
167 changes: 162 additions & 5 deletions Templates/BaseGame/game/tools/riverEditor/riverEditorGui.tscript
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,29 @@ $River::showWalls = true;

//-----------------------------------------------------------------------------

function RiverEditorGui::onWake(%this)
{
%fixedWindow = RiverEditorTreeWindow;
%fluidWindow = RiverEditorOptionsWindow;

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 RiverEditorGui::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)
Expand Down Expand Up @@ -68,7 +89,12 @@ function RiverEditorTreeWindow::onMouseDragged(%this)
{
%parent = RiverEditorGui;

if(%parent.resizing == false)
if(%parent.panelHidden == true)
{
%parent.showSidePanel();
}

if(%parent.resizing == false && %parent.docked == true)
{
%parent.resizing = true;
%parent.maxSize(%this);
Expand All @@ -79,7 +105,12 @@ function RiverEditorOptionsWindow::onMouseDragged(%this)
{
%parent = RiverEditorGui;

if(%parent.resizing == false)
if(%parent.panelHidden == true)
{
%parent.showSidePanel();
}

if(%parent.resizing == false && %parent.docked == true)
{
%parent.resizing = true;
%parent.maxSize(%this);
Expand All @@ -91,14 +122,140 @@ function RiverEditorGui::onResize(%this, %newPosition, %newExtent)
// Window to focus on (mostly the fluid window)
%window = RiverEditorOptionsWindow;

if(%this.resizing == false)
if(%window.panelHidden == true)
{
%window.showSidePanel();
}

if(%this.resizing == false && EWorldEditor.docked == true)
{
// Only resize once
%this.resizing = true;
%this.maxSize(%window);
}
}

function RiverEditorGui::dockSidePanel()
{
%parent = RiverEditorGui;
%fixedWindow = RiverEditorTreeWindow;
%fluidWindow = RiverEditorOptionsWindow;

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";

RiverEditorGui_UnDockBtn.Visible = "1";
RiverEditorGui_DockBtn.Visible = "0";

RiverEditorGui_showBtn.Visible = "0";
RiverEditorGui_hideBtn.Visible = "1";
}

function RiverEditorGui::releaseSidePanel()
{
%parent = RiverEditorGui;
%fixedWindow = RiverEditorTreeWindow;
%fluidWindow = RiverEditorOptionsWindow;

if(%parent.docked == false)
return;

// Unlock the windows so that be moved
%fixedWindow.canCollapse = "1";
%fixedWindow.canMove = "1";

%fluidWindow.canCollapse = "1";
%fluidWindow.canMove = "1";

RiverEditorGui_UnDockBtn.Visible = "0";
RiverEditorGui_DockBtn.Visible = "1";

RiverEditorGui_showBtn.Visible = "0";
RiverEditorGui_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 RiverEditorGui::hideSidePanel()
{
%parent = RiverEditorGui;
%fixedWindow = RiverEditorTreeWindow;
%fluidWindow = RiverEditorOptionsWindow;

RiverEditorGui_showBtn.Visible = "1";
RiverEditorGui_hideBtn.Visible = "0";

// hide the content of the panels
%fixedWindow.titleText = %fixedWindow.text;
%fluidWindow.titleText = %fluidWindow.text;

%fixedWindow.text = "";
RiverEditorTreeWPanel.Visible = "0";

%fluidWindow.text = "";
RiverEditorOptionsPanel.Visible = "0";
RiverEditorPropPanel.Visible = "0";
RiverEditorPropScroll.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 RiverEditorGui::showSidePanel()
{
%parent = RiverEditorGui;
%fixedWindow = RiverEditorTreeWindow;
%fluidWindow = RiverEditorOptionsWindow;

RiverEditorGui_showBtn.Visible = "0";
RiverEditorGui_hideBtn.Visible = "1";

// show the content of the panels
// hide the content of the panels
%fixedWindow.text = %fixedWindow.titleText;
RiverEditorTreeWPanel.Visible = "1";

%fluidWindow.text = %fluidWindow.titleText;
RiverEditorOptionsPanel.Visible = "1";
RiverEditorPropPanel.Visible = "1";
RiverEditorPropScroll.Visible = "1";

%parent.resizing = true;
%parent.maxSize(%fluidWindow);

FieldInfoControl.position = 5 SPC EWInspectorWindow.extent.y - 40;
%parent.panelHidden = false;
}

//-----------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit d7cb7fe

Please sign in to comment.