Browse Source

Merge remote-tracking branch 'upStream/master' into AtomicFileReference

JohnnyWahib 9 years ago
parent
commit
f9ac1de1d7

+ 4 - 0
AUTHORS.md

@@ -23,6 +23,10 @@
 
 
 - Nick Minkler (https://github.com/Sleaker)
 - Nick Minkler (https://github.com/Sleaker)
 
 
+- Raheel Hassim (https://github.com/raheelx)
+
+- Gareth Fouche (https://github.com/GarethNN)
+
 ### Contribution Copyright and Licensing
 ### Contribution Copyright and Licensing
 
 
 Atomic Game Engine contribution copyrights are held by their authors.  Each author retains the copyright to their contribution and agrees to irrevocably license the contribution under the Atomic Game Engine Contribution License `CONTRIBUTION_LICENSE.md`.  Please see `CONTRIBUTING.md` for more details.
 Atomic Game Engine contribution copyrights are held by their authors.  Each author retains the copyright to their contribution and agrees to irrevocably license the contribution under the Atomic Game Engine Contribution License `CONTRIBUTION_LICENSE.md`.  Please see `CONTRIBUTING.md` for more details.

+ 10 - 3
Resources/CoreData/Shaders/HLSL/LitSolid.hlsl

@@ -231,6 +231,8 @@ void PS(
             finalColor = diff * diffColor.rgb * cAmbientColor;
             finalColor = diff * diffColor.rgb * cAmbientColor;
 
 
             oColor = float4(GetLitFog(finalColor, fogFactor), diffColor.a);
             oColor = float4(GetLitFog(finalColor, fogFactor), diffColor.a);
+		#elif defined(LIGHTMAP)            
+            oColor = float4(0.0, 0.0, 0.0, 0.0);
         #else
         #else
             float diff = GetDiffuse(normal, iWorldPos.xyz, lightDir);
             float diff = GetDiffuse(normal, iWorldPos.xyz, lightDir);
 
 
@@ -310,11 +312,16 @@ void PS(
             finalColor += lightInput.rgb * diffColor.rgb + lightSpecColor * specColor;
             finalColor += lightInput.rgb * diffColor.rgb + lightSpecColor * specColor;
         #endif
         #endif
 
 
-        #ifdef ENVCUBEMAP
-            finalColor += cMatEnvMapColor * SampleCube(EnvCubeMap, reflect(iReflectionVec, normal)).rgb;
-        #endif
         #ifdef LIGHTMAP
         #ifdef LIGHTMAP
             finalColor += Sample2D(EmissiveMap, iTexCoord2).rgb * diffColor.rgb;
             finalColor += Sample2D(EmissiveMap, iTexCoord2).rgb * diffColor.rgb;
+			
+			#ifdef ENVCUBEMAP
+				finalColor += cMatEnvMapColor * SampleCube(EnvCubeMap, reflect(iReflectionVec, normal)).rgb * Sample2D(EmissiveMap, iTexCoord2).rgb;
+			#endif
+		#else
+			#ifdef ENVCUBEMAP
+				finalColor += cMatEnvMapColor * SampleCube(EnvCubeMap, reflect(iReflectionVec, normal)).rgb;
+			#endif
         #endif
         #endif
         #ifdef EMISSIVEMAP
         #ifdef EMISSIVEMAP
             finalColor += cMatEmissiveColor * Sample2D(EmissiveMap, iTexCoord.xy).rgb;
             finalColor += cMatEmissiveColor * Sample2D(EmissiveMap, iTexCoord.xy).rgb;

+ 1 - 1
Resources/CoreData/Techniques/DiffLightMap.xml

@@ -1,6 +1,6 @@
 <technique vs="LitSolid" ps="LitSolid" psdefines="DIFFMAP">
 <technique vs="LitSolid" ps="LitSolid" psdefines="DIFFMAP">
     <pass name="base" vsdefines="LIGHTMAP" psdefines="LIGHTMAP" />
     <pass name="base" vsdefines="LIGHTMAP" psdefines="LIGHTMAP" />
-    <pass name="light" depthtest="equal" depthwrite="false" blend="add" />
+    <pass name="light" vsdefines="LIGHTMAP" psdefines="LIGHTMAP" depthtest="equal" depthwrite="false" blend="subtract" />
     <pass name="prepass" psdefines="PREPASS" />
     <pass name="prepass" psdefines="PREPASS" />
     <pass name="material" vsdefines="LIGHTMAP" psdefines="MATERIAL LIGHTMAP" depthtest="equal" depthwrite="false" />
     <pass name="material" vsdefines="LIGHTMAP" psdefines="MATERIAL LIGHTMAP" depthtest="equal" depthwrite="false" />
     <pass name="deferred" vsdefines="LIGHTMAP" psdefines="DEFERRED LIGHTMAP" />
     <pass name="deferred" vsdefines="LIGHTMAP" psdefines="DEFERRED LIGHTMAP" />

+ 1 - 1
Script/AtomicEditor/ui/Shortcuts.ts

@@ -35,7 +35,7 @@ class Shortcuts extends Atomic.ScriptObject {
                     var args = "--resizable";
                     var args = "--resizable";
                     Atomic.editorMode.playProject(args, debug);
                     Atomic.editorMode.playProject(args, debug);
                 } else {
                 } else {
-                    var args = "--windowposx " + playerWindow.x + " --windowposy " + playerWindow.y + " --windowwidth " + playerWindow.width + " --windowheight " + playerWindow.height + " --resizable";
+                    var args = "--windowposx " + playerWindow.x + " --windowposy " + playerWindow.y + " --windowwidth " + playerWindow.width + " --windowheight " + playerWindow.height + " --resizable" + " --fromEditorPlay";
                     if (playerWindow.maximized) {
                     if (playerWindow.maximized) {
                         args += " --maximize";
                         args += " --maximize";
                     }
                     }

+ 1 - 2
Script/AtomicEditor/ui/frames/inspector/MaterialInspector.ts

@@ -318,8 +318,7 @@ class MaterialInspector extends ScriptWidget {
         section.contentRoot.addChild(attrsVerticalLayout);
         section.contentRoot.addChild(attrsVerticalLayout);
 
 
         // TODO: Filter on technique
         // TODO: Filter on technique
-        var textureUnits = [Atomic.TU_DIFFUSE, Atomic.TU_NORMAL, Atomic.TU_SPECULAR ,Atomic.TU_EMISSIVE];//, Atomic.TU_ENVIRONMENT,
-        //Atomic.TU_CUSTOM1, Atomic.TU_CUSTOM2];
+        var textureUnits = [ Atomic.TU_DIFFUSE, Atomic.TU_NORMAL, Atomic.TU_SPECULAR, Atomic.TU_EMISSIVE ];
 
 
         for (var i in textureUnits) {
         for (var i in textureUnits) {
 
 

+ 9 - 1
Script/AtomicEditor/ui/frames/menus/ProjectFrameMenu.ts

@@ -79,6 +79,13 @@ class ProjectFrameMenus extends Atomic.ScriptObject {
                 utils.revealInFinder(path);
                 utils.revealInFinder(path);
                 return true;
                 return true;
             }
             }
+
+            if (refid == "force_reimport") {
+                asset.setDirty(true);
+                ToolCore.assetDatabase.scan();
+                return true;
+            }
+
         }
         }
 
 
         return false;
         return false;
@@ -144,7 +151,8 @@ else if (Atomic.platform == "MacOSX") {
 
 
 var assetGeneralContextItems = {
 var assetGeneralContextItems = {
     "Rename": ["rename_asset", undefined, ""],
     "Rename": ["rename_asset", undefined, ""],
-    [showInFs]: ["reveal_folder", undefined, ""], 
+    "Force Reimport": ["force_reimport", undefined, ""],
+    [showInFs]: ["reveal_folder", undefined, ""],
     "-1": null,
     "-1": null,
     "Delete": ["delete_asset", undefined, ""]
     "Delete": ["delete_asset", undefined, ""]
 };
 };

+ 15 - 4
Source/Atomic/Engine/EngineConfig.cpp

@@ -326,13 +326,24 @@ bool EngineConfig::LoadFromFile(Context *context, const String& filename)
     return LoadFromJSON(json);
     return LoadFromJSON(json);
 }
 }
 
 
-void EngineConfig::ApplyConfig(VariantMap& settings)
+void EngineConfig::ApplyConfig(VariantMap& settings, bool overwrite)
 {
 {
     VariantMap::ConstIterator itr = engineConfig_.Begin();
     VariantMap::ConstIterator itr = engineConfig_.Begin();
-    while (itr != engineConfig_.End())
+    if (overwrite)
+    { 
+        while (itr != engineConfig_.End())
+        {
+            settings[itr->first_] = itr->second_;
+            itr++;
+        }
+    }
+    else
     {
     {
-        settings.InsertNew(itr->first_, itr->second_);
-        itr++;
+        while (itr != engineConfig_.End())
+        {
+            settings.InsertNew(itr->first_, itr->second_);
+            itr++;
+        }
     }
     }
 
 
 }
 }

+ 1 - 1
Source/Atomic/Engine/EngineConfig.h

@@ -40,7 +40,7 @@ public:
     static bool LoadFromJSON(const String& json);
     static bool LoadFromJSON(const String& json);
 
 
     /// Apply the configuration to a setting variant map, values that exist will not be overriden
     /// Apply the configuration to a setting variant map, values that exist will not be overriden
-    static void ApplyConfig(VariantMap& settings);
+    static void ApplyConfig(VariantMap& settings, bool overwrite = false);
 
 
     static const VariantMap& GetConfig() { return engineConfig_; }
     static const VariantMap& GetConfig() { return engineConfig_; }
 
 

+ 86 - 67
Source/AtomicEditor/Application/AEPlayerApp.cpp

@@ -52,7 +52,8 @@ namespace AtomicEditor
 
 
 AEPlayerApplication::AEPlayerApplication(Context* context) :
 AEPlayerApplication::AEPlayerApplication(Context* context) :
     AEEditorCommon(context),
     AEEditorCommon(context),
-    debugPlayer_(false)
+    debugPlayer_(false),
+    launchedByEditor_(false)
 {
 {
 }
 }
 
 
@@ -60,44 +61,98 @@ void AEPlayerApplication::Setup()
 {
 {
     AEEditorCommon::Setup();
     AEEditorCommon::Setup();
 
 
-    // Read the engine configuration
+    // Read the project engine configuration
     ReadEngineConfig();
     ReadEngineConfig();
 
 
     engine_->SetAutoExit(false);
     engine_->SetAutoExit(false);
 
 
     engineParameters_.InsertNew("WindowTitle", "AtomicPlayer");
     engineParameters_.InsertNew("WindowTitle", "AtomicPlayer");
 
 
+    // Set defaults not already set from config
 #if (ATOMIC_PLATFORM_ANDROID)
 #if (ATOMIC_PLATFORM_ANDROID)
-    engineParameters_["FullScreen"] = true;
-    engineParameters_["ResourcePaths"] = "CoreData;AtomicResources";
+    engineParameters_.InsertNew("FullScreen", true);
+    engineParameters_.InsertNew("ResourcePaths", "CoreData;AtomicResources");
 #elif ATOMIC_PLATFORM_WEB
 #elif ATOMIC_PLATFORM_WEB
-    engineParameters_["FullScreen"] = false;
-    engineParameters_["ResourcePaths"] = "AtomicResources";
-    // engineParameters_["WindowWidth"] = 1280;
-    // engineParameters_["WindowHeight"] = 720;
+    engineParameters_.InsertNew("FullScreen", false);
+    engineParameters_.InsertNew("ResourcePaths", "AtomicResources");
+    // engineParameters_.InsertNew("WindowWidth", 1280);
+    // engineParameters_.InsertNew("WindowHeight", 720);
 #elif ATOMIC_PLATFORM_IOS
 #elif ATOMIC_PLATFORM_IOS
-    engineParameters_["FullScreen"] = false;
-    engineParameters_["ResourcePaths"] = "AtomicResources";
+    engineParameters_.InsertNew("FullScreen", false);
+    engineParameters_.InsertNew("ResourcePaths", "AtomicResources)";
 #else
 #else
-    engineParameters_["FullScreen"] = false;
-    engineParameters_["WindowWidth"] = 1280;
-    engineParameters_["WindowHeight"] = 720;
+    engineParameters_.InsertNew("FullScreen", false);
+    engineParameters_.InsertNew("WindowWidth", 1280);
+    engineParameters_.InsertNew("WindowHeight", 720);
 #endif
 #endif
 
 
     engineParameters_.InsertNew("LogLevel", LOG_DEBUG);
     engineParameters_.InsertNew("LogLevel", LOG_DEBUG);
 
 
 #if ATOMIC_PLATFORM_WINDOWS || ATOMIC_PLATFORM_LINUX
 #if ATOMIC_PLATFORM_WINDOWS || ATOMIC_PLATFORM_LINUX
-    engineParameters_["WindowIcon"] = "Images/AtomicLogo32.png";
-    engineParameters_["ResourcePrefixPath"] = "AtomicPlayer_Resources";
+    engineParameters_.InsertNew("WindowIcon", "Images/AtomicLogo32.png");
+    engineParameters_.InsertNew("ResourcePrefixPath", "AtomicPlayer_Resources");
 #elif ATOMIC_PLATFORM_ANDROID
 #elif ATOMIC_PLATFORM_ANDROID
-    //engineParameters_["ResourcePrefixPath"] = "assets";
+    //engineParameters_.InsertNew("ResourcePrefixPath", "assets");
 #elif ATOMIC_PLATFORM_OSX
 #elif ATOMIC_PLATFORM_OSX
-    engineParameters_["ResourcePrefixPath"] = "../Resources";
+    engineParameters_.InsertNew("ResourcePrefixPath", "../Resources");
 #endif
 #endif
 
 
-    FileSystem* filesystem = GetSubsystem<FileSystem>();
+    // Read command line arguments, potentially overwriting project settings
+    ReadCommandLineArguments();
 
 
+    // Re-apply project settings if running from editor play button
+    if (launchedByEditor_)
+    {
+        EngineConfig::ApplyConfig(engineParameters_, true);
+    }
+
+    // Use the script file name as the base name for the log file
+    engineParameters_["LogName"] = GetSubsystem<FileSystem>()->GetAppPreferencesDir("AtomicPlayer", "Logs") + "AtomicPlayer.log";
+}
+
+void AEPlayerApplication::ReadEngineConfig()
+{
+    // find the project path from the command line args
+
+    String projectPath;
+    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 == "--project" && value.Length())
+            {
+                projectPath = AddTrailingSlash(value);
+                break;
+            }
+
+        }
+    }
+
+    if (!projectPath.Length())
+        return;
+
+    String filename = projectPath + "Settings/Engine.json";
+
+    FileSystem* fileSystem = GetSubsystem<FileSystem>();
+    if (!fileSystem->FileExists(filename))
+        return;
+
+    if (EngineConfig::LoadFromFile(context_, filename))
+    {
+        EngineConfig::ApplyConfig(engineParameters_);
+    }
+
+}
+
+void AEPlayerApplication::ReadCommandLineArguments()
+{
     const Vector<String>& arguments = GetArguments();
     const Vector<String>& arguments = GetArguments();
+    FileSystem* fileSystem = GetSubsystem<FileSystem>();
 
 
     for (unsigned i = 0; i < arguments.Size(); ++i)
     for (unsigned i = 0; i < arguments.Size(); ++i)
     {
     {
@@ -110,6 +165,12 @@ void AEPlayerApplication::Setup()
             {
             {
                 SubscribeToEvent(E_LOGMESSAGE, HANDLER(AEPlayerApplication, HandleLogMessage));
                 SubscribeToEvent(E_LOGMESSAGE, HANDLER(AEPlayerApplication, HandleLogMessage));
             }
             }
+            else if (argument.StartsWith("--ipc-server=") || argument.StartsWith("--ipc-client="))
+            {
+                // If we have IPC server/client we're being launched from the Editor
+                // TODO: Unify this with AEPlayerMode handling
+                launchedByEditor_ = true;
+            }
             else if (argument == "--debug")
             else if (argument == "--debug")
             {
             {
                 debugPlayer_ = true;
                 debugPlayer_ = true;
@@ -121,7 +182,7 @@ void AEPlayerApplication::Setup()
                 value = AddTrailingSlash(value);
                 value = AddTrailingSlash(value);
 
 
                 // check that cache exists
                 // check that cache exists
-                if (!filesystem->DirExists(value + "Cache"))
+                if (!fileSystem->DirExists(value + "Cache"))
                 {
                 {
                     ErrorExit("Project cache folder does not exist, projects must be loaded into the Atomic Editor at least once before using the --player command line mode");
                     ErrorExit("Project cache folder does not exist, projects must be loaded into the Atomic Editor at least once before using the --player command line mode");
                     return;
                     return;
@@ -130,18 +191,18 @@ void AEPlayerApplication::Setup()
 #ifdef ATOMIC_DEV_BUILD
 #ifdef ATOMIC_DEV_BUILD
 
 
                 String resourcePaths = ToString("%s/Resources/CoreData;%s/Resources/PlayerData;%sResources;%s;%sCache",
                 String resourcePaths = ToString("%s/Resources/CoreData;%s/Resources/PlayerData;%sResources;%s;%sCache",
-                         ATOMIC_ROOT_SOURCE_DIR, ATOMIC_ROOT_SOURCE_DIR, value.CString(), value.CString(), value.CString());
+                    ATOMIC_ROOT_SOURCE_DIR, ATOMIC_ROOT_SOURCE_DIR, value.CString(), value.CString(), value.CString());
 
 
 #else
 #else
 
 
 #ifdef __APPLE__
 #ifdef __APPLE__
                 engineParameters_["ResourcePrefixPath"] = "../Resources";
                 engineParameters_["ResourcePrefixPath"] = "../Resources";
 #else
 #else
-				engineParameters_["ResourcePrefixPath"] = filesystem->GetProgramDir() + "Resources";
+                engineParameters_["ResourcePrefixPath"] = fileSystem->GetProgramDir() + "Resources";
 #endif
 #endif
 
 
                 String resourcePaths = ToString("CoreData;PlayerData;%s/;%s/Resources;%s;%sCache",
                 String resourcePaths = ToString("CoreData;PlayerData;%s/;%s/Resources;%s;%sCache",
-                                                              value.CString(), value.CString(), value.CString(), value.CString());
+                    value.CString(), value.CString(), value.CString(), value.CString());
 #endif
 #endif
 
 
                 LOGINFOF("Adding ResourcePaths: %s", resourcePaths.CString());
                 LOGINFOF("Adding ResourcePaths: %s", resourcePaths.CString());
@@ -155,7 +216,7 @@ void AEPlayerApplication::Setup()
 #endif
 #endif
 
 
             }
             }
-            else if (argument == "--windowposx" && value.Length()) 
+            else if (argument == "--windowposx" && value.Length())
             {
             {
                 engineParameters_["WindowPositionX"] = atoi(value.CString());
                 engineParameters_["WindowPositionX"] = atoi(value.CString());
             }
             }
@@ -171,58 +232,16 @@ void AEPlayerApplication::Setup()
             {
             {
                 engineParameters_["WindowHeight"] = atoi(value.CString());
                 engineParameters_["WindowHeight"] = atoi(value.CString());
             }
             }
-            else if (argument == "--resizable") 
+            else if (argument == "--resizable")
             {
             {
                 engineParameters_["WindowResizable"] = true;
                 engineParameters_["WindowResizable"] = true;
-            } 
+            }
             else if (argument == "--maximize")
             else if (argument == "--maximize")
             {
             {
                 engineParameters_["WindowMaximized"] = true;
                 engineParameters_["WindowMaximized"] = true;
             }
             }
         }
         }
     }
     }
-
-    // Use the script file name as the base name for the log file
-    engineParameters_["LogName"] = filesystem->GetAppPreferencesDir("AtomicPlayer", "Logs") + "AtomicPlayer.log";
-}
-
-void AEPlayerApplication::ReadEngineConfig()
-{
-    // find the project path from the command line args
-
-    String projectPath;
-    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 == "--project" && value.Length())
-            {
-                projectPath = AddTrailingSlash(value);
-                break;
-            }
-
-        }
-    }
-
-    if (!projectPath.Length())
-        return;
-
-    FileSystem* filesystem = GetSubsystem<FileSystem>();
-    String filename = projectPath + "Settings/Engine.json";
-
-    if (!filesystem->FileExists(filename))
-        return;
-
-    if (EngineConfig::LoadFromFile(context_, filename))
-    {
-        EngineConfig::ApplyConfig(engineParameters_);
-    }
-
 }
 }
 
 
 void AEPlayerApplication::Start()
 void AEPlayerApplication::Start()

+ 4 - 0
Source/AtomicEditor/Application/AEPlayerApp.h

@@ -45,8 +45,12 @@ private:
 
 
     void ReadEngineConfig();
     void ReadEngineConfig();
 
 
+    void ReadCommandLineArguments();
+
     bool debugPlayer_;
     bool debugPlayer_;
 
 
+    bool launchedByEditor_;
+
 };
 };
 
 
 }
 }

