svn merge ^/trunk/blender -r47272:47306
authorCampbell Barton <ideasman42@gmail.com>
Fri, 1 Jun 2012 05:50:17 +0000 (05:50 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 1 Jun 2012 05:50:17 +0000 (05:50 +0000)
1  2 
release/scripts/modules/bpy_extras/keyconfig_utils.py
source/blender/compositor/CMakeLists.txt
source/blender/editors/transform/transform.c

index 306371ea6f5819d799fa1ef1eaa9720e60267e27,e652b8461b22bc342b3d5ec875769d9f8eaf983e..287cd81eff26be25d458f089ebca764c1ba49557
@@@ -95,7 -95,6 +95,7 @@@ KM_HIERARCHY = 
      ('Clip', 'CLIP_EDITOR', 'WINDOW', [
          ('Clip Editor', 'CLIP_EDITOR', 'WINDOW', []),
          ('Clip Graph Editor', 'CLIP_EDITOR', 'WINDOW', []),
 +        ('Mask Editor', 'EMPTY', 'WINDOW', []),  # image (reverse order, UVEdit before Image
          ]),
  
      ('View3D Gesture Circle', 'EMPTY', 'WINDOW', []),
@@@ -146,7 -145,7 +146,7 @@@ def _export_properties(prefix, properti
          return result
  
      for pname in properties.bl_rna.properties.keys():
-         if pname != "rna_type" and not properties.is_property_hidden(pname):
+         if pname != "rna_type":
              value = getattr(properties, pname)
              if isinstance(value, OperatorProperties):
                  _export_properties(prefix + "." + pname, value, lines)
index 3e29583756f968029a05a79dd6ca75de726b786a,355b5ac58c3dcf93425fcddf1a2e9752cc4957f5..6abc74700d6e56b9b67b2e75f05e629168854c27
@@@ -134,8 -134,6 +134,8 @@@ set(SR
        nodes/COM_MovieClipNode.h
        nodes/COM_OutputFileNode.cpp
        nodes/COM_OutputFileNode.h
 +      nodes/COM_MaskNode.cpp
 +      nodes/COM_MaskNode.h
  
  # output nodes
        nodes/COM_CompositorNode.cpp
        operations/COM_CropOperation.cpp
        operations/COM_CropOperation.h
  
-       operations/COM_LensGlowOperation.cpp
-       operations/COM_LensGlowOperation.h
-       operations/COM_LensGhostOperation.cpp
-       operations/COM_LensGhostOperation.h
        nodes/COM_TransformNode.cpp
        nodes/COM_TransformNode.h
        nodes/COM_Stabilize2dNode.cpp
  
        operations/COM_DoubleEdgeMaskOperation.cpp
        operations/COM_DoubleEdgeMaskOperation.h
 +
 +      nodes/COM_KeyingNode.cpp
 +      nodes/COM_KeyingNode.h
 +      nodes/COM_KeyingScreenNode.cpp
 +      nodes/COM_KeyingScreenNode.h
 +      operations/COM_KeyingOperation.cpp
 +      operations/COM_KeyingOperation.h
 +      operations/COM_KeyingScreenOperation.cpp
 +      operations/COM_KeyingScreenOperation.h
 +      operations/COM_KeyingDespillOperation.cpp
 +      operations/COM_KeyingDespillOperation.h
 +
  operations/COM_ColorSpillOperation.cpp
  operations/COM_ColorSpillOperation.h
                operations/COM_RenderLayersBaseProg.cpp
                operations/COM_RenderLayersCyclesOperation.cpp
                operations/COM_RenderLayersCyclesOperation.h
  
- operations/COM_ImageOperation.cpp
- operations/COM_ImageOperation.h
- operations/COM_MultilayerImageOperation.cpp
- operations/COM_MultilayerImageOperation.h
- operations/COM_TextureOperation.cpp
- operations/COM_TextureOperation.h
- operations/COM_BokehImageOperation.cpp
- operations/COM_BokehImageOperation.h
- operations/COM_LensGlowImageOperation.cpp
- operations/COM_LensGlowImageOperation.h
+       operations/COM_ImageOperation.cpp
+       operations/COM_ImageOperation.h
+       operations/COM_MultilayerImageOperation.cpp
+       operations/COM_MultilayerImageOperation.h
+       operations/COM_TextureOperation.cpp
+       operations/COM_TextureOperation.h
+       operations/COM_BokehImageOperation.cpp
+       operations/COM_BokehImageOperation.h
  
  
                operations/COM_SocketProxyOperation.h
@@@ -589,6 -569,8 +583,8 @@@ operations/COM_ConvertDepthToRadiusOper
        operations/COM_GlareSimpleStarOperation.h
        operations/COM_GlareStreaksOperation.cpp
        operations/COM_GlareStreaksOperation.h
+       operations/COM_GlareGhostOperation.cpp
+       operations/COM_GlareGhostOperation.h
        operations/COM_SetSamplerOperation.cpp
        operations/COM_SetSamplerOperation.h
  
  
        operations/COM_AntiAliasOperation.cpp
        operations/COM_AntiAliasOperation.h
 +
 +      operations/COM_MaskOperation.cpp
 +      operations/COM_MaskOperation.h
  )
  
  blender_add_lib(bf_compositor "${SRC}" "${INC}" "${INC_SYS}")
index cb2eaf7aef908c5fd1a87abadd54cac5ca47813c,e955dae017894f681a08dd53b399d9197d338da0..006704e26bff1b9197f0df0c349f1d1ced3e4ce2
@@@ -49,7 -49,6 +49,7 @@@
  #include "DNA_constraint_types.h"
  #include "DNA_mesh_types.h"
  #include "DNA_meshdata_types.h"
 +#include "DNA_mask_types.h"
  #include "DNA_movieclip_types.h"
  #include "DNA_scene_types.h"          /* PET modes                    */
  
@@@ -163,35 -162,13 +163,35 @@@ void convertViewVec(TransInfo *t, floa
        else if (t->spacetype==SPACE_CLIP) {
                View2D *v2d = t->view;
                float divx, divy;
 +              float mulx, muly;
 +              float aspx = 1.0f, aspy = 1.0f;
  
                divx = v2d->mask.xmax-v2d->mask.xmin;
                divy = v2d->mask.ymax-v2d->mask.ymin;
  
 -              r_vec[0] = (v2d->cur.xmax-v2d->cur.xmin)*(dx)/divx;
 -              r_vec[1] = (v2d->cur.ymax-v2d->cur.ymin)*(dy)/divy;
 +              mulx = (v2d->cur.xmax-v2d->cur.xmin);
 +              muly = (v2d->cur.ymax-v2d->cur.ymin);
 +
 +              if (t->options & CTX_MASK) {
 +                      /* clamp w/h, mask only */
 +                      divx = divy = maxf(divx, divy);
 +                      mulx = muly = minf(mulx, muly);
 +              }
 +
 +              r_vec[0] = mulx * (dx) / divx;
 +              r_vec[1] = muly * (dy) / divy;
                r_vec[2] = 0.0f;
 +
 +              if (t->options & CTX_MOVIECLIP) {
 +                      ED_space_clip_aspect_dimension_aware(t->sa->spacedata.first, &aspx, &aspy);
 +              }
 +              else if (t->options & CTX_MASK) {
 +                      /* TODO - NOT WORKING, this isnt so bad since its only display aspect */
 +                      ED_space_clip_mask_aspect(t->sa->spacedata.first, &aspx, &aspy);
 +              }
 +
 +              r_vec[0] *= aspx;
 +              r_vec[1] *= aspy;
        }
        else {
                printf("%s: called in an invalid context\n", __func__);
@@@ -249,18 -226,9 +249,18 @@@ void projectIntView(TransInfo *t, cons
        }
        else if (t->spacetype==SPACE_CLIP) {
                float v[2];
 +              float aspx = 1.0f, aspy = 1.0f;
  
                copy_v2_v2(v, vec);
  
 +              if (t->options & CTX_MOVIECLIP)
 +                      ED_space_clip_aspect_dimension_aware(t->sa->spacedata.first, &aspx, &aspy);
 +              else if (t->options & CTX_MASK)
 +                      ED_space_clip_mask_aspect(t->sa->spacedata.first, &aspx, &aspy);
 +
 +              v[0] /= aspx;
 +              v[1] /= aspy;
 +
                UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr+1);
        }
  }
@@@ -311,23 -279,16 +311,23 @@@ void applyAspectRatio(TransInfo *t, flo
                vec[1] /= aspy;
        }
        else if ((t->spacetype==SPACE_CLIP) && (t->mode==TFM_TRANSLATION)) {
 -              if (t->options & CTX_MOVIECLIP) {
 +              if (t->options & (CTX_MOVIECLIP | CTX_MASK)) {
                        SpaceClip *sc = t->sa->spacedata.first;
                        float aspx, aspy;
 -                      int width, height;
  
 -                      ED_space_clip_size(sc, &width, &height);
 -                      ED_space_clip_aspect(sc, &aspx, &aspy);
  
 -                      vec[0] *= width / aspx;
 -                      vec[1] *= height / aspy;
 +                      if (t->options & CTX_MOVIECLIP) {
 +                              ED_space_clip_aspect_dimension_aware(sc, &aspx, &aspy);
 +
 +                              vec[0] /= aspx;
 +                              vec[1] /= aspy;
 +                      }
 +                      else if (t->options & CTX_MASK) {
 +                              ED_space_clip_mask_aspect(sc, &aspx, &aspy);
 +
 +                              vec[0] /= aspx;
 +                              vec[1] /= aspy;
 +                      }
                }
        }
  }
@@@ -351,19 -312,16 +351,19 @@@ void removeAspectRatio(TransInfo *t, fl
                vec[1] *= aspy;
        }
        else if ((t->spacetype==SPACE_CLIP) && (t->mode==TFM_TRANSLATION)) {
 -              if (t->options & CTX_MOVIECLIP) {
 +              if (t->options & (CTX_MOVIECLIP | CTX_MASK)) {
                        SpaceClip *sc = t->sa->spacedata.first;
 -                      float aspx, aspy;
 -                      int width, height;
 +                      float aspx = 1.0f, aspy = 1.0f;
  
 -                      ED_space_clip_size(sc, &width, &height);
 -                      ED_space_clip_aspect(sc, &aspx, &aspy);
 +                      if (t->options & CTX_MOVIECLIP) {
 +                              ED_space_clip_aspect_dimension_aware(sc, &aspx, &aspy);
 +                      }
 +                      else if (t->options & CTX_MASK) {
 +                              ED_space_clip_mask_aspect(sc, &aspx, &aspy);
 +                      }
  
 -                      vec[0] *= aspx / width;
 -                      vec[1] *= aspy / height;
 +                      vec[0] *= aspx;
 +                      vec[1] *= aspy;
                }
        }
  }
@@@ -409,20 -367,12 +409,20 @@@ static void viewRedrawForce(const bCont
        }
        else if (t->spacetype==SPACE_CLIP) {
                SpaceClip *sc = (SpaceClip*)t->sa->spacedata.first;
 -              MovieClip *clip = ED_space_clip(sc);
  
 -              /* objects could be parented to tracking data, so send this for viewport refresh */
 -              WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
 +              if (ED_space_clip_show_trackedit(sc)) {
 +                      MovieClip *clip = ED_space_clip(sc);
 +
 +                      /* objects could be parented to tracking data, so send this for viewport refresh */
 +                      WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
 +
 +                      WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip);
 +              }
 +              else if (ED_space_clip_show_maskedit(sc)) {
 +                      Mask *mask = ED_space_clip_mask(sc);
  
 -              WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip);
 +                      WM_event_add_notifier(C, NC_MASK|NA_EDITED, mask);
 +              }
        }
  }
  
