Browse Source

Initialize AtomicTool from configuration JSON (if available), add GetDefaultResourcePaths to BuildBase

Josh Engebretson 10 years ago
parent
commit
7954b08d31

+ 20 - 4
Data/AtomicEditor/Deployment/Web/index.html

@@ -1,5 +1,24 @@
 
 
-<h3> Atomic Player! </h3>
+
+
+<center>
+<h3> Atomic Web Player</h3>
+<iframe id="playerframe" src="AtomicPlayer.html" width="800" height="512", marginwidth="0", marginheight="0", frameborder="0", scrolling="no"></iframe>
+</center>
+
+<h4>New Features:</h4>
+
+* Embed the Atomic Web Player in a page <br>
+* Asset Precaching <br>
+* New UI system (WIP) <br>
+* Game loop with proper cleanup <br>
+* Built from the atomic-cli  <br>
+* Optimizations <br>
+
+<h4>Known Issues:</h4>
+
+* Slow startup speed issue on Chrome 42 (fixed in 44 Canary) <br>
+* Enable blur for cool Post Process feature, er BUG! <br><br>
 
 
 <script>
 <script>
 function focus()
 function focus()
@@ -9,6 +28,3 @@ function focus()
 }
 }
 window.setInterval(focus, 100);
 window.setInterval(focus, 100);
 </script>
 </script>
-
-
-<iframe id="playerframe" src="AtomicPlayer.html" width="960" height="640", marginwidth="0", marginheight="0", frameborder="0", scrolling="no"></iframe>

+ 3 - 4
Source/Atomic/IPC/IPCTypes.h

@@ -1,17 +1,16 @@
 
 
 #pragma once
 #pragma once
 
 
-#ifdef ATOMIC_PLATFORM_WINDOWS
-
 namespace Atomic
 namespace Atomic
 {
 {
 
 
-// avoid needing to include <windows.h>
+#ifdef ATOMIC_PLATFORM_WINDOWS
 
 
-// Windows handle type
+// avoid needing to include <windows.h>
 
 
 //#define INVALID_HANDLE_VALUE -1
 //#define INVALID_HANDLE_VALUE -1
 
 
+// Windows handle type
 #define INVALID_IPCHANDLE_VALUE (void *)(-1)
 #define INVALID_IPCHANDLE_VALUE (void *)(-1)
 typedef void* IPCHandle;
 typedef void* IPCHandle;
 
 

+ 33 - 3
Source/AtomicTool/AtomicTool.cpp

@@ -3,8 +3,10 @@
 #include <Atomic/IO/Log.h>
 #include <Atomic/IO/Log.h>
 #include <Atomic/IO/FileSystem.h>
 #include <Atomic/IO/FileSystem.h>
 #include <Atomic/Engine/Engine.h>
 #include <Atomic/Engine/Engine.h>
+#include <Atomic/Resource/ResourceCache.h>
 
 
 #include <ToolCore/ToolSystem.h>
 #include <ToolCore/ToolSystem.h>
+#include <ToolCore/ToolEnvironment.h>
 #include <ToolCore/Build/BuildSystem.h>
 #include <ToolCore/Build/BuildSystem.h>
 #include <ToolCore/License/LicenseEvents.h>
 #include <ToolCore/License/LicenseEvents.h>
 #include <ToolCore/License/LicenseSystem.h>
 #include <ToolCore/License/LicenseSystem.h>
@@ -65,14 +67,18 @@ void AtomicTool::Setup()
         }
         }
 
 
     }
     }
-
+#ifndef ATOMIC_DEV_BUILD
     if (!cliDataPath_.Length())
     if (!cliDataPath_.Length())
+    {
         ErrorExit("Unable to parse --data-path");
         ErrorExit("Unable to parse --data-path");
+    }
+#endif
 
 
     engineParameters_["Headless"] = true;
     engineParameters_["Headless"] = true;
     engineParameters_["LogLevel"] = LOG_INFO;
     engineParameters_["LogLevel"] = LOG_INFO;
-    // FIXME
-    engineParameters_["ResourcePaths"] = "/Users/josh/Dev/atomic/AtomicGameEngine/Data/AtomicPlayer/Resources/CoreData";
+
+    // no default resources (will be initialized later)
+    engineParameters_["ResourcePaths"] = "";
 }
 }
 
 
 void AtomicTool::HandleCommandFinished(StringHash eventType, VariantMap& eventData)
 void AtomicTool::HandleCommandFinished(StringHash eventType, VariantMap& eventData)
