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:
authorBastien Montagne <montagne29@wanadoo.fr>2018-05-31 17:04:04 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-05-31 17:04:04 +0300
commit16100f8261770e367b0892bb38c778699ed609fe (patch)
tree97232730f4680cd689cfa086c5434761c7dd33c7 /source/blender/blenkernel
parentb53d358261a26652d510d62565f1b43035a55e67 (diff)
Cleanup: get rid of last G.main usages in BKE library code.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_library.h5
-rw-r--r--source/blender/blenkernel/intern/bpath.c2
-rw-r--r--source/blender/blenkernel/intern/library.c15
-rw-r--r--source/blender/blenkernel/intern/scene.c2
4 files changed, 9 insertions, 15 deletions
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index 9e1bc2611fb..ad97eb62773 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -88,8 +88,7 @@ void *BKE_libblock_copy_nolib(const struct ID *id, const bool do_action) ATTR_NO
void BKE_libblock_rename(struct Main *bmain, struct ID *id, const char *name) ATTR_NONNULL();
void BLI_libblock_ensure_unique_name(struct Main *bmain, const char *name) ATTR_NONNULL();
-struct ID *BKE_libblock_find_name_ex(struct Main *bmain, const short type, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
-struct ID *BKE_libblock_find_name(const short type, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+struct ID *BKE_libblock_find_name(struct Main *bmain, const short type, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
/* library_remap.c (keep here since they're general functions) */
/**
@@ -133,7 +132,7 @@ void BKE_libblock_free_data(struct ID *id, const bool do_id_user) ATTR_NONNULL(
void BKE_id_lib_local_paths(struct Main *bmain, struct Library *lib, struct ID *id);
void id_lib_extern(struct ID *id);
-void BKE_library_filepath_set(struct Library *lib, const char *filepath);
+void BKE_library_filepath_set(struct Main *bmain, struct Library *lib, const char *filepath);
void id_us_ensure_real(struct ID *id);
void id_us_clear_real(struct ID *id);
void id_us_plus_no_lib(struct ID *id);
diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c
index cc4c28e8016..2e8c369451b 100644
--- a/source/blender/blenkernel/intern/bpath.c
+++ b/source/blender/blenkernel/intern/bpath.c
@@ -651,7 +651,7 @@ void BKE_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int
/* keep packedfile paths always relative to the blend */
if (lib->packedfile == NULL) {
if (rewrite_path_fixed(lib->name, visit_cb, absbase, bpath_user_data)) {
- BKE_library_filepath_set(lib, lib->name);
+ BKE_library_filepath_set(bmain, lib, lib->name);
}
}
break;
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index ff4780f0605..70ee3cbe5f3 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -1594,17 +1594,12 @@ void BKE_main_thumbnail_create(struct Main *bmain)
}
/* ***************** ID ************************ */
-ID *BKE_libblock_find_name_ex(struct Main *bmain, const short type, const char *name)
+ID *BKE_libblock_find_name(struct Main *bmain, const short type, const char *name)
{
ListBase *lb = which_libbase(bmain, type);
BLI_assert(lb != NULL);
return BLI_findstring(lb, name, offsetof(ID, name) + 2);
}
-ID *BKE_libblock_find_name(const short type, const char *name)
-{
- return BKE_libblock_find_name_ex(G.main, type, name);
-}
-
void id_sort_by_name(ListBase *lb, ID *id)
{
@@ -1934,7 +1929,7 @@ static void library_make_local_copying_check(ID *id, GSet *loop_tags, MainIDRela
/** Make linked datablocks local.
*
- * \param bmain Almost certainly G.main.
+ * \param bmain Almost certainly global main.
* \param lib If not NULL, only make local datablocks from this library.
* \param untagged_only If true, only make local datablocks not tagged with LIB_TAG_PRE_EXISTING.
* \param set_fake If true, set fake user on all localized datablocks (except group and objects ones).
@@ -2366,7 +2361,7 @@ void BKE_id_ui_prefix(char name[MAX_ID_NAME + 1], const ID *id)
strcpy(name + 3, id->name + 2);
}
-void BKE_library_filepath_set(Library *lib, const char *filepath)
+void BKE_library_filepath_set(Main *bmain, Library *lib, const char *filepath)
{
/* in some cases this is used to update the absolute path from the
* relative */
@@ -2385,8 +2380,8 @@ void BKE_library_filepath_set(Library *lib, const char *filepath)
* since making local could cause this to be directly linked - campbell
*/
/* Never make paths relative to parent lib - reading code (blenloader) always set *all* lib->name relative to
- * current G.main, not to their parent for indirectly linked ones. */
- const char *basepath = G.main->name;
+ * current main, not to their parent for indirectly linked ones. */
+ const char *basepath = bmain->name;
BLI_path_abs(lib->filepath, basepath);
}
}
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 230afbcaeff..08b5fdb07dc 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -960,7 +960,7 @@ void BKE_scene_set_background(Main *bmain, Scene *scene)
/* called from creator_args.c */
Scene *BKE_scene_set_name(Main *bmain, const char *name)
{
- Scene *sce = (Scene *)BKE_libblock_find_name_ex(bmain, ID_SCE, name);
+ Scene *sce = (Scene *)BKE_libblock_find_name(bmain, ID_SCE, name);
if (sce) {
BKE_scene_set_background(bmain, sce);
printf("Scene switch for render: '%s' in file: '%s'\n", name, bmain->name);