2.5:
authorThomas Dinges <blender@dingto.org>
Sun, 20 Sep 2009 13:34:54 +0000 (13:34 +0000)
committerThomas Dinges <blender@dingto.org>
Sun, 20 Sep 2009 13:34:54 +0000 (13:34 +0000)
* Wrapped Invert, PremulKey Levels Node, Distance Key, Difference Key and Color Spill.
* Added RNA for Levels Node.
* Small RNA fixes.

source/blender/editors/space_node/drawnode.c
source/blender/makesrna/intern/rna_nodetree.c
source/blender/makesrna/intern/rna_nodetree_types.h

index 3fa1e43b51bd6df8c9003ee0a0fa41c009d68c5a..9b73bdbb255478be775ed6c7dba4c4283c885003 100644 (file)
@@ -1294,7 +1294,6 @@ static void node_composit_buts_lensdist(uiLayout *layout, PointerRNA *ptr)
        uiLayoutSetActive(col, RNA_boolean_get(ptr, "projector")==0);
        uiItemR(col, NULL, 0, ptr, "jitter", 0);
        uiItemR(col, NULL, 0, ptr, "fit", 0);
-
 }
 
 static void node_composit_buts_vecblur(uiLayout *layout, PointerRNA *ptr)
@@ -1395,60 +1394,30 @@ static void node_composit_buts_dilateerode(uiLayout *layout, PointerRNA *ptr)
 
 static void node_composit_buts_diff_matte(uiLayout *layout, PointerRNA *ptr)
 {
-       uiBlock *block= uiLayoutFreeBlock(layout);
-       bNode *node= ptr->data;
-       rctf *butr= &node->butr;
-       NodeChroma *c= node->storage;
+       uiLayout *col;
        
-       uiBlockBeginAlign(block);
-       uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Tolerance: ", 
-               butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20,
-               &c->t1, 0.0f, 1.0f, 100, 0, "Color differences below this threshold are keyed.");
-       uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Falloff: ", 
-               butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
-               &c->t2, 0.0f, 1.0f, 100, 0, "Color differences below this additional threshold are partially keyed.");
-       uiBlockEndAlign(block);
+       col =uiLayoutColumn(layout, 1);
+       uiItemR(col, NULL, 0, ptr, "tolerance", UI_ITEM_R_SLIDER);
+       uiItemR(col, NULL, 0, ptr, "falloff", UI_ITEM_R_SLIDER);
 }
 
 static void node_composit_buts_distance_matte(uiLayout *layout, PointerRNA *ptr)
 {
-       uiBlock *block= uiLayoutFreeBlock(layout);
-       bNode *node= ptr->data;
-       rctf *butr= &node->butr;
-       NodeChroma *c= node->storage;
+       uiLayout *col;
        
-       uiBlockBeginAlign(block);
-       uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Tolerance: ", 
-               butr->xmin, butr->ymin+20, butr->xmax-butr->xmin, 20,
-               &c->t1, 0.0f, 1.0f, 100, 0, "Color distances below this threshold are keyed.");
-       uiDefButF(block, NUMSLI, B_NODE_EXEC+node->nr, "Falloff: ", 
-               butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
-               &c->t2, 0.0f, 1.0f, 100, 0, "Color distances below this additional threshold are partially keyed.");
-       uiBlockEndAlign(block);
+       col =uiLayoutColumn(layout, 1);
+       uiItemR(col, NULL, 0, ptr, "tolerance", UI_ITEM_R_SLIDER);
+       uiItemR(col, NULL, 0, ptr, "falloff", UI_ITEM_R_SLIDER);
 }
 
 static void node_composit_buts_color_spill(uiLayout *layout, PointerRNA *ptr)
 {
-       uiBlock *block= uiLayoutFreeBlock(layout);
-       bNode *node= ptr->data;
-       rctf *butr= &node->butr;
-       short dx= (butr->xmax-butr->xmin)/3;
-
-       NodeChroma *c=node->storage;
-       uiBlockBeginAlign(block);
-       uiDefButF(block, NUM, B_NODE_EXEC, "Enhance: ", 
-                       butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20,
-                       &c->t1, 0.0f, 0.5f, 100, 2, "Adjusts how much selected channel is affected by color spill algorithm");
-       uiDefButS(block, ROW, B_NODE_EXEC, "R",
-                       butr->xmin,butr->ymin,dx,20,
-                       &node->custom1,1,1, 0, 0, "Red Spill Suppression");
-       uiDefButS(block, ROW, B_NODE_EXEC, "G",
-                       butr->xmin+dx,butr->ymin,dx,20,
-                       &node->custom1,1,2, 0, 0, "Green Spill Suppression");
-       uiDefButS(block, ROW, B_NODE_EXEC, "B",
-                       butr->xmin+2*dx,butr->ymin,dx,20,
-                       &node->custom1, 1, 3, 0, 0, "Blue Spill Suppression");
-       uiBlockEndAlign(block);
+       uiLayout *row, *col;
+       
+       col =uiLayoutColumn(layout, 1);
+       uiItemR(col, NULL, 0, ptr, "factor", 0);
+       row= uiLayoutRow(col, 0);
+       uiItemR(row, NULL, 0, ptr, "channel", UI_ITEM_R_EXPAND);
 }
 
 static void node_composit_buts_chroma_matte(uiLayout *layout, PointerRNA *ptr)