@@ -195,9 +201,33 @@ void AtomicTool::Start()
 
 
     ToolSystem* tsystem = new ToolSystem(context_);
     ToolSystem* tsystem = new ToolSystem(context_);
     context_->RegisterSubsystem(tsystem);
     context_->RegisterSubsystem(tsystem);
+
+    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;
+    }
+
+    if (!cliDataPath_.Length())
+    {
+        cliDataPath_ = env->GetRootSourceDir() + "/Data/AtomicEditor/";
+    }
+
+#endif
+
+    ResourceCache* cache = GetSubsystem<ResourceCache>();
+    cache->AddResourceDir(env->GetCoreDataDir());
+    cache->AddResourceDir(env->GetPlayerDataDir());
+
     tsystem->SetCLI();
     tsystem->SetCLI();
     tsystem->SetDataPath(cliDataPath_);
     tsystem->SetDataPath(cliDataPath_);
 
 
+
     if (activationKey_.Length())
     if (activationKey_.Length())
     {
     {
         DoActivation();
         DoActivation();

+ 12 - 0
Source/ToolCore/Build/BuildBase.cpp

@@ -7,6 +7,8 @@
 #include <Atomic/IO/FileSystem.h>
 #include <Atomic/IO/FileSystem.h>
 
 
 #include "../Project/Project.h"
 #include "../Project/Project.h"
+#include "../ToolEnvironment.h"
+
 #include "BuildBase.h"
 #include "BuildBase.h"
 #include "ResourcePackager.h"
 #include "ResourcePackager.h"
 
 
@@ -45,6 +47,16 @@ void BuildBase::BuildError(const String& error)
     buildErrors_.Push(error);
     buildErrors_.Push(error);
 }
 }
 
 
+void BuildBase::GetDefaultResourcePaths(Vector<String>& paths)
+{
+    paths.Clear();
+
+    ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
+
+    paths.Push(AddTrailingSlash(tenv->GetCoreDataDir()));
+    paths.Push(AddTrailingSlash(tenv->GetPlayerDataDir()));
+}
+
 
 
 void BuildBase::ScanResourceDirectory(const String& resourceDir)
 void BuildBase::ScanResourceDirectory(const String& resourceDir)
 {
 {

+ 2 - 0
Source/ToolCore/Build/BuildBase.h

@@ -45,6 +45,8 @@ protected:
 
 
     void BuildResourceEntries();
     void BuildResourceEntries();
 
 
+    void GetDefaultResourcePaths(Vector<String>& paths);
+
     String buildPath_;
     String buildPath_;
     PODVector<BuildResourceEntry*> resourceEntries_;
     PODVector<BuildResourceEntry*> resourceEntries_;
 
 

+ 8 - 3
Source/ToolCore/Build/BuildMac.cpp

@@ -25,13 +25,18 @@ BuildMac::~BuildMac()
 void BuildMac::Initialize()
 void BuildMac::Initialize()
 {
 {
     ToolSystem* tsystem = GetSubsystem<ToolSystem>();
     ToolSystem* tsystem = GetSubsystem<ToolSystem>();
+
     Project* project = tsystem->GetProject();
     Project* project = tsystem->GetProject();
 
 
-    String dataPath = tsystem->GetDataPath();
+    Vector<String> defaultResourcePaths;
+    GetDefaultResourcePaths(defaultResourcePaths);
     String projectResources = project->GetResourcePath();
     String projectResources = project->GetResourcePath();
-    String coreDataFolder = dataPath + "CoreData/";
 
 
-    AddResourceDir(coreDataFolder);
+    for (unsigned i = 0; i < defaultResourcePaths.Size(); i++)
+    {
+        AddResourceDir(defaultResourcePaths[i]);
+    }
+
     AddResourceDir(projectResources);
     AddResourceDir(projectResources);
 
 
     BuildResourceEntries();
     BuildResourceEntries();

+ 3 - 0
Source/ToolCore/ToolEnvironment.h

@@ -29,6 +29,9 @@ public:
     void SetRootSourceDir(const String& sourceDir);
     void SetRootSourceDir(const String& sourceDir);
     void SetRootBuildDir(const String& buildDir, bool setBinaryPaths = false);
     void SetRootBuildDir(const String& buildDir, bool setBinaryPaths = false);
 
 
+    const String& GetRootSourceDir() { return rootSourceDir_; }
+    const String& GetRootBuildDir() { return rootBuildDir_; }
+
     const String& GetEditorBinary() { return editorBinary_; }
     const String& GetEditorBinary() { return editorBinary_; }
     const String& GetPlayerBinary() { return playerBinary_; }
     const String& GetPlayerBinary() { return playerBinary_; }
     const String& GetToolBinary() { return toolBinary_; }
     const String& GetToolBinary() { return toolBinary_; }