mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 23:24:41 +00:00
Merge pull request #1339 from Areloch/Remove_Demo_Mode_Checks
Remove demo and trial checks
This commit is contained in:
commit
d268199f4f
25 changed files with 355 additions and 846 deletions
|
|
@ -55,10 +55,6 @@ bool GameTSCtrl::onAdd()
|
||||||
if ( !Parent::onAdd() )
|
if ( !Parent::onAdd() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_WATERMARK
|
|
||||||
mWatermark.init();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -172,10 +168,6 @@ void GameTSCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
|
|
||||||
if(!skipRender || true)
|
if(!skipRender || true)
|
||||||
Parent::onRender(offset, updateRect);
|
Parent::onRender(offset, updateRect);
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_WATERMARK
|
|
||||||
mWatermark.render(getExtent());
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -30,12 +30,6 @@
|
||||||
#include "gui/3d/guiTSControl.h"
|
#include "gui/3d/guiTSControl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_WATERMARK
|
|
||||||
#ifndef _WATERMARK_H_
|
|
||||||
#include "demo/watermark/watermark.h"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class ProjectileData;
|
class ProjectileData;
|
||||||
class GameBase;
|
class GameBase;
|
||||||
|
|
||||||
|
|
@ -45,10 +39,6 @@ class GameTSCtrl : public GuiTSCtrl
|
||||||
private:
|
private:
|
||||||
typedef GuiTSCtrl Parent;
|
typedef GuiTSCtrl Parent;
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_WATERMARK
|
|
||||||
Watermark mWatermark;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void makeScriptCall(const char *func, const GuiEvent &evt) const;
|
void makeScriptCall(const char *func, const GuiEvent &evt) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -61,10 +61,6 @@
|
||||||
// For the TickMs define... fix this for T2D...
|
// For the TickMs define... fix this for T2D...
|
||||||
#include "T3D/gameBase/processList.h"
|
#include "T3D/gameBase/processList.h"
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
#include "demo/pestTimer/pestTimer.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TORQUE_ENABLE_VFS
|
#ifdef TORQUE_ENABLE_VFS
|
||||||
#include "platform/platformVFS.h"
|
#include "platform/platformVFS.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -309,10 +305,6 @@ void StandardMainLoop::init()
|
||||||
// Hook in for UDP notification
|
// Hook in for UDP notification
|
||||||
Net::smPacketReceive.notify(GNet, &NetInterface::processPacketReceiveEvent);
|
Net::smPacketReceive.notify(GNet, &NetInterface::processPacketReceiveEvent);
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
PestTimerinit();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TORQUE_DEBUG_GUARD
|
#ifdef TORQUE_DEBUG_GUARD
|
||||||
Memory::flagCurrentAllocs( Memory::FLAG_Static );
|
Memory::flagCurrentAllocs( Memory::FLAG_Static );
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -613,11 +605,6 @@ bool StandardMainLoop::doMainLoop()
|
||||||
ThreadPool::processMainThreadWorkItems();
|
ThreadPool::processMainThreadWorkItems();
|
||||||
Sampler::endFrame();
|
Sampler::endFrame();
|
||||||
PROFILE_END_NAMED(MainLoop);
|
PROFILE_END_NAMED(MainLoop);
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
CheckTimer();
|
|
||||||
CheckBlocker();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return keepRunning;
|
return keepRunning;
|
||||||
|
|
|
||||||
|
|
@ -139,22 +139,4 @@ DefineConsoleFunction( getBuildString, const char*, (), , "Get the type of build
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleFunctionGroupEnd( CompileInformation );
|
ConsoleFunctionGroupEnd( CompileInformation );
|
||||||
|
|
||||||
DefineConsoleFunction( isDemo, bool, (), , "")
|
|
||||||
{
|
|
||||||
#ifdef TORQUE_DEMO
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
DefineConsoleFunction( isWebDemo, bool, (), , "")
|
|
||||||
{
|
|
||||||
#ifdef TORQUE_DEMO
|
|
||||||
return Platform::getWebDeployment();
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
@ -34,10 +34,6 @@
|
||||||
#include "core/util/journal/journal.h"
|
#include "core/util/journal/journal.h"
|
||||||
#include "core/util/uuid.h"
|
#include "core/util/uuid.h"
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
#include "gui/core/guiCanvas.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// This is a temporary hack to get tools using the library to
|
// This is a temporary hack to get tools using the library to
|
||||||
// link in this module which contains no other references.
|
// link in this module which contains no other references.
|
||||||
bool LinkConsoleFunctions = false;
|
bool LinkConsoleFunctions = false;
|
||||||
|
|
|
||||||
|
|
@ -144,23 +144,12 @@ GuiCanvas::GuiCanvas(): GuiControl(),
|
||||||
#else
|
#else
|
||||||
mNumFences = 0;
|
mNumFences = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
mPurchaseScreen = NULL;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiCanvas::~GuiCanvas()
|
GuiCanvas::~GuiCanvas()
|
||||||
{
|
{
|
||||||
SAFE_DELETE(mPlatformWindow);
|
SAFE_DELETE(mPlatformWindow);
|
||||||
SAFE_DELETE_ARRAY( mFences );
|
SAFE_DELETE_ARRAY( mFences );
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
// if (mPurchaseScreen)
|
|
||||||
// {
|
|
||||||
// SAFE_DELETE(mPurchaseScreen);
|
|
||||||
// }
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
@ -282,13 +271,6 @@ bool GuiCanvas::onAdd()
|
||||||
// Define the menu bar for this canvas (if any)
|
// Define the menu bar for this canvas (if any)
|
||||||
Con::executef(this, "onCreateMenu");
|
Con::executef(this, "onCreateMenu");
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
mPurchaseScreen = new PurchaseScreen;
|
|
||||||
mPurchaseScreen->init();
|
|
||||||
|
|
||||||
mLastPurchaseHideTime = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Sim::findObject("PlatformGenericMenubar", mMenuBarCtrl);
|
Sim::findObject("PlatformGenericMenubar", mMenuBarCtrl);
|
||||||
|
|
||||||
return parentRet;
|
return parentRet;
|
||||||
|
|
@ -296,11 +278,6 @@ bool GuiCanvas::onAdd()
|
||||||
|
|
||||||
void GuiCanvas::onRemove()
|
void GuiCanvas::onRemove()
|
||||||
{
|
{
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
if (mPurchaseScreen && mPurchaseScreen->isAwake())
|
|
||||||
removeObject(mPurchaseScreen);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// And the process list
|
// And the process list
|
||||||
Process::remove(this, &GuiCanvas::paint);
|
Process::remove(this, &GuiCanvas::paint);
|
||||||
|
|
||||||
|
|
@ -1362,11 +1339,6 @@ bool GuiCanvas::rootMouseWheelDown(const GuiEvent &event)
|
||||||
|
|
||||||
void GuiCanvas::setContentControl(GuiControl *gui)
|
void GuiCanvas::setContentControl(GuiControl *gui)
|
||||||
{
|
{
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
if (mPurchaseScreen->isForceExit())
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Skip out if we got passed NULL (why would that happen?)
|
// Skip out if we got passed NULL (why would that happen?)
|
||||||
if(!gui)
|
if(!gui)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1435,11 +1407,6 @@ GuiControl *GuiCanvas::getContentControl()
|
||||||
|
|
||||||
void GuiCanvas::pushDialogControl(GuiControl *gui, S32 layer, bool center)
|
void GuiCanvas::pushDialogControl(GuiControl *gui, S32 layer, bool center)
|
||||||
{
|
{
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
if (mPurchaseScreen->isForceExit())
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( center )
|
if( center )
|
||||||
gui->setPosition( getExtent().x / 2 - gui->getExtent().x / 2,
|
gui->setPosition( getExtent().x / 2 - gui->getExtent().x / 2,
|
||||||
getExtent().y / 2 - gui->getExtent().y / 2 );
|
getExtent().y / 2 - gui->getExtent().y / 2 );
|
||||||
|
|
@ -1956,10 +1923,6 @@ void GuiCanvas::renderFrame(bool preRenderOnly, bool bufferSwap /* = true */)
|
||||||
// this situation is necessary because it needs to take the screenshot
|
// this situation is necessary because it needs to take the screenshot
|
||||||
// before the buffers swap
|
// before the buffers swap
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_TIMEOUT
|
|
||||||
checkTimeOut();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PROFILE_END();
|
PROFILE_END();
|
||||||
|
|
||||||
// Fence logic here, because this is where endScene is called.
|
// Fence logic here, because this is where endScene is called.
|
||||||
|
|
|
||||||
|
|
@ -37,12 +37,6 @@
|
||||||
#include "windowManager/platformWindowMgr.h"
|
#include "windowManager/platformWindowMgr.h"
|
||||||
#include "gfx/gfxFence.h"
|
#include "gfx/gfxFence.h"
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
#ifndef _PURCHASESCREEN_H_
|
|
||||||
#include "demo/purchase/purchaseScreen.h"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// A canvas on which rendering occurs.
|
/// A canvas on which rendering occurs.
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
|
@ -442,21 +436,6 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const U32 MAX_GAMEPADS = 4; ///< The maximum number of supported gamepads
|
static const U32 MAX_GAMEPADS = 4; ///< The maximum number of supported gamepads
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
private:
|
|
||||||
PurchaseScreen* mPurchaseScreen;
|
|
||||||
U32 mLastPurchaseHideTime;
|
|
||||||
|
|
||||||
public:
|
|
||||||
void showPurchaseScreen(bool show, bool startBlocker, const char* location, bool doExit);
|
|
||||||
void updatePurchaseScreen(const char* value);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_TIMEOUT
|
|
||||||
private:
|
|
||||||
void checkTimeOut();
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,3 @@ exec("./guiObjectInspector.ed.cs");
|
||||||
exec("./uvEditor.ed.gui");
|
exec("./uvEditor.ed.gui");
|
||||||
exec("./objectSelection.ed.cs");
|
exec("./objectSelection.ed.cs");
|
||||||
exec("./guiPlatformGenericMenubar.ed.cs");
|
exec("./guiPlatformGenericMenubar.ed.cs");
|
||||||
|
|
||||||
if (isDemo())
|
|
||||||
exec("./messageBoxOKBuy.ed.gui");
|
|
||||||
|
|
|
||||||
|
|
@ -1,85 +0,0 @@
|
||||||
//--- OBJECT WRITE BEGIN ---
|
|
||||||
%guiContent = new GuiControl(MessageBoxOKBuyDlg) {
|
|
||||||
profile = "ToolsGuiDefaultProfile";
|
|
||||||
horizSizing = "width";
|
|
||||||
vertSizing = "height";
|
|
||||||
position = "0 0";
|
|
||||||
extent = "640 480";
|
|
||||||
minExtent = "8 8";
|
|
||||||
visible = "1";
|
|
||||||
helpTag = "0";
|
|
||||||
|
|
||||||
new GuiWindowCtrl(MBOKBuyFrame) {
|
|
||||||
profile = "ToolsGuiWindowProfile";
|
|
||||||
horizSizing = "center";
|
|
||||||
vertSizing = "center";
|
|
||||||
position = "170 175";
|
|
||||||
extent = "300 100";
|
|
||||||
minExtent = "48 92";
|
|
||||||
visible = "1";
|
|
||||||
helpTag = "0";
|
|
||||||
maxLength = "255";
|
|
||||||
resizeWidth = "1";
|
|
||||||
resizeHeight = "1";
|
|
||||||
canMove = "1";
|
|
||||||
canClose = "1";
|
|
||||||
canMinimize = "0";
|
|
||||||
canMaximize = "0";
|
|
||||||
minSize = "50 50";
|
|
||||||
text = "";
|
|
||||||
closeCommand = "MessageCallback(MessageBoxOKBuyDlg,MessageBoxOKBuyDlg.noCallback);";
|
|
||||||
|
|
||||||
new GuiMLTextCtrl(MBOKBuyText) {
|
|
||||||
profile = "ToolsGuiMLTextProfile";
|
|
||||||
horizSizing = "center";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
position = "11 38";
|
|
||||||
extent = "280 14";
|
|
||||||
minExtent = "8 8";
|
|
||||||
visible = "1";
|
|
||||||
helpTag = "0";
|
|
||||||
lineSpacing = "2";
|
|
||||||
allowColorChars = "0";
|
|
||||||
maxChars = "-1";
|
|
||||||
};
|
|
||||||
new GuiButtonCtrl() {
|
|
||||||
profile = "ToolsGuiButtonProfile";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "top";
|
|
||||||
position = "70 68";
|
|
||||||
extent = "80 22";
|
|
||||||
minExtent = "8 8";
|
|
||||||
visible = "1";
|
|
||||||
command = "MessageCallback(MessageBoxOKBuyDlg,MessageBoxOKBuyDlg.OKCallback);";
|
|
||||||
accelerator = "return";
|
|
||||||
helpTag = "0";
|
|
||||||
text = "OK";
|
|
||||||
simpleStyle = "0";
|
|
||||||
};
|
|
||||||
new GuiButtonCtrl() {
|
|
||||||
profile = "ToolsGuiButtonProfile";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "top";
|
|
||||||
position = "167 68";
|
|
||||||
extent = "80 22";
|
|
||||||
minExtent = "8 8";
|
|
||||||
visible = "1";
|
|
||||||
command = "MessageCallback(MessageBoxOKBuyDlg,MessageBoxOKBuyDlg.BuyCallback);";
|
|
||||||
accelerator = "escape";
|
|
||||||
helpTag = "0";
|
|
||||||
text = "Buy Now!";
|
|
||||||
simpleStyle = "0";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
//--- OBJECT WRITE END ---
|
|
||||||
|
|
||||||
function MessageBoxOKBuy(%title, %message, %OKCallback, %BuyCallback)
|
|
||||||
{
|
|
||||||
MBOKBuyFrame.text = %title;
|
|
||||||
MessageBoxOKBuyDlg.profile = "ToolsGuiOverlayProfile";
|
|
||||||
Canvas.pushDialog(MessageBoxOKBuyDlg);
|
|
||||||
MBSetText(MBOKBuyText, MBOKBuyFrame, %message);
|
|
||||||
MessageBoxOKBuyDlg.OKCallback = %OKCallback;
|
|
||||||
MessageBoxOKBuyDlg.BuyCallback = %BuyCallback;
|
|
||||||
}
|
|
||||||
|
|
@ -131,12 +131,6 @@ package Tools
|
||||||
Tools::LoadResources( $Tools::resourcePath );
|
Tools::LoadResources( $Tools::resourcePath );
|
||||||
|
|
||||||
//$Scripts::ignoreDSOs = %toggle;
|
//$Scripts::ignoreDSOs = %toggle;
|
||||||
|
|
||||||
if(isWebDemo())
|
|
||||||
{
|
|
||||||
// if this is the web tool demo lets init some value storage
|
|
||||||
//$clicks
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function startToolTime(%tool)
|
function startToolTime(%tool)
|
||||||
|
|
|
||||||
|
|
@ -272,20 +272,3 @@ function ESettingsWindowPopup::onSelect(%this)
|
||||||
EditorSettings.setValue(%this.editorSettingsValue, %this.getText());
|
EditorSettings.setValue(%this.editorSettingsValue, %this.getText());
|
||||||
eval(%this.editorSettingsRead);
|
eval(%this.editorSettingsRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Demo
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function OnWalkaboutDemoLimit()
|
|
||||||
{
|
|
||||||
MessageBoxOK("Walkabout demo",
|
|
||||||
"This demo only allows two NavMeshes to be created. Sorry!");
|
|
||||||
}
|
|
||||||
|
|
||||||
function OnWalkaboutDemoSave()
|
|
||||||
{
|
|
||||||
MessageBoxOK("Walkabout demo",
|
|
||||||
"This demo doesn't allow you to save NavMeshes. Sorry!" SPC
|
|
||||||
"The rest of your mission will still be saved.");
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -561,9 +561,6 @@ function EditorGui::onWake( %this )
|
||||||
|
|
||||||
if( %levelName !$= %this.levelName )
|
if( %levelName !$= %this.levelName )
|
||||||
%this.onNewLevelLoaded( %levelName );
|
%this.onNewLevelLoaded( %levelName );
|
||||||
|
|
||||||
if (isObject(DemoEditorAlert) && DemoEditorAlert.helpTag<2)
|
|
||||||
Canvas.pushDialog(DemoEditorAlert);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function EditorGui::onSleep( %this )
|
function EditorGui::onSleep( %this )
|
||||||
|
|
|
||||||
|
|
@ -81,9 +81,6 @@ function EditorPlugin::onEditorSleep( %this )
|
||||||
/// Push Gui's, stuff like that
|
/// Push Gui's, stuff like that
|
||||||
function EditorPlugin::onActivated( %this )
|
function EditorPlugin::onActivated( %this )
|
||||||
{
|
{
|
||||||
if(isDemo())
|
|
||||||
startToolTime(%this.getName());
|
|
||||||
|
|
||||||
%this.isActivated = true;
|
%this.isActivated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,9 +88,6 @@ function EditorPlugin::onActivated( %this )
|
||||||
/// Pop Gui's, stuff like that
|
/// Pop Gui's, stuff like that
|
||||||
function EditorPlugin::onDeactivated( %this )
|
function EditorPlugin::onDeactivated( %this )
|
||||||
{
|
{
|
||||||
if(isDemo())
|
|
||||||
endToolTime(%this.getName());
|
|
||||||
|
|
||||||
%this.isActivated = false;
|
%this.isActivated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -176,12 +176,6 @@ function EWCreatorWindow::createStatic( %this, %file )
|
||||||
if ( !$missionRunning )
|
if ( !$missionRunning )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(isFunction("getObjectLimit") && MissionGroup.getFullCount() >= getObjectLimit())
|
|
||||||
{
|
|
||||||
MessageBoxOKBuy( "Object Limit Reached", "You have exceeded the object limit of " @ getObjectLimit() @ " for this demo. You can remove objects if you would like to add more.", "", "Canvas.showPurchaseScreen(\"objectlimit\");" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !isObject(%this.objectGroup) )
|
if( !isObject(%this.objectGroup) )
|
||||||
%this.setNewObjectGroup( MissionGroup );
|
%this.setNewObjectGroup( MissionGroup );
|
||||||
|
|
||||||
|
|
@ -200,12 +194,6 @@ function EWCreatorWindow::createPrefab( %this, %file )
|
||||||
if ( !$missionRunning )
|
if ( !$missionRunning )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(isFunction("getObjectLimit") && MissionGroup.getFullCount() >= getObjectLimit())
|
|
||||||
{
|
|
||||||
MessageBoxOKBuy( "Object Limit Reached", "You have exceeded the object limit of " @ getObjectLimit() @ " for this demo. You can remove objects if you would like to add more.", "", "Canvas.showPurchaseScreen(\"objectlimit\");" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !isObject(%this.objectGroup) )
|
if( !isObject(%this.objectGroup) )
|
||||||
%this.setNewObjectGroup( MissionGroup );
|
%this.setNewObjectGroup( MissionGroup );
|
||||||
|
|
||||||
|
|
@ -224,12 +212,6 @@ function EWCreatorWindow::createObject( %this, %cmd )
|
||||||
if ( !$missionRunning )
|
if ( !$missionRunning )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(isFunction("getObjectLimit") && MissionGroup.getFullCount() >= getObjectLimit())
|
|
||||||
{
|
|
||||||
MessageBoxOKBuy( "Object Limit Reached", "You have exceeded the object limit of " @ getObjectLimit() @ " for this demo. You can remove objects if you would like to add more.", "", "Canvas.showPurchaseScreen(\"objectlimit\");" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !isObject(%this.objectGroup) )
|
if( !isObject(%this.objectGroup) )
|
||||||
%this.setNewObjectGroup( MissionGroup );
|
%this.setNewObjectGroup( MissionGroup );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,7 @@ $Pref::WorldEditor::FileSpec = "Torque Mission Files (*.mis)|*.mis|All Files (*.
|
||||||
|
|
||||||
function EditorFileMenu::onMenuSelect(%this)
|
function EditorFileMenu::onMenuSelect(%this)
|
||||||
{
|
{
|
||||||
// don't do this since it won't exist if this is a "demo"
|
%this.enableItem(2, EditorIsDirty());
|
||||||
if(!isWebDemo())
|
|
||||||
%this.enableItem(2, EditorIsDirty());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -88,7 +86,7 @@ function EditorClearDirty()
|
||||||
|
|
||||||
function EditorQuitGame()
|
function EditorQuitGame()
|
||||||
{
|
{
|
||||||
if( EditorIsDirty() && !isWebDemo())
|
if( EditorIsDirty())
|
||||||
{
|
{
|
||||||
MessageBoxYesNoCancel("Level Modified", "Would you like to save your changes before quitting?", "EditorSaveMissionMenu(); quit();", "quit();", "" );
|
MessageBoxYesNoCancel("Level Modified", "Would you like to save your changes before quitting?", "EditorSaveMissionMenu(); quit();", "quit();", "" );
|
||||||
}
|
}
|
||||||
|
|
@ -98,7 +96,7 @@ function EditorQuitGame()
|
||||||
|
|
||||||
function EditorExitMission()
|
function EditorExitMission()
|
||||||
{
|
{
|
||||||
if( EditorIsDirty() && !isWebDemo() )
|
if( EditorIsDirty())
|
||||||
{
|
{
|
||||||
MessageBoxYesNoCancel("Level Modified", "Would you like to save your changes before exiting?", "EditorDoExitMission(true);", "EditorDoExitMission(false);", "");
|
MessageBoxYesNoCancel("Level Modified", "Would you like to save your changes before exiting?", "EditorDoExitMission(true);", "EditorDoExitMission(false);", "");
|
||||||
}
|
}
|
||||||
|
|
@ -108,7 +106,7 @@ function EditorExitMission()
|
||||||
|
|
||||||
function EditorDoExitMission(%saveFirst)
|
function EditorDoExitMission(%saveFirst)
|
||||||
{
|
{
|
||||||
if(%saveFirst && !isWebDemo())
|
if(%saveFirst)
|
||||||
{
|
{
|
||||||
EditorSaveMissionMenu();
|
EditorSaveMissionMenu();
|
||||||
}
|
}
|
||||||
|
|
@ -202,9 +200,6 @@ function EditorOpenDeclarationInTorsion( %object )
|
||||||
|
|
||||||
function EditorNewLevel( %file )
|
function EditorNewLevel( %file )
|
||||||
{
|
{
|
||||||
if(isWebDemo())
|
|
||||||
return;
|
|
||||||
|
|
||||||
%saveFirst = false;
|
%saveFirst = false;
|
||||||
if ( EditorIsDirty() )
|
if ( EditorIsDirty() )
|
||||||
{
|
{
|
||||||
|
|
@ -241,28 +236,14 @@ function EditorNewLevel( %file )
|
||||||
|
|
||||||
function EditorSaveMissionMenu()
|
function EditorSaveMissionMenu()
|
||||||
{
|
{
|
||||||
if(!$Pref::disableSaving && !isWebDemo())
|
if(EditorGui.saveAs)
|
||||||
{
|
EditorSaveMissionAs();
|
||||||
if(EditorGui.saveAs)
|
|
||||||
EditorSaveMissionAs();
|
|
||||||
else
|
|
||||||
EditorSaveMission();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
EditorSaveMission();
|
||||||
EditorSaveMissionMenuDisableSave();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function EditorSaveMission()
|
function EditorSaveMission()
|
||||||
{
|
{
|
||||||
// just save the mission without renaming it
|
|
||||||
if(isFunction("getObjectLimit") && MissionGroup.getFullCount() >= getObjectLimit())
|
|
||||||
{
|
|
||||||
MessageBoxOKBuy( "Object Limit Reached", "You have exceeded the object limit of " @ getObjectLimit() @ " for this demo. You can remove objects if you would like to add more.", "", "Canvas.showPurchaseScreen(\"objectlimit\");" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// first check for dirty and read-only files:
|
// first check for dirty and read-only files:
|
||||||
if((EWorldEditor.isDirty || ETerrainEditor.isMissionDirty) && !isWriteableFileName($Server::MissionFile))
|
if((EWorldEditor.isDirty || ETerrainEditor.isMissionDirty) && !isWriteableFileName($Server::MissionFile))
|
||||||
{
|
{
|
||||||
|
|
@ -316,146 +297,125 @@ function EditorSaveMission()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function EditorSaveMissionMenuDisableSave()
|
|
||||||
{
|
|
||||||
GenericPromptDialog-->GenericPromptWindow.text = "Warning";
|
|
||||||
GenericPromptDialog-->GenericPromptText.setText("Saving disabled in demo mode.");
|
|
||||||
Canvas.pushDialog( GenericPromptDialog );
|
|
||||||
}
|
|
||||||
|
|
||||||
function EditorSaveMissionAs( %missionName )
|
function EditorSaveMissionAs( %missionName )
|
||||||
{
|
{
|
||||||
if(isFunction("getObjectLimit") && MissionGroup.getFullCount() >= getObjectLimit())
|
// If we didn't get passed a new mission name then
|
||||||
|
// prompt the user for one.
|
||||||
|
if ( %missionName $= "" )
|
||||||
{
|
{
|
||||||
MessageBoxOKBuy( "Object Limit Reached", "You have exceeded the object limit of " @ getObjectLimit() @ " for this demo. You can remove objects if you would like to add more.", "", "Canvas.showPurchaseScreen(\"objectlimit\");" );
|
%dlg = new SaveFileDialog()
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$Pref::disableSaving && !isWebDemo())
|
|
||||||
{
|
|
||||||
// If we didn't get passed a new mission name then
|
|
||||||
// prompt the user for one.
|
|
||||||
if ( %missionName $= "" )
|
|
||||||
{
|
{
|
||||||
%dlg = new SaveFileDialog()
|
Filters = $Pref::WorldEditor::FileSpec;
|
||||||
{
|
DefaultPath = EditorSettings.value("LevelInformation/levelsDirectory");
|
||||||
Filters = $Pref::WorldEditor::FileSpec;
|
ChangePath = false;
|
||||||
DefaultPath = EditorSettings.value("LevelInformation/levelsDirectory");
|
OverwritePrompt = true;
|
||||||
ChangePath = false;
|
};
|
||||||
OverwritePrompt = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
%ret = %dlg.Execute();
|
%ret = %dlg.Execute();
|
||||||
if(%ret)
|
if(%ret)
|
||||||
{
|
{
|
||||||
// Immediately override/set the levelsDirectory
|
// Immediately override/set the levelsDirectory
|
||||||
EditorSettings.setValue( "LevelInformation/levelsDirectory", collapseFilename(filePath( %dlg.FileName )) );
|
EditorSettings.setValue( "LevelInformation/levelsDirectory", collapseFilename(filePath( %dlg.FileName )) );
|
||||||
|
|
||||||
%missionName = %dlg.FileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
%dlg.delete();
|
%missionName = %dlg.FileName;
|
||||||
|
|
||||||
if(! %ret)
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fileExt( %missionName ) !$= ".mis" )
|
|
||||||
%missionName = %missionName @ ".mis";
|
|
||||||
|
|
||||||
EWorldEditor.isDirty = true;
|
|
||||||
%saveMissionFile = $Server::MissionFile;
|
|
||||||
|
|
||||||
$Server::MissionFile = %missionName;
|
|
||||||
|
|
||||||
%copyTerrainsFailed = false;
|
|
||||||
|
|
||||||
// Rename all the terrain files. Save all previous names so we can
|
|
||||||
// reset them if saving fails.
|
|
||||||
%newMissionName = fileBase(%missionName);
|
|
||||||
%oldMissionName = fileBase(%saveMissionFile);
|
|
||||||
|
|
||||||
|
%dlg.delete();
|
||||||
|
|
||||||
|
if(! %ret)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( fileExt( %missionName ) !$= ".mis" )
|
||||||
|
%missionName = %missionName @ ".mis";
|
||||||
|
|
||||||
|
EWorldEditor.isDirty = true;
|
||||||
|
%saveMissionFile = $Server::MissionFile;
|
||||||
|
|
||||||
|
$Server::MissionFile = %missionName;
|
||||||
|
|
||||||
|
%copyTerrainsFailed = false;
|
||||||
|
|
||||||
|
// Rename all the terrain files. Save all previous names so we can
|
||||||
|
// reset them if saving fails.
|
||||||
|
%newMissionName = fileBase(%missionName);
|
||||||
|
%oldMissionName = fileBase(%saveMissionFile);
|
||||||
|
|
||||||
|
initContainerTypeSearch( $TypeMasks::TerrainObjectType );
|
||||||
|
%savedTerrNames = new ScriptObject();
|
||||||
|
for( %i = 0;; %i ++ )
|
||||||
|
{
|
||||||
|
%terrainObject = containerSearchNext();
|
||||||
|
if( !%terrainObject )
|
||||||
|
break;
|
||||||
|
|
||||||
|
%savedTerrNames.array[ %i ] = %terrainObject.terrainFile;
|
||||||
|
|
||||||
|
%terrainFilePath = makeRelativePath( filePath( %terrainObject.terrainFile ), getMainDotCsDir() );
|
||||||
|
%terrainFileName = fileName( %terrainObject.terrainFile );
|
||||||
|
|
||||||
|
// Workaround to have terrains created in an unsaved "New Level..." mission
|
||||||
|
// moved to the correct place.
|
||||||
|
|
||||||
|
if( EditorGui.saveAs && %terrainFilePath $= "tools/art/terrains" )
|
||||||
|
%terrainFilePath = "art/terrains";
|
||||||
|
|
||||||
|
// Try and follow the existing naming convention.
|
||||||
|
// If we can't, use systematic terrain file names.
|
||||||
|
if( strstr( %terrainFileName, %oldMissionName ) >= 0 )
|
||||||
|
%terrainFileName = strreplace( %terrainFileName, %oldMissionName, %newMissionName );
|
||||||
|
else
|
||||||
|
%terrainFileName = %newMissionName @ "_" @ %i @ ".ter";
|
||||||
|
|
||||||
|
%newTerrainFile = %terrainFilePath @ "/" @ %terrainFileName;
|
||||||
|
|
||||||
|
if (!isWriteableFileName(%newTerrainFile))
|
||||||
|
{
|
||||||
|
if (MessageBox("Error", "Terrain file \""@ %newTerrainFile @ "\" is read-only. Continue?", "Ok", "Stop") == $MROk)
|
||||||
|
continue;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
%copyTerrainsFailed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !%terrainObject.save( %newTerrainFile ) )
|
||||||
|
{
|
||||||
|
error( "Failed to save '" @ %newTerrainFile @ "'" );
|
||||||
|
%copyTerrainsFailed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
%terrainObject.terrainFile = %newTerrainFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
ETerrainEditor.isDirty = false;
|
||||||
|
|
||||||
|
// Save the mission.
|
||||||
|
if(%copyTerrainsFailed || !EditorSaveMission())
|
||||||
|
{
|
||||||
|
// It failed, so restore the mission and terrain filenames.
|
||||||
|
|
||||||
|
$Server::MissionFile = %saveMissionFile;
|
||||||
|
|
||||||
initContainerTypeSearch( $TypeMasks::TerrainObjectType );
|
initContainerTypeSearch( $TypeMasks::TerrainObjectType );
|
||||||
%savedTerrNames = new ScriptObject();
|
|
||||||
for( %i = 0;; %i ++ )
|
for( %i = 0;; %i ++ )
|
||||||
{
|
{
|
||||||
%terrainObject = containerSearchNext();
|
%terrainObject = containerSearchNext();
|
||||||
if( !%terrainObject )
|
if( !%terrainObject )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
%savedTerrNames.array[ %i ] = %terrainObject.terrainFile;
|
%terrainObject.terrainFile = %savedTerrNames.array[ %i ];
|
||||||
|
|
||||||
%terrainFilePath = makeRelativePath( filePath( %terrainObject.terrainFile ), getMainDotCsDir() );
|
|
||||||
%terrainFileName = fileName( %terrainObject.terrainFile );
|
|
||||||
|
|
||||||
// Workaround to have terrains created in an unsaved "New Level..." mission
|
|
||||||
// moved to the correct place.
|
|
||||||
|
|
||||||
if( EditorGui.saveAs && %terrainFilePath $= "tools/art/terrains" )
|
|
||||||
%terrainFilePath = "art/terrains";
|
|
||||||
|
|
||||||
// Try and follow the existing naming convention.
|
|
||||||
// If we can't, use systematic terrain file names.
|
|
||||||
if( strstr( %terrainFileName, %oldMissionName ) >= 0 )
|
|
||||||
%terrainFileName = strreplace( %terrainFileName, %oldMissionName, %newMissionName );
|
|
||||||
else
|
|
||||||
%terrainFileName = %newMissionName @ "_" @ %i @ ".ter";
|
|
||||||
|
|
||||||
%newTerrainFile = %terrainFilePath @ "/" @ %terrainFileName;
|
|
||||||
|
|
||||||
if (!isWriteableFileName(%newTerrainFile))
|
|
||||||
{
|
|
||||||
if (MessageBox("Error", "Terrain file \""@ %newTerrainFile @ "\" is read-only. Continue?", "Ok", "Stop") == $MROk)
|
|
||||||
continue;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
%copyTerrainsFailed = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !%terrainObject.save( %newTerrainFile ) )
|
|
||||||
{
|
|
||||||
error( "Failed to save '" @ %newTerrainFile @ "'" );
|
|
||||||
%copyTerrainsFailed = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
%terrainObject.terrainFile = %newTerrainFile;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ETerrainEditor.isDirty = false;
|
|
||||||
|
|
||||||
// Save the mission.
|
|
||||||
if(%copyTerrainsFailed || !EditorSaveMission())
|
|
||||||
{
|
|
||||||
// It failed, so restore the mission and terrain filenames.
|
|
||||||
|
|
||||||
$Server::MissionFile = %saveMissionFile;
|
|
||||||
|
|
||||||
initContainerTypeSearch( $TypeMasks::TerrainObjectType );
|
|
||||||
for( %i = 0;; %i ++ )
|
|
||||||
{
|
|
||||||
%terrainObject = containerSearchNext();
|
|
||||||
if( !%terrainObject )
|
|
||||||
break;
|
|
||||||
|
|
||||||
%terrainObject.terrainFile = %savedTerrNames.array[ %i ];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
%savedTerrNames.delete();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
EditorSaveMissionMenuDisableSave();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%savedTerrNames.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
function EditorOpenMission(%filename)
|
function EditorOpenMission(%filename)
|
||||||
{
|
{
|
||||||
if( EditorIsDirty() && !isWebDemo() )
|
if( EditorIsDirty())
|
||||||
{
|
{
|
||||||
// "EditorSaveBeforeLoad();", "getLoadFilename(\"*.mis\", \"EditorDoLoadMission\");"
|
// "EditorSaveBeforeLoad();", "getLoadFilename(\"*.mis\", \"EditorDoLoadMission\");"
|
||||||
if(MessageBox("Mission Modified", "Would you like to save changes to the current mission \"" @
|
if(MessageBox("Mission Modified", "Would you like to save changes to the current mission \"" @
|
||||||
|
|
@ -523,72 +483,65 @@ function EditorOpenMission(%filename)
|
||||||
|
|
||||||
function EditorExportToCollada()
|
function EditorExportToCollada()
|
||||||
{
|
{
|
||||||
if ( !$Pref::disableSaving && !isWebDemo() )
|
%dlg = new SaveFileDialog()
|
||||||
{
|
{
|
||||||
%dlg = new SaveFileDialog()
|
Filters = "COLLADA Files (*.dae)|*.dae|";
|
||||||
{
|
DefaultPath = $Pref::WorldEditor::LastPath;
|
||||||
Filters = "COLLADA Files (*.dae)|*.dae|";
|
DefaultFile = "";
|
||||||
DefaultPath = $Pref::WorldEditor::LastPath;
|
ChangePath = false;
|
||||||
DefaultFile = "";
|
OverwritePrompt = true;
|
||||||
ChangePath = false;
|
};
|
||||||
OverwritePrompt = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
%ret = %dlg.Execute();
|
%ret = %dlg.Execute();
|
||||||
if ( %ret )
|
if ( %ret )
|
||||||
{
|
{
|
||||||
$Pref::WorldEditor::LastPath = filePath( %dlg.FileName );
|
$Pref::WorldEditor::LastPath = filePath( %dlg.FileName );
|
||||||
%exportFile = %dlg.FileName;
|
%exportFile = %dlg.FileName;
|
||||||
}
|
|
||||||
|
|
||||||
if( fileExt( %exportFile ) !$= ".dae" )
|
|
||||||
%exportFile = %exportFile @ ".dae";
|
|
||||||
|
|
||||||
%dlg.delete();
|
|
||||||
|
|
||||||
if ( !%ret )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ( EditorGui.currentEditor.getId() == ShapeEditorPlugin.getId() )
|
|
||||||
ShapeEdShapeView.exportToCollada( %exportFile );
|
|
||||||
else
|
|
||||||
EWorldEditor.colladaExportSelection( %exportFile );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( fileExt( %exportFile ) !$= ".dae" )
|
||||||
|
%exportFile = %exportFile @ ".dae";
|
||||||
|
|
||||||
|
%dlg.delete();
|
||||||
|
|
||||||
|
if ( !%ret )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ( EditorGui.currentEditor.getId() == ShapeEditorPlugin.getId() )
|
||||||
|
ShapeEdShapeView.exportToCollada( %exportFile );
|
||||||
|
else
|
||||||
|
EWorldEditor.colladaExportSelection( %exportFile );
|
||||||
}
|
}
|
||||||
|
|
||||||
function EditorMakePrefab()
|
function EditorMakePrefab()
|
||||||
{
|
{
|
||||||
// Should this be protected or not?
|
%dlg = new SaveFileDialog()
|
||||||
if ( !$Pref::disableSaving && !isWebDemo() )
|
|
||||||
{
|
{
|
||||||
%dlg = new SaveFileDialog()
|
Filters = "Prefab Files (*.prefab)|*.prefab|";
|
||||||
{
|
DefaultPath = $Pref::WorldEditor::LastPath;
|
||||||
Filters = "Prefab Files (*.prefab)|*.prefab|";
|
DefaultFile = "";
|
||||||
DefaultPath = $Pref::WorldEditor::LastPath;
|
ChangePath = false;
|
||||||
DefaultFile = "";
|
OverwritePrompt = true;
|
||||||
ChangePath = false;
|
};
|
||||||
OverwritePrompt = true;
|
|
||||||
};
|
%ret = %dlg.Execute();
|
||||||
|
if ( %ret )
|
||||||
%ret = %dlg.Execute();
|
{
|
||||||
if ( %ret )
|
$Pref::WorldEditor::LastPath = filePath( %dlg.FileName );
|
||||||
{
|
%saveFile = %dlg.FileName;
|
||||||
$Pref::WorldEditor::LastPath = filePath( %dlg.FileName );
|
|
||||||
%saveFile = %dlg.FileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( fileExt( %saveFile ) !$= ".prefab" )
|
|
||||||
%saveFile = %saveFile @ ".prefab";
|
|
||||||
|
|
||||||
%dlg.delete();
|
|
||||||
|
|
||||||
if ( !%ret )
|
|
||||||
return;
|
|
||||||
|
|
||||||
EWorldEditor.makeSelectionPrefab( %saveFile );
|
|
||||||
|
|
||||||
EditorTree.buildVisibleTree( true );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( fileExt( %saveFile ) !$= ".prefab" )
|
||||||
|
%saveFile = %saveFile @ ".prefab";
|
||||||
|
|
||||||
|
%dlg.delete();
|
||||||
|
|
||||||
|
if ( !%ret )
|
||||||
|
return;
|
||||||
|
|
||||||
|
EWorldEditor.makeSelectionPrefab( %saveFile );
|
||||||
|
|
||||||
|
EditorTree.buildVisibleTree( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
function EditorExplodePrefab()
|
function EditorExplodePrefab()
|
||||||
|
|
|
||||||
|
|
@ -112,35 +112,30 @@ function EditorGui::buildMenus(%this)
|
||||||
barTitle = "File";
|
barTitle = "File";
|
||||||
};
|
};
|
||||||
|
|
||||||
if(!isWebDemo())
|
|
||||||
{
|
|
||||||
%fileMenu.appendItem("New Level" TAB "" TAB "schedule( 1, 0, \"EditorNewLevel\" );");
|
|
||||||
%fileMenu.appendItem("Open Level..." TAB %cmdCtrl SPC "O" TAB "schedule( 1, 0, \"EditorOpenMission\" );");
|
|
||||||
%fileMenu.appendItem("Save Level" TAB %cmdCtrl SPC "S" TAB "EditorSaveMissionMenu();");
|
|
||||||
%fileMenu.appendItem("Save Level As..." TAB "" TAB "EditorSaveMissionAs();");
|
|
||||||
%fileMenu.appendItem("-");
|
|
||||||
|
|
||||||
if( $platform $= "windows" )
|
%fileMenu.appendItem("New Level" TAB "" TAB "schedule( 1, 0, \"EditorNewLevel\" );");
|
||||||
{
|
%fileMenu.appendItem("Open Level..." TAB %cmdCtrl SPC "O" TAB "schedule( 1, 0, \"EditorOpenMission\" );");
|
||||||
%fileMenu.appendItem( "Open Project in Torsion" TAB "" TAB "EditorOpenTorsionProject();" );
|
%fileMenu.appendItem("Save Level" TAB %cmdCtrl SPC "S" TAB "EditorSaveMissionMenu();");
|
||||||
%fileMenu.appendItem( "Open Level File in Torsion" TAB "" TAB "EditorOpenFileInTorsion();" );
|
%fileMenu.appendItem("Save Level As..." TAB "" TAB "EditorSaveMissionAs();");
|
||||||
%fileMenu.appendItem( "-" );
|
%fileMenu.appendItem("-");
|
||||||
}
|
|
||||||
|
if( $platform $= "windows" )
|
||||||
|
{
|
||||||
|
%fileMenu.appendItem( "Open Project in Torsion" TAB "" TAB "EditorOpenTorsionProject();" );
|
||||||
|
%fileMenu.appendItem( "Open Level File in Torsion" TAB "" TAB "EditorOpenFileInTorsion();" );
|
||||||
|
%fileMenu.appendItem( "-" );
|
||||||
}
|
}
|
||||||
|
|
||||||
%fileMenu.appendItem("Create Blank Terrain" TAB "" TAB "Canvas.pushDialog( CreateNewTerrainGui );");
|
%fileMenu.appendItem("Create Blank Terrain" TAB "" TAB "Canvas.pushDialog( CreateNewTerrainGui );");
|
||||||
%fileMenu.appendItem("Import Terrain Heightmap" TAB "" TAB "Canvas.pushDialog( TerrainImportGui );");
|
%fileMenu.appendItem("Import Terrain Heightmap" TAB "" TAB "Canvas.pushDialog( TerrainImportGui );");
|
||||||
|
|
||||||
if(!isWebDemo())
|
%fileMenu.appendItem("Export Terrain Heightmap" TAB "" TAB "Canvas.pushDialog( TerrainExportGui );");
|
||||||
{
|
%fileMenu.appendItem("-");
|
||||||
%fileMenu.appendItem("Export Terrain Heightmap" TAB "" TAB "Canvas.pushDialog( TerrainExportGui );");
|
%fileMenu.appendItem("Export To COLLADA..." TAB "" TAB "EditorExportToCollada();");
|
||||||
%fileMenu.appendItem("-");
|
//item[5] = "Import Terraform Data..." TAB "" TAB "Heightfield::import();";
|
||||||
%fileMenu.appendItem("Export To COLLADA..." TAB "" TAB "EditorExportToCollada();");
|
//item[6] = "Import Texture Data..." TAB "" TAB "Texture::import();";
|
||||||
//item[5] = "Import Terraform Data..." TAB "" TAB "Heightfield::import();";
|
//item[7] = "-";
|
||||||
//item[6] = "Import Texture Data..." TAB "" TAB "Texture::import();";
|
//item[8] = "Export Terraform Data..." TAB "" TAB "Heightfield::saveBitmap(\"\");";
|
||||||
//item[7] = "-";
|
|
||||||
//item[8] = "Export Terraform Data..." TAB "" TAB "Heightfield::saveBitmap(\"\");";
|
|
||||||
}
|
|
||||||
|
|
||||||
%fileMenu.appendItem( "-" );
|
%fileMenu.appendItem( "-" );
|
||||||
%fileMenu.appendItem( "Add FMOD Designer Audio..." TAB "" TAB "AddFMODProjectDlg.show();" );
|
%fileMenu.appendItem( "Add FMOD Designer Audio..." TAB "" TAB "AddFMODProjectDlg.show();" );
|
||||||
|
|
@ -148,11 +143,9 @@ function EditorGui::buildMenus(%this)
|
||||||
%fileMenu.appendItem("-");
|
%fileMenu.appendItem("-");
|
||||||
%fileMenu.appendItem("Play Level" TAB "F11" TAB "Editor.close(\"PlayGui\");");
|
%fileMenu.appendItem("Play Level" TAB "F11" TAB "Editor.close(\"PlayGui\");");
|
||||||
|
|
||||||
if(!isWebDemo())
|
%fileMenu.appendItem("Exit Level" TAB "" TAB "EditorExitMission();");
|
||||||
{
|
%fileMenu.appendItem("Quit" TAB %quitShortcut TAB "EditorQuitGame();");
|
||||||
%fileMenu.appendItem("Exit Level" TAB "" TAB "EditorExitMission();");
|
|
||||||
%fileMenu.appendItem("Quit" TAB %quitShortcut TAB "EditorQuitGame();");
|
|
||||||
}
|
|
||||||
%this.menuBar.insert(%fileMenu, %this.menuBar.getCount());
|
%this.menuBar.insert(%fileMenu, %this.menuBar.getCount());
|
||||||
|
|
||||||
// Edit Menu
|
// Edit Menu
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,3 @@ exec("./guiObjectInspector.ed.cs");
|
||||||
exec("./uvEditor.ed.gui");
|
exec("./uvEditor.ed.gui");
|
||||||
exec("./objectSelection.ed.cs");
|
exec("./objectSelection.ed.cs");
|
||||||
exec("./guiPlatformGenericMenubar.ed.cs");
|
exec("./guiPlatformGenericMenubar.ed.cs");
|
||||||
|
|
||||||
if (isDemo())
|
|
||||||
exec("./messageBoxOKBuy.ed.gui");
|
|
||||||
|
|
|
||||||
|
|
@ -1,85 +0,0 @@
|
||||||
//--- OBJECT WRITE BEGIN ---
|
|
||||||
%guiContent = new GuiControl(MessageBoxOKBuyDlg) {
|
|
||||||
profile = "ToolsGuiDefaultProfile";
|
|
||||||
horizSizing = "width";
|
|
||||||
vertSizing = "height";
|
|
||||||
position = "0 0";
|
|
||||||
extent = "640 480";
|
|
||||||
minExtent = "8 8";
|
|
||||||
visible = "1";
|
|
||||||
helpTag = "0";
|
|
||||||
|
|
||||||
new GuiWindowCtrl(MBOKBuyFrame) {
|
|
||||||
profile = "ToolsGuiWindowProfile";
|
|
||||||
horizSizing = "center";
|
|
||||||
vertSizing = "center";
|
|
||||||
position = "170 175";
|
|
||||||
extent = "300 100";
|
|
||||||
minExtent = "48 92";
|
|
||||||
visible = "1";
|
|
||||||
helpTag = "0";
|
|
||||||
maxLength = "255";
|
|
||||||
resizeWidth = "1";
|
|
||||||
resizeHeight = "1";
|
|
||||||
canMove = "1";
|
|
||||||
canClose = "1";
|
|
||||||
canMinimize = "0";
|
|
||||||
canMaximize = "0";
|
|
||||||
minSize = "50 50";
|
|
||||||
text = "";
|
|
||||||
closeCommand = "MessageCallback(MessageBoxOKBuyDlg,MessageBoxOKBuyDlg.noCallback);";
|
|
||||||
|
|
||||||
new GuiMLTextCtrl(MBOKBuyText) {
|
|
||||||
profile = "ToolsGuiMLTextProfile";
|
|
||||||
horizSizing = "center";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
position = "11 38";
|
|
||||||
extent = "280 14";
|
|
||||||
minExtent = "8 8";
|
|
||||||
visible = "1";
|
|
||||||
helpTag = "0";
|
|
||||||
lineSpacing = "2";
|
|
||||||
allowColorChars = "0";
|
|
||||||
maxChars = "-1";
|
|
||||||
};
|
|
||||||
new GuiButtonCtrl() {
|
|
||||||
profile = "ToolsGuiButtonProfile";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "top";
|
|
||||||
position = "70 68";
|
|
||||||
extent = "80 22";
|
|
||||||
minExtent = "8 8";
|
|
||||||
visible = "1";
|
|
||||||
command = "MessageCallback(MessageBoxOKBuyDlg,MessageBoxOKBuyDlg.OKCallback);";
|
|
||||||
accelerator = "return";
|
|
||||||
helpTag = "0";
|
|
||||||
text = "OK";
|
|
||||||
simpleStyle = "0";
|
|
||||||
};
|
|
||||||
new GuiButtonCtrl() {
|
|
||||||
profile = "ToolsGuiButtonProfile";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "top";
|
|
||||||
position = "167 68";
|
|
||||||
extent = "80 22";
|
|
||||||
minExtent = "8 8";
|
|
||||||
visible = "1";
|
|
||||||
command = "MessageCallback(MessageBoxOKBuyDlg,MessageBoxOKBuyDlg.BuyCallback);";
|
|
||||||
accelerator = "escape";
|
|
||||||
helpTag = "0";
|
|
||||||
text = "Buy Now!";
|
|
||||||
simpleStyle = "0";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
//--- OBJECT WRITE END ---
|
|
||||||
|
|
||||||
function MessageBoxOKBuy(%title, %message, %OKCallback, %BuyCallback)
|
|
||||||
{
|
|
||||||
MBOKBuyFrame.text = %title;
|
|
||||||
MessageBoxOKBuyDlg.profile = "ToolsGuiOverlayProfile";
|
|
||||||
Canvas.pushDialog(MessageBoxOKBuyDlg);
|
|
||||||
MBSetText(MBOKBuyText, MBOKBuyFrame, %message);
|
|
||||||
MessageBoxOKBuyDlg.OKCallback = %OKCallback;
|
|
||||||
MessageBoxOKBuyDlg.BuyCallback = %BuyCallback;
|
|
||||||
}
|
|
||||||
|
|
@ -131,12 +131,6 @@ package Tools
|
||||||
Tools::LoadResources( $Tools::resourcePath );
|
Tools::LoadResources( $Tools::resourcePath );
|
||||||
|
|
||||||
//$Scripts::ignoreDSOs = %toggle;
|
//$Scripts::ignoreDSOs = %toggle;
|
||||||
|
|
||||||
if(isWebDemo())
|
|
||||||
{
|
|
||||||
// if this is the web tool demo lets init some value storage
|
|
||||||
//$clicks
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function startToolTime(%tool)
|
function startToolTime(%tool)
|
||||||
|
|
|
||||||
|
|
@ -272,20 +272,3 @@ function ESettingsWindowPopup::onSelect(%this)
|
||||||
EditorSettings.setValue(%this.editorSettingsValue, %this.getText());
|
EditorSettings.setValue(%this.editorSettingsValue, %this.getText());
|
||||||
eval(%this.editorSettingsRead);
|
eval(%this.editorSettingsRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Demo
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function OnWalkaboutDemoLimit()
|
|
||||||
{
|
|
||||||
MessageBoxOK("Walkabout demo",
|
|
||||||
"This demo only allows two NavMeshes to be created. Sorry!");
|
|
||||||
}
|
|
||||||
|
|
||||||
function OnWalkaboutDemoSave()
|
|
||||||
{
|
|
||||||
MessageBoxOK("Walkabout demo",
|
|
||||||
"This demo doesn't allow you to save NavMeshes. Sorry!" SPC
|
|
||||||
"The rest of your mission will still be saved.");
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -561,9 +561,6 @@ function EditorGui::onWake( %this )
|
||||||
|
|
||||||
if( %levelName !$= %this.levelName )
|
if( %levelName !$= %this.levelName )
|
||||||
%this.onNewLevelLoaded( %levelName );
|
%this.onNewLevelLoaded( %levelName );
|
||||||
|
|
||||||
if (isObject(DemoEditorAlert) && DemoEditorAlert.helpTag<2)
|
|
||||||
Canvas.pushDialog(DemoEditorAlert);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function EditorGui::onSleep( %this )
|
function EditorGui::onSleep( %this )
|
||||||
|
|
|
||||||
|
|
@ -81,9 +81,6 @@ function EditorPlugin::onEditorSleep( %this )
|
||||||
/// Push Gui's, stuff like that
|
/// Push Gui's, stuff like that
|
||||||
function EditorPlugin::onActivated( %this )
|
function EditorPlugin::onActivated( %this )
|
||||||
{
|
{
|
||||||
if(isDemo())
|
|
||||||
startToolTime(%this.getName());
|
|
||||||
|
|
||||||
%this.isActivated = true;
|
%this.isActivated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,9 +88,6 @@ function EditorPlugin::onActivated( %this )
|
||||||
/// Pop Gui's, stuff like that
|
/// Pop Gui's, stuff like that
|
||||||
function EditorPlugin::onDeactivated( %this )
|
function EditorPlugin::onDeactivated( %this )
|
||||||
{
|
{
|
||||||
if(isDemo())
|
|
||||||
endToolTime(%this.getName());
|
|
||||||
|
|
||||||
%this.isActivated = false;
|
%this.isActivated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -176,12 +176,6 @@ function EWCreatorWindow::createStatic( %this, %file )
|
||||||
if ( !$missionRunning )
|
if ( !$missionRunning )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(isFunction("getObjectLimit") && MissionGroup.getFullCount() >= getObjectLimit())
|
|
||||||
{
|
|
||||||
MessageBoxOKBuy( "Object Limit Reached", "You have exceeded the object limit of " @ getObjectLimit() @ " for this demo. You can remove objects if you would like to add more.", "", "Canvas.showPurchaseScreen(\"objectlimit\");" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !isObject(%this.objectGroup) )
|
if( !isObject(%this.objectGroup) )
|
||||||
%this.setNewObjectGroup( MissionGroup );
|
%this.setNewObjectGroup( MissionGroup );
|
||||||
|
|
||||||
|
|
@ -200,12 +194,6 @@ function EWCreatorWindow::createPrefab( %this, %file )
|
||||||
if ( !$missionRunning )
|
if ( !$missionRunning )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(isFunction("getObjectLimit") && MissionGroup.getFullCount() >= getObjectLimit())
|
|
||||||
{
|
|
||||||
MessageBoxOKBuy( "Object Limit Reached", "You have exceeded the object limit of " @ getObjectLimit() @ " for this demo. You can remove objects if you would like to add more.", "", "Canvas.showPurchaseScreen(\"objectlimit\");" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !isObject(%this.objectGroup) )
|
if( !isObject(%this.objectGroup) )
|
||||||
%this.setNewObjectGroup( MissionGroup );
|
%this.setNewObjectGroup( MissionGroup );
|
||||||
|
|
||||||
|
|
@ -224,12 +212,6 @@ function EWCreatorWindow::createObject( %this, %cmd )
|
||||||
if ( !$missionRunning )
|
if ( !$missionRunning )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(isFunction("getObjectLimit") && MissionGroup.getFullCount() >= getObjectLimit())
|
|
||||||
{
|
|
||||||
MessageBoxOKBuy( "Object Limit Reached", "You have exceeded the object limit of " @ getObjectLimit() @ " for this demo. You can remove objects if you would like to add more.", "", "Canvas.showPurchaseScreen(\"objectlimit\");" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !isObject(%this.objectGroup) )
|
if( !isObject(%this.objectGroup) )
|
||||||
%this.setNewObjectGroup( MissionGroup );
|
%this.setNewObjectGroup( MissionGroup );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,7 @@ $Pref::WorldEditor::FileSpec = "Torque Mission Files (*.mis)|*.mis|All Files (*.
|
||||||
|
|
||||||
function EditorFileMenu::onMenuSelect(%this)
|
function EditorFileMenu::onMenuSelect(%this)
|
||||||
{
|
{
|
||||||
// don't do this since it won't exist if this is a "demo"
|
%this.enableItem(2, EditorIsDirty());
|
||||||
if(!isWebDemo())
|
|
||||||
%this.enableItem(2, EditorIsDirty());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -88,7 +86,7 @@ function EditorClearDirty()
|
||||||
|
|
||||||
function EditorQuitGame()
|
function EditorQuitGame()
|
||||||
{
|
{
|
||||||
if( EditorIsDirty() && !isWebDemo())
|
if( EditorIsDirty())
|
||||||
{
|
{
|
||||||
MessageBoxYesNoCancel("Level Modified", "Would you like to save your changes before quitting?", "EditorSaveMissionMenu(); quit();", "quit();", "" );
|
MessageBoxYesNoCancel("Level Modified", "Would you like to save your changes before quitting?", "EditorSaveMissionMenu(); quit();", "quit();", "" );
|
||||||
}
|
}
|
||||||
|
|
@ -98,7 +96,7 @@ function EditorQuitGame()
|
||||||
|
|
||||||
function EditorExitMission()
|
function EditorExitMission()
|
||||||
{
|
{
|
||||||
if( EditorIsDirty() && !isWebDemo() )
|
if( EditorIsDirty())
|
||||||
{
|
{
|
||||||
MessageBoxYesNoCancel("Level Modified", "Would you like to save your changes before exiting?", "EditorDoExitMission(true);", "EditorDoExitMission(false);", "");
|
MessageBoxYesNoCancel("Level Modified", "Would you like to save your changes before exiting?", "EditorDoExitMission(true);", "EditorDoExitMission(false);", "");
|
||||||
}
|
}
|
||||||
|
|
@ -108,7 +106,7 @@ function EditorExitMission()
|
||||||
|
|
||||||
function EditorDoExitMission(%saveFirst)
|
function EditorDoExitMission(%saveFirst)
|
||||||
{
|
{
|
||||||
if(%saveFirst && !isWebDemo())
|
if(%saveFirst)
|
||||||
{
|
{
|
||||||
EditorSaveMissionMenu();
|
EditorSaveMissionMenu();
|
||||||
}
|
}
|
||||||
|
|
@ -202,9 +200,6 @@ function EditorOpenDeclarationInTorsion( %object )
|
||||||
|
|
||||||
function EditorNewLevel( %file )
|
function EditorNewLevel( %file )
|
||||||
{
|
{
|
||||||
if(isWebDemo())
|
|
||||||
return;
|
|
||||||
|
|
||||||
%saveFirst = false;
|
%saveFirst = false;
|
||||||
if ( EditorIsDirty() )
|
if ( EditorIsDirty() )
|
||||||
{
|
{
|
||||||
|
|
@ -241,27 +236,15 @@ function EditorNewLevel( %file )
|
||||||
|
|
||||||
function EditorSaveMissionMenu()
|
function EditorSaveMissionMenu()
|
||||||
{
|
{
|
||||||
if(!$Pref::disableSaving && !isWebDemo())
|
if(EditorGui.saveAs)
|
||||||
{
|
EditorSaveMissionAs();
|
||||||
if(EditorGui.saveAs)
|
|
||||||
EditorSaveMissionAs();
|
|
||||||
else
|
|
||||||
EditorSaveMission();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
EditorSaveMission();
|
||||||
EditorSaveMissionMenuDisableSave();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function EditorSaveMission()
|
function EditorSaveMission()
|
||||||
{
|
{
|
||||||
// just save the mission without renaming it
|
// just save the mission without renaming it
|
||||||
if(isFunction("getObjectLimit") && MissionGroup.getFullCount() >= getObjectLimit())
|
|
||||||
{
|
|
||||||
MessageBoxOKBuy( "Object Limit Reached", "You have exceeded the object limit of " @ getObjectLimit() @ " for this demo. You can remove objects if you would like to add more.", "", "Canvas.showPurchaseScreen(\"objectlimit\");" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// first check for dirty and read-only files:
|
// first check for dirty and read-only files:
|
||||||
if((EWorldEditor.isDirty || ETerrainEditor.isMissionDirty) && !isWriteableFileName($Server::MissionFile))
|
if((EWorldEditor.isDirty || ETerrainEditor.isMissionDirty) && !isWriteableFileName($Server::MissionFile))
|
||||||
|
|
@ -316,146 +299,125 @@ function EditorSaveMission()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function EditorSaveMissionMenuDisableSave()
|
|
||||||
{
|
|
||||||
GenericPromptDialog-->GenericPromptWindow.text = "Warning";
|
|
||||||
GenericPromptDialog-->GenericPromptText.setText("Saving disabled in demo mode.");
|
|
||||||
Canvas.pushDialog( GenericPromptDialog );
|
|
||||||
}
|
|
||||||
|
|
||||||
function EditorSaveMissionAs( %missionName )
|
function EditorSaveMissionAs( %missionName )
|
||||||
{
|
{
|
||||||
if(isFunction("getObjectLimit") && MissionGroup.getFullCount() >= getObjectLimit())
|
// If we didn't get passed a new mission name then
|
||||||
|
// prompt the user for one.
|
||||||
|
if ( %missionName $= "" )
|
||||||
{
|
{
|
||||||
MessageBoxOKBuy( "Object Limit Reached", "You have exceeded the object limit of " @ getObjectLimit() @ " for this demo. You can remove objects if you would like to add more.", "", "Canvas.showPurchaseScreen(\"objectlimit\");" );
|
%dlg = new SaveFileDialog()
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$Pref::disableSaving && !isWebDemo())
|
|
||||||
{
|
|
||||||
// If we didn't get passed a new mission name then
|
|
||||||
// prompt the user for one.
|
|
||||||
if ( %missionName $= "" )
|
|
||||||
{
|
{
|
||||||
%dlg = new SaveFileDialog()
|
Filters = $Pref::WorldEditor::FileSpec;
|
||||||
{
|
DefaultPath = EditorSettings.value("LevelInformation/levelsDirectory");
|
||||||
Filters = $Pref::WorldEditor::FileSpec;
|
ChangePath = false;
|
||||||
DefaultPath = EditorSettings.value("LevelInformation/levelsDirectory");
|
OverwritePrompt = true;
|
||||||
ChangePath = false;
|
};
|
||||||
OverwritePrompt = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
%ret = %dlg.Execute();
|
%ret = %dlg.Execute();
|
||||||
if(%ret)
|
if(%ret)
|
||||||
{
|
{
|
||||||
// Immediately override/set the levelsDirectory
|
// Immediately override/set the levelsDirectory
|
||||||
EditorSettings.setValue( "LevelInformation/levelsDirectory", collapseFilename(filePath( %dlg.FileName )) );
|
EditorSettings.setValue( "LevelInformation/levelsDirectory", collapseFilename(filePath( %dlg.FileName )) );
|
||||||
|
|
||||||
%missionName = %dlg.FileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
%dlg.delete();
|
%missionName = %dlg.FileName;
|
||||||
|
|
||||||
if(! %ret)
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fileExt( %missionName ) !$= ".mis" )
|
|
||||||
%missionName = %missionName @ ".mis";
|
|
||||||
|
|
||||||
EWorldEditor.isDirty = true;
|
|
||||||
%saveMissionFile = $Server::MissionFile;
|
|
||||||
|
|
||||||
$Server::MissionFile = %missionName;
|
|
||||||
|
|
||||||
%copyTerrainsFailed = false;
|
|
||||||
|
|
||||||
// Rename all the terrain files. Save all previous names so we can
|
|
||||||
// reset them if saving fails.
|
|
||||||
%newMissionName = fileBase(%missionName);
|
|
||||||
%oldMissionName = fileBase(%saveMissionFile);
|
|
||||||
|
|
||||||
|
%dlg.delete();
|
||||||
|
|
||||||
|
if(! %ret)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( fileExt( %missionName ) !$= ".mis" )
|
||||||
|
%missionName = %missionName @ ".mis";
|
||||||
|
|
||||||
|
EWorldEditor.isDirty = true;
|
||||||
|
%saveMissionFile = $Server::MissionFile;
|
||||||
|
|
||||||
|
$Server::MissionFile = %missionName;
|
||||||
|
|
||||||
|
%copyTerrainsFailed = false;
|
||||||
|
|
||||||
|
// Rename all the terrain files. Save all previous names so we can
|
||||||
|
// reset them if saving fails.
|
||||||
|
%newMissionName = fileBase(%missionName);
|
||||||
|
%oldMissionName = fileBase(%saveMissionFile);
|
||||||
|
|
||||||
|
initContainerTypeSearch( $TypeMasks::TerrainObjectType );
|
||||||
|
%savedTerrNames = new ScriptObject();
|
||||||
|
for( %i = 0;; %i ++ )
|
||||||
|
{
|
||||||
|
%terrainObject = containerSearchNext();
|
||||||
|
if( !%terrainObject )
|
||||||
|
break;
|
||||||
|
|
||||||
|
%savedTerrNames.array[ %i ] = %terrainObject.terrainFile;
|
||||||
|
|
||||||
|
%terrainFilePath = makeRelativePath( filePath( %terrainObject.terrainFile ), getMainDotCsDir() );
|
||||||
|
%terrainFileName = fileName( %terrainObject.terrainFile );
|
||||||
|
|
||||||
|
// Workaround to have terrains created in an unsaved "New Level..." mission
|
||||||
|
// moved to the correct place.
|
||||||
|
|
||||||
|
if( EditorGui.saveAs && %terrainFilePath $= "tools/art/terrains" )
|
||||||
|
%terrainFilePath = "art/terrains";
|
||||||
|
|
||||||
|
// Try and follow the existing naming convention.
|
||||||
|
// If we can't, use systematic terrain file names.
|
||||||
|
if( strstr( %terrainFileName, %oldMissionName ) >= 0 )
|
||||||
|
%terrainFileName = strreplace( %terrainFileName, %oldMissionName, %newMissionName );
|
||||||
|
else
|
||||||
|
%terrainFileName = %newMissionName @ "_" @ %i @ ".ter";
|
||||||
|
|
||||||
|
%newTerrainFile = %terrainFilePath @ "/" @ %terrainFileName;
|
||||||
|
|
||||||
|
if (!isWriteableFileName(%newTerrainFile))
|
||||||
|
{
|
||||||
|
if (MessageBox("Error", "Terrain file \""@ %newTerrainFile @ "\" is read-only. Continue?", "Ok", "Stop") == $MROk)
|
||||||
|
continue;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
%copyTerrainsFailed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !%terrainObject.save( %newTerrainFile ) )
|
||||||
|
{
|
||||||
|
error( "Failed to save '" @ %newTerrainFile @ "'" );
|
||||||
|
%copyTerrainsFailed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
%terrainObject.terrainFile = %newTerrainFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
ETerrainEditor.isDirty = false;
|
||||||
|
|
||||||
|
// Save the mission.
|
||||||
|
if(%copyTerrainsFailed || !EditorSaveMission())
|
||||||
|
{
|
||||||
|
// It failed, so restore the mission and terrain filenames.
|
||||||
|
|
||||||
|
$Server::MissionFile = %saveMissionFile;
|
||||||
|
|
||||||
initContainerTypeSearch( $TypeMasks::TerrainObjectType );
|
initContainerTypeSearch( $TypeMasks::TerrainObjectType );
|
||||||
%savedTerrNames = new ScriptObject();
|
|
||||||
for( %i = 0;; %i ++ )
|
for( %i = 0;; %i ++ )
|
||||||
{
|
{
|
||||||
%terrainObject = containerSearchNext();
|
%terrainObject = containerSearchNext();
|
||||||
if( !%terrainObject )
|
if( !%terrainObject )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
%savedTerrNames.array[ %i ] = %terrainObject.terrainFile;
|
%terrainObject.terrainFile = %savedTerrNames.array[ %i ];
|
||||||
|
|
||||||
%terrainFilePath = makeRelativePath( filePath( %terrainObject.terrainFile ), getMainDotCsDir() );
|
|
||||||
%terrainFileName = fileName( %terrainObject.terrainFile );
|
|
||||||
|
|
||||||
// Workaround to have terrains created in an unsaved "New Level..." mission
|
|
||||||
// moved to the correct place.
|
|
||||||
|
|
||||||
if( EditorGui.saveAs && %terrainFilePath $= "tools/art/terrains" )
|
|
||||||
%terrainFilePath = "art/terrains";
|
|
||||||
|
|
||||||
// Try and follow the existing naming convention.
|
|
||||||
// If we can't, use systematic terrain file names.
|
|
||||||
if( strstr( %terrainFileName, %oldMissionName ) >= 0 )
|
|
||||||
%terrainFileName = strreplace( %terrainFileName, %oldMissionName, %newMissionName );
|
|
||||||
else
|
|
||||||
%terrainFileName = %newMissionName @ "_" @ %i @ ".ter";
|
|
||||||
|
|
||||||
%newTerrainFile = %terrainFilePath @ "/" @ %terrainFileName;
|
|
||||||
|
|
||||||
if (!isWriteableFileName(%newTerrainFile))
|
|
||||||
{
|
|
||||||
if (MessageBox("Error", "Terrain file \""@ %newTerrainFile @ "\" is read-only. Continue?", "Ok", "Stop") == $MROk)
|
|
||||||
continue;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
%copyTerrainsFailed = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !%terrainObject.save( %newTerrainFile ) )
|
|
||||||
{
|
|
||||||
error( "Failed to save '" @ %newTerrainFile @ "'" );
|
|
||||||
%copyTerrainsFailed = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
%terrainObject.terrainFile = %newTerrainFile;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ETerrainEditor.isDirty = false;
|
|
||||||
|
|
||||||
// Save the mission.
|
|
||||||
if(%copyTerrainsFailed || !EditorSaveMission())
|
|
||||||
{
|
|
||||||
// It failed, so restore the mission and terrain filenames.
|
|
||||||
|
|
||||||
$Server::MissionFile = %saveMissionFile;
|
|
||||||
|
|
||||||
initContainerTypeSearch( $TypeMasks::TerrainObjectType );
|
|
||||||
for( %i = 0;; %i ++ )
|
|
||||||
{
|
|
||||||
%terrainObject = containerSearchNext();
|
|
||||||
if( !%terrainObject )
|
|
||||||
break;
|
|
||||||
|
|
||||||
%terrainObject.terrainFile = %savedTerrNames.array[ %i ];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
%savedTerrNames.delete();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
EditorSaveMissionMenuDisableSave();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%savedTerrNames.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
function EditorOpenMission(%filename)
|
function EditorOpenMission(%filename)
|
||||||
{
|
{
|
||||||
if( EditorIsDirty() && !isWebDemo() )
|
if( EditorIsDirty())
|
||||||
{
|
{
|
||||||
// "EditorSaveBeforeLoad();", "getLoadFilename(\"*.mis\", \"EditorDoLoadMission\");"
|
// "EditorSaveBeforeLoad();", "getLoadFilename(\"*.mis\", \"EditorDoLoadMission\");"
|
||||||
if(MessageBox("Mission Modified", "Would you like to save changes to the current mission \"" @
|
if(MessageBox("Mission Modified", "Would you like to save changes to the current mission \"" @
|
||||||
|
|
@ -523,72 +485,67 @@ function EditorOpenMission(%filename)
|
||||||
|
|
||||||
function EditorExportToCollada()
|
function EditorExportToCollada()
|
||||||
{
|
{
|
||||||
if ( !$Pref::disableSaving && !isWebDemo() )
|
|
||||||
|
%dlg = new SaveFileDialog()
|
||||||
{
|
{
|
||||||
%dlg = new SaveFileDialog()
|
Filters = "COLLADA Files (*.dae)|*.dae|";
|
||||||
{
|
DefaultPath = $Pref::WorldEditor::LastPath;
|
||||||
Filters = "COLLADA Files (*.dae)|*.dae|";
|
DefaultFile = "";
|
||||||
DefaultPath = $Pref::WorldEditor::LastPath;
|
ChangePath = false;
|
||||||
DefaultFile = "";
|
OverwritePrompt = true;
|
||||||
ChangePath = false;
|
};
|
||||||
OverwritePrompt = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
%ret = %dlg.Execute();
|
%ret = %dlg.Execute();
|
||||||
if ( %ret )
|
if ( %ret )
|
||||||
{
|
{
|
||||||
$Pref::WorldEditor::LastPath = filePath( %dlg.FileName );
|
$Pref::WorldEditor::LastPath = filePath( %dlg.FileName );
|
||||||
%exportFile = %dlg.FileName;
|
%exportFile = %dlg.FileName;
|
||||||
}
|
|
||||||
|
|
||||||
if( fileExt( %exportFile ) !$= ".dae" )
|
|
||||||
%exportFile = %exportFile @ ".dae";
|
|
||||||
|
|
||||||
%dlg.delete();
|
|
||||||
|
|
||||||
if ( !%ret )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ( EditorGui.currentEditor.getId() == ShapeEditorPlugin.getId() )
|
|
||||||
ShapeEdShapeView.exportToCollada( %exportFile );
|
|
||||||
else
|
|
||||||
EWorldEditor.colladaExportSelection( %exportFile );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( fileExt( %exportFile ) !$= ".dae" )
|
||||||
|
%exportFile = %exportFile @ ".dae";
|
||||||
|
|
||||||
|
%dlg.delete();
|
||||||
|
|
||||||
|
if ( !%ret )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ( EditorGui.currentEditor.getId() == ShapeEditorPlugin.getId() )
|
||||||
|
ShapeEdShapeView.exportToCollada( %exportFile );
|
||||||
|
else
|
||||||
|
EWorldEditor.colladaExportSelection( %exportFile );
|
||||||
}
|
}
|
||||||
|
|
||||||
function EditorMakePrefab()
|
function EditorMakePrefab()
|
||||||
{
|
{
|
||||||
// Should this be protected or not?
|
|
||||||
if ( !$Pref::disableSaving && !isWebDemo() )
|
%dlg = new SaveFileDialog()
|
||||||
{
|
{
|
||||||
%dlg = new SaveFileDialog()
|
Filters = "Prefab Files (*.prefab)|*.prefab|";
|
||||||
{
|
DefaultPath = $Pref::WorldEditor::LastPath;
|
||||||
Filters = "Prefab Files (*.prefab)|*.prefab|";
|
DefaultFile = "";
|
||||||
DefaultPath = $Pref::WorldEditor::LastPath;
|
ChangePath = false;
|
||||||
DefaultFile = "";
|
OverwritePrompt = true;
|
||||||
ChangePath = false;
|
};
|
||||||
OverwritePrompt = true;
|
|
||||||
};
|
%ret = %dlg.Execute();
|
||||||
|
if ( %ret )
|
||||||
%ret = %dlg.Execute();
|
{
|
||||||
if ( %ret )
|
$Pref::WorldEditor::LastPath = filePath( %dlg.FileName );
|
||||||
{
|
%saveFile = %dlg.FileName;
|
||||||
$Pref::WorldEditor::LastPath = filePath( %dlg.FileName );
|
|
||||||
%saveFile = %dlg.FileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( fileExt( %saveFile ) !$= ".prefab" )
|
|
||||||
%saveFile = %saveFile @ ".prefab";
|
|
||||||
|
|
||||||
%dlg.delete();
|
|
||||||
|
|
||||||
if ( !%ret )
|
|
||||||
return;
|
|
||||||
|
|
||||||
EWorldEditor.makeSelectionPrefab( %saveFile );
|
|
||||||
|
|
||||||
EditorTree.buildVisibleTree( true );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( fileExt( %saveFile ) !$= ".prefab" )
|
||||||
|
%saveFile = %saveFile @ ".prefab";
|
||||||
|
|
||||||
|
%dlg.delete();
|
||||||
|
|
||||||
|
if ( !%ret )
|
||||||
|
return;
|
||||||
|
|
||||||
|
EWorldEditor.makeSelectionPrefab( %saveFile );
|
||||||
|
|
||||||
|
EditorTree.buildVisibleTree( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
function EditorExplodePrefab()
|
function EditorExplodePrefab()
|
||||||
|
|
|
||||||
|
|
@ -112,35 +112,30 @@ function EditorGui::buildMenus(%this)
|
||||||
barTitle = "File";
|
barTitle = "File";
|
||||||
};
|
};
|
||||||
|
|
||||||
if(!isWebDemo())
|
|
||||||
{
|
|
||||||
%fileMenu.appendItem("New Level" TAB "" TAB "schedule( 1, 0, \"EditorNewLevel\" );");
|
|
||||||
%fileMenu.appendItem("Open Level..." TAB %cmdCtrl SPC "O" TAB "schedule( 1, 0, \"EditorOpenMission\" );");
|
|
||||||
%fileMenu.appendItem("Save Level" TAB %cmdCtrl SPC "S" TAB "EditorSaveMissionMenu();");
|
|
||||||
%fileMenu.appendItem("Save Level As..." TAB "" TAB "EditorSaveMissionAs();");
|
|
||||||
%fileMenu.appendItem("-");
|
|
||||||
|
|
||||||
if( $platform $= "windows" )
|
%fileMenu.appendItem("New Level" TAB "" TAB "schedule( 1, 0, \"EditorNewLevel\" );");
|
||||||
{
|
%fileMenu.appendItem("Open Level..." TAB %cmdCtrl SPC "O" TAB "schedule( 1, 0, \"EditorOpenMission\" );");
|
||||||
%fileMenu.appendItem( "Open Project in Torsion" TAB "" TAB "EditorOpenTorsionProject();" );
|
%fileMenu.appendItem("Save Level" TAB %cmdCtrl SPC "S" TAB "EditorSaveMissionMenu();");
|
||||||
%fileMenu.appendItem( "Open Level File in Torsion" TAB "" TAB "EditorOpenFileInTorsion();" );
|
%fileMenu.appendItem("Save Level As..." TAB "" TAB "EditorSaveMissionAs();");
|
||||||
%fileMenu.appendItem( "-" );
|
%fileMenu.appendItem("-");
|
||||||
}
|
|
||||||
|
if( $platform $= "windows" )
|
||||||
|
{
|
||||||
|
%fileMenu.appendItem( "Open Project in Torsion" TAB "" TAB "EditorOpenTorsionProject();" );
|
||||||
|
%fileMenu.appendItem( "Open Level File in Torsion" TAB "" TAB "EditorOpenFileInTorsion();" );
|
||||||
|
%fileMenu.appendItem( "-" );
|
||||||
}
|
}
|
||||||
|
|
||||||
%fileMenu.appendItem("Create Blank Terrain" TAB "" TAB "Canvas.pushDialog( CreateNewTerrainGui );");
|
%fileMenu.appendItem("Create Blank Terrain" TAB "" TAB "Canvas.pushDialog( CreateNewTerrainGui );");
|
||||||
%fileMenu.appendItem("Import Terrain Heightmap" TAB "" TAB "Canvas.pushDialog( TerrainImportGui );");
|
%fileMenu.appendItem("Import Terrain Heightmap" TAB "" TAB "Canvas.pushDialog( TerrainImportGui );");
|
||||||
|
|
||||||
if(!isWebDemo())
|
%fileMenu.appendItem("Export Terrain Heightmap" TAB "" TAB "Canvas.pushDialog( TerrainExportGui );");
|
||||||
{
|
%fileMenu.appendItem("-");
|
||||||
%fileMenu.appendItem("Export Terrain Heightmap" TAB "" TAB "Canvas.pushDialog( TerrainExportGui );");
|
%fileMenu.appendItem("Export To COLLADA..." TAB "" TAB "EditorExportToCollada();");
|
||||||
%fileMenu.appendItem("-");
|
//item[5] = "Import Terraform Data..." TAB "" TAB "Heightfield::import();";
|
||||||
%fileMenu.appendItem("Export To COLLADA..." TAB "" TAB "EditorExportToCollada();");
|
//item[6] = "Import Texture Data..." TAB "" TAB "Texture::import();";
|
||||||
//item[5] = "Import Terraform Data..." TAB "" TAB "Heightfield::import();";
|
//item[7] = "-";
|
||||||
//item[6] = "Import Texture Data..." TAB "" TAB "Texture::import();";
|
//item[8] = "Export Terraform Data..." TAB "" TAB "Heightfield::saveBitmap(\"\");";
|
||||||
//item[7] = "-";
|
|
||||||
//item[8] = "Export Terraform Data..." TAB "" TAB "Heightfield::saveBitmap(\"\");";
|
|
||||||
}
|
|
||||||
|
|
||||||
%fileMenu.appendItem( "-" );
|
%fileMenu.appendItem( "-" );
|
||||||
%fileMenu.appendItem( "Add FMOD Designer Audio..." TAB "" TAB "AddFMODProjectDlg.show();" );
|
%fileMenu.appendItem( "Add FMOD Designer Audio..." TAB "" TAB "AddFMODProjectDlg.show();" );
|
||||||
|
|
@ -148,11 +143,9 @@ function EditorGui::buildMenus(%this)
|
||||||
%fileMenu.appendItem("-");
|
%fileMenu.appendItem("-");
|
||||||
%fileMenu.appendItem("Play Level" TAB "F11" TAB "Editor.close(\"PlayGui\");");
|
%fileMenu.appendItem("Play Level" TAB "F11" TAB "Editor.close(\"PlayGui\");");
|
||||||
|
|
||||||
if(!isWebDemo())
|
%fileMenu.appendItem("Exit Level" TAB "" TAB "EditorExitMission();");
|
||||||
{
|
%fileMenu.appendItem("Quit" TAB %quitShortcut TAB "EditorQuitGame();");
|
||||||
%fileMenu.appendItem("Exit Level" TAB "" TAB "EditorExitMission();");
|
|
||||||
%fileMenu.appendItem("Quit" TAB %quitShortcut TAB "EditorQuitGame();");
|
|
||||||
}
|
|
||||||
%this.menuBar.insert(%fileMenu, %this.menuBar.getCount());
|
%this.menuBar.insert(%fileMenu, %this.menuBar.getCount());
|
||||||
|
|
||||||
// Edit Menu
|
// Edit Menu
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue