From ffc4c126f5416b04a01653e7a03451797b98aba4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 7 Dec 2021 17:19:15 +1100 Subject: Cleanup: move public doc-strings into headers for 'blenkernel' - Added space below non doc-string comments to make it clear these aren't comments for the symbols directly below them. - Use doxy sections for some headers. - Minor improvements to doc-strings. Ref T92709 --- source/blender/blenkernel/intern/main.c | 104 -------------------------------- 1 file changed, 104 deletions(-) (limited to 'source/blender/blenkernel/intern/main.c') diff --git a/source/blender/blenkernel/intern/main.c b/source/blender/blenkernel/intern/main.c index a5de0bc99c8..7254d5d50ee 100644 --- a/source/blender/blenkernel/intern/main.c +++ b/source/blender/blenkernel/intern/main.c @@ -205,7 +205,6 @@ void BKE_main_free(Main *mainvar) MEM_freeN(mainvar); } -/* Check whether given `bmain` is empty or contains some IDs. */ bool BKE_main_is_empty(struct Main *bmain) { ID *id_iter; @@ -278,7 +277,6 @@ static int main_relations_create_idlink_cb(LibraryIDLinkCallbackData *cb_data) return IDWALK_RET_NOP; } -/** Generate the mappings between used IDs and their users, and vice-versa. */ void BKE_main_relations_create(Main *bmain, const short flag) { if (bmain->relations != NULL) { @@ -326,7 +324,6 @@ void BKE_main_relations_free(Main *bmain) } } -/** Set or clear given `tag` in all relation entries of given `bmain`. */ void BKE_main_relations_tag_set(struct Main *bmain, const eMainIDRelationsEntryTags tag, const bool value) @@ -350,12 +347,6 @@ void BKE_main_relations_tag_set(struct Main *bmain, BLI_ghashIterator_free(gh_iter); } -/** - * Create a GSet storing all IDs present in given \a bmain, by their pointers. - * - * \param gset: If not NULL, given GSet will be extended with IDs from given \a bmain, - * instead of creating a new one. - */ GSet *BKE_main_gset_create(Main *bmain, GSet *gset) { if (gset == NULL) { @@ -404,12 +395,6 @@ static bool lib_weak_key_cmp(const void *a, const void *b) STREQ(string_pair_a->id_name, string_pair_b->id_name)); } -/** - * Generate a mapping between 'library path' of an ID (as a pair (relative blend file path, id - * name)), and a current local ID, if any. - * - * This uses the information stored in `ID.library_weak_reference`. - */ GHash *BKE_main_library_weak_reference_create(Main *bmain) { GHash *library_weak_reference_mapping = BLI_ghash_new( @@ -442,24 +427,11 @@ GHash *BKE_main_library_weak_reference_create(Main *bmain) return library_weak_reference_mapping; } -/** - * Destroy the data generated by #BKE_main_library_weak_reference_create. - */ void BKE_main_library_weak_reference_destroy(GHash *library_weak_reference_mapping) { BLI_ghash_free(library_weak_reference_mapping, MEM_freeN, NULL); } -/** - * Search for a local ID matching the given linked ID reference. - * - * \param library_weak_reference_mapping: the mapping data generated by - * #BKE_main_library_weak_reference_create. - * \param library_relative_path: the path of a blend file library (relative to current working - * one). - * \param library_id_name: the full ID name, including the leading two chars encoding the ID - * type. - */ ID *BKE_main_library_weak_reference_search_item(GHash *library_weak_reference_mapping, const char *library_filepath, const char *library_id_name) @@ -469,16 +441,6 @@ ID *BKE_main_library_weak_reference_search_item(GHash *library_weak_reference_ma return (ID *)BLI_ghash_lookup(library_weak_reference_mapping, &key); } -/** - * Add the given ID weak library reference to given local ID and the runtime mapping. - * - * \param library_weak_reference_mapping: the mapping data generated by - * #BKE_main_library_weak_reference_create. - * \param library_relative_path: the path of a blend file library (relative to current working - * one). - * \param library_id_name: the full ID name, including the leading two chars encoding the ID type. - * \param new_id: New local ID matching given weak reference. - */ void BKE_main_library_weak_reference_add_item(GHash *library_weak_reference_mapping, const char *library_filepath, const char *library_id_name, @@ -507,21 +469,6 @@ void BKE_main_library_weak_reference_add_item(GHash *library_weak_reference_mapp *id_p = new_id; } -/** - * Update the status of the given ID weak library reference in current local IDs and the runtime - * mapping. - * - * This effectively transfers the 'ownership' of the given weak reference from `old_id` to - * `new_id`. - * - * \param library_weak_reference_mapping: the mapping data generated by - * #BKE_main_library_weak_reference_create. - * \param library_relative_path: the path of a blend file library (relative to current working - * one). - * \param library_id_name: the full ID name, including the leading two chars encoding the ID type. - * \param old_id: Existing local ID matching given weak reference. - * \param new_id: New local ID matching given weak reference. - */ void BKE_main_library_weak_reference_update_item(GHash *library_weak_reference_mapping, const char *library_filepath, const char *library_id_name, @@ -545,16 +492,6 @@ void BKE_main_library_weak_reference_update_item(GHash *library_weak_reference_m *id_p = new_id; } -/** - * Remove the given ID weak library reference from the given local ID and the runtime mapping. - * - * \param library_weak_reference_mapping: the mapping data generated by - * #BKE_main_library_weak_reference_create. - * \param library_relative_path: the path of a blend file library (relative to current working - * one). - * \param library_id_name: the full ID name, including the leading two chars encoding the ID type. - * \param old_id: Existing local ID matching given weak reference. - */ void BKE_main_library_weak_reference_remove_item(GHash *library_weak_reference_mapping, const char *library_filepath, const char *library_id_name, @@ -572,13 +509,6 @@ void BKE_main_library_weak_reference_remove_item(GHash *library_weak_reference_m MEM_SAFE_FREE(old_id->library_weak_reference); } -/** - * Generates a raw .blend file thumbnail data from given image. - * - * \param bmain: If not NULL, also store generated data in this Main. - * \param img: ImBuf image to generate thumbnail data from. - * \return The generated .blend file raw thumbnail data. - */ BlendThumbnail *BKE_main_thumbnail_from_imbuf(Main *bmain, ImBuf *img) { BlendThumbnail *data = NULL; @@ -603,13 +533,6 @@ BlendThumbnail *BKE_main_thumbnail_from_imbuf(Main *bmain, ImBuf *img) return data; } -/** - * Generates an image from raw .blend file thumbnail \a data. - * - * \param bmain: Use this bmain->blen_thumb data if given \a data is NULL. - * \param data: Raw .blend file thumbnail data. - * \return An ImBuf from given data, or NULL if invalid. - */ ImBuf *BKE_main_thumbnail_to_imbuf(Main *bmain, BlendThumbnail *data) { ImBuf *img = NULL; @@ -626,9 +549,6 @@ ImBuf *BKE_main_thumbnail_to_imbuf(Main *bmain, BlendThumbnail *data) return img; } -/** - * Generates an empty (black) thumbnail for given Main. - */ void BKE_main_thumbnail_create(struct Main *bmain) { MEM_SAFE_FREE(bmain->blen_thumb); @@ -638,28 +558,16 @@ void BKE_main_thumbnail_create(struct Main *bmain) bmain->blen_thumb->height = BLEN_THUMB_SIZE; } -/** - * Return filepath of given \a main. - */ const char *BKE_main_blendfile_path(const Main *bmain) { return bmain->name; } -/** - * Return filepath of global main #G_MAIN. - * - * \warning Usage is not recommended, - * you should always try to get a valid Main pointer from context... - */ const char *BKE_main_blendfile_path_from_global(void) { return BKE_main_blendfile_path(G_MAIN); } -/** - * \return A pointer to the \a ListBase of given \a bmain for requested \a type ID type. - */ ListBase *which_libbase(Main *bmain, short type) { switch ((ID_Type)type) { @@ -747,18 +655,6 @@ ListBase *which_libbase(Main *bmain, short type) return NULL; } -/** - * 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. - * - * \param lb: Array of lists #INDEX_ID_MAX in length. - * - * \note The order of each ID type #ListBase in the array is determined by the `INDEX_ID_` - * enum definitions in `DNA_ID.h`. See also the #FOREACH_MAIN_ID_BEGIN macro in `BKE_main.h` - */ int set_listbasepointers(Main *bmain, ListBase *lb[/*INDEX_ID_MAX*/]) { /* Libraries may be accessed from pretty much any other ID. */ -- cgit v1.2.3