Applied patch #23379. Does not change existing .blend files and looks

good.
This commit is contained in:
Robert Holcomb 2010-08-25 02:18:37 +00:00
parent 86ad6837c5
commit a42c490a04
4 changed files with 52 additions and 7 deletions

@ -707,13 +707,21 @@ static void node_composit_buts_crop(uiLayout *layout, bContext *C, PointerRNA *p
uiLayout *col; uiLayout *col;
uiItemR(layout, ptr, "use_crop_size", 0, NULL, 0); uiItemR(layout, ptr, "use_crop_size", 0, NULL, 0);
uiItemR(layout, ptr, "relative", 0, NULL, 0);
col= uiLayoutColumn(layout, 1); col= uiLayoutColumn(layout, 1);
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, "min_x", 0, "Left", 0);
uiItemR(col, ptr, "max_x", 0, "Right", 0); uiItemR(col, ptr, "max_x", 0, "Right", 0);
uiItemR(col, ptr, "min_y", 0, "Up", 0); uiItemR(col, ptr, "min_y", 0, "Up", 0);
uiItemR(col, ptr, "max_y", 0, "Down", 0); uiItemR(col, ptr, "max_y", 0, "Down", 0);
} }
}
static void node_composit_buts_splitviewer(uiLayout *layout, bContext *C, PointerRNA *ptr) static void node_composit_buts_splitviewer(uiLayout *layout, bContext *C, PointerRNA *ptr)
{ {

@ -255,6 +255,7 @@ typedef struct NodeChroma {
typedef struct NodeTwoXYs { typedef struct NodeTwoXYs {
short x1, x2, y1, y2; short x1, x2, y1, y2;
float fac_x1, fac_x2, fac_y1, fac_y2;
} NodeTwoXYs; } NodeTwoXYs;
typedef struct NodeTwoFloats { typedef struct NodeTwoFloats {

@ -1638,6 +1638,11 @@ static void def_cmp_crop(StructRNA *srna)
RNA_def_property_ui_text(prop, "Crop Image Size", "Whether to crop the size of the input image"); 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"); 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"); RNA_def_struct_sdna_from(srna, "NodeTwoXYs", "storage");
prop = RNA_def_property(srna, "min_x", PROP_INT, PROP_NONE); 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_range(prop, 0, 10000);
RNA_def_property_ui_text(prop, "Y2", ""); RNA_def_property_ui_text(prop, "Y2", "");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); 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) static void def_cmp_dblur(StructRNA *srna)

@ -50,6 +50,13 @@ static void node_composit_exec_crop(void *data, bNode *node, bNodeStack **in, bN
float *srcfp, *outfp; 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 */ /* check input image size */
if(cbuf->x <= ntxy->x1 + 1) if(cbuf->x <= ntxy->x1 + 1)
ntxy->x1= cbuf->x - 1; ntxy->x1= cbuf->x - 1;