forked from bartvdbraak/blender
Applied patch #23379. Does not change existing .blend files and looks
good.
This commit is contained in:
parent
86ad6837c5
commit
a42c490a04
@ -707,12 +707,20 @@ static void node_composit_buts_crop(uiLayout *layout, bContext *C, PointerRNA *p
|
||||
uiLayout *col;
|
||||
|
||||
uiItemR(layout, ptr, "use_crop_size", 0, NULL, 0);
|
||||
|
||||
uiItemR(layout, ptr, "relative", 0, NULL, 0);
|
||||
|
||||
col= uiLayoutColumn(layout, 1);
|
||||
uiItemR(col, ptr, "min_x", 0, "Left", 0);
|
||||
uiItemR(col, ptr, "max_x", 0, "Right", 0);
|
||||
uiItemR(col, ptr, "min_y", 0, "Up", 0);
|
||||
uiItemR(col, ptr, "max_y", 0, "Down", 0);
|
||||
if (RNA_boolean_get(ptr, "relative")){
|
||||
uiItemR(col, ptr, "rel_min_x", 0, "Left", 0);
|
||||
uiItemR(col, ptr, "rel_max_x", 0, "Right", 0);
|
||||
uiItemR(col, ptr, "rel_min_y", 0, "Up", 0);
|
||||
uiItemR(col, ptr, "rel_max_y", 0, "Down", 0);
|
||||
} else {
|
||||
uiItemR(col, ptr, "min_x", 0, "Left", 0);
|
||||
uiItemR(col, ptr, "max_x", 0, "Right", 0);
|
||||
uiItemR(col, ptr, "min_y", 0, "Up", 0);
|
||||
uiItemR(col, ptr, "max_y", 0, "Down", 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void node_composit_buts_splitviewer(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
|
@ -255,6 +255,7 @@ typedef struct NodeChroma {
|
||||
|
||||
typedef struct NodeTwoXYs {
|
||||
short x1, x2, y1, y2;
|
||||
float fac_x1, fac_x2, fac_y1, fac_y2;
|
||||
} NodeTwoXYs;
|
||||
|
||||
typedef struct NodeTwoFloats {
|
||||
|
@ -1637,7 +1637,12 @@ static void def_cmp_crop(StructRNA *srna)
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
|
||||
RNA_def_property_ui_text(prop, "Crop Image Size", "Whether to crop the size of the input image");
|
||||
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
|
||||
|
||||
|
||||
prop = RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "custom2", 1);
|
||||
RNA_def_property_ui_text(prop, "Relative", "Use relative values to crop image");
|
||||
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
|
||||
|
||||
RNA_def_struct_sdna_from(srna, "NodeTwoXYs", "storage");
|
||||
|
||||
prop = RNA_def_property(srna, "min_x", PROP_INT, PROP_NONE);
|
||||
@ -1663,6 +1668,30 @@ static void def_cmp_crop(StructRNA *srna)
|
||||
RNA_def_property_range(prop, 0, 10000);
|
||||
RNA_def_property_ui_text(prop, "Y2", "");
|
||||
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "rel_min_x", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "fac_x1");
|
||||
RNA_def_property_range(prop, 0.0, 1.0);
|
||||
RNA_def_property_ui_text(prop, "X1", "");
|
||||
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "rel_max_x", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "fac_x2");
|
||||
RNA_def_property_range(prop, 0.0, 1.0);
|
||||
RNA_def_property_ui_text(prop, "X2", "");
|
||||
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "rel_min_y", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "fac_y1");
|
||||
RNA_def_property_range(prop, 0.0, 1.0);
|
||||
RNA_def_property_ui_text(prop, "Y1", "");
|
||||
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "rel_max_y", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "fac_y2");
|
||||
RNA_def_property_range(prop, 0.0, 1.0);
|
||||
RNA_def_property_ui_text(prop, "Y2", "");
|
||||
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_dblur(StructRNA *srna)
|
||||
|
@ -48,7 +48,14 @@ static void node_composit_exec_crop(void *data, bNode *node, bNodeStack **in, bN
|
||||
CompBuf *stackbuf;
|
||||
int x, y;
|
||||
float *srcfp, *outfp;
|
||||
rcti outputrect;
|
||||
rcti outputrect;
|
||||
|
||||
if(node->custom2) {
|
||||
ntxy->x1= cbuf->x* ntxy->fac_x1;
|
||||
ntxy->x2= cbuf->x* ntxy->fac_x2;
|
||||
ntxy->y1= cbuf->y* ntxy->fac_y1;
|
||||
ntxy->y2= cbuf->y* ntxy->fac_y2;
|
||||
}
|
||||
|
||||
/* check input image size */
|
||||
if(cbuf->x <= ntxy->x1 + 1)
|
||||
|
Loading…
Reference in New Issue
Block a user