Cleanup: move BlendFileData to C++
This simplifies potentially adding more data to the struct. Pull Request: https://projects.blender.org/blender/blender/pulls/133050
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_sys_types.h"
|
||||
#include "BLI_utility_mixins.hh"
|
||||
|
||||
/** \file
|
||||
* \ingroup blenloader
|
||||
@@ -51,26 +52,26 @@ enum eBlenFileType {
|
||||
// BLENFILETYPE_RUNTIME = 3, /* UNUSED */
|
||||
};
|
||||
|
||||
struct BlendFileData {
|
||||
Main *main;
|
||||
UserDef *user;
|
||||
struct BlendFileData : blender::NonCopyable, blender::NonMovable {
|
||||
Main *main = nullptr;
|
||||
UserDef *user = nullptr;
|
||||
|
||||
int fileflags;
|
||||
int globalf;
|
||||
int fileflags = 0;
|
||||
int globalf = 0;
|
||||
/** Typically the actual filepath of the read blend-file, except when recovering
|
||||
* save-on-exit/autosave files. In the latter case, it will be the path of the file that
|
||||
* generated the auto-saved one being recovered.
|
||||
*
|
||||
* NOTE: Currently expected to be the same path as #BlendFileData.filepath. */
|
||||
char filepath[1024]; /* 1024 = FILE_MAX */
|
||||
char filepath[1024] = {}; /* 1024 = FILE_MAX */
|
||||
|
||||
/** TODO: think this isn't needed anymore? */
|
||||
bScreen *curscreen;
|
||||
Scene *curscene;
|
||||
bScreen *curscreen = nullptr;
|
||||
Scene *curscene = nullptr;
|
||||
/** Layer to activate in workspaces when reading without UI. */
|
||||
ViewLayer *cur_view_layer;
|
||||
ViewLayer *cur_view_layer = nullptr;
|
||||
|
||||
eBlenFileType type;
|
||||
eBlenFileType type = eBlenFileType(0);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -401,7 +401,7 @@ void BLO_blendfiledata_free(BlendFileData *bfd)
|
||||
MEM_freeN(bfd->user);
|
||||
}
|
||||
|
||||
MEM_freeN(bfd);
|
||||
MEM_delete(bfd);
|
||||
}
|
||||
|
||||
void BLO_read_do_version_after_setup(Main *new_bmain,
|
||||
|
||||
@@ -3645,7 +3645,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
|
||||
* non-BLO functions (e.g. ID deletion) can indirectly trigger it. */
|
||||
BKE_layer_collection_resync_forbid();
|
||||
|
||||
bfd = static_cast<BlendFileData *>(MEM_callocN(sizeof(BlendFileData), "blendfiledata"));
|
||||
bfd = MEM_new<BlendFileData>(__func__);
|
||||
|
||||
bfd->main = BKE_main_new();
|
||||
bfd->main->versionfile = fd->fileversion;
|
||||
|
||||
Reference in New Issue
Block a user