+ 18 - 14
Source/AtomicEditor/Editors/SceneEditor3D/SceneEditor3D.cpp

@@ -29,6 +29,7 @@
 #include <ToolCore/Project/ProjectUserPrefs.h>
 #include <ToolCore/Project/ProjectUserPrefs.h>
 #include <ToolCore/Assets/AssetDatabase.h>
 #include <ToolCore/Assets/AssetDatabase.h>
 #include <ToolCore/Assets/Asset.h>
 #include <ToolCore/Assets/Asset.h>
+#include <ToolCore/Assets/SceneImporter.h>
 
 
 
 
 #include "../../EditorMode/AEEditorEvents.h"
 #include "../../EditorMode/AEEditorEvents.h"
@@ -71,24 +72,19 @@ SceneEditor3D::SceneEditor3D(Context* context, const String &fullpath, UITabCont
     sceneView_ = new SceneView3D(context_, this);
     sceneView_ = new SceneView3D(context_, this);
     editHistory_ = new SceneEditHistory(context, this);
     editHistory_ = new SceneEditHistory(context, this);
 
 
-    // EARLY ACCESS
-    if (fullpath.Find(String("ToonTown")) != String::NPOS)
+    AssetDatabase* assetDB = GetSubsystem<AssetDatabase>();
+    Asset* sceneAsset = assetDB->GetAssetByPath(fullpath);
+
+    if (sceneAsset)
     {
     {
-        sceneView_->GetCameraNode()->SetWorldPosition(Vector3(-119.073f, 76.1121f, 16.47763f));
-        Quaternion q(0.55f, 0.14f,  0.8f, -0.2f);
-        sceneView_->SetYaw(q.YawAngle());
-        sceneView_->SetPitch(q.PitchAngle());
-        sceneView_->GetCameraNode()->SetWorldRotation(q);
+        sceneImporter_ = static_cast<SceneImporter*>(sceneAsset->GetImporter());
+        sceneView_->GetCameraNode()->SetWorldPosition(sceneImporter_->GetSceneCamPosition());
+        sceneView_->SetPitch(sceneImporter_->GetSceneCamRotation().PitchAngle());
+        sceneView_->SetYaw(sceneImporter_->GetSceneCamRotation().YawAngle());
     }
     }
     else
     else
     {
     {
-        Node* playerSpawn = scene_->GetChild("PlayerInfoStart", true);
-        if (playerSpawn)
-        {
-            sceneView_->GetCameraNode()->SetPosition(playerSpawn->GetPosition());
-            sceneView_->SetYaw(playerSpawn->GetRotation().EulerAngles().y_);
-        }
-
+        LOGERRORF("SceneEditor3D::SceneEditor3D - Unable to get scene asset");
     }
     }
 
 
     sceneView_->SetGravity(UI_GRAVITY_ALL);
     sceneView_->SetGravity(UI_GRAVITY_ALL);
@@ -237,6 +233,14 @@ void SceneEditor3D::Close(bool navigateToAvailableResource)
     data["Scene"] = scene_;
     data["Scene"] = scene_;
     SendEvent("EditorSceneClosed", data);
     SendEvent("EditorSceneClosed", data);
 
 
+    if (sceneImporter_.NotNull())
+    {
+        sceneImporter_->SetSceneCamPosition(sceneView_->GetCameraNode()->GetWorldPosition());
+        sceneImporter_->SetSceneCamRotation(sceneView_->GetCameraNode()->GetWorldRotation());
+        sceneImporter_->GetAsset()->Save();
+        sceneImporter_ = nullptr;
+    }
+
     ResourceEditor::Close(navigateToAvailableResource);
     ResourceEditor::Close(navigateToAvailableResource);
 }
 }
 
 

