diff options
Diffstat (limited to 'source/blender/blenkernel/intern/blendfile.c')
-rw-r--r-- | source/blender/blenkernel/intern/blendfile.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c index e31494ecb4e..813275e097d 100644 --- a/source/blender/blenkernel/intern/blendfile.c +++ b/source/blender/blenkernel/intern/blendfile.c @@ -37,6 +37,7 @@ #include "IMB_colormanagement.h" +#include "BKE_addon.h" #include "BKE_appdir.h" #include "BKE_blender.h" #include "BKE_blender_version.h" @@ -552,6 +553,35 @@ UserDef *BKE_blendfile_userdef_read_from_memory(const void *filebuf, return userdef; } +UserDef *BKE_blendfile_userdef_from_defaults(void) +{ + UserDef *userdef = MEM_mallocN(sizeof(*userdef), __func__); + + memcpy(userdef, &U_default, sizeof(UserDef)); + + /* Add-ons. */ + { + const char *addons[] = { + "io_anim_bvh", + "io_curve_svg", + "io_mesh_ply", + "io_mesh_stl", + "io_mesh_uv_layout", + "io_scene_fbx", + "io_scene_gltf2", + "io_scene_obj", + "io_scene_x3d", + }; + for (int i; i < ARRAY_SIZE(addons); i++) { + bAddon *addon = BKE_addon_new(); + STRNCPY(addon->module, addons[i]); + BLI_addtail(&userdef->addons, addon); + } + } + + return userdef; +} + /** * Only write the userdef in a .blend * \return success |