]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
refresh DPK VFS before refreshing textures
authorThomas Debesse <dev@illwieckz.net>
Sat, 15 Jul 2017 12:08:24 +0000 (14:08 +0200)
committerThomas Debesse <dev@illwieckz.net>
Sat, 15 Jul 2017 12:41:44 +0000 (14:41 +0200)
DPK VFS allows to add and remove pak dependencies.

Reloading VFS before refreshing textures ensures
added or removed dependencies are handled without
reloading the whole map.

It allows the user to edit the DEPS file while radiant
is running, he just has to reload the VFS asking for
texture refresh.

include/ifilesystem.h
plugins/vfspk3/vfs.cpp
radiant/mainframe.cpp
radiant/mainframe.h
radiant/texwindow.cpp

index 6bbc0db21789718a137d99528c49d77da01a374e..70b5da92bbb96503b4fb24002f7f98f36bd4df95 100644 (file)
@@ -50,6 +50,10 @@ virtual void initDirectory( const char *path ) = 0;
 /// \brief Initialises the filesystem.
 /// Called after all root search paths have been added.
 virtual void initialise() = 0;
+/// \brief Clear the filesystem if supported
+virtual void clear() = 0;
+/// \brief Reload the filesystem if supported
+virtual void refresh() = 0;
 /// \brief Shuts down the filesystem.
 virtual void shutdown() = 0;
 
index a76fafbaabe211c3ae04262538c9847327c56195..bee7403beb75ae81f5168581d6315668ef808cde 100644 (file)
@@ -848,6 +848,12 @@ void initDirectory( const char *path ){
        InitDirectory( path, FileSystemQ3API_getArchiveModules() );
 }
 void initialise(){
+       load();
+       globalOutputStream() << "filesystem initialised\n";
+       g_observers.realise();
+}
+
+void load(){
        ArchiveModules& archiveModules = FileSystemQ3API_getArchiveModules();
        bool is_dpk_vfs = GetArchiveTable( archiveModules, "dpk" );
 
@@ -873,10 +879,19 @@ void initialise(){
                g_pakfile_paths.clear();
                g_loaded_dpk_paks.clear();
        }
+}
 
-       globalOutputStream() << "filesystem initialised\n";
-       g_observers.realise();
+void clear() {
+       // like shutdown() but does not unrealise (keep map etc.)
+       Shutdown();
 }
+
+void refresh(){
+       // like initialise() but does not realise (keep map etc.)
+       load();
+       globalOutputStream() << "filesystem refreshed\n";
+}
+
 void shutdown(){
        g_observers.unrealise();
        globalOutputStream() << "filesystem shutdown\n";
index 8abd6e2a5e8a86286d209bf5232d50242edf27b6..7a9e141ee45b9e9f4c6e503bfc2a31506135b332 100644 (file)
@@ -160,6 +160,13 @@ void VFS_Shutdown(){
        GlobalFileSystem().shutdown();
        g_vfsInitialized = false;
 }
+void VFS_Refresh(){
+       if ( !g_vfsInitialized ) return;
+       GlobalFileSystem().clear();
+       QE_InitVFS();
+       GlobalFileSystem().refresh();
+       g_vfsInitialized = true;
+}
 void VFS_Restart(){
        VFS_Shutdown();
        VFS_Init();
index c273845082dfa0fc28537b16ec4ba873e45a87a7..c450fd549ca50a9231b9bf0e8d49c8b7ffcd1341 100644 (file)
@@ -245,6 +245,7 @@ void gamemode_set( const char* gamemode );
 void Radiant_attachGameModeObserver( ModuleObserver& observer );
 void Radiant_detachGameModeObserver( ModuleObserver& observer );
 
+void VFS_Refresh();
 void VFS_Restart();
 void VFS_Construct();
 void VFS_Destroy();
index e9ec10f933eb9ac2b14c91d5716027dd8f4e7df1..e30f1035112e8eaa1122c0fd4483fda619177509 100644 (file)
@@ -2361,6 +2361,7 @@ void TextureBrowser_pasteTag(){
 
 void RefreshShaders(){
        ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Loading Shaders" );
+       VFS_Refresh();
        GlobalShaderSystem().refresh();
        UpdateAllWindows();
        GtkTreeSelection* selection = gtk_tree_view_get_selection((GtkTreeView*)GlobalTextureBrowser().m_treeViewTree);