Merging r50162 through r50171 from trunk into soc-2011-tomato
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 24 Aug 2012 09:09:33 +0000 (09:09 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 24 Aug 2012 09:09:33 +0000 (09:09 +0000)
1  2 
release/scripts/startup/bl_ui/space_sequencer.py
source/blender/editors/screen/screen_ops.c
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_node/node_draw.c
source/blender/makesrna/intern/rna_sequencer.c

index 2fcd5ef8a87ce4ed2e75c2f48c4e358ac9b64310,ebc73752aef159e24778599aa17c6de84c5c4c19..d92325a8b3da579ca977e83d65133cfdc9c8400a
@@@ -882,11 -882,6 +882,11 @@@ class SEQUENCER_PT_view(SequencerButton
              col.prop(st, "show_separate_color")
          col.prop(st, "proxy_render_size")
  
 +        #col = layout.column()
 +        #col.separator()
 +        #col.label(text="Color Management:")
 +        #col.template_colormanaged_view_settings(st, "view_settings", True)
 +
  
  class SEQUENCER_PT_modifiers(SequencerButtonsPanel, Panel):
      bl_label = "Modifiers"
                      box.template_curve_mapping(mod, "curve_mapping", type='COLOR')
                  elif mod.type == 'HUE_CORRECT':
                      box.template_curve_mapping(mod, "curve_mapping", type='HUE')
+                 elif mod.type == 'BRIGHT_CONTRAST':
+                     col = box.column()
+                     col.prop(mod, "bright")
+                     col.prop(mod, "contrast")
  
  
  if __name__ == "__main__":  # only for live edit.
index 6c27dc7c6eb5578afa8c92956e41de6bf210db59,823037a79031615aded2d47fb7a437dccfd4aab0..4b26ed89f53ce840a8e86a87a820cd9e9baa2e55
@@@ -49,7 -49,6 +49,7 @@@
  #include "DNA_mask_types.h"
  #include "DNA_userdef_types.h"
  
 +#include "BKE_colortools.h"
  #include "BKE_context.h"
  #include "BKE_customdata.h"
  #include "BKE_global.h"
@@@ -522,7 -521,7 +522,7 @@@ static ScrArea *screen_areahascursor(bS
        ScrArea *sa = NULL;
        sa = scr->areabase.first;
        while (sa) {
-               if (BLI_in_rcti(&sa->totrct, x, y)) break;
+               if (BLI_rcti_isect_pt(&sa->totrct, x, y)) break;
                sa = sa->next;
        }
        
@@@ -541,7 -540,7 +541,7 @@@ static int actionzone_area_poll(bContex
                int y = win->eventstate->y;
                
                for (az = sa->actionzones.first; az; az = az->next)
-                       if (BLI_in_rcti(&az->rect, x, y))
+                       if (BLI_rcti_isect_pt(&az->rect, x, y))
                                return 1;
        }       
        return 0;
@@@ -552,7 -551,7 +552,7 @@@ AZone *is_in_area_actionzone(ScrArea *s
        AZone *az = NULL;
        
        for (az = sa->actionzones.first; az; az = az->next) {
-               if (BLI_in_rcti_v(&az->rect, xy)) {
+               if (BLI_rcti_isect_pt_v(&az->rect, xy)) {
                        if (az->type == AZONE_AREA) {
                                /* no triangle intersect but a hotspot circle based on corner */
                                int radius = (xy[0] - az->x1) * (xy[0] - az->x1) + (xy[1] - az->y1) * (xy[1] - az->y1);
@@@ -852,7 -851,7 +852,7 @@@ static int area_dupli_invoke(bContext *
        rect = sa->totrct;
        BLI_rcti_translate(&rect, win->posx, win->posy);
        newwin = WM_window_open(C, &rect);
 -      
 +
        /* allocs new screen and adds to newly created window, using window size */
        newsc = ED_screen_add(newwin, CTX_data_scene(C), sc->id.name + 2);
        newwin->screen = newsc;
index ddea7da929ac1d49aad7174acbe216ba038b9f41,8a1f0e5b611261b8720b9934929a95c93f15a9a9..b8de995b7423d7014f533793d8a55cfed251c3cc
@@@ -63,7 -63,6 +63,7 @@@
  
  #include "UI_resources.h"
  
 +#include "IMB_colormanagement.h"
  #include "IMB_imbuf.h"
  #include "IMB_imbuf_types.h"
  
@@@ -455,7 -454,7 +455,7 @@@ static int node_resize_area_default(bNo
                rctf totr = node->totr;
                /* right part of node */
                totr.xmin = node->totr.xmax - 20.0f;
-               if (BLI_in_rctf(&totr, x, y))
+               if (BLI_rctf_isect_pt(&totr, x, y))
                        return NODE_RESIZE_RIGHT;
                else
                        return 0;
@@@ -1325,10 -1324,6 +1325,10 @@@ static void node_shader_buts_tex_image(
  
        uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL);
        uiItemR(layout, ptr, "color_space", 0, "", ICON_NONE);
 +      uiItemR(layout, ptr, "projection", 0, "", ICON_NONE);
 +
 +      if(RNA_enum_get(ptr, "projection") == SHD_PROJ_BOX)
 +              uiItemR(layout, ptr, "projection_blend", 0, "Blend", ICON_NONE);
  
        /* note: image user properties used directly here, unlike compositor image node,
         * which redefines them in the node struct RNA to get proper updates.
@@@ -2008,7 -2003,7 +2008,7 @@@ static void node_composit_buts_file_out
        int multilayer = (RNA_enum_get(&imfptr, "file_format") == R_IMF_IMTYPE_MULTILAYER);
        
        node_composit_buts_file_output(layout, C, ptr);
 -      uiTemplateImageSettings(layout, &imfptr);
 +      uiTemplateImageSettings(layout, &imfptr, TRUE);
        
        uiItemS(layout);
        
                        
                        col = uiLayoutColumn(layout, FALSE);
                        uiLayoutSetActive(col, RNA_boolean_get(&active_input_ptr, "use_node_format") == FALSE);
 -                      uiTemplateImageSettings(col, &imfptr);
 +                      uiTemplateImageSettings(col, &imfptr, TRUE);
                }
        }
  }
@@@ -3036,7 -3031,7 +3036,7 @@@ void ED_node_init_butfuncs(void
  
  /* ************** Generic drawing ************** */
  
 -void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage)
 +void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode)
  {
        
        if ((snode->flag & SNODE_BACKDRAW) && snode->treetype == NTREE_COMPOSIT) {
                void *lock;
                ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
                if (ibuf) {
 +                      SpaceNode *snode = CTX_wm_space_node(C);
                        float x, y; 
 +                      unsigned char *display_buffer;
 +                      void *cache_handle;
                        
                        glMatrixMode(GL_PROJECTION);
                        glPushMatrix();
                        x = (ar->winx - snode->zoom * ibuf->x) / 2 + snode->xof;
                        y = (ar->winy - snode->zoom * ibuf->y) / 2 + snode->yof;
                        
 -                      if (!ibuf->rect) {
 -                              if (color_manage)
 -                                      ibuf->profile = IB_PROFILE_LINEAR_RGB;
 -                              else
 -                                      ibuf->profile = IB_PROFILE_NONE;
 -                              IMB_rect_from_float(ibuf);
 -                      }
  
 -                      if (ibuf->rect) {
 +                      display_buffer = IMB_display_buffer_acquire_ctx(C, ibuf, &cache_handle);
 +
 +                      if (display_buffer) {
                                if (snode->flag & (SNODE_SHOW_R | SNODE_SHOW_G | SNODE_SHOW_B)) {
                                        int ofs;
  
  #ifdef __BIG_ENDIAN__
                                        glPixelStorei(GL_UNPACK_SWAP_BYTES, 1);
  #endif
 -                                      glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_UNSIGNED_INT, ibuf->rect);
 +                                      glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_UNSIGNED_INT, display_buffer);
  
  #ifdef __BIG_ENDIAN__
                                        glPixelStorei(GL_UNPACK_SWAP_BYTES, 0);
                                        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
                                        glPixelZoom(snode->zoom, snode->zoom);
                                        
 -                                      glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
 +                                      glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, display_buffer);
                                        
                                        glPixelZoom(1.0f, 1.0f);
                                        glDisable(GL_BLEND);
                                else {
                                        glPixelZoom(snode->zoom, snode->zoom);
                                        
 -                                      glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
 +                                      glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, display_buffer);
                                        
                                        glPixelZoom(1.0f, 1.0f);
                                }
                        }
  
 +                      IMB_display_buffer_release(cache_handle);
 +
                        /** @note draw selected info on backdrop */
                        if (snode->edittree) {
                                bNode *node = snode->edittree->nodes.first;
index 0f4332e70243fee3d09afaf543363efb28751675,f1a91df6f533c6207e18d737a8e9e36c757e321f..7d35f56614038a539d83fe975d1b65753a8d3e8d
@@@ -476,12 -476,12 +476,12 @@@ void node_update_default(const bContex
  
  int node_select_area_default(bNode *node, int x, int y)
  {
-       return BLI_in_rctf(&node->totr, x, y);
+       return BLI_rctf_isect_pt(&node->totr, x, y);
  }
  
  int node_tweak_area_default(bNode *node, int x, int y)
  {
-       return BLI_in_rctf(&node->totr, x, y);
+       return BLI_rctf_isect_pt(&node->totr, x, y);
  }
  
  int node_get_colorid(bNode *node)
@@@ -989,7 -989,7 +989,7 @@@ void node_set_cursor(wmWindow *win, Spa
                else {
                        /* check nodes front to back */
                        for (node = ntree->nodes.last; node; node = node->prev) {
-                               if (BLI_in_rctf(&node->totr, snode->cursor[0], snode->cursor[1]))
+                               if (BLI_rctf_isect_pt(&node->totr, snode->cursor[0], snode->cursor[1]))
                                        break;  /* first hit on node stops */
                        }
                        if (node) {
@@@ -1091,6 -1091,8 +1091,6 @@@ void drawnodespace(const bContext *C, A
  {
        View2DScrollers *scrollers;
        SpaceNode *snode = CTX_wm_space_node(C);
 -      Scene *scene = CTX_data_scene(C);
 -      int color_manage = scene->r.color_mgt_flag & R_COLOR_MANAGEMENT;
        bNodeLinkDrag *nldrag;
        LinkData *linkdata;
        
        UI_view2d_multi_grid_draw(v2d, 25.0f, 5, 2);
  
        /* backdrop */
 -      draw_nodespace_back_pix(ar, snode, color_manage);
 +      draw_nodespace_back_pix(C, ar, snode);
        
        /* nodes */
        snode_set_context(snode, CTX_data_scene(C));
index bdee89308cfa4fbd06b2b69d62e42444002700b1,932c578899d0885ff89c1035cef45c99715b0c14..0e0e00cc8db9c016e767c8cdb32ed7f58aa43934
@@@ -63,6 -63,7 +63,7 @@@ EnumPropertyItem sequence_modifier_type
        {seqModifierType_ColorBalance, "COLOR_BALANCE", ICON_NONE, "Color Balance", ""},
        {seqModifierType_Curves, "CURVES", ICON_NONE, "Curves", ""},
        {seqModifierType_HueCorrect, "HUE_CORRECT", ICON_NONE, "Hue Correct", ""},
+       {seqModifierType_BrightContrast, "BRIGHT_CONTRAST", ICON_NONE, "Bright/Contrast", ""},
        {0, NULL, 0, NULL, NULL}
  };
  
@@@ -660,7 -661,7 +661,7 @@@ static void rna_Sequence_update_reopen_
        Scene *scene = (Scene *) ptr->id.data;
        Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
  
 -      BKE_sequencer_free_imbuf(scene, &ed->seqbase, FALSE, FALSE);
 +      BKE_sequencer_free_imbuf(scene, &ed->seqbase, FALSE);
  
        if (RNA_struct_is_a(ptr->type, &RNA_SoundSequence))
                BKE_sequencer_update_sound_bounds(scene, ptr->data);
@@@ -918,6 -919,8 +919,8 @@@ static StructRNA *rna_SequenceModifier_
                        return &RNA_CurvesModifier;
                case seqModifierType_HueCorrect:
                        return &RNA_HueCorrectModifier;
+               case seqModifierType_BrightContrast:
+                       return &RNA_BrightContrastModifier;
                default:
                        return &RNA_SequenceModifier;
        }
@@@ -2340,12 -2343,34 +2343,34 @@@ static void rna_def_hue_modifier(Blende
        RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
  }
  
+ static void rna_def_brightcontrast_modifier(BlenderRNA *brna)
+ {
+       StructRNA *srna;
+       PropertyRNA *prop;
+       srna = RNA_def_struct(brna, "BrightContrastModifier", "SequenceModifier");
+       RNA_def_struct_sdna(srna, "BrightContrastModifierData");
+       RNA_def_struct_ui_text(srna, "BrightContrastModifier", "Bright/contrast modifier data for sequence strip");
+       prop = RNA_def_property(srna, "bright", PROP_FLOAT, PROP_UNSIGNED);
+       RNA_def_property_float_sdna(prop, NULL, "bright");
+       RNA_def_property_ui_text(prop, "Bright", "");
+       RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+       prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_UNSIGNED);
+       RNA_def_property_float_sdna(prop, NULL, "contrast");
+       RNA_def_property_ui_text(prop, "Contrast", "");
+       RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+ }
  static void rna_def_modifiers(BlenderRNA *brna)
  {
        rna_def_modifier(brna);
        rna_def_colorbalance_modifier(brna);
        rna_def_curves_modifier(brna);
        rna_def_hue_modifier(brna);
+       rna_def_brightcontrast_modifier(brna);
  }
  
  void RNA_def_sequencer(BlenderRNA *brna)