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:
authorCampbell Barton <ideasman42@gmail.com>2011-11-22 00:19:58 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-11-22 00:19:58 +0400
commit0e2c8cdcdd13a49560e6f105de530c2ef94ed4e4 (patch)
tree0f53d799ec422ddc96dd948136061e08233abdf4 /source/blender/editors/space_image
parente0482b2def521df87f09c7aa23e58909f5e19b90 (diff)
move image settings into their own structure so the interface can be shared where image saving settings are needed.
currently file out node and render output share this struct & UI.
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r--source/blender/editors/space_image/image_buttons.c68
-rw-r--r--source/blender/editors/space_image/image_ops.c42
2 files changed, 103 insertions, 7 deletions
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index df5c8d4c7cd..48627e9d1ed 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -817,6 +817,74 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
MEM_freeN(cb);
}
+void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr)
+{
+ ImageFormatData *imf= imfptr->data;
+ ID *id= imfptr->id.data;
+ const int depth_ok= BKE_imtype_is_depth_ok(imf->imtype);
+ /* some settings depend on this being a scene thats rendered */
+ const short is_render_out= (id && GS(id->name) == ID_SCE);
+
+ uiLayout *col, *row;
+
+ col= uiLayoutColumn(layout, 0);
+
+ uiItemR(col, imfptr, "file_format", 0, "", ICON_NONE);
+
+ row= uiLayoutRow(col, 0);
+ uiItemR(row, imfptr, "color_mode", UI_ITEM_R_EXPAND, "Color", ICON_NONE);
+
+ /* only display depth setting if multiple depths can be used */
+ if((ELEM6(depth_ok,
+ R_IMF_CHAN_DEPTH_1,
+ R_IMF_CHAN_DEPTH_8,
+ R_IMF_CHAN_DEPTH_12,
+ R_IMF_CHAN_DEPTH_16,
+ R_IMF_CHAN_DEPTH_24,
+ R_IMF_CHAN_DEPTH_32)) == 0)
+ {
+ row= uiLayoutRow(col, 0);
+ uiItemR(row, imfptr, "color_depth", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+ }
+
+ if (BKE_imtype_is_quality_ok(imf->imtype)) {
+ uiItemR(col, imfptr, "quality", 0, NULL, ICON_NONE);
+ }
+
+ if (BKE_imtype_is_compression_ok(imf->imtype)) {
+ uiItemR(col, imfptr, "compression", 0, NULL, ICON_NONE);
+ }
+
+ if (BKE_imtype_is_zbuf_ok(imf->imtype)) {
+ uiItemR(col, imfptr, "use_zbuffer", 0, NULL, ICON_NONE);
+ }
+
+ if (ELEM(imf->imtype, R_OPENEXR, R_MULTILAYER)) {
+ uiItemR(col, imfptr, "exr_codec", 0, NULL, ICON_NONE);
+
+ if (is_render_out && (imf->imtype == R_OPENEXR)) {
+ uiItemR(col, imfptr, "use_preview", 0, NULL, ICON_NONE);
+ }
+ }
+
+ if (imf->imtype == R_JP2) {
+ uiItemR(col, imfptr, "use_jpeg2k_ycc", 0, NULL, ICON_NONE);
+ uiItemR(col, imfptr, "use_jpeg2k_cinema_preset", 0, NULL, ICON_NONE);
+ uiItemR(col, imfptr, "use_jpeg2k_cinema_48", 0, NULL, ICON_NONE);
+ }
+
+ if (imf->imtype == R_CINEON) {
+#if 1
+ uiItemL(col, "FIXME: hard coded Non-Linear, Gamma:1.0", ICON_NONE);
+#else
+ uiItemR(col, imfptr, "use_cineon_log", 0, NULL, ICON_NONE);
+ uiItemR(col, imfptr, "cineon_black", 0, NULL, ICON_NONE);
+ uiItemR(col, imfptr, "cineon_white", 0, NULL, ICON_NONE);
+ uiItemR(col, imfptr, "cineon_gamma", 0, NULL, ICON_NONE);
+#endif
+ }
+}
+
void uiTemplateImageLayers(uiLayout *layout, bContext *C, Image *ima, ImageUser *iuser)
{
Scene *scene= CTX_data_scene(C);
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 77c92b2d9c3..448e109e98a 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -967,8 +967,8 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
simopts->planes= ibuf->depth;
if(ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) {
- simopts->imtype= scene->r.imtype;
- simopts->planes= scene->r.planes;
+ simopts->imtype= scene->r.im_format.imtype;
+ simopts->planes= scene->r.im_format.planes;
}
else if (ima->source == IMA_SRC_GENERATED) {
simopts->imtype= R_PNG;
@@ -976,7 +976,7 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
else {
simopts->imtype= BKE_ftype_to_imtype(ibuf->ftype);
}
- simopts->subimtype= scene->r.subimtype; /* XXX - this is lame, we need to make these available too! */
+ //simopts->subimtype= scene->r.subimtype; /* XXX - this is lame, we need to make these available too! */
simopts->quality= ibuf->ftype & 0xff;
BLI_strncpy(simopts->filepath, ibuf->name, sizeof(simopts->filepath));
@@ -990,7 +990,7 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
/* some formats dont use quality so fallback to scenes quality */
if (simopts->quality == 0) {
- simopts->quality= scene->r.quality;
+ simopts->quality= scene->r.im_format.quality;
}
/* check for empty path */
@@ -1017,7 +1017,8 @@ static void save_image_options_from_op(SaveImageOptions *simopts, wmOperator *op
#if 0
if (RNA_property_is_set(op->ptr, "subimtype")) simopts->subimtype= RNA_enum_get(op->ptr, "subimtype"); // XXX
#else
- simopts->subimtype= evil_scene->r.subimtype;
+// simopts->subimtype= evil_scene->r.subimtype;
+ (void)evil_scene;
#endif
if (RNA_property_is_set(op->ptr, "file_quality")) simopts->quality= RNA_int_get(op->ptr, "file_quality");
@@ -1086,8 +1087,18 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
}
BKE_image_release_renderresult(scene, ima);
}
- else if (BKE_write_ibuf(ibuf, simopts->filepath, simopts->imtype, simopts->subimtype, simopts->quality)) {
- ok= TRUE;
+ else {
+ ImageFormatData imf= {0};
+
+ /* todo, make operator use template, this works for now */
+ imf.imtype= simopts->imtype;
+ imf.quality= simopts->quality;
+ imf.compress= simopts->quality;
+ imf.depth= R_IMF_CHAN_DEPTH_8;
+
+ if (BKE_write_ibuf(ibuf, simopts->filepath, &imf)) {
+ ok= TRUE;
+ }
}
if (ok) {
@@ -1191,6 +1202,22 @@ static int image_save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
return OPERATOR_RUNNING_MODAL;
}
+#if 0
+static void image_save_as_draw(bContext *C, wmOperator *op)
+{
+ ImageFormatData *imf= op->customdata;
+ PointerRNA ptr;
+
+ /* image template */
+ RNA_pointer_create(NULL, &RNA_ImageFormatSettings, imf, &ptr);
+ uiTemplateImageSettings(layout, &ptr);
+
+ /* main draw call */
+ RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
+ uiDefAutoButsRNA(layout, &ptr, NULL, '\0');
+}
+#endif
+
void IMAGE_OT_save_as(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -1203,6 +1230,7 @@ void IMAGE_OT_save_as(wmOperatorType *ot)
ot->exec= image_save_as_exec;
ot->check= image_save_as_check;
ot->invoke= image_save_as_invoke;
+ // ot->ui= image_save_as_draw;
ot->poll= space_image_buffer_exists_poll;
/* flags */