@@ -1709,56 +1678,23 @@ static void node_composit_buts_scale(uiLayout *layout, PointerRNA *ptr)
 
 static void node_composit_buts_invert(uiLayout *layout, PointerRNA *ptr)
 {
-       uiBlock *block= uiLayoutFreeBlock(layout);
-       bNode *node= ptr->data;
-       rctf *butr= &node->butr;
-
-       uiBlockBeginAlign(block);
-       uiDefButBitS(block, TOG, CMP_CHAN_RGB, B_NODE_EXEC, "RGB",
-                                butr->xmin, butr->ymin, (butr->xmax-butr->xmin)/2, 20, 
-                                &node->custom1, 0, 0, 0, 0, "");
-       uiDefButBitS(block, TOG, CMP_CHAN_A, B_NODE_EXEC, "A",
-                                butr->xmin+(butr->xmax-butr->xmin)/2, butr->ymin, (butr->xmax-butr->xmin)/2, 20, 
-                                &node->custom1, 0, 0, 0, 0, "");
-       uiBlockEndAlign(block);
+       uiLayout *col;
+       
+       col= uiLayoutColumn(layout, 0);
+       uiItemR(col, NULL, 0, ptr, "rgb", 0);
+       uiItemR(col, NULL, 0, ptr, "alpha", 0);
 }
 
 static void node_composit_buts_premulkey(uiLayout *layout, PointerRNA *ptr)
 {
-       uiBlock *block= uiLayoutFreeBlock(layout);
-       bNode *node= ptr->data;
-       rctf *butr= &node->butr;
-       uiBut *bt;
-       
-       /* blend type */
-       bt=uiDefButS(block, MENU, B_NODE_EXEC, "Key to Premul %x0|Premul to Key %x1",
-                                butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, 
-                                &node->custom1, 0, 0, 0, 0, "Conversion between premultiplied alpha and key alpha");
+       uiItemR(layout, "", 0, ptr, "mapping", 0);
 }
 
 static void node_composit_buts_view_levels(uiLayout *layout, PointerRNA *ptr)
 {
-       uiBlock *block= uiLayoutFreeBlock(layout);
-       bNode *node= ptr->data;
-       rctf *butr= &node->butr;
-       short sx= (butr->xmax-butr->xmin)/5;
-
-       /*color space selectors*/
-       uiBlockBeginAlign(block);
-       uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"C",
-               butr->xmin,butr->ymin,sx,20,&node->custom1,1,1, 0, 0, "Combined RGB");
-       uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"R",
-               butr->xmin+sx,butr->ymin,sx,20,&node->custom1,1,2, 0, 0, "Red Channel");
-       uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"G",
-               butr->xmin+2*sx,butr->ymin,sx,20,&node->custom1,1,3, 0, 0, "Green Channel");
-       uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"B",
-               butr->xmin+3*sx,butr->ymin,sx,20,&node->custom1,1,4, 0, 0, "Blue Channel");
-       uiDefButS(block, ROW,B_NODE_EXEC+node->nr,"L",
-               butr->xmin+4*sx,butr->ymin,sx,20,&node->custom1,1,5, 0, 0, "Luminenc Channel");
-       uiBlockEndAlign(block);
+       uiItemR(layout, NULL, 0, ptr, "color_space", UI_ITEM_R_EXPAND);
 }
 
-
 /* only once called */
 static void node_composit_set_butfunc(bNodeType *ntype)
 {
index b89bf0552bd759a02a74bcca11a075dd6dd98083..239fd894e4f2fef20c4d8bfdd182ce1d8a1f8bea 100644 (file)
@@ -700,6 +700,26 @@ static void def_cmp_vector_blur(StructRNA *srna)
        RNA_def_property_update(prop, 0, "rna_Node_update");
 }
 