@@@ -778,7 -728,7 +778,7 @@@ int transformEvent(TransInfo *t, wmEven
                                        t->redraw |= TREDRAW_HARD;
                                }
                                else if (t->mode == TFM_TRANSLATION) {
 -                                      if (t->options & CTX_MOVIECLIP) {
 +                                      if (t->options & (CTX_MOVIECLIP | CTX_MASK)) {
                                                restoreTransObjects(t);
  
                                                t->flag ^= T_ALT_TRANSFORM;
                                break;
                        case TFM_MODAL_ROTATE:
                                /* only switch when... */
 -                              if (!(t->options & CTX_TEXTURE) && !(t->options & CTX_MOVIECLIP)) {
 +                              if (!(t->options & CTX_TEXTURE) && !(t->options & (CTX_MOVIECLIP | CTX_MASK))) {
                                        if ( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
                                                
                                                resetTransRestrictions(t);
                                        initSnapping(t, NULL); // need to reinit after mode change
                                        t->redraw |= TREDRAW_HARD;
                                }
 +                              else if (t->mode == TFM_RESIZE) {
 +                                      if (t->options & CTX_MOVIECLIP) {
 +                                              restoreTransObjects(t);
 +
 +                                              t->flag ^= T_ALT_TRANSFORM;
 +                                              t->redraw |= TREDRAW_HARD;
 +                                      }
 +                              }
                                break;
                                
                        case TFM_MODAL_SNAP_INV_ON:
                        break;
                case RKEY:
                        /* only switch when... */
 -                      if (!(t->options & CTX_TEXTURE) && !(t->options & CTX_MOVIECLIP)) {
 +                      if (!(t->options & CTX_TEXTURE)) {
                                if ( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
  
                                        resetTransRestrictions(t);
@@@ -1517,8 -1459,6 +1517,8 @@@ void saveTransform(bContext *C, TransIn
                {
                        if (t->obedit)
                                ts->proportional = proportional;
 +                      else if (t->options & CTX_MASK)
 +                              ts->proportional_mask = (proportional != PROP_EDIT_OFF);
                        else
                                ts->proportional_objects = (proportional != PROP_EDIT_OFF);
                }
@@@ -2735,9 -2675,6 +2735,9 @@@ static void ElementResize(TransInfo *t
        {
                copy_v3_v3(center, td->center);
        }
 +      else if (t->options & CTX_MOVIECLIP) {
 +              copy_v3_v3(center, td->center);
 +      }
        else {
                copy_v3_v3(center, t->center);
        }
@@@ -3111,10 -3048,6 +3111,10 @@@ static void ElementRotation(TransInfo *
                {
                        center = td->center;
                }
 +
 +              if (t->options & CTX_MOVIECLIP) {
 +                      center = td->center;
 +              }
        }
  
        if (t->flag & T_POINTS) {
@@@ -4595,8 -4528,8 +4595,8 @@@ static int createSlideVerts(TransInfo *
        BMBVHTree *btree = BMBVH_NewBVH(em, BMBVH_RESPECT_HIDDEN, NULL, NULL);
        SmallHash table;
        SlideData *sld = MEM_callocN(sizeof(*sld), "sld");
-       View3D *v3d = t->sa ? t->sa->spacedata.first : NULL;
-       RegionView3D *rv3d = t->ar ? t->ar->regiondata : NULL; /* background mode support */
+       View3D *v3d = NULL;
+       RegionView3D *rv3d = NULL;
        ARegion *ar = t->ar;
        float projectMat[4][4];
        float mval[2] = {(float)t->mval[0], (float)t->mval[1]};
        float vec[3], vec2[3], lastvec[3] /*, size, dis=0.0, z */ /* UNUSED */;
        int numsel, i, j;
  
+       if (t->spacetype == SPACE_VIEW3D) {
+               /* background mode support */
+               v3d = t->sa ? t->sa->spacedata.first : NULL;
+               rv3d = t->ar ? t->ar->regiondata : NULL;
+       }
        sld->is_proportional = TRUE;
        sld->curr_sv_index = 0;
        sld->flipped_vtx = FALSE;
  
-       if (!v3d) {
+       if (!rv3d) {
                /* ok, let's try to survive this */
                unit_m4(projectMat);
        }
                                        if (BM_elem_flag_test(e2, BM_ELEM_SELECT))
                                                continue;
                                        
-                                       if (!BMBVH_EdgeVisible(btree, e2, ar, v3d, t->obedit))
+                                       if (v3d && !BMBVH_EdgeVisible(btree, e2, ar, v3d, t->obedit))
                                                continue;
                                        
                                        j = GET_INT_FROM_POINTER(BLI_smallhash_lookup(&table, (uintptr_t)v));
                BLI_smallhash_insert(&sld->vhash, (uintptr_t)sv_array->v, sv_array);
        }
  
-       calcNonProportionalEdgeSlide(t, sld, mval);
+       if (rv3d)
+               calcNonProportionalEdgeSlide(t, sld, mval);
  
        sld->origfaces_init = TRUE;
        sld->em = em;