+ 2 - 0
Source/AtomicEditor/Editors/SceneEditor3D/SceneEditor3D.h

@@ -30,6 +30,7 @@ class Octree;
 namespace ToolCore
 namespace ToolCore
 {
 {
     class ProjectUserPrefs;
     class ProjectUserPrefs;
+    class SceneImporter;
 }
 }
 
 
 using namespace ToolCore;
 using namespace ToolCore;
@@ -110,6 +111,7 @@ private:
 
 
     SharedPtr<SceneSelection> selection_;
     SharedPtr<SceneSelection> selection_;
     SharedPtr<SceneEditHistory> editHistory_;
     SharedPtr<SceneEditHistory> editHistory_;
+    SharedPtr<SceneImporter> sceneImporter_;
 
 
     SharedPtr<Node> clipboardNode_;
     SharedPtr<Node> clipboardNode_;
 
 

+ 2 - 0
Source/ThirdParty/TurboBadger/tb_editfield.cpp

@@ -232,6 +232,8 @@ bool TBEditField::OnEvent(const TBWidgetEvent &ev)
         {
         {
             // Post a message to start selection scroll
             // Post a message to start selection scroll
             PostMessageDelayed(TBIDC("selscroll"), nullptr, SELECTION_SCROLL_DELAY);
             PostMessageDelayed(TBIDC("selscroll"), nullptr, SELECTION_SCROLL_DELAY);
+            // forward to delegate, if any
+            TBWidget::OnEvent(ev);
             return true;
             return true;
         }
         }
     }
     }

