[Bf-blender-cvs] [916eca6a1e5] master: Alembic export: make the start/end frame default values less reasonable

Sybren A. Stüvel noreply at git.blender.org
Tue May 30 13:48:19 CEST 2017


Commit: 916eca6a1e52806cf135f2c289432820547f1502
Author: Sybren A. Stüvel
Date:   Fri May 26 13:48:19 2017 +0200
Branches: master
https://developer.blender.org/rB916eca6a1e52806cf135f2c289432820547f1502

Alembic export: make the start/end frame default values less reasonable

The old default values (start/end frame = 1) could have been an actually
desired setting (for example when exporting a non-animated model). To
make this worse, this was only interpreted as "start/end of the scene" by
the export operator when running interactively, but not when run from
Python.

By choosing INT_MIN as default it's highly unlikely that the interval
[start, end) was intended as actual export range.

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

M	source/blender/editors/io/io_alembic.c

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

diff --git a/source/blender/editors/io/io_alembic.c b/source/blender/editors/io/io_alembic.c
index 62c36552048..3da4caa7cfc 100644
--- a/source/blender/editors/io/io_alembic.c
+++ b/source/blender/editors/io/io_alembic.c
@@ -102,7 +102,7 @@ static int wm_alembic_export_exec(bContext *C, wmOperator *op)
 	char filename[FILE_MAX];
 	RNA_string_get(op->ptr, "filepath", filename);
 
-	const struct AlembicExportParams params = {
+	struct AlembicExportParams params = {
 	    .frame_start = RNA_int_get(op->ptr, "start"),
 	    .frame_end = RNA_int_get(op->ptr, "end"),
 
@@ -133,8 +133,17 @@ static int wm_alembic_export_exec(bContext *C, wmOperator *op)
 	    .global_scale = RNA_float_get(op->ptr, "global_scale"),
 	};
 
+	/* Take some defaults from the scene, if not specified explicitly. */
+	Scene *scene = CTX_data_scene(C);
+	if (params.frame_start == INT_MIN) {
+		params.frame_start = SFRA;
+	}
+	if (params.frame_end == INT_MIN) {
+		params.frame_end = EFRA;
+	}
+
 	const bool as_background_job = RNA_boolean_get(op->ptr, "as_background_job");
-	bool ok = ABC_export(CTX_data_scene(C), C, filename, &params, as_background_job);
+	bool ok = ABC_export(scene, C, filename, &params, as_background_job);
 
 	return as_background_job || ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
 }
@@ -295,11 +304,17 @@ void WM_OT_alembic_export(wmOperatorType *ot)
 	                               FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH,
 	                               FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
 
-	RNA_def_int(ot->srna, "start", 1, INT_MIN, INT_MAX,
-	            "Start Frame", "Start Frame", INT_MIN, INT_MAX);
-
-	RNA_def_int(ot->srna, "end", 1, INT_MIN, INT_MAX,
-	            "End Frame", "End Frame", INT_MIN, INT_MAX);
+	RNA_def_int(ot->srna, "start", INT_MIN, INT_MIN, INT_MAX,
+	            "Start Frame",
+	            "Start frame of the export, use the default value to "
+	            "take the start frame of the current scene",
+	            INT_MIN, INT_MAX);
+
+	RNA_def_int(ot->srna, "end", INT_MIN, INT_MIN, INT_MAX,
+	            "End Frame",
+	            "End frame of the export, use the default value to "
+	            "take the end frame of the current scene",
+	            INT_MIN, INT_MAX);
 
 	RNA_def_int(ot->srna, "xsamples", 1, 1, 128,
 	            "Transform Samples", "Number of times per frame transformations are sampled", 1, 128);




More information about the Bf-blender-cvs mailing list