|
Blender
V2.93
|
#include <string.h>#include "MEM_guardedalloc.h"#include "BLI_blenlib.h"#include "BLI_ghash.h"#include "BLI_mempool.h"#include "BLI_threads.h"#include "DNA_ID.h"#include "BKE_global.h"#include "BKE_lib_id.h"#include "BKE_lib_query.h"#include "BKE_main.h"#include "IMB_imbuf.h"#include "IMB_imbuf_types.h"Go to the source code of this file.
Functions | |
| Main * | BKE_main_new (void) |
| void | BKE_main_free (Main *mainvar) |
| void | BKE_main_lock (struct Main *bmain) |
| void | BKE_main_unlock (struct Main *bmain) |
| static int | main_relations_create_idlink_cb (LibraryIDLinkCallbackData *cb_data) |
| void | BKE_main_relations_create (Main *bmain, const short flag) |
| void | BKE_main_relations_free (Main *bmain) |
| void | BKE_main_relations_tag_set (struct Main *bmain, const MainIDRelationsEntryTags tag, const bool value) |
| GSet * | BKE_main_gset_create (Main *bmain, GSet *gset) |
| BlendThumbnail * | BKE_main_thumbnail_from_imbuf (Main *bmain, ImBuf *img) |
| ImBuf * | BKE_main_thumbnail_to_imbuf (Main *bmain, BlendThumbnail *data) |
| void | BKE_main_thumbnail_create (struct Main *bmain) |
| const char * | BKE_main_blendfile_path (const Main *bmain) |
| const char * | BKE_main_blendfile_path_from_global (void) |
| ListBase * | which_libbase (Main *bmain, short type) |
| int | set_listbasepointers (Main *bmain, ListBase *lb[INDEX_ID_MAX]) |
| const char* BKE_main_blendfile_path | ( | const Main * | bmain | ) |
Return filepath of given main.
Definition at line 428 of file main.c.
References Main::name.
Referenced by BKE_main_blendfile_path_from_global().
| const char* BKE_main_blendfile_path_from_global | ( | void | ) |
Return filepath of global main G_MAIN.
Definition at line 439 of file main.c.
References BKE_main_blendfile_path(), and G_MAIN.
Referenced by bpy_lib_write(), blender::compositor::OutputOpenExrSingleLayerMultiViewOperation::deinitExecution(), blender::compositor::OutputOpenExrMultiLayerMultiViewOperation::deinitExecution(), blender::compositor::OutputStereoOperation::deinitExecution(), blender::compositor::OutputSingleLayerOperation::deinitExecution(), blender::compositor::OutputOpenExrMultiLayerOperation::deinitExecution(), dynamicPaint_outputSurfaceImage(), filelist_setdir(), fileselect_ensure_updated_file_params(), fileselect_initialize_params_common(), get_proxy_fname(), icon_preview_imbuf_from_brush(), library_link_end(), movieclip_open_anim_file(), pose_copy_exec(), pose_paste_exec(), ptcache_path(), render_result_exr_file_cache_path(), render_result_exr_file_path(), screenshot_exec(), screenshot_invoke(), SEQ_add_image_init_alpha_mode(), SEQ_add_reload_new_file(), seq_open_anim_file(), seq_proxy_get_custom_file_fname(), seq_proxy_get_fname(), seq_proxy_multiview_context_invalid(), seq_render_image_strip(), stampdata(), wm_autosave_location(), wm_history_file_update(), WM_init(), wm_link_append_invoke(), wm_window_title(), and write_crash_blend().
| void BKE_main_free | ( | Main * | mainvar | ) |
Definition at line 53 of file main.c.
References Freestyle::a, BKE_id_free_ex(), BKE_main_relations_free(), Main::blen_thumb, BLI_assert_unreachable, BLI_listbase_clear(), BLI_spin_end(), ListBase::first, id, INDEX_ID_MAX, LIB_ID_FREE_NO_DEG_TAG, LIB_ID_FREE_NO_MAIN, LIB_ID_FREE_NO_UI_USER, LIB_ID_FREE_NO_USER_REFCOUNT, Main::lock, MEM_freeN, MEM_SAFE_FREE, ID::next, NULL, Main::relations, and set_listbasepointers().
Referenced by BKE_blender_free(), BKE_blender_globals_clear(), BKE_blendfile_userdef_read(), BKE_blendfile_userdef_read_from_memory(), BKE_blendfile_workspace_config_data_free(), BKE_lib_override_library_operations_store_finalize(), BLO_blendfiledata_free(), blo_join_main(), BLO_library_temp_free(), bpy_rna_data_context_exit(), ED_preview_free_dbase(), library_link_end(), object_preview_render(), pose_copy_exec(), pose_paste_exec(), read_libraries(), render_endjob(), seq_prefetch_free(), blender::io::alembic::AlembicExportTest::TearDown(), and Freestyle::BlenderStrokeRenderer::~BlenderStrokeRenderer().
Create a GSet storing all IDs present in given bmain, by their pointers.
| gset | If not NULL, given GSet will be extended with IDs from given bmain, instead of creating a new one. |
Definition at line 342 of file main.c.
References BLI_ghashutil_ptrcmp(), BLI_ghashutil_ptrhash(), BLI_gset_add(), BLI_gset_new(), FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, id, and NULL.
Referenced by BKE_main_idmap_create().
| void BKE_main_lock | ( | struct Main * | bmain | ) |
Definition at line 202 of file main.c.
References BLI_spin_lock(), and Main::lock.
Referenced by BKE_id_free_ex(), BKE_libblock_alloc(), BKE_libblock_management_main_add(), BKE_libblock_management_main_remove(), BKE_libblock_remap(), BKE_libblock_remap_locked(), BKE_libblock_unlink(), BKE_objects_materials_test_all(), BLO_main_validate_libraries(), BLO_main_validate_shapekeys(), id_delete(), and lib_relocate_do().
| Main* BKE_main_new | ( | void | ) |
Definition at line 45 of file main.c.
References BLI_spin_init(), Main::lock, MEM_callocN, and MEM_mallocN.
Referenced by BKE_blender_globals_init(), BKE_lib_override_library_operations_store_init(), Freestyle::BlenderStrokeRenderer::BlenderStrokeRenderer(), blo_find_main(), BLO_library_temp_load_id(), blo_read_file_internal(), blo_split_main(), bpy_rna_data_context_enter(), direct_link_library(), library_link_end(), object_preview_render(), pose_copy_exec(), pose_paste_exec(), read_libraries(), seq_prefetch_start_ex(), and blender::io::alembic::AlembicExportTest::SetUp().
| void BKE_main_relations_create | ( | Main * | bmain, |
| const short | flag | ||
| ) |
Generate the mappings between used IDs and their users, and vice-versa.
Definition at line 265 of file main.c.
References BKE_library_foreach_ID_link(), BKE_main_relations_free(), BLI_assert, BLI_ghash_ensure_p(), BLI_ghash_new(), BLI_ghashutil_ptrcmp(), BLI_ghashutil_ptrhash(), BLI_mempool_create(), BLI_MEMPOOL_NOP, MainIDRelations::entry_items_pool, MainIDRelations::flag, FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, id, IDWALK_INCLUDE_UI, IDWALK_READONLY, main_relations_create_idlink_cb(), MAINIDRELATIONS_INCLUDE_UI, MEM_callocN, MEM_mallocN, NULL, Main::relations, MainIDRelations::relations_from_pointers, and ID::session_uuid.
Referenced by BKE_lib_override_library_delete(), BKE_lib_override_library_id_hierarchy_reset(), BKE_lib_override_library_main_resync(), BKE_lib_override_library_resync(), BKE_lib_query_unused_ids_tag(), BKE_library_make_local(), and lib_override_library_create_do().
| void BKE_main_relations_free | ( | Main * | bmain | ) |
Definition at line 300 of file main.c.
References BLI_ghash_free(), BLI_mempool_destroy(), MainIDRelations::entry_items_pool, MEM_freeN, NULL, Main::relations, and MainIDRelations::relations_from_pointers.
Referenced by BKE_lib_override_library_delete(), BKE_lib_override_library_id_hierarchy_reset(), BKE_lib_override_library_main_resync(), BKE_lib_override_library_resync(), BKE_lib_query_unused_ids_tag(), BKE_library_make_local(), BKE_main_free(), BKE_main_relations_create(), and lib_override_library_create_do().
| void BKE_main_relations_tag_set | ( | struct Main * | bmain, |
| const MainIDRelationsEntryTags | tag, | ||
| const bool | value | ||
| ) |
Set or clear given tag in all relation entries of given bmain.
Definition at line 313 of file main.c.
References BLI_ghashIterator_done(), BLI_ghashIterator_free(), BLI_ghashIterator_getValue(), BLI_ghashIterator_new(), BLI_ghashIterator_step(), NULL, Main::relations, MainIDRelations::relations_from_pointers, and MainIDRelationsEntry::tags.
Referenced by BKE_lib_override_library_main_resync(), BKE_lib_override_library_resync(), and lib_override_library_create_do().
| void BKE_main_thumbnail_create | ( | struct Main * | bmain | ) |
Generates an empty (black) thumbnail for given Main.
Definition at line 416 of file main.c.
References Main::blen_thumb, BLEN_THUMB_MEMSIZE, BLEN_THUMB_SIZE, BlendThumbnail::height, MEM_callocN, MEM_SAFE_FREE, and BlendThumbnail::width.
| BlendThumbnail* BKE_main_thumbnail_from_imbuf | ( | Main * | bmain, |
| ImBuf * | img | ||
| ) |
Generates a raw .blend file thumbnail data from given image.
| bmain | If not NULL, also store generated data in this Main. |
| img | ImBuf image to generate thumbnail data from. |
Definition at line 363 of file main.c.
References Main::blen_thumb, BLEN_THUMB_MEMSIZE, data, IMB_rect_from_float(), MEM_mallocN, MEM_SAFE_FREE, NULL, ImBuf::rect, ImBuf::x, and ImBuf::y.
Referenced by blend_file_thumb().
| ImBuf* BKE_main_thumbnail_to_imbuf | ( | Main * | bmain, |
| BlendThumbnail * | data | ||
| ) |
Generates an image from raw .blend file thumbnail data.
| bmain | Use this bmain->blen_thumb data if given data is NULL. |
| data | Raw .blend file thumbnail data. |
Definition at line 394 of file main.c.
References Main::blen_thumb, BLEN_THUMB_MEMSIZE, data, IB_metadata, IB_rect, IMB_allocImBuf(), NULL, and ImBuf::rect.
Referenced by blend_file_thumb(), and IMB_thumb_load_blend().
| void BKE_main_unlock | ( | struct Main * | bmain | ) |
Definition at line 207 of file main.c.
References BLI_spin_unlock(), and Main::lock.
Referenced by BKE_id_free_ex(), BKE_libblock_alloc(), BKE_libblock_management_main_add(), BKE_libblock_management_main_remove(), BKE_libblock_remap(), BKE_libblock_remap_locked(), BKE_libblock_unlink(), BKE_objects_materials_test_all(), BLO_main_validate_libraries(), BLO_main_validate_shapekeys(), id_delete(), and lib_relocate_do().
|
static |
Definition at line 212 of file main.c.
References BLI_assert, BLI_ghash_ensure_p(), BLI_mempool_alloc(), LibraryIDLinkCallbackData::cb_flag, MainIDRelations::entry_items_pool, MainIDRelationsEntryItem::from, LibraryIDLinkCallbackData::id_pointer, MainIDRelationsEntryItem::id_pointer, LibraryIDLinkCallbackData::id_self, IDWALK_RET_NOP, MAIN_ID_SESSION_UUID_UNSET, MEM_callocN, MainIDRelationsEntryItem::next, NULL, MainIDRelations::relations_from_pointers, MainIDRelationsEntryItem::session_uuid, ID::session_uuid, MainIDRelationsEntryItem::to, MainIDRelationsEntryItem::usage_flag, and LibraryIDLinkCallbackData::user_data.
Referenced by BKE_main_relations_create().
Put the pointers to all the ListBase structs in given bmain into the *lb[INDEX_ID_MAX] array, and return the number of those for convenience.
This is useful for generic traversal of all the blocks in a Main (by traversing all the lists in turn), without worrying about block types.
INDEX_ID_<IDTYPE> enum definitions in DNA_ID.h. See also the FOREACH_MAIN_ID_BEGIN macro in BKE_main.h Definition at line 544 of file main.c.
References Main::actions, Main::armatures, Main::brushes, Main::cachefiles, Main::cameras, Main::collections, Main::curves, Main::fonts, Main::gpencils, Main::hairs, Main::images, INDEX_ID_AC, INDEX_ID_AR, INDEX_ID_BR, INDEX_ID_CA, INDEX_ID_CF, INDEX_ID_CU, INDEX_ID_GD, INDEX_ID_GR, INDEX_ID_HA, INDEX_ID_IM, INDEX_ID_IP, INDEX_ID_KE, INDEX_ID_LA, INDEX_ID_LI, INDEX_ID_LP, INDEX_ID_LS, INDEX_ID_LT, INDEX_ID_MA, INDEX_ID_MAX, INDEX_ID_MB, INDEX_ID_MC, INDEX_ID_ME, INDEX_ID_MSK, INDEX_ID_NT, INDEX_ID_NULL, INDEX_ID_OB, INDEX_ID_PA, INDEX_ID_PAL, INDEX_ID_PC, INDEX_ID_PT, INDEX_ID_SCE, INDEX_ID_SCR, INDEX_ID_SIM, INDEX_ID_SO, INDEX_ID_SPK, INDEX_ID_TE, INDEX_ID_TXT, INDEX_ID_VF, INDEX_ID_VO, INDEX_ID_WM, INDEX_ID_WO, INDEX_ID_WS, Main::ipo, Main::lattices, Main::libraries, Main::lightprobes, Main::lights, Main::linestyles, Main::masks, Main::materials, Main::meshes, Main::metaballs, Main::movieclips, Main::nodetrees, NULL, Main::objects, Main::paintcurves, Main::palettes, Main::particles, Main::pointclouds, Main::scenes, Main::screens, Main::shapekeys, Main::simulations, Main::sounds, Main::speakers, Main::texts, Main::textures, Main::volumes, Main::wm, Main::workspaces, and Main::worlds.
Referenced by BKE_main_free().
Definition at line 447 of file main.c.
References Main::actions, Main::armatures, Main::brushes, Main::cachefiles, Main::cameras, Main::collections, Main::curves, Main::fonts, Main::gpencils, Main::hairs, ID_AC, ID_AR, ID_BR, ID_CA, ID_CF, ID_CU, ID_GD, ID_GR, ID_HA, ID_IM, ID_IP, ID_KE, ID_LA, ID_LI, ID_LP, ID_LS, ID_LT, ID_MA, ID_MB, ID_MC, ID_ME, ID_MSK, ID_NT, ID_OB, ID_PA, ID_PAL, ID_PC, ID_PT, ID_SCE, ID_SCR, ID_SIM, ID_SO, ID_SPK, ID_TE, ID_TXT, ID_VF, ID_VO, ID_WM, ID_WO, ID_WS, Main::images, Main::ipo, Main::lattices, Main::libraries, Main::lightprobes, Main::lights, Main::linestyles, Main::masks, Main::materials, Main::meshes, Main::metaballs, Main::movieclips, Main::nodetrees, NULL, Main::objects, Main::paintcurves, Main::palettes, Main::particles, Main::pointclouds, Main::scenes, Main::screens, Main::shapekeys, Main::simulations, Main::sounds, Main::speakers, Main::texts, Main::textures, type, Main::volumes, Main::wm, Main::workspaces, and Main::worlds.
Referenced by BKE_id_free_ex(), BKE_id_is_in_global_main(), BKE_libblock_alloc(), BKE_libblock_find_name(), BKE_libblock_management_main_add(), BKE_libblock_management_main_remove(), BKE_libblock_rename(), BKE_main_id_tag_idcode(), BKE_main_idmap_lookup_name(), BKE_mask_clipboard_paste_to_layer(), BKE_node_clipboard_validate(), BLI_libblock_ensure_unique_name(), blo_do_versions_280(), blo_do_versions_290(), BLO_library_link_copypaste(), blender::ed::outliner::TreeDisplayIDOrphans::buildTree(), create_placeholder(), is_yet_read(), lib_id_clear_library_data_ex(), lib_relocate_do(), lib_relocate_do_remap(), link_named_part(), outliner_id_itemf(), outliner_id_remap_exec(), pastebuf_match_path_property(), read_libblock(), read_libblock_undo_restore_at_old_address(), read_libblock_undo_restore_identical(), rename_id_for_versioning(), seqclipboard_ptr_restore(), split_libdata(), ui_template_id(), and undosys_id_ref_resolve().