Skip to content
Permalink
Browse files

Initial Editor Setup

There are no editors yet, but this does set up the folder and file structures needed to make the editors. It moves the toys out of a "modules" folder and puts them into a "toybox" folder. It also creates an editor folder which will house the editors and a library folder which will hold reusable modules.
  • Loading branch information...
greenfire27 committed Mar 21, 2019
1 parent 03ef9ca commit 19adc74c7a2a55c6a9fd0685cccf98366b7e7987
Showing 724 changed files with 3,043 additions and 1,507 deletions.
@@ -0,0 +1,56 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2013 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------

function AssetAdmin::create(%this)
{
%this.guiPage = EditorCore.RegisterEditor("Asset Manager", %this);

%this.comingSoon = new GuiControl()
{
Profile = EditorCore.themes.panelProfile;
HorizSizing="center";
VertSizing="center";
Position="412 324";
Extent="200 120";
minExtent="8 8";
Visible="1";
Text = "Coming Soon!";
};
%this.guiPage.add(%this.comingSoon);

EditorCore.FinishRegistration(%this.guiPage);
}

function AssetAdmin::destroy(%this)
{

}

function AssetAdmin::open(%this)
{

}

function AssetAdmin::close(%this)
{

}
@@ -0,0 +1,8 @@
<ModuleDefinition
ModuleId="AssetAdmin"
VersionId="1"
Dependencies="EditorCore=1"
Description="Provides controls to view and edit assets."
ScriptFile="AssetAdmin.cs"
CreateFunction="create"
DestroyFunction="destroy" />
@@ -0,0 +1,130 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2013 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------

function EditorConsole::create(%this)
{
%this.guiPage = EditorCore.RegisterEditor("Console", %this);

%this.consoleEntry = new GuiConsoleEditCtrl()
{
Profile = EditorCore.themes.textEditProfile;
HorizSizing="width";
VertSizing="top";
Position="0 738";
Extent="924 30";
minExtent="120 20";
AltCommand="EditorConsole.eval();";
MaxLength="255";
active = "1";
HistorySize="40";
password="0";
TabComplete="0";
SinkAllKeyEvents="1";
UseSiblingScroller="1";
Text = "Hello World";
};
%this.guiPage.add(%this.consoleEntry);

%this.hideLogButton = new GuiButtonCtrl()
{
Profile = EditorCore.themes.buttonProfile;
Text="Close";
command="EditorCore.close();";
HorizSizing="left";
VertSizing="top";
Position="924 738";
Extent="100 30";
MinExtent="80 20";
};
%this.guiPage.add(%this.hideLogButton);

%this.scroller = new GuiScrollCtrl()
{
Name="ConsoleScrollCtrl";
Profile="ConsoleScrollProfile";
HorizSizing="width";
VertSizing="height";
Position="0 0";
Extent="1024 738";
MinExtent="220 200";
willFirstRespond="1";
hScrollBar="alwaysOn";
vScrollBar="alwaysOn";
constantThumbHeight="0";
childMargin="10 0";
};
%this.guiPage.add(%this.scroller);

%this.consoleLog = new GuiConsole()
{
Profile="GuiConsoleProfile";
Position="0 0";
Extent="1024 738";
HorizSizing="width";
VertSizing="height";
Visible="1";
};
%this.scroller.add(%this.consoleLog);

EditorCore.FinishRegistration(%this.guiPage);
}

function EditorConsole::destroy(%this)
{

}

function EditorConsole::open(%this)
{
%this.scroller.scrollToBottom();
%this.consoleEntry.setFirstResponder();
}

function EditorConsole::close(%this)
{

}

function EditorConsole::eval(%this)
{
%text = trim(%this.consoleEntry.getValue());

if(strpos(%text, "(") == -1)
{
if(strpos(%text, "=") == -1 && strpos(%text, " ") == -1)
{
if(strpos(%text, "{") == -1 && strpos(%text, "}") == -1)
{
%text = %text @ "()";
}
}
}

%pos = strlen(%text) - 1;

if(strpos(%text, ";", %pos) == -1 && strpos(%text, "}") == -1)
%text = %text @ ";";

echo("==>" @ %text);
eval(%text);
%this.consoleEntry.setValue("");
}
@@ -0,0 +1,8 @@
<ModuleDefinition
ModuleId="EditorConsole"
VersionId="1"
Dependencies="EditorCore=1"
Description="Console for the Editor"
ScriptFile="EditorConsole.cs"
CreateFunction="create"
DestroyFunction="destroy" />
@@ -0,0 +1,112 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2013 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------

function EditorCore::create( %this )
{
exec("./Themes/ThemeManager.cs");
exec("./Themes/BaseTheme.cs");
exec("./Themes/LabCoatTheme.cs");
exec("./Themes/ForestRobeTheme.cs");

%this.themes = new ScriptObject()
{
class = "ThemeManager";
};

%this.initGui();

%this.editorKeyMap = new ActionMap();
%this.editorKeyMap.bindCmd( "keyboard", "ctrl tilde", "EditorCore.toggleEditor();", "");
%this.editorKeyMap.push();
}

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

function EditorCore::destroy( %this )
{
}

function EditorCore::initGui(%this)
{
%this.tabBook = new GuiTabBookCtrl()
{
Profile = %this.themes.tabBookProfileTop;
TabProfile = %this.themes.tabProfileTop;
HorizSizing = width;
VertSizing = height;
Position = "0 0";
Extent = "1024 768";
TabPosition = top;
};
}

function EditorCore::toggleEditor(%this)
{
// Is the console awake?
if ( %this.tabBook.isAwake() )
{
// Yes, so deactivate it.
%this.close();
return;
}

// Activate it.
%this.open();
}

function EditorCore::open(%this)
{
if ( $enableDirectInput )
deactivateKeyboard();

Canvas.pushDialog(%this.tabBook);

%this.tabBook.selectPage(0);
EditorConsole.open();
}

function EditorCore::close(%this)
{
if ( $enableDirectInput )
activateKeyboard();
Canvas.popDialog(%this.tabBook);
}

function EditorCore::RegisterEditor(%this, %name, %editor)
{
%this.page[%name] = new GuiTabPageCtrl()
{
Profile = %this.themes.tabPageProfile;
HorizSizing = width;
VertSizing = height;
Position = "0 0";
Extent = "1024 768";
Text = %name;
};

return %this.page[%name];
}

function EditorCore::FinishRegistration(%this, %page)
{
%this.tabBook.add(%page);
}
Oops, something went wrong.

0 comments on commit 19adc74

Please sign in to comment.
You can’t perform that action at this time.