From 4d37cf90b9d9d8ed2f0339c8ccd72481e29a4514 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 18 Oct 2010 06:41:16 +0000 Subject: remove G.sce, use G.main->name instead. Both stored the filename of the blend file, but G.sce stored the last opened file. This will make blender act differently in some cases since a relative path to the last opened file will no longer resolve (which is correct IMHO since that file isnt open and the path might not even be valid anymore). Tested linking with durian files and rendering to relative paths when no files is loaded however we may need to have some operators give an error if they are used on the default startup.blend. --- source/blender/editors/render/render_preview.c | 4 ++-- source/blender/editors/render/render_shading.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'source/blender/editors/render') diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 21f10d936bf..0e8587e4642 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -111,7 +111,7 @@ ImBuf* get_brush_icon(Brush *brush) // first use the path directly to try and load the file BLI_strncpy(path, brush->icon_filepath, sizeof(brush->icon_filepath)); - BLI_path_abs(path, G.sce); + BLI_path_abs(path, G.main->name); brush->icon_imbuf= IMB_loadiffname(path, flags); @@ -121,7 +121,7 @@ ImBuf* get_brush_icon(Brush *brush) path[0]= 0; - BLI_make_file_string(G.sce, path, folder, brush->icon_filepath); + BLI_make_file_string(G.main->name, path, folder, brush->icon_filepath); if (path[0]) brush->icon_imbuf= IMB_loadiffname(path, flags); diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index bca8100a809..9db15ee43e5 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -852,7 +852,7 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int ibuf->profile = IB_PROFILE_LINEAR_RGB; /* to save, we first get absolute path */ - BLI_path_abs(str, G.sce); + BLI_path_abs(str, G.main->name); if (BKE_write_ibuf(scene, ibuf, str, imtype, scene->r.subimtype, scene->r.quality)) { retval = OPERATOR_FINISHED; @@ -863,7 +863,7 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int } /* in case we were saving with relative paths, change back again */ if(relative) - BLI_path_rel(str, G.sce); + BLI_path_rel(str, G.main->name); IMB_freeImBuf(ibuf); ibuf = NULL; @@ -908,7 +908,7 @@ static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event //RNA_enum_set(op->ptr, "file_type", scene->r.imtype); - RNA_string_set(op->ptr, "filepath", G.sce); + RNA_string_set(op->ptr, "filepath", G.main->name); WM_event_add_fileselect(C, op); return OPERATOR_RUNNING_MODAL; -- cgit v1.2.3