Commit: 4b9d242be53203dfa6dc8cd86aef79cce24bc00a
Author: Campbell Barton
Date:   Thu Nov 22 15:16:45 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB4b9d242be53203dfa6dc8cd86aef79cce24bc00a

Merge branch 'master' into blender2.8

===================================================================



===================================================================

diff --cc source/blender/blenkernel/intern/blender_undo.c
index a00ad5ff05f,441687c1c01..fac3685f7b1
--- a/source/blender/blenkernel/intern/blender_undo.c
+++ b/source/blender/blenkernel/intern/blender_undo.c
@@@ -55,10 -55,9 +55,11 @@@
  #include "BKE_main.h"
  
  #include "BLO_undofile.h"
+ #include "BLO_readfile.h"
  #include "BLO_writefile.h"
  
 +#include "DEG_depsgraph.h"
 +
  /* -------------------------------------------------------------------- */
  
  /** \name Global Undo
diff --cc source/blender/blenkernel/intern/blendfile.c
index 5a975402c90,c6cb8a412fe..cc42fe71579
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@@ -414,11 -392,11 +417,11 @@@ bool BKE_blendfile_read_from_memory
  {
        BlendFileData *bfd;
  
-       bfd = BLO_read_from_memory(filebuf, filelength, reports, skip_flags);
+       bfd = BLO_read_from_memory(filebuf, filelength, params->skip_flags, 
reports);
        if (bfd) {
                if (update_defaults)
 -                      BLO_update_defaults_startup_blend(bfd->main);
 +                      BLO_update_defaults_startup_blend(bfd->main, NULL);
-               setup_app_data(C, bfd, "<memory2>", reports);
+               setup_app_data(C, bfd, "<memory2>", params->is_startup, 
reports);
        }
        else {
                BKE_reports_prepend(reports, "Loading failed: ");
@@@ -561,54 -543,6 +568,54 @@@ bool BKE_blendfile_userdef_write_app_te
        return ok;
  }
  
 +WorkspaceConfigFileData *BKE_blendfile_workspace_config_read(const char 
*filepath, const void *filebuf, int filelength, ReportList *reports)
 +{
 +      BlendFileData *bfd;
 +      WorkspaceConfigFileData *workspace_config = NULL;
 +
 +      if (filepath) {
-               bfd = BLO_read_from_file(filepath, reports, 
BLO_READ_SKIP_USERDEF);
++              bfd = BLO_read_from_file(filepath, BLO_READ_SKIP_USERDEF, 
reports);
 +      }
 +      else {
-               bfd = BLO_read_from_memory(filebuf, filelength, reports, 
BLO_READ_SKIP_USERDEF);
++              bfd = BLO_read_from_memory(filebuf, filelength, 
BLO_READ_SKIP_USERDEF, reports);
 +      }
 +
 +      if (bfd) {
 +              workspace_config = MEM_mallocN(sizeof(*workspace_config), 
__func__);
 +              workspace_config->main = bfd->main;
 +              workspace_config->workspaces = bfd->main->workspaces;
 +
 +              MEM_freeN(bfd);
 +      }
 +
 +      return workspace_config;
 +}
 +
 +bool BKE_blendfile_workspace_config_write(Main *bmain, const char *filepath, 
ReportList *reports)
 +{
 +      int fileflags = G.fileflags & ~(G_FILE_NO_UI | G_FILE_HISTORY);
 +      bool retval = false;
 +
 +      BKE_blendfile_write_partial_begin(bmain);
 +
 +      for (WorkSpace *workspace = bmain->workspaces.first; workspace; 
workspace = workspace->id.next) {
 +              BKE_blendfile_write_partial_tag_ID(&workspace->id, true);
 +      }
 +
 +      if (BKE_blendfile_write_partial(bmain, filepath, fileflags, reports)) {
 +              retval = true;
 +      }
 +
 +      BKE_blendfile_write_partial_end(bmain);
 +
 +      return retval;
 +}
 +
 +void BKE_blendfile_workspace_config_data_free(WorkspaceConfigFileData 
*workspace_config)
 +{
 +      BKE_main_free(workspace_config->main);
 +      MEM_freeN(workspace_config);
 +}
  
  /** \} */
  
diff --cc source/blender/blenloader/BLO_readfile.h
index ef02e7d7034,5a1c479f450..df8cc164869
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@@ -75,12 -72,10 +75,16 @@@ typedef struct BlendFileData 
        eBlenFileType type;
  } BlendFileData;
  
 +typedef struct WorkspaceConfigFileData {
 +      struct Main *main; /* has to be freed when done reading file data */
 +
 +      struct ListBase workspaces;
 +} WorkspaceConfigFileData;
 +
+ struct BlendFileReadParams {
+       uint skip_flags : 2;  /* eBLOReadSkip */
+       uint is_startup : 1;
+ };
  
  /* skip reading some data-block types (may want to skip screen data too). */
  typedef enum eBLOReadSkip {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to