+static void def_cmp_levels(StructRNA *srna)
+{
+       PropertyRNA *prop;
+       
+       static EnumPropertyItem space_items[] = {
+               {1, "COMNINED_RGB", 0, "C", "Combined RGB"},
+               {2, "RED", 0, "R", "Red Channel"},
+               {3, "GREEN", 0, "G", "Green Channel"},
+               {4, "BLUE", 0, "B", "Blue Channel"},
+               {5, "LUMINANCE", 0, "L", "Luminance Channel"},
+               {0, NULL, 0, NULL, NULL}
+       };
+       
+       prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "custom1");
+       RNA_def_property_enum_items(prop, space_items);
+       RNA_def_property_ui_text(prop, "Color Space", "");
+       RNA_def_property_update(prop, 0, "rna_Node_update");
+}
+
 static void def_cmp_image(StructRNA *srna)
 {
        PropertyRNA *prop;
@@ -964,9 +984,9 @@ static void def_cmp_color_spill(StructRNA *srna)
        PropertyRNA *prop;
        
        static EnumPropertyItem channel_items[] = {
-               {1, "R", 0, "Red",   ""},
-               {2, "G", 0, "Green", ""},
-               {3, "B", 0, "Blue",  ""},
+               {1, "R", 0, "R", "Red Spill Suppression"},
+               {2, "G", 0, "G", "Green Spill Suppression"},
+               {3, "B", 0, "B", "Blue Spill Suppression"},
                {0, NULL, 0, NULL, NULL}
        };
        
index 420f1deae488b096f157f853f85f0e8b5a9f2fdc..69424649b3b646b26e331f86fa19241b8e24f89e 100644 (file)
@@ -64,7 +64,7 @@ DefNode( CompositorNode, CMP_NODE_VECBLUR,        def_cmp_vector_blur,    "VECBL
 DefNode( CompositorNode, CMP_NODE_SEPRGBA,        0,                      "SEPRGBA",        SepRGBA,          "Separate RGBA",     ""              )
 DefNode( CompositorNode, CMP_NODE_SEPHSVA,        0,                      "SEPHSVA",        SepHSVA,          "Separate HSVA",     ""              )
 DefNode( CompositorNode, CMP_NODE_SETALPHA,       0,                      "SETALPHA",       SetAlpha,         "Set Alpha",         ""              )
-DefNode( CompositorNode, CMP_NODE_HUE_SAT,        def_cmp_hue_saturation,                      "HUE_SAT",        HueSat,           "Hue/Saturation",    ""              )
+DefNode( CompositorNode, CMP_NODE_HUE_SAT,        def_cmp_hue_saturation, "HUE_SAT",        HueSat,           "Hue/Saturation",    ""              )
 DefNode( CompositorNode, CMP_NODE_IMAGE,          def_cmp_image,          "IMAGE",          Image,            "Image",             ""              )
 DefNode( CompositorNode, CMP_NODE_R_LAYERS,       def_cmp_render_layers,  "R_LAYERS",       RLayers,          "Render Layers",     ""              )
 DefNode( CompositorNode, CMP_NODE_COMPOSITE,      0,                      "COMPOSITE",      Composite,        "Composite",         ""              )
@@ -104,7 +104,7 @@ DefNode( CompositorNode, CMP_NODE_PREMULKEY,      def_cmp_premul_key,     "PREMU
 DefNode( CompositorNode, CMP_NODE_GLARE,          def_cmp_glare,          "GLARE",          Glare,            "Glare",             ""              )
 DefNode( CompositorNode, CMP_NODE_TONEMAP,        def_cmp_tonemap,        "TONEMAP",        Tonemap,          "Tonemap",           ""              )
 DefNode( CompositorNode, CMP_NODE_LENSDIST,       def_cmp_lensdist,       "LENSDIST",       Lensdist,         "Lensdist",          ""              )
-DefNode( CompositorNode, CMP_NODE_VIEW_LEVELS,    0,                      "LEVELS",         Levels,           "Levels",            ""              )
+DefNode( CompositorNode, CMP_NODE_VIEW_LEVELS,    def_cmp_levels,         "LEVELS",         Levels,           "Levels",            ""              )
 DefNode( CompositorNode, CMP_NODE_COLOR_MATTE,    def_cmp_color_matte,    "COLOR_MATTE",    ColorMatte,       "Color Matte",       ""              )
 DefNode( CompositorNode, CMP_NODE_DIST_MATTE,     def_cmp_distance_matte, "DISTANCE_MATTE", DistanceMatte,    "Distance Matte",    ""              )