+ 19 - 2
Source/ToolCore/Assets/SceneImporter.cpp

@@ -5,6 +5,8 @@
 // license information: https://github.com/AtomicGameEngine/AtomicGameEngine
 // license information: https://github.com/AtomicGameEngine/AtomicGameEngine
 //
 //
 
 
+#include <Atomic/Core/StringUtils.h>
+
 #include "Asset.h"
 #include "Asset.h"
 #include "AssetDatabase.h"
 #include "AssetDatabase.h"
 #include "SceneImporter.h"
 #include "SceneImporter.h"
@@ -25,6 +27,9 @@ SceneImporter::~SceneImporter()
 void SceneImporter::SetDefaults()
 void SceneImporter::SetDefaults()
 {
 {
     AssetImporter::SetDefaults();
     AssetImporter::SetDefaults();
+
+    sceneCamRotation_ = Quaternion::IDENTITY;
+    sceneCamPosition_ = Vector3::ZERO;
 }
 }
 
 
 bool SceneImporter::Import()
 bool SceneImporter::Import()
@@ -39,6 +44,14 @@ bool SceneImporter::LoadSettingsInternal(JSONValue& jsonRoot)
 
 
     JSONValue import = jsonRoot.Get("SceneImporter");
     JSONValue import = jsonRoot.Get("SceneImporter");
 
 
