Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-17 07:17:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-17 07:21:24 +0300
commite12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch)
tree8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/blenkernel/intern/blender_copybuffer.c
parentb3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff)
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/blenkernel/intern/blender_copybuffer.c')
-rw-r--r--source/blender/blenkernel/intern/blender_copybuffer.c147
1 files changed, 76 insertions, 71 deletions
diff --git a/source/blender/blenkernel/intern/blender_copybuffer.c b/source/blender/blenkernel/intern/blender_copybuffer.c
index 2ac013df620..c801c1780c8 100644
--- a/source/blender/blenkernel/intern/blender_copybuffer.c
+++ b/source/blender/blenkernel/intern/blender_copybuffer.c
@@ -36,7 +36,7 @@
#include "IMB_imbuf.h"
#include "IMB_moviecache.h"
-#include "BKE_blender_copybuffer.h" /* own include */
+#include "BKE_blender_copybuffer.h" /* own include */
#include "BKE_blendfile.h"
#include "BKE_context.h"
#include "BKE_global.h"
@@ -53,19 +53,18 @@
#include "IMB_colormanagement.h"
-
/* -------------------------------------------------------------------- */
/** \name Copy/Paste `.blend`, partial saves.
* \{ */
void BKE_copybuffer_begin(Main *bmain_src)
{
- BKE_blendfile_write_partial_begin(bmain_src);
+ BKE_blendfile_write_partial_begin(bmain_src);
}
void BKE_copybuffer_tag_ID(ID *id)
{
- BKE_blendfile_write_partial_tag_ID(id, true);
+ BKE_blendfile_write_partial_tag_ID(id, true);
}
/**
@@ -73,99 +72,105 @@ void BKE_copybuffer_tag_ID(ID *id)
*/
bool BKE_copybuffer_save(Main *bmain_src, const char *filename, ReportList *reports)
{
- const int write_flags = G_FILE_RELATIVE_REMAP;
+ const int write_flags = G_FILE_RELATIVE_REMAP;
- bool retval = BKE_blendfile_write_partial(bmain_src, filename, write_flags, reports);
+ bool retval = BKE_blendfile_write_partial(bmain_src, filename, write_flags, reports);
- BKE_blendfile_write_partial_end(bmain_src);
+ BKE_blendfile_write_partial_end(bmain_src);
- return retval;
+ return retval;
}
-bool BKE_copybuffer_read(Main *bmain_dst, const char *libname, ReportList *reports, const unsigned int id_types_mask)
+bool BKE_copybuffer_read(Main *bmain_dst,
+ const char *libname,
+ ReportList *reports,
+ const unsigned int id_types_mask)
{
- BlendHandle *bh = BLO_blendhandle_from_file(libname, reports);
- if (bh == NULL) {
- /* Error reports will have been made by BLO_blendhandle_from_file(). */
- return false;
- }
- /* Here appending/linking starts. */
- Main *mainl = BLO_library_link_begin(bmain_dst, &bh, libname);
- BLO_library_link_copypaste(mainl, bh, id_types_mask);
- BLO_library_link_end(mainl, &bh, 0, NULL, NULL, NULL, NULL);
- /* Mark all library linked objects to be updated. */
- BKE_main_lib_objects_recalc_all(bmain_dst);
- IMB_colormanagement_check_file_config(bmain_dst);
- /* Append, rather than linking. */
- Library *lib = BLI_findstring(&bmain_dst->libraries, libname, offsetof(Library, filepath));
- BKE_library_make_local(bmain_dst, lib, NULL, true, false);
- /* Important we unset, otherwise these object wont
- * link into other scenes from this blend file.
- */
- BKE_main_id_tag_all(bmain_dst, LIB_TAG_PRE_EXISTING, false);
- BLO_blendhandle_close(bh);
- return true;
+ BlendHandle *bh = BLO_blendhandle_from_file(libname, reports);
+ if (bh == NULL) {
+ /* Error reports will have been made by BLO_blendhandle_from_file(). */
+ return false;
+ }
+ /* Here appending/linking starts. */
+ Main *mainl = BLO_library_link_begin(bmain_dst, &bh, libname);
+ BLO_library_link_copypaste(mainl, bh, id_types_mask);
+ BLO_library_link_end(mainl, &bh, 0, NULL, NULL, NULL, NULL);
+ /* Mark all library linked objects to be updated. */
+ BKE_main_lib_objects_recalc_all(bmain_dst);
+ IMB_colormanagement_check_file_config(bmain_dst);
+ /* Append, rather than linking. */
+ Library *lib = BLI_findstring(&bmain_dst->libraries, libname, offsetof(Library, filepath));
+ BKE_library_make_local(bmain_dst, lib, NULL, true, false);
+ /* Important we unset, otherwise these object wont
+ * link into other scenes from this blend file.
+ */
+ BKE_main_id_tag_all(bmain_dst, LIB_TAG_PRE_EXISTING, false);
+ BLO_blendhandle_close(bh);
+ return true;
}
/**
* \return Number of IDs directly pasted from the buffer (does not includes indirectly pulled out ones).
*/
-int BKE_copybuffer_paste(
- bContext *C, const char *libname, const short flag, ReportList *reports, const unsigned int id_types_mask)
+int BKE_copybuffer_paste(bContext *C,
+ const char *libname,
+ const short flag,
+ ReportList *reports,
+ const unsigned int id_types_mask)
{
- Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
- ViewLayer *view_layer = CTX_data_view_layer(C);
- View3D *v3d = CTX_wm_view3d(C); /* may be NULL. */
- Main *mainl = NULL;
- Library *lib;
- BlendHandle *bh;
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ View3D *v3d = CTX_wm_view3d(C); /* may be NULL. */
+ Main *mainl = NULL;
+ Library *lib;
+ BlendHandle *bh;
- bh = BLO_blendhandle_from_file(libname, reports);
+ bh = BLO_blendhandle_from_file(libname, reports);
- if (bh == NULL) {
- /* error reports will have been made by BLO_blendhandle_from_file() */
- return 0;
- }
+ if (bh == NULL) {
+ /* error reports will have been made by BLO_blendhandle_from_file() */
+ return 0;
+ }
- BKE_view_layer_base_deselect_all(view_layer);
+ BKE_view_layer_base_deselect_all(view_layer);
- /* tag everything, all untagged data can be made local
- * its also generally useful to know what is new
- *
- * take extra care BKE_main_id_flag_all(bmain, LIB_TAG_PRE_EXISTING, false) is called after! */
- BKE_main_id_tag_all(bmain, LIB_TAG_PRE_EXISTING, true);
+ /* tag everything, all untagged data can be made local
+ * its also generally useful to know what is new
+ *
+ * take extra care BKE_main_id_flag_all(bmain, LIB_TAG_PRE_EXISTING, false) is called after! */
+ BKE_main_id_tag_all(bmain, LIB_TAG_PRE_EXISTING, true);
- /* here appending/linking starts */
- mainl = BLO_library_link_begin(bmain, &bh, libname);
+ /* here appending/linking starts */
+ mainl = BLO_library_link_begin(bmain, &bh, libname);
- const int num_pasted = BLO_library_link_copypaste(mainl, bh, id_types_mask);
+ const int num_pasted = BLO_library_link_copypaste(mainl, bh, id_types_mask);
- BLO_library_link_end(mainl, &bh, flag, bmain, scene, view_layer, v3d);
+ BLO_library_link_end(mainl, &bh, flag, bmain, scene, view_layer, v3d);
- /* mark all library linked objects to be updated */
- BKE_main_lib_objects_recalc_all(bmain);
- IMB_colormanagement_check_file_config(bmain);
+ /* mark all library linked objects to be updated */
+ BKE_main_lib_objects_recalc_all(bmain);
+ IMB_colormanagement_check_file_config(bmain);
- /* append, rather than linking */
- lib = BLI_findstring(&bmain->libraries, libname, offsetof(Library, filepath));
- BKE_library_make_local(bmain, lib, NULL, true, false);
+ /* append, rather than linking */
+ lib = BLI_findstring(&bmain->libraries, libname, offsetof(Library, filepath));
+ BKE_library_make_local(bmain, lib, NULL, true, false);
- /* important we unset, otherwise these object wont
- * link into other scenes from this blend file */
- BKE_main_id_tag_all(bmain, LIB_TAG_PRE_EXISTING, false);
+ /* important we unset, otherwise these object wont
+ * link into other scenes from this blend file */
+ BKE_main_id_tag_all(bmain, LIB_TAG_PRE_EXISTING, false);
- /* recreate dependency graph to include new objects */
- DEG_relations_tag_update(bmain);
+ /* recreate dependency graph to include new objects */
+ DEG_relations_tag_update(bmain);
- /* Tag update the scene to flush base collection settings, since the new object is added to a
- * new (active) collection, not its original collection, thus need recalculation. */
- DEG_id_tag_update(&scene->id, 0);
+ /* Tag update the scene to flush base collection settings, since the new object is added to a
+ * new (active) collection, not its original collection, thus need recalculation. */
+ DEG_id_tag_update(&scene->id, 0);
- BLO_blendhandle_close(bh);
- /* remove library... */
+ BLO_blendhandle_close(bh);
+ /* remove library... */
- return num_pasted;
+ return num_pasted;
}
/** \} */