Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_image/image_ops.c
| Show First 20 Lines • Show All 1,147 Lines • ▼ Show 20 Lines | if (RNA_boolean_get(op->ptr, "use_multiview")) { | ||||
| ImageFormatData *imf = &iod->im_format; | ImageFormatData *imf = &iod->im_format; | ||||
| ima->flag |= IMA_USE_VIEWS; | ima->flag |= IMA_USE_VIEWS; | ||||
| ima->views_format = imf->views_format; | ima->views_format = imf->views_format; | ||||
| *ima->stereo3d_format = imf->stereo3d_format; | *ima->stereo3d_format = imf->stereo3d_format; | ||||
| } | } | ||||
| else { | else { | ||||
| ima->flag &= ~IMA_USE_VIEWS; | ima->flag &= ~IMA_USE_VIEWS; | ||||
| ima->flag &= ~IMA_IS_STEREO; | |||||
| ima->flag &= ~IMA_IS_MULTIVIEW; | |||||
| BKE_image_free_views(ima); | BKE_image_free_views(ima); | ||||
| } | } | ||||
| /* only image path after save, never ibuf */ | /* only image path after save, never ibuf */ | ||||
| if (is_relative_path) { | if (is_relative_path) { | ||||
| if (!exists) { | if (!exists) { | ||||
| BLI_path_rel(ima->name, bmain->name); | BLI_path_rel(ima->name, bmain->name); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 532 Lines • ▼ Show 20 Lines | else { | ||||
| /* checks each pixel, not ideal */ | /* checks each pixel, not ideal */ | ||||
| ibuf->planes = BKE_imbuf_alpha_test(ibuf) ? R_IMF_PLANES_RGBA : R_IMF_PLANES_RGB; | ibuf->planes = BKE_imbuf_alpha_test(ibuf) ? R_IMF_PLANES_RGBA : R_IMF_PLANES_RGB; | ||||
| } | } | ||||
| } | } | ||||
| /* we need renderresult for exr and rendered multiview */ | /* we need renderresult for exr and rendered multiview */ | ||||
| scene = CTX_data_scene(C); | scene = CTX_data_scene(C); | ||||
| rr = BKE_image_acquire_renderresult(scene, ima); | rr = BKE_image_acquire_renderresult(scene, ima); | ||||
| is_mono = rr ? BLI_listbase_count_ex(&rr->views, 2) < 2 : (ima->flag & IMA_IS_MULTIVIEW) == 0; | is_mono = rr ? BLI_listbase_count_ex(&rr->views, 2) < 2 : BLI_listbase_count_ex(&ima->views, 2) < 2; | ||||
| /* error handling */ | /* error handling */ | ||||
| if (!rr) { | if (!rr) { | ||||
| if (imf->imtype == R_IMF_IMTYPE_MULTILAYER) { | if (imf->imtype == R_IMF_IMTYPE_MULTILAYER) { | ||||
| BKE_report(op->reports, RPT_ERROR, "Did not write, no Multilayer Image"); | BKE_report(op->reports, RPT_ERROR, "Did not write, no Multilayer Image"); | ||||
| goto cleanup; | goto cleanup; | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| if (imf->views_format == R_IMF_VIEWS_STEREO_3D) { | if (imf->views_format == R_IMF_VIEWS_STEREO_3D) { | ||||
| if ((ima->flag & IMA_IS_STEREO) == 0) { | if (!BKE_image_is_stereo(ima)) { | ||||
| BKE_reportf(op->reports, RPT_ERROR, "Did not write, the image doesn't have a \"%s\" and \"%s\" views", | BKE_reportf(op->reports, RPT_ERROR, "Did not write, the image doesn't have a \"%s\" and \"%s\" views", | ||||
| STEREO_LEFT_NAME, STEREO_RIGHT_NAME); | STEREO_LEFT_NAME, STEREO_RIGHT_NAME); | ||||
| goto cleanup; | goto cleanup; | ||||
| } | } | ||||
| /* it shouldn't ever happen*/ | /* it shouldn't ever happen*/ | ||||
| if ((BLI_findstring(&rr->views, STEREO_LEFT_NAME, offsetof(RenderView, name)) == NULL) || | if ((BLI_findstring(&rr->views, STEREO_LEFT_NAME, offsetof(RenderView, name)) == NULL) || | ||||
| (BLI_findstring(&rr->views, STEREO_RIGHT_NAME, offsetof(RenderView, name)) == NULL)) | (BLI_findstring(&rr->views, STEREO_RIGHT_NAME, offsetof(RenderView, name)) == NULL)) | ||||
| ▲ Show 20 Lines • Show All 228 Lines • ▼ Show 20 Lines | static int image_save_as_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | ||||
| RNA_boolean_set(op->ptr, "save_as_render", save_as_render); | RNA_boolean_set(op->ptr, "save_as_render", save_as_render); | ||||
| op->customdata = MEM_mallocN(sizeof(simopts.im_format), __func__); | op->customdata = MEM_mallocN(sizeof(simopts.im_format), __func__); | ||||
| memcpy(op->customdata, &simopts.im_format, sizeof(simopts.im_format)); | memcpy(op->customdata, &simopts.im_format, sizeof(simopts.im_format)); | ||||
| /* show multiview save options only if image has multiviews */ | /* show multiview save options only if image has multiviews */ | ||||
| prop = RNA_struct_find_property(op->ptr, "show_multiview"); | prop = RNA_struct_find_property(op->ptr, "show_multiview"); | ||||
| RNA_property_boolean_set(op->ptr, prop, (ima->flag & IMA_IS_MULTIVIEW) != 0); | RNA_property_boolean_set(op->ptr, prop, BKE_image_is_multiview(ima)); | ||||
| prop = RNA_struct_find_property(op->ptr, "use_multiview"); | prop = RNA_struct_find_property(op->ptr, "use_multiview"); | ||||
| RNA_property_boolean_set(op->ptr, prop, (ima->flag & IMA_IS_MULTIVIEW) != 0); | RNA_property_boolean_set(op->ptr, prop, BKE_image_is_multiview(ima)); | ||||
| image_filesel(C, op, simopts.filepath); | image_filesel(C, op, simopts.filepath); | ||||
| return OPERATOR_RUNNING_MODAL; | return OPERATOR_RUNNING_MODAL; | ||||
| } | } | ||||
| static void image_save_as_cancel(bContext *UNUSED(C), wmOperator *op) | static void image_save_as_cancel(bContext *UNUSED(C), wmOperator *op) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 1,599 Lines • Show Last 20 Lines | |||||