+    SetDefaults();
+
+    if (import.Get("sceneCamRotation").IsString())
+        sceneCamRotation_ = ToQuaternion(import.Get("sceneCamRotation").GetString());
+
+    if (import.Get("sceneCamPosition").IsString())
+        sceneCamPosition_ = ToVector3(import.Get("sceneCamPosition").GetString());
+
     return true;
     return true;
 }
 }
 
 
@@ -47,8 +60,12 @@ bool SceneImporter::SaveSettingsInternal(JSONValue& jsonRoot)
     if (!AssetImporter::SaveSettingsInternal(jsonRoot))
     if (!AssetImporter::SaveSettingsInternal(jsonRoot))
         return false;
         return false;
 
 
-    JSONValue import(JSONValue::emptyObject);
-    jsonRoot.Set("SceneImporter", import);
+    JSONValue save;
+
+    save.Set("sceneCamRotation", sceneCamRotation_.ToString());
+    save.Set("sceneCamPosition", sceneCamPosition_.ToString());
+
+    jsonRoot.Set("SceneImporter", save);
 
 
     return true;
     return true;
 }
 }

+ 13 - 0
Source/ToolCore/Assets/SceneImporter.h

@@ -23,6 +23,16 @@ public:
 
 
     virtual void SetDefaults();
     virtual void SetDefaults();
 
 
