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:
authorSybren A. Stüvel <sybren@stuvel.eu>2017-05-26 14:48:19 +0300
committerSybren A. Stüvel <sybren@stuvel.eu>2017-05-30 14:47:51 +0300
commit916eca6a1e52806cf135f2c289432820547f1502 (patch)
tree649a773d72db9c51029a9398e96e945bbf001797 /source/blender/editors/io
parent4aeba3b90dac780d25fd04c174b5cdc4da53efd5 (diff)
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.
Diffstat (limited to 'source/blender/editors/io')
-rw-r--r--source/blender/editors/io/io_alembic.c29
1 files changed, 22 insertions, 7 deletions
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);