Merge branch 'master' into blender2.8
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 22 Nov 2017 11:50:17 +0000 (12:50 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 22 Nov 2017 11:50:17 +0000 (12:50 +0100)
1  2 
source/blender/blenkernel/BKE_blendfile.h
source/blender/blenkernel/intern/blendfile.c
source/blender/editors/mesh/editmesh_utils.c
source/blender/editors/space_sequencer/sequencer_add.c
source/blender/makesrna/RNA_enum_types.h
source/blender/makesrna/intern/rna_mesh.c
source/blender/windowmanager/intern/wm_files.c
source/blender/windowmanager/intern/wm_operators.c

index d9fff5343b0a3ed59339b53ddb98857528d885d2,1cf8a78fef375af73e419b022f1f299a69a8425e..0a8eac7961a11a0f5939540aee1b801b688eb0e5
@@@ -58,13 -58,8 +58,12 @@@ struct UserDef *BKE_blendfile_userdef_r
          const void *filebuf, int filelength,
          struct ReportList *reports);
  
int BKE_blendfile_userdef_write(const char *filepath, struct ReportList *reports);
bool BKE_blendfile_userdef_write(const char *filepath, struct ReportList *reports);
  
 +struct WorkspaceConfigFileData *BKE_blendfile_workspace_config_read(const char *filepath, struct ReportList *reports);
 +bool BKE_blendfile_workspace_config_write(struct Main *bmain, const char *filepath, struct ReportList *reports);
 +void BKE_blendfile_workspace_config_data_free(struct WorkspaceConfigFileData *workspace_config);
 +
  /* partial blend file writing */
  void BKE_blendfile_write_partial_tag_ID(struct ID *id, bool set);
  void BKE_blendfile_write_partial_begin(struct Main *bmain_src);
index 211f92c2e7834797595da6c92f7765de9bd3e04b,99e3769572a6754a119fb42989eed04c1a9c58f8..6df008e7ac9f8235386b72ed993302e2f1bc6341
@@@ -533,52 -512,9 +536,52 @@@ bool BKE_blendfile_userdef_write(const 
  
        MEM_freeN(mainb);
  
-       return retval;
+       return ok;
  }
  
 +WorkspaceConfigFileData *BKE_blendfile_workspace_config_read(const char *filepath, ReportList *reports)
 +{
 +      BlendFileData *bfd;
 +      WorkspaceConfigFileData *workspace_config = NULL;
 +
 +      bfd = BLO_read_from_file(filepath, reports, BLO_READ_SKIP_USERDEF);
 +      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_AUTOPLAY | 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);
 +}
 +
  /** \} */