+    /// Set the scene camera's rotation
+    void SetSceneCamRotation(const Quaternion& rotation) { sceneCamRotation_ = rotation; }
+    /// Set the scene camera's position
+    void SetSceneCamPosition(const Vector3& position) { sceneCamPosition_ = position; }
+
+    /// Get the scene camera's rotation
+    const Quaternion& GetSceneCamRotation() const { return sceneCamRotation_; }
+    /// Get the scene camera's position
+    const Vector3& GetSceneCamPosition() const { return sceneCamPosition_; }
+
 protected:
 protected:
 
 
     bool Import();
     bool Import();
@@ -30,6 +40,9 @@ protected:
     virtual bool LoadSettingsInternal(JSONValue& jsonRoot);
     virtual bool LoadSettingsInternal(JSONValue& jsonRoot);
     virtual bool SaveSettingsInternal(JSONValue& jsonRoot);
     virtual bool SaveSettingsInternal(JSONValue& jsonRoot);
 
 
+    Quaternion sceneCamRotation_;
+    Vector3 sceneCamPosition_;
+
 };
 };
 
 
 }
 }

+ 5 - 1
Source/ToolCore/JSBind/JSBDoc.cpp

@@ -50,7 +50,11 @@ static String GetScriptType(JSBFunctionType* ftype)
 
 
 void JSBDoc::Begin()
 void JSBDoc::Begin()
 {
 {
-    source_ += "//Atomic JSDoc Definitions\n\n\n";
+    source_ += "//////////////////////////////////////////////////////////\n";
+    source_ += "// IMPORTANT: THIS FILE IS GENERATED, CHANGES WILL BE LOST\n";
+    source_ += "//////////////////////////////////////////////////////////\n\n";
+
+    source_ += "//Atomic JSDoc Definitions\n\n";
 
 
     source_ += "/**\n * Atomic Game Engine\n * @namespace\n*/\n var " + package_->GetName() + " = {}\n\n";
     source_ += "/**\n * Atomic Game Engine\n * @namespace\n*/\n var " + package_->GetName() + " = {}\n\n";
 }
 }

+ 4 - 1
Source/ToolCore/JSBind/JSBTypeScript.cpp

@@ -75,8 +75,11 @@ String JSBTypeScript::GetScriptType(JSBFunctionType* ftype)
 
 
 void JSBTypeScript::Begin()
 void JSBTypeScript::Begin()
 {
 {
-    source_ += "//Atomic TypeScript Definitions\n\n\n";
+    source_ += "//////////////////////////////////////////////////////////\n";
+    source_ += "// IMPORTANT: THIS FILE IS GENERATED, CHANGES WILL BE LOST\n";
+    source_ += "//////////////////////////////////////////////////////////\n\n";
 
 
+    source_ += "// Atomic TypeScript Definitions\n\n";
 
 
     if (package_->GetName() != "Atomic")
     if (package_->GetName() != "Atomic")
     {
     {