From 638de722775fc43c3543a30aaa888372fe93fe98 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sat, 9 Jun 2018 15:16:44 +0200 Subject: Cleanup: remove some G.main usages. --- source/blender/blenkernel/intern/modifier.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source/blender/blenkernel/intern/modifier.c') 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) { -- cgit v1.2.3