diff options
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 32 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 8 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_operator.c | 1 |
3 files changed, 21 insertions, 20 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index a34335a031d..1b0893e50e0 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -657,25 +657,27 @@ void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath) void file_operator_to_sfile(SpaceFile *sfile, wmOperator *op) { - int change= FALSE; - if(RNA_struct_find_property(op->ptr, "filename")) { - RNA_string_get(op->ptr, "filename", sfile->params->file); - change= TRUE; - } - if(RNA_struct_find_property(op->ptr, "directory")) { - RNA_string_get(op->ptr, "directory", sfile->params->dir); - change= TRUE; - } - + PropertyRNA *prop; + /* If neither of the above are set, split the filepath back */ - if(RNA_struct_find_property(op->ptr, "filepath")) { - if(change==FALSE) { - char filepath[FILE_MAX]; - RNA_string_get(op->ptr, "filepath", filepath); - BLI_split_dirfile(filepath, sfile->params->dir, sfile->params->file); + if((prop= RNA_struct_find_property(op->ptr, "filepath"))) { + char filepath[FILE_MAX]; + RNA_property_string_get(op->ptr, prop, filepath); + BLI_split_dirfile(filepath, sfile->params->dir, sfile->params->file); + } + else { + if((prop= RNA_struct_find_property(op->ptr, "filename"))) { + RNA_property_string_get(op->ptr, prop, sfile->params->file); + } + if((prop= RNA_struct_find_property(op->ptr, "directory"))) { + RNA_property_string_get(op->ptr, prop, sfile->params->dir); } } + /* we could check for relative_path property which is used when converting + * in the other direction but doesnt hurt to do this every time */ + BLI_path_abs(sfile->params->dir, G.main->name); + /* XXX, files and dirs updates missing, not really so important though */ } diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index d483dd45f7f..d58b78ff6a7 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -983,7 +983,7 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima, /* unlikely but just incase */ if (ELEM3(simopts->planes, R_PLANESBW, R_PLANES24, R_PLANES32) == 0) { - simopts->planes= 32; + simopts->planes= R_PLANES32; } /* some formats dont use quality so fallback to scenes quality */ @@ -1000,7 +1000,6 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima, } BLI_path_abs(simopts->filepath, G.main->name); } - /* cleanup */ BKE_image_release_renderresult(scene, ima); } @@ -1026,6 +1025,7 @@ static void save_image_options_to_op(SaveImageOptions *simopts, wmOperator *op) RNA_enum_set(op->ptr, "file_format", simopts->imtype); // RNA_enum_set(op->ptr, "subimtype", simopts->subimtype); RNA_int_set(op->ptr, "file_quality", simopts->quality); + RNA_string_set(op->ptr, "filepath", simopts->filepath); } @@ -1050,10 +1050,10 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI if(ima->type == IMA_TYPE_R_RESULT) { /* enforce user setting for RGB or RGBA, but skip BW */ - if(simopts->planes==32) { + if(simopts->planes==R_PLANES32) { ibuf->depth= 32; } - else if(simopts->planes==24) { + else if(simopts->planes==R_PLANES24) { ibuf->depth= 24; } } diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index 742dce30124..7327679cc7e 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -117,7 +117,6 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args) } context_dict_back= CTX_py_dict_get(C); - CTX_py_dict_set(C, (void *)context_dict); Py_XINCREF(context_dict); /* so we done loose it */ |