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:
Diffstat (limited to 'source/blender/editors/space_image/image_ops.c')
-rw-r--r--source/blender/editors/space_image/image_ops.c42
1 files changed, 31 insertions, 11 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 7c021cf6645..c87e547b6ea 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -48,6 +48,7 @@
#include "BKE_colortools.h"
#include "BKE_context.h"
+#include "BKE_depsgraph.h"
#include "BKE_icons.h"
#include "BKE_image.h"
#include "BKE_global.h"
@@ -564,6 +565,8 @@ static void image_view_zoom_cancel(bContext *C, wmOperator *op)
void IMAGE_OT_view_zoom(wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
ot->name = "View Zoom";
ot->idname = "IMAGE_OT_view_zoom";
@@ -580,8 +583,9 @@ void IMAGE_OT_view_zoom(wmOperatorType *ot)
ot->flag = OPTYPE_BLOCKING | OPTYPE_LOCK_BYPASS;
/* properties */
- RNA_def_float(ot->srna, "factor", 0.0f, -FLT_MAX, FLT_MAX,
- "Factor", "Zoom factor, values higher than 1.0 zoom in, lower values zoom out", -FLT_MAX, FLT_MAX);
+ prop = RNA_def_float(ot->srna, "factor", 0.0f, -FLT_MAX, FLT_MAX, "Factor",
+ "Zoom factor, values higher than 1.0 zoom in, lower values zoom out", -FLT_MAX, FLT_MAX);
+ RNA_def_property_flag(prop, PROP_HIDDEN);
}
/********************** NDOF operator *********************/
@@ -799,6 +803,8 @@ static int image_view_zoom_in_invoke(bContext *C, wmOperator *op, const wmEvent
void IMAGE_OT_view_zoom_in(wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
ot->name = "View Zoom In";
ot->idname = "IMAGE_OT_view_zoom_in";
@@ -813,7 +819,9 @@ void IMAGE_OT_view_zoom_in(wmOperatorType *ot)
ot->flag = OPTYPE_LOCK_BYPASS;
/* properties */
- RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in screen coordinates", -10.0f, 10.0f);
+ prop = RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX,
+ "Location", "Cursor location in screen coordinates", -10.0f, 10.0f);
+ RNA_def_property_flag(prop, PROP_HIDDEN);
}
static int image_view_zoom_out_exec(bContext *C, wmOperator *op)
@@ -844,6 +852,8 @@ static int image_view_zoom_out_invoke(bContext *C, wmOperator *op, const wmEvent
void IMAGE_OT_view_zoom_out(wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
ot->name = "View Zoom Out";
ot->idname = "IMAGE_OT_view_zoom_out";
@@ -858,7 +868,9 @@ void IMAGE_OT_view_zoom_out(wmOperatorType *ot)
ot->flag = OPTYPE_LOCK_BYPASS;
/* properties */
- RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in screen coordinates", -10.0f, 10.0f);
+ prop = RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX,
+ "Location", "Cursor location in screen coordinates", -10.0f, 10.0f);
+ RNA_def_property_flag(prop, PROP_HIDDEN);
}
/********************** view zoom ratio operator *********************/
@@ -1382,7 +1394,7 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
/* sanitize all settings */
/* unlikely but just in case */
- if (ELEM3(simopts->im_format.planes, R_IMF_PLANES_BW, R_IMF_PLANES_RGB, R_IMF_PLANES_RGBA) == 0) {
+ if (ELEM(simopts->im_format.planes, R_IMF_PLANES_BW, R_IMF_PLANES_RGB, R_IMF_PLANES_RGBA) == 0) {
simopts->im_format.planes = R_IMF_PLANES_RGBA;
}
@@ -1484,9 +1496,12 @@ static bool save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
}
else {
/* TODO, better solution, if a 24bit image is painted onto it may contain alpha */
- if (ibuf->userflags & IB_BITMAPDIRTY) { /* it has been painted onto */
+ if ((simopts->im_format.planes == R_IMF_PLANES_RGBA) &&
+ /* it has been painted onto */
+ (ibuf->userflags & IB_BITMAPDIRTY))
+ {
/* checks each pixel, not ideal */
- ibuf->planes = BKE_imbuf_alpha_test(ibuf) ? 32 : 24;
+ ibuf->planes = BKE_imbuf_alpha_test(ibuf) ? R_IMF_PLANES_RGBA : R_IMF_PLANES_RGB;
}
}
@@ -1866,6 +1881,7 @@ static int image_reload_exec(bContext *C, wmOperator *UNUSED(op))
// XXX other users?
BKE_image_signal(ima, (sima) ? &sima->iuser : NULL, IMA_SIGNAL_RELOAD);
+ DAG_id_tag_update(&ima->id, 0);
WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima);
@@ -1921,7 +1937,7 @@ static int image_new_exec(bContext *C, wmOperator *op)
gen_type = RNA_enum_get(op->ptr, "generated_type");
RNA_float_get_array(op->ptr, "color", color);
alpha = RNA_boolean_get(op->ptr, "alpha");
-
+
if (!alpha)
color[3] = 1.0f;
@@ -2001,6 +2017,9 @@ void IMAGE_OT_new(wmOperatorType *ot)
RNA_def_enum(ot->srna, "generated_type", image_generated_type_items, IMA_GENTYPE_BLANK,
"Generated Type", "Fill the image with a grid for UV map testing");
RNA_def_boolean(ot->srna, "float", 0, "32 bit Float", "Create image with 32 bit floating point bit depth");
+ prop = RNA_def_boolean(ot->srna, "texstencil", 0, "Stencil", "Set Image as stencil");
+ RNA_def_property_flag(prop, PROP_HIDDEN);
+
}
#undef IMA_DEF_NAME
@@ -2035,7 +2054,7 @@ static int image_invert_exec(bContext *C, wmOperator *op)
if (support_undo) {
ED_undo_paint_push_begin(UNDO_PAINT_IMAGE, op->type->name,
- ED_image_undo_restore, ED_image_undo_free);
+ ED_image_undo_restore, ED_image_undo_free, NULL);
/* not strictly needed, because we only imapaint_dirty_region to invalidate all tiles
* but better do this right in case someone copies this for a tool that uses partial redraw better */
ED_imapaint_clear_partial_redraw();
@@ -2459,11 +2478,12 @@ static void image_sample_apply(bContext *C, wmOperator *op, const wmEvent *event
int point = RNA_enum_get(op->ptr, "point");
if (point == 1) {
- curvemapping_set_black_white(curve_mapping, NULL, info->colfp);
+ curvemapping_set_black_white(curve_mapping, NULL, info->linearcol);
}
else if (point == 0) {
- curvemapping_set_black_white(curve_mapping, info->colfp, NULL);
+ curvemapping_set_black_white(curve_mapping, info->linearcol, NULL);
}
+ WM_event_add_notifier(C, NC_WINDOW, NULL);
}
}