[Bf-blender-cvs] [184a2ee] master: Fix screenshot adding image extension after .blend

Campbell Barton noreply at git.blender.org
Wed Feb 10 05:35:06 CET 2016


Commit: 184a2ee5a4a79540656a545f65f7bdbe3803d1cd
Author: Campbell Barton
Date:   Wed Feb 10 13:57:54 2016 +1100
Branches: master
https://developer.blender.org/rB184a2ee5a4a79540656a545f65f7bdbe3803d1cd

Fix screenshot adding image extension after .blend

===================================================================

M	source/blender/editors/screen/screendump.c

===================================================================

diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index a6270af..2dd7400 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -229,7 +229,12 @@ static int screenshot_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
 			return screenshot_exec(C, op);
 
 		/* extension is added by 'screenshot_check' after */
-		RNA_string_set(op->ptr, "filepath", G.relbase_valid ? G.main->name : "//screen");
+		char filepath[FILE_MAX] = "//screen";
+		if (G.relbase_valid) {
+			BLI_strncpy(filepath, G.main->name, sizeof(filepath));
+			BLI_replace_extension(filepath, sizeof(filepath), "");  /* strip '.blend' */
+		}
+		RNA_string_set(op->ptr, "filepath", filepath);
 		
 		WM_event_add_fileselect(C, op);




More information about the Bf-blender-cvs mailing list