Browse Source

Merge pull request #609 from AtomicGameEngine/JME-ATOMIC-608

Adding Scan/Force Reimport to developer debug menu, adding ATOMIC_DEBUG preprocessor, cleanups
JoshEngebretson 10 years ago
parent
commit
5d1701ca6f

+ 2 - 0
Build/CMake/Modules/AtomicAndroid.cmake

@@ -1,4 +1,6 @@
 
+include(AtomicCommon)
+
 set (JAVASCRIPT_BINDINGS_PLATFORM "ANDROID")
 
 add_definitions(-DATOMIC_PLATFORM_ANDROID)

+ 3 - 0
Build/CMake/Modules/AtomicCommon.cmake

@@ -0,0 +1,3 @@
+
+set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DATOMIC_DEBUG")
+set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DATOMIC_DEBUG")

+ 3 - 0
Build/CMake/Modules/AtomicDesktop.cmake

@@ -1,3 +1,6 @@
+
+include(AtomicCommon)
+
 include_directories(${CMAKE_SOURCE_DIR}/Source/ThirdParty/Poco/Foundation/include)
 
 add_definitions( -DATOMIC_NAVIGATION -DATOMIC_TBUI -DATOMIC_FILEWATCHER -DPOCO_NO_AUTOMATIC_LIBS -DPOCO_STATIC )

+ 2 - 0
Build/CMake/Modules/AtomicIOS.cmake

@@ -1,5 +1,7 @@
 include (BundleUtilities)
 
+include(AtomicCommon)
+
 set (JAVASCRIPT_BINDINGS_PLATFORM "IOS")
 
 add_definitions (-DIOS -DATOMIC_PLATFORM_IOS -DATOMIC_OPENGL -DKNET_UNIX -DATOMIC_TBUI)

+ 0 - 1
Build/CMake/Modules/AtomicLinux.cmake

@@ -3,7 +3,6 @@ set (ATOMIC_NODE_JAKE Build/Linux/node/node Build/node_modules/jake/bin/cli.js
 
 include(AtomicDesktop)
 
-
 add_definitions(-DATOMIC_PLATFORM_LINUX -DATOMIC_OPENGL -DKNET_UNIX -DHAVE_INT64_T)
 
 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-offsetof -std=gnu++0x")

+ 2 - 0
Build/CMake/Modules/AtomicWeb.cmake

@@ -1,4 +1,6 @@
 
+include(AtomicCommon)
+
 set (JAVASCRIPT_BINDINGS_PLATFORM "WEB")
 
 add_definitions(-DATOMIC_PLATFORM_WEB)

+ 32 - 3
Script/AtomicEditor/ui/frames/menus/MainFrameMenu.ts

@@ -22,6 +22,7 @@ class MainFrameMenu extends Atomic.ScriptObject {
         MenuItemSources.createMenuItemSource("menu tools", toolsItems);
         MenuItemSources.createMenuItemSource("menu developer", developerItems);
         MenuItemSources.createMenuItemSource("menu help", helpItems);
+
     }
 
     handlePopupMenu(target: Atomic.UIWidget, refid: string): boolean {
@@ -176,10 +177,31 @@ class MainFrameMenu extends Atomic.ScriptObject {
             }
 
             if (refid == "developer show uidebugger") {
-                Atomic.UI.debugShowSettingsWindow(EditorUI.getView());
+
+                if (Atomic.engine.debugBuild) {
+                    Atomic.UI.debugShowSettingsWindow(EditorUI.getView());
+                }
+                else {
+                    EditorUI.showModalError("Debug Build Required",
+                        "UIDebugger currently requires a Debug engine build");
+                }
+
                 return true;
             }
 
+            if (refid == "developer assetdatabase scan") {
+
+              ToolCore.assetDatabase.scan();
+
+            }
+
+            if (refid == "developer assetdatabase force") {
+
+              ToolCore.assetDatabase.reimportAllAssets();
+
+            }
+
+
         } else if (target.id == "menu tools popup") {
 
             if (refid == "tools toggle profiler") {
@@ -278,7 +300,14 @@ var buildItems = {
 var developerItems = {
 
     "Show Console": ["developer show console"],
-    "Show UI Debugger": ["developer show uidebugger"]
+    "Debug": {
+        "UI Debugger": ["developer show uidebugger"],
+        "Asset Database": {
+            "Scan": ["developer assetdatabase scan"],
+            "Force Reimport": ["developer assetdatabase force"]
+        }
+    }
+
 
 };
 
@@ -293,7 +322,7 @@ var fileItems = {
     "Save File": ["file save file", StringID.ShortcutSaveFile],
     "Save All Files": ["file save all"],
     "Close File": ["file close file", StringID.ShortcutCloseFile],
-     "-3": null,
+    "-3": null,
     "Quit": "quit"
 };
 

+ 14 - 0
Source/Atomic/Engine/Engine.cpp

@@ -958,4 +958,18 @@ void Engine::DoExit()
 #endif
 }
 
+// ATOMIC BEGIN
+
+bool Engine::GetDebugBuild()
+{
+#ifdef ATOMIC_DEBUG
+    return true;
+#else
+    return false;
+#endif
+}
+
+// ATOMIC END
+
+
 }

+ 4 - 0
Source/Atomic/Engine/Engine.h

@@ -118,6 +118,10 @@ public:
     static const Variant
         & GetParameter(const VariantMap& parameters, const String& parameter, const Variant& defaultValue = Variant::EMPTY);
 
+    // ATOMIC BEGIN
+    static bool GetDebugBuild();
+    // ATOMIC END
+
 private:
     /// Handle exit requested event. Auto-exit if enabled.
     void HandleExitRequested(StringHash eventType, VariantMap& eventData);

+ 1 - 1
Source/Atomic/UI/UI.cpp

@@ -914,7 +914,7 @@ bool UI::OnWidgetInvokeEvent(tb::TBWidget *widget, const tb::TBWidgetEvent &ev)
 void UI::DebugShowSettingsWindow(UIWidget* parent)
 {
 
-#ifdef TB_RUNTIME_DEBUG_INFO
+#ifdef ATOMIC_DEBUG
     if (parent && parent->GetInternalWidget())
         tb::ShowDebugInfoSettingsWindow(parent->GetInternalWidget());
 #endif

+ 14 - 0
Source/ToolCore/Assets/AssetDatabase.cpp

@@ -555,5 +555,19 @@ String AssetDatabase::GetResourceImporterName(const String& resourceTypeName)
 
 }
 
+void AssetDatabase::ReimportAllAssets()
+{
+    List<SharedPtr<Asset>>::ConstIterator itr = assets_.Begin();
+
+    while (itr != assets_.End())
+    {
+        (*itr)->SetDirty(true);
+        itr++;
+    }
+
+    Scan();
+
+}
+
 
 }

+ 2 - 0
Source/ToolCore/Assets/AssetDatabase.h

@@ -40,6 +40,8 @@ public:
 
     void Scan();
 
+    void ReimportAllAssets();
+
     void GetFolderAssets(String folder, PODVector<Asset*>& assets) const;
 
     String GetResourceImporterName(const String& resourceTypeName);