Преглед на файлове

Pruning Attic, CIScripts, CLI folders

Josh Engebretson преди 9 години
родител
ревизия
3e50f3f1ea
променени са 100 файла, в които са добавени 0 реда и са изтрити 17012 реда
  1. 0 4
      Attic/AtomicEditorReference/AtomicEditorWindows.cmake
  2. 0 52
      Attic/AtomicEditorReference/CMakeLists.txt
  3. 0 244
      Attic/AtomicEditorReference/Source/AEApplication.cpp
  4. 0 36
      Attic/AtomicEditorReference/Source/AEApplication.h
  5. 0 345
      Attic/AtomicEditorReference/Source/AEEditor.cpp
  6. 0 97
      Attic/AtomicEditorReference/Source/AEEditor.h
  7. 0 215
      Attic/AtomicEditorReference/Source/AEEditorShortcuts.cpp
  8. 0 61
      Attic/AtomicEditorReference/Source/AEEditorShortcuts.h
  9. 0 81
      Attic/AtomicEditorReference/Source/AEEditorStrings.cpp
  10. 0 64
      Attic/AtomicEditorReference/Source/AEEditorStrings.h
  11. 0 5
      Attic/AtomicEditorReference/Source/AEEvents.cpp
  12. 0 146
      Attic/AtomicEditorReference/Source/AEEvents.h
  13. 0 326
      Attic/AtomicEditorReference/Source/AEJavascript.cpp
  14. 0 70
      Attic/AtomicEditorReference/Source/AEJavascript.h
  15. 0 287
      Attic/AtomicEditorReference/Source/AEPreferences.cpp
  16. 0 68
      Attic/AtomicEditorReference/Source/AEPreferences.h
  17. 0 28
      Attic/AtomicEditorReference/Source/AETypes.h
  18. 0 10
      Attic/AtomicEditorReference/Source/AEVersion.h
  19. 0 10
      Attic/AtomicEditorReference/Source/AtomicEditor.h
  20. 0 224
      Attic/AtomicEditorReference/Source/Build/AndroidProjectGenerator.cpp
  21. 0 47
      Attic/AtomicEditorReference/Source/Build/AndroidProjectGenerator.h
  22. 0 411
      Attic/AtomicEditorReference/Source/Build/BuildAndroid.cpp
  23. 0 58
      Attic/AtomicEditorReference/Source/Build/BuildAndroid.h
  24. 0 117
      Attic/AtomicEditorReference/Source/Build/BuildBase.cpp
  25. 0 63
      Attic/AtomicEditorReference/Source/Build/BuildBase.h
  26. 0 345
      Attic/AtomicEditorReference/Source/Build/BuildIOS.cpp
  27. 0 49
      Attic/AtomicEditorReference/Source/Build/BuildIOS.h
  28. 0 13
      Attic/AtomicEditorReference/Source/Build/BuildIOSUtils.h
  29. 0 76
      Attic/AtomicEditorReference/Source/Build/BuildIOSUtils.mm
  30. 0 113
      Attic/AtomicEditorReference/Source/Build/BuildMac.cpp
  31. 0 30
      Attic/AtomicEditorReference/Source/Build/BuildMac.h
  32. 0 202
      Attic/AtomicEditorReference/Source/Build/BuildSettings.cpp
  33. 0 105
      Attic/AtomicEditorReference/Source/Build/BuildSettings.h
  34. 0 189
      Attic/AtomicEditorReference/Source/Build/BuildSystem.cpp
  35. 0 54
      Attic/AtomicEditorReference/Source/Build/BuildSystem.h
  36. 0 40
      Attic/AtomicEditorReference/Source/Build/BuildTypes.h
  37. 0 97
      Attic/AtomicEditorReference/Source/Build/BuildWeb.cpp
  38. 0 30
      Attic/AtomicEditorReference/Source/Build/BuildWeb.h
  39. 0 97
      Attic/AtomicEditorReference/Source/Build/BuildWindows.cpp
  40. 0 30
      Attic/AtomicEditorReference/Source/Build/BuildWindows.h
  41. 0 219
      Attic/AtomicEditorReference/Source/Build/ResourcePackager.cpp
  42. 0 46
      Attic/AtomicEditorReference/Source/Build/ResourcePackager.h
  43. 0 553
      Attic/AtomicEditorReference/Source/Editors/JSResourceEditor.cpp
  44. 0 64
      Attic/AtomicEditorReference/Source/Editors/JSResourceEditor.h
  45. 0 64
      Attic/AtomicEditorReference/Source/Editors/ModelResourceEditor.cpp
  46. 0 57
      Attic/AtomicEditorReference/Source/Editors/ModelResourceEditor.h
  47. 0 121
      Attic/AtomicEditorReference/Source/Editors/ResourceEditor.cpp
  48. 0 60
      Attic/AtomicEditorReference/Source/Editors/ResourceEditor.h
  49. 0 437
      Attic/AtomicEditorReference/Source/Editors/SceneEditor3D/Gizmo3D.cpp
  50. 0 155
      Attic/AtomicEditorReference/Source/Editors/SceneEditor3D/Gizmo3D.h
  51. 0 183
      Attic/AtomicEditorReference/Source/Editors/SceneEditor3D/SceneEditor3D.cpp
  52. 0 70
      Attic/AtomicEditorReference/Source/Editors/SceneEditor3D/SceneEditor3D.h
  53. 0 344
      Attic/AtomicEditorReference/Source/Editors/SceneEditor3D/SceneView3D.cpp
  54. 0 79
      Attic/AtomicEditorReference/Source/Editors/SceneEditor3D/SceneView3D.h
  55. 0 305
      Attic/AtomicEditorReference/Source/Editors/TextResourceEditor.cpp
  56. 0 53
      Attic/AtomicEditorReference/Source/Editors/TextResourceEditor.h
  57. 0 997
      Attic/AtomicEditorReference/Source/Import/AEImportJSON.cpp
  58. 0 934
      Attic/AtomicEditorReference/Source/Import/AEImportJSON.h
  59. 0 994
      Attic/AtomicEditorReference/Source/Import/AEJSONSceneProcess.cpp
  60. 0 86
      Attic/AtomicEditorReference/Source/Import/AEJSONSceneProcess.h
  61. 0 961
      Attic/AtomicEditorReference/Source/Javascript/JSAST.cpp
  62. 0 967
      Attic/AtomicEditorReference/Source/Javascript/JSAST.h
  63. 0 7
      Attic/AtomicEditorReference/Source/Javascript/JSASTSyntaxColorVisitor.cpp
  64. 0 360
      Attic/AtomicEditorReference/Source/Javascript/JSASTSyntaxColorVisitor.h
  65. 0 7
      Attic/AtomicEditorReference/Source/Javascript/JSASTVisitor.cpp
  66. 0 382
      Attic/AtomicEditorReference/Source/Javascript/JSASTVisitor.h
  67. 0 190
      Attic/AtomicEditorReference/Source/Javascript/JSAutocomplete.cpp
  68. 0 56
      Attic/AtomicEditorReference/Source/Javascript/JSAutocomplete.h
  69. 0 26
      Attic/AtomicEditorReference/Source/Javascript/JSErrorChecker.cpp
  70. 0 33
      Attic/AtomicEditorReference/Source/Javascript/JSErrorChecker.h
  71. 0 303
      Attic/AtomicEditorReference/Source/Javascript/JSSpiderMonkeyVM.cpp
  72. 0 56
      Attic/AtomicEditorReference/Source/Javascript/JSSpiderMonkeyVM.h
  73. 0 5
      Attic/AtomicEditorReference/Source/Javascript/JSTheme.cpp
  74. 0 182
      Attic/AtomicEditorReference/Source/Javascript/JSTheme.h
  75. 0 541
      Attic/AtomicEditorReference/Source/License/AELicenseSystem.cpp
  76. 0 112
      Attic/AtomicEditorReference/Source/License/AELicenseSystem.h
  77. 0 145
      Attic/AtomicEditorReference/Source/License/AEVersionCheck.cpp
  78. 0 37
      Attic/AtomicEditorReference/Source/License/AEVersionCheck.h
  79. 0 180
      Attic/AtomicEditorReference/Source/License/UIActivation.cpp
  80. 0 47
      Attic/AtomicEditorReference/Source/License/UIActivation.h
  81. 0 82
      Attic/AtomicEditorReference/Source/License/UIActivationSuccess.cpp
  82. 0 34
      Attic/AtomicEditorReference/Source/License/UIActivationSuccess.h
  83. 0 121
      Attic/AtomicEditorReference/Source/License/UIEulaAgreement.cpp
  84. 0 34
      Attic/AtomicEditorReference/Source/License/UIEulaAgreement.h
  85. 0 111
      Attic/AtomicEditorReference/Source/License/UIManageLicense.cpp
  86. 0 40
      Attic/AtomicEditorReference/Source/License/UIManageLicense.h
  87. 0 122
      Attic/AtomicEditorReference/Source/Main.cpp
  88. 0 125
      Attic/AtomicEditorReference/Source/Net/CurlManager.cpp
  89. 0 73
      Attic/AtomicEditorReference/Source/Net/CurlManager.h
  90. 0 120
      Attic/AtomicEditorReference/Source/Player/AEPlayer.cpp
  91. 0 80
      Attic/AtomicEditorReference/Source/Player/AEPlayer.h
  92. 0 291
      Attic/AtomicEditorReference/Source/Player/AEPlayerApplication.cpp
  93. 0 66
      Attic/AtomicEditorReference/Source/Player/AEPlayerApplication.h
  94. 0 105
      Attic/AtomicEditorReference/Source/Player/UIPlayer.cpp
  95. 0 43
      Attic/AtomicEditorReference/Source/Player/UIPlayer.h
  96. 0 276
      Attic/AtomicEditorReference/Source/Project/AEProject.cpp
  97. 0 67
      Attic/AtomicEditorReference/Source/Project/AEProject.h
  98. 0 219
      Attic/AtomicEditorReference/Source/Project/ProjectUtils.cpp
  99. 0 41
      Attic/AtomicEditorReference/Source/Project/ProjectUtils.h
  100. 0 5
      Attic/AtomicEditorReference/Source/Resources/AEComponent.cpp

+ 0 - 4
Attic/AtomicEditorReference/AtomicEditorWindows.cmake

@@ -1,4 +0,0 @@
-
-
-
-

+ 0 - 52
Attic/AtomicEditorReference/CMakeLists.txt

@@ -1,52 +0,0 @@
-include_directories (${CMAKE_SOURCE_DIR}/Source/ThirdParty/rapidjson/include
-                     ${CMAKE_SOURCE_DIR}/Source/ThirdParty
-                     ${CMAKE_SOURCE_DIR}/Source/ThirdParty/nativefiledialog)
-
-
-file (GLOB_RECURSE SOURCE_FILES Source/*.cpp Source/*.h)
-
-if (APPLE)
-    set (EXE_TYPE MACOSX_BUNDLE)
-    set (SOURCE_FILES ${SOURCE_FILES} Source/Build/BuildIOSUtils.mm)
-
-    #ICNS
-    set(MACOSX_BUNDLE_ICON_FILE Atomic.icns)
-    set(ATOMIC_EDITOR_ICON ${CMAKE_SOURCE_DIR}/CMake/Modules/Atomic.icns)
-    set_source_files_properties(${ATOMIC_EDITOR_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
-elseif(LINUX)
-
-else()
-    include_directories (${CMAKE_SOURCE_DIR}/Source/ThirdParty/libcurl/include)
-    add_definitions(-DCURL_STATICLIB)
-    
-    # We want the console for now
-    #set (EXE_TYPE WIN32)
-    add_definitions(-DATOMIC_WIN32_CONSOLE)
-    
-    set (SOURCE_FILES ${SOURCE_FILES} ${CMAKE_SOURCE_DIR}/CMake/Modules/Atomic.rc)
-endif(APPLE)
-
-GroupSources("Source")
-
-add_executable(AtomicEditor ${EXE_TYPE} ${SOURCE_FILES} ${ATOMIC_EDITOR_ICON})
-
-target_link_libraries(AtomicEditor ToolCore AtomicJS Poco nativefiledialog ${ATOMIC_LINK_LIBRARIES})
-
-if (APPLE)
-    set (TARGET_PROPERTIES MACOSX_BUNDLE_INFO_PLIST MacOSXBundleInfo.plist.template)
-    target_link_libraries(AtomicEditor curl)
-elseif(LINUX)
-    target_link_libraries(AtomicEditor curl nativefiledialog ${GTK3_LIBRARIES})
-else()
-    target_link_libraries(AtomicEditor libcurl Iphlpapi Wldap32)
-    
-    # pre-Windows 8 can't count on D3DCompiler_47.dll being on system
-    add_custom_command (TARGET AtomicEditor POST_BUILD
-    COMMAND ${CMAKE_COMMAND}
-    ARGS -E copy_if_different \"${D3DCOMPILER_47_DLL}\" \"$<TARGET_FILE_DIR:AtomicEditor>/D3DCompiler_47.dll\")
-
-endif()
-
-if (TARGET_PROPERTIES)
-    set_target_properties (AtomicEditor PROPERTIES ${TARGET_PROPERTIES})
-endif ()

+ 0 - 244
Attic/AtomicEditorReference/Source/AEApplication.cpp

@@ -1,244 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-
-#include <Atomic/Engine/Engine.h>
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/IO/Log.h>
-#include <Atomic/Core/Main.h>
-#include <Atomic/Core/ProcessUtils.h>
-#include <Atomic/Graphics/Graphics.h>
-#include <Atomic/Resource/XMLFile.h>
-#include <Atomic/Resource/ResourceCache.h>
-#include <Atomic/Resource/ResourceEvents.h>
-#include <Atomic/DebugNew.h>
-
-#include <Atomic/Engine/Console.h>
-#include <Atomic/Engine/DebugHud.h>
-
-#include <Atomic/Input/Input.h>
-
-#include <Atomic/UI/UI.h>
-#include <Atomic/Environment/Environment.h>
-#include <Atomic/Graphics/Renderer.h>
-
-#include <Atomic/IPC/IPC.h>
-
-#include "AEEditorStrings.h"
-#include "AEEditorShortcuts.h"
-#include "Project/ProjectUtils.h"
-#include "Subprocess/AESubprocessSystem.h"
-#include "Build/BuildSystem.h"
-#include "License/AELicenseSystem.h"
-#include "License/AEVersionCheck.h"
-#include "Net/CurlManager.h"
-
-// just for testing, remove me
-#include "Import/AEImportJSON.h"
-#include "Import/AEJSONSceneProcess.h"
-
-#include "AEEditor.h"
-#include "AEPreferences.h"
-#include "AEApplication.h"
-
-#include "Tools/External/AEExternalTooling.h"
-
-#include <AtomicJS/Javascript/Javascript.h>
-
-#include <ToolCore/ToolSystem.h>
-#include <ToolCore/ToolEnvironment.h>
-
-using namespace ToolCore;
-
-namespace AtomicEditor
-{
-
-AEApplication::AEApplication(Context* context) :
-    Application(context)
-{
-
-}
-
-void AEApplication::Start()
-{
-    // refactor this
-    RegisterEnvironmentLibrary(context_);
-
-    ToolSystem* tsystem = new ToolSystem(context_);
-    context_->RegisterSubsystem(tsystem);
-
-    Engine* engine = GetSubsystem<Engine>();
-    engine->SetAutoExit(false);
-
-    // Register IPC system
-    context_->RegisterSubsystem(new IPC(context_));
-
-    // Get default style
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    cache->SetAutoReloadResources(true);
-
-#ifndef ATOMIC_DEV_BUILD
-
-    FileSystem* fileSystem = GetSubsystem<FileSystem>();
-
-#ifdef __APPLE__    
-    String editorResources = fileSystem->GetAppBundleResourceFolder() + "EditorData.pak";
-#else
-    String editorResources = fileSystem->GetProgramDir() + "EditorData.pak";
-#endif
-
-    assert(fileSystem->FileExists(editorResources));
-    cache->AddPackageFile(editorResources);
-
-#endif
-
-    // initialize after EditorResources set
-    UI* tbui = GetSubsystem<UI>();
-
-    tbui->Initialize("AtomicEditor/resources/language/lng_en.tb.txt");
-    tbui->LoadSkin("AtomicEditor/resources/default_skin/skin.tb.txt", "AtomicEditor/editor/skin/skin.tb.txt");
-    tbui->AddFont("AtomicEditor/resources/vera.ttf", "Vera");
-    tbui->AddFont("AtomicEditor/resources/MesloLGS-Regular.ttf", "Monaco");
-    tbui->SetDefaultFont("Vera", 12);
-
-    Input* input = GetSubsystem<Input>();
-    input->SetMouseVisible(true);
-
- #ifdef ATOMIC_PLATFORM_WINDOWS
-    // on windows maximize, otherwise window does funky thing with "restore down"
-    // todo: better way of handling this?  Windows 8 restore down goes below taskbar :(
-    Graphics* graphics = GetSubsystem<Graphics>();
-    IntVector2 resolution = graphics->GetDesktopResolution();
-    int height = graphics->GetHeight();
-    if ( Abs(height - resolution.y_) < 128)
-        GetSubsystem<Graphics>()->Maximize();
- #endif
-
-    context_->RegisterSubsystem(new EditorStrings(context_));
-    context_->RegisterSubsystem(new EditorShortcuts(context_));
-    context_->RegisterSubsystem(new ProjectUtils(context_));
-    context_->RegisterSubsystem(new Javascript(context_));
-    context_->RegisterSubsystem(new SubprocessSystem(context_));
-    context_->RegisterSubsystem(new ExternalTooling(context_));
-    context_->RegisterSubsystem(new BuildSystem(context_));
-    context_->RegisterSubsystem(new CurlManager(context_));
-
-// BEGIN LICENSE MANAGEMENT
-    context_->RegisterSubsystem(new LicenseSystem(context_));
-    context_->RegisterSubsystem(new VersionCheck(context_));
-// END LICENSE MANAGEMENT
-
-    Editor* editor = new Editor(context_);
-    context_->RegisterSubsystem(editor);
-
-#ifdef ATOMIC_PLATFORM_OSX
-    editor->RequestPlatformChange(AE_PLATFORM_MAC);
-#else
-    editor->RequestPlatformChange(AE_PLATFORM_WINDOWS);
-#endif
-
-    bool process = false;
-    if (process)
-    {
-        SharedPtr<JSONSceneImporter> jimporter;
-        jimporter = new JSONSceneImporter(context_);
-        jimporter->Import("/Users/josh/Desktop/Blah.js");
-
-        SharedPtr<JSONSceneProcess> sceneProcess;
-        sceneProcess = new JSONSceneProcess(context_, jimporter);
-        sceneProcess->Process();
-        sceneProcess->Write();
-    }
-
-    if (cmdLineProjectFile_.Length())
-    {
-        editor->LoadProject(cmdLineProjectFile_);
-    }
-}
-
-void AEApplication::Setup()
-{
-    FileSystem* filesystem = GetSubsystem<FileSystem>();
-
-    ToolEnvironment* env = new ToolEnvironment(context_);
-    context_->RegisterSubsystem(env);
-
-#ifdef ATOMIC_DEV_BUILD
-
-    if (!env->InitFromJSON())
-    {
-        ErrorExit(ToString("Unable to initialize tool environment from %s", env->GetDevConfigFilename().CString()));
-        return;
-    }
-
-#endif
-
-    const Vector<String>& arguments = GetArguments();
-
-    for (unsigned i = 0; i < arguments.Size(); ++i)
-    {
-        if (arguments[i].Length() > 1 && arguments[i][0] == '-')
-        {
-            String argument = arguments[i].Substring(1).ToLower();
-            String value = i + 1 < arguments.Size() ? arguments[i + 1] : String::EMPTY;
-
-            if (argument == "-project" && value.Length())
-            {
-                Vector<String> projectFiles;
-                filesystem->ScanDir(projectFiles, value, "*.atomic", SCAN_FILES, false);
-                if (!projectFiles.Size())
-                {
-                    ErrorExit(ToString("No .atomic project file in %s", value.CString()));
-                    return;
-                }
-                else if (projectFiles.Size() > 1)
-                {
-                    ErrorExit(ToString("Multiple .atomic project files found in %s", value.CString()));
-                    return;
-                }
-
-                cmdLineProjectFile_ = value + "/" + projectFiles[0];
-
-            }
-        }
-    }
-
-    engineParameters_["WindowTitle"] = "AtomicEditor";
-    engineParameters_["WindowResizable"] = true;
-    engineParameters_["FullScreen"] = false;
-
-    AEPreferences::StartupPreferences prefs;
-    if (AEPreferences::ReadStartupPrefs(context_, prefs))
-    {
-        engineParameters_["WindowWidth"] = prefs.windowWidth;
-        engineParameters_["WindowHeight"] = prefs.windowHeight;
-    }
-
-#ifdef ATOMIC_DEV_BUILD
-    engineParameters_["ResourcePrefixPath"] = "";
-    String resourcePaths = env->GetCoreDataDir() + ";" +  env->GetEditorDataDir();
-    engineParameters_["ResourcePaths"] = resourcePaths;
-#else
-
-#ifdef __APPLE__
-    engineParameters_["ResourcePrefixPath"] = "../Resources";
-#endif
-
-#endif // ATOMIC_DEV_BUILD
-
-#ifndef __APPLE__
-    engineParameters_["WindowIcon"] = "Images/AtomicLogo32.png";
-#endif
-
-    engineParameters_["LogName"] = filesystem->GetAppPreferencesDir("AtomicEditor", "Logs") + "AtomicEditor.log";
-
-}
-
-void AEApplication::Stop()
-{
-    context_->RemoveSubsystem<Editor>();
-}
-
-}

+ 0 - 36
Attic/AtomicEditorReference/Source/AEApplication.h

@@ -1,36 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <Atomic/Engine/Application.h>
-
-using namespace Atomic;
-
-namespace AtomicEditor
-{
-
-/// AtomicEditor application runs a script specified on the command line.
-class AEApplication : public Application
-{
-    OBJECT(AEApplication);
-
-public:
-    /// Construct.
-    AEApplication(Context* context);
-
-    /// Setup before engine initialization. Verify that a script file has been specified.
-    virtual void Setup();
-    /// Setup after engine initialization. Load the script and execute its start function.
-    virtual void Start();
-    /// Cleanup after the main loop. Run the script's stop function if it exists.
-    virtual void Stop();
-
-private:
-
-    String cmdLineProjectFile_;
-    
-};
-
-}

+ 0 - 345
Attic/AtomicEditorReference/Source/AEEditor.cpp

@@ -1,345 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-
-#include <Atomic/Engine/Engine.h>
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/Resource/ResourceCache.h>
-#include <Atomic/Input/Input.h>
-#include <Atomic/UI/UI.h>
-#include <Atomic/Core/CoreEvents.h>
-
-#include <AtomicJS/Javascript/Javascript.h>
-
-#include "AEEditor.h"
-
-#include "AEPreferences.h"
-#include "Project/AEProject.h"
-#include "AEJavascript.h"
-#include "AEEvents.h"
-#include "Player/AEPlayer.h"
-
-#ifdef USE_SPIDERMONKEY
-#include "Javascript/JSSpiderMonkeyVM.h"
-#endif
-
-#include "UI/UIMainFrame.h"
-#include "UI/UIProjectFrame.h"
-#include "UI/UIResourceFrame.h"
-#include "UI/Modal/UIMessageModal.h"
-
-#include "License/AELicenseSystem.h"
-
-#include "Resources/AEResourceOps.h"
-
-#include <TurboBadger/tb_message_window.h>
-#include <TurboBadger/animation/tb_animation.h>
-
-namespace AtomicEditor
-{
-
-Editor::Editor(Context* context) :
-    Object(context),
-    currentPlatform_(AE_PLATFORM_UNDEFINED),
-    requestExit_(false)
-
-{
-    RegisterEditorLibrary(context_);
-
-    aejavascript_ = new AEJavascript(context_);
-    aepreferences_ = new AEPreferences(context_);
-
-#ifdef USE_SPIDERMONKEY
-    spidermonkey_ = new JSSpiderMonkeyVM(context_);
-#endif
-
-    resourceCreator_ = new ResourceOps(context_);
-
-    // Create the Main Editor Frame
-    mainframe_ = new MainFrame(context_);
-
-    SubscribeToEvent(E_EXITREQUESTED, HANDLER(Editor, HandleExitRequested));
-
-    SubscribeToEvent(E_PLAYERERROR, HANDLER(Editor, HandlePlayerError));
-    SubscribeToEvent(E_POSTUPDATE, HANDLER(Editor, HandlePostUpdate));
-
-    // the player handling might move
-    SubscribeToEvent(E_EDITORPLAYREQUEST, HANDLER(Editor, HandlePlayRequest));
-    SubscribeToEvent(E_EDITORPLAYSTOP, HANDLER(Editor, HandlePlayStop));
-    SubscribeToEvent(E_EDITORPLAYSTARTED, HANDLER(Editor, HandlePlayStarted));
-    SubscribeToEvent(E_EDITORPLAYSTOPPED, HANDLER(Editor, HandlePlayStopped));    
-
-// BEGIN LICENSE MANAGEMENT
-    GetSubsystem<LicenseSystem>()->Initialize();
-// END LICENSE MANAGEMENT
-
-
-}
-
-Editor::~Editor()
-{
-
-}
-
-MainFrame* Editor::GetMainFrame()
-{
-    return mainframe_;
-}
-
-Project* Editor::GetProject()
-{
-    return project_;
-}
-
-AEPreferences* Editor::GetPreferences()
-{
-    return aepreferences_;
-}
-
-void Editor::EditResource(const String& fullpath)
-{
-    mainframe_->GetResourceFrame()->EditResource(fullpath);
-}
-
-void Editor::LoadProject(const String& fullpath)
-{
-    aepreferences_->RegisterRecentProject(fullpath);
-
-    String path = GetPath(fullpath);
-
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    cache->AddResourceDir(path, 0);
-
-    String resourcePath = path;
-    resourcePath += "Resources";
-    cache->AddResourceDir(resourcePath, 0);
-
-    project_ = new Project(context_);
-    project_->SetResourcePath(resourcePath);
-    project_->Load(fullpath);
-
-    mainframe_->ShowResourceFrame();
-    mainframe_->GetProjectFrame()->RefreshFolders();
-    mainframe_->UpdateJavascriptErrors();
-}
-
-void Editor::CloseProject()
-{
-    if (project_.Null())
-        return;
-
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    String projectPath = project_->GetProjectFilePath();
-    String resourcePath = project_->GetResourcePath();
-
-    mainframe_->GetProjectFrame()->Clear();
-    mainframe_->GetResourceFrame()->CloseAllResourceEditors();
-
-    project_ = 0;
-
-    cache->RemoveResourceDir(resourcePath);
-    cache->RemoveResourceDir(projectPath);
-    cache->ReleaseAllResources(true);
-
-    mainframe_->ShowWelcomeFrame();
-
-}
-
-void Editor::SaveProject()
-{
-    if (project_.Null())
-        return;
-
-    project_->Save(project_->GetProjectFilePath());
-
-}
-
-// Project Playing
-
-void Editor::HandlePlayStarted(StringHash eventType, VariantMap& eventData)
-{
-}
-
-void Editor::HandlePlayStop(StringHash eventType, VariantMap& eventData)
-{    
-    SendEvent(E_EDITORPLAYSTOPPED);
-
-    if (!player_)
-        return;
-
-    //UI* tbui = GetSubsystem<UI>();
-    //tbui->SetKeyboardDisabled(false);
-    if (player_->GetMode() != AE_PLAYERMODE_WIDGET)
-    {
-        //tbui->SetInputDisabled(false);
-    }
-
-    Input* input = GetSubsystem<Input>();
-    input->SetMouseVisible(true);
-
-    mainframe_->UpdateJavascriptErrors();
-
-    player_->Invalidate();
-    player_ = NULL;
-
-}
-
-void Editor::HandlePlayStopped(StringHash eventType, VariantMap& eventData)
-{
-
-}
-
-void Editor::HandlePlayerError(StringHash eventType, VariantMap& eventData)
-{    
-
-}
-
-void Editor::PostModalError(const String& title, const String& message)
-{
-    using namespace EditorModal;
-    VariantMap eventData;
-    eventData[P_TYPE] = EDITOR_MODALERROR;
-    eventData[P_TITLE] = title;
-    eventData[P_MESSAGE] = message;
-    SendEvent(E_EDITORMODAL, eventData);
-
-}
-
-void Editor::PostModalInfo(const String& title, const String& message)
-{
-    using namespace EditorModal;
-    VariantMap eventData;
-    eventData[P_TYPE] = EDITOR_MODALINFO;
-    eventData[P_TITLE] = title;
-    eventData[P_MESSAGE] = message;
-    SendEvent(E_EDITORMODAL, eventData);
-
-}
-
-void Editor::RequestPlatformChange(AEEditorPlatform platform)
-{
-// BEGIN LICENSE MANAGEMENT
-    LicenseSystem* licenseSystem = GetSubsystem<LicenseSystem>();
-
-    if (!licenseSystem->RequestPlatformChange(platform))
-    {
-        PostModalInfo("Platform License Required", "Platform License is required to switch to this deployment");
-        return;
-    }
-
-    if (currentPlatform_ == platform)
-        return;
-
-    // if we can switch platforms via some other event, may want to do this in a handler
-    currentPlatform_ = platform;
-
-    if (!project_.Null())
-        project_->Save(project_->GetProjectFilePath());
-
-    using namespace PlatformChange;
-    VariantMap eventData;
-    eventData[P_PLATFORM] = (unsigned) platform;
-    SendEvent(E_PLATFORMCHANGE, eventData);
-
-// END LICENSE MANAGEMENT
-
-}
-
-void Editor::HandlePlayRequest(StringHash eventType, VariantMap& eventData)
-{
-    if (player_ || project_.Null())
-        return;
-
-    ResourceFrame* resourceFrame = mainframe_->GetResourceFrame();
-
-    if (resourceFrame->HasUnsavedModifications())
-    {
-        PostModalError("Unsaved Modifications", "There are unsaved modications.\nPlease save before entering play mode");
-        return;
-
-    }
-    else if (mainframe_->UpdateJavascriptErrors())
-    {
-        return;
-    }
-
-    assert(!player_);
-
-    AEPlayerMode mode = (AEPlayerMode) eventData[EditorPlayStarted::P_MODE].GetUInt();
-
-    if (mode != AE_PLAYERMODE_WIDGET)
-    {
-        //tbui->SetInputDisabled(true);
-    }
-
-    player_ = new AEPlayer(context_);
-
-    TBWidgetDelegate* tb = mainframe_->GetResourceFrame()->GetWidgetDelegate();
-    TBRect rect = tb->GetRect();
-    tb->ConvertToRoot(rect.x, rect.y);
-
-    if (!player_->Play(mode, IntRect(rect.x, rect.y, rect.x + rect.w, rect.y + rect.h)))
-    {
-        player_->Invalidate();
-        player_ = 0;
-        return;
-    }
-
-    SendEvent(E_EDITORPLAYSTARTED, eventData);
-
-}
-
-void Editor::HandlePostUpdate(StringHash eventType, VariantMap& eventData)
-{
-    if (player_ && player_->HasErrors())
-    {
-        SendEvent(E_EDITORPLAYSTOP);
-    }
-
-    if (requestExit_)
-    {
-        requestExit_ = false;
-        SendEvent(E_EXITREQUESTED);
-    }
-
-}
-
-void Editor::HandleExitRequested(StringHash eventType, VariantMap& eventData)
-{
-    if (aepreferences_.NotNull())
-    {
-        aepreferences_->Write();
-    }
-
-    mainframe_ = 0;
-    player_ = 0;
-    project_ = 0;
-    javascript_ = 0;
-    aejavascript_ = 0;
-    aepreferences_ = 0;
-
-    TBAnimationManager::BeginBlockAnimations();
-
-    UI* tbui = GetSubsystem<UI>();
-    tbui->Shutdown();
-
-    context_->RemoveSubsystem(Javascript::GetBaseTypeStatic());
-
-    SendEvent(E_EDITORSHUTDOWN);
-
-    SharedPtr<Editor> keepAlive(this);
-    context_->RemoveSubsystem(GetType());
-
-    Engine* engine = GetSubsystem<Engine>();
-    engine->Exit();
-}
-
-
-void RegisterEditorLibrary(Context* context)
-{
-
-}
-
-}

+ 0 - 97
Attic/AtomicEditorReference/Source/AEEditor.h

@@ -1,97 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <Atomic/Core/Object.h>
-#include "AETypes.h"
-
-using namespace Atomic;
-
-namespace Atomic
-{
-class Javascript;
-}
-
-namespace AtomicEditor
-{
-
-class Project;
-class MainFrame;
-class AEJavascript;
-class AEPlayer;
-class AEPreferences;
-class ResourceOps;
-
-#ifdef USE_SPIDERMONKEY
-class JSSpiderMonkeyVM;
-#endif
-
-class Editor : public Object
-{
-    OBJECT(Editor);
-
-#ifdef USE_SPIDERMONKEY
-    SharedPtr<JSSpiderMonkeyVM> spidermonkey_;
-#endif
-
-public:
-    /// Construct.
-    Editor(Context* context);
-    /// Destruct.
-    ~Editor();
-
-    void LoadProject(const String& fullpath);
-    void SaveProject();
-    void CloseProject();
-    bool IsProjectLoaded() { return project_.NotNull(); }
-
-    void EditResource(const String& fullpath);
-
-    MainFrame* GetMainFrame();
-    Project* GetProject();
-    AEJavascript* GetAEJavascript();
-    AEPreferences* GetPreferences();
-
-    void PostModalError(const String& title, const String& message);
-    void PostModalInfo(const String& title, const String& message);
-
-    bool IsPlayingProject() { return !player_.Null(); }
-
-    void RequestPlatformChange(AEEditorPlatform platform);
-    AEEditorPlatform GetCurrentPlatform() { return currentPlatform_; }
-
-    /// Called from UI code such as MainFrame quit menu, caught in post update
-    void RequestExit() { requestExit_ = true; }
-
-private:
-
-    void HandlePostUpdate(StringHash eventType, VariantMap& eventData);
-    void HandlePlayerError(StringHash eventType, VariantMap& eventData);
-    void HandlePlayRequest(StringHash eventType, VariantMap& eventData);
-    void HandlePlayStarted(StringHash eventType, VariantMap& eventData);
-    void HandlePlayStop(StringHash eventType, VariantMap& eventData);
-    void HandlePlayStopped(StringHash eventType, VariantMap& eventData);
-    void HandleExitRequested(StringHash eventType, VariantMap& eventData);
-
-    SharedPtr<AEPlayer> player_;
-    SharedPtr<Project> project_;
-    SharedPtr<MainFrame> mainframe_;
-    SharedPtr<Javascript> javascript_;
-    SharedPtr<AEJavascript> aejavascript_;
-    SharedPtr<AEPreferences> aepreferences_;
-
-    WeakPtr<ResourceOps> resourceCreator_;
-
-    AEEditorPlatform currentPlatform_;
-
-    bool requestExit_;
-
-};
-
-/// Register Javascript library objects.
-void RegisterEditorLibrary(Context* context);
-
-
-}

+ 0 - 215
Attic/AtomicEditorReference/Source/AEEditorShortcuts.cpp

@@ -1,215 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-
-#include <rapidjson/document.h>
-#include "rapidjson/prettywriter.h"
-#include "rapidjson/filestream.h"
-
-#include <Atomic/Core/Context.h>
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/IO/Log.h>
-#include <Atomic/IO/File.h>
-#include <Atomic/Input/Input.h>
-#include <Atomic/Input/InputEvents.h>
-
-#include "UI/UIMainFrame.h"
-#include "UI/UIResourceFrame.h"
-#include "UI/Modal/UIModalOps.h"
-
-#include "AEEditor.h"
-#include "AEEvents.h"
-#include "AEEditorShortcuts.h"
-
-using namespace rapidjson;
-
-namespace AtomicEditor
-{
-
-EditorShortcuts::EditorShortcuts(Context* context) :
-    Object(context)
-{
-    SubscribeToEvent(E_KEYDOWN, HANDLER(EditorShortcuts, HandleKeyDown));
-    SubscribeToEvent(E_KEYUP, HANDLER(EditorShortcuts, HandleKeyUp));
-    SubscribeToEvent(E_EDITORSHUTDOWN, HANDLER(EditorShortcuts, HandleEditorShutdown));
-}
-
-EditorShortcuts::~EditorShortcuts()
-{
-
-}
-
-void EditorShortcuts::HandleEditorShutdown(StringHash eventType, VariantMap& eventData)
-{
-    context_->RemoveSubsystem(GetType());
-}
-
-bool EditorShortcuts::IsProjectLoaded()
-{
-    Editor* editor = context_->GetSubsystem<Editor>();
-    return editor->GetProject() != NULL;
-}
-
-void EditorShortcuts::InvokePlayStop()
-{
-    if (!IsProjectLoaded())
-        return;
-
-    Editor* editor = context_->GetSubsystem<Editor>();
-
-    if (!editor->IsPlayingProject())
-    {
-        UIModalOps* ops = GetSubsystem<UIModalOps>();
-        if (ops->ModalActive())
-            return;
-
-        VariantMap eventData;
-        eventData[EditorPlayRequest::P_MODE] = (unsigned) AE_PLAYERMODE_WIDGET;
-        SendEvent(E_EDITORPLAYREQUEST, eventData);
-    }
-    else
-    {
-        SendEvent(E_EDITORPLAYSTOP);
-    }
-}
-
-void EditorShortcuts::InvokeResourceFrameShortcut(const String& id)
-{
-    if (!IsProjectLoaded())
-        return;
-
-    MainFrame* frame = GetSubsystem<MainFrame>();
-    ResourceFrame* resourceFrame = frame->GetResourceFrame();
-    TBWidgetEvent ev(EVENT_TYPE_SHORTCUT);
-    ev.ref_id = TBIDC(id.CString());
-    resourceFrame->OnEvent(ev);
-
-}
-
-void EditorShortcuts::InvokeFileSave()
-{
-    InvokeResourceFrameShortcut("save");
-}
-
-void EditorShortcuts::InvokeFileClose()
-{
-    InvokeResourceFrameShortcut("close");
-}
-
-void EditorShortcuts::InvokeEditCut()
-{
-    InvokeResourceFrameShortcut("cut");
-}
-
-void EditorShortcuts::InvokeEditCopy()
-{
-    InvokeResourceFrameShortcut("copy");
-}
-
-void EditorShortcuts::InvokeEditPaste()
-{
-    InvokeResourceFrameShortcut("paste");
-}
-
-void EditorShortcuts::InvokeEditSelectAll()
-{
-    InvokeResourceFrameShortcut("selectall");
-}
-
-void EditorShortcuts::InvokeEditUndo()
-{
-    InvokeResourceFrameShortcut("undo");
-}
-
-void EditorShortcuts::InvokeEditRedo()
-{
-    InvokeResourceFrameShortcut("redo");
-}
-
-void EditorShortcuts::InvokeEditFind()
-{
-    InvokeResourceFrameShortcut("find");
-}
-
-void EditorShortcuts::InvokeEditFindNext()
-{
-    InvokeResourceFrameShortcut("findnext");
-}
-
-void EditorShortcuts::InvokeEditFindPrev()
-{
-    InvokeResourceFrameShortcut("findprev");
-}
-
-void EditorShortcuts::InvokeEditFormatCode()
-{
-    InvokeResourceFrameShortcut("beautify");
-}
-
-void EditorShortcuts::InvokeBuild()
-{
-    if (!IsProjectLoaded())
-        return;
-
-    UIModalOps* ops = GetSubsystem<UIModalOps>();
-
-    if (!ops->ModalActive())
-        ops->ShowBuild();
-
-}
-
-void EditorShortcuts::InvokeBuildSettings()
-{
-    if (!IsProjectLoaded())
-        return;
-
-    UIModalOps* ops = GetSubsystem<UIModalOps>();
-
-    if (!ops->ModalActive())
-        ops->ShowBuildSettings();
-
-}
-
-void EditorShortcuts::HandleKeyDown(StringHash eventType, VariantMap& eventData)
-{
-    using namespace KeyDown;
-
-    Input* input = context_->GetSubsystem<Input>();
-
-#ifdef ATOMIC_PLATFORM_WINDOWS
-    bool cmdKey = (input->GetKeyDown(KEY_LCTRL) || input->GetKeyDown(KEY_RCTRL));
-#else
-    bool cmdKey = (input->GetKeyDown(KEY_LGUI) || input->GetKeyDown(KEY_RGUI));
-#endif
-
-    int keycode = eventData[P_KEY].GetInt();
-    int qualifiers = eventData[P_QUALIFIERS].GetInt();
-
-
-    if (cmdKey && keycode == KEY_P)
-    {
-        InvokePlayStop();
-    }
-    else if (cmdKey && (qualifiers & QUAL_SHIFT) && keycode == KEY_B)
-    {
-        InvokeBuildSettings();
-    }
-    else if (cmdKey && keycode == KEY_B)
-    {
-        InvokeBuild();
-    }
-
-
-}
-
-void EditorShortcuts::HandleKeyUp(StringHash eventType, VariantMap& eventData)
-{
-    using namespace KeyUp;
-
-
-}
-
-
-}

+ 0 - 61
Attic/AtomicEditorReference/Source/AEEditorShortcuts.h

@@ -1,61 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <Atomic/Core/Object.h>
-#include <Atomic/IO/FileSystem.h>
-
-using namespace Atomic;
-
-namespace AtomicEditor
-{
-
-class EditorShortcuts : public Object
-{
-
-    OBJECT(EditorShortcuts);
-
-public:
-
-    /// Construct.
-    EditorShortcuts(Context* context);
-    /// Destruct.
-    ~EditorShortcuts();
-
-    void InvokeFileClose();
-    void InvokeFileSave();
-
-    void InvokeEditCut();
-    void InvokeEditCopy();
-    void InvokeEditPaste();
-    void InvokeEditSelectAll();
-
-    void InvokeEditUndo();
-    void InvokeEditRedo();
-
-    void InvokeEditFind();
-    void InvokeEditFindNext();
-    void InvokeEditFindPrev();
-
-    void InvokeEditFormatCode();
-
-    void InvokeBuild();
-    void InvokeBuildSettings();
-
-    void InvokePlayStop();
-
-private:
-
-    bool IsProjectLoaded();
-
-    void InvokeResourceFrameShortcut(const String& id);
-
-    void HandleKeyDown(StringHash eventType, VariantMap& eventData);
-    void HandleKeyUp(StringHash eventType, VariantMap& eventData);
-    void HandleEditorShutdown(StringHash eventType, VariantMap& eventData);
-};
-
-
-}

+ 0 - 81
Attic/AtomicEditorReference/Source/AEEditorStrings.cpp

@@ -1,81 +0,0 @@
-
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-
-#include <Atomic/Core/Context.h>
-
-#include "AEEvents.h"
-#include "AEEditorStrings.h"
-
-namespace AtomicEditor
-{
-
-EditorStrings::EditorStrings(Context* context) :
-    Object(context)
-{
-    InitializeStrings();
-    SubscribeToEvent(E_EDITORSHUTDOWN, HANDLER(EditorStrings, HandleEditorShutdown));
-}
-
-EditorStrings::~EditorStrings()
-{
-
-}
-
-const String& EditorStrings::Str(EditorString estring)
-{
-    if (stringLookup_.Contains(estring))
-        return stringLookup_[estring];
-    return String::EMPTY;
-}
-
-void EditorStrings::InitializeStrings()
-{
-
-    stringLookup_[RevealInFinder] = "Reveal in Finder";
-
-#ifdef ATOMIC_PLATFORM_WINDOWS
-    String shortcutKey = "Ctrl-";
-    stringLookup_[ShortcutRedo] ="Ctrl-Y";
-    stringLookup_[ShortcutFindNext] = "F3";
-    stringLookup_[ShortcutFindPrev] = "Shift-F3";
-    stringLookup_[ShortcutBuildSettings] = "Ctrl-Shift-B";
-#else
-    String shortcutKey = "⌘";
-    stringLookup_[ShortcutRedo] ="⇧⌘Z";
-    stringLookup_[ShortcutFindNext] = "⌘G";
-    stringLookup_[ShortcutFindPrev] = "⇧⌘G";
-    stringLookup_[ShortcutBuildSettings] = "⇧⌘B";
-
-#endif
-    // Shortcuts
-    stringLookup_[ShortcutUndo] = shortcutKey + "Z";
-
-    stringLookup_[ShortcutCut] = shortcutKey + "X";
-    stringLookup_[ShortcutCopy] = shortcutKey + "C";
-    stringLookup_[ShortcutPaste] = shortcutKey + "V";
-    stringLookup_[ShortcutSelectAll] = shortcutKey + "A";
-    stringLookup_[ShortcutFind] = shortcutKey + "F";
-
-    stringLookup_[ShortcutBeautify] = shortcutKey + "I";
-
-    stringLookup_[ShortcutSaveFile] = shortcutKey + "S";
-    stringLookup_[ShortcutCloseFile] = shortcutKey + "W";
-
-    stringLookup_[ShortcutPlay] = shortcutKey + "P";
-
-    stringLookup_[ShortcutBuild] = shortcutKey +"B";
-
-
-
-}
-
-void EditorStrings::HandleEditorShutdown(StringHash eventType, VariantMap& eventData)
-{
-    context_->RemoveSubsystem(GetType());
-}
-
-}

+ 0 - 64
Attic/AtomicEditorReference/Source/AEEditorStrings.h

@@ -1,64 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <Atomic/Core/Object.h>
-#include <Atomic/IO/FileSystem.h>
-
-using namespace Atomic;
-
-#define EDITOR_STRING(x) (GetSubsystem<EditorStrings>()->Str(EditorStrings::x))
-
-namespace AtomicEditor
-{
-
-class EditorStrings : public Object
-{
-
-    OBJECT(EditorStrings);
-
-public:
-
-    enum EditorString
-    {
-        RevealInFinder,
-        ShortcutUndo,
-        ShortcutRedo,
-        ShortcutCut,
-        ShortcutCopy,
-        ShortcutPaste,
-        ShortcutSelectAll,
-        ShortcutFind,
-        ShortcutFindNext,
-        ShortcutFindPrev,
-        ShortcutBeautify,
-        ShortcutCloseFile,
-        ShortcutSaveFile,
-        ShortcutPlay,
-        ShortcutBuild,
-        ShortcutBuildSettings,
-    };
-
-
-    /// Construct.
-    EditorStrings(Context* context);
-    /// Destruct.
-    ~EditorStrings();
-
-    const String& Str(EditorString estring);
-
-private:
-
-    void InitializeStrings();
-
-    void HandleEditorShutdown(StringHash eventType, VariantMap& eventData);
-
-    HashMap<unsigned, String> stringLookup_;
-
-
-};
-
-
-}

+ 0 - 5
Attic/AtomicEditorReference/Source/AEEvents.cpp

@@ -1,5 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"

+ 0 - 146
Attic/AtomicEditorReference/Source/AEEvents.h

@@ -1,146 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <Atomic/Core/Object.h>
-
-using namespace Atomic;
-
-namespace AtomicEditor
-{
-
-static const unsigned FINDTEXT_FLAG_NONE = 0x0;
-static const unsigned FINDTEXT_FLAG_CASESENSITIVE = 0x1;
-static const unsigned FINDTEXT_FLAG_WHOLEWORD = 0x2;
-static const unsigned FINDTEXT_FLAG_WRAP = 0x4;
-static const unsigned FINDTEXT_FLAG_NEXT = 0x8;
-static const unsigned FINDTEXT_FLAG_PREV = 0x10;
-
-EVENT(E_FINDTEXT, FindText)
-{
-    PARAM(P_FLAGS, Flags);    // int
-    PARAM(P_TEXT, Text);      // string
-}
-
-EVENT(E_FINDTEXTCLOSE, FindTextClose)
-{
-
-}
-
-EVENT(E_FINDTEXTOPEN, FindTextOpen)
-{
-
-}
-
-EVENT(E_JAVASCRIPTSAVED, JavascriptSaved)
-{
-
-}
-
-// editor play request
-EVENT(E_EDITORPLAYREQUEST, EditorPlayRequest)
-{
-    PARAM(P_MODE, Mode);    // uint (AEPlayerMode)
-
-}
-
-// stop play mode
-EVENT(E_EDITORPLAYSTOP, EditorPlayStop)
-{
-
-}
-
-// stop play mode
-EVENT(E_EDITORRESOURCEEDITORCHANGED, EditorResourceEditorChanged)
-{
-    PARAM(P_RESOURCEEDITOR, ResourceEditor); // ResourceEditor*
-}
-
-
-// emitted once play has started
-EVENT(E_EDITORPLAYSTARTED, EditorPlayStarted)
-{
-    PARAM(P_MODE, Mode);    // uint (AEPlayerMode)
-}
-
-// emitted once play has stopped
-EVENT(E_EDITORPLAYSTOPPED, EditorPlayStopped)
-{
-
-}
-
-EVENT(E_EDITORBUILD, EditorBuild)
-{
-    PARAM(P_PLATFORM, Platform);      // string
-    PARAM(P_BUILDPATH, BuildPath);    // string
-}
-
-
-// TODO: consolidate all errors to use this message
-
-static const unsigned EDITOR_MODALERROR = 0x1;
-static const unsigned EDITOR_MODALINFO = 0x2;
-
-
-EVENT(E_EDITORMODAL, EditorModal)
-{
-    PARAM(P_TYPE, Type);      // uint (EDITOR_ERROR_MODAL, etc)
-    PARAM(P_TITLE, Title);      // for modal errors, title text
-    PARAM(P_MESSAGE, Message);    // for modal errors, error text
-}
-
-EVENT(E_EDITORACTIVESCENECHANGE, EditorActiveSceneChange)
-{
-    PARAM(P_SCENE, Scene);      // Scene*
-}
-
-EVENT(E_EDITORACTIVENODECHANGE, EditorActiveNodeChange)
-{
-    PARAM(P_NODE, Node);      // Node*
-}
-
-
-EVENT(E_PLAYERERROR, PlayerError)
-{
-    PARAM(P_TEXT, Text);      // string
-}
-
-EVENT(E_CONSOLEMESSAGE, ConsoleMessage)
-{
-    PARAM(P_TEXT, Text);      // string
-}
-
-EVENT(E_CONSOLEERRORMESSAGE, ConsoleErrorMessage)
-{
-    PARAM(P_TEXT, Text);      // string
-}
-
-EVENT(E_PLATFORMCHANGE, PlatformChange)
-{
-    PARAM(P_PLATFORM, Platform);      // uint (AEEditorPlatform)
-}
-
-EVENT(E_SUBPROCESSOUTPUT, SubprocessOutput)
-{
-    PARAM(P_TEXT, Text);      // string
-}
-
-EVENT(E_SUBPROCESSCOMPLETE, SubprocessComplete)
-{
-    PARAM(P_PROCESSKEY, ProcessKey); // unsigned
-    PARAM(P_RETCODE, RetCode);      // int (return code of process)
-}
-
-EVENT(E_CURLCOMPLETE, CurlComplete)
-{
-    PARAM(P_CURLREQUEST, Request);      // CurlRequest*
-}
-
-EVENT(E_EDITORSHUTDOWN, EditorShutdown)
-{
-
-}
-
-}

+ 0 - 326
Attic/AtomicEditorReference/Source/AEJavascript.cpp

@@ -1,326 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-
-#include <Duktape/duktape.h>
-
-#include <Atomic/IO/Log.h>
-#include <Atomic/Core/Context.h>
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/Resource/ResourceEvents.h>
-#include <Atomic/Resource/ResourceCache.h>
-
-#include "AEEditor.h"
-#include "AEEvents.h"
-#include "Project/AEProject.h"
-
-#include "AEJavascript.h"
-#include "Javascript/JSErrorChecker.h"
-
-namespace AtomicEditor
-{
-
-WeakPtr<AEJavascript> AEJavascript::instance_;
-
-AEJavascript::AEJavascript(Context* context) :
-    Object(context)
-{
-    context->RegisterSubsystem(this);
-    instance_ = this;
-    ctx_ = duk_create_heap_default();
-
-    duk_get_global_string(ctx_, "Duktape");
-    duk_push_c_function(ctx_, js_module_search, 1);
-    duk_put_prop_string(ctx_, -2, "modSearch");
-    duk_push_c_function(ctx_, js_read_source, 1);
-    duk_put_prop_string(ctx_, -2, "readSource");
-    duk_pop(ctx_);
-
-    errorChecker_ = new JSErrorChecker(context, ctx_);
-
-    SubscribeToEvent(E_FILECHANGED, HANDLER(AEJavascript, HandleFileChanged));
-    SubscribeToEvent(E_EDITORSHUTDOWN, HANDLER(AEJavascript, HandleEditorShutdown));
-
-    ExecuteFile("AtomicEditor/javascript/AtomicEditor.js");
-}
-
-AEJavascript::~AEJavascript()
-{
-    duk_destroy_heap(ctx_);
-    instance_ = NULL;
-}
-
-bool AEJavascript::ExecuteFile(const String& path)
-{
-
-    SharedPtr<File> file (GetSubsystem<ResourceCache>()->GetFile(path));
-
-    if (file.Null())
-        return false;
-
-    String source;
-
-    file->ReadText(source);
-
-    duk_push_string(ctx_, file->GetFullPath().CString());
-    if (duk_eval_raw(ctx_, source.CString(), 0,
-                     DUK_COMPILE_EVAL | DUK_COMPILE_SAFE | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN) != 0)
-    {
-        if (duk_is_object(ctx_, -1))
-        {
-            LOGERRORF("Error: %s\n", duk_safe_to_string(ctx_, -1));
-        }
-
-        assert(0);
-
-        duk_pop(ctx_);
-        return false;
-    }
-
-    duk_pop(ctx_);
-
-    return true;
-
-}
-
-void AEJavascript::HandleFileChanged(StringHash eventType, VariantMap& eventData)
-{
-
-    Editor* editor = GetSubsystem<Editor>();
-    Project* project = editor->GetProject();
-
-    if (!project)
-        return;
-
-    using namespace FileChanged;
-    const String& fileName = eventData[P_FILENAME].GetString();
-    //const String& resourceName = eventData[P_RESOURCENAME].GetString();
-
-    if (GetExtension(fileName) != ".js")
-        return;
-
-    if (modifiedJS_.Contains(fileName))
-        return;
-
-    String componentsPath = AddTrailingSlash(project->GetComponentsPath());
-    String scriptsPath = AddTrailingSlash(project->GetScriptsPath());
-    String modulesPath = AddTrailingSlash(project->GetModulesPath());
-
-    if (fileName.StartsWith(componentsPath) || fileName.StartsWith(scriptsPath) || fileName.StartsWith(modulesPath))
-    {
-        modifiedJS_.Push(fileName);
-    }
-
-}
-
-bool AEJavascript::CheckJSErrors(bool fullCheck)
-{
-    errors_.Clear();
-
-    Editor* editor = GetSubsystem<Editor>();
-    Project* project = editor->GetProject();
-
-    FileSystem* fileSystem = GetSubsystem<FileSystem>();
-    if (!project)
-    {
-        modifiedJS_.Clear();
-        return true;
-    }
-
-    Vector<String>& filesToCheck = modifiedJS_;
-
-    Vector<String> allFiles;
-
-    if (fullCheck)
-    {
-        filesToCheck = allFiles;
-
-        String componentsPath = AddTrailingSlash(project->GetComponentsPath());
-        String scriptsPath = AddTrailingSlash(project->GetScriptsPath());
-        String modulesPath = AddTrailingSlash(project->GetModulesPath());
-
-        Vector<String> files;
-        fileSystem->ScanDir(files, componentsPath, "*.js", SCAN_FILES, true );
-        for (unsigned i = 0; i < files.Size(); i++)
-            allFiles.Push(componentsPath + files[i]);
-
-        fileSystem->ScanDir(files, scriptsPath, "*.js", SCAN_FILES, true );
-        for (unsigned i = 0; i < files.Size(); i++)
-            allFiles.Push(scriptsPath + files[i]);
-
-        fileSystem->ScanDir(files, modulesPath, "*.js", SCAN_FILES, true );
-        for (unsigned i = 0; i < files.Size(); i++)
-            allFiles.Push(modulesPath + files[i]);
-
-    }
-
-    bool ok = true;
-
-    for (unsigned j = 0; j < filesToCheck.Size(); j++)
-    {
-        String source;
-        String fullpath = filesToCheck[j];
-        ReadZeroTerminatedSourceFile(fullpath, source);
-
-        duk_get_global_string(ctx_, "__atomic_parse_error_check");
-        duk_push_string(ctx_, source.CString());
-
-        if (duk_pcall(ctx_, 1))
-        {
-            printf("Error: %s\n", duk_safe_to_string(ctx_, -1));
-        }
-        else
-        {
-            if (duk_is_boolean(ctx_, -1))
-            {
-                // error
-                if (duk_to_boolean(ctx_, -1))
-                    ok = false;
-            }
-            else if (duk_is_object(ctx_, -1))
-            {
-                ok = false;
-                JSError error;
-
-                error.fullpath = fullpath;
-
-                duk_get_prop_string(ctx_, -1, "message");
-                error.message = duk_to_string(ctx_, -1);
-                duk_pop(ctx_);
-
-                duk_get_prop_string(ctx_, -1, "loc");
-                duk_get_prop_string(ctx_, -1, "line");
-                error.line = duk_to_number(ctx_, -1);
-                duk_get_prop_string(ctx_, -2, "column");
-                error.column = duk_to_number(ctx_, -1);
-                duk_get_prop_string(ctx_, -4, "raisedAt");
-                error.tokenPos = duk_to_number(ctx_, -1);
-
-                duk_pop_3(ctx_);
-
-                errors_.Push(error);
-            }
-            else
-            {
-                // what to do?
-            }
-
-        }
-
-        // ignore result
-        duk_pop(ctx_);
-
-    }
-
-    modifiedJS_.Clear();
-
-
-    return !ok;
-
-}
-
-bool AEJavascript::ParseJavascriptToJSON(const char* source, String& json, bool loose)
-{
-    json.Clear();
-
-    // forcing loose to false, as issues with MSVC release - 3/3/2015 First Early Access Release
-    loose = false;
-
-    duk_get_global_string(ctx_, loose ? "__atomic_parse_to_json_loose" : "__atomic_parse_to_json");
-    duk_push_string(ctx_, source);
-    bool ok = true;
-
-    if (duk_pcall(ctx_, 1))
-    {
-        ok = false;
-        printf("Error: %s\n", duk_safe_to_string(ctx_, -1));
-    }
-    else
-    {
-        json = duk_to_string(ctx_, -1);
-    }
-
-    // ignore result
-    duk_pop(ctx_);
-
-    return ok;
-
-}
-
-bool AEJavascript::BeautifyJavascript(const char* source, String& output)
-{
-    output.Clear();
-
-    duk_get_global_string(ctx_, "__atomic_js_beautify");
-    duk_push_string(ctx_, source);
-    bool ok = true;
-
-    if (duk_pcall(ctx_, 1))
-    {
-        ok = false;
-        printf("Error: %s\n", duk_safe_to_string(ctx_, -1));
-    }
-    else
-    {
-        output = duk_to_string(ctx_, -1);
-    }
-
-    // ignore result
-    duk_pop(ctx_);
-
-    return ok;
-
-}
-
-bool AEJavascript::ReadZeroTerminatedSourceFile(const String& path, String& source)
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-
-    SharedPtr<File> file = cache->GetFile(path);
-
-    if (file.Null() || !file->IsOpen())
-        return false;
-
-    file->ReadText(source);
-
-    return true;
-
-}
-
-int AEJavascript::js_read_source(duk_context* ctx)
-{
-    String path = duk_to_string(ctx, 0);
-
-    String source;
-
-    instance_->ReadZeroTerminatedSourceFile(path, source);
-
-    duk_push_string(ctx, source.CString());
-
-    return 1;
-
-}
-
-int AEJavascript::js_module_search(duk_context* ctx)
-{
-    String path = duk_to_string(ctx, 0);
-
-    path = "AtomicEditor/javascript/modules/" + path + ".js";
-
-    String source;
-
-    instance_->ReadZeroTerminatedSourceFile(path, source);
-
-    duk_push_string(ctx, source.CString());
-
-    return 1;
-}
-
-void AEJavascript::HandleEditorShutdown(StringHash eventType, VariantMap& eventData)
-{
-    context_->RemoveSubsystem(GetType());
-}
-
-}

+ 0 - 70
Attic/AtomicEditorReference/Source/AEJavascript.h

@@ -1,70 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <Atomic/Core/Object.h>
-
-#include <Duktape/duktape.h>
-
-using namespace Atomic;
-
-namespace AtomicEditor
-{
-
-class JSErrorChecker;
-
-struct JSError
-{
-    String fullpath;
-    String message;
-    int line;
-    int column;
-    int tokenPos;
-};
-
-// This is the Javascript subsystem for the editor
-// the embedded player uses a separate VM
-class AEJavascript : public Object
-{
-    OBJECT(AEJavascript);
-
-public:
-    /// Construct.
-    AEJavascript(Context* context);
-    /// Destruct.
-    ~AEJavascript();
-
-    bool ExecuteFile(const String& path);
-
-    bool ParseJavascriptToJSON(const char* source, String& json, bool loose = true);
-    bool BeautifyJavascript(const char* source, String& output);
-
-    bool CheckJSErrors(bool fullCheck = false);
-    const Vector<JSError>& GetJSErrors() { return errors_; }
-
-private:
-
-    bool ReadZeroTerminatedSourceFile(const String& path, String& source);
-    void HandleFileChanged(StringHash eventType, VariantMap& eventData);
-    void HandleEditorShutdown(StringHash eventType, VariantMap& eventData);
-
-    static int js_module_search(duk_context* ctx);
-    static int js_read_source(duk_context* ctx);
-
-
-    duk_context* ctx_;
-
-    Vector<JSError> errors_;
-    SharedPtr<JSErrorChecker> errorChecker_;
-
-    // for access within duktape callbacks
-    static WeakPtr<AEJavascript> instance_;
-
-    Vector<String> modifiedJS_;
-
-};
-
-
-}

+ 0 - 287
Attic/AtomicEditorReference/Source/AEPreferences.cpp

@@ -1,287 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-
-#include <rapidjson/document.h>
-#include "rapidjson/prettywriter.h"
-#include "rapidjson/filestream.h"
-
-#include <Atomic/Core/Context.h>
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/IO/Log.h>
-#include <Atomic/IO/File.h>
-#include <Atomic/Graphics/Graphics.h>
-
-#include "AEEvents.h"
-#include "AEPreferences.h"
-
-using namespace rapidjson;
-
-namespace AtomicEditor
-{
-
-AEPreferences::AEPreferences(Context* context) :
-    Object(context)
-{
-    context->RegisterSubsystem(this);
-
-    SubscribeToEvent(E_EDITORSHUTDOWN, HANDLER(AEPreferences, HandleEditorShutdown));
-
-    Read();
-}
-
-AEPreferences::~AEPreferences()
-{
-
-}
-
-String AEPreferences::GetPreferencesFullPath()
-{
-    FileSystem* fs = GetSubsystem<FileSystem>();
-    String filepath = fs->GetAppPreferencesDir("AtomicEditor", "Preferences");
-    filepath += "prefs.json";
-    return filepath;
-}
-
-void AEPreferences::Clear()
-{
-    recentProjects_.Clear();
-}
-
-void AEPreferences::Read()
-{
-    rapidjson::Document document;
-
-    String filepath = GetPreferencesFullPath();
-
-    File jsonFile(context_, filepath);
-
-    if (!jsonFile.IsOpen())
-        return;
-
-    String json;
-    jsonFile.ReadText(json);
-
-    if (!json.Length())
-        return;
-
-    if (document.Parse<0>(json.CString()).HasParseError())
-    {
-        LOGERRORF("Could not parse JSON data from %s", filepath.CString());
-        return;
-    }
-
-    Clear();
-
-    const Value::Member* recent_files = document.FindMember("recent_files");
-    if (recent_files && recent_files->value.IsArray())
-    {
-        for (Value::ConstValueIterator itr = recent_files->value.Begin(); itr != recent_files->value.End(); itr++)
-        {
-             if (!(*itr).IsString())
-                 continue;
-
-            String path(itr->GetString());
-            recentProjects_.Push(path.CString());
-        }
-    }
-
-    const Value::Member* android_sdk_path = document.FindMember("android_sdk_path");
-    if (android_sdk_path && android_sdk_path->value.IsString())
-        androidSDKPath_ = android_sdk_path->value.GetString();
-
-    const Value::Member* jdk_root_path = document.FindMember("jdk_root_path");
-    if (jdk_root_path && jdk_root_path->value.IsString())
-        jdkRootPath_ = jdk_root_path->value.GetString();
-
-    const Value::Member* ant_path = document.FindMember("ant_path");
-    if (ant_path && ant_path->value.IsString())
-        antPath_ = ant_path->value.GetString();
-
-    UpdateRecentFiles(false);
-
-}
-
-void AEPreferences::Write()
-{
-    String filepath = GetPreferencesFullPath();
-
-    FILE* file = fopen(filepath.CString(), "w");
-
-    if (!file)
-        return;
-
-    Graphics* graphics = GetSubsystem<Graphics>();
-
-    IntVector2 pos(-1, -1);
-
-    int width = -1;
-    int height = -1;
-
-    if (graphics && !graphics->GetFullscreen())
-    {
-        pos = graphics->GetWindowPosition();
-        width = graphics->GetWidth();
-        height = graphics->GetHeight();
-    }
-
-    rapidjson::FileStream s(file);
-    rapidjson::PrettyWriter<rapidjson::FileStream> writer(s);
-
-    writer.StartObject();
-
-    // recent files
-    writer.String("recent_files");
-    writer.StartArray();
-    for (unsigned i = 0; i < recentProjects_.Size(); i++)
-        writer.String(recentProjects_[i].CString());
-    writer.EndArray();
-
-    writer.String("android_sdk_path");
-    writer.String(androidSDKPath_.CString());
-
-    writer.String("jdk_root_path");
-    writer.String(jdkRootPath_.CString());
-
-    writer.String("ant_path");
-    writer.String(antPath_.CString());
-
-    writer.String("window_pos_x");
-    writer.Int(pos.x_);
-    writer.String("window_pos_y");
-    writer.Int(pos.y_);
-    writer.String("window_width");
-    writer.Int(width);
-    writer.String("window_height");
-    writer.Int(height);
-
-    writer.EndObject();
-
-    fclose(file);
-
-}
-
-void AEPreferences::UpdateRecentFiles(bool write)
-{
-    FileSystem* fileSystem = GetSubsystem<FileSystem>();
-    Vector<String> recentProjects;
-
-    for (unsigned i = 0; i < recentProjects_.Size(); i++)
-    {
-        String path = recentProjects_[i];
-
-        if (!fileSystem->FileExists(path))
-            continue;
-
-
-        recentProjects.Push(path);
-
-        if (recentProjects.Size() > 0 && recentProjects.Size() <= 15)
-            break;
-    }
-
-    recentProjects_ = recentProjects;
-
-    if (write)
-        Write();
-}
-
-void AEPreferences::RegisterRecentProject(const String& fullpath)
-{
-    if (recentProjects_.Contains(fullpath))
-    {
-        recentProjects_.Remove(fullpath);
-    }
-
-    recentProjects_.Insert(0, fullpath);
-
-
-    UpdateRecentFiles();
-
-}
-
-bool AEPreferences::ReadStartupPrefs(Context *context, StartupPreferences& prefs)
-{
-
-    FileSystem* fileSystem = context->GetSubsystem<FileSystem>();
-    String filepath = fileSystem->GetAppPreferencesDir("AtomicEditor", "Preferences");
-    filepath += "prefs.json";
-
-    if (!fileSystem->FileExists(filepath))
-        return false;
-
-    SharedPtr<File> file(new File(context, filepath, FILE_READ));
-
-    if (!file->IsOpen())
-        return false;
-
-    String json;
-    file->ReadText(json);
-
-    if (!json.Length())
-        return false;
-
-    rapidjson::Document document;
-
-    if (document.Parse<0>(json.CString()).HasParseError())
-    {
-        return false;
-    }
-
-    bool success = true;
-
-    const Value::Member* imember = document.FindMember("window_pos_x");
-    if (imember && imember->value.IsInt())
-    {
-        prefs.windowPos.x_ = imember->value.GetInt();
-    }
-    else
-    {
-        success = false;
-    }
-
-    imember = document.FindMember("window_pos_y");
-    if (imember && imember->value.IsInt())
-    {
-        prefs.windowPos.y_ = imember->value.GetInt();
-    }
-    else
-    {
-        success = false;
-    }
-
-    imember = document.FindMember("window_width");
-    if (imember && imember->value.IsInt())
-    {
-        prefs.windowWidth = imember->value.GetInt();
-    }
-    else
-    {
-        success = false;
-    }
-
-    imember = document.FindMember("window_height");
-    if (imember && imember->value.IsInt())
-    {
-        prefs.windowHeight = imember->value.GetInt();
-    }
-    else
-    {
-        success = false;
-    }
-
-    if (prefs.windowHeight < 128 || prefs.windowWidth < 128)
-        return false;
-
-    return success;
-
-}
-
-void AEPreferences::HandleEditorShutdown(StringHash eventType, VariantMap& eventData)
-{
-    context_->RemoveSubsystem(GetType());
-}
-
-}

+ 0 - 68
Attic/AtomicEditorReference/Source/AEPreferences.h

@@ -1,68 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <Atomic/Core/Object.h>
-#include <Atomic/IO/FileSystem.h>
-
-using namespace Atomic;
-
-namespace AtomicEditor
-{
-
-class AEPreferences : public Object
-{
-
-    OBJECT(AEPreferences);
-
-public:
-
-    struct StartupPreferences
-    {
-        IntVector2 windowPos;
-        int windowWidth;
-        int windowHeight;
-    };
-
-    /// Construct.
-    AEPreferences(Context* context);
-    /// Destruct.
-    ~AEPreferences();
-
-    void RegisterRecentProject(const String& fullpath);
-    const Vector<String>& GetRecentProjects() { return recentProjects_; }
-
-    void SetAndroidSDKPath(const String& path) { androidSDKPath_ = path; Write(); }
-    void SetAntPath(const String& path) { antPath_ = path; Write(); }
-    void SetJDKRootPath(const String& path) { jdkRootPath_ = path; Write(); }
-
-    String GetAndroidSDKPath() { return AddTrailingSlash(androidSDKPath_); }
-    String GetJDKRootPath() { return AddTrailingSlash(jdkRootPath_); }
-    String GetAntPath() { return AddTrailingSlash(antPath_); }
-
-    void Read();
-    void Write();
-
-    static bool ReadStartupPrefs(Context* context, StartupPreferences& prefs);
-
-    void UpdateRecentFiles(bool write = true);
-
-private:
-
-     void HandleEditorShutdown(StringHash eventType, VariantMap& eventData);
-
-    void Clear();
-    String GetPreferencesFullPath();
-
-    String androidSDKPath_;
-    String jdkRootPath_;
-    String antPath_;
-
-    String lastProjectFullPath_;
-    Vector<String> recentProjects_;    
-};
-
-
-}

+ 0 - 28
Attic/AtomicEditorReference/Source/AETypes.h

@@ -1,28 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-namespace AtomicEditor
-{
-
-enum AEPlayerMode
-{
-    AE_PLAYERMODE_FULLSCREEN,
-    AE_PLAYERMODE_MAXIMIZED,
-    AE_PLAYERMODE_WIDGET
-};
-
-enum AEEditorPlatform
-{
-    AE_PLATFORM_UNDEFINED,
-    AE_PLATFORM_WINDOWS,
-    AE_PLATFORM_MAC,
-    AE_PLATFORM_ANDROID,
-    AE_PLATFORM_IOS,
-    AE_PLATFORM_HTML5
-};
-
-
-}

+ 0 - 10
Attic/AtomicEditorReference/Source/AEVersion.h

@@ -1,10 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#define ATOMIC_EDITOR_VERSION_MAJOR 0
-#define ATOMIC_EDITOR_VERSION_MINOR 2
-#define ATOMIC_EDITOR_VERSION_PATCH 0
-

+ 0 - 10
Attic/AtomicEditorReference/Source/AtomicEditor.h

@@ -1,10 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <Atomic/Atomic.h>
-#include "AETypes.h"
-
-

+ 0 - 224
Attic/AtomicEditorReference/Source/Build/AndroidProjectGenerator.cpp

@@ -1,224 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include <Poco/File.h>
-
-#include "AtomicEditor.h"
-#include <Atomic/IO/File.h>
-#include "../AEEditor.h"
-#include "../AEPreferences.h"
-#include "BuildSystem.h"
-#include "AndroidProjectGenerator.h"
-
-namespace AtomicEditor
-{
-
-AndroidProjectGenerator::AndroidProjectGenerator(Context* context) :
-    Object(context)
-{
-    BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
-    buildSettings_ = buildSystem->GetBuildSettings()->GetAndroidSettings();
-}
-
-AndroidProjectGenerator::~AndroidProjectGenerator()
-{
-
-}
-
-bool AndroidProjectGenerator::Generate()
-{
-    if (!GenerateAndroidManifest())
-        return false;
-
-    if (!GenerateStringXML())
-        return false;
-
-    if (!GenerateLocalProperties())
-        return false;
-
-    if (!GenerateProjectProperties())
-        return false;
-
-    if (!GenerateActivitySource())
-        return false;
-
-    return true;
-}
-
-bool AndroidProjectGenerator::GenerateActivitySource()
-{
-    if (!buildSettings_.package.Length())
-    {
-        errorText_ = "Invalid Package Name";
-        return false;
-    }
-
-    Vector<String> elements = buildSettings_.package.Split('.');
-    String path;
-    path.Join(elements, "/");
-
-    path = buildPath_ + "/src/" + path;
-
-    Poco::File dirs(path.CString());
-    dirs.createDirectories();
-
-    if (!dirs.exists())
-    {
-        errorText_ = "Unable to create ";
-        return false;
-    }
-
-    String source;
-    source.AppendWithFormat("package %s;\n", buildSettings_.package.CString());
-
-    source += "import org.libsdl.app.SDLActivity;\n";
-
-    source += "public class AtomicGameEngine extends SDLActivity {\n";
-
-    source += "}\n";
-
-    File file(context_, path + "/AtomicGameEngine.java", FILE_WRITE);
-
-    if (!file.IsOpen())
-        return false;
-
-    file.Write(source.CString(), source.Length());
-
-    return true;
-
-}
-
-bool AndroidProjectGenerator::GenerateLocalProperties()
-{
-    Editor* editor = GetSubsystem<Editor>();
-    String sdkPath = editor->GetPreferences()->GetAndroidSDKPath();
-
-    if (!sdkPath.Length())
-    {
-        errorText_ = "Invalid Android SDK Path";
-        return false;
-    }
-
-    String props;
-    props.AppendWithFormat("sdk.dir=%s", sdkPath.CString());
-
-    File file(context_, buildPath_ + "/local.properties", FILE_WRITE);
-
-    if (!file.IsOpen())
-        return false;
-
-    file.Write(props.CString(), props.Length());
-
-    return true;
-
-}
-
-bool AndroidProjectGenerator::GenerateProjectProperties()
-{
-    String apiString = buildSettings_.targetSDKVersion;
-    if (!apiString.Length())
-    {
-        errorText_ = "Invalid Android API";
-        return false;
-    }
-
-
-    String props;
-    props.AppendWithFormat("target=%s", apiString.CString());
-
-    File file(context_, buildPath_ + "/project.properties", FILE_WRITE);
-
-    if (!file.IsOpen())
-        return false;
-
-    file.Write(props.CString(), props.Length());
-
-    return true;
-
-}
-
-bool AndroidProjectGenerator::GenerateStringXML()
-{
-    if (!buildSettings_.appName.Length())
-    {
-        errorText_ = "Invalid App Name";
-        return false;
-    }
-
-    String strings  = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
-
-    strings += "<resources>\n";
-
-    strings.AppendWithFormat("<string name=\"app_name\">%s</string>\n", buildSettings_.appName.CString());
-
-    strings += "</resources>\n";
-
-    File file(context_, buildPath_ + "/res/values/strings.xml", FILE_WRITE);
-
-    if (!file.IsOpen())
-        return false;
-
-    file.Write(strings.CString(), strings.Length());
-
-    return true;
-
-}
-
-bool AndroidProjectGenerator::GenerateAndroidManifest()
-{
-
-    if (!buildSettings_.package.Length())
-    {
-        errorText_ = "Invalid Package Name";
-        return false;
-    }
-
-    buildSettings_.activityName = "AtomicGameEngine";
-    if (!buildSettings_.activityName.Length())
-    {
-        errorText_ = "Invalid Activity Name";
-        return false;
-    }
-
-    String manifest  = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
-    manifest += "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n";
-    manifest.AppendWithFormat("package=\"%s\"\n", buildSettings_.package.CString());
-    manifest += "android:versionCode=\"1\"\n";
-    manifest += "android:versionName=\"1.0\">\n";
-
-    manifest += "<uses-permission android:name=\"android.permission.INTERNET\" />\n";
-    manifest += "<uses-feature android:glEsVersion=\"0x00020000\" />\n";
-    manifest += "<uses-sdk android:targetSdkVersion=\"12\" android:minSdkVersion=\"10\" />\n";
-
-    manifest += "<application android:label=\"@string/app_name\" android:icon=\"@drawable/icon\">\n";
-    manifest.AppendWithFormat("<activity android:name=\".%s\"\n", buildSettings_.activityName.CString());
-
-    manifest += "android:label=\"@string/app_name\"\n";
-    manifest += "android:theme=\"@android:style/Theme.NoTitleBar.Fullscreen\"\n";
-    manifest += "android:configChanges=\"keyboardHidden|orientation\"\n";
-    manifest += "android:screenOrientation=\"landscape\">\n";
-    manifest += "<intent-filter>\n";
-    manifest += "<action android:name=\"android.intent.action.MAIN\" />\n";
-    manifest += "<category android:name=\"android.intent.category.LAUNCHER\" />\n";
-    manifest += "</intent-filter>\n";
-    manifest += "</activity>\n";
-    manifest += "</application>\n";
-    manifest += "</manifest>\n";
-
-    File file(context_, buildPath_ + "/AndroidManifest.xml", FILE_WRITE);
-
-    if (!file.IsOpen())
-        return false;
-
-    file.Write(manifest.CString(), manifest.Length());
-
-    return true;
-
-}
-
-}
-
-/*
-
-*/

+ 0 - 47
Attic/AtomicEditorReference/Source/Build/AndroidProjectGenerator.h

@@ -1,47 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <Atomic/Container/Str.h>
-#include <Atomic/Core/Object.h>
-
-#include "BuildSettings.h"
-
-using namespace Atomic;
-
-namespace AtomicEditor
-{
-
-class AndroidProjectGenerator : public Object
-{
-
-    OBJECT(AndroidProjectGenerator);
-
-public:
-
-    AndroidProjectGenerator(Context* context);
-    virtual ~AndroidProjectGenerator();
-
-    void SetBuildPath(const String& buildpath) { buildPath_ = buildpath; }
-
-    bool Generate();
-
-    const String& GetErrorText() { return errorText_; }
-
-private:
-
-    bool GenerateAndroidManifest();
-    bool GenerateStringXML();
-    bool GenerateLocalProperties();
-    bool GenerateProjectProperties();
-    bool GenerateActivitySource();
-
-    String buildPath_;
-    String errorText_;
-    AndroidBuildSettings buildSettings_;
-
-};
-
-}

+ 0 - 411
Attic/AtomicEditorReference/Source/Build/BuildAndroid.cpp

@@ -1,411 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-#include <Atomic/IO/File.h>
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/IO/Log.h>
-#include <Atomic/IO/MemoryBuffer.h>
-#include "../AEEditor.h"
-#include "../Project/AEProject.h"
-#include "../Project/ProjectUtils.h"
-
-#include "BuildAndroid.h"
-#include "AndroidProjectGenerator.h"
-
-// TODO: We're going to want headless builds
-#include "AEEditor.h"
-#include "AEEvents.h"
-#include "AEPreferences.h"
-#include "Subprocess/AESubprocessSystem.h"
-#include "UI/Modal/UIModalOps.h"
-
-#include "BuildSystem.h"
-
-namespace AtomicEditor
-{
-
-BuildAndroid::BuildAndroid(Context * context) : BuildBase(context)
-{
-
-}
-
-BuildAndroid::~BuildAndroid()
-{
-
-}
-
-void BuildAndroid::Initialize()
-{
-    Editor* editor = GetSubsystem<Editor>();
-    Project* project = editor->GetProject();
-
-    FileSystem* fileSystem = GetSubsystem<FileSystem>();
-
-#ifdef ATOMIC_PLATFORM_OSX
-    String bundleResources = fileSystem->GetAppBundleResourceFolder();
-#else
-    String bundleResources = fileSystem->GetProgramDir();
-#endif
-
-    String projectResources = project->GetResourcePath();
-    String coreDataFolder = bundleResources + "CoreData/";
-
-    AddResourceDir(coreDataFolder);
-    AddResourceDir(projectResources);
-
-    BuildResourceEntries();
-}
-
-void BuildAndroid::HandleEvent(StringHash eventType, VariantMap& eventData)
-{
-
-    if (eventType == E_SUBPROCESSOUTPUT)
-    {
-        if (currentBuildPhase_ == ADBListDevices)
-        {
-            deviceListText_ += eventData[SubprocessOutput::P_TEXT].GetString();
-        }
-    }
-
-
-    if (eventType == E_SUBPROCESSCOMPLETE)
-    {
-        BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
-
-        int code = eventData[SubprocessComplete::P_RETCODE].GetInt();
-
-        if (!code || currentBuildPhase_ == ADBListDevices)
-        {
-            // success
-            if (currentBuildPhase_ == AndroidUpdateProject)
-            {
-                RunAntDebug();
-            }
-            else if (currentBuildPhase_ == AntBuildDebug)
-            {
-                RunADBListDevices();
-            }
-            else if (currentBuildPhase_ == ADBListDevices)
-            {
-                // check if we have any devices attached, otherwise adb install
-                // will hang looking for devices
-                bool noDevices = true;
-                if (deviceListText_.Length())
-                {
-                    MemoryBuffer reader(deviceListText_.CString(), deviceListText_.Length() + 1);
-                    while (!reader.IsEof())
-                    {
-                        String line = reader.ReadLine();
-                        if (line.Length() && line[0] >= '0' && line[0] <= '9')
-                        {
-                            noDevices = false;
-                            break;
-                        }
-                    }
-                }
-
-                if (!noDevices)
-                    RunADBInstall();
-                else
-                {
-                    // can't proceed
-                    buildSystem->BuildComplete(AE_PLATFORM_ANDROID, buildPath_);
-                }
-
-            }
-            else if (currentBuildPhase_ == ADBInstall)
-            {
-                RunStartActivity();
-            }
-            else if (currentBuildPhase_ == ADBStartActivity)
-            {
-                buildSystem->BuildComplete(AE_PLATFORM_ANDROID, buildPath_);
-            }
-
-        }
-        else
-        {
-
-            buildSystem->BuildComplete(AE_PLATFORM_ANDROID, buildPath_, false);
-        }
-
-
-    }
-}
-
-// adb shell am start -n com.package.name/com.package.name.ActivityName
-
-void BuildAndroid::RunStartActivity()
-{
-    Editor* editor = GetSubsystem<Editor>();
-    SubprocessSystem* subs = GetSubsystem<SubprocessSystem>();
-
-    BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
-    AndroidBuildSettings buildSettings = buildSystem->GetBuildSettings()->GetAndroidSettings();
-
-
-    String adbCommand = editor->GetPreferences()->GetAndroidSDKPath();
-
-#ifdef ATOMIC_PLATFORM_OSX
-    adbCommand += "platform-tools/adb";
-#else
-    adbCommand += "/platform-tools/adb.exe";
-#endif
-    String stringArgs;
-    const char* cpackage = buildSettings.package.CString();
-    stringArgs.AppendWithFormat("shell am start -n %s/%s.AtomicGameEngine",cpackage, cpackage);
-
-    Vector<String> args = stringArgs.Split(' ');
-
-    currentBuildPhase_ = ADBStartActivity;
-    Subprocess* subprocess = subs->Launch(adbCommand, args, buildPath_);
-    if (!subprocess)
-    {
-        assert(0);
-        // ERROR
-        return;
-    }
-
-    SubscribeToEvent(subprocess, E_SUBPROCESSCOMPLETE, HANDLER(BuildAndroid, HandleEvent));
-    SubscribeToEvent(subprocess, E_SUBPROCESSOUTPUT, HANDLER(BuildAndroid, HandleEvent));
-
-
-    UIModalOps* ops = GetSubsystem<UIModalOps>();
-    ops->SetProgramOutputSubprocess(subprocess);
-
-    ops->PrintToProgramOutput("\n\nStarting Android Activity\n\n");
-
-}
-
-void BuildAndroid::RunADBInstall()
-{
-    Editor* editor = GetSubsystem<Editor>();
-    SubprocessSystem* subs = GetSubsystem<SubprocessSystem>();
-
-    String adbCommand = editor->GetPreferences()->GetAndroidSDKPath();
-#ifdef ATOMIC_PLATFORM_OSX
-    adbCommand += "platform-tools/adb";
-#else
-    adbCommand += "/platform-tools/adb.exe";
-#endif
-
-    Vector<String> args = String("install -r ./bin/Atomic-debug-unaligned.apk").Split(' ');
-
-    currentBuildPhase_ = ADBInstall;
-    Subprocess* subprocess = subs->Launch(adbCommand, args, buildPath_);
-
-    if (!subprocess)
-    {
-        assert(0);
-        // ERROR
-        return;
-    }
-
-    SubscribeToEvent(subprocess, E_SUBPROCESSCOMPLETE, HANDLER(BuildAndroid, HandleEvent));
-    SubscribeToEvent(subprocess, E_SUBPROCESSOUTPUT, HANDLER(BuildAndroid, HandleEvent));
-
-    UIModalOps* ops = GetSubsystem<UIModalOps>();
-    ops->SetProgramOutputSubprocess(subprocess);
-
-    ops->PrintToProgramOutput("\n\n<color #D4FB79>Installing on Android Device</color>\n\n");
-
-}
-
-void BuildAndroid::RunADBListDevices()
-{
-    Editor* editor = GetSubsystem<Editor>();
-    SubprocessSystem* subs = GetSubsystem<SubprocessSystem>();
-
-    deviceListText_.Clear();
-
-    String adbCommand = editor->GetPreferences()->GetAndroidSDKPath();
-#ifdef ATOMIC_PLATFORM_OSX
-    adbCommand += "platform-tools/adb";
-#else
-    adbCommand += "/platform-tools/adb.exe";
-#endif
-
-    Vector<String> args = String("devices").Split(' ');
-
-    currentBuildPhase_ = ADBListDevices;
-    Subprocess* subprocess = subs->Launch(adbCommand, args, "");
-
-    if (!subprocess)
-    {
-        assert(0);
-        // ERROR
-        return;
-    }
-
-    SubscribeToEvent(subprocess, E_SUBPROCESSCOMPLETE, HANDLER(BuildAndroid, HandleEvent));
-    SubscribeToEvent(subprocess, E_SUBPROCESSOUTPUT, HANDLER(BuildAndroid, HandleEvent));
-
-
-    UIModalOps* ops = GetSubsystem<UIModalOps>();
-    ops->SetProgramOutputSubprocess(subprocess);
-
-    ops->PrintToProgramOutput("\n\n<color #D4FB79>Listing Android Devices</color>\n\n");
-
-}
-
-void BuildAndroid::RunAntDebug()
-{
-    Editor* editor = GetSubsystem<Editor>();
-    AEPreferences* prefs = editor->GetPreferences();
-    SubprocessSystem* subs = GetSubsystem<SubprocessSystem>();
-
-     Poco::Process::Env env;
-
-#ifdef ATOMIC_PLATFORM_OSX
-    String antCommand = "/usr/local/bin/ant";
-    Vector<String> args;
-    args.Push("debug");
-#else
-     // C:\ProgramData\Oracle\Java\javapath;
-    Vector<String> args;
-    String antCommand = "cmd";
-    String antPath = prefs->GetAntPath() + "/ant.bat";
-    env["JAVA_HOME"] = prefs->GetJDKRootPath().CString();
-    // ant is a batch file on windows, so have to run with cmd /c
-    args.Push("/c");
-    args.Push("\"" + antPath + "\"");
-    args.Push("debug");
-#endif
-
-    currentBuildPhase_ = AntBuildDebug;
-    Subprocess* subprocess = subs->Launch(antCommand, args, buildPath_, env);
-
-    if (!subprocess)
-    {
-        assert(0);
-        // ERROR
-        return;
-    }
-
-    SubscribeToEvent(subprocess, E_SUBPROCESSCOMPLETE, HANDLER(BuildAndroid, HandleEvent));
-    SubscribeToEvent(subprocess, E_SUBPROCESSOUTPUT, HANDLER(BuildAndroid, HandleEvent));
-
-
-    UIModalOps* ops = GetSubsystem<UIModalOps>();
-    ops->ShowProgramOutput(subprocess);
-
-    ops->PrintToProgramOutput("<color #D4FB79>Starting Android Deployment</color>\n\n");
-}
-
-void BuildAndroid::RunAndroidUpdate()
-{
-    Editor* editor = GetSubsystem<Editor>();
-    SubprocessSystem* subs = GetSubsystem<SubprocessSystem>();
-
-    String androidCommand = editor->GetPreferences()->GetAndroidSDKPath();
-    androidCommand += "tools/android";
-
-    Vector<String> args = String("update project -p . -t 33").Split(' ');
-
-    currentBuildPhase_ = AndroidUpdateProject;
-    Subprocess* subprocess = subs->Launch(androidCommand, args, buildPath_);
-
-    if (!subprocess)
-    {
-        assert(0);
-        // ERROR
-        return;
-    }
-
-    SubscribeToEvent(subprocess, E_SUBPROCESSCOMPLETE, HANDLER(BuildAndroid, HandleEvent));
-    SubscribeToEvent(subprocess, E_SUBPROCESSOUTPUT, HANDLER(BuildAndroid, HandleEvent));
-
-
-    UIModalOps* ops = GetSubsystem<UIModalOps>();
-    ops->ShowProgramOutput(subprocess);
-
-}
-
-void BuildAndroid::Build(const String& buildPath)
-{
-    Editor* editor = GetSubsystem<Editor>();
-    Project* project = editor->GetProject();
-
-    buildPath_ = buildPath + "/Android-Build";
-
-    androidSDKPath_ = editor->GetPreferences()->GetAndroidSDKPath();
-
-#ifdef ATOMIC_PLATFORM_OSX
-    androidCommand_ = androidSDKPath_ + "platform/android";
-    adbCommand_ = androidSDKPath_ + "platform-tools/adb";
-#else
-    androidCommand_ = androidSDKPath_ + "platform/android.bat";
-    adbCommand_ = androidSDKPath_ + "platform-tools/adb.exe";
-#endif
-
-    Initialize();
-
-    //generate manifest file
-    String manifest;
-    for (unsigned i = 0; i < resourceEntries_.Size(); i++)
-    {
-        BuildResourceEntry* entry = resourceEntries_[i];
-        manifest += entry->packagePath_;
-        if ( i != resourceEntries_.Size() - 1)
-            manifest += ";";
-    }
-
-    FileSystem* fileSystem = GetSubsystem<FileSystem>();
-
-    if (fileSystem->DirExists(buildPath_))
-        fileSystem->RemoveDir(buildPath_, true);
-
-    if (fileSystem->DirExists(buildPath_))
-    {
-        BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
-        buildSystem->BuildComplete(AE_PLATFORM_ANDROID, buildPath_, false);
-        editor->PostModalInfo("Build Error", ToString("Build Folder:\n\n %s\n\nis in use and could not be removed, please select another build folder.", buildPath_.CString()));
-        return;
-    }
-
-#ifdef ATOMIC_PLATFORM_OSX
-    String buildSourceDir = fileSystem->GetAppBundleResourceFolder();
-#else
-    String buildSourceDir = fileSystem->GetProgramDir();
-#endif
-
-    String androidProject = buildSourceDir + "Deployment/Android";
-    String projectResources = project->GetResourcePath();
-    String coreDataFolder = buildSourceDir + "CoreData/";
-
-    fileSystem->CopyDir(androidProject, buildPath_);
-
-    if (!fileSystem->DirExists(buildPath_))
-    {
-        BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
-        buildSystem->BuildComplete(AE_PLATFORM_ANDROID, buildPath_, false);
-        editor->PostModalInfo("Build Error", ToString("Build Folder:\n\n %s\n\ncould not be written to, is it in use?", buildPath_.CString()));
-        return;
-    }
-
-    fileSystem->CopyDir(projectResources, buildPath_ + "/assets/AtomicResources");    
-    fileSystem->CopyDir(coreDataFolder, buildPath_ + "/assets/CoreData");
-
-    // write the manifest
-    SharedPtr<File> mfile(new File(context_, buildPath_ + "/assets/AtomicManifest", FILE_WRITE));
-    mfile->WriteString(manifest);
-    mfile->Close();
-
-    AndroidProjectGenerator gen(context_);
-    gen.SetBuildPath(buildPath_);
-
-    if (!gen.Generate())
-    {
-        BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
-        buildSystem->BuildComplete(AE_PLATFORM_ANDROID, buildPath_, false);
-        editor->PostModalInfo("Build Error", ToString("Unable to generate Android project, please check build settings and try again"));
-        return;
-    }
-
-    // RunAndroidUpdate();
-    RunAntDebug();
-}
-
-}

+ 0 - 58
Attic/AtomicEditorReference/Source/Build/BuildAndroid.h

@@ -1,58 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include "BuildBase.h"
-
-namespace AtomicEditor
-{
-
-class BuildAndroid : public BuildBase
-{
-    OBJECT(BuildAndroid);
-
-public:
-
-    BuildAndroid(Context* context);
-    virtual ~BuildAndroid();
-
-    void Build(const String& buildPath);
-
-    virtual bool UseResourcePackager() { return false; }
-
-protected:
-
-    void Initialize();
-
-private:
-
-    void HandleEvent(StringHash eventType, VariantMap& eventData);
-
-    // subprocesses
-    void RunAndroidUpdate();
-    void RunAntDebug();
-    void RunADBInstall();
-    void RunADBListDevices();
-    void RunStartActivity();
-
-    enum BuildPhase
-    {        
-        AndroidUpdateProject,
-        AntBuildDebug,        
-        ADBListDevices,
-        ADBInstall,
-        ADBStartActivity
-    };
-
-    BuildPhase currentBuildPhase_;
-    String deviceListText_;
-    String androidSDKPath_;
-    String androidCommand_;
-    String adbCommand_;
-    String antCommand_;
-
-};
-
-}

+ 0 - 117
Attic/AtomicEditorReference/Source/Build/BuildBase.cpp

@@ -1,117 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-#include <Atomic/IO/Log.h>
-#include <Atomic/IO/FileSystem.h>
-
-#include "BuildBase.h"
-#include "ResourcePackager.h"
-
-namespace AtomicEditor
-{
-
-BuildBase::BuildBase(Context * context) : Object(context), containsMDL_(false)
-{
-
-    if (UseResourcePackager())
-        resourcePackager_ = new ResourcePackager(context, this);
-
-    BuildLog("Build Started");
-
-}
-
-BuildBase::~BuildBase()
-{
-    for (unsigned i = 0; i < resourceEntries_.Size(); i++)
-    {
-        delete resourceEntries_[i];
-    }
-}
-
-void BuildBase::BuildLog(const String& message)
-{
-    buildLog_.Push(message);
-}
-
-void BuildBase::BuildWarn(const String& warning)
-{
-    buildWarnings_.Push(warning);
-}
-
-void BuildBase::BuildError(const String& error)
-{
-    buildErrors_.Push(error);
-}
-
-
-void BuildBase::ScanResourceDirectory(const String& resourceDir)
-{
-    Vector<String> fileNames;
-    FileSystem* fileSystem = GetSubsystem<FileSystem>();
-    fileSystem->ScanDir(fileNames, resourceDir, "*.*", SCAN_FILES, true);
-
-    for (unsigned i = 0; i < fileNames.Size(); i++)
-    {
-        const String& filename = fileNames[i];
-
-        for (unsigned j = 0; j < resourceEntries_.Size(); j++)
-        {
-            const BuildResourceEntry* entry = resourceEntries_[j];
-            if (entry->packagePath_ == filename)
-            {
-                BuildWarn(ToString("Resource Path: %s already exists", filename.CString()));
-                continue;
-            }
-        }
-
-        BuildResourceEntry* newEntry = new BuildResourceEntry;
-
-// BEGIN LICENSE MANAGEMENT
-        if (GetExtension(filename) == ".mdl")
-        {
-            containsMDL_ = true;
-        }
-// END LICENSE MANAGEMENT
-
-        newEntry->absolutePath_ = resourceDir + filename;
-        newEntry->packagePath_ = filename;
-        newEntry->resourceDir_ = resourceDir;
-
-        resourceEntries_.Push(newEntry);
-    }
-}
-
-void BuildBase::BuildResourceEntries()
-{
-    for (unsigned i = 0; i < resourceDirs_.Size(); i++)
-    {
-        ScanResourceDirectory(resourceDirs_[i]);
-    }
-
-    if (resourcePackager_.NotNull())
-    {
-        for (unsigned i = 0; i < resourceEntries_.Size(); i++)
-        {
-            BuildResourceEntry* entry = resourceEntries_[i];
-            resourcePackager_->AddResourceEntry(entry);
-        }
-
-    }
-
-}
-
-void BuildBase::GenerateResourcePackage(const String& resourcePackagePath)
-{
-    resourcePackager_->GeneratePackage(resourcePackagePath);
-}
-
-void BuildBase::AddResourceDir(const String& dir)
-{
-    assert(!resourceDirs_.Contains(dir));
-    resourceDirs_.Push(dir);
-}
-
-
-}

+ 0 - 63
Attic/AtomicEditorReference/Source/Build/BuildBase.h

@@ -1,63 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <Atomic/Core/Object.h>
-#include "BuildTypes.h"
-
-using namespace Atomic;
-
-namespace AtomicEditor
-{
-
-class ResourcePackager;
-
-class BuildBase : public Object
-{
-    OBJECT(BuildBase);
-
-public:
-
-    BuildBase(Context* context);
-    virtual ~BuildBase();
-
-    virtual void Build(const String& buildPath) = 0;
-
-    // some platforms may want to do their own packaging of resources
-    virtual bool UseResourcePackager() { return true; }
-
-    // add in search order, first added is first searched
-    // will warn on name conflicts
-    void AddResourceDir(const String& dir);
-
-    void BuildLog(const String& message);
-    void BuildWarn(const String& warning);
-    void BuildError(const String& error);
-
-protected:
-
-    void GenerateResourcePackage(const String& resourcePackagePath);
-
-    void BuildResourceEntries();
-
-    String buildPath_;
-    PODVector<BuildResourceEntry*> resourceEntries_;
-
-    bool containsMDL_;
-
-private:
-
-    Vector<String> buildLog_;
-    Vector<String> buildWarnings_;
-    Vector<String> buildErrors_;
-
-    void ScanResourceDirectory(const String& resourceDir);
-
-    SharedPtr<ResourcePackager> resourcePackager_;
-    Vector<String> resourceDirs_;    
-
-};
-
-}

+ 0 - 345
Attic/AtomicEditorReference/Source/Build/BuildIOS.cpp

@@ -1,345 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/IO/File.h>
-#include "../AEEditor.h"
-#include "../Project/AEProject.h"
-#include "../Project/ProjectUtils.h"
-
-#include "AEEvents.h"
-
-#include "Subprocess/AESubprocessSystem.h"
-
-#include "BuildIOS.h"
-#include "BuildSystem.h"
-#include "UI/Modal/UIModalOps.h"
-
-#include "Tools/External/AEExternalTooling.h"
-
-
-
-namespace AtomicEditor
-{
-
-BuildIOS::BuildIOS(Context * context) : BuildBase(context)
-{
-
-}
-
-BuildIOS::~BuildIOS()
-{
-
-}
-
-void BuildIOS::Initialize()
-{
-    Editor* editor = GetSubsystem<Editor>();
-    Project* project = editor->GetProject();
-
-    FileSystem* fileSystem = GetSubsystem<FileSystem>();
-
-#ifdef ATOMIC_PLATFORM_WINDOWS
-    String bundleResources = fileSystem->GetProgramDir();
-#else
-    String bundleResources = fileSystem->GetAppBundleResourceFolder();
-#endif
-
-    String projectResources = project->GetResourcePath();
-    String coreDataFolder = bundleResources + "CoreData/";
-
-    AddResourceDir(coreDataFolder);
-    AddResourceDir(projectResources);
-
-    BuildResourceEntries();
-
-}
-
-String BuildIOS::GenerateInfoPlist()
-{
-
-    BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
-    IOSBuildSettings settings = buildSystem->GetBuildSettings()->GetIOSSettings();
-
-    String plist = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
-    plist += "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n";
-    plist += "<plist version=\"1.0\">\n";
-    plist += "<dict>\n";
-
-    plist += "<key>CFBundleDevelopmentRegion</key>\n";
-    plist += "<string>English</string>\n";
-
-    plist += "<key>CFBundleExecutable</key>\n";
-    plist += "<string>AtomicPlayer</string>\n";
-
-    plist += "<key>CFBundleGetInfoString</key>\n";
-    plist += "<string>\"Atomic Player\"</string>\n";
-
-    plist += "<key>CFBundleIconFile</key>\n";
-    plist += "<string></string>\n";
-
-    plist += "<key>CFBundleIdentifier</key>\n";
-    plist.AppendWithFormat("<string>%s</string>\n", settings.package.CString());
-
-    plist += "<key>CFBundleInfoDictionaryVersion</key>\n";
-    plist += "<string>6.0</string>\n";
-
-    plist += "<key>CFBundleLongVersionString</key>\n";
-    plist += "<string></string>\n";
-
-    plist +=  "<key>CFBundleName</key>\n";
-    plist += "<string></string>\n";
-    plist += "<key>CFBundlePackageType</key>\n";
-    plist += "<string>APPL</string>\n";
-    plist += "<key>CFBundleShortVersionString</key>\n";
-    plist += "<string></string>\n";
-    plist += "<key>CFBundleSignature</key>\n";
-    plist += "<string>????</string>\n";
-    plist += "<key>CFBundleVersion</key>\n";
-    plist += "<string></string>\n";
-    plist += "<key>CSResourcesFileMapped</key>\n";
-    plist += "<true/>\n";
-    plist += "<key>LSRequiresCarbon</key>\n";
-    plist += "<true/>\n";
-    plist += "<key>NSHumanReadableCopyright</key>\n";
-    plist += "<string>\"(c) Your Company\"</string>\n";
-    plist += "<key>CFBundleIconFiles</key>\n";
-    plist += "<array>\n";
-    plist += "<string></string>\n";
-    plist += "</array>\n";
-    plist += "</dict>\n";
-    plist += "</plist>\n";
-
-    return plist;
-
-}
-
-String BuildIOS::GenerateEntitlements()
-{
-    BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
-    IOSBuildSettings settings = buildSystem->GetBuildSettings()->GetIOSSettings();
-    String app_identifer = settings.appidPrefix + ".";
-    app_identifer += settings.package;
-
-    String team_identifier = settings.appidPrefix;
-
-    String keychain_access_group = app_identifer;
-
-    String entitlements = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
-    entitlements += "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n";
-    entitlements += "<plist version=\"1.0\">\n";
-    entitlements += "<dict>\n";
-    entitlements += "<key>application-identifier</key>\n";
-    entitlements.AppendWithFormat("<string>%s</string>\n", app_identifer.CString());
-    entitlements += "<key>com.apple.developer.team-identifier</key>\n";
-    entitlements.AppendWithFormat("<string>%s</string>\n", team_identifier.CString());
-    entitlements += "<key>get-task-allow</key>\n";
-    entitlements += "<true/>\n";
-    entitlements += "<key>keychain-access-groups</key>\n";
-    entitlements += "<array>\n";
-    entitlements.AppendWithFormat("<string>%s</string>\n", keychain_access_group.CString());
-    entitlements += "</array>\n";
-    entitlements += "</dict>\n";
-    entitlements += "</plist>\n";
-
-    return entitlements;
-}
-
-void BuildIOS::HandleEvent(StringHash eventType, VariantMap& eventData)
-{
-
-    if (eventType == E_SUBPROCESSOUTPUT)
-    {
-
-    }
-
-    if (eventType == E_SUBPROCESSCOMPLETE)
-    {
-        BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
-
-        int code = eventData[SubprocessComplete::P_RETCODE].GetInt();
-
-        if (!code)
-        {
-            // success
-            if (currentBuildPhase_ == ConvertPList)
-            {
-                RunCodeSign();
-            }
-            else if (currentBuildPhase_ == CodeSign)
-            {
-                RunDeploy();
-            }
-            else if (currentBuildPhase_ == Deploy)
-            {
-                buildSystem->BuildComplete(AE_PLATFORM_IOS, buildPath_);
-            }
-
-        }
-        else
-        {
-            buildSystem->BuildComplete(AE_PLATFORM_IOS, buildPath_, false);
-
-        }
-    }
-}
-
-void BuildIOS::RunConvertPList()
-{
-    SubprocessSystem* subs = GetSubsystem<SubprocessSystem>();
-
-    Vector<String> args = String("-convert binary1 ./AtomicPlayer.app/Info.plist").Split(' ');
-
-    currentBuildPhase_ = ConvertPList;
-    Subprocess* subprocess = subs->Launch("/usr/bin/plutil", args, buildPath_);
-
-    if (!subprocess)
-    {
-        assert(0);
-        // ERROR
-        return;
-    }
-
-    SubscribeToEvent(subprocess, E_SUBPROCESSCOMPLETE, HANDLER(BuildIOS, HandleEvent));
-    SubscribeToEvent(subprocess, E_SUBPROCESSOUTPUT, HANDLER(BuildIOS, HandleEvent));
-
-    UIModalOps* ops = GetSubsystem<UIModalOps>();
-    ops->ShowProgramOutput(subprocess);
-
-    ops->PrintToProgramOutput("<color #D4FB79>Starting iOS Deployment</color>\n\n");
-}
-
-void BuildIOS::RunCodeSign()
-{
-    SubprocessSystem* subs = GetSubsystem<SubprocessSystem>();
-
-    Vector<String> args;
-    args.Push("--force");
-    args.Push("--sign");
-    args.Push("iPhone Developer");
-    args.Push("--entitlements");
-    args.Push("./AtomicPlayer.app.xcent");
-    args.Push("./AtomicPlayer.app");
-
-    Poco::Process::Env env;
-    env["CODESIGN_ALLOCATE"] =  "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate";
-
-    currentBuildPhase_ = CodeSign;
-    Subprocess* subprocess = subs->Launch("/usr/bin/codesign", args, buildPath_, env);
-
-    if (!subprocess)
-    {
-        assert(0);
-        // ERROR
-        return;
-    }
-
-    SubscribeToEvent(subprocess, E_SUBPROCESSCOMPLETE, HANDLER(BuildIOS, HandleEvent));
-    SubscribeToEvent(subprocess, E_SUBPROCESSOUTPUT, HANDLER(BuildIOS, HandleEvent));
-
-    UIModalOps* ops = GetSubsystem<UIModalOps>();
-    ops->SetProgramOutputSubprocess(subprocess);
-
-    ops->PrintToProgramOutput("\n\n<color #D4FB79>Signing iOS Deployment</color>\n\n");
-
-}
-
-void BuildIOS::RunDeploy()
-{
-    SubprocessSystem* subs = GetSubsystem<SubprocessSystem>();
-    ExternalTooling* tooling = GetSubsystem<ExternalTooling>();
-    String iosDeploy = tooling->GetToolApplicationPath();
-    iosDeploy += "CommandLine/ios-deploy";
-
-
-    Vector<String> args;
-
-    args.Push("--uninstall");
-    args.Push("--bundle");
-    args.Push("./AtomicPlayer.app");
-
-    currentBuildPhase_ = Deploy;
-    Subprocess* subprocess = subs->Launch(iosDeploy.CString(), args, buildPath_);
-
-    if (!subprocess)
-    {
-        assert(0);
-        // ERROR
-        return;
-    }
-
-    SubscribeToEvent(subprocess, E_SUBPROCESSCOMPLETE, HANDLER(BuildIOS, HandleEvent));
-    SubscribeToEvent(subprocess, E_SUBPROCESSOUTPUT, HANDLER(BuildIOS, HandleEvent));
-
-
-    UIModalOps* ops = GetSubsystem<UIModalOps>();
-    ops->SetProgramOutputSubprocess(subprocess);
-
-    ops->PrintToProgramOutput("\n\n<color #D4FB79>Deploying to iOS Device</color>\n\n");
-
-}
-
-
-void BuildIOS::Build(const String& buildPath)
-{
-    buildPath_ = buildPath + "/IOS-Build";
-
-    Initialize();
-
-    FileSystem* fileSystem = GetSubsystem<FileSystem>();
-    if (fileSystem->DirExists(buildPath_))
-        fileSystem->RemoveDir(buildPath_, true);
-
-
- #ifdef ATOMIC_PLATFORM_WINDOWS
-    String buildSourceDir = fileSystem->GetProgramDir();
- #else
-    String buildSourceDir = fileSystem->GetAppBundleResourceFolder();
- #endif
-
-    String buildAppSourceDir = buildSourceDir + "Deployment/IOS/AtomicPlayer.app";
-
-    fileSystem->CreateDir(buildPath_);
-
-    String buildDestDist = buildPath_ + "/AtomicPlayer.app";
-
-    fileSystem->CreateDir(buildDestDist);
-
-    String resourcePackagePath = buildDestDist + "/AtomicResources.pak";
-    GenerateResourcePackage(resourcePackagePath);
-
-    fileSystem->Copy(buildAppSourceDir + "/AtomicPlayer", buildDestDist + "/AtomicPlayer");
-    fileSystem->Copy(buildAppSourceDir + "/PkgInfo", buildDestDist + "/PkgInfo");
-
-    BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
-
-    IOSBuildSettings settings = buildSystem->GetBuildSettings()->GetIOSSettings();
-
-    fileSystem->Copy(settings.provisionFile, buildDestDist + "/embedded.mobileprovision");
-
-    String entitlements = GenerateEntitlements();
-    String plist = GenerateInfoPlist();
-
-    File file(context_, buildPath_ + "/AtomicPlayer.app.xcent", FILE_WRITE);
-
-    if (file.IsOpen())
-    {
-        file.Write(entitlements.CString(), entitlements.Length());
-        file.Close();
-    }
-
-    File pfile(context_, buildDestDist + "/Info.plist", FILE_WRITE);
-
-    if (pfile.IsOpen())
-    {
-        pfile.Write(plist.CString(), plist.Length());
-        pfile.Close();
-    }
-
-    RunConvertPList();
-
-}
-
-}

+ 0 - 49
Attic/AtomicEditorReference/Source/Build/BuildIOS.h

@@ -1,49 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include "BuildBase.h"
-
-namespace AtomicEditor
-{
-
-class BuildIOS : public BuildBase
-{
-    OBJECT(BuildIOS);
-
-public:
-
-    BuildIOS(Context* context);
-    virtual ~BuildIOS();
-
-    void Build(const String& buildPath);
-
-protected:
-
-    void Initialize();
-
-private:
-
-    void HandleEvent(StringHash eventType, VariantMap& eventData);
-
-    enum BuildPhase
-    {
-        ConvertPList,
-        CodeSign,
-        Deploy
-    };
-
-    void RunConvertPList();
-    void RunCodeSign();
-    void RunDeploy();
-
-    String GenerateEntitlements();
-    String GenerateInfoPlist();
-
-    BuildPhase currentBuildPhase_;
-
-};
-
-}

+ 0 - 13
Attic/AtomicEditorReference/Source/Build/BuildIOSUtils.h

@@ -1,13 +0,0 @@
-
-#pragma once
-
-#include <Atomic/Container/Str.h>
-
-using namespace Atomic;
-
-namespace AtomicEditor
-{
-
-String GetMobileProvisionData(const char* cfilename);
-
-}

+ 0 - 76
Attic/AtomicEditorReference/Source/Build/BuildIOSUtils.mm

@@ -1,76 +0,0 @@
-/*
-Portions Copyright (c) 2013 Eugene Solodovnykov
-
-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.
-*/
-
-#import <Foundation/Foundation.h>
-#import <Security/Security.h>
-
-#include "AtomicEditor.h"
-#include "BuildIOSUtils.h"
-
-namespace AtomicEditor {
-
-String GetMobileProvisionData(const char* cfilename)
-{
-    CMSDecoderRef decoder = NULL;
-    CFDataRef dataRef = NULL;
-
-    NSString *plistString = nil;
-    //NSDictionary *plist = nil;
-
-    NSString *file = [[NSString alloc]  initWithBytes:cfilename
-                                                      length:strlen(cfilename)
-                                                      encoding:NSUTF8StringEncoding];
-    @try {
-        CMSDecoderCreate(&decoder);
-        NSData *fileData = [NSData dataWithContentsOfFile:file];
-        CMSDecoderUpdateMessage(decoder, fileData.bytes, fileData.length);
-        CMSDecoderFinalizeMessage(decoder);
-        CMSDecoderCopyContent(decoder, &dataRef);
-        plistString = [[[NSString alloc] initWithData:(NSData *)dataRef encoding:NSUTF8StringEncoding] autorelease];
-        //plist = [plistString propertyList];
-    }
-    @catch (NSException *exception) {
-        printf("Could not decode file.\n");
-    }
-    @finally {
-        if (decoder) CFRelease(decoder);
-        if (dataRef) CFRelease(dataRef);
-    }
-
-    String value;
-
-    if (plistString)
-    {
-         value = [plistString UTF8String];
-         [plistString release];
-    }
-
-    [file release];
-
-    return value;
-}
-
-}
-
-
-
-

+ 0 - 113
Attic/AtomicEditorReference/Source/Build/BuildMac.cpp

@@ -1,113 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-#include <Atomic/IO/FileSystem.h>
-#include "../AEEditor.h"
-#include "../Project/AEProject.h"
-#include "../Project/ProjectUtils.h"
-#include "License/AELicenseSystem.h"
-
-#include "BuildMac.h"
-#include "BuildSystem.h"
-
-namespace AtomicEditor
-{
-
-BuildMac::BuildMac(Context * context) : BuildBase(context)
-{
-
-}
-
-BuildMac::~BuildMac()
-{
-
-}
-
-void BuildMac::Initialize()
-{
-    Editor* editor = GetSubsystem<Editor>();
-    Project* project = editor->GetProject();
-
-    FileSystem* fileSystem = GetSubsystem<FileSystem>();
-
-#ifdef ATOMIC_PLATFORM_WINDOWS
-    String bundleResources = fileSystem->GetProgramDir();
-#else
-    String bundleResources = fileSystem->GetAppBundleResourceFolder();
-#endif
-
-    String projectResources = project->GetResourcePath();
-    String coreDataFolder = bundleResources + "CoreData/";
-
-    AddResourceDir(coreDataFolder);
-    AddResourceDir(projectResources);
-
-    BuildResourceEntries();
-
-}
-
-void BuildMac::Build(const String& buildPath)
-{
-    buildPath_ = buildPath + "/Mac-Build";
-
-    Initialize();
-
-    BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
-
-// BEGIN LICENSE MANAGEMENT
-    LicenseSystem *licenseSystem = GetSubsystem<LicenseSystem>();
-    if (licenseSystem->IsStandardLicense())
-    {
-        if (containsMDL_)
-        {
-            buildSystem->BuildComplete(AE_PLATFORM_MAC, buildPath_, false, true);
-            return;
-        }
-    }
-// END LICENSE MANAGEMENT
-
-    FileSystem* fileSystem = GetSubsystem<FileSystem>();
-    if (fileSystem->DirExists(buildPath_))
-        fileSystem->RemoveDir(buildPath_, true);
-
- #ifdef ATOMIC_PLATFORM_WINDOWS
-    String buildSourceDir = fileSystem->GetProgramDir();
- #else
-    String buildSourceDir = fileSystem->GetAppBundleResourceFolder();
- #endif
-
-    buildSourceDir += "Deployment/MacOS/AtomicPlayer.app";
-
-    fileSystem->CreateDir(buildPath_);
-
-    buildPath_ += "/AtomicPlayer.app";
-
-    fileSystem->CreateDir(buildPath_);
-
-    fileSystem->CreateDir(buildPath_ + "/Contents");
-    fileSystem->CreateDir(buildPath_ + "/Contents/MacOS");
-    fileSystem->CreateDir(buildPath_ + "/Contents/Resources");
-
-    String resourcePackagePath = buildPath_ + "/Contents/Resources/AtomicResources.pak";
-    GenerateResourcePackage(resourcePackagePath);
-
-    fileSystem->Copy(buildSourceDir + "/Contents/Resources/Atomic.icns", buildPath_ + "/Contents/Resources/Atomic.icns");
-
-    fileSystem->Copy(buildSourceDir + "/Contents/Info.plist", buildPath_ + "/Contents/Info.plist");
-    fileSystem->Copy(buildSourceDir + "/Contents/MacOS/AtomicPlayer", buildPath_ + "/Contents/MacOS/AtomicPlayer");
-
-#ifdef ATOMIC_PLATFORM_OSX
-    Vector<String> args;
-    args.Push("+x");
-    args.Push(buildPath_ + "/Contents/MacOS/AtomicPlayer");
-    fileSystem->SystemRun("chmod", args);
-#endif
-
-    buildPath_ = buildPath + "/Mac-Build";    
-    buildSystem->BuildComplete(AE_PLATFORM_MAC, buildPath_);
-
-}
-
-}

+ 0 - 30
Attic/AtomicEditorReference/Source/Build/BuildMac.h

@@ -1,30 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include "BuildBase.h"
-
-namespace AtomicEditor
-{
-
-class BuildMac : public BuildBase
-{
-    OBJECT(BuildMac);
-
-public:
-
-    BuildMac(Context* context);
-    virtual ~BuildMac();
-
-    void Build(const String& buildPath);
-
-protected:
-
-    void Initialize();
-
-
-};
-
-}

+ 0 - 202
Attic/AtomicEditorReference/Source/Build/BuildSettings.cpp

@@ -1,202 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-#include <Atomic/Core/CoreEvents.h>
-#include "AtomicEditor.h"
-#include "BuildSettings.h"
-
-namespace AtomicEditor
-{
-
-BuildSettings::BuildSettings(Context* context) :
-    Object(context)
-{
-
-}
-
-BuildSettings::~BuildSettings()
-{
-
-}
-
-String BuildSettings::GetStringMember(rapidjson::Value::Member* jobject, const String& name)
-{
-    rapidjson::Value::Member* member = jobject->value.FindMember(name.CString());
-
-    if (!member || !member->value.IsString())
-        return "";
-
-    return member->value.GetString();
-}
-
-void BuildSettings::Load(rapidjson::Value::Member* jobject)
-{
-    // ANDROID ------
-    rapidjson::Value::Member* jandroid = jobject->value.FindMember("android");
-    if (jandroid && jandroid->value.IsObject())
-    {
-        android_.appName = GetStringMember(jandroid, "app_name");
-        android_.package = GetStringMember(jandroid, "package");
-        android_.targetSDKVersion = GetStringMember(jandroid, "target_sdk_version");
-        android_.minSDKVersion = GetStringMember(jandroid, "min_sdk_version");
-        android_.activityName = GetStringMember(jandroid, "activity_name");
-        android_.companyName = GetStringMember(jandroid, "company_name");
-        android_.productName = GetStringMember(jandroid, "product_name");
-    }
-    // END ANDROID ------
-
-    // IOS ------
-    rapidjson::Value::Member* jios = jobject->value.FindMember("ios");
-    if (jios && jios->value.IsObject())
-    {
-        ios_.appName = GetStringMember(jios, "app_name");
-        ios_.package = GetStringMember(jios, "package");
-        ios_.provisionFile = GetStringMember(jios, "provision_file");
-        ios_.companyName = GetStringMember(jios, "company_name");
-        ios_.productName = GetStringMember(jios, "product_name");
-        ios_.appidPrefix = GetStringMember(jios, "appid_prefix");
-    }
-    // END IOS ------
-
-    // Mac ------
-    rapidjson::Value::Member* jmac = jobject->value.FindMember("mac");
-    if (jmac && jmac->value.IsObject())
-    {
-        mac_.appName = GetStringMember(jmac, "app_name");
-        mac_.package = GetStringMember(jmac, "package");
-        mac_.companyName = GetStringMember(jmac, "company_name");
-        mac_.productName = GetStringMember(jmac, "product_name");
-    }
-    // END Mac ------
-
-    // Windows ------
-    rapidjson::Value::Member* jwindows = jobject->value.FindMember("windows");
-    if (jwindows && jwindows->value.IsObject())
-    {
-        windows_.appName = GetStringMember(jwindows, "app_name");
-        windows_.package = GetStringMember(jwindows, "package");
-        windows_.companyName = GetStringMember(jwindows, "company_name");
-        windows_.productName = GetStringMember(jwindows, "product_name");
-    }
-    // END Windows ------
-
-    // WebGL ------
-    rapidjson::Value::Member* jwebgl = jobject->value.FindMember("webgl");
-    if (jwebgl && jwebgl->value.IsObject())
-    {
-        webgl_.appName = GetStringMember(jwebgl, "app_name");
-        webgl_.package = GetStringMember(jwebgl, "package");
-        webgl_.companyName = GetStringMember(jwebgl, "company_name");
-        webgl_.productName = GetStringMember(jwebgl, "product_name");
-    }
-    // END WebGL ------
-
-}
-
-void BuildSettings::Save(rapidjson::PrettyWriter<rapidjson::FileStream>& writer)
-{
-    writer.String("build_settings");
-    writer.StartObject();
-
-    writer.String("version");
-    writer.Int(1);
-
-    // ANDROID ------
-    writer.String("android");
-    writer.StartObject();
-
-    writer.String("app_name");
-    writer.String(android_.appName.CString());
-    writer.String("package");
-    writer.String(android_.package.CString());
-    writer.String("target_sdk_version");
-    writer.String(android_.targetSDKVersion.CString());
-    writer.String("min_sdk_version");
-    writer.String(android_.minSDKVersion.CString());
-    writer.String("activity_name");
-    writer.String(android_.activityName.CString());
-    writer.String("company_name");
-    writer.String(android_.companyName.CString());
-    writer.String("product_name");
-    writer.String(android_.productName.CString());
-
-    writer.EndObject();
-    // END ANDROID ------
-
-    // IOS ------
-    writer.String("ios");
-    writer.StartObject();
-
-    writer.String("app_name");
-    writer.String(ios_.appName.CString());
-    writer.String("package");
-    writer.String(ios_.package.CString());
-    writer.String("provision_file");
-    writer.String(ios_.provisionFile.CString());
-    writer.String("company_name");
-    writer.String(ios_.companyName.CString());
-    writer.String("product_name");
-    writer.String(ios_.productName.CString());
-    writer.String("appid_prefix");
-    writer.String(ios_.appidPrefix.CString());
-
-    writer.EndObject();
-    // END IOS ------
-
-    // Mac ------
-    writer.String("mac");
-    writer.StartObject();
-
-    writer.String("app_name");
-    writer.String(mac_.appName.CString());
-    writer.String("package");
-    writer.String(mac_.package.CString());
-    writer.String("company_name");
-    writer.String(mac_.companyName.CString());
-    writer.String("product_name");
-    writer.String(mac_.productName.CString());
-
-    writer.EndObject();
-    // END Mac ------
-
-    // Windows ------
-    writer.String("windows");
-    writer.StartObject();
-
-    writer.String("app_name");
-    writer.String(windows_.appName.CString());
-    writer.String("package");
-    writer.String(windows_.package.CString());
-    writer.String("company_name");
-    writer.String(windows_.companyName.CString());
-    writer.String("product_name");
-    writer.String(windows_.productName.CString());
-
-    writer.EndObject();
-    // END Windows ------
-
-    // WebGL ------
-    writer.String("webgl");
-    writer.StartObject();
-
-    writer.String("app_name");
-    writer.String(webgl_.appName.CString());
-    writer.String("package");
-    writer.String(webgl_.package.CString());
-    writer.String("company_name");
-    writer.String(webgl_.companyName.CString());
-    writer.String("product_name");
-    writer.String(webgl_.productName.CString());
-
-    writer.EndObject();
-    // END WebGL ------
-
-
-    writer.EndObject();
-
-}
-
-}
-

+ 0 - 105
Attic/AtomicEditorReference/Source/Build/BuildSettings.h

@@ -1,105 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <rapidjson/document.h>
-#include <rapidjson/filestream.h>
-#include <rapidjson/prettywriter.h>
-
-#include <Atomic/Container/Str.h>
-#include <Atomic/Core/Object.h>
-
-using namespace Atomic;
-
-namespace AtomicEditor
-{
-
-struct AndroidBuildSettings
-{
-    String appName;
-    String package;
-    String targetSDKVersion;
-    String minSDKVersion;
-    String activityName;
-    String companyName;
-    String productName;
-};
-
-struct IOSBuildSettings
-{
-    String appName;
-    String package;
-    String companyName;
-    String productName;
-    String provisionFile;
-    String appidPrefix;
-};
-
-struct MacBuildSettings
-{
-    String appName;
-    String package;
-    String companyName;
-    String productName;
-};
-
-struct WindowsBuildSettings
-{
-    String appName;
-    String package;
-    String companyName;
-    String productName;
-};
-
-struct WebGLSettings
-{
-    String appName;
-    String package;
-    String companyName;
-    String productName;
-};
-
-
-class BuildSettings : public Object
-{
-    OBJECT(BuildSettings);
-
-public:
-    /// Construct.
-    BuildSettings(Context* context);
-    /// Destruct.
-    virtual ~BuildSettings();
-
-    const AndroidBuildSettings& GetAndroidSettings() { return android_; }
-    void SetAndroidSettings(const AndroidBuildSettings& settings) { android_ = settings; }
-
-    const IOSBuildSettings& GetIOSSettings() { return ios_; }
-    void SetIOSSettings(const IOSBuildSettings& settings) { ios_ = settings; }
-
-    const MacBuildSettings& GetMacSettings() { return mac_; }
-    void SetMacSettings(const MacBuildSettings& settings) { mac_ = settings; }
-
-    const WindowsBuildSettings& GetWindowsSettings() { return windows_; }
-    void SetWindowsSettings(const WindowsBuildSettings& settings) { windows_ = settings; }
-
-    const WebGLSettings& GetWebGLSettings() { return webgl_; }
-    void SetWebGLSettings(const WebGLSettings& settings) { webgl_ = settings; }
-
-    void Load(rapidjson::Value::Member* jobject);
-    void Save(rapidjson::PrettyWriter<rapidjson::FileStream>& writer);
-
-private:
-
-    String GetStringMember(rapidjson::Value::Member* jobject, const String& name);
-
-    AndroidBuildSettings android_;
-    IOSBuildSettings ios_;
-    MacBuildSettings mac_;
-    WindowsBuildSettings windows_;
-    WebGLSettings webgl_;
-
-};
-
-}

+ 0 - 189
Attic/AtomicEditorReference/Source/Build/BuildSystem.cpp

@@ -1,189 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-#include <Atomic/Core/Context.h>
-#include <Atomic/Core/StringUtils.h>
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/IO/Log.h>
-
-#include "BuildSystem.h"
-#include "BuildMac.h"
-#include "BuildWindows.h"
-#include "BuildAndroid.h"
-#include "BuildIOS.h"
-#include "BuildWeb.h"
-
-#include "UI/Modal/UIModalOps.h"
-
-#include "../AEEvents.h"
-#include "../AEEditor.h"
-
-namespace AtomicEditor
-{
-
-BuildSystem::BuildSystem(Context* context) :
-    Object(context)
-{
-    buildSettings_ = new BuildSettings(context);
-
-    SubscribeToEvent(E_EDITORBUILD, HANDLER(BuildSystem, HandleEditorBuild));
-    SubscribeToEvent(E_EDITORSHUTDOWN, HANDLER(BuildSystem, HandleEditorShutdown));
-
-}
-
-BuildSystem::~BuildSystem()
-{
-
-}
-
-void BuildSystem::ClearBuildCompleteUI()
-{
-    if (uiBuildComplete_.Null())
-        return;
-
-    uiBuildComplete_->Hide();
-
-    uiBuildComplete_ = 0;
-
-}
-
-void BuildSystem::BuildComplete(AEEditorPlatform platform, const String &buildFolder, bool success, bool fail3D)
-{
-    String title;
-    String message;
-
-    if (platform == AE_PLATFORM_ANDROID)
-    {
-        title = "Android Deployment";
-        message = "Android Deployment";
-    }
-    else if (platform == AE_PLATFORM_IOS)
-    {
-        title = "iOS Deployment";
-        message = "iOS Deployment";
-    }
-    else if (platform == AE_PLATFORM_MAC)
-    {
-        title = "Mac Deployment";
-        message = "Mac Deployment";
-    }
-    else if (platform == AE_PLATFORM_WINDOWS)
-    {
-        title = "Windows Deployment";
-        message = "Windows Deployment";
-    }
-    else if (platform == AE_PLATFORM_HTML5)
-    {
-        title = "Web Deployment";
-        message = "Web Deployment";
-    }
-
-    if (success)
-    {
-        title += " Success";
-        message += " Success";
-    }
-    else
-    {
-        title += " Failed";
-        message += " Failed";
-    }
-
-// BEGIN LICENSE MANAGEMENT
-    if (fail3D)
-    {
-        UIModalOps* ops = GetSubsystem<UIModalOps>();
-        ops->ShowInfoModule3D();
-    }
-    else
-    {
-        uiBuildComplete_ = new UIBuildComplete(context_, title, message, buildFolder, success);
-        uiBuildComplete_->Show();
-    }
-
-// END LICENSE MANAGEMENT
-
-    currentBuild_ = 0;
-}
-
-void BuildSystem::DoBuildMac(const String& buildPath)
-{
-    currentBuild_ = SharedPtr<BuildBase>(new BuildMac(context_));
-    currentBuild_->Build(buildPath);
-}
-
-void BuildSystem::DoBuildWindows(const String& buildPath)
-{
-    currentBuild_ = SharedPtr<BuildBase>(new BuildWindows(context_));
-    currentBuild_->Build(buildPath);
-}
-
-void BuildSystem::DoBuildAndroid(const String& buildPath)
-{
-    currentBuild_ = SharedPtr<BuildBase>(new BuildAndroid(context_));
-    currentBuild_->Build(buildPath);
-
-}
-
-void BuildSystem::DoBuildWeb(const String& buildPath)
-{
-    currentBuild_ = SharedPtr<BuildBase>(new BuildWeb(context_));
-    currentBuild_->Build(buildPath);
-
-}
-
-void BuildSystem::DoBuildIOS(const String& buildPath)
-{
-    currentBuild_ = SharedPtr<BuildBase>(new BuildIOS(context_));
-    currentBuild_->Build(buildPath);
-}
-
-void BuildSystem::LoadBuildSettings(rapidjson::Value::Member* jobject)
-{
-    buildSettings_->Load(jobject);
-}
-
-void BuildSystem::SaveBuildSettings(rapidjson::PrettyWriter<rapidjson::FileStream>& writer)
-{
-    buildSettings_->Save(writer);
-}
-
-
-void BuildSystem::HandleEditorBuild(StringHash eventType, VariantMap& eventData)
-{
-    using namespace EditorBuild;
-
-    String buildPlatform = eventData[P_PLATFORM].GetString();
-    String buildPath = eventData[P_BUILDPATH].GetString();
-
-    if (buildPlatform == "Mac")
-    {
-        DoBuildMac(buildPath);
-    }
-    else if (buildPlatform == "Windows")
-    {
-        DoBuildWindows(buildPath);
-    }
-    else if (buildPlatform == "Android")
-    {
-        DoBuildAndroid(buildPath);
-    }
-    else if (buildPlatform == "HTML5")
-    {
-        DoBuildWeb(buildPath);
-    }
-    else if (buildPlatform == "IOS")
-    {
-        DoBuildIOS(buildPath);
-    }
-
-}
-
-void BuildSystem::HandleEditorShutdown(StringHash eventType, VariantMap& eventData)
-{
-    context_->RemoveSubsystem(GetType());
-}
-
-}

+ 0 - 54
Attic/AtomicEditorReference/Source/Build/BuildSystem.h

@@ -1,54 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <Atomic/Core/Object.h>
-#include "BuildSettings.h"
-#include "BuildBase.h"
-
-using namespace Atomic;
-
-#include "UI/Modal/UIBuildComplete.h"
-
-namespace AtomicEditor
-{
-
-class BuildSystem : public Object
-{
-    OBJECT(BuildSystem);
-
-public:
-    /// Construct.
-    BuildSystem(Context* context);
-    /// Destruct.
-    virtual ~BuildSystem();
-
-    BuildSettings* GetBuildSettings() { return buildSettings_; }
-
-    void LoadBuildSettings(rapidjson::Value::Member* jobject);
-    void SaveBuildSettings(rapidjson::PrettyWriter<rapidjson::FileStream>& writer);
-
-    void ClearBuildCompleteUI();
-    void BuildComplete(AEEditorPlatform platform,const String& buildFolder, bool success = true, bool fail3D = false);
-
-private:
-
-    void DoBuildMac(const String& buildPath);
-    void DoBuildWindows(const String& buildPath);
-    void DoBuildAndroid(const String& buildPath);
-    void DoBuildIOS(const String& buildPath);
-    void DoBuildWeb(const String& buildPath);
-
-    SharedPtr<BuildSettings> buildSettings_;
-    SharedPtr<BuildBase> currentBuild_;
-
-    SharedPtr<UIBuildComplete> uiBuildComplete_;
-
-    void HandleEditorBuild(StringHash eventType, VariantMap& eventData);
-    void HandleEditorShutdown(StringHash eventType, VariantMap& eventData);
-};
-
-
-}

+ 0 - 40
Attic/AtomicEditorReference/Source/Build/BuildTypes.h

@@ -1,40 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include <Atomic/Container/Str.h>
-
-#pragma once
-
-using namespace Atomic;
-
-namespace AtomicEditor
-{
-
-struct BuildResourceEntry
-{
-    // the resource directory this resource came from
-    String resourceDir_;
-
-    // the absolute path to the resource
-    String absolutePath_;
-
-    // the path within the package
-    String packagePath_;
-
-    // the offset in the package file
-    unsigned offset_;
-
-    // the size in the resource
-    unsigned size_;
-
-    // the checksum_
-    unsigned checksum_;
-
-    BuildResourceEntry()
-    {
-        offset_ = size_ = checksum_ = 0;
-    }
-};
-
-}

+ 0 - 97
Attic/AtomicEditorReference/Source/Build/BuildWeb.cpp

@@ -1,97 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/IO/File.h>
-#include "../AEEditor.h"
-#include "../Project/AEProject.h"
-
-#include "../Project/ProjectUtils.h"
-
-#include "BuildSystem.h"
-#include "BuildWeb.h"
-
-namespace AtomicEditor
-{
-
-BuildWeb::BuildWeb(Context * context) : BuildBase(context)
-{
-
-}
-
-BuildWeb::~BuildWeb()
-{
-
-}
-
-void BuildWeb::Initialize()
-{
-    Editor* editor = GetSubsystem<Editor>();
-    Project* project = editor->GetProject();
-
-    FileSystem* fileSystem = GetSubsystem<FileSystem>();
-    String bundleResources = fileSystem->GetAppBundleResourceFolder();
-
-    String projectResources = project->GetResourcePath();
-    String coreDataFolder = bundleResources + "CoreData/";
-
-    AddResourceDir(coreDataFolder);
-    AddResourceDir(projectResources);
-
-    BuildResourceEntries();
-}
-void BuildWeb::Build(const String& buildPath)
-{
-    buildPath_ = buildPath + "/Web-Build";
-
-    Initialize();
-
-    FileSystem* fileSystem = GetSubsystem<FileSystem>();
-    if (fileSystem->DirExists(buildPath_))
-        fileSystem->RemoveDir(buildPath_, true);
-
-    String buildSourceDir = fileSystem->GetAppBundleResourceFolder();
-    buildSourceDir += "Deployment/Web";
-
-    fileSystem->CreateDir(buildPath_);
-
-    String resourcePackagePath = buildPath_ + "/AtomicResources.data";
-    GenerateResourcePackage(resourcePackagePath);
-
-    fileSystem->Copy(buildSourceDir + "/AtomicPlayer.html", buildPath_ + "/AtomicPlayer.html");
-    fileSystem->Copy(buildSourceDir + "/AtomicPlayer.js", buildPath_ + "/AtomicPlayer.js");
-
-    File file(context_, buildSourceDir + "/AtomicResources_js.template", FILE_READ);
-    unsigned size = file.GetSize();
-
-    SharedArrayPtr<char> buffer(new char[size + 1]);
-    file.Read(buffer.Get(), size);
-    buffer[size] = '\0';
-
-    String resourcejs = (const char*) buffer.Get();
-
-    file.Close();
-
-    file.Open(buildPath_ + "/AtomicResources.data", FILE_READ);
-    int rsize = (int) file.GetSize();
-    file.Close();
-
-    String request;
-    request.AppendWithFormat("new DataRequest(0, %i, 0, 0).open('GET', '/AtomicResources.pak');", rsize);
-
-    resourcejs.Replace("$$ATOMIC_RESOURCES_DATA_REQUEST$$", request);
-
-    file.Open(buildPath_ + "/AtomicResources.js", FILE_WRITE);
-    file.Write(resourcejs.CString(), resourcejs.Length());
-    file.Close();
-
-    BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
-    buildSystem->BuildComplete(AE_PLATFORM_HTML5, buildPath_);
-
-    //fileSystem->SystemCommandAsync("/Applications/Firefox.app/Contents/MacOS/firefox");
-
-}
-
-}

+ 0 - 30
Attic/AtomicEditorReference/Source/Build/BuildWeb.h

@@ -1,30 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include "BuildBase.h"
-
-namespace AtomicEditor
-{
-
-class BuildWeb : public BuildBase
-{
-    OBJECT(BuildWeb);
-
-public:
-
-    BuildWeb(Context* context);
-    virtual ~BuildWeb();
-
-    void Build(const String& buildPath);
-
-protected:
-
-    void Initialize();
-
-
-};
-
-}

+ 0 - 97
Attic/AtomicEditorReference/Source/Build/BuildWindows.cpp

@@ -1,97 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-#include <Atomic/IO/FileSystem.h>
-#include "../AEEditor.h"
-#include "../Project/AEProject.h"
-
-#include "../Project/ProjectUtils.h"
-#include "License/AELicenseSystem.h"
-
-#include "BuildSystem.h"
-#include "BuildWindows.h"
-
-namespace AtomicEditor
-{
-
-BuildWindows::BuildWindows(Context * context) : BuildBase(context)
-{
-
-}
-
-BuildWindows::~BuildWindows()
-{
-
-}
-
-void BuildWindows::Initialize()
-{
-    Editor* editor = GetSubsystem<Editor>();
-    Project* project = editor->GetProject();
-
-    FileSystem* fileSystem = GetSubsystem<FileSystem>();
-
-#ifdef ATOMIC_PLATFORM_WINDOWS
-    String bundleResources = fileSystem->GetProgramDir();
-#else
-    String bundleResources = fileSystem->GetAppBundleResourceFolder();
-#endif
-
-    String projectResources = project->GetResourcePath();
-    String coreDataFolder = bundleResources + "CoreData/";
-
-    AddResourceDir(coreDataFolder);
-    AddResourceDir(projectResources);
-
-    BuildResourceEntries();
-
-}
-
-void BuildWindows::Build(const String& buildPath)
-{
-    buildPath_ = buildPath + "/Windows-Build";
-
-    Initialize();
-
-    BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
-
-// BEGIN LICENSE MANAGEMENT
-    LicenseSystem *licenseSystem = GetSubsystem<LicenseSystem>();
-    if (licenseSystem->IsStandardLicense())
-    {
-        if (containsMDL_)
-        {
-            buildSystem->BuildComplete(AE_PLATFORM_WINDOWS, buildPath_, false, true);
-            return;
-        }
-    }
-// END LICENSE MANAGEMENT
-
-    FileSystem* fileSystem = GetSubsystem<FileSystem>();
-    if (fileSystem->DirExists(buildPath_))
-        fileSystem->RemoveDir(buildPath_, true);
-
-#ifdef ATOMIC_PLATFORM_WINDOWS
-    String buildSourceDir = fileSystem->GetProgramDir();
-#else
-    String buildSourceDir = fileSystem->GetAppBundleResourceFolder();
-#endif
-
-    buildSourceDir += "Deployment/Win64";
-
-    fileSystem->CreateDir(buildPath_);
-    fileSystem->CreateDir(buildPath_ + "/AtomicPlayer_Resources");
-
-    String resourcePackagePath = buildPath_ + "/AtomicPlayer_Resources/AtomicResources.pak";
-    GenerateResourcePackage(resourcePackagePath);
-
-    fileSystem->Copy(buildSourceDir + "/AtomicPlayer.exe", buildPath_ + "/AtomicPlayer.exe");
-    fileSystem->Copy(buildSourceDir + "/D3DCompiler_47.dll", buildPath_ + "/D3DCompiler_47.dll");
-
-    buildSystem->BuildComplete(AE_PLATFORM_WINDOWS, buildPath_);
-
-}
-
-}

+ 0 - 30
Attic/AtomicEditorReference/Source/Build/BuildWindows.h

@@ -1,30 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include "BuildBase.h"
-
-namespace AtomicEditor
-{
-
-class BuildWindows : public BuildBase
-{
-    OBJECT(BuildWindows);
-
-public:
-
-    BuildWindows(Context* context);
-    virtual ~BuildWindows();
-
-    void Build(const String& buildPath);
-
-protected:
-
-    void Initialize();
-
-
-};
-
-}

+ 0 - 219
Attic/AtomicEditorReference/Source/Build/ResourcePackager.cpp

@@ -1,219 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-//
-// Portions Copyright (c) 2008-2014 the Urho3D project.
-//
-// 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.
-//
-
-#include "AtomicEditor.h"
-
-#include "Atomic/Core/StringUtils.h"
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/Container/ArrayPtr.h>
-
-#include <LZ4/lz4.h>
-#include <LZ4/lz4hc.h>
-
-#include "BuildBase.h"
-#include "ResourcePackager.h"
-
-namespace AtomicEditor
-{
-
-ResourcePackager::ResourcePackager(Context* context, BuildBase* buildBase) : Object(context)
-  , buildBase_(buildBase)
-  , checksum_(0)
-{
-
-
-}
-
-ResourcePackager::~ResourcePackager()
-{
-
-}
-
-bool ResourcePackager::WritePackageFile(const String& destFilePath)
-{
-    buildBase_->BuildLog("Writing package");
-
-    SharedPtr<File> dest(new File(context_, destFilePath, FILE_WRITE));
-    if (!dest->IsOpen())
-    {
-        buildBase_->BuildError("Could not open output file " + destFilePath);
-        return false;
-    }
-
-    // Write ID, number of files & placeholder for checksum
-    WriteHeader(dest);
-
-    for (unsigned i = 0; i < resourceEntries_.Size(); i++)
-    {
-        BuildResourceEntry* entry = resourceEntries_[i];
-
-        // Write entry (correct offset is still unknown, will be filled in later)
-        dest->WriteString(entry->packagePath_);
-        dest->WriteUInt(entry->offset_);
-        dest->WriteUInt(entry->size_);
-        dest->WriteUInt(entry->checksum_);
-    }
-
-    unsigned totalDataSize = 0;
-
-    // Write file data, calculate checksums & correct offsets
-    for (unsigned i = 0; i < resourceEntries_.Size(); i++)
-    {
-        BuildResourceEntry* entry = resourceEntries_[i];
-
-        entry->offset_ = dest->GetSize();
-
-        File srcFile(context_, entry->absolutePath_);
-        if (!srcFile.IsOpen())
-        {
-            buildBase_->BuildError("Could not open input file " + entry->absolutePath_);
-            return false;
-        }
-
-        unsigned dataSize = entry->size_;
-        totalDataSize += dataSize;
-        SharedArrayPtr<unsigned char> buffer(new unsigned char[dataSize]);
-
-        if (srcFile.Read(&buffer[0], dataSize) != dataSize)
-        {
-            buildBase_->BuildError("Could not read input file " + entry->absolutePath_);
-            return false;
-        }
-
-        srcFile.Close();
-
-        for (unsigned j = 0; j < dataSize; ++j)
-        {
-            checksum_ = SDBMHash(checksum_, buffer[j]);
-            entry->checksum_ = SDBMHash(entry->checksum_, buffer[j]);
-        }
-
-        // might not want to compress for WebGL
-        //if (!compress_)
-        //{
-        //    PrintLine(entries_[i].name_ + " size " + String(dataSize));
-        //    dest.Write(&buffer[0], entries_[i].size_);
-        //}
-        //else
-        //{
-
-        unsigned compressedBlockSize_ = 32768;
-
-        SharedArrayPtr<unsigned char> compressBuffer(new unsigned char[LZ4_compressBound(compressedBlockSize_)]);
-
-        unsigned pos = 0;
-        unsigned totalPackedBytes = 0;
-
-        while (pos < dataSize)
-        {
-            unsigned unpackedSize = compressedBlockSize_;
-            if (pos + unpackedSize > dataSize)
-                unpackedSize = dataSize - pos;
-
-            unsigned packedSize = LZ4_compressHC((const char*)&buffer[pos], (char*)compressBuffer.Get(), unpackedSize);
-            if (!packedSize)
-            {
-                buildBase_->BuildError("LZ4 compression failed for file " + entry->absolutePath_ + " at offset " + pos);
-                return false;
-            }
-
-            dest->WriteUShort(unpackedSize);
-            dest->WriteUShort(packedSize);
-            dest->Write(compressBuffer.Get(), packedSize);
-            totalPackedBytes += 6 + packedSize;
-
-            pos += unpackedSize;
-        }
-
-        buildBase_->BuildLog(entry->absolutePath_ + " in " + String(dataSize) + " out " + String(totalPackedBytes));
-        }
-    //}
-
-    // Write package size to the end of file to allow finding it linked to an executable file
-    unsigned currentSize = dest->GetSize();
-    dest->WriteUInt(currentSize + sizeof(unsigned));
-
-    // Write header again with correct offsets & checksums
-    dest->Seek(0);
-    WriteHeader(dest);
-
-    for (unsigned i = 0; i < resourceEntries_.Size(); i++)
-    {
-        BuildResourceEntry* entry = resourceEntries_[i];
-
-        dest->WriteString(entry->packagePath_);
-        dest->WriteUInt(entry->offset_);
-        dest->WriteUInt(entry->size_);
-        dest->WriteUInt(entry->checksum_);
-    }
-
-    buildBase_->BuildLog("Number of files " + String(resourceEntries_.Size()));
-    buildBase_->BuildLog("File data size " + String(totalDataSize));
-    buildBase_->BuildLog("Package size " + String(dest->GetSize()));
-
-    return true;
-}
-
-void ResourcePackager::WriteHeader(File* dest)
-{
-    dest->WriteFileID("ULZ4");
-    dest->WriteUInt(resourceEntries_.Size());
-    dest->WriteUInt(checksum_);
-}
-
-
-void ResourcePackager::GeneratePackage(const String& destFilePath)
-{
-    for (unsigned i = 0; i < resourceEntries_.Size(); i++)
-    {
-        BuildResourceEntry* entry = resourceEntries_[i];
-
-        File file(context_);
-
-        if (!file.Open(entry->absolutePath_))
-        {
-            buildBase_->BuildError(Atomic::ToString("Could not open resource file %s", entry->absolutePath_.CString()));
-            return;
-        }
-
-        if (!file.GetSize())
-        {
-            return;
-        }
-
-        entry->size_ = file.GetSize();
-    }
-
-    WritePackageFile(destFilePath);
-
-}
-
-void ResourcePackager::AddResourceEntry(BuildResourceEntry* entry)
-{
-    resourceEntries_.Push(entry);
-}
-
-}

+ 0 - 46
Attic/AtomicEditorReference/Source/Build/ResourcePackager.h

@@ -1,46 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <Atomic/Core/Object.h>
-#include "Atomic/Container/Vector.h"
-#include <Atomic/IO/File.h>
-
-#include "BuildTypes.h"
-
-using namespace Atomic;
-
-namespace AtomicEditor
-{
-
-class BuildBase;
-
-class ResourcePackager : public Object
-{
-    OBJECT(ResourcePackager);
-
-public:
-
-    ResourcePackager(Context* context, BuildBase* buildBase);
-    virtual ~ResourcePackager();
-
-    void AddResourceEntry(BuildResourceEntry* entry);
-
-    void GeneratePackage(const String& destFilePath);
-
-private:
-
-    void WriteHeader(File* dest);
-    bool WritePackageFile(const String& destFilePath);
-
-    PODVector<BuildResourceEntry*> resourceEntries_;
-
-    WeakPtr<BuildBase> buildBase_;
-
-    unsigned checksum_;
-
-};
-
-}

+ 0 - 553
Attic/AtomicEditorReference/Source/Editors/JSResourceEditor.cpp

@@ -1,553 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-#include <Atomic/Container/ArrayPtr.h>
-#include <Atomic/UI/UI.h>
-#include <Atomic/IO/Log.h>
-#include <Atomic/IO/File.h>
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/Resource/ResourceCache.h>
-#include <Atomic/Core/CoreEvents.h>
-
-#include "../AEEvents.h"
-#include "../UI/UIFindTextWidget.h"
-
-
-
-#include "JSResourceEditor.h"
-
-#include "../AEJavascript.h"
-
-#include "../Javascript/JSAutocomplete.h"
-#include "../Javascript/JSTheme.h"
-#include "../Javascript/JSASTSyntaxColorVisitor.h"
-#ifdef USE_SPIDERMONKEY
-#include "../Javascript/JSSpiderMonkeyVM.h"
-#endif
-
-#include <TurboBadger/tb_message_window.h>
-#include <TurboBadger/tb_editfield.h>
-#include <TurboBadger/tb_style_edit.h>
-#include <TurboBadger/tb_style_edit_content.h>
-
-using namespace tb;
-
-namespace AtomicEditor
-{
-
-JSResourceEditor ::JSResourceEditor(Context* context, const String &fullpath, TBTabContainer *container) :
-    ResourceEditor(context, fullpath, container),
-    styleEdit_(0),
-    lineNumberList_(0),
-    editField_(0),
-    autocomplete_(0),
-    textDirty_(true),
-    textDelta_(0.0f),
-    modified_(false),
-    currentFindPos_(-1)
-{
-
-    TBLayout* layout = new TBLayout();
-    layout->SetLayoutSize(LAYOUT_SIZE_GRAVITY);
-    layout->SetGravity(WIDGET_GRAVITY_ALL);
-    layout->SetLayoutDistribution(LAYOUT_DISTRIBUTION_GRAVITY);
-
-    rootContentWidget_->AddChild(layout);
-
-    TBContainer* c = new TBContainer();
-    c->SetGravity(WIDGET_GRAVITY_ALL);
-
-    TBEditField* text = editField_ = new TBEditField();
-    text->SetMultiline(true);
-    text->SetWrapping(true);
-    text->SetGravity(WIDGET_GRAVITY_ALL);
-    text->SetStyling(true);
-    text->SetSkinBg(TBIDC("TextCode"));
-
-    TBFontDescription fd;
-    fd.SetID(TBIDC("Monaco"));
-    fd.SetSize(12);
-    text->SetFontDescription(fd);
-
-    SharedPtr<File> jsFile(GetSubsystem<ResourceCache>()->GetFile(fullpath));
-    assert(jsFile);
-
-    String source;
-    jsFile->ReadText(source);
-
-    String json;
-
-    JSASTProgram* program = NULL;
-    //JSSpiderMonkeyVM* smjs = GetSubsystem<JSSpiderMonkeyVM>();
-    AEJavascript* smjs = GetSubsystem<AEJavascript>();
-    if (smjs->ParseJavascriptToJSON(source.CString(), json))
-    {
-        program = JSASTProgram::ParseFromJSON(fullpath, json);
-    }
-
-    text->SetText(source.CString());
-
-    lineNumberList_ = new TBSelectList();
-    lineNumberList_->SetFontDescription(fd);
-    lineNumberList_->SetSkinBg(TBIDC("LineNumberSelectList"));
-    lineNumberList_->GetScrollContainer()->SetScrollMode(SCROLL_MODE_OFF);
-    //lineNumberList_->GetScrollContainer()->SetIgnoreScrollEvents(true);
-    lineNumberList_->SetGravity(WIDGET_GRAVITY_ALL);
-    LayoutParams lp;
-    lp.max_w = 48;
-    lineNumberList_->SetLayoutParams(lp);
-
-    c->AddChild(text);
-
-    layout->AddChild(lineNumberList_);
-    layout->AddChild(c);
-    layout->SetSpacing(0);
-
-    TBStyleEdit* sedit = text->GetStyleEdit();
-    TBTextTheme* theme = new TBTextTheme();
-    for (unsigned i = 0; i < TB_MAX_TEXT_THEME_COLORS; i++)
-        theme->themeColors[i] = TBColor(255, 255, 255);
-
-    theme->themeColors[JSTHEME_LITERAL_STRING].SetFromString("#E6DB74", 7);
-
-    theme->themeColors[JSTHEME_LITERAL_NUMBER].SetFromString("#AE81FF", 7);
-    theme->themeColors[JSTHEME_LITERAL_REGEX].SetFromString("#AE81FF", 7);
-    theme->themeColors[JSTHEME_LITERAL_BOOLEAN].SetFromString("#AE81FF", 7);
-    theme->themeColors[JSTHEME_LITERAL_NULL].SetFromString("#AE81FF", 7);
-
-    theme->themeColors[JSTHEME_FUNCTION].SetFromString("#66D9EF", 7);
-    theme->themeColors[JSTHEME_VAR].SetFromString("#66D9EF", 7);
-
-
-    theme->themeColors[JSTHEME_KEYWORD].SetFromString("#f92672", 7);
-    theme->themeColors[JSTHEME_OPERATOR].SetFromString("#f92672", 7);
-
-    theme->themeColors[JSTHEME_CODE].SetFromString("#a6e22e", 7);
-    theme->themeColors[JSTHEME_COMMENT].SetFromString("#75715e", 7);
-
-    theme->themeColors[JSTHEME_FUNCTIONDECLARG].SetFromString("#FF9800", 7);
-
-    sedit->SetTextTheme(theme);
-
-    sedit->text_change_listener = this;
-
-    styleEdit_ = sedit;
-    UpdateLineNumbers();
-
-    if (program)
-    {
-        JSASTSyntaxColorVisitor syntaxColor(sedit);
-        syntaxColor.visit(program);
-    }
-
-    autocomplete_ = new JSAutocomplete(text);
-    autocomplete_->UpdateLocals();
-
-    SubscribeToEvent(E_UPDATE, HANDLER(JSResourceEditor, HandleUpdate));
-
-    // FIXME: Set the size at the end of setup, so all children are updated accordingly
-    // future size changes will be handled automatically
-    TBRect rect = container_->GetContentRoot()->GetRect();
-    rootContentWidget_->SetSize(rect.w, rect.h);
-}
-
-JSResourceEditor::~JSResourceEditor()
-{
-}
-
-void JSResourceEditor::UpdateLineNumbers()
-{
-    if (!styleEdit_)
-        return;
-
-    TBGenericStringItemSource* lineSource = lineNumberList_->GetDefaultSource();
-
-    int lines = lineSource->GetNumItems();
-
-    int lineCount = styleEdit_->blocks.CountLinks();
-
-    if (lines == lineCount)
-        return;
-
-    while (lines > lineCount)
-    {
-        lineSource->DeleteItem(lineSource->GetNumItems() - 1);
-        lines --;
-    }
-
-    for (int i = lines; i < lineCount; i++)
-    {
-        String sline;
-        sline.AppendWithFormat("%i  ", i + 1);
-        TBGenericStringItem* item = new TBGenericStringItem(sline.CString());
-        lineSource->AddItem(item);
-
-    }
-
-    // item widgets don't exist until ValidateList
-    lineNumberList_->ValidateList();
-
-    for (int i = 0; i < lineCount; i++)
-    {
-        TBTextField* textField = (TBTextField* )lineNumberList_->GetItemWidget(i);
-
-        if (textField)
-        {
-            textField->SetTextAlign(TB_TEXT_ALIGN_RIGHT);
-            textField->SetSkinBg(TBIDC("TBSelectItemLineNumber"));
-        }
-
-    }
-
-}
-
-void JSResourceEditor::OnChange(TBStyleEdit* styleEdit)
-{
-    textDelta_ = 0.25f;
-    textDirty_ = true;
-    modified_ = true;
-
-    String filename = GetFileNameAndExtension(fullpath_);
-    filename += "*";
-    button_->SetText(filename.CString());
-
-    autocomplete_->Hide();
-
-    TBTextFragment* fragment = 0;
-    int ofs = styleEdit_->caret.pos.ofs;
-    fragment = styleEdit_->caret.pos.block->FindFragment(ofs, true);
-
-    if (fragment && fragment->len && (styleEdit_->caret.pos.ofs == (fragment->ofs + fragment->len)))
-    {
-        String value(fragment->Str(), fragment->len);
-        bool hasCompletions = autocomplete_->UpdateCompletions(value);
-
-        if (hasCompletions)
-        {
-            autocomplete_->SetPosition(TBPoint(fragment->xpos, (styleEdit_->caret.y - styleEdit_->scroll_y) + fragment->line_height));
-            autocomplete_->Show();
-        }
-    }
-
-    UpdateLineNumbers();
-}
-
-bool JSResourceEditor::OnEvent(const TBWidgetEvent &ev)
-{
-    if (ev.type == EVENT_TYPE_KEY_DOWN)
-    {
-        if (autocomplete_ && autocomplete_->Visible())
-        {
-            return autocomplete_->OnEvent(ev);
-        }
-
-        if (ev.special_key == TB_KEY_ESC)
-        {
-            SendEvent(E_FINDTEXTCLOSE);
-        }
-
-    }
-
-    if (ev.type == EVENT_TYPE_SHORTCUT)
-    {
-        if (ev.ref_id == TBIDC("close"))
-        {
-            if (modified_)
-            {
-                TBMessageWindow *msg_win = new TBMessageWindow(container_, TBIDC("unsaved_jsmodifications_dialog"));
-                TBMessageWindowSettings settings(TB_MSG_OK_CANCEL, TBID(uint32(0)));
-                settings.dimmer = true;
-                settings.styling = true;
-                msg_win->Show("Unsaved Modifications", "There are unsaved modications.\nDo you wish to discard them and close?", &settings, 640, 360);
-            }
-            else
-            {
-                Close();
-            }
-
-        }
-
-        if (ev.ref_id == TBIDC("save") && modified_)
-        {
-            TBStr text;
-            styleEdit_->GetText(text);
-            File file(context_, fullpath_, FILE_WRITE);
-            file.Write((void*) text.CStr(), text.Length());
-            file.Close();
-
-            String filename = GetFileNameAndExtension(fullpath_);
-            button_->SetText(filename.CString());
-            modified_ = false;
-            SendEvent(E_JAVASCRIPTSAVED);
-
-            return true;
-        }
-        else if (ev.ref_id == TBIDC("find"))
-        {
-            using namespace FindTextOpen;
-            SendEvent(E_FINDTEXTOPEN);
-        }
-        else if (ev.ref_id == TBIDC("findnext") || ev.ref_id == TBIDC("findprev"))
-        {
-            String text;
-
-            FindTextWidget* finder = GetSubsystem<FindTextWidget>();
-            finder->GetFindText(text);
-
-            // TODO: get flags from finder
-            unsigned flags = FINDTEXT_FLAG_NONE;
-
-            if (ev.ref_id == TBIDC("findnext"))
-                flags |= FINDTEXT_FLAG_NEXT;
-            else if (ev.ref_id == TBIDC("findprev"))
-                flags |= FINDTEXT_FLAG_PREV;
-
-            flags |= FINDTEXT_FLAG_WRAP;
-
-            finder->Find(text, flags);
-        }
-        else if (ev.ref_id == TBIDC("beautify"))
-        {
-            TBStr text;
-            styleEdit_->GetText(text);
-
-            if (text.Length())
-            {
-                AEJavascript* smjs = GetSubsystem<AEJavascript>();
-                String output;
-                if (smjs->BeautifyJavascript(text.CStr(), output))
-                {
-                    if (output.Length())
-                    {
-                        styleEdit_->selection.SelectAll();
-                        styleEdit_->InsertText(output.CString(), output.Length());
-                    }
-                }
-            }
-        }
-        else if (ev.ref_id == TBIDC("cut") || ev.ref_id == TBIDC("copy") || ev.ref_id == TBIDC("paste")
-                 || ev.ref_id == TBIDC("selectall") || ev.ref_id == TBIDC("undo") || ev.ref_id == TBIDC("redo") )
-        {
-            editField_->OnEvent(ev);
-        }
-    }
-
-    if (ev.type == EVENT_TYPE_CLICK)
-    {
-        if (ev.target->GetID() == TBIDC("unsaved_jsmodifications_dialog"))
-        {
-            if (ev.ref_id == TBIDC("TBMessageWindow.ok"))
-            {
-                Close();
-            }
-            else
-            {
-                SetFocus();
-            }
-
-            return true;
-        }
-
-    }
-
-    return false;
-}
-
-void JSResourceEditor::HandleUpdate(StringHash eventType, VariantMap& eventData)
-{
-
-    if (!styleEdit_)
-        return;
-
-    // sync line number
-    lineNumberList_->GetScrollContainer()->ScrollTo(0, styleEdit_->scroll_y);
-    lineNumberList_->SetValue(styleEdit_->GetCaretLine());
-
-    if (autocomplete_->Visible())
-    {
-        TBTextFragment* fragment = 0;
-        int ofs = styleEdit_->caret.pos.ofs;
-        fragment = styleEdit_->caret.pos.block->FindFragment(ofs, true);
-
-        if (fragment && (styleEdit_->caret.pos.ofs == (fragment->ofs + fragment->len)))
-        {
-            String value(fragment->Str(), fragment->len);
-            bool hasCompletions = autocomplete_->UpdateCompletions(value);
-
-            if (!hasCompletions)
-            {
-                autocomplete_->Hide();
-            }
-        }
-
-    }
-
-    // Timestep parameter is same no matter what event is being listened to
-    float timeStep = eventData[Update::P_TIMESTEP].GetFloat();
-
-    if (!textDirty_)
-        return;
-
-    if (textDelta_ > 0.0f)
-    {
-        textDelta_ -= timeStep;
-        if (textDelta_ < 0.0f)
-        {
-            textDelta_ = 0.0f;
-        }
-        else
-        {
-            return;
-        }
-    }
-
-    TBStr text;
-    styleEdit_->GetText(text);
-
-    JSASTProgram* program = NULL;
-    /*
-    JSSpiderMonkeyVM* smjs = GetSubsystem<JSSpiderMonkeyVM>();
-    */
-    AEJavascript* smjs = GetSubsystem<AEJavascript>();
-    String json;
-    if (smjs->ParseJavascriptToJSON(text.CStr(), json))
-    {
-        program = JSASTProgram::ParseFromJSON("fullpath", json);
-
-        if (program)
-        {
-            JSASTSyntaxColorVisitor syntaxColor(styleEdit_);
-            syntaxColor.visit(program);
-            delete program;
-        }
-
-    }
-
-    textDirty_ = false;
-
-    editField_->SetFocus(WIDGET_FOCUS_REASON_UNKNOWN);
-
-}
-
-void JSResourceEditor::FindTextClose()
-{
-    editField_->SetFocus(WIDGET_FOCUS_REASON_UNKNOWN);
-    styleEdit_->selection.SelectNothing();
-}
-
-bool JSResourceEditor::FindText(const String& findText, unsigned flags)
-{
-    unsigned findLength = findText.Length();
-
-    if (!findLength)
-        return true;
-
-    TBStr _source;
-    styleEdit_->GetText(_source);
-    String source = _source.CStr();
-
-    unsigned pos = String::NPOS;
-    int startPos = currentFindPos_;
-
-    if (currentFindPos_ == -1)
-        startPos = styleEdit_->caret.GetGlobalOfs();
-    else
-    {
-        if (flags & FINDTEXT_FLAG_NEXT)
-            startPos += findLength;
-    }
-
-    if (flags & FINDTEXT_FLAG_PREV)
-    {
-        String pretext = source.Substring(0, startPos);
-        pos = pretext.FindLast(findText, String::NPOS, flags & FINDTEXT_FLAG_CASESENSITIVE ? true : false);
-    }
-    else
-    {
-        pos = source.Find(findText, startPos, flags & FINDTEXT_FLAG_CASESENSITIVE ? true : false);
-    }
-
-    if (pos == String::NPOS)
-    {
-        if (flags & FINDTEXT_FLAG_WRAP)
-        {
-            if (flags & FINDTEXT_FLAG_PREV)
-            {
-                pos = source.FindLast(findText, String::NPOS, flags & FINDTEXT_FLAG_CASESENSITIVE ? true : false);
-            }
-            else
-            {
-                pos = source.Find(findText, 0, flags & FINDTEXT_FLAG_CASESENSITIVE ? true : false);
-            }
-        }
-
-        if (pos == String::NPOS)
-        {
-            styleEdit_->selection.SelectNothing();
-            return true;
-        }
-    }
-
-    currentFindPos_ = pos;
-
-    styleEdit_->caret.SetGlobalOfs((int) pos + findLength);
-
-    int height = styleEdit_->layout_height;
-
-    int newy = styleEdit_->caret.y - height/2;
-
-    styleEdit_->SetScrollPos(styleEdit_->scroll_x, newy);
-
-    styleEdit_->selection.Select(pos, pos + findLength);
-
-    return true;
-}
-
-void JSResourceEditor::SetFocus()
-{
-    editField_->SetFocus(WIDGET_FOCUS_REASON_UNKNOWN);
-}
-
-void JSResourceEditor::GotoTokenPos(int tokenPos)
-{
-    styleEdit_->caret.SetGlobalOfs(tokenPos);
-
-    int height = styleEdit_->layout_height;
-
-    int newy = styleEdit_->caret.y - height/2;
-
-    styleEdit_->SetScrollPos(styleEdit_->scroll_x, newy);
-
-}
-
-void JSResourceEditor::GotoLineNumber(int lineNumber)
-{
-    int line = 0;
-    TBBlock *block = NULL;
-    for (block = styleEdit_->blocks.GetFirst(); block; block = block->GetNext())
-    {
-        if (lineNumber == line)
-            break;
-        line++;
-    }
-    if (!block)
-        return;
-
-    styleEdit_->caret.Place(block, 0);
-
-    int height = styleEdit_->layout_height;
-    int newy = styleEdit_->caret.y - height/2;
-
-    styleEdit_->SetScrollPos(styleEdit_->scroll_x, newy);
-
-}
-
-
-bool JSResourceEditor::HasUnsavedModifications()
-{
-    return modified_;
-}
-
-}

+ 0 - 64
Attic/AtomicEditorReference/Source/Editors/JSResourceEditor.h

@@ -1,64 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include "ResourceEditor.h"
-#include <TurboBadger/tb_editfield.h>
-#include <TurboBadger/tb_style_edit.h>
-#include <TurboBadger/tb_select.h>
-
-using namespace Atomic;
-using namespace tb;
-
-namespace AtomicEditor
-{
-
-class JSAutocomplete;
-
-class JSResourceEditor: public ResourceEditor, public TBStyleEditTextChangeListener
-{
-    OBJECT(JSResourceEditor);
-
-public:
-
-    JSResourceEditor(Context* context, const String& fullpath, TBTabContainer* container);
-
-    virtual ~JSResourceEditor();
-
-    bool OnEvent(const TBWidgetEvent &ev);
-
-    bool FindText(const String& findText, unsigned flags);
-    void FindTextClose();
-
-    void OnChange(TBStyleEdit* styleEdit);
-    void HandleUpdate(StringHash eventType, VariantMap& eventData);    
-
-    void GotoTokenPos(int tokenPos);
-    void GotoLineNumber(int lineNumber);
-
-    void SetFocus();
-
-    bool HasUnsavedModifications();
-
-private:
-
-    void UpdateLineNumbers();
-
-    tb::TBStyleEdit* styleEdit_;
-    tb::TBSelectList* lineNumberList_;
-
-    TBEditField* editField_;
-    JSAutocomplete* autocomplete_;
-
-    float textDelta_;
-    bool textDirty_;
-
-    bool modified_;
-
-    int currentFindPos_;
-
-};
-
-}

+ 0 - 64
Attic/AtomicEditorReference/Source/Editors/ModelResourceEditor.cpp

@@ -1,64 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-#include <Atomic/Core/CoreEvents.h>
-#include <Atomic/Scene/Scene.h>
-#include <Atomic/Graphics/Octree.h>
-#include <Atomic/Graphics/Camera.h>
-#include <Atomic/Graphics/Zone.h>
-#include <Atomic/Atomic3D/AnimatedModel.h>
-#include <Atomic/Atomic3D/Animation.h>
-#include <Atomic/Atomic3D/AnimationState.h>
-#include <Atomic/Atomic3D/AnimationController.h>
-#include <Atomic/Graphics/Material.h>
-#include <Atomic/Graphics/DebugRenderer.h>
-
-#include <Atomic/Resource/ResourceCache.h>
-#include <Atomic/Input/Input.h>
-
-#include "../AEEditor.h"
-
-
-#include "ModelResourceEditor.h"
-
-#include <Atomic/UI/UI.h>
-
-namespace AtomicEditor
-{
-
-ModelResourceEditor ::ModelResourceEditor(Context* context, const String &fullpath, TBTabContainer *container) :
-    ResourceEditor(context, fullpath, container),
-    layout_(0),
-    view3DContainer_(0),
-    yaw_(0.0f),
-    pitch_(0.0f)
-{
-}
-
-ModelResourceEditor::~ModelResourceEditor()
-{
-
-}
-
-bool ModelResourceEditor::OnEvent(const TBWidgetEvent &ev)
-{
-
-    return false;
-}
-
-void ModelResourceEditor::MoveCamera(float timeStep)
-{
-
-}
-
-void ModelResourceEditor::HandleUpdate(StringHash eventType, VariantMap& eventData)
-{
-
-
-
-}
-
-
-}

+ 0 - 57
Attic/AtomicEditorReference/Source/Editors/ModelResourceEditor.h

@@ -1,57 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <TurboBadger/tb_widgets_common.h>
-#include "ResourceEditor.h"
-
-using namespace Atomic;
-using namespace tb;
-
-namespace Atomic
-{
-class Scene;
-class Node;
-class Camera;
-}
-
-namespace AtomicEditor
-{
-
-class JSAutocomplete;
-
-class ModelResourceEditor: public ResourceEditor
-{
-    OBJECT(ModelResourceEditor);
-
-public:
-
-    ModelResourceEditor(Context* context, const String& fullpath, TBTabContainer* container);
-
-    virtual ~ModelResourceEditor();
-
-    bool OnEvent(const TBWidgetEvent &ev);
-
-    void HandleUpdate(StringHash eventType, VariantMap& eventData);
-
-private:
-
-    void MoveCamera(float timeStep);
-
-    SharedPtr<Scene> scene_;
-    SharedPtr<Node> cameraNode_;
-    //SharedPtr<View3D> view3D_;
-    SharedPtr<Camera> camera_;
-    float yaw_;
-    float pitch_;
-
-    TBLayout* layout_;
-    TBContainer* view3DContainer_;
-
-    WeakPtr<Node> modelNode_;
-
-};
-
-}

+ 0 - 121
Attic/AtomicEditorReference/Source/Editors/ResourceEditor.cpp

@@ -1,121 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/Resource/ResourceEvents.h>
-
-#include "ResourceEditor.h"
-
-#include "../UI/UIMainFrame.h"
-#include "../UI/UIResourceFrame.h"
-
-namespace AtomicEditor
-{
-
-class EditorTabLayout: public TBLayout
-{
-public:
-
-    ResourceEditor* editor_;
-    TBButton* button_;
-    TBButton* close_;
-    TBTabContainer* container_;
-
-    void SetValue(int value)
-    {
-        button_->SetValue(value);
-    }
-
-    bool OnEvent(const TBWidgetEvent &ev)
-    {
-        if (ev.type == EVENT_TYPE_CLICK || ev.type == EVENT_TYPE_POINTER_DOWN)
-        {
-            if (ev.target->GetID() == TBIDC("tabclose"))
-            {
-                container_->OnEvent(ev);
-                editor_->Close();
-                return true;
-            }
-            else
-            {
-                TBWidgetEvent nevent = ev;
-                nevent.target = this;
-                container_->OnEvent(nevent);
-            }
-        }
-
-        return false;
-    }
-};
-
-ResourceEditor::ResourceEditor(Context* context, const String& fullpath, TBTabContainer* container):
-    Object(context), fullpath_(fullpath), container_(container),
-    editorTabLayout_(0), rootContentWidget_(0), button_(0)
-{
-
-    String filename = GetFileNameAndExtension(fullpath_);
-
-    editorTabLayout_ = new EditorTabLayout();
-    editorTabLayout_->SetID(TBIDC("tab"));
-
-    button_ = new TBButton();
-    button_->SetText(filename.CString());
-    button_->SetSqueezable(true);
-    button_->SetSkinBg(TBIDC("TBButton.flat"));
-    button_->SetValue(1);
-    editorTabLayout_->AddChild(button_);
-
-    TBButton* closebutton = new TBButton();
-    editorTabLayout_->AddChild(closebutton);
-    closebutton->SetSkinBg(TBIDC("TBWindow.close"));
-    closebutton->SetIsFocusable(false);
-    closebutton->SetID(TBIDC("tabclose"));
-
-    editorTabLayout_->editor_ = this;
-    editorTabLayout_->button_ = button_;
-    editorTabLayout_->close_ = closebutton;
-    editorTabLayout_->container_ = container;
-
-    container_->GetTabLayout()->AddChild(editorTabLayout_);
-
-    rootContentWidget_ = new TBWidget();
-    rootContentWidget_->SetGravity(WIDGET_GRAVITY_ALL);
-    container_->GetContentRoot()->AddChild(rootContentWidget_);
-
-    SubscribeToEvent(E_FILECHANGED, HANDLER(ResourceEditor, HandleFileChanged));
-}
-
-ResourceEditor::~ResourceEditor()
-{
-
-}
-
-void ResourceEditor::HandleFileChanged(StringHash eventType, VariantMap& eventData)
-{
-    using namespace FileChanged;
-    const String& fileName = eventData[P_FILENAME].GetString();
-    const String& resourceName = eventData[P_RESOURCENAME].GetString();
-
-    if (fullpath_ == fileName)
-    {
-        FileSystem* fs = GetSubsystem<FileSystem>();
-        if (!fs->FileExists(fullpath_))
-            Close();
-    }
-}
-
-void ResourceEditor::Close(bool navigateToAvailabeResource)
-{
-    // keep us alive through the close
-    SharedPtr<ResourceEditor> keepalive(this);
-
-    container_->GetTabLayout()->RemoveChild(editorTabLayout_);
-
-    MainFrame* frame = GetSubsystem<MainFrame>();
-    ResourceFrame* rframe = frame->GetResourceFrame();
-    rframe->CloseResourceEditor(this, navigateToAvailabeResource);
-}
-
-}

+ 0 - 60
Attic/AtomicEditorReference/Source/Editors/ResourceEditor.h

@@ -1,60 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <Atomic/Core/Object.h>
-#include <TurboBadger/tb_tab_container.h>
-
-using namespace Atomic;
-using namespace tb;
-
-namespace AtomicEditor
-{
-
-class EditorTabLayout;
-
-class ResourceEditor: public Object
-{
-    OBJECT(ResourceEditor);
-
-public:
-
-    ResourceEditor(Context* context, const String& fullpath, TBTabContainer* container);
-
-    virtual ~ResourceEditor();
-
-    TBButton* GetButton() { return button_; }
-
-    virtual bool HasUnsavedModifications() { return false; }
-
-    virtual void SetFocus() {}
-    virtual void Close(bool navigateToAvailabeResource = true);
-
-    virtual bool OnEvent(const TBWidgetEvent &ev) { return false; }
-
-    virtual bool FindText(const String& text, unsigned flags) { return false; }
-    virtual void FindTextClose() { }
-
-    virtual bool RequiresInspector() { return false; }
-
-    const String& GetFullPath() { return fullpath_; }
-
-    TBWidget* GetRootContentWidget() { return rootContentWidget_; }
-
-protected:
-
-    String fullpath_;
-    TBTabContainer* container_;
-    EditorTabLayout* editorTabLayout_;
-    TBWidget* rootContentWidget_;
-    TBButton* button_;
-
-private:
-
-    void HandleFileChanged(StringHash eventType, VariantMap& eventData);
-
-};
-
-}

+ 0 - 437
Attic/AtomicEditorReference/Source/Editors/SceneEditor3D/Gizmo3D.cpp

@@ -1,437 +0,0 @@
-// Portions Copyright (c) 2008-2015 the Urho3D project.
-
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-
-#include <Atomic/Atomic3D/Model.h>
-#include <Atomic/Graphics/Material.h>
-#include <Atomic/Graphics/Octree.h>
-#include <Atomic/Resource/ResourceCache.h>
-
-#include <Atomic/Input/Input.h>
-
-#include "Gizmo3D.h"
-
-namespace AtomicEditor
-{
-
-
-Gizmo3D::Gizmo3D(Context* context) : Object(context)
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-
-    gizmoNode_ = new Node(context_);
-    gizmo_ = gizmoNode_->CreateComponent<StaticModel>();
-    gizmo_->SetModel(cache->GetResource<Model>("AtomicEditor/Models/Axes.mdl"));
-
-    gizmo_->SetEnabled(false);
-    gizmo_->SetViewMask(0x80000000); // Editor raycasts use viewmask 0x7fffffff
-    gizmo_->SetOccludee(false);
-
-    axisMode_ = AXIS_LOCAL;
-
-    gizmoAxisX_.lastSelected_ = false;
-    gizmoAxisY_.lastSelected_ = false;
-    gizmoAxisZ_.lastSelected_ = false;
-
-    editMode_ = EDIT_MOVE;
-    lastEditMode_ = EDIT_SELECT;
-}
-
-Gizmo3D::~Gizmo3D()
-{
-
-}
-
-void Gizmo3D::SetView(SceneView3D* view3D)
-{
-    view3D_ = view3D;
-    scene_ = view3D->GetScene();
-    camera_ = view3D->GetCameraNode()->GetComponent<Camera>();
-    assert(camera_.NotNull());
-}
-
-void Gizmo3D::Position()
-{
-    Vector3 center(0, 0, 0);
-    bool containsScene = false;
-
-    for (unsigned i = 0; i < editNodes_->Size(); ++i)
-    {
-        // Scene's transform should not be edited, so hide gizmo if it is included
-        if (editNodes_->At(i) == scene_)
-        {
-            containsScene = true;
-            break;
-        }
-        center += editNodes_->At(i)->GetWorldPosition();
-    }
-
-    if (editNodes_->Empty() || containsScene)
-    {
-        Hide();
-        return;
-    }
-
-    center /= editNodes_->Size();
-    gizmoNode_->SetPosition(center);
-
-    if (axisMode_ == AXIS_WORLD || editNodes_->Size() > 1)
-        gizmoNode_->SetRotation(Quaternion());
-    else
-        gizmoNode_->SetRotation(editNodes_->At(0)->GetWorldRotation());
-
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-
-    if (editMode_ != lastEditMode_)
-    {
-        switch (editMode_)
-        {
-        case EDIT_MOVE:
-            gizmo_->SetModel(cache->GetResource<Model>("AtomicEditor/Models/Axes.mdl"));
-            break;
-
-        case EDIT_ROTATE:
-            gizmo_->SetModel(cache->GetResource<Model>("AtomicEditor/Models/RotateAxes.mdl"));
-            break;
-
-        case EDIT_SCALE:
-            gizmo_->SetModel(cache->GetResource<Model>("AtomicEditor/Models/ScaleAxes.mdl"));
-            break;
-
-        default:
-            break;
-        }
-
-        lastEditMode_ = editMode_;
-    }
-
-    bool orbiting = false;
-    if ((editMode_ != EDIT_SELECT && !orbiting) && !gizmo_->IsEnabled())
-        Show();
-    else if ((editMode_ == EDIT_SELECT || orbiting) && gizmo_->IsEnabled())
-        Hide();
-
-    if (gizmo_->IsEnabled())
-    {
-        float scale = 0.1f / camera_->GetZoom();
-
-        if (camera_->IsOrthographic())
-            scale *= camera_->GetOrthoSize();
-        else
-            scale *= (camera_->GetView() * gizmoNode_->GetPosition()).z_;
-
-        gizmoNode_->SetScale(Vector3(scale, scale, scale));
-
-    }
-}
-
-void Gizmo3D::Update(Vector<Node *> &editNodes)
-{
-    editNodes_ = &editNodes;
-
-    Use();
-    Position();
-
-
-}
-
-void Gizmo3D::CalculateGizmoAxes()
-{
-    gizmoAxisX_.axisRay_ = Ray(gizmoNode_->GetPosition(), gizmoNode_->GetRotation() * Vector3(1, 0, 0));
-    gizmoAxisY_.axisRay_ = Ray(gizmoNode_->GetPosition(), gizmoNode_->GetRotation() * Vector3(0, 1, 0));
-    gizmoAxisZ_.axisRay_ = Ray(gizmoNode_->GetPosition(), gizmoNode_->GetRotation() * Vector3(0, 0, 1));
-}
-
-void Gizmo3D::Use()
-{
-    if (gizmo_.Null() || !gizmo_->IsEnabled() || editMode_ == EDIT_SELECT)
-    {
-        //StoreGizmoEditActions();
-        //previousGizmoDrag = false;
-        return;
-    }
-
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    Input* input = GetSubsystem<Input>();
-
-    Ray cameraRay = view3D_->GetCameraRay();
-    float scale = gizmoNode_->GetScale().x_;
-
-    // Recalculate axes only when not left-dragging
-    bool drag = input->GetMouseButtonDown(MOUSEB_LEFT);// && (Abs(input->GetMouseMoveX()) > 3 || Abs(input->GetMouseMoveY()) > 3);
-    if (!drag)
-        CalculateGizmoAxes();
-
-    gizmoAxisX_.Update(cameraRay, scale, drag, camera_->GetNode());
-    gizmoAxisY_.Update(cameraRay, scale, drag, camera_->GetNode());
-    gizmoAxisZ_.Update(cameraRay, scale, drag, camera_->GetNode());
-
-    if (!editNodes_->Size() || editNodes_->At(0) == scene_)
-    {
-        gizmoAxisX_.selected_ = gizmoAxisY_.selected_ = gizmoAxisZ_.selected_ = false;
-        // this just forces an update
-        gizmoAxisX_.lastSelected_ = gizmoAxisY_.lastSelected_ = gizmoAxisZ_.lastSelected_ = true;
-    }
-
-
-    if (gizmoAxisX_.selected_ != gizmoAxisX_.lastSelected_)
-    {
-        gizmo_->SetMaterial(0, cache->GetResource<Material>(
-                                gizmoAxisX_.selected_ ?
-                                    "AtomicEditor/Materials/BrightRedUnlit.xml" : "AtomicEditor/Materials/RedUnlit.xml"));
-
-        gizmoAxisX_.lastSelected_ = gizmoAxisX_.selected_;
-    }
-
-    if (gizmoAxisY_.selected_ != gizmoAxisY_.lastSelected_)
-    {
-        gizmo_->SetMaterial(1, cache->GetResource<Material>(
-                                gizmoAxisY_.selected_ ?
-                                    "AtomicEditor/Materials/BrightGreenUnlit.xml" : "AtomicEditor/Materials/GreenUnlit.xml"));
-
-        gizmoAxisY_.lastSelected_ = gizmoAxisY_.selected_;
-    }
-    if (gizmoAxisZ_.selected_ != gizmoAxisZ_.lastSelected_)
-    {
-        gizmo_->SetMaterial(2, cache->GetResource<Material>(
-                                gizmoAxisZ_.selected_ ?
-                                    "AtomicEditor/Materials/BrightBlueUnlit.xml" : "AtomicEditor/Materials/BlueUnlit.xml"));
-
-        gizmoAxisZ_.lastSelected_ = gizmoAxisZ_.selected_;
-    }
-
-    if (drag)
-        Drag();
-
-}
-
-bool Gizmo3D::MoveEditNodes(Vector3 adjust)
-{
-    bool moved = false;
-
-    if (adjust.Length() > M_EPSILON)
-    {
-        for (unsigned i = 0; i < editNodes_->Size(); ++i)
-        {
-            /*
-            if (moveSnap)
-            {
-                float moveStepScaled = moveStep * snapScale;
-                adjust.x = Floor(adjust.x / moveStepScaled + 0.5) * moveStepScaled;
-                adjust.y = Floor(adjust.y / moveStepScaled + 0.5) * moveStepScaled;
-                adjust.z = Floor(adjust.z / moveStepScaled + 0.5) * moveStepScaled;
-            }
-            */
-
-            Node* node = editNodes_->At(i);
-            Vector3 nodeAdjust = adjust;
-            if (axisMode_ == AXIS_LOCAL && editNodes_->Size() == 1)
-                nodeAdjust = node->GetWorldRotation() * nodeAdjust;
-
-            Vector3 worldPos = node->GetWorldPosition();
-            Vector3 oldPos = node->GetPosition();
-
-            worldPos += nodeAdjust;
-
-            if (!node->GetParent())
-                node->SetPosition(worldPos);
-            else
-                node->SetPosition(node->GetParent()->WorldToLocal(worldPos));
-
-            if (node->GetPosition() != oldPos)
-                moved = true;
-        }
-    }
-
-    return moved;
-
-
-}
-
-bool Gizmo3D::RotateEditNodes(Vector3 adjust)
-{
-    bool moved = false;
-
-    /*
-    if (rotateSnap)
-    {
-        float rotateStepScaled = rotateStep * snapScale;
-        adjust.x = Floor(adjust.x / rotateStepScaled + 0.5) * rotateStepScaled;
-        adjust.y = Floor(adjust.y / rotateStepScaled + 0.5) * rotateStepScaled;
-        adjust.z = Floor(adjust.z / rotateStepScaled + 0.5) * rotateStepScaled;
-    }
-    */
-
-    if (adjust.Length() > M_EPSILON)
-    {
-        moved = true;
-
-        for (unsigned i = 0; i < editNodes_->Size(); ++i)
-        {
-            Node* node = editNodes_->At(i);
-            Quaternion rotQuat(adjust.x_, adjust.y_, adjust.z_);
-            if (axisMode_ == AXIS_LOCAL && editNodes_->Size() == 1)
-                node->SetRotation(node->GetRotation() * rotQuat);
-            else
-            {
-                Vector3 offset = node->GetWorldPosition() - gizmoAxisX_.axisRay_.origin_;
-                if (node->GetParent() && node->GetParent()->GetWorldRotation() != Quaternion(1, 0, 0, 0))
-                    rotQuat = node->GetParent()->GetWorldRotation().Inverse() * rotQuat * node->GetParent()->GetWorldRotation();
-                node->SetRotation(rotQuat * node->GetRotation());
-                Vector3 newPosition = gizmoAxisX_.axisRay_.origin_ + rotQuat * offset;
-                if (node->GetParent())
-                    newPosition = node->GetParent()->WorldToLocal(newPosition);
-                node->SetPosition(newPosition);
-            }
-        }
-    }
-
-    return moved;
-}
-
-bool Gizmo3D::ScaleEditNodes(Vector3 adjust)
-{
-    bool moved = false;
-
-    if (adjust.Length() > M_EPSILON)
-    {
-        for (unsigned i = 0; i < editNodes_->Size(); ++i)
-        {
-            Node* node = editNodes_->At(i);
-
-            Vector3 scale = node->GetScale();
-            Vector3 oldScale = scale;
-
-            if (true)//!scaleSnap)
-                scale += adjust;
-            else
-            {
-                /*
-                float scaleStepScaled = scaleStep * snapScale;
-                if (adjust.x != 0)
-                {
-                    scale.x += adjust.x * scaleStepScaled;
-                    scale.x = Floor(scale.x / scaleStepScaled + 0.5) * scaleStepScaled;
-                }
-                if (adjust.y != 0)
-                {
-                    scale.y += adjust.y * scaleStepScaled;
-                    scale.y = Floor(scale.y / scaleStepScaled + 0.5) * scaleStepScaled;
-                }
-                if (adjust.z != 0)
-                {
-                    scale.z += adjust.z * scaleStepScaled;
-                    scale.z = Floor(scale.z / scaleStepScaled + 0.5) * scaleStepScaled;
-                }
-                */
-            }
-
-            if (scale != oldScale)
-                moved = true;
-
-            node->SetScale(scale);
-        }
-    }
-
-    return moved;
-}
-
-void Gizmo3D::Moved()
-{
-    gizmoAxisX_.Moved();
-    gizmoAxisY_.Moved();
-    gizmoAxisZ_.Moved();
-}
-
-
-void Gizmo3D::Drag()
-{
-    bool moved = false;
-
-    float scale = gizmoNode_->GetScale().x_;
-
-    if (editMode_ == EDIT_MOVE)
-    {
-        Vector3 adjust(0, 0, 0);
-        if (gizmoAxisX_.selected_)
-            adjust += Vector3(1, 0, 0) * (gizmoAxisX_.t_ - gizmoAxisX_.lastT_);
-        if (gizmoAxisY_.selected_)
-            adjust += Vector3(0, 1, 0) * (gizmoAxisY_.t_ - gizmoAxisY_.lastT_);
-        if (gizmoAxisZ_.selected_)
-            adjust += Vector3(0, 0, 1) * (gizmoAxisZ_.t_ - gizmoAxisZ_.lastT_);
-
-        moved = MoveEditNodes(adjust);
-    }
-    else if (editMode_ == EDIT_ROTATE)
-    {
-        const float rotSensitivity = 50.0;
-
-        Vector3 adjust(0, 0, 0);
-        if (gizmoAxisX_.selected_)
-            adjust.x_ = (gizmoAxisX_.d_ - gizmoAxisX_.lastD_) * rotSensitivity / scale;
-        if (gizmoAxisY_.selected_)
-            adjust.y_ = -(gizmoAxisY_.d_ - gizmoAxisY_.lastD_) * rotSensitivity / scale;
-        if (gizmoAxisZ_.selected_)
-            adjust.z_ = (gizmoAxisZ_.d_ - gizmoAxisZ_.lastD_) * rotSensitivity / scale;
-
-        moved = RotateEditNodes(adjust);
-    }
-    else if (editMode_ == EDIT_SCALE)
-    {
-        Vector3 adjust(0, 0, 0);
-        if (gizmoAxisX_.selected_)
-            adjust += Vector3(1, 0, 0) * (gizmoAxisX_.t_ - gizmoAxisX_.lastT_);
-        if (gizmoAxisY_.selected_)
-            adjust += Vector3(0, 1, 0) * (gizmoAxisY_.t_ - gizmoAxisY_.lastT_);
-        if (gizmoAxisZ_.selected_)
-            adjust += Vector3(0, 0, 1) * (gizmoAxisZ_.t_ - gizmoAxisZ_.lastT_);
-
-        // Special handling for uniform scale: use the unmodified X-axis movement only
-        if (editMode_ == EDIT_SCALE && gizmoAxisX_.selected_ && gizmoAxisY_.selected_ && gizmoAxisZ_.selected_)
-        {
-            float x = gizmoAxisX_.t_ - gizmoAxisX_.lastT_;
-            adjust = Vector3(x, x, x);
-        }
-
-        moved = ScaleEditNodes(adjust);
-    }
-
-    if (moved)
-    {
-        Moved();
-        //UpdateNodeAttributes();
-        //needGizmoUndo = true;
-    }
-
-}
-
-void Gizmo3D::SetEditMode(EditMode mode)
-{
-    editMode_ = mode;
-}
-
-void Gizmo3D::Hide()
-{
-    gizmo_->SetEnabled(false);
-}
-
-void Gizmo3D::Show()
-{
-    if (scene_.Null())
-        return;
-
-    gizmo_->SetEnabled(true);
-
-    Octree* octree = scene_->GetComponent<Octree>();
-    if (!octree)
-        return;
-
-    octree->AddManualDrawable(gizmo_);
-
-}
-
-}

+ 0 - 155
Attic/AtomicEditorReference/Source/Editors/SceneEditor3D/Gizmo3D.h

@@ -1,155 +0,0 @@
-
-// Portions Copyright (c) 2008-2015 the Urho3D project.
-
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <Atomic/Core/Object.h>
-#include <Atomic/Math/MathDefs.h>
-#include <Atomic/Math/Ray.h>
-#include <Atomic/Scene/Scene.h>
-
-#include <Atomic/Atomic3D/StaticModel.h>
-#include <Atomic/Graphics/Camera.h>
-
-
-#include "SceneView3D.h"
-
-using namespace Atomic;
-
-namespace Atomic
-{
-    class Node;
-}
-
-namespace AtomicEditor
-{
-
-class Gizmo3DAxis
-{
-public:
-
-    Ray axisRay_;
-    bool selected_;
-    bool lastSelected_;
-    float t_;
-    float d_;
-    float lastT_;
-    float lastD_;
-
-    Gizmo3DAxis()
-    {
-        selected_ = false;
-        lastSelected_ = false;
-        t_ = 0.0;
-        d_ = 0.0;
-        lastT_ = 0.0;
-        lastD_ = 0.0;
-    }
-
-    void Update(Ray cameraRay, float scale, bool drag, Node* cameraNode)
-    {
-        const float axisMaxD = 0.1f;
-        const float axisMaxT = 1.0f;
-
-        Vector3 closest = cameraRay.ClosestPoint(axisRay_);
-        Vector3 projected = axisRay_.Project(closest);
-        d_ = axisRay_.Distance(closest);
-        t_ = (projected - axisRay_.origin_).DotProduct(axisRay_.direction_);
-
-        // Determine the sign of d from a plane that goes through the camera position to the axis
-        Plane axisPlane(cameraNode->GetPosition(), axisRay_.origin_, axisRay_.origin_ + axisRay_.direction_);
-        if (axisPlane.Distance(closest) < 0.0)
-            d_ = -d_;
-
-        // Update selected status only when not dragging
-        if (!drag)
-        {
-            selected_ = Abs(d_) < axisMaxD * scale && t_ >= -axisMaxD * scale && t_ <= axisMaxT * scale;
-            lastT_ = t_;
-            lastD_ = d_;
-        }
-    }
-
-    void Moved()
-    {
-        lastT_ = t_;
-        lastD_ = d_;
-    }
-};
-
-class Gizmo3D: public Object
-{
-    OBJECT(Gizmo3D);
-
-public:
-
-    enum EditMode
-    {
-        EDIT_SELECT,
-        EDIT_MOVE,
-        EDIT_ROTATE,
-        EDIT_SCALE
-    };
-
-    enum AxisMode
-    {
-        AXIS_WORLD = 0,
-        AXIS_LOCAL
-    };
-
-    Gizmo3D(Context* context);
-    virtual ~Gizmo3D();
-
-    void SetView(SceneView3D* view3D);
-
-    void SetEditMode(EditMode);
-
-    bool Selected()
-    {
-        return gizmoAxisX_.selected_ || gizmoAxisY_.selected_ || gizmoAxisZ_.selected_;
-    }
-
-    void Show();
-    void Hide();
-    void Update(Vector<Node*>& editNodes);
-
-    Node* GetGizmoNode() { return gizmoNode_; }
-
-private:
-
-    void Position();
-    void Use();
-    void Drag();
-    void Moved();
-    void CalculateGizmoAxes();
-
-    bool MoveEditNodes(Vector3 adjust);
-    bool RotateEditNodes(Vector3 adjust);
-    bool ScaleEditNodes(Vector3 adjust);
-
-    SharedPtr<Node> gizmoNode_;
-
-    WeakPtr<SceneView3D> view3D_;
-    WeakPtr<Scene> scene_;
-    WeakPtr<Camera> camera_;
-    WeakPtr<StaticModel> gizmo_;
-
-    Gizmo3DAxis gizmoAxisX_;
-    Gizmo3DAxis gizmoAxisY_;
-    Gizmo3DAxis gizmoAxisZ_;
-
-    EditMode editMode_;
-    EditMode lastEditMode_;
-
-    AxisMode axisMode_;
-
-    Vector<Node *> *editNodes_;
-
-};
-
-}
-

+ 0 - 183
Attic/AtomicEditorReference/Source/Editors/SceneEditor3D/SceneEditor3D.cpp

@@ -1,183 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-#include <Atomic/IO/Log.h>
-#include <Atomic/Core/CoreEvents.h>
-#include <Atomic/Scene/Scene.h>
-#include <Atomic/Graphics/Camera.h>
-
-#include <Atomic/Graphics/DebugRenderer.h>
-#include <Atomic/Graphics/Viewport.h>
-#include <Atomic/Graphics/Octree.h>
-
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/Resource/ResourceCache.h>
-
-#include <Atomic/Physics/PhysicsWorld.h>
-
-#include "AEEditor.h"
-#include "AEEvents.h"
-
-#include <Atomic/Input/Input.h>
-#include <Atomic/UI/UI.h>
-
-#include "SceneEditor3D.h"
-
-namespace AtomicEditor
-{
-
-SceneEditor3D ::SceneEditor3D(Context* context, const String &fullpath, TBTabContainer *container) :
-    ResourceEditor(context, fullpath, container)
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-
-    scene_ = new Scene(context_);
-    SharedPtr<File> xmlFile = cache->GetFile(fullpath);
-
-    if (GetExtension(fullpath) == ".scene")
-        scene_->LoadXML(*xmlFile);
-    else
-        scene_->Load(*xmlFile);
-
-    scene_->SetUpdateEnabled(false);
-
-    sceneView_ = new SceneView3D(context_, this);
-
-    // EARLY ACCESS
-    if (fullpath.Find(String("ToonTown")) != String::NPOS)
-    {
-          sceneView_->GetCameraNode()->SetWorldPosition(Vector3(-119.073, 76.1121, 16.47763));
-          Quaternion q(0.55, 0.14,  0.8, -0.2);
-          sceneView_->SetYaw(q.YawAngle());
-          sceneView_->SetPitch(q.PitchAngle());
-          sceneView_->GetCameraNode()->SetWorldRotation(q);
-    }
-    else
-    {
-        Node* playerSpawn = scene_->GetChild("PlayerInfoStart", true);
-        if (playerSpawn)
-        {
-            sceneView_->GetCameraNode()->SetPosition(playerSpawn->GetPosition());
-            sceneView_->SetYaw(playerSpawn->GetRotation().EulerAngles().y_);
-        }
-
-    }
-
-    TBWidgetDelegate* delegate = sceneView_->GetWidgetDelegate();
-    delegate->SetGravity(WIDGET_GRAVITY_ALL);
-
-    rootContentWidget_->AddChild(delegate);
-
-    gizmo3D_ = new Gizmo3D(context_);
-    gizmo3D_->SetView(sceneView_);
-    gizmo3D_->Show();
-
-    SubscribeToEvent(E_UPDATE, HANDLER(SceneEditor3D, HandleUpdate));
-    SubscribeToEvent(E_EDITORACTIVENODECHANGE, HANDLER(SceneEditor3D, HandleEditorActiveNodeChange));
-
-    // FIXME: Set the size at the end of setup, so all children are updated accordingly
-    // future size changes will be handled automatically
-    TBRect rect = container_->GetContentRoot()->GetRect();
-    rootContentWidget_->SetSize(rect.w, rect.h);
-
-    // TODO: generate this event properly
-    VariantMap eventData;
-    eventData[EditorActiveSceneChange::P_SCENE] = scene_;
-    SendEvent(E_EDITORACTIVESCENECHANGE, eventData);
-
-    SubscribeToEvent(E_EDITORPLAYSTARTED, HANDLER(SceneEditor3D, HandlePlayStarted));
-    SubscribeToEvent(E_EDITORPLAYSTOPPED, HANDLER(SceneEditor3D, HandlePlayStopped));
-
-}
-
-SceneEditor3D::~SceneEditor3D()
-{
-
-}
-
-bool SceneEditor3D::OnEvent(const TBWidgetEvent &ev)
-{
-
-    if (ev.type == EVENT_TYPE_SHORTCUT)
-    {
-        if (ev.ref_id == TBIDC("save"))
-        {
-            File file(context_);
-            if (file.Open(fullpath_, FILE_WRITE))
-            {
-                scene_->SaveXML(file);
-                file.Close();
-            }
-
-            return true;
-
-        }
-    }
-
-    if (ev.type == EVENT_TYPE_CLICK)
-    {
-        SetFocus();
-
-        if (ev.target)
-        {
-            if (ev.target->GetID() == TBIDC("3d_translate"))
-            {
-                gizmo3D_->SetEditMode(Gizmo3D::EDIT_MOVE);
-                return false;
-            }
-            else if (ev.target->GetID() == TBIDC("3d_rotate"))
-            {
-                gizmo3D_->SetEditMode(Gizmo3D::EDIT_ROTATE);
-                return false;
-            }
-            else if (ev.target->GetID() == TBIDC("3d_scale"))
-            {
-                gizmo3D_->SetEditMode(Gizmo3D::EDIT_SCALE);
-                return false;
-            }
-        }
-    }
-
-    return false;
-}
-
-void SceneEditor3D::SetFocus()
-{
-    sceneView_->GetWidgetDelegate()->SetFocus(WIDGET_FOCUS_REASON_UNKNOWN);
-}
-
-void SceneEditor3D::SelectNode(Node* node)
-{
-    selectedNode_ = node;
-}
-
-void SceneEditor3D::HandleUpdate(StringHash eventType, VariantMap& eventData)
-{    
-    Vector<Node*> editNodes;
-    editNodes.Push(selectedNode_);
-    gizmo3D_->Update(editNodes);
-}
-
-void SceneEditor3D::HandleEditorActiveNodeChange(StringHash eventType, VariantMap& eventData)
-{
-    Node* node = (Node*) (eventData[EditorActiveNodeChange::P_NODE].GetPtr());
-    SelectNode(node);
-}
-
-void SceneEditor3D::HandlePlayStarted(StringHash eventType, VariantMap& eventData)
-{
-    sceneView_->Disable();
-
-}
-
-void SceneEditor3D::HandlePlayStopped(StringHash eventType, VariantMap& eventData)
-{
-    sceneView_->Enable();
-}
-
-
-
-
-}

+ 0 - 70
Attic/AtomicEditorReference/Source/Editors/SceneEditor3D/SceneEditor3D.h

@@ -1,70 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <TurboBadger/tb_widgets_common.h>
-
-#include "../ResourceEditor.h"
-#include "SceneView3D.h"
-#include "Gizmo3D.h"
-
-using namespace Atomic;
-using namespace tb;
-
-namespace Atomic
-{
-class Scene;
-class Node;
-class View3D;
-class Camera;
-class DebugRenderer;
-class Octree;
-
-}
-
-namespace AtomicEditor
-{
-
-class SceneEditor3D: public ResourceEditor
-{
-    OBJECT(SceneEditor3D);
-
-public:
-
-    SceneEditor3D(Context* context, const String& fullpath, TBTabContainer* container);
-
-    virtual ~SceneEditor3D();
-
-    bool OnEvent(const TBWidgetEvent &ev);
-
-    void SelectNode(Node* node);
-
-    Scene* GetScene() { return scene_; }
-    Gizmo3D* GetGizmo() { return gizmo3D_; }
-
-    void SetFocus();
-
-    virtual bool RequiresInspector() { return true; }
-
-
-private:
-
-    void HandleUpdate(StringHash eventType, VariantMap& eventData);
-    void HandleEditorActiveNodeChange(StringHash eventType, VariantMap& eventData);
-    void HandlePlayStarted(StringHash eventType, VariantMap& eventData);
-    void HandlePlayStopped(StringHash eventType, VariantMap& eventData);
-
-    SharedPtr<Scene> scene_;
-
-    // TODO: multiple views
-    SharedPtr<SceneView3D> sceneView_;
-
-    SharedPtr<Gizmo3D> gizmo3D_;
-
-    WeakPtr<Node> selectedNode_;
-
-};
-
-}

+ 0 - 344
Attic/AtomicEditorReference/Source/Editors/SceneEditor3D/SceneView3D.cpp

@@ -1,344 +0,0 @@
-// Portions Copyright (c) 2008-2015 the Urho3D project.
-
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-#include <Atomic/IO/Log.h>
-#include <Atomic/Core/CoreEvents.h>
-#include <Atomic/Scene/Scene.h>
-#include <Atomic/Graphics/Camera.h>
-
-#include <Atomic/Graphics/Graphics.h>
-#include <Atomic/Graphics/DebugRenderer.h>
-#include <Atomic/Graphics/Viewport.h>
-#include <Atomic/Graphics/Octree.h>
-#include <Atomic/Atomic3D/Terrain.h>
-
-#include <Atomic/Input/Input.h>
-
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/Resource/ResourceCache.h>
-
-#include <Atomic/Physics/PhysicsWorld.h>
-
-#include "AEEditor.h"
-#include "AEEvents.h"
-
-#include "SceneView3D.h"
-#include "SceneEditor3D.h"
-#include <Atomic/UI/UI.h>
-
-namespace AtomicEditor
-{
-
-SceneView3D ::SceneView3D(Context* context, SceneEditor3D *sceneEditor) :
-    UIView3D(context),
-    yaw_(0.0f),
-    pitch_(0.0f),
-    mouseLeftDown_(false),
-    mouseMoved_(false),
-    enabled_(true)
-{
-
-    sceneEditor_ = sceneEditor;
-
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-
-    scene_ = sceneEditor->GetScene();
-
-    debugRenderer_ = scene_->GetComponent<DebugRenderer>();
-
-    if (debugRenderer_.Null())
-    {
-        debugRenderer_ = scene_->CreateComponent<DebugRenderer>();
-    }
-
-    octree_ = scene_->GetComponent<Octree>();
-
-    if (octree_.Null())
-    {
-        LOGWARNING("Scene without an octree loaded");
-        octree_ = scene_->CreateComponent<Octree>();
-    }
-
-    cameraNode_ = scene_->CreateChild("Camera");
-    cameraNode_->SetTemporary(true);
-    camera_ = cameraNode_->CreateComponent<Camera>();
-
-    debugRenderer_ = scene_->GetComponent<DebugRenderer>();
-    assert(debugRenderer_.NotNull());
-    octree_ = scene_->GetComponent<Octree>();
-    assert(octree_.NotNull());
-
-    cameraNode_->SetPosition(Vector3(0, 0, -10));
-
-    SetView(scene_, camera_);
-    SetAutoUpdate(false);
-
-    SubscribeToEvent(E_UPDATE, HANDLER(SceneView3D, HandleUpdate));
-    SubscribeToEvent(E_EDITORACTIVENODECHANGE, HANDLER(SceneView3D, HandleEditorActiveNodeChange));
-    SubscribeToEvent(E_POSTRENDERUPDATE, HANDLER(SceneView3D, HandlePostRenderUpdate));
-
-    // TODO: generate this event properly
-    VariantMap eventData;
-    eventData[EditorActiveSceneChange::P_SCENE] = scene_;
-    SendEvent(E_EDITORACTIVESCENECHANGE, eventData);
-
-    delegate_->SetIsFocusable(true);
-
-
-}
-
-SceneView3D::~SceneView3D()
-{
-
-}
-
-void SceneView3D::Enable()
-{
-    if (enabled_)
-        return;
-
-    enabled_ = true;
-
-    view3DWidget_->SetVisibilility(WIDGET_VISIBILITY_VISIBLE);
-}
-
-void SceneView3D::Disable()
-{
-    if (!enabled_)
-        return;
-
-    enabled_ = false;
-
-    view3DWidget_->SetVisibilility(WIDGET_VISIBILITY_INVISIBLE);
-
-}
-
-void SceneView3D::MoveCamera(float timeStep)
-{
-    if (!enabled_)
-        return;
-
-    Input* input = GetSubsystem<Input>();
-
-    // Movement speed as world units per second
-    float MOVE_SPEED = 20.0f;
-    // Mouse sensitivity as degrees per pixel
-    const float MOUSE_SENSITIVITY = 0.2f;
-
-    if (input->GetKeyDown(KEY_LSHIFT) || input->GetKeyDown(KEY_RSHIFT))
-        MOVE_SPEED *= 3.0f;
-
-    // Use this frame's mouse motion to adjust camera node yaw and pitch. Clamp the pitch between -90 and 90 degrees
-    if (input->GetMouseButtonDown(MOUSEB_RIGHT))
-    {
-        IntVector2 mouseMove = input->GetMouseMove();
-        yaw_ += MOUSE_SENSITIVITY * mouseMove.x_;
-        pitch_ += MOUSE_SENSITIVITY * mouseMove.y_;
-        pitch_ = Clamp(pitch_, -90.0f, 90.0f);
-        // Not working on OSX
-        //input->SetMouseMode(MM_RELATIVE);
-    }
-    else
-    {
-        // Not working on OSX
-        /*
-        if (input->GetMouseMode() != MM_ABSOLUTE)
-            input->SetMouseMode(MM_ABSOLUTE);
-        */
-    }
-
-
-    // Construct new orientation for the camera scene node from yaw and pitch. Roll is fixed to zero
-    cameraNode_->SetRotation(Quaternion(pitch_, yaw_, 0.0f));
-
-    //Vector3 pos = cameraNode_->GetWorldPosition();
-    //Quaternion q = cameraNode_->GetWorldRotation();
-    //LOGINFOF("%f %f %f : %f %f %f %f", pos.x_, pos.y_, pos.z_, q.x_, q.y_, q.z_, q.w_ );
-
-    // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
-    // Use the Translate() function (default local space) to move relative to the node's orientation.
-    if (input->GetKeyDown('W'))
-        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('S'))
-        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('A'))
-        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('D'))
-        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
-}
-
-Ray SceneView3D::GetCameraRay()
-{
-    Ray camRay;
-
-    Input* input = GetSubsystem<Input>();
-    IntVector2 cpos = input->GetMousePosition();
-
-    TBRect rect = GetWidgetDelegate()->GetRect();
-
-    if (!rect.w || !rect.h)
-        return camRay;
-
-    GetWidgetDelegate()->ConvertToRoot(rect.x, rect.y);
-
-    return  camera_->GetScreenRay(float(cpos.x_ - rect.x) / rect.w,
-                                       float(cpos.y_ - rect.y) /rect.h);
-}
-
-void SceneView3D::DrawNodeDebug(Node* node, DebugRenderer* debug, bool drawNode)
-{
-    if (drawNode)
-        debug->AddNode(node, 1.0, false);
-
-    // Exception for the scene to avoid bringing the editor to its knees: drawing either the whole hierarchy or the subsystem-
-    // components can have a large performance hit. Also do not draw terrain child nodes due to their large amount
-    // (TerrainPatch component itself draws nothing as debug geometry)
-    if (node != scene_ && !node->GetComponent<Terrain>())
-    {
-        const Vector<SharedPtr<Component> >& components = node->GetComponents();
-
-        for (unsigned j = 0; j < components.Size(); ++j)
-            components[j]->DrawDebugGeometry(debug, false);
-
-        // To avoid cluttering the view, do not draw the node axes for child nodes
-        for (unsigned k = 0; k < node->GetNumChildren(); ++k)
-            DrawNodeDebug(node->GetChild(k), debug, false);
-    }
-}
-
-bool SceneView3D::MouseInView()
-{
-    Input* input = GetSubsystem<Input>();
-    IntVector2 pos = input->GetMousePosition();
-
-    TBRect rect = GetWidgetDelegate()->GetRect();
-    GetWidgetDelegate()->ConvertToRoot(rect.x, rect.y);
-
-    return rect.Contains(TBPoint(pos.x_, pos.y_));
-
-}
-
-
-void SceneView3D::HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData)
-{
-
-    // Visualize the currently selected nodes
-    if (selectedNode_.NotNull())
-    {
-        DrawNodeDebug(selectedNode_, debugRenderer_);
-
-    }
-
-    if (!MouseInView())
-        return;
-
-    Input* input = GetSubsystem<Input>();
-
-    mouseLeftDown_ = false;
-
-    if (input->GetMouseButtonPress(MOUSEB_LEFT))
-    {
-        if (!mouseMoved_ && !sceneEditor_->GetGizmo()->Selected())
-        {
-            Ray camRay  = GetCameraRay();
-            PODVector<RayQueryResult> result;
-
-            RayOctreeQuery query(result, camRay, RAY_TRIANGLE, camera_->GetFarClip(), DRAWABLE_GEOMETRY, 0x7fffffff);
-            octree_->RaycastSingle(query);
-
-            if (query.result_.Size())
-            {
-                const RayQueryResult& r = result[0];
-
-                if (r.drawable_)
-                {
-
-                    VariantMap neventData;
-                    neventData[EditorActiveNodeChange::P_NODE] = r.drawable_->GetNode();
-                    SendEvent(E_EDITORACTIVENODECHANGE, neventData);
-
-                }
-            }
-        }
-
-        mouseMoved_ = false;
-
-    }
-    else if (!input->GetMouseButtonDown(MOUSEB_LEFT))
-    {
-
-        Ray camRay  = GetCameraRay();
-        PODVector<RayQueryResult> result;
-
-        mouseMoved_ = false;
-
-        /*
-        Array<int> pickModeDrawableFlags = {
-            DRAWABLE_GEOMETRY,
-            DRAWABLE_LIGHT,
-            DRAWABLE_ZONE
-        };
-        */
-
-        RayOctreeQuery query(result, camRay, RAY_TRIANGLE, camera_->GetFarClip(), DRAWABLE_GEOMETRY, 0x7fffffff);
-        octree_->RaycastSingle(query);
-
-        if (query.result_.Size())
-        {
-            const RayQueryResult& r = result[0];
-
-            if (r.drawable_)
-            {
-                debugRenderer_->AddNode(r.drawable_->GetNode(), 1.0, false);
-                r.drawable_->DrawDebugGeometry(debugRenderer_, false);
-            }
-
-        }
-    }
-    else
-    {
-        mouseLeftDown_ = true;
-        if (Abs(input->GetMouseMoveX() > 3 || input->GetMouseMoveY() >  3))
-        {
-            mouseMoved_ = true;
-        }
-    }
-
-}
-
-void SceneView3D::SelectNode(Node* node)
-{
-    selectedNode_ = node;
-}
-
-bool SceneView3D::OnEvent(const TBWidgetEvent &ev)
-{
-    return sceneEditor_->OnEvent(ev);
-}
-
-
-void SceneView3D::HandleUpdate(StringHash eventType, VariantMap& eventData)
-{
-
-    // Timestep parameter is same no matter what event is being listened to
-    float timeStep = eventData[Update::P_TIMESTEP].GetFloat();
-
-    if (MouseInView())
-        MoveCamera(timeStep);
-
-    QueueUpdate();
-}
-
-void SceneView3D::HandleEditorActiveNodeChange(StringHash eventType, VariantMap& eventData)
-{
-    Node* node = (Node*) (eventData[EditorActiveNodeChange::P_NODE].GetPtr());
-    SelectNode(node);
-}
-
-
-
-}

+ 0 - 79
Attic/AtomicEditorReference/Source/Editors/SceneEditor3D/SceneView3D.h

@@ -1,79 +0,0 @@
-// Portions Copyright (c) 2008-2015 the Urho3D project.
-
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <Atomic/Core/Object.h>
-
-#include "UI/UIView3D.h"
-
-using namespace Atomic;
-
-namespace Atomic
-{
-class Scene;
-class Node;
-class Camera;
-class DebugRenderer;
-class Octree;
-}
-
-namespace AtomicEditor
-{
-
-class SceneEditor3D;
-
-class SceneView3D: public UIView3D
-{
-    OBJECT(SceneView3D);
-
-public:
-
-    SceneView3D(Context* context, SceneEditor3D* sceneEditor);
-    virtual ~SceneView3D();
-    void SelectNode(Node* node);
-
-    Ray GetCameraRay();
-
-    bool OnEvent(const TBWidgetEvent &ev);
-
-    void SetPitch(float pitch) { pitch_ = pitch; }
-    void SetYaw(float yaw) { yaw_ = yaw; }
-
-    void Enable();
-    void Disable();
-    bool IsEnabled() { return enabled_; }
-
-private:
-
-    bool MouseInView();
-
-    void HandleUpdate(StringHash eventType, VariantMap& eventData);
-    void HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData);
-    void HandleEditorActiveNodeChange(StringHash eventType, VariantMap& eventData);
-
-    void DrawNodeDebug(Node* node, DebugRenderer* debug, bool drawNode = true);
-
-    void MoveCamera(float timeStep);
-
-    WeakPtr<SceneEditor3D> sceneEditor_;
-
-    float yaw_;
-    float pitch_;
-
-    bool mouseLeftDown_;
-    bool mouseMoved_;
-
-    bool enabled_;
-
-    SharedPtr<Camera> camera_;
-    SharedPtr<DebugRenderer> debugRenderer_;
-    SharedPtr<Octree> octree_;
-    SharedPtr<Node> selectedNode_;
-
-};
-
-}

+ 0 - 305
Attic/AtomicEditorReference/Source/Editors/TextResourceEditor.cpp

@@ -1,305 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-#include <Atomic/Container/ArrayPtr.h>
-#include <Atomic/UI/UI.h>
-#include <Atomic/IO/Log.h>
-#include <Atomic/IO/File.h>
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/Resource/ResourceCache.h>
-#include <Atomic/Core/CoreEvents.h>
-
-#include "../AEEvents.h"
-#include "../UI/UIFindTextWidget.h"
-
-#include "TextResourceEditor.h"
-
-#include <TurboBadger/tb_message_window.h>
-#include <TurboBadger/tb_editfield.h>
-#include <TurboBadger/tb_style_edit.h>
-#include <TurboBadger/tb_style_edit_content.h>
-
-using namespace tb;
-
-namespace AtomicEditor
-{
-
-TextResourceEditor ::TextResourceEditor(Context* context, const String &fullpath, TBTabContainer *container) :
-    ResourceEditor(context, fullpath, container),
-    styleEdit_(0),
-    editField_(0),
-    modified_(false),
-    currentFindPos_(-1)
-{
-
-    TBLayout* layout =  new TBLayout();
-    layout->SetLayoutDistribution(LAYOUT_DISTRIBUTION_GRAVITY);
-    layout->SetGravity(WIDGET_GRAVITY_ALL);
-
-    rootContentWidget_->AddChild(layout);
-
-    TBContainer* c = new TBContainer();
-    c->SetGravity(WIDGET_GRAVITY_ALL);
-
-    TBEditField* text = editField_ = new TBEditField();
-    text->SetMultiline(true);
-    text->SetWrapping(true);
-    text->SetGravity(WIDGET_GRAVITY_ALL);
-    text->SetStyling(true);
-    text->SetSkinBg(TBIDC("TextCode"));
-
-    TBFontDescription fd;
-    fd.SetID(TBIDC("Monaco"));
-    fd.SetSize(12);
-    text->SetFontDescription(fd);
-
-    SharedPtr<File> jsFile(GetSubsystem<ResourceCache>()->GetFile(fullpath));
-    assert(jsFile);
-
-    String source;
-    jsFile->ReadText(source);
-
-    text->SetText(source.CString());
-
-    c->AddChild(text);
-
-    layout->AddChild(c);
-    layout->SetSpacing(0);
-
-    TBStyleEdit* sedit = text->GetStyleEdit();
-    sedit->text_change_listener = this;
-
-    TBTextTheme* theme = new TBTextTheme();
-    for (unsigned i = 0; i < TB_MAX_TEXT_THEME_COLORS; i++)
-        theme->themeColors[i] = TBColor(255, 255, 255);
-
-    sedit->SetTextTheme(theme);
-
-    styleEdit_ = sedit;
-
-    SubscribeToEvent(E_UPDATE, HANDLER(TextResourceEditor, HandleUpdate));
-
-    // FIXME: Set the size at the end of setup, so all children are updated accordingly
-    // future size changes will be handled automatically
-    TBRect rect = container_->GetContentRoot()->GetRect();
-    rootContentWidget_->SetSize(rect.w, rect.h);
-
-
-}
-
-TextResourceEditor::~TextResourceEditor()
-{
-}
-
-
-
-bool TextResourceEditor::OnEvent(const TBWidgetEvent &ev)
-{
-    if (ev.type == EVENT_TYPE_KEY_DOWN)
-    {
-        if (ev.special_key == TB_KEY_ESC)
-        {
-            SendEvent(E_FINDTEXTCLOSE);
-        }
-
-    }
-
-    if (ev.type == EVENT_TYPE_SHORTCUT)
-    {
-        if (ev.ref_id == TBIDC("close"))
-        {
-            if (modified_)
-            {
-                TBMessageWindow *msg_win = new TBMessageWindow(container_, TBIDC("unsaved_jsmodifications_dialog"));
-                TBMessageWindowSettings settings(TB_MSG_OK_CANCEL, TBID(uint32(0)));
-                settings.dimmer = true;
-                settings.styling = true;
-                msg_win->Show("Unsaved Modifications", "There are unsaved modications.\nDo you wish to discard them and close?", &settings, 640, 360);
-            }
-            else
-            {
-                Close();
-            }
-
-        }
-
-        if (ev.ref_id == TBIDC("save") && modified_)
-        {
-            TBStr text;
-            styleEdit_->GetText(text);
-            File file(context_, fullpath_, FILE_WRITE);
-            file.Write((void*) text.CStr(), text.Length());
-            file.Close();
-
-            ResourceCache* cache = GetSubsystem<ResourceCache>();
-
-            //SharedPtr<File> jsFile (GetSubsystem<ResourceCache>()->GetFile<File>(fullpath_));
-            //cache->ReloadResource(jsFile);
-
-            String filename = GetFileNameAndExtension(fullpath_);
-            button_->SetText(filename.CString());
-
-            modified_ = false;
-
-            SendEvent(E_JAVASCRIPTSAVED);
-
-            return true;
-        }
-        else if (ev.ref_id == TBIDC("find"))
-        {
-            using namespace FindTextOpen;
-            SendEvent(E_FINDTEXTOPEN);
-        }
-        else if (ev.ref_id == TBIDC("findnext") || ev.ref_id == TBIDC("findprev"))
-        {
-            String text;
-
-            FindTextWidget* finder = GetSubsystem<FindTextWidget>();
-            finder->GetFindText(text);
-
-            // TODO: get flags from finder
-            unsigned flags = FINDTEXT_FLAG_NONE;
-
-            if (ev.ref_id == TBIDC("findnext"))
-                flags |= FINDTEXT_FLAG_NEXT;
-            else if (ev.ref_id == TBIDC("findprev"))
-                flags |= FINDTEXT_FLAG_PREV;
-
-            flags |= FINDTEXT_FLAG_WRAP;
-
-            finder->Find(text, flags);
-        }
-        else if (ev.ref_id == TBIDC("cut") || ev.ref_id == TBIDC("copy") || ev.ref_id == TBIDC("paste")
-                 || ev.ref_id == TBIDC("selectall") || ev.ref_id == TBIDC("undo") || ev.ref_id == TBIDC("redo") )
-        {
-            editField_->OnEvent(ev);
-        }
-
-    }
-
-    if (ev.type == EVENT_TYPE_CLICK)
-    {
-        if (ev.target->GetID() == TBIDC("unsaved_jsmodifications_dialog"))
-        {
-            if (ev.ref_id == TBIDC("TBMessageWindow.ok"))
-            {
-                Close();
-            }
-            else
-            {
-                SetFocus();
-            }
-
-            return true;
-        }
-
-    }
-
-    return false;
-}
-
-void TextResourceEditor::HandleUpdate(StringHash eventType, VariantMap& eventData)
-{
-
-    if (!styleEdit_)
-        return;
-}
-
-void TextResourceEditor::FindTextClose()
-{
-    editField_->SetFocus(WIDGET_FOCUS_REASON_UNKNOWN);
-    styleEdit_->selection.SelectNothing();
-}
-
-
-void TextResourceEditor::OnChange(TBStyleEdit* styleEdit)
-{
-    modified_ = true;
-    String filename = GetFileNameAndExtension(fullpath_);
-    filename += "*";
-    button_->SetText(filename.CString());
-}
-
-bool TextResourceEditor::FindText(const String& findText, unsigned flags)
-{
-    // TODO: this should be shared with the JS resource editor
-    unsigned findLength = findText.Length();
-
-    if (!findLength)
-        return true;
-
-    TBStr _source;
-    styleEdit_->GetText(_source);
-    String source = _source.CStr();
-
-    unsigned pos = String::NPOS;
-    int startPos = currentFindPos_;
-
-    if (currentFindPos_ == -1)
-        startPos = styleEdit_->caret.GetGlobalOfs();
-    else
-    {
-        if (flags & FINDTEXT_FLAG_NEXT)
-            startPos += findLength;
-    }
-
-    if (flags & FINDTEXT_FLAG_PREV)
-    {
-        String pretext = source.Substring(0, startPos);
-        pos = pretext.FindLast(findText, String::NPOS, flags & FINDTEXT_FLAG_CASESENSITIVE ? true : false);
-    }
-    else
-    {
-        pos = source.Find(findText, startPos, flags & FINDTEXT_FLAG_CASESENSITIVE ? true : false);
-    }
-
-    if (pos == String::NPOS)
-    {
-        if (flags & FINDTEXT_FLAG_WRAP)
-        {
-            if (flags & FINDTEXT_FLAG_PREV)
-            {
-                pos = source.FindLast(findText, String::NPOS, flags & FINDTEXT_FLAG_CASESENSITIVE ? true : false);
-            }
-            else
-            {
-                pos = source.Find(findText, 0, flags & FINDTEXT_FLAG_CASESENSITIVE ? true : false);
-            }
-        }
-
-        if (pos == String::NPOS)
-        {
-            styleEdit_->selection.SelectNothing();
-            return true;
-        }
-    }
-
-    currentFindPos_ = pos;
-
-    styleEdit_->caret.SetGlobalOfs((int) pos + findLength);
-
-    int height = styleEdit_->layout_height;
-
-    int newy = styleEdit_->caret.y - height/2;
-
-    styleEdit_->SetScrollPos(styleEdit_->scroll_x, newy);
-
-    styleEdit_->selection.Select(pos, pos + findLength);
-
-    return true;
-}
-
-void TextResourceEditor::SetFocus()
-{
-    editField_->SetFocus(WIDGET_FOCUS_REASON_UNKNOWN);
-}
-
-
-bool TextResourceEditor::HasUnsavedModifications()
-{
-    return modified_;
-}
-
-}

+ 0 - 53
Attic/AtomicEditorReference/Source/Editors/TextResourceEditor.h

@@ -1,53 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include "ResourceEditor.h"
-#include <TurboBadger/tb_editfield.h>
-#include <TurboBadger/tb_style_edit.h>
-#include <TurboBadger/tb_select.h>
-
-using namespace Atomic;
-using namespace tb;
-
-namespace AtomicEditor
-{
-
-class TextResourceEditor: public ResourceEditor, public TBStyleEditTextChangeListener
-{
-    OBJECT(TextResourceEditor);
-
-public:
-
-    TextResourceEditor(Context* context, const String& fullpath, TBTabContainer* container);
-
-    virtual ~TextResourceEditor();
-
-    bool OnEvent(const TBWidgetEvent &ev);
-
-    bool FindText(const String& findText, unsigned flags);
-    void FindTextClose();
-
-    void SetFocus();
-
-    bool HasUnsavedModifications();
-    void OnChange(TBStyleEdit* styleEdit);
-
-private:
-
-    void HandleUpdate(StringHash eventType, VariantMap& eventData);
-
-    void UpdateLineNumbers();
-
-    tb::TBStyleEdit* styleEdit_;
-    TBEditField* editField_;
-
-    bool modified_;
-
-    int currentFindPos_;
-
-};
-
-}

+ 0 - 997
Attic/AtomicEditorReference/Source/Import/AEImportJSON.cpp

@@ -1,997 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-#include <rapidjson/document.h>
-#include <rapidjson/stringbuffer.h>
-#include <rapidjson/prettywriter.h>
-
-#include <Atomic/IO/Log.h>
-#include <Atomic/IO/File.h>
-#include "AEImportJSON.h"
-
-using namespace rapidjson;
-
-namespace AtomicEditor
-{
-
-static unsigned char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-static int _base64Decode(const unsigned char *input, unsigned int input_len, unsigned char *output, unsigned int *output_len )
-{
-    static char inalphabet[256], decoder[256];
-    int i, bits, c = 0, char_count, errors = 0;
-    unsigned int input_idx = 0;
-    unsigned int output_idx = 0;
-
-    for (i = (sizeof alphabet) - 1; i >= 0 ; i--) {
-        inalphabet[alphabet[i]] = 1;
-        decoder[alphabet[i]] = i;
-    }
-
-    char_count = 0;
-    bits = 0;
-    for( input_idx=0; input_idx < input_len ; input_idx++ ) {
-        c = input[ input_idx ];
-        if (c == '=')
-            break;
-        if (c > 255 || ! inalphabet[c])
-            continue;
-        bits += decoder[c];
-        char_count++;
-        if (char_count == 4) {
-            output[ output_idx++ ] = (bits >> 16);
-            output[ output_idx++ ] = ((bits >> 8) & 0xff);
-            output[ output_idx++ ] = ( bits & 0xff);
-            bits = 0;
-            char_count = 0;
-        } else {
-            bits <<= 6;
-        }
-    }
-
-    if( c == '=' ) {
-        switch (char_count) {
-        case 1:
-            errors++;
-            break;
-        case 2:
-            output[ output_idx++ ] = ( bits >> 10 );
-            break;
-        case 3:
-            output[ output_idx++ ] = ( bits >> 16 );
-            output[ output_idx++ ] = (( bits >> 8 ) & 0xff);
-            break;
-        }
-    } else if ( input_idx < input_len ) {
-        if (char_count) {
-            errors++;
-        }
-    }
-
-    *output_len = output_idx;
-    return errors;
-}
-
-bool JSONComponent::Parse(const rapidjson::Value& value)
-{
-    for (Value::ConstMemberIterator oitr = value.MemberBegin();
-         oitr != value.MemberEnd(); ++oitr)
-    {
-        if (!strcmp(oitr->name.GetString(), "enabled"))
-        {
-            enabled_ = oitr->value.IsTrue();
-        }
-    }
-
-    return true;
-
-}
-
-JSONTransform::JSONTransform(JSONSceneImporter* importer, const rapidjson::Value& value) :
-    JSONComponent(importer, "Transform")
-{
-
-    JSONComponent::Parse(value);
-
-    for (Value::ConstMemberIterator oitr = value.MemberBegin();
-         oitr != value.MemberEnd(); ++oitr)
-    {
-        if (!strcmp(oitr->name.GetString(), "localPosition"))
-        {
-            importer->ReadVector3FromArray(oitr->value, localPosition_);
-        }
-        else if (!strcmp(oitr->name.GetString(), "localScale"))
-        {
-            importer->ReadVector3FromArray(oitr->value, localScale_);
-        }
-        else if (!strcmp(oitr->name.GetString(), "localRotation"))
-        {
-            importer->ReadQuaternionFromArray(oitr->value, localRotation_);
-        }
-    }
-}
-
-
-JSONMeshRenderer::JSONMeshRenderer(JSONSceneImporter* importer, const rapidjson::Value& value, const char* type) :
-    JSONComponent(importer, type)
-  , mesh_(0)
-  , castShadows_(false)
-  , receiveShadows_(false)
-  , lightmapIndex_(-1)
-{
-    JSONComponent::Parse(value);
-
-    for (Value::ConstMemberIterator oitr = value.MemberBegin();
-         oitr != value.MemberEnd(); ++oitr)
-    {
-        if (!strcmp(oitr->name.GetString(), "mesh"))
-        {
-            mesh_ = importer->GetMesh(oitr->value.GetString());
-        }
-        else if (!strcmp(oitr->name.GetString(), "castShadows"))
-        {
-            castShadows_ = oitr->value.IsTrue();
-        }
-        else if (!strcmp(oitr->name.GetString(), "receiveShadows"))
-        {
-            receiveShadows_ = oitr->value.IsTrue();
-        }
-        else if (!strcmp(oitr->name.GetString(), "lightmapIndex"))
-        {
-            lightmapIndex_ = oitr->value.GetInt();
-        }
-        else if (!strcmp(oitr->name.GetString(), "lightmapTilingOffset"))
-        {
-            importer->ReadVector4FromArray(oitr->value, lightmapTilingOffset_);
-        }
-        else if (!strcmp(oitr->name.GetString(), "materials"))
-        {
-            for (Value::ConstValueIterator mitr = oitr->value.Begin(); mitr != oitr->value.End(); mitr++)
-            {
-                JSONMaterial* material = importer->GetMaterial((*mitr).GetString());
-                assert(material);
-                materials_.Push(material);
-            }
-
-        }
-    }
-}
-
-JSONSkinnedMeshRenderer::JSONSkinnedMeshRenderer(JSONSceneImporter* importer, const rapidjson::Value& value) :
-    JSONMeshRenderer(importer, value, "SkinnedMeshRenderer")
-{
-
-}
-
-JSONAnimation::JSONAnimation(JSONSceneImporter* importer, const rapidjson::Value& value) :
-    JSONComponent(importer, "Animation")
-{
-    JSONComponent::Parse(value);
-
-    const Value::Member* jclips = value.FindMember("clips");
-
-    assert(jclips);
-
-    for (Value::ConstValueIterator clipitr = jclips->value.Begin(); clipitr != jclips->value.End(); clipitr++)
-    {
-        const Value::Member* clipname = clipitr->FindMember("name");
-        const Value::Member* clipnodes = clipitr->FindMember("nodes");
-
-        AnimationClip* aclip = new AnimationClip();
-        aclip->name_ = clipname->value.GetString();
-
-        for (Value::ConstValueIterator nodeitr = clipnodes->value.Begin(); nodeitr != clipnodes->value.End(); nodeitr++)
-        {
-            AnimationNode* node = new AnimationNode();
-            const Value::Member* nodename = nodeitr->FindMember("name");
-            const Value::Member* keyframes = nodeitr->FindMember("keyframes");
-
-            node->name_ = nodename->value.GetString();
-
-            for (Value::ConstValueIterator keyitr = keyframes->value.Begin(); keyitr != keyframes->value.End(); keyitr++)
-            {
-                Keyframe* keyframe = new Keyframe();
-
-                const Value::Member* jpos = keyitr->FindMember("pos");
-                const Value::Member* jscale = keyitr->FindMember("scale");
-                const Value::Member* jrot = keyitr->FindMember("rot");
-                const Value::Member* jtime = keyitr->FindMember("time");
-
-                keyframe->time_ = (float) jtime->value.GetDouble();
-                importer_->ReadVector3FromArray(jpos->value, keyframe->pos_);
-                importer_->ReadVector3FromArray(jscale->value, keyframe->scale_);
-                importer_->ReadQuaternionFromArray(jrot->value, keyframe->rot_);
-
-                node->keyframes_.Push(keyframe);
-            }
-
-            aclip->nodes_.Push(node);
-
-        }
-
-        clips_.Push(aclip);
-
-    }
-
-}
-
-JSONTimeOfDay::JSONTimeOfDay(JSONSceneImporter* importer, const rapidjson::Value& value) :
-    JSONComponent(importer, "TimeOfDay"),
-    timeOn_(0),
-    timeOff_(0)
-{
-    JSONComponent::Parse(value);
-
-    const Value::Member* jtimeOn = value.FindMember("timeOn");
-    if (jtimeOn)
-        timeOn_ = (float) jtimeOn->value.GetDouble();
-
-    const Value::Member* jtimeOff = value.FindMember("timeOff");
-    if (jtimeOff)
-        timeOff_ = (float) jtimeOff->value.GetDouble();
-}
-
-JSONLight::JSONLight(JSONSceneImporter* importer, const rapidjson::Value& value) :
-    JSONComponent(importer, "Light"),
-    lightType_("Point"),
-    range_(10),
-    color_(1, 1, 1, 1),
-    castsShadows_(false),
-    realtime_(false)
-{
-    JSONComponent::Parse(value);
-
-    const Value::Member* jlightType = value.FindMember("lightType");
-    if (jlightType)
-        lightType_ = jlightType->value.GetString();
-
-    const Value::Member* jrange = value.FindMember("range");
-    if (jrange)
-        range_ = (float) jrange->value.GetDouble();
-
-    const Value::Member* jcolor = value.FindMember("color");
-    if (jcolor)
-        importer->ReadColorFromArray(jcolor->value, color_);
-
-    const Value::Member* jcastsShadows = value.FindMember("castsShadows");
-    if (jcastsShadows)
-        castsShadows_ = jcastsShadows->value.GetBool();
-
-    const Value::Member* jrealtime = value.FindMember("realtime");
-    if (jrealtime)
-        realtime_ = jrealtime->value.GetBool();
-}
-
-
-JSONRigidBody::JSONRigidBody(JSONSceneImporter* importer, const rapidjson::Value& value) :
-    JSONComponent(importer, "RigidBody"),
-    mass_(0)
-{
-    JSONComponent::Parse(value);
-
-    const Value::Member* jmass = value.FindMember("mass");
-    if (jmass)
-        mass_ = (float) jmass->value.GetDouble();
-}
-
-
-JSONMeshCollider::JSONMeshCollider(JSONSceneImporter* importer, const rapidjson::Value& value) :
-    JSONComponent(importer, "MeshCollider")
-{
-    JSONComponent::Parse(value);
-
-}
-
-JSONBoxCollider::JSONBoxCollider(JSONSceneImporter* importer, const rapidjson::Value& value) :
-    JSONComponent(importer, "BoxCollider")
-{
-    JSONComponent::Parse(value);
-
-    const Value::Member* jcenter= value.FindMember("center");
-    if (jcenter)
-        importer->ReadVector3FromArray(jcenter->value, center_);
-
-    const Value::Member* jsize= value.FindMember("size");
-    if (jsize)
-        importer->ReadVector3FromArray(jsize->value, size_);
-}
-
-JSONTerrain::JSONTerrain(JSONSceneImporter* importer, const rapidjson::Value& value) :
-    JSONComponent(importer, "Terrain")
-  , heightmapHeight_(0)
-  , heightmapWidth_(0)
-  , heightmapResolution_(0)
-  , alphamapWidth_(0)
-  , alphamapHeight_(0)
-  , alphamapLayers_(0)
-  , alphaMapLength_(0)
-  , heightMapLength_(0)
-{
-    JSONComponent::Parse(value);
-
-    String base64Height;
-    String base64Alpha;
-
-    for (Value::ConstMemberIterator oitr = value.MemberBegin();
-         oitr != value.MemberEnd(); ++oitr)
-    {
-        if (!strcmp(oitr->name.GetString(), "heightmapHeight"))
-        {
-            heightmapHeight_ = oitr->value.GetInt();
-        }
-        else if (!strcmp(oitr->name.GetString(), "heightmapWidth"))
-        {
-            heightmapWidth_ = oitr->value.GetInt();
-        }
-        else if (!strcmp(oitr->name.GetString(), "heightmapResolution"))
-        {
-            heightmapResolution_ = oitr->value.GetInt();
-        }
-        else if (!strcmp(oitr->name.GetString(), "alphamapWidth"))
-        {
-            alphamapWidth_ = oitr->value.GetInt();
-        }
-        else if (!strcmp(oitr->name.GetString(), "alphamapHeight"))
-        {
-            alphamapHeight_ = oitr->value.GetInt();
-        }
-        else if (!strcmp(oitr->name.GetString(), "alphamapLayers"))
-        {
-            alphamapLayers_ = oitr->value.GetInt();
-        }
-        else if (!strcmp(oitr->name.GetString(), "base64HeightLength"))
-        {
-            heightMapLength_ = oitr->value.GetInt();
-        }
-        else if (!strcmp(oitr->name.GetString(), "base64AlphaLength"))
-        {
-            alphaMapLength_ = oitr->value.GetInt();
-        }
-        else if (!strcmp(oitr->name.GetString(), "base64Height"))
-        {
-            base64Height = oitr->value.GetString();
-        }
-        else if (!strcmp(oitr->name.GetString(), "base64Alpha"))
-        {
-            base64Alpha = oitr->value.GetString();
-        }
-        else if (!strcmp(oitr->name.GetString(), "heightmapScale"))
-        {
-            importer->ReadVector3FromArray(oitr->value, heightmapScale_);
-        }
-        else if (!strcmp(oitr->name.GetString(), "size"))
-        {
-            importer->ReadVector3FromArray(oitr->value, size_);
-        }
-
-    }
-
-    heightMap_ = new float[heightMapLength_];
-    alphaMap_ = new float[alphaMapLength_];
-
-    unsigned int length = 0;
-    int errors;
-
-    errors = _base64Decode((const unsigned char*)base64Height.CString(), base64Height.Length(), (unsigned char*) heightMap_.Get(), &length);
-
-    assert(!errors);
-    assert(length == heightMapLength_);
-
-    length = 0;
-
-    errors = _base64Decode((const unsigned char*)base64Alpha.CString(), base64Alpha.Length(),  (unsigned char*) alphaMap_.Get(), &length);
-
-    assert(!errors);
-    assert(length == alphaMapLength_);
-
-}
-
-JSONCamera::JSONCamera(JSONSceneImporter* importer, const rapidjson::Value& value) :
-    JSONComponent(importer, "Camera")
-{
-    JSONComponent::Parse(value);
-}
-
-JSONNode::JSONNode(JSONSceneImporter* importer, const rapidjson::Value& value) : importer_(importer)
-
-{
-    for (Value::ConstMemberIterator oitr = value.MemberBegin();
-         oitr != value.MemberEnd(); ++oitr)
-    {
-        if (!strcmp(oitr->name.GetString(), "name"))
-        {
-            name_ = oitr->value.GetString();
-        }
-        else if (!strcmp(oitr->name.GetString(), "children"))
-        {
-            for (Value::ConstValueIterator citr = oitr->value.Begin(); citr != oitr->value.End(); citr++)
-            {
-                if (!(*citr).IsObject())
-                    continue;
-
-                AddChild(new JSONNode(importer, *citr));
-            }
-        }
-        else if (!strcmp(oitr->name.GetString(), "components"))
-        {
-            for (Value::ConstValueIterator citr = oitr->value.Begin(); citr != oitr->value.End(); citr++)
-            {
-                if (!(*citr).IsObject())
-                    continue;
-
-                const Value::Member* jtype = citr->FindMember("type");
-
-                if (!jtype)
-                    continue;
-
-                String type = jtype->value.GetString();
-
-                if (type == "Transform")
-                {
-                    components_.Push(new JSONTransform(importer_, *citr));
-                }
-                else if (type == "MeshRenderer")
-                {
-                    components_.Push(new JSONMeshRenderer(importer_, *citr));
-                }
-                else if (type == "SkinnedMeshRenderer")
-                {
-                    components_.Push(new JSONSkinnedMeshRenderer(importer_, *citr));
-                }
-                else if (type == "Animation")
-                {
-                    components_.Push(new JSONAnimation(importer_, *citr));
-                }
-                else if (type == "Camera")
-                {
-                    components_.Push(new JSONCamera(importer_, *citr));
-                }
-                else if (type == "Terrain")
-                {
-                    components_.Push(new JSONTerrain(importer_, *citr));
-                }
-                else if (type == "RigidBody")
-                {
-                    components_.Push(new JSONRigidBody(importer_, *citr));
-                }
-                else if (type == "MeshCollider")
-                {
-                    components_.Push(new JSONMeshCollider(importer_, *citr));
-                }
-                else if (type == "BoxCollider")
-                {
-                    components_.Push(new JSONBoxCollider(importer_, *citr));
-                }
-                else if (type == "Light")
-                {
-                    components_.Push(new JSONLight(importer_, *citr));
-                }
-                else if (type == "TimeOfDay")
-                {
-                    components_.Push(new JSONTimeOfDay(importer_, *citr));
-                }
-
-            }
-        }
-    }
-}
-
-JSONSceneImporter::JSONSceneImporter(Context* context) : Importer(context)
-  , document_(new Document())
-
-{
-
-}
-
-void JSONSceneImporter::ReadColorFromArray(const rapidjson::Value& value, Color& color)
-{
-    if (!value.IsArray() || (value.Size() < 3 || value.Size() > 4))
-        return;
-
-    color.r_ = color.g_ = color.b_ = color.a_ = 1.0f;
-
-    color.r_ = (float) value[SizeType(0)].GetDouble();
-    color.g_ = (float) value[SizeType(1)].GetDouble();
-    color.b_ = (float) value[SizeType(2)].GetDouble();
-    if (value.Size() ==  4)
-        color.a_ = (float) value[SizeType(3)].GetDouble();
-
-}
-
-void JSONSceneImporter::ReadVector2FromArray(const rapidjson::Value& value, Vector2& v)
-{
-    if (!value.IsArray() || value.Size() != 2)
-        return;
-
-    v.x_ = (float) value[SizeType(0)].GetDouble();
-    v.y_ = (float) value[SizeType(1)].GetDouble();
-
-}
-
-void JSONSceneImporter::ReadVector3FromArray(const rapidjson::Value& value, Vector3& v)
-{
-    if (!value.IsArray() || value.Size() != 3)
-        return;
-
-    v.x_ = (float) value[SizeType(0)].GetDouble();
-    v.y_ = (float) value[SizeType(1)].GetDouble();
-    v.z_ = (float) value[SizeType(2)].GetDouble();
-}
-
-void JSONSceneImporter::ReadVector4FromArray(const rapidjson::Value& value, Vector4& v)
-{
-    if (!value.IsArray() || value.Size() != 4)
-        return;
-
-    v.x_ = (float) value[SizeType(0)].GetDouble();
-    v.y_ = (float) value[SizeType(1)].GetDouble();
-    v.z_ = (float) value[SizeType(2)].GetDouble();
-    v.w_ = (float) value[SizeType(3)].GetDouble();
-}
-
-void JSONSceneImporter::ReadQuaternionFromArray(const rapidjson::Value& value, Quaternion& q)
-{
-    if (!value.IsArray() || value.Size() != 4)
-        return;
-
-    q.x_ = (float) value[SizeType(0)].GetDouble();
-    q.y_ = (float) value[SizeType(1)].GetDouble();
-    q.z_ = (float) value[SizeType(2)].GetDouble();
-    q.w_ = (float) value[SizeType(3)].GetDouble();
-
-}
-
-void JSONSceneImporter::ReadMatrix4FromArray(const rapidjson::Value& value, Matrix4& m)
-{
-    if (!value.IsArray() || value.Size() != 16)
-        return;
-
-    float mf[16];
-    for (SizeType i = 0; i < 16; i++)
-        mf[i] = (float) value[i].GetDouble();
-
-    m = Matrix4(mf);
-
-}
-
-
-bool JSONSceneImporter::ParseMaterials(const rapidjson::Value& value)
-{
-    const Value::Member* jmaterials = value.FindMember("materials");
-    if (jmaterials && jmaterials->value.IsArray())
-    {
-        for (Value::ConstValueIterator itr = jmaterials->value.Begin(); itr != jmaterials->value.End(); itr++)
-        {
-            if ((*itr).IsObject())
-            {
-                String name = "Anonymous Material";
-                String shader;
-                String mainTexture;
-                Vector2 mainTextureOffset(0.0f, 0.0f);
-                Vector2 mainTextureScale(1.0f, 1.0f);
-                int passCount = 1;
-                int renderQueue = 0;
-                Color color(1, 1, 1, 1);
-
-                for (Value::ConstMemberIterator oitr = (*itr).MemberBegin();
-                     oitr != (*itr).MemberEnd(); ++oitr)
-                {
-
-                    if (!strcmp(oitr->name.GetString(), "name"))
-                    {
-                        name = oitr->value.GetString();
-                    }
-                    else if (!strcmp(oitr->name.GetString(), "shader"))
-                    {
-                        shader = oitr->value.GetString();
-                    }
-                    else if (!strcmp(oitr->name.GetString(), "mainTexture"))
-                    {
-                        mainTexture = oitr->value.GetString();
-                    }
-                    else if (!strcmp(oitr->name.GetString(), "mainTextureOffset"))
-                    {
-                        ReadVector2FromArray(oitr->value, mainTextureOffset);
-                    }
-                    else if (!strcmp(oitr->name.GetString(), "mainTextureScale"))
-                    {
-                        ReadVector2FromArray(oitr->value, mainTextureScale);
-                    }
-                    else if (!strcmp(oitr->name.GetString(), "renderQueue"))
-                    {
-                        renderQueue = oitr->value.GetInt();
-                    }
-                    else if (!strcmp(oitr->name.GetString(), "passCount"))
-                    {
-                        passCount = oitr->value.GetInt();
-                    }
-                    else if (!strcmp(oitr->name.GetString(), "color"))
-                    {
-                        ReadColorFromArray(oitr->value, color);
-                    }
-                }
-
-                JSONMaterial* material = new JSONMaterial(name);
-
-                material->SetColor(color);
-                material->SetMainTexture(mainTexture);
-                material->SetMainTextureOffset(mainTextureOffset);
-                material->SetMainTextureScale(mainTextureScale);
-                material->SetPassCount(passCount);
-                material->SetRenderQueue(renderQueue);
-                material->SetShader(shader);
-
-                AddMaterial(material);
-            }
-        }
-    }
-
-    return true;
-}
-
-bool JSONSceneImporter::ParseMeshes(const rapidjson::Value& value)
-{
-    const Value::Member* jmeshes = value.FindMember("meshes");
-    if (jmeshes && jmeshes->value.IsArray())
-    {
-        for (Value::ConstValueIterator itr = jmeshes->value.Begin(); itr != jmeshes->value.End(); itr++)
-        {
-            if ((*itr).IsObject())
-            {
-                JSONMesh* mesh = new JSONMesh("Anonymous Mesh");
-
-                for (Value::ConstMemberIterator oitr = (*itr).MemberBegin();
-                     oitr != (*itr).MemberEnd(); ++oitr)
-                {
-
-                    if (!strcmp(oitr->name.GetString(), "name"))
-                    {
-                        mesh->SetName(oitr->value.GetString());
-                    }
-                    else if (!strcmp(oitr->name.GetString(), "triangles"))
-                    {
-                        if (oitr->value.IsArray())
-                        {
-                            for (Value::ConstValueIterator triangleArrayItr = oitr->value.Begin();
-                                 triangleArrayItr != oitr->value.End(); triangleArrayItr++)
-                            {
-                                PODVector<int>& triangles = mesh->AddSubMesh();
-
-                                for (Value::ConstValueIterator vertexItr = triangleArrayItr->Begin();
-                                     vertexItr != triangleArrayItr->End(); vertexItr++)
-                                {
-                                    triangles.Push((*vertexItr).GetInt());
-                                }
-
-                            }
-                        }
-                    }
-                    else if (!strcmp(oitr->name.GetString(), "vertexPositions"))
-                    {
-                        Vector3 pos;
-                        PODVector<Vector3>& vpos = mesh->GetVertexPositions();
-                        for (Value::ConstValueIterator vertexItr = oitr->value.Begin();
-                             vertexItr != oitr->value.End(); vertexItr++)
-                        {
-
-                            ReadVector3FromArray(*vertexItr, pos);
-                            vpos.Push(pos);
-                        }
-
-                    }
-                    else if (!strcmp(oitr->name.GetString(), "vertexNormals"))
-                    {
-                        Vector3 pos;
-                        PODVector<Vector3>& vnorm = mesh->GetVertexNormals();
-                        for (Value::ConstValueIterator vertexItr = oitr->value.Begin();
-                             vertexItr != oitr->value.End(); vertexItr++)
-                        {
-
-                            ReadVector3FromArray(*vertexItr, pos);
-                            vnorm.Push(pos);
-                        }
-
-                    }
-                    else if (!strcmp(oitr->name.GetString(), "vertexTangents"))
-                    {
-                        Vector4 tangent;
-                        PODVector<Vector4>& vtangents = mesh->GetVertexTangents();
-                        for (Value::ConstValueIterator vertexItr = oitr->value.Begin();
-                             vertexItr != oitr->value.End(); vertexItr++)
-                        {
-
-                            ReadVector4FromArray(*vertexItr, tangent);
-                            vtangents.Push(tangent);
-                        }
-
-                    }
-                    else if (!strcmp(oitr->name.GetString(), "boneWeights"))
-                    {
-                        PODVector<JSONMesh::BoneWeight>& boneWeights = mesh->GetBoneWeights();
-
-                        for (Value::ConstValueIterator bitr = oitr->value.Begin();
-                             bitr != oitr->value.End(); bitr++)
-                        {
-                            JSONMesh::BoneWeight bw;
-                            const Value::Member* indexes = bitr->FindMember("indexes");
-                            const Value::Member* weights = bitr->FindMember("weights");
-
-                            for (int i = 0; i < 4; i++)
-                            {
-                                bw.indexes_[i] = indexes->value[SizeType(i)].GetInt();
-                                bw.weights_[i] = (float) weights->value[SizeType(i)].GetDouble();
-                            }
-
-                            boneWeights.Push(bw);
-
-                        }
-
-                    }
-                    else if (!strcmp(oitr->name.GetString(), "rootBone"))
-                    {
-                        mesh->SetRootBone(oitr->value.GetString());
-                    }
-                    else if (!strcmp(oitr->name.GetString(), "bindPoses"))
-                    {
-                        Vector<Matrix4>& bindPoses = mesh->GetBindPoses();
-
-                        for (Value::ConstValueIterator bitr = oitr->value.Begin();
-                             bitr != oitr->value.End(); bitr++)
-                        {
-                            Matrix4 m;
-                            ReadMatrix4FromArray(*bitr, m);
-                            bindPoses.Push(m);
-                        }
-
-                    }
-                    else if (!strcmp(oitr->name.GetString(), "bones"))
-                    {
-                        Vector<JSONMesh::Bone>& bones = mesh->GetBones();
-
-                        if (!oitr->value.IsNull())
-                        {
-                            for (Value::ConstValueIterator bitr = oitr->value.Begin();
-                                 bitr != oitr->value.End(); bitr++)
-                            {
-                                const Value::Member* pos = bitr->FindMember("localPosition");
-                                const Value::Member* rot = bitr->FindMember("localRotation");
-                                const Value::Member* scale = bitr->FindMember("localScale");
-                                const Value::Member* name = bitr->FindMember("name");
-                                const Value::Member* parentName = bitr->FindMember("parentName");
-
-                                JSONMesh::Bone bone;
-
-                                ReadVector3FromArray(pos->value, bone.pos_);
-                                ReadVector3FromArray(scale->value, bone.scale_);
-                                ReadQuaternionFromArray(rot->value, bone.rot_);
-                                bone.name_ = name->value.GetString();
-                                bone.parentName_ = parentName->value.GetString();
-
-                                bones.Push(bone);
-                            }
-                        }
-
-                    }
-                    else if (!strcmp(oitr->name.GetString(), "vertexUV") ||
-                             !strcmp(oitr->name.GetString(), "vertexUV2"))
-                    {
-                        Vector2 uv;
-                        PODVector<Vector2>& uvs = !strcmp(oitr->name.GetString(), "vertexUV") ?
-                                    mesh->GetUVSet(0) : mesh->GetUVSet(1);
-
-                        for (Value::ConstValueIterator uvItr = oitr->value.Begin();
-                             uvItr != oitr->value.End(); uvItr++)
-                        {
-
-                            ReadVector2FromArray(*uvItr, uv);
-                            uvs.Push(uv);
-                        }
-
-                    }
-
-                }
-
-                AddMesh(mesh);
-            }
-        }
-    }
-
-    return true;
-}
-
-bool JSONSceneImporter::ParseShaders(const rapidjson::Value& value)
-{
-    const Value::Member* jshaders = value.FindMember("shaders");
-    if (jshaders && jshaders->value.IsArray())
-    {
-        for (Value::ConstValueIterator itr = jshaders->value.Begin(); itr != jshaders->value.End(); itr++)
-        {
-            if ((*itr).IsObject())
-            {
-                String name = "Anonymous Shader";
-                int renderQueue = 0;
-
-                for (Value::ConstMemberIterator oitr = (*itr).MemberBegin();
-                     oitr != (*itr).MemberEnd(); ++oitr)
-                {
-                    if (!strcmp(oitr->name.GetString(), "name"))
-                    {
-                        name = oitr->value.GetString();
-                    }
-                    else if (!strcmp(oitr->name.GetString(), "renderQueue"))
-                    {
-                        renderQueue = oitr->value.GetInt();
-                    }
-
-                }
-
-                AddShader(new JSONShader(name, renderQueue));
-            }
-        }
-    }
-
-    return true;
-}
-
-bool JSONSceneImporter::ParseTextures(const rapidjson::Value& value)
-{
-    const Value::Member* jtextures = value.FindMember("textures");
-    if (jtextures && jtextures->value.IsArray())
-    {
-        for (Value::ConstValueIterator itr = jtextures->value.Begin(); itr != jtextures->value.End(); itr++)
-        {
-            String name;
-            String base64PNG;
-            int base64PNGLength = 0;
-
-            if ((*itr).IsObject())
-            {
-                const Value::Member* jname = (*itr).FindMember("name");
-                if (jname && jname->value.IsString())
-                {
-                    name = jname->value.GetString();
-                }
-                const Value::Member* jbase64PNG = (*itr).FindMember("base64PNG");
-                if (jbase64PNG)
-                {
-                    base64PNG = jbase64PNG->value.GetString();
-                }
-                const Value::Member* jbase64PNGLength = (*itr).FindMember("base64PNGLength");
-                if (jbase64PNGLength)
-                {
-                    base64PNGLength = jbase64PNGLength->value.GetInt();
-                }
-
-            }
-
-            SharedArrayPtr<unsigned char> pngPixels;
-            pngPixels = new unsigned char[base64PNGLength];
-
-            unsigned int length = 0;
-            int errors = _base64Decode((const unsigned char*)base64PNG.CString(), base64PNG.Length(), pngPixels.Get(), &length);
-
-            assert(!errors);
-            assert(length == base64PNGLength);
-
-            JSONTexture* texture = new JSONTexture(name);
-            texture->SetPNGPixels(pngPixels, base64PNGLength);
-            AddTexture(texture);
-
-        }
-    }
-
-    return true;
-}
-
-bool JSONSceneImporter::ParseLightmaps(const rapidjson::Value& value)
-{
-    const Value::Member* jlightmaps = value.FindMember("lightmaps");
-    if (jlightmaps && jlightmaps->value.IsArray())
-    {
-        for (Value::ConstValueIterator itr = jlightmaps->value.Begin(); itr != jlightmaps->value.End(); itr++)
-        {
-            String name;
-            String base64PNG;
-            int base64PNGLength = 0;
-
-            if ((*itr).IsObject())
-            {
-                const Value::Member* jname = (*itr).FindMember("filename");
-                if (jname && jname->value.IsString())
-                {
-                    name = jname->value.GetString();
-                }
-                const Value::Member* jbase64PNG = (*itr).FindMember("base64PNG");
-                if (jbase64PNG)
-                {
-                    base64PNG = jbase64PNG->value.GetString();
-                }
-                const Value::Member* jbase64PNGLength = (*itr).FindMember("base64PNGLength");
-                if (jbase64PNGLength)
-                {
-                    base64PNGLength = jbase64PNGLength->value.GetInt();
-                }
-
-            }
-
-            SharedArrayPtr<unsigned char> pngPixels;
-            pngPixels = new unsigned char[base64PNGLength];
-
-            unsigned int length = 0;
-            int errors = _base64Decode((const unsigned char*)base64PNG.CString(), base64PNG.Length(), pngPixels.Get(), &length);
-
-            assert(!errors);
-            assert(length == base64PNGLength);
-
-            JSONLightmap* lightmap = new JSONLightmap(name);
-            lightmap->SetPNGPixels(pngPixels, base64PNGLength);
-            AddLightmap(lightmap);
-
-        }
-    }
-
-    return true;
-}
-
-bool JSONSceneImporter::ParseResources(const rapidjson::Value& value)
-{
-
-    ParseTextures(value);
-    ParseLightmaps(value);
-    ParseShaders(value);
-    ParseMaterials(value);
-    ParseMeshes(value);
-
-    return true;
-}
-
-bool JSONSceneImporter::ParseHierarchy(const rapidjson::Value& value)
-{
-    for (Value::ConstValueIterator itr = value.Begin(); itr != value.End(); itr++)
-    {
-        if ((*itr).IsObject())
-        {
-            hierarchy_.Push(new JSONNode(this, *itr));
-        }
-    }
-
-    return true;
-}
-
-bool JSONSceneImporter::Import(const String& path)
-{
-    File jsonFile(context_, path);
-
-    String json;
-
-    jsonFile.ReadText(json);
-
-    if (document_->Parse<0>(json.CString()).HasParseError())
-    {
-        LOGERRORF("Could not parse JSON data from %s", path.CString());
-        return false;
-    }
-    const Value::Member* name = document_->FindMember("name");
-    if (name)
-        sceneName_ = name->value.GetString();
-
-    const Value::Member* jresources = document_->FindMember("resources");
-    if (jresources)
-        ParseResources(jresources->value);
-
-    const Value::Member* jhierarchy = document_->FindMember("hierarchy");
-    if (jhierarchy)
-        ParseHierarchy(jhierarchy->value);
-
-    return true;
-}
-
-JSONSceneImporter::~JSONSceneImporter()
-{
-    if (document_)
-        delete document_;
-}
-
-}

+ 0 - 934
Attic/AtomicEditorReference/Source/Import/AEImportJSON.h

@@ -1,934 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <Atomic/Container/List.h>
-#include <Atomic/Core/Object.h>
-
-using namespace Atomic;
-
-namespace rapidjson
-{
-template<typename CharType> struct UTF8;
-class CrtAllocator;
-template <typename BaseAllocator> class MemoryPoolAllocator;
-template <typename Encoding, typename Allocator> class GenericValue;
-typedef GenericValue<UTF8<char>, MemoryPoolAllocator<CrtAllocator> > Value;
-template <typename Encoding, typename Allocator> class GenericDocument;
-typedef GenericDocument<UTF8<char>, MemoryPoolAllocator<CrtAllocator> > Document;
-}
-
-
-namespace AtomicEditor
-{
-
-class JSONSceneImporter;
-
-class JSONResource
-{
-public:
-
-    void SetName(const String& name)
-    {
-        name_ = name;
-    }
-
-    const String& GetName() const
-    {
-        return name_;
-    }
-
-
-protected:
-    JSONResource(String name) : name_(name) {}
-
-private:
-
-    String name_;
-
-};
-
-class JSONTexture : public JSONResource
-{
-public:
-
-    JSONTexture(const String& name) : JSONResource(name)
-    {
-
-    }
-
-    unsigned char* GetPNGPixels(unsigned& length) const
-    {
-        length = length_;
-        return pngPixels_.Get();
-    }
-
-
-    void SetPNGPixels(SharedArrayPtr<unsigned char>& pngPixels, unsigned length)
-    {
-        length_ = length;
-        pngPixels_ = pngPixels;
-    }
-
-
-private:
-
-    SharedArrayPtr<unsigned char> pngPixels_;
-    unsigned length_;
-};
-
-class JSONLightmap : public JSONResource
-{
-public:
-
-    JSONLightmap(const String& name) : JSONResource(name)
-    {
-
-    }
-
-    unsigned char* GetPNGPixels(unsigned& length) const
-    {
-        length = length_;
-        return pngPixels_.Get();
-    }
-
-
-    void SetPNGPixels(SharedArrayPtr<unsigned char>& pngPixels, unsigned length)
-    {
-        length_ = length;
-        pngPixels_ = pngPixels;
-    }
-
-
-private:
-
-    SharedArrayPtr<unsigned char> pngPixels_;
-    unsigned length_;
-};
-
-
-class JSONShader: public JSONResource
-{
-public:
-
-    JSONShader(const String& name, int renderQueue) :
-        JSONResource(name), renderQueue_(renderQueue)
-    {
-
-    }
-
-private:
-
-    int renderQueue_;
-
-};
-
-class JSONMaterial : public JSONResource
-{
-public:
-
-    JSONMaterial(const String& name) :
-        JSONResource(name),
-        mainTextureOffset_(0.0f, 0.0f),
-        mainTextureScale_(1.0f, 1.0f),
-        passCount_(1),
-        color_(1, 1, 1, 1),
-        renderQueue_(0)
-    {
-
-    }
-
-    const String& GetShader() const
-    {
-        return shader_;
-    }
-
-    void SetShader(const String& shader)
-    {
-        shader_ = shader;
-    }
-
-    const String& GetMainTexture() const
-    {
-        return mainTexture_;
-    }
-
-    void SetMainTexture(const String& mainTexture)
-    {
-        mainTexture_ = mainTexture;
-    }
-
-    void SetMainTextureOffset(const Vector2& offset)
-    {
-        mainTextureOffset_ = offset;
-    }
-
-    void SetMainTextureScale(const Vector2& scale)
-    {
-        mainTextureScale_ = scale;
-    }
-
-    void SetColor(const Color& color)
-    {
-        color_ = color;
-    }
-
-    void SetPassCount(int count)
-    {
-        passCount_ = count;
-    }
-
-    void SetRenderQueue(int renderQueue)
-    {
-        renderQueue_ = renderQueue;
-    }
-
-private:
-
-    String shader_;
-    String mainTexture_;
-    Vector2 mainTextureOffset_;
-    Vector2 mainTextureScale_;
-    int passCount_;
-    Color color_;
-    int renderQueue_;
-    List<String> shaderKeywords_;
-};
-
-
-class JSONMesh : public JSONResource
-{
-public:
-
-    struct BoneWeight
-    {
-        int indexes_[4];
-        float weights_[4];
-    };
-
-    class Bone
-    {
-    public:
-        Vector3 pos_;
-        Vector3 scale_;
-        Quaternion rot_;
-        String name_;
-        String parentName_;
-    };
-
-    JSONMesh(const String& name) :
-        JSONResource(name)
-    {
-
-    }
-
-    PODVector<int>& AddSubMesh()
-    {
-        triangles_.Resize(triangles_.Size() + 1);
-        return triangles_.Back();
-    }
-
-    unsigned GetSubMeshCount()
-    {
-        return triangles_.Size();
-    }
-
-    PODVector<int>& GetSubMesh(unsigned index)
-    {
-        return triangles_.At(index);
-    }
-
-    unsigned GetVertexCount() const
-    {
-        return vertexPositions_.Size();
-    }
-
-    PODVector<Vector3>& GetVertexPositions()
-    {
-        return vertexPositions_;
-    }
-
-    PODVector<Vector3>& GetVertexNormals()
-    {
-        return vertexNormals_;
-    }
-
-    PODVector<Vector4>& GetVertexTangents()
-    {
-        return vertexTangents_;
-    }
-
-    unsigned GetNumUVSets() const
-    {
-        return vertexUV_.Size();
-    }
-
-    PODVector<Vector2>& GetUVSet(int idx)
-    {
-        while (vertexUV_.Size() <= idx)
-        {
-            AddUVSet();
-        }
-
-        return vertexUV_.At(idx);
-
-    }
-
-    PODVector<BoneWeight>& GetBoneWeights()
-    {
-        return boneWeights_;
-    }
-
-    Vector<Matrix4>& GetBindPoses()
-    {
-        return bindPoses_;
-    }
-
-    Vector<Bone>& GetBones()
-    {
-        return bones_;
-    }
-
-    const String& GetRootBone() const
-    {
-        return rootBone_;
-    }
-
-    void SetRootBone(const String& rootBone)
-    {
-        rootBone_ = rootBone;
-    }
-
-private:
-
-    PODVector<Vector2>& AddUVSet()
-    {
-        vertexUV_.Resize(vertexUV_.Size() + 1);
-        return vertexUV_.Back();
-    }
-
-
-    PODVector<Vector3> vertexPositions_;
-    PODVector<Vector3> vertexNormals_;
-    PODVector<Vector4> vertexTangents_;
-
-    Vector<PODVector<Vector2> > vertexUV_;
-
-    Vector<Matrix4> bindPoses_;
-    Vector<Bone> bones_;
-    PODVector<BoneWeight> boneWeights_;
-    String rootBone_;
-
-    //broken into submeshes
-    Vector<PODVector<int> > triangles_;
-
-};
-
-class JSONComponent
-{
-public:
-
-    const String& GetType() const
-    {
-        return type_;
-    }
-
-protected:
-
-    JSONComponent(JSONSceneImporter* importer, const String& type) : type_(type), enabled_(true)
-    {
-
-    }
-
-
-protected:
-
-    bool Parse(const rapidjson::Value& value);
-
-    String type_;
-    JSONSceneImporter* importer_;
-
-    bool enabled_;
-
-
-};
-
-class JSONTransform : public JSONComponent
-{
-public:
-
-    JSONTransform(JSONSceneImporter* importer, const rapidjson::Value& value);
-
-    const Vector3& GetLocalPosition() const
-    {
-        return localPosition_;
-    }
-    const Vector3& GetLocalScale() const
-    {
-        return localScale_;
-    }
-    const Quaternion& GetLocalRotation() const
-    {
-        return localRotation_;
-    }
-
-private:
-
-    Vector3 localPosition_;
-    Vector3 localScale_;
-    Quaternion localRotation_;
-};
-
-class JSONMeshRenderer: public JSONComponent
-{
-public:
-
-    JSONMeshRenderer(JSONSceneImporter* importer, const rapidjson::Value& value, const char *type = "MeshRenderer");
-
-    const JSONMesh* GetMesh() const
-    {
-        return mesh_;
-    }
-
-    bool GetCastShadows() const
-    {
-        return castShadows_;
-    }
-
-    bool GetReceiveShadows() const
-    {
-        return receiveShadows_;
-    }
-
-    unsigned GetNumMaterials() const
-    {
-        return materials_.Size();
-    }
-
-    const JSONMaterial* GetMaterial(unsigned index) const
-    {
-        return materials_.At(index);
-    }
-
-    int GetLightmapIndex() const
-    {
-        return lightmapIndex_;
-    }
-
-    const Vector4& GetLightmapTilingOffset() const
-    {
-        return lightmapTilingOffset_;
-    }
-
-protected:
-
-    JSONMesh* mesh_;
-    bool castShadows_;
-    bool receiveShadows_;
-    int lightmapIndex_;
-    Vector4 lightmapTilingOffset_;
-    PODVector<JSONMaterial*> materials_;
-
-};
-
-class JSONSkinnedMeshRenderer: public JSONMeshRenderer
-{
-public:
-
-    JSONSkinnedMeshRenderer(JSONSceneImporter* importer, const rapidjson::Value& value);
-
-};
-
-class JSONTimeOfDay : public JSONComponent
-{
-public:
-
-    JSONTimeOfDay(JSONSceneImporter* importer, const rapidjson::Value& value);
-
-    float GetTimeOn() const
-    {
-        return timeOn_;
-    }
-
-    void SetTimeOn(float value)
-    {
-        timeOn_ = value;
-    }
-
-    float GetTimeOff() const
-    {
-        return timeOff_;
-    }
-
-    void SetTimeOff(float value)
-    {
-        timeOff_ = value;
-    }
-
-private:
-
-    float timeOn_;
-    float timeOff_;
-
-
-};
-
-
-class JSONLight : public JSONComponent
-{
-public:
-
-    JSONLight(JSONSceneImporter* importer, const rapidjson::Value& value);
-
-    float GetRange() const
-    {
-        return range_;
-    }
-
-    void SetRange(float range)
-    {
-        range_ = range;
-    }
-
-    void SetLightType(const String& lightType)
-    {
-        lightType_ = lightType;
-    }
-
-    const String& GetLightType() const
-    {
-        return lightType_;
-    }
-
-    void SetColor(const Color& color)
-    {
-        color_ = color;
-    }
-
-    const Color& GetColor() const
-    {
-        return color_;
-    }
-
-    void SetCastsShadows(bool castsShadows)
-    {
-        castsShadows_ = castsShadows;
-    }
-
-    bool GetCastsShadows() const
-    {
-        return castsShadows_;
-    }
-
-    void SetRealtime(bool realtime)
-    {
-        realtime_ = realtime;
-    }
-
-    bool GetRealtime() const
-    {
-        return realtime_;
-    }
-
-private:
-
-    String lightType_;
-    float range_;
-    Color color_;
-    bool castsShadows_;
-    bool realtime_;
-};
-
-
-class JSONRigidBody : public JSONComponent
-{
-public:
-
-    JSONRigidBody(JSONSceneImporter* importer, const rapidjson::Value& value);
-
-    float GetMass() const
-    {
-        return mass_;
-    }
-
-    void SetMass(float mass)
-    {
-        mass_ = mass;
-    }
-
-private:
-    float mass_;
-};
-
-class JSONMeshCollider : public JSONComponent
-{
-public:
-
-    JSONMeshCollider(JSONSceneImporter* importer, const rapidjson::Value& value);
-
-};
-
-class JSONBoxCollider : public JSONComponent
-{
-public:
-
-    JSONBoxCollider(JSONSceneImporter* importer, const rapidjson::Value& value);
-
-    const Vector3& GetCenter() const
-    {
-        return center_;
-    }
-
-    const Vector3& GetSize() const
-    {
-        return size_;
-    }
-
-    void SetCenter(const Vector3& center)
-    {
-        center_ = center;
-    }
-
-    void SetSize(const Vector3& size)
-    {
-        size_ = size;
-    }
-
-private:
-    Vector3 center_;
-    Vector3 size_;
-};
-
-class JSONAnimation : public JSONComponent
-{
-public:
-
-    class Keyframe
-    {
-    public:
-        Vector3 pos_;
-        Vector3 scale_;
-        Quaternion rot_;
-        float time_;
-    };
-
-    class AnimationNode
-    {
-    public:
-        String name_;
-        Vector<Keyframe*> keyframes_;
-    };
-
-    class AnimationClip
-    {
-    public:
-        String name_;
-        Vector<AnimationNode*> nodes_;
-
-        float GetDuration() const
-        {
-            float maxTime = -1.0f;
-            for (unsigned i = 0 ; i < nodes_.Size(); i++)
-            {
-                if (nodes_[i]->keyframes_.Size())
-                    if (nodes_[i]->keyframes_.Back()->time_ > maxTime)
-                        maxTime = nodes_[i]->keyframes_.Back()->time_;
-            }
-
-            return maxTime;
-        }
-
-    };
-
-    const Vector<AnimationClip*>& GetClips() const
-    {
-        return clips_;
-    }
-
-    JSONAnimation(JSONSceneImporter* importer, const rapidjson::Value& value);
-
-private:
-
-    Vector<AnimationClip*> clips_;
-
-};
-
-class JSONTerrain: public JSONComponent
-{
-public:
-
-    JSONTerrain(JSONSceneImporter* importer, const rapidjson::Value& value);
-
-    int GetHeightMapWidth() const
-    {
-        return heightmapWidth_;
-    }
-
-    int GetHeightMapHeight() const
-    {
-        return heightmapHeight_;
-    }
-
-    int GetHeightMapResolution() const
-    {
-        return heightmapResolution_;
-    }
-
-    const Vector3& GetHeightMapScale() const
-    {
-        return heightmapScale_;
-    }
-
-    const Vector3& GetHeightMapSize() const
-    {
-        return size_;
-    }
-
-    int GetAlphaMapWidth() const
-    {
-        return alphamapWidth_;
-    }
-
-    int GetAlphaMapHeight() const
-    {
-        return alphamapHeight_;
-    }
-
-    int GetAlphaMapLayers() const
-    {
-        return alphamapLayers_;
-    }
-
-    const float* GetHeightMap(unsigned& length) const
-    {
-        length = heightMapLength_;
-        return heightMap_.Get();
-    }
-
-    const float* GetAlphaMap(unsigned& length) const
-    {
-        length = alphaMapLength_;
-        return alphaMap_.Get();
-    }
-
-private:
-    int heightmapHeight_;
-    int heightmapWidth_;
-    int heightmapResolution_;
-
-    Vector3 heightmapScale_;
-    Vector3 size_;
-
-    int alphamapWidth_;
-    int alphamapHeight_;
-    int alphamapLayers_;
-
-    SharedArrayPtr<float> heightMap_;
-    unsigned heightMapLength_;
-    SharedArrayPtr<float> alphaMap_;
-    unsigned alphaMapLength_;
-
-};
-
-class JSONCamera: public JSONComponent
-{
-public:
-
-    JSONCamera(JSONSceneImporter* importer, const rapidjson::Value& value);
-
-
-private:
-
-};
-
-
-class JSONNode
-{
-public:
-
-    JSONNode(JSONSceneImporter* importer, const rapidjson::Value& value);
-
-    const String& GetName() const
-    {
-        return name_;
-    }
-
-    const PODVector<JSONComponent*>& GetComponents() const
-    {
-        return components_;
-
-    }
-
-    const PODVector<JSONNode*>& GetChildren() const
-    {
-        return children_;
-    }
-
-    void AddChild(JSONNode* child)
-    {
-        children_.Push(child);
-    }
-
-private:
-
-    String name_;
-    JSONSceneImporter* importer_;
-
-    PODVector<JSONComponent*> components_;
-    PODVector<JSONNode*> children_;
-
-};
-
-
-class Importer: public Object
-{
-    OBJECT(Importer);
-
-public:
-
-    Importer(Context* context) : Object(context) {}
-
-private:
-
-};
-
-
-class JSONSceneImporter: public Importer
-{
-    OBJECT(JSONSceneImporter);
-
-public:
-
-    JSONSceneImporter(Context* context);
-
-    bool Import(const String& path);
-
-    void ReadVector2FromArray(const rapidjson::Value& value, Vector2& v);
-    void ReadVector3FromArray(const rapidjson::Value& value, Vector3& v);
-    void ReadVector4FromArray(const rapidjson::Value& value, Vector4& v);
-    void ReadQuaternionFromArray(const rapidjson::Value& value, Quaternion& q);
-    void ReadMatrix4FromArray(const rapidjson::Value& value, Matrix4& m);
-    void ReadColorFromArray(const rapidjson::Value& value, Color& color);
-
-    JSONMesh* GetMesh(const String& name)
-    {
-        for (unsigned i = 0; i < meshes_.Size(); i++)
-        {
-            if (meshes_[i]->GetName() == name)
-                return meshes_[i];
-        }
-
-        return NULL;
-    }
-
-    JSONMaterial* GetMaterial(const String& name)
-    {
-        for (unsigned i = 0; i < materials_.Size(); i++)
-        {
-            if (materials_[i]->GetName() == name)
-                return materials_[i];
-        }
-
-        return NULL;
-    }
-
-    const PODVector<JSONTexture*>& GetTexture()
-    {
-        return textures_;
-    }
-
-    const PODVector<JSONLightmap*>& GetLightmaps()
-    {
-        return lightmaps_;
-    }
-
-    const PODVector<JSONShader*>& GetShaders()
-    {
-        return shaders_;
-    }
-
-    const PODVector<JSONMaterial*>& GetMaterials()
-    {
-        return materials_;
-    }
-
-    const PODVector<JSONTexture*>& GetTextures()
-    {
-        return textures_;
-    }
-
-    const PODVector<JSONNode*>& GetHierarchy() const
-    {
-        return hierarchy_;
-    }
-
-
-    PODVector<JSONMesh*>& GetMeshes()
-    {
-        return meshes_;
-    }
-
-    const String& GetSceneName() const
-    {
-        return sceneName_;
-    }
-
-
-    virtual ~JSONSceneImporter();
-
-private:
-
-    void AddTexture(JSONTexture* texture)
-    {
-        textures_.Push(texture);
-    }
-
-    void AddLightmap(JSONLightmap* lightmap)
-    {
-        lightmaps_.Push(lightmap);
-    }
-
-    void AddShader(JSONShader* shader)
-    {
-        shaders_.Push(shader);
-    }
-
-    void AddMaterial(JSONMaterial* material)
-    {
-        materials_.Push(material);
-    }
-
-    void AddMesh(JSONMesh* mesh)
-    {
-        meshes_.Push(mesh);
-    }
-
-    bool ParseShaders(const rapidjson::Value& value);
-    bool ParseTextures(const rapidjson::Value& value);
-    bool ParseLightmaps(const rapidjson::Value& value);
-    bool ParseMaterials(const rapidjson::Value& value);
-    bool ParseMeshes(const rapidjson::Value& value);
-
-    bool ParseResources(const rapidjson::Value& value);
-
-    bool ParseHierarchy(const rapidjson::Value& value);
-
-    rapidjson::Document* document_;
-
-    String sceneName_;
-
-    PODVector<JSONTexture*> textures_;
-    PODVector<JSONLightmap*> lightmaps_;
-    PODVector<JSONShader*> shaders_;
-    PODVector<JSONMaterial*> materials_;
-    PODVector<JSONMesh*> meshes_;
-
-    PODVector<JSONNode*> hierarchy_;
-
-};
-
-
-
-}

+ 0 - 994
Attic/AtomicEditorReference/Source/Import/AEJSONSceneProcess.cpp

@@ -1,994 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include <stdint.h>
-
-#include "AtomicEditor.h"
-#include <Atomic/Core/ProcessUtils.h>
-#include <Atomic/IO/Log.h>
-
-#include <Atomic/Resource/Image.h>
-
-#include <Atomic/Graphics/IndexBuffer.h>
-#include <Atomic/Graphics/VertexBuffer.h>
-#include <Atomic/Graphics/Geometry.h>
-
-#include <Atomic/Graphics/Octree.h>
-#include <Atomic/Graphics/Zone.h>
-#include <Atomic/Atomic3D/AnimatedModel.h>
-#include <Atomic/Atomic3D/StaticModel.h>
-#include <Atomic/Atomic3D/LMStaticModel.h>
-#include <Atomic/Atomic3D/Terrain.h>
-#include <Atomic/Atomic3D/Animation.h>
-#include <Atomic/Graphics/DebugRenderer.h>
-#include <Atomic/Physics/CollisionShape.h>
-#include <Atomic/Physics/RigidBody.h>
-#include <Atomic/Physics/PhysicsWorld.h>
-#include <Atomic/Environment/TimeOfDay.h>
-
-#include "AEJSONSceneProcess.h"
-#include "AEImportJSON.h"
-
-
-
-static String __rootFolder = "/Users/josh/Dev/atomic/AtomicRuntime/Source/AtomicEditor/Projects/OpenWorld/Resources";
-
-namespace AtomicEditor
-{
-
-bool JSONSceneProcess::ProcessTextures()
-{
-    const PODVector<JSONTexture*>& textures = importer_->GetTextures();
-
-    for (unsigned i = 0; i < textures.Size(); i++)
-    {
-        const JSONTexture* jtexture = textures.At(i);
-
-        unsigned length;
-        const unsigned char* pixels = jtexture->GetPNGPixels(length);
-
-        String filename = __rootFolder + "/Textures/" + jtexture->GetName() + ".png";
-
-        SharedPtr<File> file (new File(context_, filename, FILE_WRITE));
-
-        file->Write(pixels, length);
-
-        file->Close();
-
-    }
-
-    return true;
-}
-
-bool JSONSceneProcess::ProcessLightmaps()
-{
-    const PODVector<JSONLightmap*>& lightmaps = importer_->GetLightmaps();
-
-    for (unsigned i = 0; i < lightmaps.Size(); i++)
-    {
-        const JSONLightmap* jlightmap = lightmaps.At(i);
-
-        unsigned length;
-        const unsigned char* pixels = jlightmap->GetPNGPixels(length);
-
-        String filename = __rootFolder + "/Textures/" + jlightmap->GetName() + ".png";
-
-        SharedPtr<File> file (new File(context_, filename, FILE_WRITE));
-
-        file->Write(pixels, length);
-
-        file->Close();
-
-    }
-
-    return true;
-}
-
-bool JSONSceneProcess::ProcessMaterials()
-{
-    const PODVector<JSONMaterial*>& materials = importer_->GetMaterials();
-
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-
-    for (unsigned i = 0; i < materials.Size(); i++)
-    {
-        const JSONMaterial* jmaterial = materials.At(i);
-
-        const String& shader = jmaterial->GetShader();
-
-        //LOGINFOF("Shader: %s", shader.CString());
-
-        // TODO: factor in lightmaps
-        bool lightmap = false;
-
-        String technique("Diff.xml");
-
-        if (!lightmap)
-        {
-            if (shader == "Transparent/Diffuse")
-                technique = "DiffAlpha.xml";
-            else if (shader == "Transparent/Cutout/Diffuse")
-                technique = "DiffAlphaMask.xml";
-            else if (shader == "Transparent/Cutout/Specular")
-                technique = "DiffAlphaMask.xml";
-            else if (shader == "Transparent/Specular")
-                technique = "DiffAlpha.xml";
-            else if (shader == "Hidden/Nature/Tree Creator Leaves Fast Optimized")
-                technique = "DiffAlphaMask.xml";
-        }
-        else
-        {
-            technique = "DiffLightMap.xml";
-            if (shader == "Transparent/Diffuse")
-                technique = "DiffLightMapAlpha.xml";
-            else if (shader == "Transparent/Cutout/Diffuse")
-                technique = "DiffLightMapAlpha.xml";
-            else if (shader == "Transparent/Cutout/Specular")
-                technique = "DiffLightMapAlpha.xml";
-            else if (shader == "Transparent/Specular")
-                technique = "DiffLightMapAlpha.xml";
-
-        }
-
-        SharedPtr<Material> material;
-        material = new Material(context_);
-
-        material->SetName("Materials/" + jmaterial->GetName() + ".xml");
-
-        Technique* _technique = cache->GetResource<Technique>("Techniques/" + technique);
-        assert(_technique);
-
-        material->SetTechnique(0, _technique);
-
-        const String& mainTexture = jmaterial->GetMainTexture();
-        if (mainTexture.Length())
-        {
-            Texture2D* texture = cache->GetResource<Texture2D>("Textures/" + mainTexture + ".png");
-            material->SetTexture(TU_DIFFUSE, texture);
-        }
-
-        materials_[jmaterial->GetName()] = material;
-
-    }
-
-    return true;
-}
-
-bool JSONSceneProcess::WriteMaterials()
-{
-    String materialFolder("Materials");
-    HashMap<String, SharedPtr<Material> >::Iterator itr = materials_.Begin();
-    while (itr != materials_.End())
-    {
-        Material* material = itr->second_;
-        SharedPtr<File> file;
-        file = new File(context_, __rootFolder + "/" + material->GetName(), FILE_WRITE);
-        material->Save(*file);
-        itr++;
-    }
-
-    return true;
-}
-
-bool JSONSceneProcess::WriteModels()
-{
-    HashMap<String, SharedPtr<Model> >::Iterator itr = models_.Begin();
-    while (itr != models_.End())
-    {
-        Model* model = itr->second_;
-        SharedPtr<File> file;
-        file = new File(context_, __rootFolder + "/" + model->GetName(), FILE_WRITE);
-        model->Save(*file);
-        itr++;
-    }
-
-    return true;
-}
-
-bool JSONSceneProcess::WriteHierarchy(Scene* scene)
-{
-
-
-    List<SharedPtr<Node> >::Iterator itr = hierarchy_.Begin();
-    while (itr != hierarchy_.End())
-    {
-        scene->AddChild(*itr);
-        itr++;
-    }
-
-    File file(context_);
-
-    bool useXML = true;
-
-    String filename;
-
-    filename.AppendWithFormat("%s", importer_->GetSceneName().CString());
-
-    if (!useXML)
-        filename += ".scene";
-    else
-        filename += ".xml";
-
-    filename = __rootFolder + "/Scenes/" + filename;
-
-    if (!file.Open(filename, FILE_WRITE))
-        ErrorExit("Could not open output file: Scenes/Test.bin");
-
-    if (useXML)
-        scene->SaveXML(file);
-    else
-        scene->Save(file);
-
-
-    file.Close();
-
-
-    return true;
-}
-
-
-bool JSONSceneProcess::ProcessModels()
-{
-    PODVector<JSONMesh*>& meshes = importer_->GetMeshes();
-
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-
-    for (unsigned i = 0; i < meshes.Size(); i++)
-    {
-        JSONMesh* jmesh = meshes.At(i);
-
-        SharedPtr<Model> model(new Model(context_));
-
-        model->SetName("Models/" + jmesh->GetName() + ".mdl");
-
-        unsigned vertexElementMask = MASK_POSITION | MASK_NORMAL | MASK_TEXCOORD1;// | MASK_COLOR;
-
-        if (jmesh->GetNumUVSets() == 2)
-            vertexElementMask |= MASK_TEXCOORD2;
-
-        PODVector<JSONMesh::BoneWeight>& boneWeights = jmesh->GetBoneWeights();
-
-        if (boneWeights.Size())
-            vertexElementMask |= (MASK_BLENDWEIGHTS | MASK_BLENDINDICES);
-
-        // the model has to have 65535 or less indices to avoid 32 bit indices, check this
-        SharedPtr<IndexBuffer> ib (new IndexBuffer(context_));
-        SharedPtr<VertexBuffer> vb (new VertexBuffer(context_));
-
-        // even though shadowing, need to "SetData()" on these below
-        // could we SetData with the shadowed data?
-        ib->SetShadowed(true);
-        vb->SetShadowed(true);
-
-        // Setup Vertex Data
-        unsigned vertexCount = jmesh->GetVertexCount();
-
-        vb->SetSize(vertexCount, vertexElementMask);
-
-        BoundingBox bbox;
-
-        PODVector<Vector3>& vpos =  jmesh->GetVertexPositions();
-        PODVector<Vector3>& vnorm = jmesh->GetVertexNormals();
-        PODVector<Vector4>& vtan = jmesh->GetVertexTangents();
-        PODVector<Vector2>& uv0 = jmesh->GetUVSet(0);
-        PODVector<Vector2>& uv1 = jmesh->GetUVSet(1);
-
-        PODVector<float> vdata;
-
-        unsigned vertexSize = 8;
-        if (vertexElementMask & MASK_TEXCOORD2)
-            vertexSize += 2;
-
-        if (vertexElementMask & MASK_BLENDWEIGHTS)
-            vertexSize += 5;
-
-        vdata.Resize(vertexCount * vertexSize);
-
-        // TODO: we should be identifying unique vertices
-        float* v = &vdata[0];
-
-        for (unsigned j = 0; j < vertexCount; j++)
-        {
-            if (j < vpos.Size())
-            {
-                *v = vpos[j].x_; v++;
-                *v = vpos[j].y_; v++;
-                *v = vpos[j].z_; v++;
-            }
-            else
-            {
-                *v = 0; v++;
-                *v = 0; v++;
-                *v = 0; v++;
-            }
-
-            if (j < vnorm.Size())
-            {
-                *v = vnorm[j].x_; v++;
-                *v = vnorm[j].y_; v++;
-                *v = vnorm[j].z_; v++;
-            }
-            else
-            {
-                *v = 0; v++;
-                *v = 0; v++;
-                *v = 0; v++;
-            }
-
-            if (j < uv0.Size())
-            {
-                *v = uv0[j].x_; v++;
-                *v = -uv0[j].y_; v++;
-            }
-            else
-            {
-                *v = 0; v++;
-                *v = 0; v++;
-            }
-
-            if (vertexElementMask &  MASK_TEXCOORD2)
-            {
-                if (j < uv1.Size())
-                {
-                    *v = uv1[j].x_; v++;
-                    *v = -uv1[j].y_; v++;
-                }
-                else
-                {
-                    *v = 0; v++;
-                    *v = 0; v++;
-                }
-            }
-
-            if (vertexElementMask & MASK_BLENDWEIGHTS)
-            {
-                JSONMesh::BoneWeight& boneWeight = boneWeights[j];
-
-                for (unsigned k = 0; k < 4; ++k)
-                {
-                    *v = boneWeight.weights_[k]; v++;
-                }
-            }
-            if (vertexElementMask & MASK_BLENDINDICES)
-            {
-                JSONMesh::BoneWeight& boneWeight = boneWeights[j];
-
-                unsigned char* destBytes = (unsigned char*)v;
-                ++v;
-                for (unsigned k = 0; k < 4; ++k)
-                {
-                    *destBytes++ = (unsigned char) boneWeight.indexes_[k];
-                }
-            }
-
-
-            bbox.Merge(vpos[j]);
-
-        }
-
-        vb->SetData(&vdata[0]);
-
-        unsigned numIndices = 0;
-        PODVector<uint16_t> allIndices;
-
-        unsigned numGeom = jmesh->GetSubMeshCount();
-        for (unsigned j = 0; j < numGeom; j++)
-        {
-            PODVector<int>& submesh = jmesh->GetSubMesh(j);
-
-            numIndices += submesh.Size();
-
-            for (unsigned k = 0; k < submesh.Size(); k++)
-            {
-                allIndices.Push((uint16_t) submesh[k]);
-            }
-        }
-
-        ib->SetSize(numIndices, false);
-
-        ib->SetData(&allIndices[0]);
-
-        Vector<SharedPtr<Geometry> > geometry;
-
-        uint16_t start = 0;
-        for (unsigned j = 0; j < numGeom; j++)
-        {
-            PODVector<int>& submesh = jmesh->GetSubMesh(j);
-
-            SharedPtr<Geometry> geom(new Geometry(context_));
-            geometry.Push(geom);
-
-            geom->SetIndexBuffer(ib);
-            geom->SetVertexBuffer(0, vb, vertexElementMask);
-            geom->SetDrawRange(TRIANGLE_LIST, start, submesh.Size(), false);
-
-            start += submesh.Size();
-        }
-
-        model->SetNumGeometries(geometry.Size());
-
-        Vector<SharedPtr<VertexBuffer> > vbVector;
-        Vector<SharedPtr<IndexBuffer> > ibVector;
-
-        vbVector.Push(vb);
-        ibVector.Push(ib);
-
-        PODVector<unsigned> emptyMorphRange;
-        model->SetVertexBuffers(vbVector, emptyMorphRange, emptyMorphRange);
-        model->SetIndexBuffers(ibVector);
-
-        Vector<JSONMesh::Bone>& jbones = jmesh->GetBones();
-
-        // FIXME: we need to get the bounds or calculate propoer
-        if (jbones.Size())
-        {
-            bbox.min_ *= 2;
-            bbox.max_ *= 2;
-
-        }
-
-        // see fixme's for skeletal geo center/bounds
-        for (unsigned j = 0; j < geometry.Size(); j++)
-        {
-            model->SetNumGeometryLodLevels(j, 1);
-            model->SetGeometry(j, 0, geometry[j]);
-            // this could be finer grained
-            // also, fix this for skeletal
-            model->SetGeometryCenter(j, jbones.Size() ? Vector3::ZERO : bbox.Center());//Vector3::ZERO);
-        }
-
-        // FIXME: skeletal bounds is off
-        if (!jbones.Size())
-            model->SetBoundingBox(bbox);
-        else
-            model->SetBoundingBox(BoundingBox(-1024, 1024));
-
-        // Build skeleton if necessary
-        if (jbones.Size())
-        {
-            Skeleton skeleton;
-            Vector<Bone>& bones = skeleton.GetModifiableBones();
-
-            unsigned rootindex = 0;
-
-            const String& rootBoneName = jmesh->GetRootBone();
-
-            for (unsigned j = 0; j < jbones.Size(); ++j)
-            {
-                JSONMesh::Bone& jbone = jbones[j];
-
-                if (jbone.name_ == rootBoneName)
-                {
-                    rootindex = j;
-                    break;
-                }
-
-            }
-
-            for (unsigned j = 0; j < jbones.Size(); ++j)
-            {
-                JSONMesh::Bone& jbone = jbones[j];
-
-                String boneName(jbone.name_);
-
-                Bone newBone;
-                newBone.name_ = boneName;
-                newBone.initialPosition_ = jbone.pos_;
-                newBone.initialRotation_ = jbone.rot_;
-                newBone.initialScale_ = jbone.scale_;
-
-                // Get offset information if exists
-                newBone.offsetMatrix_ = Matrix3x4(jmesh->GetBindPoses()[j]);
-                //newBone.radius_ = model.boneRadii_[i];
-                //newBone.boundingBox_ = model.boneHitboxes_[i];
-                //newBone.collisionMask_ = BONECOLLISION_SPHERE | BONECOLLISION_BOX;
-                newBone.parentIndex_ = j;
-                bones.Push(newBone);
-            }
-
-            // Set the bone hierarchy
-            for (unsigned j = 0; j < jbones.Size(); ++j)
-            {
-                JSONMesh::Bone& jbone = jbones[j];
-
-                String parentName = jbone.parentName_;
-
-                if (!parentName.Length())
-                {
-                    bones[j].parentIndex_ = j;
-                }
-                else
-                {
-                    for (unsigned k = 0; k < bones.Size(); ++k)
-                    {
-                        if (bones[k].name_ == parentName)
-                        {
-                            bones[j].parentIndex_ = k;
-                            break;
-                        }
-                    }
-
-                }
-
-            }
-
-            skeleton.SetRootBoneIndex(rootindex);
-
-            model->SetSkeleton(skeleton);
-        }
-
-        models_[jmesh->GetName()] = model;
-
-    }
-
-    return true;
-}
-
-bool JSONSceneProcess::ProcessComponent(Node* node, const JSONTransform* jtransform)
-{
-    node->SetPosition(jtransform->GetLocalPosition());
-    node->SetRotation(jtransform->GetLocalRotation());
-    node->SetScale(jtransform->GetLocalScale());
-
-    return true;
-}
-
-bool JSONSceneProcess::ProcessComponent(Node* node, const JSONTimeOfDay* jtime )
-{
-    TimeOfDay* timeofday = node->CreateComponent<TimeOfDay>();
-    timeofday->SetTimeOn(jtime->GetTimeOn());
-    timeofday->SetTimeOff(jtime->GetTimeOff());
-    return true;
-}
-
-
-bool JSONSceneProcess::ProcessComponent(Node* node, const JSONLight* jlight )
-{
-    if (!jlight->GetRealtime() || jlight->GetLightType() != "Point")
-        return true;
-
-    Light* light = node->CreateComponent<Light>();
-    light->SetRange(jlight->GetRange());
-    light->SetCastShadows(jlight->GetCastsShadows());
-    light->SetColor(jlight->GetColor());
-    light->SetLightType(LIGHT_POINT);
-
-    return true;
-}
-
-bool JSONSceneProcess::ProcessComponent(Node* node, const JSONBoxCollider* jbox )
-{
-    CollisionShape* shape = node->CreateComponent<CollisionShape>();
-    shape->SetBox(jbox->GetSize(), jbox->GetCenter());
-    return true;
-}
-
-bool JSONSceneProcess::ProcessComponent(Node* node, const JSONMeshCollider* jmesh )
-{
-    // JSONMeshCollider should store the mesh, as this may not be on node
-    CollisionShape* shape = node->CreateComponent<CollisionShape>();
-    StaticModel* model = node->GetComponent<StaticModel>();
-
-    if (!model || !model->GetModel())
-    {
-        LOGWARNING("Missing model for MeshCollier");
-        return true;
-    }
-
-    assert(model && model->GetModel());
-    if (model)
-        shape->SetTriangleMesh(model->GetModel());
-    return true;
-}
-
-bool JSONSceneProcess::ProcessComponent(Node* node, const JSONRigidBody* jbody )
-{
-    RigidBody* body = node->CreateComponent<RigidBody>();
-    body->SetMass(jbody->GetMass());
-    return true;
-}
-
-
-bool JSONSceneProcess::ProcessComponent(Node* node, const JSONTerrain* jterrain)
-{
-    int heightmapHeight = jterrain->GetHeightMapHeight();
-    int heightmapWidth = jterrain->GetHeightMapWidth();
-    unsigned length;
-    const float* heightmap = jterrain->GetHeightMap(length);
-
-    const Vector3 heightmapScale = jterrain->GetHeightMapScale();
-    const Vector3 heightmapSize = jterrain->GetHeightMapSize();
-
-    PODVector<uint8_t> bytes;
-
-    bytes.Resize(heightmapHeight * heightmapWidth * 4);
-
-    uint8_t* out = &bytes[0];
-
-    for (int y = 0; y < heightmapHeight; y++)
-    {
-        for (int x = 0; x < heightmapWidth; x++)
-        {
-            float h = heightmap[y * heightmapWidth + x];
-            uint8_t hbyte = uint8_t(255.0 * h);
-            *out++ = hbyte;
-            *out++ = hbyte;
-            *out++ = hbyte;
-            *out++ = 255;
-        }
-    }
-
-    SharedPtr<Image> image(new Image(context_));
-
-    image->SetSize(heightmapWidth, heightmapHeight, 4);
-    image->SetData(&bytes[0]);
-
-    String heightMapPath = __rootFolder + "/Textures/TerrainHeightMap.png";
-    image->SavePNG(heightMapPath);
-
-    int alphamapWidth = jterrain->GetAlphaMapHeight();
-    int alphamapHeight = jterrain->GetAlphaMapWidth();
-    int alphamapLayers = jterrain->GetAlphaMapLayers();
-
-    if (alphamapLayers > 3)
-        alphamapLayers = 3;
-
-    const float* alphamap = jterrain->GetAlphaMap(length);
-
-    bytes.Resize( alphamapWidth * alphamapWidth * 4);
-
-    memset (&bytes[0], 255, alphamapWidth * alphamapWidth * 4);
-
-    for (int i = 0; i < alphamapLayers; i++)
-    {
-        uint8_t* out = &bytes[i];
-
-        for (int y = 0; y < alphamapHeight; y++)
-        {
-            for (int x = 0; x < alphamapWidth; x++)
-            {
-                float w = alphamap[(i * (alphamapWidth * alphamapHeight)) + y * alphamapWidth + x ];
-                uint8_t wbyte = uint8_t(255.0 * w);
-                *out = wbyte;
-                out += 4;
-            }
-        }
-    }
-
-    SharedPtr<Image> alphaWeights(new Image(context_));
-
-    alphaWeights->SetSize(alphamapWidth, alphamapHeight, 4);
-    alphaWeights->SetData(&bytes[0]);
-
-    String alphaWeightsPath = __rootFolder + "/Textures/TerrainWeights.png";
-    alphaWeights->SavePNG(alphaWeightsPath);
-
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    Image* heightMap = cache->GetResource<Image>(heightMapPath);
-
-    Material* material = cache->GetResource<Material>("Materials/DemoTerrain.xml");
-
-    Terrain* terrain = node->CreateComponent<Terrain>();
-
-    terrain->SetHeightMap(heightMap);
-    terrain->SetMaterial(material);
-    terrain->SetSmoothing(true);
-
-    //terrain->SetPatchSize(64);
-    //terrain->SetSpacing(Vector3(2.0f, 0.5f, 2.0f)); // Spacing between vertices and vertical resolution of the height map
-    //terrain->SetSmoothing(true);
-
-    Vector3 spacing = heightmapScale;
-
-    spacing.y_ = heightmapScale.y_ / 250.0f;
-
-    terrain->SetSpacing(spacing);
-
-    Vector3 pos = node->GetPosition();
-    pos.x_ += heightmapSize.x_/2.0f;
-    pos.y_  += .1f;
-    pos.z_ += heightmapSize.z_/2.0f;
-
-    node->SetPosition(pos);
-
-    Quaternion rotation;
-    rotation = node->GetRotation();
-
-    rotation.FromEulerAngles(0, -90, 0);
-
-    node->SetRotation(rotation);
-
-    RigidBody* body = node->CreateComponent<RigidBody>();
-    // use layer 2 for static
-    body->SetCollisionLayer(2);
-    body->SetFriction(1.0f);
-    CollisionShape* shape = node->CreateComponent<CollisionShape>();
-    shape->SetTerrain();
-
-    return true;
-}
-
-bool JSONSceneProcess::ProcessComponent(Node* node, const JSONAnimation* janim )
-{
-    const Vector<JSONAnimation::AnimationClip*>& clips =  janim->GetClips();
-
-    for (unsigned i = 0; i < clips.Size(); i++)
-    {
-        const JSONAnimation::AnimationClip* clip = clips[i];
-
-        SharedPtr<Animation> outAnim(new Animation(context_));
-        outAnim->SetAnimationName(clip->name_);
-        outAnim->SetLength(clip->GetDuration());
-
-        Vector<AnimationTrack> tracks;
-
-        for (unsigned j = 0; j < clip->nodes_.Size(); ++j)
-        {
-            const JSONAnimation::AnimationNode* node = clip->nodes_[j];
-
-            String channelName = node->name_;
-
-            if (channelName.Contains('/'))
-            {
-                channelName = channelName.Split('/').Back();
-            }
-
-            AnimationTrack track;
-            track.name_ = channelName;
-            track.nameHash_ = channelName;
-            // TODO: optimize channels
-            track.channelMask_ |= (CHANNEL_POSITION | CHANNEL_ROTATION | CHANNEL_SCALE);
-
-            //assert(node->keyframes_.Size());
-
-            for (unsigned k = 0; k < node->keyframes_.Size(); k++)
-            {
-                const JSONAnimation::Keyframe* keyframe = node->keyframes_[k];
-
-                AnimationKeyFrame key;
-
-                key.time_ = keyframe->time_;
-                key.position_ = keyframe->pos_;
-                key.rotation_ = keyframe->rot_;
-                key.scale_ = keyframe->scale_;
-
-                track.keyFrames_.Push(key);
-
-            }
-
-            tracks.Push(track);
-
-        }
-
-        outAnim->SetTracks(tracks);
-
-        String filename = __rootFolder;
-
-        filename.AppendWithFormat("/Models/AS_FatZombie_FBX_FatZombie_LOD0_%s.ani", clip->name_.CString());
-
-        File outFile(context_);
-        if (!outFile.Open(filename, FILE_WRITE))
-            ErrorExit("Could not open output file for animation");
-        outAnim->Save(outFile);
-
-
-    }
-
-
-    return true;
-
-
-}
-
-bool JSONSceneProcess::ProcessComponent(Node* node, const JSONMeshRenderer* jmeshrenderer )
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-
-    StaticModel* staticModel = NULL;
-    int lightmapIndex = jmeshrenderer->GetLightmapIndex();
-
-    if (lightmapIndex >= 0)
-    {
-        LMStaticModel* lmstatic = node->CreateComponent<LMStaticModel>();
-        staticModel = lmstatic;
-
-        const Vector4& tilingOffset = jmeshrenderer->GetLightmapTilingOffset();
-        lmstatic->lightmapTilingOffset_ = tilingOffset;
-
-        lmstatic->lightmapTilingOffset_.w_ = -lmstatic->lightmapTilingOffset_.w_;
-
-        String lightmapName;
-
-        lightmapName.AppendWithFormat("Textures/%s_Lightmap_%i.png", importer_->GetSceneName().CString(), lightmapIndex);
-
-        Texture2D* texture = cache->GetResource<Texture2D>(lightmapName);
-        assert(texture);
-        lmstatic->SetLightmapTexure(texture);
-    }
-    else
-        staticModel = node->CreateComponent<StaticModel>();
-
-    const JSONMesh* mesh = jmeshrenderer->GetMesh();
-
-    assert(models_.Contains(mesh->GetName()));
-
-    Model* model = models_[mesh->GetName()];
-
-    staticModel->SetModel(model);
-
-    for (unsigned i = 0; i < jmeshrenderer->GetNumMaterials(); i++)
-    {
-        const JSONMaterial* jmat = jmeshrenderer->GetMaterial(i);
-
-        assert(materials_.Contains(jmat->GetName()));
-
-        staticModel->SetMaterial(i, materials_[jmat->GetName()]);
-
-    }
-
-    staticModel->SetCastShadows(jmeshrenderer->GetCastShadows());
-
-    /*
-    CollisionShape* shape = node->CreateComponent<CollisionShape>();
-    shape->SetTriangleMesh(model, 0);
-    node->CreateComponent<RigidBody>();
-    */
-
-    BoundingBox bbox = model->GetBoundingBox();
-    bbox.Transform(node->GetWorldTransform());
-
-    Vector3 size = bbox.Size();
-    //staticModel->SetDrawDistance(size.Length() * 30.0f);
-    //staticModel->SetShadowDistance(size.Length() * 10.0f);
-
-    return true;
-}
-
-bool JSONSceneProcess::ProcessComponent(Node* node, const JSONSkinnedMeshRenderer* jmeshrenderer )
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-
-    AnimatedModel* animatedModel =  node->CreateComponent<AnimatedModel>();
-
-    const JSONMesh* mesh = jmeshrenderer->GetMesh();
-
-    assert(models_.Contains(mesh->GetName()));
-
-    Model* model = models_[mesh->GetName()];
-
-    animatedModel->SetModel(model);
-
-    for (unsigned i = 0; i < jmeshrenderer->GetNumMaterials(); i++)
-    {
-        const JSONMaterial* jmat = jmeshrenderer->GetMaterial(i);
-
-        assert(materials_.Contains(jmat->GetName()));
-
-        animatedModel->SetMaterial(i, materials_[jmat->GetName()]);
-
-    }
-
-    animatedModel->SetCastShadows(jmeshrenderer->GetCastShadows());
-
-    return true;
-}
-
-Node* JSONSceneProcess::ProcessNode(const JSONNode* jnode, Node* parent)
-{
-    Node* node = parent->CreateChild(jnode->GetName());
-
-    const PODVector<JSONComponent*>& components = jnode->GetComponents();
-
-    for (unsigned i = 0; i < components.Size(); i++)
-    {
-        const JSONComponent* c = components.At(i);
-
-        if (c->GetType() == "Transform")
-        {
-            ProcessComponent(node, (const JSONTransform*) c);
-        }
-        else if (c->GetType() == "MeshRenderer")
-        {
-            ProcessComponent(node, (const JSONMeshRenderer*) c);
-        }
-        else if (c->GetType() == "SkinnedMeshRenderer")
-        {
-            ProcessComponent(node, (const JSONSkinnedMeshRenderer*) c);
-        }
-        else if (c->GetType() == "Terrain")
-        {
-            ProcessComponent(node, (const JSONTerrain*) c);
-        }
-        else if (c->GetType() == "Animation")
-        {
-            ProcessComponent(node, (const JSONAnimation*) c);
-        }
-        else if (c->GetType() == "BoxCollider")
-        {
-            ProcessComponent(node, (const JSONBoxCollider*) c);
-        }
-        else if (c->GetType() == "MeshCollider")
-        {
-            ProcessComponent(node, (const JSONMeshCollider*) c);
-        }
-        else if (c->GetType() == "RigidBody")
-        {
-            ProcessComponent(node, (const JSONRigidBody*) c);
-        }
-        else if (c->GetType() == "Light")
-        {
-            ProcessComponent(node, (const JSONLight*) c);
-        }
-        else if (c->GetType() == "TimeOfDay")
-        {
-            ProcessComponent(node, (const JSONTimeOfDay*) c);
-        }
-    }
-
-    if (node->GetComponent<CollisionShape>() && !node->GetComponent<RigidBody>())
-    {
-        RigidBody* body = node->CreateComponent<RigidBody>();
-        body->SetCollisionLayer(2);
-
-    }
-
-    const PODVector<JSONNode*>& children = jnode->GetChildren();
-
-    for (unsigned i = 0; i < children.Size(); i++)
-    {
-        node->AddChild(ProcessNode(children.At(i), node));
-    }
-
-    return node;
-}
-
-bool JSONSceneProcess::ProcessHierarchy(Scene* scene)
-{
-    const PODVector<JSONNode*>& hierarchy = importer_->GetHierarchy();
-
-    for (unsigned i = 0; i < hierarchy.Size(); i++)
-    {
-        hierarchy_.Push(SharedPtr<Node>(ProcessNode(hierarchy[i], scene)));
-    }
-
-    return true;
-}
-
-bool JSONSceneProcess::Process()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    cache->AddResourceDir(__rootFolder);
-    scene_ = new Scene(context_);
-    scene_->CreateComponent<PhysicsWorld>();
-    scene_->CreateComponent<Octree>();
-    scene_->CreateComponent<DebugRenderer>();
-
-    Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
-    zone->SetBoundingBox(BoundingBox(-10000.0f, 10000.f));
-    zone->SetAmbientColor(Color(1, 1, 1));
-
-    ProcessTextures();
-    ProcessLightmaps();
-    ProcessMaterials();
-    ProcessModels();
-    ProcessHierarchy(scene_);
-
-    return true;
-}
-
-bool JSONSceneProcess::Write()
-{
-
-    WriteMaterials();
-    WriteModels();
-    WriteHierarchy(scene_);
-
-    return true;
-}
-
-
-}
-
-

+ 0 - 86
Attic/AtomicEditorReference/Source/Import/AEJSONSceneProcess.h

@@ -1,86 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <Atomic/Container/HashMap.h>
-#include <Atomic/Container/List.h>
-
-
-#include <Atomic/Resource/ResourceCache.h>
-#include <Atomic/Graphics/Technique.h>
-#include <Atomic/Graphics/Texture2D.h>
-#include <Atomic/Graphics/Material.h>
-#include <Atomic/Atomic3D/Model.h>
-#include <Atomic/Scene/Scene.h>
-
-using namespace Atomic;
-
-namespace AtomicEditor
-{
-
-class JSONSceneImporter;
-class JSONNode;
-class JSONTransform;
-class JSONMeshRenderer;
-class JSONSkinnedMeshRenderer;
-class JSONAnimation;
-class JSONTerrain;
-class JSONBoxCollider;
-class JSONMeshCollider;
-class JSONRigidBody;
-class JSONLight;
-class JSONTimeOfDay;
-
-class JSONSceneProcess : public Object
-{
-
-    OBJECT(JSONSceneProcess);
-
-public:
-
-    JSONSceneProcess(Context* context, JSONSceneImporter* importer) : Object(context)
-    {
-        importer_ = importer;
-    }
-
-    bool Process();
-    bool Write();
-
-private:
-
-    HashMap<String, SharedPtr<Material> > materials_;
-    HashMap<String, SharedPtr<Model> > models_;
-
-    SharedPtr<Scene> scene_ ;
-    List<SharedPtr<Node> > hierarchy_;
-
-    bool WriteMaterials();
-    bool WriteModels();
-    bool WriteHierarchy(Scene *scene);
-
-    bool ProcessTextures();
-    bool ProcessLightmaps();
-    bool ProcessMaterials();
-    bool ProcessModels();
-
-    bool ProcessComponent(Node* node, const JSONTransform* jtransform );
-    bool ProcessComponent(Node* node, const JSONMeshRenderer* jmeshrenderer );
-    bool ProcessComponent(Node* node, const JSONSkinnedMeshRenderer* jmeshrenderer );
-    bool ProcessComponent(Node* node, const JSONAnimation* janim );
-    bool ProcessComponent(Node* node, const JSONTerrain* jterrain );
-    bool ProcessComponent(Node* node, const JSONBoxCollider* jbox );
-    bool ProcessComponent(Node* node, const JSONMeshCollider* jmesh );
-    bool ProcessComponent(Node* node, const JSONLight* jlight );
-    bool ProcessComponent(Node* node, const JSONRigidBody* jbody );
-    bool ProcessComponent(Node* node, const JSONTimeOfDay* jtime );
-    Node* ProcessNode(const JSONNode* jnode, Node *parent);
-
-    bool ProcessHierarchy(Scene *scene);
-
-    SharedPtr<JSONSceneImporter> importer_;
-
-};
-
-}

+ 0 - 961
Attic/AtomicEditorReference/Source/Javascript/JSAST.cpp

@@ -1,961 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-
-#include <rapidjson/document.h>
-#include <rapidjson/stringbuffer.h>
-#include <rapidjson/prettywriter.h>
-
-#include <Atomic/IO/Log.h>
-#include "JSAST.h"
-#include "JSASTVisitor.h"
-
-using namespace rapidjson;
-
-namespace AtomicEditor
-{
-
-JSASTNode::JSASTNode(JSASTType type) : type_(type), rangeStart_(0), rangeEnd_(0)
-{
-
-}
-
-bool JSASTNode::Parse(const rapidjson::Value& value)
-{
-    assert(value.IsObject());
-
-    for (Value::ConstMemberIterator itr = value.MemberBegin();
-         itr != value.MemberEnd(); ++itr)
-    {
-        String name = itr->name.GetString();
-
-        if (name == "loc")
-        {
-            ParseLoc(itr->value);
-        }
-        else if (name == "type")
-        {
-            // TODO: Verify type
-        }
-        else if (name == "range")
-        {
-            ParseRange(itr->value);
-        }
-
-    }
-
-    return true;
-
-}
-
-bool JSASTNode::ParseLoc(const rapidjson::Value& value)
-{
-    // SpiderMonkey can have this for loc :/
-    if (value.IsNull())
-        return true;
-
-    assert(value.IsObject());
-
-    const Value::Member* mstart = value.FindMember("start");
-    assert(mstart);
-
-    const Value::Member* mend = value.FindMember("end");
-    assert(mend);
-
-    loc_.startLine_ = mstart->value["line"].GetInt();
-    loc_.startColumn_ = mstart->value["column"].GetInt();
-    loc_.endLine_ = mend->value["line"].GetInt();
-    loc_.endColumn_ = mend->value["column"].GetInt();
-
-    return true;
-}
-
-bool JSASTNode::ParseRange(const rapidjson::Value& value)
-{
-    assert(value.IsArray() && value.Size() == 2);
-
-    rangeStart_ = value[SizeType(0)].GetInt();
-    rangeEnd_ = value[SizeType(1)].GetInt();
-
-    return true;
-
-}
-
-JSASTStatement* JSASTNode::ParseStatement(const rapidjson::Value &value)
-{
-    assert(value.IsObject());
-
-    JSASTStatement* statement = NULL;
-
-    const Value::Member* mtype = value.FindMember("type");
-    assert(mtype);
-
-    String type = mtype->value.GetString();
-
-    if (type == "ExpressionStatement")
-    {
-        statement = new JSASTExpressionStatement();
-    }
-    else if (type == "VariableDeclaration")
-    {
-        statement = new JSASTVariableDeclaration();
-    }
-    else if (type == "ReturnStatement")
-    {
-        statement = new JSASTReturnStatement();
-    }
-    else if (type == "FunctionDeclaration")
-    {
-        statement = new JSASTFunctionDeclaration();
-    }
-    else if (type == "IfStatement")
-    {
-        statement = new JSASTIfStatement();
-    }
-    else if (type == "BlockStatement")
-    {
-        statement = new JSASTBlockStatement();
-    }
-    else if (type == "EmptyStatement")
-    {
-        statement = new JSASTBlockStatement();
-    }
-    else if (type == "ForStatement")
-    {
-        statement = new JSASTForStatement();
-    }
-    else if (type == "LabeledStatement")
-    {
-        statement = new JSASTLabeledStatement();
-    }
-
-    if (!statement)
-    {
-        LOGWARNINGF("Unknown JSASTStatement: %s", type.CString());
-    }
-    else
-    {
-        statement->Parse(value);
-    }
-
-    return statement;
-
-}
-
-JSASTExpression* JSASTNode::ParseExpression(const rapidjson::Value &value, JSASTType astType)
-{
-    if (!value.IsObject())
-        return NULL;
-
-    JSASTExpression* expr = NULL;
-
-    const Value::Member* mtype = value.FindMember("type");
-    assert(mtype);
-
-    String type = mtype->value.GetString();
-    if (type == "Identifier" && (astType == JSAST_UNDEFINED || astType == JSAST_IDENTIFIER))
-    {
-        expr = new JSASTIdentifier();
-    }
-    else if (type == "Literal" && (astType == JSAST_UNDEFINED || astType == JSAST_LITERAL))
-    {
-        expr = new JSASTLiteral();
-    }
-    else if (type == "UnaryExpression" && (astType == JSAST_UNDEFINED || astType == JSAST_UNARYEXPRESSION))
-    {
-        expr = new JSASTUnaryExpression();
-    }
-    else if (type == "UpdateExpression" && (astType == JSAST_UNDEFINED || astType == JSAST_UPDATEEXPRESSION))
-    {
-        expr = new JSASTUpdateExpression();
-    }
-    else if (type == "NewExpression" && (astType == JSAST_UNDEFINED || astType == JSAST_NEWEXPRESSION))
-    {
-        expr = new JSASTNewExpression();
-    }
-    else if (type == "FunctionExpression" && (astType == JSAST_UNDEFINED || astType == JSAST_FUNCTIONEXPRESSION))
-    {
-        expr = new JSASTFunctionExpression();
-    }
-    else if (type == "BinaryExpression" && (astType == JSAST_UNDEFINED || astType == JSAST_BINARYEXPRESSION))
-    {
-        expr = new JSASTBinaryExpression();
-    }
-    else if (type == "AssignmentExpression" && (astType == JSAST_UNDEFINED || astType == JSAST_ASSIGNMENTEXPRESSION))
-    {
-        expr = new JSASTAssignmentExpression();
-    }
-    else if (type == "LogicalExpression" && (astType == JSAST_UNDEFINED || astType == JSAST_LOGICALEXPRESSION))
-    {
-        expr = new JSASTAssignmentExpression();
-    }
-    else if (type == "CallExpression" && (astType == JSAST_UNDEFINED || astType == JSAST_CALLEXPRESSION))
-    {
-        expr = new JSASTCallExpression();
-    }
-    else if (type == "VariableDeclarator" && (astType == JSAST_UNDEFINED || astType == JSAST_VARIABLEDECLARATOR))
-    {
-        expr = new JSASTVariableDeclarator();
-    }
-    else if (type == "MemberExpression" && (astType == JSAST_UNDEFINED || astType == JSAST_MEMBEREXPRESSION))
-    {
-        expr = new JSASTMemberExpression();
-    }
-    else if (type == "ArrayExpression" && (astType == JSAST_UNDEFINED || astType == JSAST_ARRAYEXPRESSION))
-    {
-        expr = new JSASTArrayExpression();
-    }
-    else if (type == "ObjectExpression" && (astType == JSAST_UNDEFINED || astType == JSAST_OBJECTEXPRESSION))
-    {
-        expr = new JSASTObjectExpression();
-    }
-    else if (type == "ConditionalExpression" && (astType == JSAST_UNDEFINED || astType == JSAST_CONDITIONALEXPRESSION))
-    {
-        expr = new JSASTConditionalExpression();
-    }
-    else if (type == "ThisExpression" && (astType == JSAST_UNDEFINED || astType == JSAST_THISEXPRESSION))
-    {
-        expr = new JSASTThisExpression();
-    }
-
-    if (!expr)
-    {
-        LOGWARNINGF("Unknown JSASTExpression: %s", type.CString());
-    }
-    else
-    {
-        expr->Parse(value);
-    }
-
-    return expr;
-
-}
-
-bool JSASTNode::ParseExpressionArray(const rapidjson::Value &value, Vector<JSASTExpression *> &expressions)
-{
-
-    assert(value.IsArray());
-
-    for (Value::ConstValueIterator itr = value.Begin(); itr != value.End(); itr++)
-    {
-        JSASTExpression* expr = ParseExpression(*itr);
-        //assert(expr);
-        expressions.Push(expr);
-
-    }
-
-    return true;
-}
-
-
-bool JSASTNode::ParseStatementArray(const rapidjson::Value &value, Vector<JSASTStatement *> &statements)
-{
-
-    assert(value.IsArray());
-
-    for (Value::ConstValueIterator itr = value.Begin(); itr != value.End(); itr++)
-    {
-        JSASTStatement* stmt = ParseStatement(*itr);
-        //assert(stmt);
-        statements.Push(stmt);
-
-    }
-
-    return true;
-}
-
-bool JSASTThisExpression::Parse(const rapidjson::Value& value)
-{
-    JSASTExpression::Parse(value);
-
-    return true;
-}
-
-void JSASTThisExpression::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-
-bool JSASTIdentifier::Parse(const rapidjson::Value& value)
-{
-    JSASTExpression::Parse(value);
-
-    if (value.FindMember("name"))
-        name_ = value["name"].GetString();
-    return true;
-}
-
-void JSASTIdentifier::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-
-bool JSASTAssignmentExpression::Parse(const rapidjson::Value& value)
-{
-    JSASTExpression::Parse(value);
-
-    operator_ = value["operator"].GetString();
-
-    leftExpression_ = ParseExpression(value["left"]);
-    rightExpression_ = ParseExpression(value["right"]);
-
-    return true;
-}
-
-void JSASTAssignmentExpression::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-bool JSASTLogicalExpression::Parse(const rapidjson::Value& value)
-{
-    JSASTExpression::Parse(value);
-
-    operator_ = value["operator"].GetString();
-
-    leftExpression_ = ParseExpression(value["left"]);
-    rightExpression_ = ParseExpression(value["right"]);
-
-    return true;
-}
-
-void JSASTLogicalExpression::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-
-
-bool JSASTBinaryExpression::Parse(const rapidjson::Value& value)
-{
-    JSASTExpression::Parse(value);
-
-    operator_ = value["operator"].GetString();
-
-    leftExpression_ = ParseExpression(value["left"]);
-    rightExpression_ = ParseExpression(value["right"]);
-
-    return true;
-}
-
-void JSASTBinaryExpression::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-
-bool JSASTLiteral::Parse(const rapidjson::Value& value)
-{
-    JSASTExpression::Parse(value);
-
-    if (!value.FindMember("value") || !value.FindMember("raw"))
-    {
-        literalType_ = LITERAL_UNKNOWN;
-        return false;
-    }
-
-    const rapidjson::Value& v = value["value"];
-
-    raw_ = value["raw"].GetString();;
-
-    if (v.IsNull())
-        literalType_ = LITERAL_NULL;
-    else if (v.IsString())
-        literalType_ = LITERAL_STRING;
-    else if (v.IsNumber())
-        literalType_ = LITERAL_NUMBER;
-    else if (v.IsBool())
-        literalType_ = LITERAL_BOOLEAN;
-
-
-
-    return true;
-}
-
-void JSASTLiteral::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-
-bool JSASTArrayExpression::Parse(const rapidjson::Value& value)
-{
-    JSASTExpression::Parse(value);
-
-    ParseExpressionArray(value["elements"], elements_);
-
-    return true;
-}
-
-void JSASTArrayExpression::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-bool JSASTProperty::Parse(const rapidjson::Value& value)
-{
-    key_ = ParseExpression(value["key"]);
-    assert(key_);
-
-    value_ = ParseExpression(value["value"]);
-    assert(value_);
-
-    return true;
-}
-
-void JSASTProperty::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-bool JSASTObjectExpression::Parse(const rapidjson::Value& value)
-{
-    JSASTExpression::Parse(value);
-
-    const rapidjson::Value& jprops = value["properties"];
-
-    assert(jprops.IsArray());
-
-    for (Value::ConstValueIterator itr = jprops.Begin(); itr != jprops.End(); itr++)
-    {
-
-        JSASTProperty* property = new JSASTProperty();
-        property->Parse(*itr);
-        properties_.Push(property);
-
-    }
-
-
-    return true;
-}
-
-void JSASTObjectExpression::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-
-bool JSASTMemberExpression::Parse(const rapidjson::Value& value)
-{
-    JSASTExpression::Parse(value);
-
-    computed_ = value["computed"].GetBool();
-    object_ = ParseExpression(value["object"]);
-    property_ = ParseExpression(value["property"]);
-
-    return true;
-}
-
-void JSASTMemberExpression::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-
-
-bool JSASTCallExpression::Parse(const rapidjson::Value& value)
-{
-    JSASTExpression::Parse(value);
-
-    callee_ = ParseExpression(value["callee"]);
-
-    ParseExpressionArray(value["arguments"], arguments_);
-
-    return true;
-
-}
-
-void JSASTCallExpression::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-
-bool JSASTNewExpression::Parse(const rapidjson::Value& value)
-{
-    JSASTExpression::Parse(value);
-
-    callee_ = ParseExpression(value["callee"]);
-
-    ParseExpressionArray(value["arguments"], arguments_);
-
-    return true;
-
-}
-
-void JSASTNewExpression::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-
-bool JSASTVariableDeclarator::Parse(const rapidjson::Value& value)
-{
-    JSASTExpression::Parse(value);
-
-    id_ = ParseExpression(value["id"]);
-
-    const Value::Member* init = value.FindMember("init");
-    if (init && init->value.IsObject())
-    {
-        init_ = ParseExpression(init->value);
-    }
-
-    return true;
-
-}
-
-void JSASTVariableDeclarator::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-
-bool JSASTUnaryExpression::Parse(const rapidjson::Value& value)
-{
-    JSASTExpression::Parse(value);
-
-    argument_ = ParseExpression(value["argument"]);
-
-    prefix_ = value["prefix"].IsTrue();
-
-    operator_ = value["operator"].GetString();
-
-    return true;
-
-}
-
-void JSASTUnaryExpression::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-bool JSASTUpdateExpression::Parse(const rapidjson::Value& value)
-{
-    JSASTExpression::Parse(value);
-
-    argument_ = ParseExpression(value["argument"]);
-
-    prefix_ = value["prefix"].IsTrue();
-
-    operator_ = value["operator"].GetString();
-
-    return true;
-
-}
-
-void JSASTUpdateExpression::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-bool JSASTConditionalExpression::Parse(const rapidjson::Value& value)
-{
-    JSASTExpression::Parse(value);
-
-    test_ = ParseExpression(value["test"]);
-    consequent_ = ParseExpression(value["consequent"]);
-    alternate_ = ParseExpression(value["alternate"]);
-
-    return true;
-}
-
-void JSASTConditionalExpression::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-
-
-bool JSASTFunctionExpression::Parse(const rapidjson::Value& value)
-{
-
-    JSASTExpression::Parse(value);
-
-    if (!value["id"].IsNull())
-    {
-        id_ = (JSASTIdentifier*) ParseExpression(value["id"],  JSAST_IDENTIFIER);
-    }
-
-    ParseExpressionArray(value["params"], params_);
-
-    const rapidjson::Value& body = value["body"];
-
-    String type = body["type"].GetString();
-
-    if (type == "BlockStatement")
-    {
-        body_ = (JSASTBlockStatement*) ParseStatement(body);
-    }
-    else
-    {
-        return true;
-    }
-
-
-    return true;
-}
-
-void JSASTFunctionExpression::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-
-JSASTFunctionExpression::~JSASTFunctionExpression()
-{
-    if (id_)
-        delete id_;
-    if (rest_)
-        delete rest_;
-    if (body_)
-        delete body_;
-
-
-
-    for (unsigned i = 0; i < params_.Size(); i++)
-        delete params_[i];
-    for (unsigned i = 0; i < defaults_.Size(); i++)
-        delete defaults_[i];
-
-    params_.Clear();
-    defaults_.Clear();
-}
-
-// STATEMENTS
-
-bool JSASTExpressionStatement::Parse(const rapidjson::Value& value)
-{
-    JSASTStatement::Parse(value);
-
-    const Value::Member* expr = value.FindMember("expression");
-    assert(expr);
-
-    expression_ = ParseExpression(expr->value);
-
-    return expression_ != NULL;
-
-}
-
-void JSASTLabeledStatement::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-bool JSASTLabeledStatement::Parse(const rapidjson::Value& value)
-{
-    JSASTStatement::Parse(value);
-
-    const Value::Member* body = value.FindMember("body");
-    assert(body);
-
-    const Value::Member* label = value.FindMember("label");
-    assert(label);
-
-
-    body_ = ParseStatement(body->value);
-    label_ = (JSASTIdentifier*) ParseExpression(label->value,  JSAST_IDENTIFIER);
-
-    return body_ && label_;
-
-}
-
-void JSASTExpressionStatement::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-
-bool JSASTReturnStatement::Parse(const rapidjson::Value& value)
-{
-    JSASTStatement::Parse(value);
-
-    if (!value["argument"].IsNull())
-    {
-        argument_ = ParseExpression(value["argument"]);
-    }
-
-
-    return true;
-}
-
-void JSASTReturnStatement::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-
-
-bool JSASTVariableDeclaration::Parse(const rapidjson::Value& value)
-{
-    JSASTDeclaration::Parse(value);
-
-    kind_ = value["kind"].GetString();
-
-    ParseExpressionArray(value["declarations"], declarations_);
-
-    return true;
-
-}
-
-void JSASTVariableDeclaration::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-
-JSASTComment::JSASTComment() : JSASTNode(JSAST_COMMENT) , isBlock_(false)
-{
-
-}
-
-JSASTComment::~JSASTComment()
-{
-
-}
-
-bool JSASTComment::Parse(const rapidjson::Value& value)
-{
-    JSASTNode::Parse(value);
-
-    // Block or Line
-    if (value.FindMember("type"))
-    {
-        String type = value["type"].GetString();
-        isBlock_ = type == "Block";
-    }
-
-    if (value.FindMember("value"))
-    {
-        value_ = value["value"].GetString();
-    }
-
-    return true;
-}
-
-void JSASTComment::Accept(JSASTVisitor *visitor)
-{
-    visitor->visit(this);
-}
-
-
-
-JSASTProgram::JSASTProgram(const String &path, const String &json) : JSASTNode(JSAST_PROGRAM)
-  , document_(new Document())
-{
-
-    if (document_->Parse<0>(json.CString()).HasParseError())
-    {
-        LOGERRORF("Could not parse JSON data from %s", path.CString());
-        return;
-    }
-    else
-    {
-        //StringBuffer buffer;
-        //PrettyWriter<StringBuffer> writer(buffer, &(document_->GetAllocator()));
-        //writer.SetIndent(' ', 3);
-        //document_->Accept(writer);
-        //LOGINFOF("%s", buffer.GetString());
-    }
-
-    Parse(*document_);
-
-}
-
-
-
-bool JSASTProgram::Parse(const rapidjson::Value& value)
-{
-    JSASTNode::Parse(value);
-
-    for (Value::ConstMemberIterator itr = value.MemberBegin();
-         itr != value.MemberEnd(); ++itr)
-    {
-        String name = itr->name.GetString();
-
-        if (name == "body")
-        {
-            ParseStatementArray(itr->value, body_);
-        }
-
-        if (name == "comments")
-        {
-            if (itr->value.IsArray())
-            {
-                for (Value::ConstValueIterator citr = itr->value.Begin();
-                     citr != itr->value.End();
-                     citr++)
-                {
-                    JSASTComment* comment = new JSASTComment();
-                    assert(citr->IsObject());
-                    comment->Parse(*citr);
-                    comments_.Push(comment);
-                }
-            }
-        }
-
-    }
-
-    return true;
-
-}
-
-JSASTProgram::~JSASTProgram()
-{
-    for (unsigned i = 0; i < comments_.Size(); i++)
-        delete comments_[i];
-
-    comments_.Clear();
-
-    delete document_;
-    document_ = 0;
-}
-
-void JSASTProgram::Accept(JSASTVisitor *visitor)
-{
-    visitor->visit(this);
-}
-
-
-JSASTProgram* JSASTProgram::ParseFromJSON(const String& path, const String& json)
-{
-    JSASTProgram* cunit = new JSASTProgram(path, json);
-
-    return cunit;
-}
-
-bool JSASTIfStatement::Parse(const rapidjson::Value& value)
-{
-    JSASTStatement::Parse(value);
-
-    test_ = ParseExpression(value["test"]);
-    consequent_ = ParseStatement(value["consequent"]);
-
-    if (!value["alternate"].IsNull())
-        alternate_ = ParseStatement(value["alternate"]);
-
-    return true;
-}
-
-void JSASTIfStatement::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-
-bool JSASTFunctionDeclaration::Parse(const rapidjson::Value& value)
-{
-    JSASTDeclaration::Parse(value);
-
-    if (!value["id"].IsNull())
-    {
-        id_ = (JSASTIdentifier*) ParseExpression(value["id"],  JSAST_IDENTIFIER);
-    }
-
-    ParseExpressionArray(value["params"], params_);
-
-    const rapidjson::Value& body = value["body"];
-
-    String type = body["type"].GetString();
-
-    if (type == "BlockStatement")
-    {
-        body_ = (JSASTBlockStatement*) ParseStatement(body);
-    }
-    else
-    {
-
-    }
-
-
-    return true;
-}
-
-void JSASTFunctionDeclaration::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-JSASTFunctionDeclaration::~JSASTFunctionDeclaration()
-{
-    if (id_)
-        delete id_;
-    if (rest_)
-        delete rest_;
-    if (body_)
-        delete body_;
-
-    for (unsigned i = 0; i < params_.Size(); i++)
-        delete params_[i];
-    for (unsigned i = 0; i < defaults_.Size(); i++)
-        delete defaults_[i];
-
-    params_.Clear();
-    defaults_.Clear();
-}
-
-bool JSASTBlockStatement::Parse(const rapidjson::Value& value)
-{
-    if (value.FindMember("body"))
-    {
-        ParseStatementArray(value["body"], body_);
-
-    }
-
-    return true;
-
-}
-
-void JSASTBlockStatement::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-bool JSASTForStatement::Parse(const rapidjson::Value& value)
-{
-    JSASTStatement::Parse(value);
-
-    if (value.FindMember("init") && !value.FindMember("init")->value.IsNull())
-    {
-        const Value::Member* member = value.FindMember("init");
-
-        String type = member->value.FindMember("type")->value.GetString();
-        if (type == "VariableDeclaration")
-        {
-            initVariable_ = (JSASTVariableDeclaration*) ParseStatement(member->value);
-        }
-        else
-        {
-            initExpression_ = ParseExpression(member->value);
-        }
-    }
-
-    if (value.FindMember("test") && !value.FindMember("test")->value.IsNull())
-    {
-        test_ = ParseExpression(value["test"]);
-    }
-
-    if (value.FindMember("update") && !value.FindMember("update")->value.IsNull())
-    {
-        update_ = ParseExpression(value["update"]);
-    }
-
-    if (value.FindMember("body"))
-    {
-        body_ = ParseStatement(value["body"]);
-    }
-
-    return true;
-}
-
-void JSASTForStatement::Accept(JSASTVisitor* visitor)
-{
-    visitor->visit(this);
-}
-
-
-}

+ 0 - 967
Attic/AtomicEditorReference/Source/Javascript/JSAST.h

@@ -1,967 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-// see https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Parser_API
-
-#include <Atomic/Container/Str.h>
-#include <Atomic/Container/Vector.h>
-
-using namespace Atomic;
-
-namespace rapidjson
-{
-template<typename CharType> struct UTF8;
-class CrtAllocator;
-template <typename BaseAllocator> class MemoryPoolAllocator;
-template <typename Encoding, typename Allocator> class GenericValue;
-typedef GenericValue<UTF8<char>, MemoryPoolAllocator<CrtAllocator> > Value;
-template <typename Encoding, typename Allocator> class GenericDocument;
-typedef GenericDocument<UTF8<char>, MemoryPoolAllocator<CrtAllocator> > Document;
-}
-
-namespace AtomicEditor
-{
-
-enum JSASTType
-{
-    JSAST_UNDEFINED,
-    JSAST_COMMENT,
-    JSAST_PROGRAM,
-    JSAST_PROPERTY,
-    // Expression
-    JSAST_ASSIGNMENTEXPRESSION,
-    JSAST_LOGICALEXPRESSION,
-    JSAST_IDENTIFIER,
-    JSAST_CALLEXPRESSION,
-    JSAST_VARIABLEDECLARATOR,
-    JSAST_BINARYEXPRESSION,
-    JSAST_MEMBEREXPRESSION,
-    JSAST_LITERAL,
-    JSAST_ARRAYEXPRESSION,
-    JSAST_FUNCTIONEXPRESSION,
-    JSAST_NEWEXPRESSION,
-    JSAST_UNARYEXPRESSION,
-    JSAST_UPDATEEXPRESSION,
-    JSAST_CONDITIONALEXPRESSION,
-    JSAST_OBJECTEXPRESSION,
-    JSAST_THISEXPRESSION,
-    // Statements
-    JSAST_RETURNSTATEMENT,
-    JSAST_EMPTYSTATEMENT,
-    JSAST_EXPRESSIONSTATEMENT,
-    JSAST_LABELEDSTATEMENT,
-    JSAST_VARIABLEDECLARATION,
-    JSAST_FUNCTIONDECLARATION,
-    JSAST_IFSTATEMENT,
-    JSAST_BLOCKSTATEMENT
-};
-
-
-class JSASTProgram;
-class JSASTStatement;
-class JSASTEmptyStatement;
-class JSASTExpressionStatement;
-class JSASTExpression;
-class JSASTVisitor;
-class JSASTBlockStatement;
-
-class JSASTNode
-{    
-public:
-
-    struct Loc
-    {
-        int startLine_;
-        int startColumn_;
-        int endLine_;
-        int endColumn_;
-
-        Loc()
-        {
-            startLine_ = startColumn_ = -1;
-            endLine_ = endColumn_ = -1;
-        }
-
-        bool Valid() const { return startLine_ != -1 && startColumn_ != -1 &&
-                    endLine_ != -1 && endColumn_ != -1; }
-
-    };
-
-    JSASTNode(JSASTType type);
-    virtual bool Parse(const rapidjson::Value& value);
-
-    JSASTType GetType() { return type_; }
-    const Loc& GetLoc() { return loc_; }
-
-    virtual void Accept(JSASTVisitor* visitor) = 0;
-
-protected:
-
-    bool ParseLoc(const rapidjson::Value &value);
-    bool ParseRange(const rapidjson::Value &value);
-
-    JSASTStatement* ParseStatement(const rapidjson::Value &value);
-    JSASTExpression* ParseExpression(const rapidjson::Value &value, JSASTType astType = JSAST_UNDEFINED);
-
-    bool ParseExpressionArray(const rapidjson::Value &value, Vector<JSASTExpression *> &expressions);
-    bool ParseStatementArray(const rapidjson::Value &value, Vector<JSASTStatement *> &statements);
-
-private:
-
-    Loc loc_;
-    JSASTType type_;
-    // character range
-    int rangeStart_;
-    int rangeEnd_;
-
-
-};
-
-class JSASTComment: public JSASTNode
-{
-public:
-
-    JSASTComment();
-    virtual ~JSASTComment();
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-    const String& GetValue() { return value_; }
-    bool IsBlock() { return isBlock_; }
-
-private:
-
-    bool isBlock_;
-    String value_;
-
-};
-
-class JSASTProgram : public JSASTNode
-{
-public:
-
-    JSASTProgram(const String& path, const String& json);
-    virtual ~JSASTProgram();
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-    static JSASTProgram* ParseFromJSON(const String& path, const String& json);
-
-    unsigned GetStatementCount() { return body_.Size(); }
-    JSASTStatement* GetStatement(unsigned idx) { return body_[idx]; }
-
-    unsigned GetCommentCount() { return comments_.Size(); }
-    JSASTComment* GetComment(unsigned idx) { return comments_[idx]; }
-
-
-protected:
-
-private:
-
-    Vector<JSASTStatement*> body_;
-    rapidjson::Document* document_;
-
-    Vector<JSASTComment*> comments_;
-
-};
-
-class JSASTExpression : public JSASTNode
-{
-public:
-
-    virtual ~JSASTExpression() {}
-
-    virtual bool Parse(const rapidjson::Value& value)
-    {
-        return JSASTNode::Parse(value);
-    }
-
-protected:
-    JSASTExpression(JSASTType type) :  JSASTNode(type) {}
-
-};
-
-
-class JSASTIdentifier : public JSASTExpression
-{
-
-public:
-    JSASTIdentifier() : JSASTExpression(JSAST_IDENTIFIER) {}
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-private:
-
-    String name_;
-};
-
-class JSASTThisExpression : public JSASTExpression
-{
-
-public:
-    JSASTThisExpression() : JSASTExpression(JSAST_THISEXPRESSION) {}
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-private:
-
-};
-
-
-class JSASTLiteral : public JSASTExpression
-{
-
-public:
-
-    enum LiteralType
-    {
-        LITERAL_UNKNOWN,
-        LITERAL_NULL,
-        LITERAL_STRING,
-        LITERAL_NUMBER,
-        LITERAL_BOOLEAN,
-        LITERAL_REGEX
-    };
-
-    JSASTLiteral() : JSASTExpression(JSAST_LITERAL), literalType_(LITERAL_UNKNOWN) {}
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-    LiteralType GetLiteralType() { return literalType_; }
-
-private:
-
-    //value: string | boolean | null | number | RegExp;
-    LiteralType literalType_;
-    String raw_;
-};
-
-class JSASTArrayExpression : public JSASTExpression
-{
-
-public:
-    JSASTArrayExpression() : JSASTExpression(JSAST_ARRAYEXPRESSION) {}
-
-    virtual ~JSASTArrayExpression()
-    {
-        for (unsigned i = 0; i < elements_.Size(); i++)
-            delete elements_[i];
-
-        elements_.Clear();
-    }
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-    unsigned GetElementCount() { return elements_.Size(); }
-    JSASTExpression* GetElement(unsigned idx) { return elements_[idx]; }
-
-private:
-
-    Vector<JSASTExpression*> elements_;
-
-};
-
-class JSASTProperty: public JSASTNode
-{
-
-public:
-
-    JSASTProperty() : JSASTNode(JSAST_PROPERTY), key_(0), value_(0) {}
-    virtual ~JSASTProperty()
-    {
-        if (key_)
-            delete key_;
-
-        if (value_)
-            delete value_;
-    }
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-    JSASTExpression* GetKey() { return key_; }
-    JSASTExpression* GetValue() { return value_; }
-
-
-private:
-    JSASTExpression* key_;
-    JSASTExpression* value_;
-
-};
-
-
-class JSASTObjectExpression : public JSASTExpression
-{
-
-public:
-    JSASTObjectExpression() : JSASTExpression(JSAST_OBJECTEXPRESSION) {}
-
-    virtual ~JSASTObjectExpression()
-    {
-        for (unsigned i = 0; i < properties_.Size(); i++)
-            delete properties_[i];
-
-        properties_.Clear();
-    }
-
-    unsigned GetPropertyCount() { return properties_.Size(); }
-    JSASTProperty* GetProperty(unsigned idx) { return properties_[idx]; }
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-private:
-
-    Vector<JSASTProperty*> properties_;
-};
-
-
-
-class JSASTAssignmentExpression : public JSASTExpression
-{
-
-public:
-    JSASTAssignmentExpression() : JSASTExpression(JSAST_ASSIGNMENTEXPRESSION),
-        leftExpression_(0), rightExpression_(0) {}
-
-    virtual ~JSASTAssignmentExpression()
-    {
-        if (leftExpression_)
-            delete leftExpression_;
-        if (rightExpression_)
-            delete rightExpression_;
-    }
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-    const String& GetOperator() { return operator_; }
-    JSASTExpression* GetLeft() { return leftExpression_; }
-    JSASTExpression* GetRight() { return rightExpression_; }
-
-private:
-
-    String operator_;
-    JSASTExpression* leftExpression_;
-    JSASTExpression* rightExpression_;
-
-};
-
-class JSASTLogicalExpression : public JSASTExpression
-{
-
-public:
-    JSASTLogicalExpression() : JSASTExpression(JSAST_LOGICALEXPRESSION),
-        leftExpression_(0), rightExpression_(0) {}
-
-    virtual ~JSASTLogicalExpression()
-    {
-        if (leftExpression_)
-            delete leftExpression_;
-        if (rightExpression_)
-            delete rightExpression_;
-    }
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-    const String& GetOperator() { return operator_; }
-    JSASTExpression* GetLeft() { return leftExpression_; }
-    JSASTExpression* GetRight() { return rightExpression_; }
-
-private:
-
-    String operator_;
-    JSASTExpression* leftExpression_;
-    JSASTExpression* rightExpression_;
-
-};
-
-
-class JSASTUnaryExpression : public JSASTExpression
-{
-
-public:
-    JSASTUnaryExpression() : JSASTExpression(JSAST_UNARYEXPRESSION),
-        argument_(0), prefix_(false) {}
-
-    virtual ~JSASTUnaryExpression()
-    {
-        if (argument_)
-            delete argument_;
-    }
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-    const String& GetOperator() { return operator_;}
-
-    JSASTExpression* GetArgument() { return argument_; }
-
-private:
-
-    String operator_;
-    bool prefix_;
-    JSASTExpression* argument_;
-
-};
-
-class JSASTUpdateExpression : public JSASTExpression
-{
-
-public:
-    JSASTUpdateExpression() : JSASTExpression(JSAST_UPDATEEXPRESSION),
-        argument_(0), prefix_(false) {}
-
-    virtual ~JSASTUpdateExpression()
-    {
-        if (argument_)
-            delete argument_;
-    }
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-    const String& GetOperator() { return operator_;}
-
-    JSASTExpression* GetArgument() { return argument_; }
-
-private:
-
-    String operator_;
-    bool prefix_;
-    JSASTExpression* argument_;
-
-};
-
-class JSASTFunctionExpression : public JSASTExpression
-{
-
-public:
-    JSASTFunctionExpression() : JSASTExpression(JSAST_FUNCTIONEXPRESSION),
-        id_(0), rest_(0), body_(0), generator_(false), expression_(false) {}
-
-    virtual ~JSASTFunctionExpression();
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-    JSASTIdentifier* GetID() { return id_; }
-    JSASTBlockStatement* GetBodyStatement() { return body_; }
-
-    unsigned GetParamsCount() { return params_.Size(); }
-    JSASTExpression* GetParam(unsigned idx) { return params_[idx]; }
-
-private:
-
-    JSASTIdentifier* id_;
-    Vector<JSASTExpression*> params_;
-    Vector<JSASTExpression*> defaults_;
-    JSASTIdentifier* rest_;
-
-    JSASTBlockStatement* body_;
-
-    bool generator_;
-    bool expression_;
-
-};
-
-
-class JSASTBinaryExpression : public JSASTExpression
-{
-
-public:
-    JSASTBinaryExpression() : JSASTExpression(JSAST_BINARYEXPRESSION),
-        leftExpression_(0), rightExpression_(0) {}
-
-    virtual ~JSASTBinaryExpression()
-    {
-        if (leftExpression_)
-            delete leftExpression_;
-        if (rightExpression_)
-            delete rightExpression_;
-    }
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-    JSASTExpression* GetLeft() { return leftExpression_; }
-    JSASTExpression* GetRight() { return rightExpression_; }
-
-    const String& GetOperator() { return operator_;}
-
-private:
-
-    String operator_;
-    JSASTExpression* leftExpression_;
-    JSASTExpression* rightExpression_;
-
-};
-
-class JSASTMemberExpression : public JSASTExpression
-{
-
-public:
-    JSASTMemberExpression() : JSASTExpression(JSAST_MEMBEREXPRESSION),
-        object_(0), property_(0), computed_(false) {}
-
-    virtual ~JSASTMemberExpression()
-    {
-        if (object_)
-            delete object_;
-        if (property_)
-            delete property_;
-    }
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-    JSASTExpression* GetObject() { return object_;}
-    JSASTExpression* GetProperty() { return property_; }
-
-
-private:
-
-    JSASTExpression* object_;
-    JSASTExpression* property_;
-    bool computed_;
-};
-
-class JSASTConditionalExpression : public JSASTExpression
-{
-public:
-
-    JSASTConditionalExpression() : JSASTExpression(JSAST_CONDITIONALEXPRESSION), test_(0), consequent_(0), alternate_(0) {}
-
-    virtual ~JSASTConditionalExpression()
-    {
-        if (test_)
-            delete test_;
-        if (consequent_)
-            delete consequent_;
-        if (alternate_)
-            delete alternate_;
-    }
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-    JSASTExpression* GetTest() { return test_; }
-    JSASTExpression* GetConsequent() { return consequent_; }
-    JSASTExpression* GetAlternate() { return alternate_; }
-
-private:
-
-    JSASTExpression* test_;
-    JSASTExpression* consequent_;
-    JSASTExpression* alternate_;
-
-};
-
-class JSASTCallExpression : public JSASTExpression
-{
-
-public:
-    JSASTCallExpression() : JSASTExpression(JSAST_CALLEXPRESSION),
-        callee_(0){}
-
-    virtual ~JSASTCallExpression()
-    {
-        if (callee_)
-            delete callee_;
-
-        for (unsigned i = 0; i < arguments_.Size(); i++)
-        {
-            delete arguments_[i];
-        }
-
-        arguments_.Clear();
-    }
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-    JSASTExpression* GetCallee() { return callee_; }
-    unsigned GetArgumentCount() { return arguments_.Size(); }
-    JSASTExpression* GetArgument(unsigned idx) { return arguments_[idx]; }
-
-private:
-
-    JSASTExpression* callee_;
-    Vector<JSASTExpression*> arguments_;
-
-};
-
-class JSASTNewExpression : public JSASTExpression
-{
-
-public:
-    JSASTNewExpression() : JSASTExpression(JSAST_NEWEXPRESSION),
-        callee_(0){}
-
-    virtual ~JSASTNewExpression()
-    {
-        if (callee_)
-            delete callee_;
-
-        for (unsigned i = 0; i < arguments_.Size(); i++)
-        {
-            delete arguments_[i];
-        }
-
-        arguments_.Clear();
-    }
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-    JSASTExpression* GetCallee() { return callee_; }
-    unsigned GetArgumentCount() { return arguments_.Size(); }
-    JSASTExpression* GetArgument(unsigned idx) { return arguments_[idx]; }
-
-
-private:
-
-    JSASTExpression* callee_;
-    Vector<JSASTExpression*> arguments_;
-
-};
-
-class JSASTVariableDeclarator : public JSASTExpression
-{
-public:
-
-    JSASTVariableDeclarator() : JSASTExpression(JSAST_VARIABLEDECLARATOR), id_(0), init_(0) {}
-
-    virtual ~JSASTVariableDeclarator()
-    {
-        if (id_)
-            delete id_;
-        if (init_)
-            delete init_;
-    }
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-    JSASTExpression* GetID() { return id_; }
-    JSASTExpression* GetInit() { return init_; }
-
-
-private:
-
-    JSASTExpression* id_;
-    JSASTExpression* init_;
-
-};
-
-class JSASTStatement : public JSASTNode
-{
-
-public:
-
-    virtual ~JSASTStatement() {}
-
-    virtual bool Parse(const rapidjson::Value& value)
-    {
-        return JSASTNode::Parse(value);
-    }
-
-protected:
-    JSASTStatement(JSASTType type) :  JSASTNode(type) {}
-
-};
-
-class JSASTEmptyStatement : public JSASTStatement
-{
-
-public:
-    JSASTEmptyStatement() : JSASTStatement(JSAST_EMPTYSTATEMENT) {}
-
-    virtual bool Parse(const rapidjson::Value& value)
-    {
-        return JSASTStatement::Parse(value);
-    }
-    virtual void Accept(JSASTVisitor* visitor);
-
-};
-
-class JSASTExpressionStatement : public JSASTStatement
-{
-
-public:
-    JSASTExpressionStatement(JSASTType type = JSAST_EXPRESSIONSTATEMENT) : JSASTStatement(type),
-        expression_(0) {}
-
-    virtual ~JSASTExpressionStatement()
-    {
-        if (expression_)
-            delete expression_;
-    }
-
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-    JSASTExpression* GetExpression() { return expression_; }
-
-protected:
-
-    JSASTExpression* expression_;
-
-};
-
-class JSASTLabeledStatement : public JSASTStatement
-{
-
-public:
-    JSASTLabeledStatement(JSASTType type = JSAST_LABELEDSTATEMENT) : JSASTStatement(type),
-        label_(0), body_(0) {}
-
-    virtual ~JSASTLabeledStatement()
-    {
-        if (label_)
-            delete label_;
-
-        if (body_)
-            delete body_;
-
-    }
-
-    JSASTIdentifier* GetLabel() { return label_; }
-    JSASTStatement* GetBody() { return body_; }
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-protected:
-
-    JSASTIdentifier* label_;
-    JSASTStatement* body_;
-
-};
-
-
-class JSASTReturnStatement : public JSASTStatement
-{
-
-public:
-    JSASTReturnStatement(JSASTType type = JSAST_RETURNSTATEMENT) : JSASTStatement(type),
-        argument_(0) {}
-
-    virtual ~JSASTReturnStatement()
-    {
-        if (argument_)
-            delete argument_;
-    }
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-    JSASTExpression* GetArgument() { return argument_; }
-
-protected:
-
-    JSASTExpression* argument_;
-
-};
-
-
-class JSASTDeclaration : public JSASTStatement
-{
-
-public:
-
-    virtual bool Parse(const rapidjson::Value& value) { return JSASTStatement::Parse(value); }
-
-protected:
-
-    JSASTDeclaration(JSASTType type) : JSASTStatement(type) {}
-
-};
-
-class JSASTBlockStatement : public JSASTStatement
-{
-public:
-    JSASTBlockStatement() : JSASTStatement(JSAST_BLOCKSTATEMENT) {}
-
-    virtual ~JSASTBlockStatement()
-    {
-        for (unsigned i = 0; i < body_.Size(); i++)
-            delete body_[i];
-
-        body_.Clear();
-    }
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-    unsigned GetStatementCount() { return body_.Size(); }
-    JSASTStatement* GetStatement(unsigned idx) { return body_[idx]; }
-
-
-private:
-
-    Vector<JSASTStatement*> body_;
-
-};
-
-class JSASTIfStatement : public JSASTStatement
-{
-public:
-
-    JSASTIfStatement() : JSASTStatement(JSAST_IFSTATEMENT), test_(0), consequent_(0), alternate_(0) {}
-
-    virtual ~JSASTIfStatement()
-    {
-        if (test_)
-            delete test_;
-        if (consequent_)
-            delete consequent_;
-        if (alternate_)
-            delete alternate_;
-    }
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-    JSASTExpression* GetTest() { return test_; }
-    JSASTStatement* GetConsequent() { return consequent_; }
-    JSASTStatement* GetAlternate() { return alternate_; }
-
-private:
-
-    JSASTExpression* test_;
-    JSASTStatement* consequent_;
-    JSASTStatement* alternate_;
-
-};
-
-class JSASTVariableDeclaration : public JSASTDeclaration
-{
-
-public:
-
-    JSASTVariableDeclaration() : JSASTDeclaration(JSAST_VARIABLEDECLARATION) {}
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-    const String& GetKind()  { return kind_; }
-
-    unsigned GetDeclarationsCount() { return declarations_.Size(); }
-    JSASTExpression* GetDeclaration(unsigned idx) { return declarations_[idx]; }
-
-protected:
-
-    // "var" | "let" | "const";
-    String kind_;
-
-    // Array of JSASTVariableDeclarator
-    Vector<JSASTExpression*> declarations_;
-
-};
-
-
-class JSASTFunctionDeclaration : public JSASTDeclaration
-{
-
-public:
-    JSASTFunctionDeclaration() : JSASTDeclaration(JSAST_FUNCTIONDECLARATION),
-        id_(0), rest_(0), body_(0), generator_(false), expression_(false) {}
-
-    virtual ~JSASTFunctionDeclaration();
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-    JSASTIdentifier* GetID() { return id_; }
-    JSASTBlockStatement* GetBodyStatement() { return body_; }
-
-    unsigned GetParamsCount() { return params_.Size(); }
-    JSASTExpression* GetParam(unsigned idx) { return params_[idx]; }
-
-private:
-
-    JSASTIdentifier* id_;
-    Vector<JSASTExpression*> params_;
-    Vector<JSASTExpression*> defaults_;
-    JSASTIdentifier* rest_;
-
-    JSASTBlockStatement* body_;
-
-    bool generator_;
-    bool expression_;
-
-};
-
-/*
-interface ForStatement <: Statement {
-    type: "ForStatement";
-    init: VariableDeclaration | Expression | null;
-    test: Expression | null;
-    update: Expression | null;
-    body: Statement;
-}
-*/
-
-
-class JSASTForStatement : public JSASTStatement
-{
-public:
-
-    JSASTForStatement() : JSASTStatement(JSAST_IFSTATEMENT),
-        initVariable_(0), initExpression_(0), test_(0), update_(0), body_(0)
-    {
-
-    }
-
-    virtual ~JSASTForStatement()
-    {
-        if (initVariable_)
-            delete initVariable_;
-
-        if (initExpression_)
-            delete initExpression_;
-
-        if (test_)
-            delete(test_);
-
-        if(update_)
-            delete update_;
-
-        if (body_)
-            delete body_;
-    }
-
-    virtual bool Parse(const rapidjson::Value& value);
-    virtual void Accept(JSASTVisitor* visitor);
-
-    JSASTExpression* GetTest() { return test_; }
-    JSASTVariableDeclaration* GetInitVariable() { return initVariable_; }
-    JSASTExpression* GetInitExpression() { return initExpression_; }
-    JSASTExpression* GetUpdate() { return update_; }
-    JSASTStatement* GetBody() { return body_; }
-
-private:
-    JSASTVariableDeclaration* initVariable_;
-    JSASTExpression* initExpression_;
-    JSASTExpression* test_;
-    JSASTExpression* update_;
-    JSASTStatement* body_;
-
-};
-
-
-}
-
-

+ 0 - 7
Attic/AtomicEditorReference/Source/Javascript/JSASTSyntaxColorVisitor.cpp

@@ -1,7 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-
-#include "JSASTSyntaxColorVisitor.h"

+ 0 - 360
Attic/AtomicEditorReference/Source/Javascript/JSASTSyntaxColorVisitor.h

@@ -1,360 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-
-#include "JSASTVisitor.h"
-#include "JSTheme.h"
-
-#include <TurboBadger/tb_style_edit.h>
-
-using namespace tb;
-
-namespace AtomicEditor
-{
-
-// TBBlock::InsertText, handle text input, split/layout
-
-class JSASTSyntaxColorVisitor : public JSASTTraversalVisitor
-{
-public:
-
-    JSASTSyntaxColorVisitor(TBStyleEdit* styleEdit) : styleEdit_(styleEdit) {}
-
-    using JSASTTraversalVisitor::visit;
-
-    virtual JSASTExpression* visit(JSASTIdentifier* expr)
-    {
-        //SetLocColor(expr->GetLoc(), 6);
-        return expr;
-    }
-
-    virtual JSASTExpression* visit(JSASTLiteral* expr)
-    {
-        JSThemeColor color = JSTHEME_NORMAL;
-        switch (expr->GetLiteralType())
-        {
-        case JSASTLiteral::LITERAL_BOOLEAN:
-            color = JSTHEME_LITERAL_BOOLEAN;
-            break;
-        case JSASTLiteral::LITERAL_STRING:
-            color = JSTHEME_LITERAL_STRING;
-            break;
-        case JSASTLiteral::LITERAL_NULL:
-            color = JSTHEME_LITERAL_NULL;
-            break;
-        case JSASTLiteral::LITERAL_NUMBER:
-            color = JSTHEME_LITERAL_NUMBER;
-            break;
-        case JSASTLiteral::LITERAL_REGEX:
-            color = JSTHEME_LITERAL_REGEX;
-            break;
-
-        default:
-            break;
-        }
-
-        SetLocColor(expr->GetLoc(), color);
-        return expr;
-    }
-
-    virtual JSASTStatement* visit(JSASTFunctionDeclaration* decl)
-    {
-        SetLocColor(decl->GetLoc(), JSTHEME_FUNCTION, true);
-
-        JSASTNode* id = decl->GetID();
-        if (id)
-            SetLocColor(id->GetLoc(), JSTHEME_CODE, true);
-
-        for (unsigned i = 0; i < decl->GetParamsCount(); i++)
-        {
-            JSASTExpression* p = decl->GetParam(i);
-            SetLocColor(p->GetLoc(), JSTHEME_FUNCTIONDECLARG, true);
-        }
-
-
-        return JSASTTraversalVisitor::visit(decl);
-
-    }
-
-    virtual JSASTStatement* visit(JSASTVariableDeclaration* decl)
-    {
-        SetLocColor(decl->GetLoc(), JSTHEME_VAR, true);
-
-        SetLocColor(decl->GetLoc(), "=", JSTHEME_KEYWORD, true);
-
-        for (unsigned i = 0; i < decl->GetDeclarationsCount(); i++)
-        {
-            JSASTExpression* expr = decl->GetDeclaration(i);
-
-            if (expr->GetType() == JSAST_VARIABLEDECLARATOR)
-            {
-                JSASTVariableDeclarator* v = (JSASTVariableDeclarator*) expr;
-
-                if (JSASTExpression* init = v->GetInit())
-                {
-                    if (init->GetType() == JSAST_FUNCTIONEXPRESSION)
-                    {
-                        if (v->GetID())
-                            SetLocColor(v->GetID()->GetLoc(), JSTHEME_CODE, true);
-                    }
-                }
-            }
-
-        }
-
-        return JSASTTraversalVisitor::visit(decl);
-    }
-
-    virtual JSASTComment* visit(JSASTComment* comment)
-    {
-        SetLocColor(comment->GetLoc(), JSTHEME_COMMENT, false);
-        return comment;
-    }
-
-    virtual JSASTStatement* visit(JSASTIfStatement* stmt)
-    {
-        SetLocColor(stmt->GetLoc(), JSTHEME_KEYWORD, true);
-        return JSASTTraversalVisitor::visit(stmt);
-    }
-
-    virtual JSASTExpression* visit(JSASTConditionalExpression* expr)
-    {
-        return JSASTTraversalVisitor::visit(expr);
-    }
-
-
-    virtual JSASTStatement* visit(JSASTForStatement* stmt)
-    {
-        SetLocColor(stmt->GetLoc(), JSTHEME_KEYWORD, true);
-        return JSASTTraversalVisitor::visit(stmt);
-    }
-
-
-    virtual JSASTExpression* visit(JSASTCallExpression* expr)
-    {
-
-        JSASTNode* locNode = expr->GetCallee();
-        if (locNode->GetType() == JSAST_MEMBEREXPRESSION)
-        {
-            locNode = ((JSASTMemberExpression*) locNode)->GetProperty();
-        }
-
-        //SetLocColor(locNode->GetLoc(), 2);
-
-        return JSASTTraversalVisitor::visit(expr);
-    }
-
-    virtual JSASTStatement* visit(JSASTReturnStatement *stmt)
-    {
-        SetLocColor(stmt->GetLoc(), JSTHEME_KEYWORD, true);
-
-        return JSASTTraversalVisitor::visit(stmt);
-    }
-
-    virtual JSASTExpression* visit(JSASTUnaryExpression* expr)
-    {
-        const String& op = expr->GetOperator();
-
-        SetLocColor(expr->GetLoc(), op, JSTHEME_KEYWORD, false);
-
-        return JSASTTraversalVisitor::visit(expr);
-    }
-
-    virtual JSASTExpression* visit(JSASTUpdateExpression* expr)
-    {
-        const String& op = expr->GetOperator();
-
-        SetLocColor(expr->GetLoc(), op, JSTHEME_KEYWORD, false);
-
-        return JSASTTraversalVisitor::visit(expr);
-    }
-
-
-    virtual JSASTExpression* visit(JSASTBinaryExpression* expr)
-    {
-        const String& op = expr->GetOperator();
-
-        SetLocColor(expr->GetLoc(), op, JSTHEME_KEYWORD, false);
-
-        return JSASTTraversalVisitor::visit(expr);
-    }
-
-    virtual JSASTExpression* visit(JSASTAssignmentExpression* expr)
-    {
-        const String& op = expr->GetOperator();
-
-        SetLocColor(expr->GetLoc(), op, JSTHEME_KEYWORD, false);
-
-        return JSASTTraversalVisitor::visit(expr);
-    }
-
-    virtual JSASTExpression* visit(JSASTLogicalExpression* expr)
-    {
-        const String& op = expr->GetOperator();
-
-        SetLocColor(expr->GetLoc(), op, JSTHEME_KEYWORD, false);
-
-        return JSASTTraversalVisitor::visit(expr);
-    }
-
-
-    virtual JSASTExpression* visit(JSASTNewExpression* expr)
-    {
-        SetLocColor(expr->GetLoc(), JSTHEME_KEYWORD, true);
-
-        JSASTNode* locNode = expr->GetCallee();
-
-        if (locNode->GetType() == JSAST_MEMBEREXPRESSION)
-        {
-            locNode = ((JSASTMemberExpression*) locNode)->GetProperty();
-        }
-
-        return JSASTTraversalVisitor::visit(expr);
-    }
-
-    virtual JSASTExpression* visit(JSASTFunctionExpression* expr)
-    {
-        SetLocColor(expr->GetLoc(), "function", JSTHEME_FUNCTION, true);
-
-        for (unsigned i = 0; i < expr->GetParamsCount(); i++)
-        {
-            JSASTExpression* p = expr->GetParam(i);
-            SetLocColor(p->GetLoc(), JSTHEME_FUNCTIONDECLARG, true);
-        }
-
-        return JSASTTraversalVisitor::visit(expr);
-    }
-
-
-private:
-
-    void SetLocColor(const JSASTNode::Loc& loc, unsigned color, bool single = false)
-    {
-        if (!loc.Valid())
-            return;
-
-        PODVector<TBTextFragment*> fragments;
-        GetTextFragments(loc, fragments);
-        for (unsigned i = 0; i < fragments.Size(); i++)
-        {
-            fragments.At(i)->themeColor = color;
-            if (single)
-                break;
-        }
-    }
-
-    void SetLocColor(const JSASTNode::Loc& loc, const String& value, unsigned color, bool single = false)
-    {
-        if (!loc.Valid())
-            return;
-
-        String substring = value;
-
-        PODVector<TBTextFragment*> fragments;
-        GetTextFragments(loc, fragments);
-        for (unsigned i = 0; i < fragments.Size(); i++)
-        {
-            TBTextFragment* fragment = fragments[i];
-
-            if (!strncmp(substring.CString(), fragment->Str(), substring.Length()))
-            {
-                fragments.At(i)->themeColor = color;
-
-                substring = substring.Substring(fragments.At(i)->len);
-
-                if (single || !substring.Length())
-                    break;
-            }
-        }
-    }
-
-
-    TBTextFragment* GetFragmentAt( const JSASTNode::Loc& loc)
-    {
-        if (!loc.Valid())
-            return NULL;
-
-        int line = loc.startLine_ - 1;
-
-        TBBlock *block = styleEdit_->blocks.GetFirst();
-        int count = 0;
-        while (block && count < line)
-        {
-            block = block->GetNext();
-            count++;
-        }
-
-        if (!block)
-            return NULL;
-
-        for (TBTextFragment* frag = block->fragments.GetFirst(); frag; frag = frag->GetNext())
-        {
-            if (frag->ofs >= loc.startColumn_)
-                return frag;
-        }
-
-        return NULL;
-
-    }
-
-
-    void GetTextFragments( const JSASTNode::Loc& loc,  PODVector<TBTextFragment*>& fragments)
-    {
-        if (!loc.Valid())
-            return;
-
-        for (int lcounter = loc.startLine_; lcounter <= loc.endLine_; lcounter++)
-        {
-            int line = lcounter - 1;
-
-            TBBlock *block = styleEdit_->blocks.GetFirst();
-            int count = 0;
-            while (block && count < line)
-            {
-                block = block->GetNext();
-                count++;
-            }
-
-            if (!block)
-                return;
-
-            for (TBTextFragment* frag = block->fragments.GetFirst(); frag; frag = frag->GetNext())
-            {
-                if (loc.startLine_ == loc.endLine_)
-                {
-                    if (frag->ofs >= loc.startColumn_ && frag->ofs < loc.endColumn_)
-                        fragments.Push(frag);
-                }
-                else
-                {
-                    if (lcounter == loc.startLine_)
-                    {
-                        if (frag->ofs >= loc.startColumn_)
-                            fragments.Push(frag);
-
-                    }
-                    else if (lcounter == loc.endLine_)
-                    {
-                        if (frag->ofs < loc.endColumn_)
-                            fragments.Push(frag);
-
-                    }
-                    else
-                    {
-                        fragments.Push(frag);
-                    }
-                }
-            }
-        }
-
-    }
-
-    TBStyleEdit* styleEdit_;
-
-};
-
-
-}

+ 0 - 7
Attic/AtomicEditorReference/Source/Javascript/JSASTVisitor.cpp

@@ -1,7 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-
-#include "JSASTVisitor.h"

+ 0 - 382
Attic/AtomicEditorReference/Source/Javascript/JSASTVisitor.h

@@ -1,382 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include "JSAST.h"
-
-namespace AtomicEditor
-{
-
-class JSASTVisitor
-{
-public:
-
-    virtual JSASTProgram* visit(JSASTProgram *program) = 0;
-
-    virtual JSASTStatement* visit(JSASTBlockStatement *stmt) = 0;
-    virtual JSASTStatement* visit(JSASTExpressionStatement *stmt) = 0;
-    virtual JSASTStatement* visit(JSASTIfStatement *stmt) = 0;
-    virtual JSASTStatement* visit(JSASTFunctionDeclaration *stmt) = 0;
-    virtual JSASTStatement* visit(JSASTVariableDeclaration *stmt) = 0;
-    virtual JSASTStatement* visit(JSASTReturnStatement *stmt) = 0;
-    virtual JSASTStatement* visit(JSASTEmptyStatement *stmt) = 0;
-    virtual JSASTStatement* visit(JSASTForStatement *stmt) = 0;
-
-    virtual JSASTExpression* visit(JSASTAssignmentExpression* expr) = 0;
-    virtual JSASTExpression* visit(JSASTLogicalExpression* expr) = 0;
-    virtual JSASTExpression* visit(JSASTConditionalExpression* expr) = 0;
-    virtual JSASTExpression* visit(JSASTThisExpression* expr) = 0;
-
-    virtual JSASTExpression* visit(JSASTIdentifier* expr) = 0;
-    virtual JSASTExpression* visit(JSASTCallExpression* expr) = 0;
-    virtual JSASTExpression* visit(JSASTBinaryExpression* expr) = 0;
-    virtual JSASTExpression* visit(JSASTMemberExpression* expr) = 0;
-    virtual JSASTExpression* visit(JSASTLiteral* expr) = 0;
-    virtual JSASTExpression* visit(JSASTArrayExpression* expr) = 0;
-    virtual JSASTExpression* visit(JSASTObjectExpression* expr) = 0;
-    virtual JSASTExpression* visit(JSASTFunctionExpression* expr) = 0;
-    virtual JSASTExpression* visit(JSASTNewExpression* expr) = 0;
-    virtual JSASTExpression* visit(JSASTUnaryExpression* expr) = 0;
-    virtual JSASTExpression* visit(JSASTUpdateExpression* expr) = 0;
-    virtual JSASTExpression* visit(JSASTVariableDeclarator* expr) = 0;    
-
-    virtual JSASTProperty* visit(JSASTProperty* property) = 0;
-    virtual JSASTStatement*  visit(JSASTLabeledStatement* property) = 0;
-
-    virtual JSASTComment* visit(JSASTComment* expr) = 0;
-
-};
-
-class JSASTTraversalVisitor : public JSASTVisitor
-{
-public:
-
-    virtual JSASTProgram* visit(JSASTProgram *program)
-    {
-        // this would cause recursion
-        // program->Accept(this);
-
-        unsigned count = program->GetCommentCount();
-        for (unsigned i = 0; i < count; i++)
-        {
-            JSASTComment* cmt = program->GetComment(i);
-            if (cmt)
-                cmt->Accept(this);
-        }
-
-
-        count = program->GetStatementCount();
-        for (unsigned i = 0; i < count; i++)
-        {
-            JSASTStatement* stmt = program->GetStatement(i);
-            if (stmt)
-                stmt->Accept(this);
-        }
-
-        return program;
-
-    }
-
-    virtual JSASTStatement* visit(JSASTForStatement *stmt)
-    {
-        if (stmt->GetInitVariable())
-            stmt->GetInitVariable()->Accept(this);
-        if (stmt->GetInitExpression())
-            stmt->GetInitExpression()->Accept(this);
-
-        if (stmt->GetTest())
-            stmt->GetTest()->Accept(this);
-
-        if (stmt->GetUpdate())
-            stmt->GetUpdate()->Accept(this);
-
-        if (stmt->GetBody())
-            stmt->GetBody()->Accept(this);
-
-        return stmt;
-
-    }
-
-    virtual JSASTStatement* visit(JSASTBlockStatement *block)
-    {
-        unsigned count = block->GetStatementCount();
-
-        for (unsigned i = 0; i < count; i++)
-        {
-            JSASTStatement* stmt = block->GetStatement(i);
-            if (stmt)
-                stmt->Accept(this);
-        }
-
-        return block;
-
-    }
-
-    virtual JSASTStatement* visit(JSASTExpressionStatement *stmt)
-    {
-        if (stmt->GetExpression())
-            stmt->GetExpression()->Accept(this);
-
-        return stmt;
-    }
-
-    virtual JSASTStatement* visit(JSASTIfStatement *stmt)
-    {
-        if (stmt->GetTest())
-            stmt->GetTest()->Accept(this);
-        if (stmt->GetConsequent())
-            stmt->GetConsequent()->Accept(this);
-        if (stmt->GetAlternate())
-            stmt->GetAlternate()->Accept(this);
-
-        return stmt;
-    }
-
-    virtual JSASTStatement* visit(JSASTFunctionDeclaration *stmt)
-    {
-        if (stmt->GetID())
-            stmt->GetID()->Accept(this);
-
-        for (unsigned i = 0; i < stmt->GetParamsCount(); i++)
-            stmt->GetParam(i)->Accept(this);
-
-        JSASTBlockStatement* body = stmt->GetBodyStatement();
-
-        if (body)
-            body->Accept(this);
-
-        return stmt;
-
-    }
-
-    virtual JSASTStatement* visit(JSASTVariableDeclaration *stmt)
-    {
-        for (unsigned i = 0; i < stmt->GetDeclarationsCount(); i++)
-            stmt->GetDeclaration(i)->Accept(this);
-
-        return stmt;
-    }
-
-    virtual JSASTStatement* visit(JSASTReturnStatement *stmt)
-    {
-        if (stmt->GetArgument())
-            stmt->GetArgument()->Accept(this);
-
-        return stmt;
-    }
-
-    virtual JSASTStatement* visit(JSASTEmptyStatement *stmt)
-    {
-        return stmt;
-    }
-
-    virtual JSASTExpression* visit(JSASTAssignmentExpression* expr)
-    {
-        if (expr->GetLeft())
-            expr->GetLeft()->Accept(this);
-
-        if (expr->GetRight())
-            expr->GetRight()->Accept(this);
-
-        return expr;
-
-    }
-
-    virtual JSASTExpression* visit(JSASTConditionalExpression *expr)
-    {
-        if (expr->GetTest())
-            expr->GetTest()->Accept(this);
-        if (expr->GetConsequent())
-            expr->GetConsequent()->Accept(this);
-        if (expr->GetAlternate())
-            expr->GetAlternate()->Accept(this);
-
-        return expr;
-    }
-
-
-    virtual JSASTExpression* visit(JSASTLogicalExpression* expr)
-    {
-        if (expr->GetLeft())
-            expr->GetLeft()->Accept(this);
-
-        if (expr->GetRight())
-            expr->GetRight()->Accept(this);
-
-        return expr;
-
-    }
-
-    virtual JSASTExpression* visit(JSASTIdentifier* expr)
-    {
-        return expr;
-    }
-
-    virtual JSASTExpression* visit(JSASTCallExpression* expr)
-    {
-        if (expr->GetCallee())
-            expr->GetCallee()->Accept(this);
-
-        for (unsigned i = 0; i < expr->GetArgumentCount(); i++)
-        {   if (expr->GetArgument(i))
-                expr->GetArgument(i)->Accept(this);
-        }
-
-        return expr;
-    }
-
-    virtual JSASTExpression* visit(JSASTBinaryExpression* expr)
-    {
-        if (expr->GetLeft())
-            expr->GetLeft()->Accept(this);
-
-        if (expr->GetRight())
-            expr->GetRight()->Accept(this);
-
-        return expr;
-
-    }
-
-    virtual JSASTExpression* visit(JSASTMemberExpression* expr)
-    {
-        if (expr->GetObject())
-            expr->GetObject()->Accept(this);
-
-        if (expr->GetProperty())
-            expr->GetProperty()->Accept(this);
-
-        return expr;
-
-    }
-
-    virtual JSASTExpression* visit(JSASTLiteral* expr)
-    {
-        return expr;
-    }
-
-    virtual JSASTExpression* visit(JSASTArrayExpression* expr)
-    {
-        for (unsigned i = 0; i < expr->GetElementCount(); i++)
-        {
-            JSASTExpression* arrayElement = expr->GetElement(i);
-            if (arrayElement)
-                arrayElement->Accept(this);
-        }
-
-        return expr;
-    }
-
-    virtual JSASTExpression* visit(JSASTObjectExpression* expr)
-    {
-        for (unsigned i = 0; i < expr->GetPropertyCount(); i++)
-        {
-            JSASTProperty* property = expr->GetProperty(i);
-
-            if (property)
-                property->Accept(this);
-        }
-
-        return expr;
-    }
-
-    virtual JSASTExpression* visit(JSASTFunctionExpression* expr)
-    {
-        if (expr->GetID())
-            expr->GetID()->Accept(this);
-
-        for (unsigned i = 0; i < expr->GetParamsCount(); i++)
-            expr->GetParam(i)->Accept(this);
-
-        JSASTBlockStatement* body = expr->GetBodyStatement();
-
-        if (body)
-            body->Accept(this);
-
-        return expr;
-
-    }
-
-    virtual JSASTExpression* visit(JSASTNewExpression* expr)
-    {
-        if (expr->GetCallee())
-            expr->GetCallee()->Accept(this);
-
-        for (unsigned i = 0; i < expr->GetArgumentCount(); i++)
-        {
-            if (expr->GetArgument(i))
-                expr->GetArgument(i)->Accept(this);
-        }
-
-        return expr;
-
-    }
-
-    virtual JSASTExpression* visit(JSASTUnaryExpression* expr)
-    {
-        if (expr->GetArgument())
-            expr->GetArgument()->Accept(this);
-
-        return expr;
-    }
-
-    virtual JSASTExpression* visit(JSASTUpdateExpression* expr)
-    {
-        if (expr->GetArgument())
-            expr->GetArgument()->Accept(this);
-
-        return expr;
-    }
-
-    virtual JSASTExpression* visit(JSASTVariableDeclarator* expr)
-    {
-        if (expr->GetID())
-            expr->GetID()->Accept(this);
-
-        if (expr->GetInit())
-            expr->GetInit()->Accept(this);
-
-
-        return expr;
-    }
-
-    virtual JSASTComment* visit(JSASTComment* comment)
-    {
-        return comment;
-    }
-
-    virtual JSASTProperty* visit(JSASTProperty* property)
-    {
-        if (property->GetKey())
-            property->GetKey()->Accept(this);
-        if (property->GetValue())
-            property->GetValue()->Accept(this);
-
-        return property;
-    }
-
-    virtual JSASTStatement* visit(JSASTLabeledStatement* labeledStatement)
-    {
-        if (labeledStatement->GetLabel())
-            labeledStatement->GetLabel()->Accept(this);
-        if (labeledStatement->GetBody())
-            labeledStatement->GetBody()->Accept(this);
-
-        return labeledStatement;
-    }
-
-
-    virtual JSASTExpression* visit(JSASTThisExpression* expr)
-    {
-        return expr;
-    }
-
-
-};
-
-
-
-}
-
-

+ 0 - 190
Attic/AtomicEditorReference/Source/Javascript/JSAutocomplete.cpp

@@ -1,190 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-#include <Atomic/IO/Log.h>
-#include "JSAutocomplete.h"
-
-
-namespace AtomicEditor
-{
-
-JSAutocomplete::JSAutocomplete(TBEditField* editField) :
-    editField_(editField),
-    styleEdit_(editField->GetStyleEdit()),
-    autoList_(0)
-{
-    autoList_ = new TBSelectList();
-    autoList_->SetSource(&autoSource_);
-
-    autoList_->SetSize(150, 100);
-    autoList_->SetIgnoreInput(true);
-
-    editField->AddChild(autoList_);
-
-    Hide();
-}
-
-bool JSAutocomplete::UpdateCompletions(const String& value)
-{
-    if (value == currentValue_)
-        return autoSource_.GetNumItems() > 0;
-
-    currentValue_ = value;
-
-    String lstring(value[0]);
-    if (!locals_.Contains(lstring))
-    {
-        return false;
-    }
-
-    autoSource_.DeleteAllItems();
-
-    const List<String>& tokens = locals_[lstring];
-
-    for (List<String>::ConstIterator i = tokens.Begin(); i != tokens.End(); ++i)
-    {
-        if (*i != value && i->StartsWith(value))
-        {
-            autoSource_.AddItem(new TBGenericStringItem(i->CString()));
-        }
-
-    }
-
-    autoList_->SetValue(0);
-
-    return autoSource_.GetNumItems() > 0;
-
-}
-
-void JSAutocomplete::UpdateLocals()
-{
-    TBBlock *block = styleEdit_->blocks.GetFirst();
-    while (block)
-    {
-        for (TBTextFragment* frag = block->fragments.GetFirst(); frag; frag = frag->GetNext())
-        {
-            if (frag->len > 3)
-            {
-                String lstring(frag->Str()[0]);
-
-                String token(frag->Str(), frag->len);
-
-                if (!locals_[lstring].Contains(token))
-                {
-                    //LOGINFOF("Adding Token %s to locals", token.CString());
-                    locals_[lstring].Push(token);
-                }
-
-            }
-
-        }
-
-        block = block->GetNext();
-    }
-}
-
-void JSAutocomplete::SetPosition(const TBPoint &pos)
-{
-    autoList_->SetPosition(pos);
-}
-
-bool JSAutocomplete::OnEvent(const TBWidgetEvent &ev)
-{
-    if (ev.type == EVENT_TYPE_KEY_DOWN)
-    {
-        if (ev.special_key == TB_KEY_UP)
-        {
-            int v = autoList_->GetValue() - 1;
-            if (v < 0)
-            {
-                styleEdit_->autocomplete_visible = false;
-                autoList_->SetVisibilility(WIDGET_VISIBILITY_INVISIBLE);
-                autoList_->SetValue(0);
-                return styleEdit_->KeyDown(ev.key, ev.special_key, ev.modifierkeys);
-
-            }
-            else
-            {
-                autoList_->SetValue(v);
-            }
-        }
-        else if (ev.special_key == TB_KEY_DOWN)
-        {
-            int v = autoList_->GetValue() + 1;
-            if (v >= autoList_->GetSource()->GetNumItems())
-            {
-                styleEdit_->autocomplete_visible = false;
-                autoList_->SetVisibilility(WIDGET_VISIBILITY_INVISIBLE);
-                autoList_->SetValue(0);
-                return styleEdit_->KeyDown(ev.key, ev.special_key, ev.modifierkeys);
-            }
-            else
-            {
-                autoList_->SetValue(v);
-            }
-        }
-        else if (ev.special_key == TB_KEY_ENTER || ev.special_key == TB_KEY_TAB)
-        {
-            TBStr str = autoList_->GetSource()->GetItemString(autoList_->GetValue());
-
-            TBTextFragment* fragment = 0;
-            int ofs = styleEdit_->caret.pos.ofs;
-            if (ofs >= 0)
-            {
-                fragment = styleEdit_->caret.pos.block->FindFragment(ofs, true);
-                if (fragment)
-                {
-                    int gofs = fragment->GetGlobalOfs();
-                    styleEdit_->selection.Select(gofs, gofs + fragment->len);
-                    styleEdit_->InsertText(str.CStr(), str.Length());
-                }
-            }
-
-            styleEdit_->autocomplete_visible = false;
-            autoList_->SetVisibilility(WIDGET_VISIBILITY_INVISIBLE);
-            autoList_->SetValue(0);
-
-            return true;
-        }
-        else if (ev.special_key == TB_KEY_ESC)
-        {
-            styleEdit_->autocomplete_visible = false;
-            autoList_->SetVisibilility(WIDGET_VISIBILITY_INVISIBLE);
-            autoList_->SetValue(0);
-            return true;
-        }
-
-    }
-
-    return false;
-}
-
-JSAutocomplete::~JSAutocomplete()
-{
-    autoList_->SetSource(NULL);
-    autoSource_.DeleteAllItems();
-}
-
-void JSAutocomplete::Show()
-{
-    styleEdit_->autocomplete_visible = true;
-    autoList_->SetVisibilility(WIDGET_VISIBILITY_VISIBLE);
-    autoList_->SetValue(0);
-}
-
-void JSAutocomplete::Hide()
-{
-    styleEdit_->autocomplete_visible = false;
-    autoList_->SetVisibilility(WIDGET_VISIBILITY_INVISIBLE);
-    autoList_->SetValue(0);
-}
-
-bool JSAutocomplete::Visible()
-{
-    return autoList_->GetVisibility() == WIDGET_VISIBILITY_VISIBLE;
-}
-
-
-}

+ 0 - 56
Attic/AtomicEditorReference/Source/Javascript/JSAutocomplete.h

@@ -1,56 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <Atomic/Container/Str.h>
-#include <Atomic/Container/HashMap.h>
-#include <Atomic/Container/List.h>
-#include <Atomic/Math/StringHash.h>
-
-#include <TurboBadger/tb_select.h>
-#include <TurboBadger/tb_editfield.h>
-#include <TurboBadger/tb_style_edit.h>
-
-using namespace Atomic;
-
-using namespace tb;
-
-namespace AtomicEditor
-{
-
-// per document autocompletion
-class JSAutocomplete
-{
-public:
-
-    JSAutocomplete(TBEditField* editField);
-
-    ~JSAutocomplete();
-
-    void Show();
-    void Hide();
-    bool Visible();
-
-    void SetPosition(const TBPoint& pos);
-    bool UpdateCompletions(const String& value);
-
-    bool OnEvent(const TBWidgetEvent &ev);
-
-    void UpdateLocals();
-
-private:
-
-    HashMap<StringHash, List<String> > locals_;
-
-    TBEditField* editField_;
-    TBStyleEdit* styleEdit_;
-    TBSelectList* autoList_;
-    TBGenericStringItemSource autoSource_;
-    String currentValue_;
-
-};
-
-
-}

+ 0 - 26
Attic/AtomicEditorReference/Source/Javascript/JSErrorChecker.cpp

@@ -1,26 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-#include <Atomic/Core/Context.h>
-#include "JSErrorChecker.h"
-
-namespace AtomicEditor
-{
-
-/// Construct.
-JSErrorChecker::JSErrorChecker(Context* context, duk_context *ctx) :
-    Object(context),
-    ctx_(ctx)
-{
-
-}
-
-/// Destruct.
-JSErrorChecker::~JSErrorChecker()
-{
-
-}
-
-}

+ 0 - 33
Attic/AtomicEditorReference/Source/Javascript/JSErrorChecker.h

@@ -1,33 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <Duktape/duktape.h>
-
-#include <Atomic/Core/Object.h>
-
-using namespace Atomic;
-
-namespace AtomicEditor
-{
-
-class JSErrorChecker : public Object
-{
-    OBJECT(JSErrorChecker);
-
-public:
-
-    /// Construct.
-    JSErrorChecker(Context* context, duk_context* ctx);
-    /// Destruct.
-    ~JSErrorChecker();
-
-private:
-
-    duk_context* ctx_;
-
-};
-
-}

+ 0 - 303
Attic/AtomicEditorReference/Source/Javascript/JSSpiderMonkeyVM.cpp

@@ -1,303 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#ifdef USE_SPIDERMONKEY
-
-#include "AtomicEditor.h"
-#include "/Users/josh/Desktop/SpiderMonkey/include/mozjs-37a1/jsapi.h"
-#include "js/RootingAPI.h"
-#include "JSSpiderMonkeyVM.h"
-
-using namespace JS;
-
-#include "Context.h"
-#include "FileSystem.h"
-#include "ResourceCache.h"
-#include "JSFile.h"
-
-static RootedObject* __global = NULL;
-
-// The class of the global object.
-static JSClass globalClass = {
-    "global",
-    JSCLASS_GLOBAL_FLAGS,
-    JS_PropertyStub,
-    JS_DeletePropertyStub,
-    JS_PropertyStub,
-    JS_StrictPropertyStub,
-    JS_EnumerateStub,
-    JS_ResolveStub,
-    JS_ConvertStub,
-    nullptr, nullptr, nullptr, nullptr,
-    JS_GlobalObjectTraceHook
-};
-
-// The error reporter callback.
-void reportError(JSContext *cx, const char *message, JSErrorReport *report) {
-    fprintf(stderr, "%s:%u:%s\n",
-            report->filename ? report->filename : "[no filename]",
-            (unsigned int) report->lineno,
-            message);
-}
-
-
-namespace AtomicEditor
-{
-
-
-
-WeakPtr<JSSpiderMonkeyVM> JSSpiderMonkeyVM::instance_;
-
-static bool
-print(JSContext *cx, unsigned argc, jsval *vp)
-{
-    JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
-
-    for (unsigned i = 0; i < args.length(); i++) {
-        JSString *str = JS::ToString(cx, args[i]);
-        if (!str)
-            return false;
-        char *bytes = JS_EncodeString(cx, str);
-        if (!bytes)
-            return false;
-        printf("%s%s", i ? " " : "", bytes);
-        JS_free(cx, bytes);
-    }
-
-    putchar('\n');
-    fflush(stdout);
-    args.rval().setUndefined();
-    return true;
-}
-
-JSSpiderMonkeyVM::JSSpiderMonkeyVM(Context* context) :
-    Object(context), runtime_(0), jscontext_(0),
-    autorequest_(0), autocompartment_(0)
-{
-    context_->RegisterSubsystem(this);
-    instance_ = this;
-
-    // Initialize the JS engine.
-    if (!JS_Init())
-    {
-        assert(0);
-    }
-
-    // Create a JS runtime.
-    runtime_ = JS_NewRuntime(32L * 1024L * 1024L);
-
-    if (runtime_)
-    {
-        jscontext_ = JS_NewContext(runtime_, 8192);
-        if (jscontext_)
-        {
-            JS_SetErrorReporter(runtime_, reportError);
-        }
-        else
-        {
-            assert(0);
-        }
-
-    }
-    else
-    {
-        assert(0);
-    }
-
-    // Enter a request before running anything in the context.
-    autorequest_ = new JSAutoRequest(jscontext_);
-
-    // Create the global object and a new compartment.
-    __global = new RootedObject(jscontext_);
-    *__global = JS_NewGlobalObject(jscontext_, &globalClass, nullptr,
-                                   JS::DontFireOnNewGlobalHook);
-    // Enter the new global object's compartment.
-    autocompartment_ = new JSAutoCompartment(jscontext_, *__global);
-
-    // Populate the global object with the standard globals, like Object and
-    // Array.
-    if (!JS_InitStandardClasses(jscontext_, *__global))
-    {
-        assert(0);
-    }
-
-    if (!JS_InitReflect(jscontext_, *__global))
-    {
-        assert(0);
-    }
-
-    JS_DefineFunction(jscontext_, *__global, "print", (JSNative) print, 0, 0);
-
-    ExecuteFile("AtomicEditor/javascript/modules/acorn_spidermonkey.js");
-
-}
-
-JSSpiderMonkeyVM::~JSSpiderMonkeyVM()
-{
-    instance_ = NULL;
-
-    if (autocompartment_)
-        delete autocompartment_;
-
-    if (__global)
-    {
-        delete __global;
-        __global = NULL;
-    }
-
-    if (autorequest_)
-        delete autorequest_;
-
-    // Shut everything down.
-    if (context_)
-        JS_DestroyContext(jscontext_);
-    if (runtime_)
-        JS_DestroyRuntime(runtime_);
-
-    JS_ShutDown();
-
-}
-
-bool JSSpiderMonkeyVM::ExecuteFile(const String& path)
-{
-    SharedPtr<JSFile> jsfile;
-    jsfile = GetSubsystem<ResourceCache>()->GetResource<JSFile>(path);
-
-    JS::RootedValue returnValue(jscontext_);
-
-    OwningCompileOptions options(jscontext_);
-
-    options.setFileAndLine(jscontext_, path.CString(), 0);
-    options.setCompileAndGo(true);
-    bool ok = JS::Evaluate(jscontext_, *__global, options,
-                           jsfile->GetSource(), strlen(jsfile->GetSource()), &returnValue);
-
-    return ok;
-
-}
-
-bool JSSpiderMonkeyVM::ParseJavascriptToJSON(const char* source, String& json)
-{
-    json.Clear();
-
-    bool ok = true;
-
-    JS::Rooted<JS::Value> v(jscontext_);
-    JS::RootedValue returnValue(jscontext_);
-    JS::RootedValue jsource(jscontext_, JS::StringValue(JS_NewStringCopyZ(jscontext_, source)));
-    JS_CallFunctionName(jscontext_, *__global, "__atomic_parse_to_json", HandleValueArray(jsource), &returnValue);
-
-    JS::RootedString hm(jscontext_);
-    hm = JS::ToString(jscontext_, returnValue);
-
-    const char* strjson = JS_EncodeStringToUTF8(jscontext_, hm);
-
-    json = strjson;
-
-    //printf("%s\n", strjson);
-
-    JS_free(jscontext_, (void *) strjson);
-
-    return ok;
-
-}
-
-
-bool JSSpiderMonkeyVM::ParseJavascriptToJSONWithSpiderMonkeyReflectAPI(const char* source, String& json)
-{
-    json.Clear();
-
-    bool ok = true;
-
-    JS::Rooted<JS::Value> v(jscontext_);
-    JS::RootedValue returnValue(jscontext_);
-    JS::RootedValue jsource(jscontext_, JS::StringValue(JS_NewStringCopyZ(jscontext_, source)));
-
-    // get the Reflect object
-    if (!JS_GetProperty(jscontext_, *__global, "Reflect", &v))
-        return false;
-
-    JS::RootedObject reflectObject(jscontext_);
-    JS_ValueToObject(jscontext_, v, &reflectObject);
-
-    JS_CallFunctionName(jscontext_, reflectObject, "parse", HandleValueArray(jsource), &returnValue);
-
-    JS::RootedObject jsonObject(jscontext_);
-    if (!JS_GetProperty(jscontext_, *__global, "JSON", &v))
-        return false;
-
-    JS_ValueToObject(jscontext_, v, &jsonObject);
-
-    // pretty printed, can remove for speed
-    JS::AutoValueArray<3> args(jscontext_);
-    args[0].set(returnValue);
-    args[1].set(JS::NullValue());
-    args[2].setNumber(3.0);
-
-    JS::RootedValue jjson(jscontext_);
-    JS_CallFunctionName(jscontext_, jsonObject, "stringify", HandleValueArray(args), &jjson);
-
-    JS::RootedString hm(jscontext_);
-    hm = JS::ToString(jscontext_, jjson);
-
-    const char* strjson = JS_EncodeStringToUTF8(jscontext_, hm);
-
-    json = strjson;
-
-    //printf("%s\n", strjson);
-
-    JS_free(jscontext_, (void *) strjson);
-
-    return ok;
-
-}
-
-bool JSSpiderMonkeyVM::ReadZeroTerminatedSourceFile(const String& path, String& source)
-{
-    File file(instance_->GetContext());
-    file.Open(path);
-
-    unsigned size = file.GetSize();
-
-    SharedArrayPtr<char> data;
-    data = new char[size + 1];
-    data[size] = '\0';
-    file.Read(data, size);
-
-    source = data;
-
-    return true;
-
-}
-
-
-}
-
-int run(JSContext *cx) {
-    // Enter a request before running anything in the context.
-    JSAutoRequest ar(cx);
-
-    // Create the global object and a new compartment.
-    RootedObject global(cx);
-    global = JS_NewGlobalObject(cx, &globalClass, nullptr,
-                                JS::DontFireOnNewGlobalHook);
-    if (!global)
-        return 1;
-
-    // Enter the new global object's compartment.
-    JSAutoCompartment ac(cx, global);
-
-    // Populate the global object with the standard globals, like Object and
-    // Array.
-    if (!JS_InitStandardClasses(cx, global))
-        return 1;
-
-    // Your application code here. This may include JSAPI calls to create your
-    // own custom JS objects and run scripts.
-
-    return 0;
-}
-
-#endif
-

+ 0 - 56
Attic/AtomicEditorReference/Source/Javascript/JSSpiderMonkeyVM.h

@@ -1,56 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#ifdef USE_SPIDERMONKEY
-#pragma once
-
-#include "Object.h"
-
-using namespace Atomic;
-
-struct JSRuntime;
-struct JSContext;
-class JSAutoRequest;
-class JSAutoCompartment;
-
-namespace AtomicEditor
-{
-
-// Notes: SpiderMonkey Reflect API is giving some bad loc's, which seems to be an issue with the
-// C++ generator not passing in tokens for some nodes (MemberExpression.property for example)
-// probably should use http://esprima.org/
-class JSSpiderMonkeyVM : public Object
-{
-    OBJECT(JSSpiderMonkeyVM);
-
-public:
-    /// Construct.
-    JSSpiderMonkeyVM(Context* context);
-    /// Destruct.
-    ~JSSpiderMonkeyVM();
-
-    bool ExecuteFile(const String& path);
-
-    bool ParseJavascriptToJSON(const char* source, String& json);
-
-    bool ParseJavascriptToJSONWithSpiderMonkeyReflectAPI(const char* source, String& json);
-
-private:
-
-    bool ReadZeroTerminatedSourceFile(const String& path, String& source);
-
-    // for access within duktape callbacks
-    static WeakPtr<JSSpiderMonkeyVM> instance_;
-
-    JSRuntime* runtime_;
-    JSContext* jscontext_;
-    JSAutoRequest* autorequest_;
-    JSAutoCompartment* autocompartment_;
-
-};
-
-
-}
-
-#endif

+ 0 - 5
Attic/AtomicEditorReference/Source/Javascript/JSTheme.cpp

@@ -1,5 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"

+ 0 - 182
Attic/AtomicEditorReference/Source/Javascript/JSTheme.h

@@ -1,182 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-namespace AtomicEditor
-{
-
-// //http://hilightjs.org
-
-enum JSThemeColor
-{
-    JSTHEME_NORMAL,
-    JSTHEME_LITERAL_STRING,
-    JSTHEME_LITERAL_BOOLEAN,
-    JSTHEME_LITERAL_NUMBER,
-    JSTHEME_LITERAL_REGEX,
-    JSTHEME_LITERAL_NULL,
-    JSTHEME_KEYWORD,
-    JSTHEME_OPERATOR,
-    JSTHEME_FUNCTION,
-    JSTHEME_VAR,
-    JSTHEME_CODE,
-    JSTHEME_COMMENT,
-    JSTHEME_FUNCTIONDECLARG
-};
-
-
-}
-/*
-
-.hljs {
-  display: block;
-  overflow-x: auto;
-  padding: 0.5em;
-  background: #23241f;
-  -webkit-text-size-adjust: none;
-}
-
-.hljs,
-.hljs-tag,
-.css .hljs-rules,
-.css .hljs-value,
-.aspectj .hljs-function,
-.css .hljs-function
-.hljs-preprocessor,
-.hljs-pragma {
-  color: #f8f8f2;
-}
-
-.hljs-strongemphasis,
-.hljs-strong,
-.hljs-emphasis {
-  color: #a8a8a2;
-}
-
-.hljs-bullet,
-.hljs-blockquote,
-.hljs-horizontal_rule,
-.hljs-number,
-.hljs-regexp,
-.alias .hljs-keyword,
-.hljs-literal,
-.hljs-hexcolor {
-  color: #ae81ff;
-}
-
-.hljs-tag .hljs-value,
-.hljs-code,
-.hljs-title,
-.css .hljs-class,
-.hljs-class .hljs-title:last-child {
-  color: #a6e22e;
-}
-
-.hljs-link_url {
-  font-size: 80%;
-}
-
-.hljs-strong,
-.hljs-strongemphasis {
-  font-weight: bold;
-}
-
-.hljs-emphasis,
-.hljs-strongemphasis,
-.hljs-class .hljs-title:last-child,
-.hljs-typename {
-  font-style: italic;
-}
-
-.hljs-keyword,
-.ruby .hljs-class .hljs-keyword:first-child,
-.ruby .hljs-function .hljs-keyword,
-.hljs-function,
-.hljs-change,
-.hljs-winutils,
-.hljs-flow,
-.nginx .hljs-title,
-.tex .hljs-special,
-.hljs-header,
-.hljs-attribute,
-.hljs-symbol,
-.hljs-symbol .hljs-string,
-.hljs-tag .hljs-title,
-.hljs-value,
-.alias .hljs-keyword:first-child,
-.css .hljs-tag,
-.css .unit,
-.css .hljs-important {
-  color: #f92672;
-}
-
-.hljs-function .hljs-keyword,
-.hljs-class .hljs-keyword:first-child,
-.hljs-aspect .hljs-keyword:first-child,
-.hljs-constant,
-.hljs-typename,
-.css .hljs-attribute {
-  color: #66d9ef;
-}
-
-.hljs-variable,
-.hljs-params,
-.hljs-class .hljs-title,
-.hljs-aspect .hljs-title {
-  color: #f8f8f2;
-}
-
-.hljs-string,
-.css .hljs-id,
-.hljs-subst,
-.hljs-type,
-.ruby .hljs-class .hljs-parent,
-.hljs-built_in,
-.django .hljs-template_tag,
-.django .hljs-variable,
-.smalltalk .hljs-class,
-.django .hljs-filter .hljs-argument,
-.smalltalk .hljs-localvars,
-.smalltalk .hljs-array,
-.hljs-attr_selector,
-.hljs-pseudo,
-.hljs-addition,
-.hljs-stream,
-.hljs-envvar,
-.apache .hljs-tag,
-.apache .hljs-cbracket,
-.tex .hljs-command,
-.hljs-prompt,
-.hljs-link_label,
-.hljs-link_url {
-  color: #e6db74;
-}
-
-.hljs-comment,
-.hljs-javadoc,
-.hljs-annotation,
-.hljs-decorator,
-.hljs-pi,
-.hljs-doctype,
-.hljs-deletion,
-.hljs-shebang,
-.apache .hljs-sqbracket,
-.tex .hljs-formula {
-  color: #75715e;
-}
-
-.coffeescript .javascript,
-.javascript .xml,
-.tex .hljs-formula,
-.xml .javascript,
-.xml .vbscript,
-.xml .css,
-.xml .hljs-cdata,
-.xml .php,
-.php .xml {
-  opacity: 0.5;
-}
-
-*/

+ 0 - 541
Attic/AtomicEditorReference/Source/License/AELicenseSystem.cpp

@@ -1,541 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-// BEGIN LICENSE MANAGEMENT
-
-#ifdef ATOMIC_PLATFORM_WINDOWS
-#ifndef _MSC_VER
-#define _WIN32_IE 0x501
-#endif
-#include <windows.h>
-#include <shellapi.h>
-#include <direct.h>
-#include <shlobj.h>
-#include <sys/types.h>
-#include <sys/utime.h>
-#endif
-
-#include "AtomicEditor.h"
-#include <Atomic/Core/CoreEvents.h>
-#include <Atomic/Core/Context.h>
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/IO/File.h>
-#include <Atomic/IO/Log.h>
-
-#include "AtomicEditor.h"
-#include "AEEditor.h"
-#include "AEEvents.h"
-#include "AELicenseSystem.h"
-
-#include "UI/Modal/UIModalOps.h"
-#include "UI/Modal/UIMessageModal.h"
-
-#include "UI/UIMainFrame.h"
-
-#include <Poco/MD5Engine.h>
-#include <Poco/File.h>
-
-namespace AtomicEditor
-{
-
-LicenseSystem::LicenseSystem(Context* context) :
-    Object(context)
-    , eulaAgreementConfirmed_(false)
-
-{
-    ResetLicense();
-
-    SubscribeToEvent(E_EDITORSHUTDOWN, HANDLER(LicenseSystem, HandleEditorShutdown));
-}
-
-LicenseSystem::~LicenseSystem()
-{
-
-}
-
-void LicenseSystem::Initialize()
-{
-
-    FileSystem* filesystem = GetSubsystem<FileSystem>();
-    String eulaConfirmedFilePath = filesystem->GetAppPreferencesDir("AtomicEditor", "License");
-    eulaConfirmedFilePath = AddTrailingSlash(eulaConfirmedFilePath);
-    eulaConfirmedFilePath += "EulaConfirmed";
-
-    eulaAgreementConfirmed_ = filesystem->FileExists(eulaConfirmedFilePath);
-
-    if (!LoadLicense() || !key_.Length() || !eulaAgreementConfirmed_)
-    {
-        ResetLicense();
-        UIModalOps* ops = GetSubsystem<UIModalOps>();
-
-        if (eulaAgreementConfirmed_)
-            ops->ShowActivation();
-        else
-            ops->ShowEulaAgreement();
-    }
-    else
-    {
-        RequestServerVerification(key_);
-    }
-}
-
-void LicenseSystem::LicenseAgreementConfirmed()
-{
-    eulaAgreementConfirmed_ = true;
-
-    FileSystem* filesystem = GetSubsystem<FileSystem>();
-    String eulaConfirmedFilePath = filesystem->GetAppPreferencesDir("AtomicEditor", "License");
-    eulaConfirmedFilePath = AddTrailingSlash(eulaConfirmedFilePath);
-    eulaConfirmedFilePath += "EulaConfirmed";
-
-    SharedPtr<File> file(new File(context_, eulaConfirmedFilePath, FILE_WRITE));
-    file->WriteInt(1);
-    file->Close();
-
-    UIModalOps* ops = GetSubsystem<UIModalOps>();
-    ops->ShowActivation();
-}
-
-String LicenseSystem::GenerateMachineID()
-{
-#if defined(ATOMIC_PLATFORM_OSX) || defined(ATOMIC_PLATFORM_LINUX)
-    String path = getenv("HOME");
-#else
-    wchar_t pathName[MAX_PATH];
-    pathName[0] = 0;
-    SHGetSpecialFolderPathW(0, pathName, CSIDL_PERSONAL, 0);
-    String path(pathName);
-#endif
-
-    Poco::MD5Engine md5;
-    md5.update(path.CString(), path.Length());
-    String id = Poco::MD5Engine::digestToHex(md5.digest()).c_str();
-    return id;
-}
-
-void LicenseSystem::ResetLicense()
-{
-    key_ = "";
-    licenseWindows_ = false;
-    licenseMac_ = false;
-    licenseAndroid_ = false;
-    licenseIOS_ = false;
-    licenseHTML5_ = false;
-    licenseModule3D_ = false;
-
-}
-
-bool LicenseSystem::LoadLicense()
-{
-
-    ResetLicense();
-
-    FileSystem* filesystem = GetSubsystem<FileSystem>();
-    String licenseFilePath = filesystem->GetAppPreferencesDir("AtomicEditor", "License");
-    licenseFilePath = AddTrailingSlash(licenseFilePath);
-    licenseFilePath += "AtomicLicense";
-
-    if (!filesystem->FileExists(licenseFilePath))
-        return false;
-
-    SharedPtr<File> file(new File(context_, licenseFilePath, FILE_READ));
-
-    file->ReadInt(); // version
-
-    String key = file->ReadString();
-    if (!ValidateKey(key))
-        return false;
-
-    key_ = key;
-
-    licenseWindows_ = file->ReadBool();
-    licenseMac_ = file->ReadBool();
-    licenseAndroid_ = file->ReadBool();
-    licenseIOS_ = file->ReadBool();
-    licenseHTML5_ = file->ReadBool();
-    licenseModule3D_ = file->ReadBool();
-
-    return true;
-}
-
-bool LicenseSystem::ValidateKey(const String& key)
-{
-    if (!key.StartsWith("ATOMIC-"))
-        return false;
-
-    Vector<String> elements = key.Split('-');
-    if (elements.Size() != 5)
-        return false;
-
-    for (unsigned i = 1; i < elements.Size(); i++)
-    {
-        String element = elements[i];
-        if (element.Length() != 4)
-            return false;
-
-        for (unsigned j = 0; j < 4; j++)
-        {
-            char c = element[j];
-            if ((c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9'))
-                continue;
-            return false;
-        }
-    }
-
-    return true;
-}
-
-
-void LicenseSystem::SaveLicense()
-{
-    FileSystem* filesystem = GetSubsystem<FileSystem>();
-    String licenseFilePath = filesystem->GetAppPreferencesDir("AtomicEditor", "License");
-    licenseFilePath = AddTrailingSlash(licenseFilePath);
-
-    if (!filesystem->DirExists(licenseFilePath))
-    {
-        Poco::File dirs(licenseFilePath.CString());
-        dirs.createDirectories();
-    }
-
-    licenseFilePath += "AtomicLicense";
-
-    SharedPtr<File> file(new File(context_, licenseFilePath, FILE_WRITE));
-    file->WriteInt(1); // version
-    file->WriteString(key_);
-
-    file->WriteBool(licenseWindows_);
-    file->WriteBool(licenseMac_);
-    file->WriteBool(licenseAndroid_);
-    file->WriteBool(licenseIOS_);
-    file->WriteBool(licenseHTML5_);
-    file->WriteBool(licenseModule3D_);
-
-    file->Close();
-
-}
-
-void LicenseSystem::RemoveLicense()
-{
-    FileSystem* filesystem = GetSubsystem<FileSystem>();
-
-    String licenseFilePath = filesystem->GetAppPreferencesDir("AtomicEditor", "License");
-    licenseFilePath = AddTrailingSlash(licenseFilePath);
-    licenseFilePath += "AtomicLicense";
-
-    if (filesystem->FileExists(licenseFilePath))
-    {
-        filesystem->Delete(licenseFilePath);
-    }
-}
-
-bool LicenseSystem::IsStandardLicense()
-{
-    return !licenseAndroid_;
-}
-
-
-void LicenseSystem::RequestServerVerification(const String& key)
-{
-    if (serverVerification_.NotNull())
-    {
-        LOGERROR("LicenseSystem::RequestServerLicense - request already exists");
-        return;
-    }
-
-    key_ = key;
-    CurlManager* cm = GetSubsystem<CurlManager>();
-    String post;
-    String id = GenerateMachineID();
-    post.AppendWithFormat("key=%s&id=%s", key.CString(), id.CString());
-
-    serverVerification_ = cm->MakeRequest("https://store.atomicgameengine.com/licenses/license_verify.php", post);
-
-    SubscribeToEvent(serverVerification_, E_CURLCOMPLETE, HANDLER(LicenseSystem, HandleVerification));
-}
-
-int LicenseSystem::ParseResponse(const String& response, LicenseParse& parse)
-{
-
-    if (response.StartsWith("AC_ACTIVATIONSEXCEEDED"))
-    {
-        return 1;
-    }
-
-    if (response.StartsWith("AC_IDNOTACTIVATED"))
-    {
-        return 4;
-    }
-
-    if (response.StartsWith("AC_FAILED"))
-    {
-        return 2;
-    }
-
-    if (!response.StartsWith("WINDOWS"))
-    {
-        LOGERRORF("Error Parsing Server Response %s", response.CString());
-        return 3;
-    }
-
-    String codes = response;
-    codes.Replace("\n", "");
-    codes.Replace("\r", "");
-
-    Vector<String> cvector = codes.Split(' ');
-
-    for (unsigned i = 0; i < cvector.Size(); i++)
-    {
-        Vector<String> feature = cvector[i].Split('=');
-        if (feature.Size() != 2)
-            continue;
-
-        if (feature[0] == "WINDOWS")
-            parse.licenseWindows_ = !feature[1].StartsWith("0");
-        else if (feature[0] == "MAC")
-            parse.licenseMac_ = !feature[1].StartsWith("0");
-        else if (feature[0] == "ANDROID")
-            parse.licenseAndroid_ = !feature[1].StartsWith("0");
-        else if (feature[0] == "IOS")
-            parse.licenseIOS_ = !feature[1].StartsWith("0");
-        else if (feature[0] == "HTML5")
-            parse.licenseHTML5_ = !feature[1].StartsWith("0");
-        else if (feature[0] == "THREED")
-            parse.licenseModule3D_ = !feature[1].StartsWith("0");
-
-    }
-
-    return 0;
-
-}
-
-bool LicenseSystem::RequestPlatformChange(AEEditorPlatform platform)
-{
-
-    if (platform == AE_PLATFORM_HTML5 && LicenseHTML5())
-        return true;
-
-    if (platform == AE_PLATFORM_IOS && LicenseIOS())
-        return true;
-
-    if (platform == AE_PLATFORM_WINDOWS && LicenseWindows())
-        return true;
-
-    if (platform == AE_PLATFORM_MAC && LicenseMac())
-        return true;
-
-    if (platform == AE_PLATFORM_ANDROID && LicenseAndroid())
-        return true;
-
-#ifdef ATOMIC_PLATFORM_OSX
-    if (platform == AE_PLATFORM_MAC)
-        return true;
-#else
-    if (platform == AE_PLATFORM_WINDOWS)
-        return true;
-#endif
-
-    return false;
-
-}
-
-void LicenseSystem::Activate(const String& key, const LicenseParse& parse)
-{
-    key_ = key;
-
-    licenseWindows_ = parse.licenseWindows_;
-    licenseMac_ = parse.licenseMac_;
-    licenseAndroid_ = parse.licenseAndroid_;
-    licenseIOS_= parse.licenseIOS_;
-    licenseHTML5_= parse.licenseHTML5_;
-    licenseModule3D_= parse.licenseModule3D_;
-
-    SaveLicense();
-}
-
-SharedPtr<CurlRequest>& LicenseSystem::Deactivate()
-{
-    if (deactivate_.NotNull())
-    {
-        LOGERROR("LicenseSystem::Deactivate - request already exists");
-        return deactivate_;
-    }
-
-    if (!key_.Length())
-    {
-        LOGERROR("LicenseSystem::Deactivate - zero length key");
-        return deactivate_;
-    }
-
-    CurlManager* cm = GetSubsystem<CurlManager>();
-    String post;
-    String id = GenerateMachineID();
-    post.AppendWithFormat("key=%s&id=%s", key_.CString(), id.CString());
-
-    deactivate_ = cm->MakeRequest("https://store.atomicgameengine.com/licenses/license_deactivate.php", post);
-
-    SubscribeToEvent(deactivate_, E_CURLCOMPLETE, HANDLER(LicenseSystem, HandleDeactivate));
-
-    return deactivate_;
-
-}
-
-void LicenseSystem::HandleVerification(StringHash eventType, VariantMap& eventData)
-{
-
-    CurlRequest* request = (CurlRequest*) (eventData[CurlComplete::P_CURLREQUEST].GetPtr());
-
-    if (serverVerification_.NotNull())
-    {
-        assert(request == serverVerification_);
-
-        if (serverVerification_->GetError().Length())
-        {
-            LOGERRORF("Unable to verify with server: %s", serverVerification_->GetError().CString());
-        }
-        else
-        {
-            LicenseParse parse;
-            int code = ParseResponse(serverVerification_->GetResponse(), parse);
-
-            // Not activated
-            if (code == 4)
-            {
-
-            }
-            else if (code == 2)
-            {
-                // something is wrong with the key
-                LOGERRORF("Error with product key");
-
-                RemoveLicense();
-                ResetLicense();
-                UIModalOps* ops = GetSubsystem<UIModalOps>();
-                ops->Hide();
-                ops->ShowActivation();
-
-            }
-            else if (code == 3)
-            {
-                // something is wrong on the activation server
-                key_ = "";
-            }
-            else if (code == 1)
-            {
-                // exceeded code, should not happen here as we aren't activating
-                key_ = "";
-            }
-            else if (code == 0)
-            {
-                // we should raise an error if there is a mismatch between local and server keys
-                // when the local says there are more enabled than server?
-                // otherwise, they could be being added
-
-                bool mismatch = false;
-
-                if (parse.licenseWindows_ != licenseWindows_)
-                    mismatch = true;
-
-                if (parse.licenseMac_ != licenseMac_)
-                    mismatch = true;
-
-                if (parse.licenseWindows_ != licenseWindows_)
-                    mismatch = true;
-
-                if (parse.licenseAndroid_ != licenseAndroid_)
-                    mismatch = true;
-
-                if (parse.licenseIOS_ != licenseIOS_)
-                    mismatch = true;
-
-                if (parse.licenseHTML5_ != licenseHTML5_)
-                    mismatch = true;
-
-                if (parse.licenseModule3D_ != licenseModule3D_)
-                    mismatch = true;
-
-                if (mismatch)
-                {
-                    LOGERROR("License Mismatch, reseting");
-                    licenseWindows_ = parse.licenseWindows_;
-                    licenseMac_ = parse.licenseMac_;
-                    licenseAndroid_ = parse.licenseAndroid_;
-                    licenseIOS_= parse.licenseIOS_;
-                    licenseHTML5_= parse.licenseHTML5_;
-                    licenseModule3D_= parse.licenseModule3D_;
-
-                    SaveLicense();
-                }
-
-                //if (!HasPlatformLicense())
-                //{
-                //    UIModalOps* ops = GetSubsystem<UIModalOps>();
-                //    if (!ops->ModalActive())
-                //        ops->ShowPlatformsInfo();
-
-               // }
-
-            }
-
-        }
-
-        UnsubscribeFromEvents(serverVerification_);
-        serverVerification_ = 0;
-    }
-
-}
-
-void LicenseSystem::HandleDeactivate(StringHash eventType, VariantMap& eventData)
-{
-    Editor* editor = GetSubsystem<Editor>();
-
-    CurlRequest* request = (CurlRequest*) (eventData[CurlComplete::P_CURLREQUEST].GetPtr());
-
-    if (deactivate_.NotNull())
-    {
-        assert(request == deactivate_);
-
-        if (deactivate_->GetError().Length())
-        {
-            String msg;
-            msg.AppendWithFormat("Unable to deactivate with server: %s", deactivate_->GetError().CString());
-            editor->PostModalError("Deactivation Error", msg);
-            LOGERROR(msg);
-        }
-        else
-        {
-            String response = request->GetResponse();
-            if (response.StartsWith("AC_FAILED"))
-            {
-                String msg;
-                msg.AppendWithFormat("Unable to deactivate with server: %s", response.CString());
-                editor->PostModalError("Deactivation Error", msg);
-                LOGERROR(msg);
-            }
-            else if (response.StartsWith("AC_NOTACTIVATED") || response.StartsWith("AC_SUCCESS"))
-            {
-                ResetLicense();
-                RemoveLicense();
-
-                UIModalOps* ops = GetSubsystem<UIModalOps>();
-                ops->Hide();
-                ops->ShowActivation();
-            }
-
-        }
-
-        UnsubscribeFromEvents(deactivate_);
-        deactivate_ = 0;
-    }
-
-}
-
-void LicenseSystem::HandleEditorShutdown(StringHash eventType, VariantMap& eventData)
-{
-    context_->RemoveSubsystem(GetType());
-}
-
-}
-
-// END LICENSE MANAGEMENT

+ 0 - 112
Attic/AtomicEditorReference/Source/License/AELicenseSystem.h

@@ -1,112 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-// BEGIN LICENSE MANAGEMENT
-
-#pragma once
-
-#include <Atomic/Core/Object.h>
-#include "../AETypes.h"
-
-#include "Net/CurlManager.h"
-
-using namespace Atomic;
-
-namespace AtomicEditor
-{
-
-class LicenseSystem : public Object
-{
-    OBJECT(LicenseSystem);
-
-public:
-
-    struct LicenseParse
-    {
-        bool licenseWindows_;
-        bool licenseMac_;
-        bool licenseAndroid_;
-        bool licenseIOS_;
-        bool licenseHTML5_;
-        bool licenseModule3D_;
-
-        LicenseParse()
-        {
-            licenseWindows_ = false;
-            licenseMac_ = false;
-            licenseAndroid_ = false;
-            licenseIOS_ = false;
-            licenseHTML5_ = false;
-            licenseModule3D_ = false;
-        }
-    };
-
-
-    /// Construct.
-    LicenseSystem(Context* context);
-    /// Destruct.
-    virtual ~LicenseSystem();
-
-    void Initialize();
-
-    bool LicenseWindows() { return licenseWindows_; }
-    bool LicenseMac() { return licenseMac_; }
-    bool LicenseAndroid() { return licenseAndroid_; }
-    bool LicenseIOS() { return licenseIOS_; }
-    bool LicenseHTML5() { return licenseHTML5_; }
-    bool LicenseModule3D() { return licenseModule3D_; }
-
-    /// Returns whether there are any platform licenses available
-    bool IsStandardLicense();
-
-    bool RequestPlatformChange(AEEditorPlatform platform);
-
-    void Activate(const String& key, const LicenseParse& parse);
-    SharedPtr<CurlRequest>& Deactivate();
-
-    void ResetLicense();
-
-    /// Basic key validation
-    bool ValidateKey(const String &key);
-
-    const String& GetKey() { return key_; }
-    String GenerateMachineID();
-    String GetEmail() { return email_;}
-
-    void LicenseAgreementConfirmed();
-
-    int ParseResponse(const String& response, LicenseParse &parse);
-
-private:
-
-    void RequestServerVerification(const String& key);
-
-    bool LoadLicense();
-    void SaveLicense();
-    void RemoveLicense();
-
-    void HandleVerification(StringHash eventType, VariantMap& eventData);
-    void HandleDeactivate(StringHash eventType, VariantMap& eventData);
-    void HandleEditorShutdown(StringHash eventType, VariantMap& eventData);
-
-    bool eulaAgreementConfirmed_;
-
-    String key_;
-    String email_;
-    bool licenseWindows_;
-    bool licenseMac_;
-    bool licenseAndroid_;
-    bool licenseIOS_;
-    bool licenseHTML5_;
-    bool licenseModule3D_;
-
-    SharedPtr<CurlRequest> serverVerification_;
-    SharedPtr<CurlRequest> deactivate_;
-
-
-};
-
-}
-
-// END LICENSE MANAGEMENT

+ 0 - 145
Attic/AtomicEditorReference/Source/License/AEVersionCheck.cpp

@@ -1,145 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include <rapidjson/document.h>
-#include <rapidjson/filestream.h>
-#include <rapidjson/prettywriter.h>
-
-#include "AtomicEditor.h"
-#include <Atomic/Core/Context.h>
-#include <Atomic/IO/Log.h>
-#include "AEEditor.h"
-#include "AEEvents.h"
-#include "AEVersion.h"
-#include "AEVersionCheck.h"
-
-namespace AtomicEditor
-{
-
-VersionCheck::VersionCheck(Context* context) :
-    Object(context)
-
-{
-    SubscribeToEvent(E_EDITORSHUTDOWN, HANDLER(VersionCheck, HandleEditorShutdown));
-    progressModal_ = new ProgressModal(context_, "Checking for Updates", "Checking for updates, please wait...");
-}
-
-VersionCheck::~VersionCheck()
-{
-
-}
-
-void VersionCheck::DoVersionCheck()
-{
-    progressModal_->Show();
-
-    CurlManager* cm = GetSubsystem<CurlManager>();
-
-    versionRequest_ = cm->MakeRequest("https://store.atomicgameengine.com/versions/atomic_editor.html");
-
-    SubscribeToEvent(versionRequest_, E_CURLCOMPLETE, HANDLER(VersionCheck, HandleCurlComplete));
-
-}
-
-void VersionCheck::HandleCurlComplete(StringHash eventType, VariantMap& eventData)
-{
-    progressModal_->Hide();
-
-    Editor* editor = GetSubsystem<Editor>();
-
-    bool valid = true;
-    int major;
-    int minor;
-    int patch;
-
-    if (versionRequest_->GetError().Length())
-    {
-        valid = false;
-    }
-    else
-    {
-        rapidjson::Document document;
-        String json = versionRequest_->GetResponse();
-
-        if (document.Parse<0>(json.CString()).HasParseError())
-        {
-            valid = false;
-        }
-        else
-        {
-            const rapidjson::Value::Member* jmajor = document.FindMember("major");
-            if (jmajor && jmajor->value.IsInt())
-            {
-                major = jmajor->value.GetInt();
-            }
-            else
-                valid = false;
-
-            const rapidjson::Value::Member* jminor = document.FindMember("minor");
-            if (jminor && jminor->value.IsInt())
-            {
-                minor = jminor->value.GetInt();
-            }
-            else
-                valid = false;
-
-            const rapidjson::Value::Member* jpatch = document.FindMember("patch");
-            if (jpatch && jpatch->value.IsInt())
-            {
-                patch = jpatch->value.GetInt();
-            }
-            else
-                valid = false;
-
-        }
-
-    }
-
-    if (!valid)
-    {
-        String errorMessage;
-        errorMessage.AppendWithFormat("There was an error contacting the version server\n\n%s", versionRequest_->GetError().CString());
-        editor->PostModalError("Error Contacting Version Server", errorMessage);
-    }
-    else
-    {
-        bool newer = false;
-        if (ATOMIC_EDITOR_VERSION_MAJOR < major)
-            newer = true;
-        else if (ATOMIC_EDITOR_VERSION_MINOR < minor)
-            newer = true;
-        else if (ATOMIC_EDITOR_VERSION_PATCH < patch)
-            newer = true;
-
-        if (newer)
-        {
-            editor->PostModalInfo("New Version Available", "There is a newer version of the Atomic Editor available");
-        }
-        else
-        {
-            editor->PostModalInfo("Up to date", "The Atomic Editor is up to date");
-        }
-
-    }
-
-    versionRequest_ = 0;
-
-}
-
-void VersionCheck::HandleEditorShutdown(StringHash eventType, VariantMap& eventData)
-{
-    context_->RemoveSubsystem(GetType());
-}
-
-/*
-{
-    "major" : 0,
-    "minor" : 2,
-    "patch" : 0
-}
-*/
-
-
-}
-

+ 0 - 37
Attic/AtomicEditorReference/Source/License/AEVersionCheck.h

@@ -1,37 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include <Atomic/Core/Object.h>
-
-#include "AETypes.h"
-#include "Net/CurlManager.h"
-#include "UI/Modal/UIProgressModal.h"
-
-using namespace Atomic;
-
-namespace AtomicEditor
-{
-
-class VersionCheck : public Object
-{
-    OBJECT(VersionCheck);
-
-public:
-
-    /// Construct.
-    VersionCheck(Context* context);
-    /// Destruct.
-    virtual ~VersionCheck();
-
-    void DoVersionCheck();
-
-private:
-    void HandleEditorShutdown(StringHash eventType, VariantMap& eventData);
-    void HandleCurlComplete(StringHash eventType, VariantMap& eventData);
-
-    SharedPtr<CurlRequest> versionRequest_;
-    SharedPtr<ProgressModal> progressModal_;
-};
-
-}

+ 0 - 180
Attic/AtomicEditorReference/Source/License/UIActivation.cpp

@@ -1,180 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-// BEGIN LICENSE MANAGEMENT
-
-#include "AtomicEditor.h"
-
-#include <TurboBadger/tb_window.h>
-#include <TurboBadger/tb_select.h>
-#include <TurboBadger/tb_editfield.h>
-
-#include <Atomic/Core/Context.h>
-#include <Atomic/IO/Log.h>
-#include <Atomic/UI/UI.h>
-
-#include "../Resources/AEResourceOps.h"
-#include "../AEPreferences.h"
-
-#include "../AEEditor.h"
-#include "../AEEvents.h"
-#include "../Project/AEProject.h"
-#include "../Project/ProjectUtils.h"
-
-#include "UIActivation.h"
-#include "AELicenseSystem.h"
-
-namespace AtomicEditor
-{
-
-// UIBuildSettings------------------------------------------------
-
-UIActivation::UIActivation(Context* context):
-    UIModalOpWindow(context),
-    licenseKey_(0)
-{
-    UI* tbui = GetSubsystem<UI>();
-    window_->SetSettings(WINDOW_SETTINGS_DEFAULT & ~WINDOW_SETTINGS_CLOSE_BUTTON);
-    window_->SetText("Product Activation");
-    tbui->LoadResourceFile(window_->GetContentRoot(), "AtomicEditor/editor/ui/activation.tb.txt");
-
-    licenseKey_ = delegate_->GetWidgetByIDAndType<TBEditField>(TBIDC("license_key"));
-    assert(licenseKey_);
-
-    window_->ResizeToFitContent();
-    Center();
-
-    progressModal_ = new ProgressModal(context_, "Activation", "Activating, please wait...");
-}
-
-UIActivation::~UIActivation()
-{
-
-}
-
-void UIActivation::RequestServerActivation(const String& key)
-{
-    if (serverActivation_.NotNull())
-    {
-        LOGERROR("UIActivation::RequestServerActivation - request already exists");
-        return;
-    }
-
-    LicenseSystem* licenseSystem = GetSubsystem<LicenseSystem>();
-
-    key_ = key;
-    CurlManager* cm = GetSubsystem<CurlManager>();
-    String post;
-    String id = licenseSystem->GenerateMachineID();
-    post.AppendWithFormat("key=%s&id=%s", key.CString(), id.CString());
-
-    // todo, this should be a verify url (shouldn't auto add id)
-    serverActivation_ = cm->MakeRequest("https://store.atomicgameengine.com/licenses/license_activate.php", post);
-
-    SubscribeToEvent(serverActivation_, E_CURLCOMPLETE, HANDLER(UIActivation, HandleCurlComplete));
-}
-
-
-bool UIActivation::OnEvent(const TBWidgetEvent &ev)
-{
-    Editor* editor = GetSubsystem<Editor>();
-    LicenseSystem* licenseSystem = GetSubsystem<LicenseSystem>();
-
-    if (ev.type == EVENT_TYPE_CLICK)
-    {
-        if (ev.target->GetID() == TBIDC("get_key"))
-        {
-            FileSystem* fileSystem = GetSubsystem<FileSystem>();
-            fileSystem->SystemOpen("https://store.atomicgameengine.com/site");
-        }
-        else if (ev.target->GetID() == TBIDC("quit"))
-        {
-            editor->RequestExit();
-        }
-        else if (ev.target->GetID() == TBIDC("activate"))
-        {
-            TBStr _key;
-            licenseKey_->GetText(_key);
-            String key = _key.CStr();
-            key = key.ToUpper().Trimmed();
-            if (!licenseSystem->ValidateKey(key))
-            {
-                editor->PostModalError("Invalid Product Key",
-                                       "The key entered is invalid\n\nProduct keys are in the form of ATOMIC-XXXX-XXXX-XXXX-XXXX");
-            }
-            else
-            {
-                progressModal_->Show();
-                RequestServerActivation(key);
-            }
-
-            return true;
-        }
-    }
-
-
-    return false;
-}
-
-void UIActivation::HandleCurlComplete(StringHash eventType, VariantMap& eventData)
-{
-    // we want to stay alive through the call, though will be swapped for success modal
-    SharedPtr<UIModalOpWindow> keepAlive(this);
-
-    Editor* editor = GetSubsystem<Editor>();
-    LicenseSystem* licenseSystem = GetSubsystem<LicenseSystem>();
-
-
-    progressModal_->Hide();
-
-    if (serverActivation_->GetError().Length())
-    {
-        String errorMessage;
-        errorMessage.AppendWithFormat("There was an error contacting the activation server\n\n%s", serverActivation_->GetError().CString());
-        editor->PostModalError("Error Contacting Activation Server", errorMessage);
-    }
-    else
-    {
-        LicenseSystem::LicenseParse parse;
-        int code = licenseSystem->ParseResponse(serverActivation_->GetResponse(), parse);
-
-        if (code == 0)
-        {
-
-            licenseSystem->Activate(key_, parse);
-
-            UIModalOps* ops = GetSubsystem<UIModalOps>();
-            ops->Hide();
-            ops->ShowActivationSuccess();
-
-        }
-        else if (code == 1)
-        {
-            editor->PostModalError("Activations Exceeded",
-                            "This key has 2 activations in use.\n\nPlease return a license from Atomic Editor - Manage License menu on one of these active computers.\n\nIf you are unable to do so, please contact [email protected] providing the key to reset it");
-        }
-        else if (code == 2)
-        {
-            editor->PostModalError("License Error",
-                            "There was a problem with the license key.\n\nPlease check the key and try again.\n\nIf the problem persists please contact [email protected]");
-
-        }
-        else if (code == 3)
-        {
-            editor->PostModalError("Activation Server Error",
-                            "There was an error on the activation server\n\nIf the problem persists please contact [email protected]");
-
-        }
-
-    }
-
-    UnsubscribeFromEvents(serverActivation_);
-    serverActivation_ = 0;
-
-
-}
-
-}
-
-// END LICENSE MANAGEMENT

+ 0 - 47
Attic/AtomicEditorReference/Source/License/UIActivation.h

@@ -1,47 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-// BEGIN LICENSE MANAGEMENT
-
-#pragma once
-
-#include "UI/Modal/UIModalOps.h"
-#include "UI/Modal/UIProgressModal.h"
-#include "Net/CurlManager.h"
-
-#include <TurboBadger/tb_select.h>
-#include <TurboBadger/tb_select_item.h>
-
-namespace AtomicEditor
-{
-
-class UIActivation: public UIModalOpWindow
-{
-    OBJECT(UIActivation);
-
-public:
-
-    UIActivation(Context* context);
-    virtual ~UIActivation();
-    bool OnEvent(const TBWidgetEvent &ev);
-
-private:
-
-    void RequestServerActivation(const String& key);
-
-    void HandleCurlComplete(StringHash eventType, VariantMap& eventData);
-
-    TBEditField* licenseKey_;
-    String key_;
-
-    SharedPtr<CurlRequest> serverActivation_;
-
-    SharedPtr<ProgressModal> progressModal_;
-
-
-};
-
-}
-
-// END LICENSE MANAGEMENT

+ 0 - 82
Attic/AtomicEditorReference/Source/License/UIActivationSuccess.cpp

@@ -1,82 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-// BEGIN LICENSE MANAGEMENT
-
-#include "AtomicEditor.h"
-
-#include <TurboBadger/tb_window.h>
-#include <TurboBadger/tb_select.h>
-#include <TurboBadger/tb_editfield.h>
-
-#include <Atomic/Core/Context.h>
-#include <Atomic/UI/UI.h>
-
-#include "../Resources/AEResourceOps.h"
-#include "../AEPreferences.h"
-
-#include "../AEEditor.h"
-#include "../AEEvents.h"
-#include "../Project/AEProject.h"
-#include "../Project/ProjectUtils.h"
-
-
-#include "UIActivationSuccess.h"
-#include "AELicenseSystem.h"
-
-namespace AtomicEditor
-{
-
-// UIBuildSettings------------------------------------------------
-
-UIActivationSuccess::UIActivationSuccess(Context* context):
-    UIModalOpWindow(context)
-{
-    UI* tbui = GetSubsystem<UI>();
-    window_->SetText("Product Activation Successful");
-    tbui->LoadResourceFile(window_->GetContentRoot(), "AtomicEditor/editor/ui/activationsuccess.tb.txt");
-
-    window_->ResizeToFitContent();
-    Center();
-}
-
-UIActivationSuccess::~UIActivationSuccess()
-{
-
-}
-
-bool UIActivationSuccess::OnEvent(const TBWidgetEvent &ev)
-{
-    UIModalOps* ops = GetSubsystem<UIModalOps>();
-
-    if (ev.type == EVENT_TYPE_CLICK)
-    {
-        if (ev.target->GetID() == TBIDC("ok"))
-        {
-
-            /*
-            LicenseSystem* licenseSystem = GetSubsystem<LicenseSystem>();
-
-            if (licenseSystem->IsStarterLicense())
-            {
-                SharedPtr<UIActivationSuccess> keepAlive(this);
-                UIModalOps* ops = GetSubsystem<UIModalOps>();
-                ops->Hide();
-                ops->ShowPlatformsInfo();
-                return true;
-            }
-            */
-
-            ops->Hide();
-            return true;
-        }
-    }
-
-    return false;
-}
-
-
-}
-
-// END LICENSE MANAGEMENT

+ 0 - 34
Attic/AtomicEditorReference/Source/License/UIActivationSuccess.h

@@ -1,34 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-// BEGIN LICENSE MANAGEMENT
-
-#pragma once
-
-#include "UI/Modal/UIModalOps.h"
-
-#include <TurboBadger/tb_select.h>
-#include <TurboBadger/tb_select_item.h>
-
-namespace AtomicEditor
-{
-
-class UIActivationSuccess: public UIModalOpWindow
-{
-    OBJECT(UIActivationSuccess);
-
-public:
-
-    UIActivationSuccess(Context* context);
-    virtual ~UIActivationSuccess();
-    bool OnEvent(const TBWidgetEvent &ev);
-
-private:
-
-
-};
-
-}
-
-// END LICENSE MANAGEMENT

+ 0 - 121
Attic/AtomicEditorReference/Source/License/UIEulaAgreement.cpp

@@ -1,121 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-// BEGIN LICENSE MANAGEMENT
-
-#include "AtomicEditor.h"
-
-#include <TurboBadger/tb_window.h>
-#include <TurboBadger/tb_select.h>
-#include <TurboBadger/tb_editfield.h>
-#include <TurboBadger/tb_tab_container.h>
-
-#include <Atomic/Core/Context.h>
-#include <Atomic/IO/File.h>
-#include <Atomic/Resource/ResourceCache.h>
-#include <Atomic/Input/InputEvents.h>
-#include <Atomic/UI/UI.h>
-
-#include "Resources/AEResourceOps.h"
-#include "AEPreferences.h"
-
-#include "AEEditor.h"
-#include "AEEvents.h"
-#include "Project/AEProject.h"
-#include "Project/ProjectUtils.h"
-
-#include "License/AELicenseSystem.h"
-#include "UIEulaAgreement.h"
-
-namespace AtomicEditor
-{
-
-// UIBuildSettings------------------------------------------------
-
-UIEulaAgreement::UIEulaAgreement(Context* context):
-    UIModalOpWindow(context)
-{
-    UI* tbui = GetSubsystem<UI>();
-    window_->SetSettings(WINDOW_SETTINGS_DEFAULT & ~WINDOW_SETTINGS_CLOSE_BUTTON);
-    window_->SetText("License Agreement");
-    tbui->LoadResourceFile(window_->GetContentRoot(), "AtomicEditor/editor/ui/eulaagreement.tb.txt");
-
-    eulaCheck_ = window_->GetWidgetByIDAndType<TBCheckBox>(TBIDC("eula_check"));
-    assert(eulaCheck_);
-
-    TBEditField* age_license = window_->GetWidgetByIDAndType<TBEditField>(TBIDC("age_license"));
-    assert(age_license);
-
-    TBEditField* thirdparty_license = window_->GetWidgetByIDAndType<TBEditField>(TBIDC("thirdparty_license"));
-    assert(thirdparty_license);
-
-    TBEditField* externaltool_license = window_->GetWidgetByIDAndType<TBEditField>(TBIDC("externaltool_license"));
-    assert(externaltool_license);
-
-
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-
-    SharedPtr<File> file = cache->GetFile("AtomicEditor/eulas/atomic_game_engine_eula.txt");
-    String text;
-    file->ReadText(text);
-    age_license->SetText(text.CString());
-
-    file = cache->GetFile("AtomicEditor/eulas/atomic_thirdparty_eula.txt");
-    file->ReadText(text);
-    thirdparty_license->SetText(text.CString());
-
-    file = cache->GetFile("AtomicEditor/eulas/atomic_external_tools_eula.txt");
-    file->ReadText(text);
-    externaltool_license->SetText(text.CString());
-
-    window_->ResizeToFitContent();
-    Center();
-
-    TBTabContainer* container = window_->GetWidgetByIDAndType<TBTabContainer>(TBIDC("tabcontainer"));
-    assert(container);
-    container->SetValue(0);
-
-}
-
-
-UIEulaAgreement::~UIEulaAgreement()
-{
-}
-
-bool UIEulaAgreement::OnEvent(const TBWidgetEvent &ev)
-{
-    if (ev.type == EVENT_TYPE_CLICK)
-    {
-        if (ev.target->GetID() == TBIDC("quit"))
-        {
-            SendEvent(E_EXITREQUESTED);
-            return true;
-        }
-        else if (ev.target->GetID() == TBIDC("ok"))
-        {
-            Editor* editor = GetSubsystem<Editor>();
-
-            if (!eulaCheck_->GetValue())
-            {
-                editor->PostModalInfo("License Agreement", "Please agree to licensing terms and conditions to continue");
-                return true;
-            }
-
-            SharedPtr<UIEulaAgreement> keepAlive(this);
-            GetSubsystem<UIModalOps>()->Hide();
-            LicenseSystem* licenseSystem = GetSubsystem<LicenseSystem>();
-            licenseSystem->LicenseAgreementConfirmed();
-            return true;
-        }
-
-
-    }
-
-
-    return false;
-}
-
-}
-
-// END LICENSE MANAGEMENT

+ 0 - 34
Attic/AtomicEditorReference/Source/License/UIEulaAgreement.h

@@ -1,34 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-// BEGIN LICENSE MANAGEMENT
-
-#pragma once
-
-#include "UI/Modal/UIModalOps.h"
-
-#include <TurboBadger/tb_widgets_common.h>
-
-namespace AtomicEditor
-{
-
-class UIEulaAgreement: public UIModalOpWindow
-{
-    OBJECT(UIEulaAgreement);
-
-public:
-
-    UIEulaAgreement(Context* context);
-    virtual ~UIEulaAgreement();
-    bool OnEvent(const TBWidgetEvent &ev);
-
-private:
-
-    TBCheckBox* eulaCheck_;
-
-};
-
-}
-
-// END LICENSE MANAGEMENT

+ 0 - 111
Attic/AtomicEditorReference/Source/License/UIManageLicense.cpp

@@ -1,111 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-// BEGIN LICENSE MANAGEMENT
-
-#include "AtomicEditor.h"
-
-#include <TurboBadger/tb_window.h>
-#include <TurboBadger/tb_select.h>
-#include <TurboBadger/tb_editfield.h>
-#include <TurboBadger/tb_message_window.h>
-
-#include <Atomic/Core/Context.h>
-#include <Atomic/UI/UI.h>
-
-#include "Resources/AEResourceOps.h"
-#include "AEPreferences.h"
-
-#include "AEEditor.h"
-#include "AEEvents.h"
-#include "Project/AEProject.h"
-#include "Project/ProjectUtils.h"
-
-#include "AELicenseSystem.h"
-#include "UIManageLicense.h"
-
-namespace AtomicEditor
-{
-
-// UIBuildSettings------------------------------------------------
-
-UIManageLicense::UIManageLicense(Context* context):
-    UIModalOpWindow(context)
-
-{
-    Editor* editor = GetSubsystem<Editor>();
-    Project* project = editor->GetProject();
-
-    UI* tbui = GetSubsystem<UI>();
-    window_->SetText("Manage License");
-    tbui->LoadResourceFile(window_->GetContentRoot(), "AtomicEditor/editor/ui/managelicense.tb.txt");
-
-    window_->ResizeToFitContent();
-    Center();
-
-    progressModal_ = new ProgressModal(context_, "Manage License", "");
-}
-
-
-UIManageLicense::~UIManageLicense()
-{
-    progressModal_->Hide();
-}
-
-bool UIManageLicense::OnEvent(const TBWidgetEvent &ev)
-{
-    Editor* editor = GetSubsystem<Editor>();
-    LicenseSystem* licenseSystem = GetSubsystem<LicenseSystem>();
-
-    if (ev.type == EVENT_TYPE_CLICK)
-    {
-
-        if (ev.target->GetID() == TBIDC("ok"))
-        {
-            UIModalOps* ops = GetSubsystem<UIModalOps>();
-            ops->Hide();
-            return true;
-        }
-
-        if (ev.target->GetID() == TBIDC("confirm_license_return"))
-        {
-            if (ev.ref_id == TBIDC("TBMessageWindow.ok"))
-            {
-                request_ = licenseSystem->Deactivate();
-                SubscribeToEvent(request_, E_CURLCOMPLETE, HANDLER(UIManageLicense, HandleCurlComplete));
-                progressModal_->SetMessage("Returning license, please wait...");
-                progressModal_->Show();
-            }
-        }
-
-        if (ev.target->GetID() == TBIDC("return_activation"))
-        {
-            if (editor->IsProjectLoaded())
-            {
-                editor->PostModalError("Close Project", "Please close the current project before deactivating license");
-            }
-            else
-            {
-                TBMessageWindow *msg_win = new TBMessageWindow(window_, TBIDC("confirm_license_return"));
-                TBMessageWindowSettings settings(TB_MSG_OK_CANCEL, TBID(uint32(0)));
-                settings.dimmer = true;
-                settings.styling = true;
-                msg_win->Show("Return License", "Are you sure you want to return the installed license?", &settings, 300, 140);
-            }
-
-            return true;
-        }
-    }
-
-    return false;
-}
-
-void UIManageLicense::HandleCurlComplete(StringHash eventType, VariantMap& eventData)
-{
-    progressModal_->Hide();
-}
-
-}
-
-// END LICENSE MANAGEMENT

+ 0 - 40
Attic/AtomicEditorReference/Source/License/UIManageLicense.h

@@ -1,40 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-// BEGIN LICENSE MANAGEMENT
-
-#pragma once
-
-#include "UI/Modal/UIModalOps.h"
-#include "UI/Modal/UIProgressModal.h"
-#include "Net/CurlManager.h"
-
-#include <TurboBadger/tb_select.h>
-#include <TurboBadger/tb_select_item.h>
-
-namespace AtomicEditor
-{
-
-class UIManageLicense: public UIModalOpWindow
-{
-    OBJECT(UIManageLicense);
-
-public:
-
-    UIManageLicense(Context* context);
-    virtual ~UIManageLicense();
-    bool OnEvent(const TBWidgetEvent &ev);
-
-private:
-
-    void HandleCurlComplete(StringHash eventType, VariantMap& eventData);
-
-    SharedPtr<ProgressModal> progressModal_;
-    SharedPtr<CurlRequest> request_;
-
-};
-
-}
-
-// END LICENSE MANAGEMENT

+ 0 - 122
Attic/AtomicEditorReference/Source/Main.cpp

@@ -1,122 +0,0 @@
-
-#if defined(WIN32) && !defined(ATOMIC_WIN32_CONSOLE)
-#include <Atomic/Core/MiniDump.h>
-#include <windows.h>
-#ifdef _MSC_VER
-#include <crtdbg.h>
-#endif
-#endif
-
-#include <Atomic/Core/ProcessUtils.h>
-#include <Atomic/IO/Log.h>
-
-#include "AEApplication.h"
-#include "Player/AEPlayerApplication.h"
-
-using namespace AtomicEditor;
-
-static int RunEditorApplication()
-{
-    Atomic::SharedPtr<Atomic::Context> context(new Atomic::Context());
-    Atomic::SharedPtr<AEApplication> application(new AEApplication(context));
-    return application->Run();
-}
-
-static int RunPlayerApplication()
-{
-    Atomic::SharedPtr<Atomic::Context> context(new Atomic::Context());
-    Atomic::SharedPtr<AEPlayerApplication> application(new AEPlayerApplication(context));
-    return application->Run();
-}
-
-
-// Define a platform-specific main function, which in turn executes the user-defined function
-
-// MSVC debug mode: use memory leak reporting
-#if defined(_MSC_VER) && defined(_DEBUG) && !defined(ATOMIC_WIN32_CONSOLE)
-int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, PSTR cmdLine, int showCmd)
-{
-    _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
-    Atomic::ParseArguments(GetCommandLineW());
-
-    const Vector<String>& arguments = GetArguments();
-
-    bool runPlayer = false;
-    for (unsigned i = 0; i < arguments.Size();i++)
-    {
-        if (arguments.At(i) == "--player")
-        {
-            runPlayer = true;
-            break;
-        }
-    }
-
-    if (runPlayer)
-        return RunPlayerApplication();
-
-    return RunEditorApplication();
-
-}
-// MSVC release mode: write minidump on crash
-#elif defined(_MSC_VER) && defined(ATOMIC_MINIDUMPS) && !defined(ATOMIC_WIN32_CONSOLE)
-
-int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, PSTR cmdLine, int showCmd)
-{
-    Atomic::ParseArguments(GetCommandLineW());
-    int exitCode;
-    __try
-    {
-        exitCode = function;
-    }
-    __except(Atomic::WriteMiniDump("Atomic", GetExceptionInformation()))
-    {
-    }
-    return exitCode;
-}
-// Other Win32 or minidumps disabled: just execute the function
-#elif defined(WIN32) && !defined(ATOMIC_WIN32_CONSOLE)
-int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, PSTR cmdLine, int showCmd)
-{
-    Atomic::ParseArguments(GetCommandLineW());
-
-    const Vector<String>& arguments = GetArguments();
-
-    bool runPlayer = false;
-    for (unsigned i = 0; i < arguments.Size();i++)
-    {
-        if (arguments.At(i) == "--player")
-        {
-            runPlayer = true;
-            break;
-        }
-    }
-
-    if (runPlayer)
-        return RunPlayerApplication();
-
-    return RunEditorApplication();
-}
-// Linux or OS X: use main
-#else
-int main(int argc, char** argv)
-{
-    Atomic::ParseArguments(argc, argv);
-
-    const Vector<String>& arguments = GetArguments();
-
-    bool runPlayer = false;
-    for (unsigned i = 0; i < arguments.Size();i++)
-    {
-        if (arguments.At(i) == "--player")
-        {
-            runPlayer = true;
-            break;
-        }
-    }
-
-    if (runPlayer)
-        return RunPlayerApplication();
-
-    return RunEditorApplication();
-}
-#endif

+ 0 - 125
Attic/AtomicEditorReference/Source/Net/CurlManager.cpp

@@ -1,125 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-#include <Atomic/Core/CoreEvents.h>
-#include <Atomic/Core/Context.h>
-#include "CurlManager.h"
-#include <curl/curl.h>
-
-#include "AEEvents.h"
-
-namespace AtomicEditor
-{
-
-CurlRequest::CurlRequest(Context* context, const String& url, const String& postData) :
-    Object(context)
-{
-    curl_ = curl_easy_init();
-
-    // take care, curl doesn't make copies of all data
-    url_ = url;
-    postData_ = postData;
-
-    curl_easy_setopt(curl_, CURLOPT_URL, url_.CString());
-    curl_easy_setopt(curl_, CURLOPT_WRITEFUNCTION, Writer);
-
-    if (postData.Length())
-    {
-        curl_easy_setopt(curl_, CURLOPT_POSTFIELDS, postData_.CString());
-    }
-
-    curl_easy_setopt(curl_, CURLOPT_WRITEDATA, (void *) this);
-
-}
-
-CurlRequest::~CurlRequest()
-{
-    curl_easy_cleanup(curl_);
-}
-
-void CurlRequest::ThreadFunction()
-{
-    CURLcode res;
-    res = curl_easy_perform(curl_);
-
-    if(res != CURLE_OK)
-    {
-        error_ = curl_easy_strerror(res);
-    }
-
-    shouldRun_ = false;
-}
-
-size_t CurlRequest::Writer(void *ptr, size_t size, size_t nmemb, void *crequest)
-{
-    CurlRequest* request = (CurlRequest*) crequest;
-
-    size_t realsize = size * nmemb;
-    const char* text = (const char*) ptr;
-
-    for (size_t i = 0; i < realsize; i++)
-    {
-        request->response_ += text[i];
-    }
-
-    return realsize;
-
-}
-
-
-CurlManager::CurlManager(Context* context) :
-    Object(context)
-{
-    curl_global_init(CURL_GLOBAL_DEFAULT);
-
-    SubscribeToEvent(E_UPDATE, HANDLER(CurlManager, HandleUpdate));
-    SubscribeToEvent(E_EDITORSHUTDOWN, HANDLER(CurlManager, HandleEditorShutdown));
-}
-
-CurlManager::~CurlManager()
-{
-    curl_global_cleanup();
-}
-
-SharedPtr<CurlRequest> CurlManager::MakeRequest(const String& url, const String& postData)
-{
-    SharedPtr<CurlRequest> request(new CurlRequest(context_, url, postData));
-    request->Run();
-    requests_.Push(request);
-    return request;
-
-}
-
-void CurlManager::HandleUpdate(StringHash eventType, VariantMap& eventData)
-{
-    Vector<CurlRequest*> remove;
-
-    for (unsigned i = 0; i < requests_.Size(); i++)
-    {
-        CurlRequest* request = requests_[i];
-
-        if (!request->shouldRun_)
-        {
-            remove.Push(request);
-            VariantMap eventData;
-            eventData[CurlComplete::P_CURLREQUEST] = request;
-            request->SendEvent(E_CURLCOMPLETE, eventData);
-
-        }
-    }
-
-    for (unsigned i = 0; i < remove.Size(); i++)
-    {
-        requests_.Remove(SharedPtr<CurlRequest>(remove[i]));
-    }
-
-}
-
-void CurlManager::HandleEditorShutdown(StringHash eventType, VariantMap& eventData)
-{
-    context_->RemoveSubsystem(GetType());
-}
-
-}

+ 0 - 73
Attic/AtomicEditorReference/Source/Net/CurlManager.h

@@ -1,73 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-typedef void CURL;
-
-#include <Atomic/Core/Object.h>
-#include <Atomic/Container/Str.h>
-#include <Atomic/Core/Mutex.h>
-#include <Atomic/Core/Thread.h>
-
-using namespace Atomic;
-
-namespace AtomicEditor
-{
-
-class CurlRequest : public Object, public Thread
-{
-    friend class CurlManager;
-
-    OBJECT(CurlRequest);
-
-public:
-
-    CurlRequest(Context* context, const String& url, const String& postData = String::EMPTY);
-    virtual ~CurlRequest();
-
-    const String& GetError() { return error_; }
-    const String& GetResponse() { return response_; }
-
-private:
-
-    void ThreadFunction();
-    mutable Mutex mutex_;
-
-    static size_t Writer(void *ptr, size_t size, size_t nmemb, void *userp);
-
-    CURL* curl_;
-    String response_;
-    String error_;
-
-    String postData_;
-    String url_;
-};
-
-class CurlManager : public Object
-{
-    OBJECT(CurlManager);
-
-public:
-    /// Construct.
-    CurlManager(Context* context);
-    /// Destruct.
-    virtual ~CurlManager();
-
-    SharedPtr<CurlRequest> MakeRequest(const String& url, const String& postData = String::EMPTY);
-
-private:
-
-    void HandleEditorShutdown(StringHash eventType, VariantMap& eventData);
-    void HandleUpdate(StringHash eventType, VariantMap& eventData);
-
-    Vector< SharedPtr<CurlRequest> > requests_;
-
-};
-
-}
-
-
-
-

+ 0 - 120
Attic/AtomicEditorReference/Source/Player/AEPlayer.cpp

@@ -1,120 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-
-#include "../Subprocess/AESubprocessSystem.h"
-
-#include <Atomic/Core/Context.h>
-#include <Atomic/Core/StringUtils.h>
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/IO/Log.h>
-#include <Atomic/Input/Input.h>
-#include <Atomic/Resource/ResourceCache.h>
-#include <Atomic/UI/UI.h>
-
-#include <ToolCore/ToolEnvironment.h>
-
-#include "AEPlayer.h"
-#include "AEEvents.h"
-#include "AEEditor.h"
-#include "Project/AEProject.h"
-
-#include "UIPlayer.h"
-#include "UI/Modal/UIModalOps.h"
-
-namespace AtomicEditor
-{
-
-
-AEPlayer::AEPlayer(Context* context) :
-    Object(context),
-    mode_(AE_PLAYERMODE_WIDGET)
-{
-    SubscribeToEvent(E_EDITORSHUTDOWN, HANDLER(AEPlayer, HandleEditorShutdown));
-    SubscribeToEvent(E_IPCWORKERSTART, HANDLER(AEPlayer, HandleIPCWorkerStarted));
-
-    assert(!context->GetSubsystem<AEPlayer>());
-    context->RegisterSubsystem(this);
-
-}
-
-AEPlayer::~AEPlayer()
-{
-
-}
-
-void AEPlayer::Invalidate()
-{
-    UIModalOps* ops = GetSubsystem<UIModalOps>();
-    ops->Hide();
-    context_->RemoveSubsystem<AEPlayer>();
-}
-
-void AEPlayer::HandleJSError(StringHash eventType, VariantMap& eventData)
-{
-
-}
-
-void AEPlayer::HandleIPCWorkerStarted(StringHash eventType, VariantMap& eventData)
-{
-    //VariantMap weventData;
-    //broker_->PostMessage(E_IPCSTARTUP, weventData);
-}
-
-void AEPlayer::HandleIPCWorkerExit(StringHash eventType, VariantMap& eventData)
-{
-    SendEvent(E_EDITORPLAYSTOP);
-}
-
-
-bool AEPlayer::Play(AEPlayerMode mode, const IntRect &rect)
-{
-    Editor* editor = GetSubsystem<Editor>();
-    ToolCore::ToolEnvironment* env = GetSubsystem<ToolCore::ToolEnvironment>();
-    const String& editorBinary = env->GetEditorBinary();
-
-    Project* project = editor->GetProject();
-
-    Vector<String> paths;
-    paths.Push(env->GetCoreDataDir());
-    paths.Push(env->GetPlayerDataDir());
-    paths.Push(project->GetResourcePath());
-
-    String resourcePaths;
-    resourcePaths.Join(paths, "!");
-
-    Vector<String> vargs;
-
-    String args = ToString("--editor-resource-paths \"%s\"", resourcePaths.CString());
-
-    vargs = args.Split(' ');
-    vargs.Insert(0, "--player");
-
-    String dump;
-    dump.Join(vargs, " ");
-    LOGINFOF("Launching Broker %s %s", editorBinary.CString(), dump.CString());
-
-    IPC* ipc = GetSubsystem<IPC>();
-    broker_ = ipc->SpawnWorker(editorBinary, vargs);
-
-    if (broker_)
-    {
-        SubscribeToEvent(broker_, E_IPCWORKEREXIT, HANDLER(AEPlayer, HandleIPCWorkerExit));
-    }
-
-    return broker_.NotNull();
-}
-
-void AEPlayer::SetUIPlayer(UIPlayer* uiPlayer)
-{
-    uiPlayer_ = uiPlayer;
-}
-
-void AEPlayer::HandleEditorShutdown(StringHash eventType, VariantMap& eventData)
-{
-    context_->RemoveSubsystem(GetType());
-}
-
-}

+ 0 - 80
Attic/AtomicEditorReference/Source/Player/AEPlayer.h

@@ -1,80 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <Atomic/Core/Object.h>
-#include <Atomic/IPC/IPC.h>
-#include <Atomic/IPC/IPCEvents.h>
-#include <Atomic/IPC/IPCBroker.h>
-
-#include "../AETypes.h"
-
-using namespace Atomic;
-
-namespace Atomic
-{
-
-class JSVM;
-
-}
-
-namespace AtomicEditor
-{
-
-class UIPlayer;
-
-struct AEPlayerError
-{
-    String name_;
-    String message_;
-    String filename_;
-    int lineNumber_;
-    String stack_;
-};
-
-class AEPlayer : public Object
-{
-    OBJECT(AEPlayer);
-
-public:
-    /// Construct.
-    AEPlayer(Context* context);
-    /// Destruct.
-    ~AEPlayer();
-
-    bool Play(AEPlayerMode mode, const IntRect& rect = IntRect());
-
-    AEPlayerMode GetMode() const { return mode_; }
-
-    void Invalidate();
-
-    bool HasErrors() { return errors_.Size() != 0; }
-
-    const Vector<AEPlayerError>& GetErrors() { return errors_; }
-
-    UIPlayer* GetUIPlayer() { return uiPlayer_; }
-    void SetUIPlayer(UIPlayer* uiPlayer);
-
-private:
-
-    AEPlayerMode mode_;
-
-    Vector<AEPlayerError> errors_;
-
-    void HandleJSError(StringHash eventType, VariantMap& eventData);
-    void HandleEditorShutdown(StringHash eventType, VariantMap& eventData);
-
-    void HandleIPCWorkerStarted(StringHash eventType, VariantMap& eventData);
-    void HandleIPCWorkerExit(StringHash eventType, VariantMap& eventData);
-
-    SharedPtr<IPCBroker> broker_;
-
-
-    SharedPtr<UIPlayer> uiPlayer_;    
-
-};
-
-
-}

+ 0 - 291
Attic/AtomicEditorReference/Source/Player/AEPlayerApplication.cpp

@@ -1,291 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// 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.
-//
-
-#include <Atomic/Atomic.h>
-#include <Atomic/Engine/Engine.h>
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/IO/Log.h>
-#include <Atomic/IO/IOEvents.h>
-#include <Atomic/Core/Main.h>
-#include <Atomic/Core/ProcessUtils.h>
-#include <Atomic/Resource/ResourceCache.h>
-#include <Atomic/Resource/ResourceEvents.h>
-
-#include <Atomic/IPC/IPC.h>
-#include <Atomic/IPC/IPCEvents.h>
-#include <Atomic/IPC/IPCWorker.h>
-
-// Move me
-#include <Atomic/Environment/Environment.h>
-
-#include <AtomicJS/Javascript/Javascript.h>
-
-#include "AEPlayerApplication.h"
-
-#include <Atomic/DebugNew.h>
-
-#include <Atomic/UI/UI.h>
-
-#ifdef __APPLE__
-#include <unistd.h>
-#endif
-
-namespace AtomicEditor
-{
-
-// fixme
-static JSVM* vm = NULL;
-static Javascript* javascript = NULL;
-
-AEPlayerApplication::AEPlayerApplication(Context* context) :
-    Application(context)
-{
-    fd_[0] = INVALID_IPCHANDLE_VALUE;
-    fd_[1] = INVALID_IPCHANDLE_VALUE;
-
-#ifdef ATOMIC_3D
-    RegisterEnvironmentLibrary(context_);
-#endif
-
-}
-
-void AEPlayerApplication::Setup()
-{
-    FileSystem* filesystem = GetSubsystem<FileSystem>();
-
-    engineParameters_["WindowTitle"] = "AtomicPlayer";
-
-#if (ATOMIC_PLATFORM_ANDROID)
-    engineParameters_["FullScreen"] = true;
-    engineParameters_["ResourcePaths"] = "CoreData;AtomicResources";
-#elif ATOMIC_PLATFORM_WEB
-    engineParameters_["FullScreen"] = false;
-    engineParameters_["ResourcePaths"] = "AtomicResources";
-    // engineParameters_["WindowWidth"] = 1280;
-    // engineParameters_["WindowHeight"] = 720;
-#elif ATOMIC_PLATFORM_IOS
-    engineParameters_["FullScreen"] = false;
-    engineParameters_["ResourcePaths"] = "AtomicResources";
-#else
-    engineParameters_["FullScreen"] = false;
-    engineParameters_["WindowWidth"] = 1280;
-    engineParameters_["WindowHeight"] = 720;
-#endif
-
-#if ATOMIC_PLATFORM_WINDOWS
-    engineParameters_["WindowIcon"] = "Images/AtomicLogo32.png";
-    engineParameters_["ResourcePrefixPath"] = "AtomicPlayer_Resources";
-#elif ATOMIC_PLATFORM_ANDROID
-    //engineParameters_["ResourcePrefixPath"] = "assets";
-#elif ATOMIC_PLATFORM_OSX
-    engineParameters_["ResourcePrefixPath"] = "../Resources";
-#endif
-
-    const Vector<String>& arguments = GetArguments();
-
-    for (unsigned i = 0; i < arguments.Size(); ++i)
-    {
-        if (arguments[i].Length() > 1)
-        {
-            String argument = arguments[i].ToLower();
-            String value = i + 1 < arguments.Size() ? arguments[i + 1] : String::EMPTY;
-
-            if (argument == "--log-std")
-            {
-                SubscribeToEvent(E_LOGMESSAGE, HANDLER(AEPlayerApplication, HandleLogMessage));
-            }
-
-            if (argument.StartsWith("--ipc-server=") || argument.StartsWith("--ipc-client="))
-            {
-                LOGINFOF("Starting IPCWorker %s", argument.CString());
-
-                Vector<String> ipc = argument.Split(argument.CString(), '=');
-
-                if (ipc.Size() == 2)
-                {
-                    if (argument.StartsWith("--ipc-server="))
-                    {
-#ifdef ATOMIC_PLATFORM_WINDOWS
-                        WString wipc(ipc[1]);
-                        HANDLE pipe = reinterpret_cast<HANDLE>(_wtoi64(wipc.CString()));
-                        fd_[0] = pipe;
-#else
-                        int fd = ToInt(ipc[1].CString());
-                        fd_[0] = fd;
-#endif
-                    }
-                    else
-                    {
-#ifdef ATOMIC_PLATFORM_WINDOWS
-                        WString wipc(ipc[1]);
-                        HANDLE pipe = reinterpret_cast<HANDLE>(_wtoi64(wipc.CString()));
-                        fd_[1] = pipe;
-#else
-                        int fd = ToInt(ipc[1].CString());
-                        fd_[1] = fd;
-#endif
-                    }
-
-                }
-
-            }
-            else if (argument == "--project" && value.Length())
-            {
-                engineParameters_["ResourcePrefixPath"] = "";
-
-                // This works for a local dev build, --editor-resource-paths command below is for
-                // launching from AtomicEditor (IPC)
-
-                String resourcePaths = ToString("%s/Data/AtomicPlayer/Resources/CoreData;%s/Data/AtomicPlayer/Resources/PlayerData;%s/Resources",
-                         ATOMIC_ROOT_SOURCE_DIR, ATOMIC_ROOT_SOURCE_DIR, value.CString());
-
-                LOGINFOF("Adding ResourcePaths: %s", resourcePaths.CString());
-
-                engineParameters_["ResourcePaths"] = resourcePaths;
-
-            }
-            else if (argument == "--editor-resource-paths" && value.Length())
-            {
-                // "/Users/josh/Dev/atomic/AtomicGameEngine/Data/AtomicPlayer/Resources/CoreData!/Users/josh/Dev/atomic/AtomicGameEngine/Data/AtomicPlayer/Resources/PlayerData!/Users/josh/Dev/atomic/AtomicExamples/NewSpaceGame/Resources"
-                engineParameters_["ResourcePrefixPath"] = "";
-                value.Replace("!", ";");
-                engineParameters_["ResourcePaths"] = value;
-            }
-        }
-    }
-
-    // Use the script file name as the base name for the log file
-    engineParameters_["LogName"] = filesystem->GetAppPreferencesDir("AtomicPlayer", "Logs") + "AtomicPlayer.log";
-}
-
-void AEPlayerApplication::HandleHelloFromBroker(StringHash eventType, VariantMap& eventData)
-{
-    //assert(eventData[HelloFromBroker::P_HELLO].GetString() == "Hello");
-    //assert(eventData[HelloFromBroker::P_LIFETHEUNIVERSEANDEVERYTHING].GetInt() == 42);
-
-    LOGERROR("Passed Test!");
-}
-
-void AEPlayerApplication::Start()
-{
-
-    //SubscribeToEvent(E_IPCHELLOFROMBROKER, HANDLER(AEPlayerApplication, HandleHelloFromBroker));
-    SubscribeToEvent(E_JSERROR, HANDLER(AEPlayerApplication, HandleJSError));
-
-
-#ifdef ATOMIC_PLATFORM_WINDOWS
-    if (fd_[0] != INVALID_IPCHANDLE_VALUE)
-    {
-        //::CloseHandle(fd_[0]);
-        fd_[0] = INVALID_IPCHANDLE_VALUE;
-    }
-
-    if (fd_[1] != INVALID_IPCHANDLE_VALUE)
-    {
-        IPC* ipc = new IPC(context_);
-        context_->RegisterSubsystem(ipc);
-        //ipc->InitWorker(fd_[0], fd_[1]);
-    }
-#else
-    if (fd_[0] != INVALID_IPCHANDLE_VALUE && fd_[1] != INVALID_IPCHANDLE_VALUE)
-    {
-        IPC* ipc = new IPC(context_);
-        context_->RegisterSubsystem(ipc);
-        //ipc->InitWorker(fd_[0], fd_[1]);
-    }
-#endif
-
-    // Instantiate and register the Javascript subsystem
-    javascript = new Javascript(context_);
-    context_->RegisterSubsystem(javascript);
-
-    vm = javascript->InstantiateVM("MainVM");
-    vm->InitJSContext();
-
-    vm->SetModuleSearchPaths("Modules");
-
-    if (!vm->ExecuteMain())
-    {
-        ErrorExit("Error executing Scripts/main.js");
-    }
-
-    return;
-}
-
-void AEPlayerApplication::Stop()
-{
-    context_->RemoveSubsystem<Javascript>();
-}
-
-void AEPlayerApplication::HandleScriptReloadStarted(StringHash eventType, VariantMap& eventData)
-{
-}
-
-void AEPlayerApplication::HandleScriptReloadFinished(StringHash eventType, VariantMap& eventData)
-{
-}
-
-void AEPlayerApplication::HandleScriptReloadFailed(StringHash eventType, VariantMap& eventData)
-{
-    ErrorExit();
-}
-
-void AEPlayerApplication::HandleLogMessage(StringHash eventType, VariantMap& eventData)
-{
-    using namespace LogMessage;
-
-    int level = eventData[P_LEVEL].GetInt();
-    // The message may be multi-line, so split to rows in that case
-    Vector<String> rows = eventData[P_MESSAGE].GetString().Split('\n');
-
-    for (unsigned i = 0; i < rows.Size(); ++i)
-    {
-        if (level == LOG_ERROR)
-        {
-            fprintf(stderr, "%s\n", rows[i].CString());
-        }
-        else
-        {
-            fprintf(stdout, "%s\n", rows[i].CString());
-        }
-    }
-        
-}
-
-void AEPlayerApplication::HandleJSError(StringHash eventType, VariantMap& eventData)
-{
-    using namespace JSError;
-    //String errName = eventData[P_ERRORNAME].GetString();
-    String errMessage = eventData[P_ERRORMESSAGE].GetString();
-    String errFilename = eventData[P_ERRORFILENAME].GetString();
-    //String errStack = eventData[P_ERRORSTACK].GetString();
-    int errLineNumber = eventData[P_ERRORLINENUMBER].GetInt();
-
-    String errorString = ToString("%s - %s - Line: %i",
-                                  errFilename.CString(), errMessage.CString(), errLineNumber);
-
-    ErrorExit(errorString);
-
-}
-
-
-}

+ 0 - 66
Attic/AtomicEditorReference/Source/Player/AEPlayerApplication.h

@@ -1,66 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// 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.
-//
-
-#pragma once
-
-#include <Atomic/IPC/IPCTypes.h>
-#include <Atomic/Engine/Application.h>
-
-using namespace Atomic;
-
-namespace AtomicEditor
-{
-
-class AEPlayerApplication : public Application
-{
-    OBJECT(AEPlayerApplication);
-
-public:
-    /// Construct.
-    AEPlayerApplication(Context* context);
-
-    /// Setup before engine initialization. Verify that a script file has been specified.
-    virtual void Setup();
-    /// Setup after engine initialization. Load the script and execute its start function.
-    virtual void Start();
-    /// Cleanup after the main loop. Run the script's stop function if it exists.
-    virtual void Stop();
-
-private:
-    /// Handle reload start of the script file.
-    void HandleScriptReloadStarted(StringHash eventType, VariantMap& eventData);
-    /// Handle reload success of the script file.
-    void HandleScriptReloadFinished(StringHash eventType, VariantMap& eventData);
-    /// Handle reload failure of the script file.
-    void HandleScriptReloadFailed(StringHash eventType, VariantMap& eventData);
-
-    void HandleJSError(StringHash eventType, VariantMap& eventData);
-
-    void HandleLogMessage(StringHash eventType, VariantMap& eventData);
-
-
-    void HandleHelloFromBroker(StringHash eventType, VariantMap& eventData);
-
-    IPCHandle fd_[2];
-};
-
-}

+ 0 - 105
Attic/AtomicEditorReference/Source/Player/UIPlayer.cpp

@@ -1,105 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-
-#include <TurboBadger/tb_window.h>
-#include <TurboBadger/tb_select.h>
-#include <TurboBadger/tb_editfield.h>
-
-#include <Atomic/Core/Context.h>
-#include <Atomic/Core/CoreEvents.h>
-#include <Atomic/IO/Log.h>
-#include <Atomic/UI/UI.h>
-
-#include <Atomic/Graphics/Graphics.h>
-#include <Atomic/Graphics/Viewport.h>
-#include <Atomic/Graphics/Camera.h>
-
-#include "UI/Modal/UIModalOps.h"
-#include "License/AELicenseSystem.h"
-
-#include "AEEditor.h"
-#include "AEEvents.h"
-
-#include "UIPlayer.h"
-
-namespace Atomic
-{
-    void FixMeSetLight2DGroupViewport(Viewport *viewport);
-}
-
-namespace AtomicEditor
-{
-
-// UIBuildSettings------------------------------------------------
-
-UIPlayer::UIPlayer(Context* context):
-    UIModalOpWindow(context)
-{
-
-    aePlayer_ = GetSubsystem<AEPlayer>();
-    aePlayer_->SetUIPlayer(this);
-
-    UI* tbui = GetSubsystem<UI>();
-
-    window_->SetSettings(WINDOW_SETTINGS_DEFAULT & ~WINDOW_SETTINGS_CLOSE_BUTTON);
-
-    window_->SetText("Atomic Player");
-    tbui->LoadResourceFile(window_->GetContentRoot(), "AtomicEditor/editor/ui/playerwidget.tb.txt");
-
-    Graphics* graphics = GetSubsystem<Graphics>();
-
-    float gwidth = graphics->GetWidth();
-    float aspect = float(graphics->GetHeight())/ gwidth;
-    gwidth -= 150;
-
-    playerSize_.x_ = gwidth;
-    playerSize_.y_ = gwidth * aspect;
-
-    TBLayout* playercontainer = window_->GetWidgetByIDAndType<TBLayout>(TBIDC("playerlayout"));
-    assert(playercontainer);
-
-    window_->ResizeToFitContent();
-
-    Center();    
-
-    SubscribeToEvent(E_UPDATE, HANDLER(UIPlayer, HandleUpdate));
-
-}
-
-
-UIPlayer::~UIPlayer()
-{
-
-}
-
-void UIPlayer::HandleUpdate(StringHash eventType, VariantMap& eventData)
-{
-
-}
-
-
-bool UIPlayer::OnEvent(const TBWidgetEvent &ev)
-{
-    if (ev.type == EVENT_TYPE_CLICK)
-    {
-        if (ev.target->GetID() == TBIDC("play"))
-        {
-            if (GetSubsystem<Editor>()->IsPlayingProject())
-            {
-                SendEvent(E_EDITORPLAYSTOP);                               
-                return true;
-            }
-        }
-    }
-
-    return true;
-}
-
-
-
-}
-
-

+ 0 - 43
Attic/AtomicEditorReference/Source/Player/UIPlayer.h

@@ -1,43 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-
-#pragma once
-
-#include "UI/Modal/UIModalOps.h"
-#include "UI/UIView3D.h"
-
-#include "AEPlayer.h"
-
-namespace Atomic
-{
-class Scene;
-class Camera;
-}
-
-namespace AtomicEditor
-{
-
-/// Player modal
-
-class UIPlayer: public UIModalOpWindow
-{
-    OBJECT(UIPlayer);
-
-public:
-
-    UIPlayer(Context* context);
-    virtual ~UIPlayer();
-
-    bool OnEvent(const TBWidgetEvent &ev);
-    const IntVector2& GetPlayerSize() { return playerSize_; }
-
-private:
-
-    void HandleUpdate(StringHash eventType, VariantMap& eventData);
-    WeakPtr<AEPlayer> aePlayer_;
-    IntVector2 playerSize_;
-};
-
-}

+ 0 - 276
Attic/AtomicEditorReference/Source/Project/AEProject.cpp

@@ -1,276 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include <rapidjson/document.h>
-#include <rapidjson/filestream.h>
-#include <rapidjson/prettywriter.h>
-
-#include "AtomicEditor.h"
-#include <Atomic/IO/File.h>
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/IO/Log.h>
-#include <Atomic/Core/Context.h>
-
-#include "../AEEditor.h"
-#include "Build/BuildSystem.h"
-#include "AEProject.h"
-
-using namespace rapidjson;
-
-namespace AtomicEditor
-{
-
-Project::Project(Context* context) :
-    Object(context),
-    loading_(false)
-{
-	
-}
-
-Project::~Project()
-{
-
-}
-
-void Project::LoadUserPrefs(const String& fullpath)
-{
-    rapidjson::Document document;
-
-    File jsonFile(context_, fullpath);
-
-    if (!jsonFile.IsOpen())
-        return;
-
-    String json;
-    jsonFile.ReadText(json);
-
-    if (!json.Length())
-        return;
-
-    if (document.Parse<0>(json.CString()).HasParseError())
-    {
-        LOGERRORF("Could not parse Project JSON data from %s", fullpath.CString());
-        return;
-    }
-
-    const Value::Member* current_platform = document.FindMember("current_platform");
-
-    AEEditorPlatform platform = AE_PLATFORM_UNDEFINED;
-    if (current_platform && current_platform->value.IsString())
-    {
-        String splatform = current_platform->value.GetString();
-        if (splatform == "Windows")
-            platform = AE_PLATFORM_WINDOWS;
-        else if (splatform == "Mac")
-            platform = AE_PLATFORM_MAC;
-        else if (splatform == "HTML5")
-            platform = AE_PLATFORM_HTML5;
-        else if (splatform == "iOS")
-            platform = AE_PLATFORM_IOS;
-        else if (splatform == "Android")
-            platform = AE_PLATFORM_ANDROID;
-    }
-    if (platform == AE_PLATFORM_UNDEFINED)
-    {
-#ifdef ATOMIC_PLATFORM_OSX
-        platform = AE_PLATFORM_MAC;
-#else
-        platform = AE_PLATFORM_WINDOWS;
-#endif
-    }
-
-    const Value::Member* last_build_path = document.FindMember("last_build_path");
-    if (last_build_path && last_build_path->value.IsString())
-    {
-        lastBuildPath_ = last_build_path->value.GetString();
-    }
-
-    // probably will want to move this, it will trigger a save (which is guarded with load_)
-    Editor* editor = GetSubsystem<Editor>();
-    editor->RequestPlatformChange(platform);
-
-}
-
-void Project::SaveUserPrefs(const String& fullpath)
-{
-    Editor* editor = GetSubsystem<Editor>();
-    FILE* file = fopen(fullpath.CString(), "w");
-
-    if (!file)
-        return;
-
-    rapidjson::FileStream s(file);
-    rapidjson::PrettyWriter<rapidjson::FileStream> writer(s);
-
-    writer.StartObject();
-    writer.String("version");
-    writer.Int(1);
-
-    writer.String("current_platform");
-    AEEditorPlatform platform = editor->GetCurrentPlatform();
-    if (platform == AE_PLATFORM_WINDOWS)
-        writer.String("Windows");
-    else if (platform == AE_PLATFORM_MAC)
-        writer.String("Mac");
-    else if (platform == AE_PLATFORM_HTML5)
-        writer.String("HTML5");
-    else if (platform == AE_PLATFORM_IOS)
-        writer.String("iOS");
-    else if (platform == AE_PLATFORM_ANDROID)
-        writer.String("Android");
-
-    writer.String("last_build_path");
-    writer.String(lastBuildPath_.CString());
-
-    writer.EndObject();
-
-    fclose(file);
-}
-
-void Project::Load(const String& fullpath)
-{
-    loading_ = true;
-    projectFilePath_ = fullpath;
-
-    LoadUserPrefs(GetUserPrefsFullPath(fullpath));
-
-    rapidjson::Document document;
-
-    File jsonFile(context_, fullpath);
-
-    if (!jsonFile.IsOpen())
-    {
-        loading_ = false;
-        return;
-    }
-
-    String json;
-    jsonFile.ReadText(json);
-
-    if (!json.Length())
-    {
-        loading_ = false;
-        return;
-    }
-
-    if (document.Parse<0>(json.CString()).HasParseError())
-    {
-        LOGERRORF("Could not parse Project JSON data from %s", fullpath.CString());
-        loading_ = false;
-        return;
-    }
-
-    const Value::Member* version = document.FindMember("version");
-    if (version && version->value.IsInt())
-    {
-
-    }
-
-    Value::Member* build_settings = document.FindMember("build_settings");
-    if (build_settings && build_settings->value.IsObject())
-    {
-        BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
-        buildSystem->LoadBuildSettings(build_settings);
-    }
-
-    loading_ = false;
-}
-
-String Project::GetUserPrefsFullPath(const String& projectPath)
-{
-    String path = GetPath(projectPath);
-    String filename = GetFileName(projectPath);
-    String prefsPath = path + "/" + filename + ".atomic.userprefs";
-    return prefsPath;
-}
-
-void Project::Save(const String& fullpath)
-{
-    if (loading_)
-        return;
-
-    if (fullpath.Length())
-        projectFilePath_ = fullpath;
-
-    String path = projectFilePath_;
-
-    SaveUserPrefs(GetUserPrefsFullPath(path));
-
-    FILE* file = fopen(path.CString(), "w");
-
-    if (!file)
-        return;
-
-    rapidjson::FileStream s(file);
-    rapidjson::PrettyWriter<rapidjson::FileStream> writer(s);
-
-    writer.StartObject();
-    writer.String("version");
-    writer.Int(1);
-
-    BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
-    buildSystem->SaveBuildSettings(writer);
-
-    writer.EndObject();
-
-    fclose(file);
-
-}
-
-bool Project::IsComponentsDirOrFile(const String& fullPath)
-{
-    String pathName;
-    String fileName;
-    String extension;
-
-    SplitPath(fullPath, pathName, fileName, extension);
-
-    if (extension.Length() && extension != ".js")
-        return false;
-
-    if (IsAbsoluteParentPath(componentsPath_, pathName))
-        return true;
-
-    return false;
-
-}
-
-bool Project::IsScriptsDirOrFile(const String& fullPath)
-{
-    String pathName;
-    String fileName;
-    String extension;
-
-    SplitPath(fullPath, pathName, fileName, extension);
-
-    if (extension.Length() && extension != ".js")
-        return false;
-
-    if (IsAbsoluteParentPath(scriptsPath_, pathName))
-        return true;
-
-    return false;
-
-}
-
-bool Project::IsModulesDirOrFile(const String& fullPath)
-{
-    String pathName;
-    String fileName;
-    String extension;
-
-    SplitPath(fullPath, pathName, fileName, extension);
-
-    if (extension.Length() && extension != ".js")
-        return false;
-
-    if (IsAbsoluteParentPath(modulesPath_, pathName))
-        return true;
-
-    return false;
-
-}
-
-
-}

+ 0 - 67
Attic/AtomicEditorReference/Source/Project/AEProject.h

@@ -1,67 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/Core/Object.h>
-
-using namespace Atomic;
-
-namespace AtomicEditor
-{
-
-class Project : public Object
-{
-    OBJECT(Project);
-
-public:
-    /// Construct.
-    Project(Context* context);
-    /// Destruct.
-    virtual ~Project();
-
-    const String GetResourcePath() { return resourcePath_; }
-    void SetResourcePath(const String& resourcePath)
-    {
-        resourcePath_ = AddTrailingSlash(resourcePath);
-        componentsPath_ = resourcePath_ + "Components";
-        scriptsPath_ = resourcePath_ + "Scripts";
-        modulesPath_ = resourcePath_ + "Modules";
-    }
-    void Load(const String& fullpath);
-    void Save(const String& fullpath = "");
-
-    const String& GetComponentsPath() { return componentsPath_; }
-    const String& GetScriptsPath() { return scriptsPath_; }
-    const String& GetModulesPath() { return modulesPath_; }
-
-    const String& GetProjectFilePath() { return projectFilePath_; }
-
-    bool IsComponentsDirOrFile(const String& fullPath);
-    bool IsScriptsDirOrFile(const String& fullPath);
-    bool IsModulesDirOrFile(const String& fullPath);
-
-    const String& GetLastBuildPath() { return lastBuildPath_; }
-    void SetLastBuildPath(const String& path) { lastBuildPath_ = path; }
-
-private:
-
-    void LoadUserPrefs(const String& fullpath);
-    void SaveUserPrefs(const String& fullpath);
-    String GetUserPrefsFullPath(const String& projectPath);
-
-    String projectFilePath_;
-    String resourcePath_;
-
-    String componentsPath_;
-    String scriptsPath_;
-    String modulesPath_;
-
-    String lastBuildPath_;
-    bool loading_;
-
-};
-
-}

+ 0 - 219
Attic/AtomicEditorReference/Source/Project/ProjectUtils.cpp

@@ -1,219 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"
-
-#include <Atomic/Core/Context.h>
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/Graphics/Graphics.h>
-#include "ProjectUtils.h"
-#include "AEEvents.h"
-#include "nfd.h"
-
-#include "../AEEditor.h"
-
-namespace AtomicEditor
-{
-
-ProjectUtils::ProjectUtils(Context* context) :
-    Object(context)
-{
-     SubscribeToEvent(E_EDITORSHUTDOWN, HANDLER(ProjectUtils, HandleEditorShutdown));
-}
-
-void ProjectUtils::OpenProjectFileDialog()
-{
-    nfdchar_t *outPath = NULL;
-
-    nfdresult_t result = NFD_OpenDialog( "atomic",
-                                NULL,
-                                &outPath);
-
-    if (outPath && result == NFD_OKAY)
-    {
-        String fullpath = outPath;
-        Editor* editor = GetSubsystem<Editor>();
-        editor->LoadProject(fullpath);
-    }
-
-    GetSubsystem<Graphics>()->RaiseWindow();
-
-    if (outPath)
-        free(outPath);
-
-}
-
-String ProjectUtils::GetBuildPath(const String& defaultPath)
-{
-    String buildPath;
-
-    nfdchar_t *outPath = NULL;
-
-    nfdresult_t result = NFD_ChooseDirectory( "Please choose the build folder",
-                                defaultPath.Length() ? defaultPath.CString() : NULL,
-                                &outPath);
-
-    if (outPath && result == NFD_OKAY)
-    {
-        buildPath = outPath;
-    }
-
-    if (outPath)
-        free(outPath);
-
-    GetSubsystem<Graphics>()->RaiseWindow();
-
-    return GetInternalPath(buildPath);
-
-}
-
-String ProjectUtils::GetMobileProvisionPath()
-{
-    nfdchar_t *outPath = NULL;
-
-    nfdresult_t result = NFD_OpenDialog( "mobileprovision",
-                                NULL,
-                                &outPath);
-
-    String fullpath;
-
-    if (outPath && result == NFD_OKAY)
-    {
-         fullpath = outPath;
-    }
-
-    GetSubsystem<Graphics>()->RaiseWindow();
-
-    if (outPath)
-        free(outPath);
-
-    return fullpath;
-
-}
-
-String ProjectUtils::GetAndroidSDKPath(const String& defaultPath)
-{
-    String sdkPath;
-
-    nfdchar_t *outPath = NULL;
-
-    nfdresult_t result = NFD_ChooseDirectory( "Please choose the root folder of your Android SDK",
-                                defaultPath.Length() ? defaultPath.CString() : NULL,
-                                &outPath);
-
-    if (outPath && result == NFD_OKAY)
-    {
-        sdkPath = outPath;
-    }
-
-    if (outPath)
-        free(outPath);
-
-    GetSubsystem<Graphics>()->RaiseWindow();
-
-    return GetInternalPath(sdkPath);
-
-}
-
-String ProjectUtils::GetAntPath(const String& defaultPath)
-{
-    String antPath;
-
-    nfdchar_t *outPath = NULL;
-
-#ifdef ATOMIC_PLATFORM_WINDOWS
-    String msg = "Please select the folder which contains ant.bat";
-#else
-     String msg = "Please select the folder which contains the ant executable";
-#endif
-
-    nfdresult_t result = NFD_ChooseDirectory( msg.CString(),
-                                defaultPath.Length() ? defaultPath.CString() : NULL,
-                                &outPath);
-
-    if (outPath && result == NFD_OKAY)
-    {
-        antPath = outPath;
-    }
-
-    if (outPath)
-        free(outPath);
-
-    GetSubsystem<Graphics>()->RaiseWindow();
-
-    return GetInternalPath(antPath);
-}
-
-String ProjectUtils::GetJDKRootPath(const String& defaultPath)
-{
-    String jdkPath;
-
-    nfdchar_t *outPath = NULL;
-
-    nfdresult_t result = NFD_ChooseDirectory( "Please choose the root folder of your JDK",
-                                defaultPath.Length() ? defaultPath.CString() : NULL,
-                                &outPath);
-
-    if (outPath && result == NFD_OKAY)
-    {
-        jdkPath = outPath;
-    }
-
-    if (outPath)
-        free(outPath);
-
-    GetSubsystem<Graphics>()->RaiseWindow();
-
-    return GetInternalPath(jdkPath);
-
-}
-
-
-
-String ProjectUtils::NewProjectFileDialog()
-{
-
-    String projectPath;
-
-    nfdchar_t *outPath = NULL;
-
-    nfdresult_t result = NFD_ChooseDirectory( "Please choose the root folder for your project",
-                                NULL,
-                                &outPath);
-
-
-    if (outPath && result == NFD_OKAY)
-    {
-        projectPath = outPath;
-    }
-
-    GetSubsystem<Graphics>()->RaiseWindow();
-
-    if (outPath)
-        free(outPath);
-
-    return projectPath;
-
-}
-
-void ProjectUtils::RevealInFinder(const String& fullpath)
-{
-    FileSystem* fs = GetSubsystem<FileSystem>();
-    if (fs->DirExists(fullpath))
-        fs->SystemOpen(fullpath);
-    else if (fs->FileExists(fullpath))
-        fs->SystemOpen(GetPath(fullpath));
-}
-
-ProjectUtils::~ProjectUtils()
-{
-}
-
-void ProjectUtils::HandleEditorShutdown(StringHash eventType, VariantMap& eventData)
-{
-    context_->RemoveSubsystem(GetType());
-}
-
-
-}

+ 0 - 41
Attic/AtomicEditorReference/Source/Project/ProjectUtils.h

@@ -1,41 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#pragma once
-
-#include <Atomic/Core/Object.h>
-
-using namespace Atomic;
-
-namespace AtomicEditor
-{
-
-class ProjectUtils : public Object
-{
-    OBJECT(ProjectUtils);
-
-    void OpenProjectFileDialog();
-    String NewProjectFileDialog();
-    void RevealInFinder(const String& fullpath);
-
-    String GetBuildPath(const String& defaultPath);
-    String GetAndroidSDKPath(const String& defaultPath);
-    String GetAntPath(const String& defaultPath);
-    String GetJDKRootPath(const String& defaultPath);
-    String GetMobileProvisionPath();
-
-public:
-    /// Construct.
-    ProjectUtils(Context* context);
-    /// Destruct.
-    ~ProjectUtils();
-
-private:
-
-    void HandleEditorShutdown(StringHash eventType, VariantMap& eventData);
-
-};
-
-
-}

+ 0 - 5
Attic/AtomicEditorReference/Source/Resources/AEComponent.cpp

@@ -1,5 +0,0 @@
-// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
-// Please see LICENSE.md in repository root for license information
-// https://github.com/AtomicGameEngine/AtomicGameEngine
-
-#include "AtomicEditor.h"

Някои файлове не бяха показани, защото твърде много файлове са промени