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-06-09 16:16:44 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-06-09 16:17:04 +0300
commit638de722775fc43c3543a30aaa888372fe93fe98 (patch)
tree08991e0d3279693dfa8e4fcfec696bfa9f1b2499 /source/blender/blenkernel
parentfb565ddb681f39cbe47e91d11e5b728bb4314a7b (diff)
Cleanup: remove some G.main usages.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_modifier.h2
-rw-r--r--source/blender/blenkernel/intern/modifier.c12
2 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index aacd2f99ff5..e9ce91996e0 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -431,7 +431,7 @@ void modifier_mdef_compact_influences(struct ModifierData *md);
void modifier_path_init(char *path, int path_maxlen, const char *name);
const char *modifier_path_relbase(struct Main *bmain, struct Object *ob);
-
+const char *modifier_path_relbase_from_global(struct Object *ob);
/* wrappers for modifier callbacks */
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index 0cf10f7590c..368a691e778 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -777,6 +777,18 @@ const char *modifier_path_relbase(Main *bmain, Object *ob)
}
}
+const char *modifier_path_relbase_from_global(Object *ob)
+{
+ if (G.relbase_valid || ID_IS_LINKED(ob)) {
+ return ID_BLEND_PATH_FROM_GLOBAL(&ob->id);
+ }
+ else {
+ /* last resort, better then using "" which resolves to the current
+ * working directory */
+ return BKE_tempdir_session();
+ }
+}
+
/* initializes the path with either */
void modifier_path_init(char *path, int path_maxlen, const char *name)
{