svn merge ^/trunk/blender -r48162:48168
authorCampbell Barton <ideasman42@gmail.com>
Thu, 21 Jun 2012 14:38:45 +0000 (14:38 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 21 Jun 2012 14:38:45 +0000 (14:38 +0000)
1  2 
source/blender/editors/space_node/drawnode.c

index e893e1180a1565d57c86040b9037e72fd4a0633d,22017a2d8b921241469c2e098b9b65da63ebaf63..9b6671c40398e95ead96c85372acaf19594a6fe1
@@@ -52,7 -52,6 +52,7 @@@
  #include "BKE_library.h"
  #include "BKE_main.h"
  #include "BKE_node.h"
 +#include "BKE_tracking.h"
  
  #include "BLF_api.h"
  #include "BLF_translation.h"
@@@ -341,25 -340,30 +341,30 @@@ static void node_buts_curvevec(uiLayou
        uiTemplateCurveMapping(layout, ptr, "mapping", 'v', 0, 0);
  }
  
- static float *_sample_col = NULL;    // bad bad, 2.5 will do better?
- #if 0
static void node_curvemap_sample(float *col)
+ static float _sample_col[4];    // bad bad, 2.5 will do better?
+ #define SAMPLE_FLT_ISNONE FLT_MAX
void ED_node_sample_set(const float col[4])
  {
-       _sample_col = col;
+       if (col) {
+               copy_v4_v4(_sample_col, col);
+       }
+       else {
+               copy_v4_fl(_sample_col, SAMPLE_FLT_ISNONE);
+       }
  }
- #endif
  
  static void node_buts_curvecol(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
  {
        bNode *node = ptr->data;
        CurveMapping *cumap = node->storage;
  
-       if (_sample_col) {
+       if (_sample_col[0] != SAMPLE_FLT_ISNONE) {
                cumap->flag |= CUMA_DRAW_SAMPLE;
                copy_v3_v3(cumap->sample, _sample_col);
        }
-       else 
+       else {
                cumap->flag &= ~CUMA_DRAW_SAMPLE;
+       }
  
        uiTemplateCurveMapping(layout, ptr, "mapping", 'c', 0, 0);
  }
@@@ -2130,6 -2134,17 +2135,17 @@@ static void node_composit_buts_colorbal
  
  static void node_composit_buts_huecorrect(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
  {
+       bNode *node = ptr->data;
+       CurveMapping *cumap = node->storage;
+       if (_sample_col[0] != SAMPLE_FLT_ISNONE) {
+               cumap->flag |= CUMA_DRAW_SAMPLE;
+               copy_v3_v3(cumap->sample, _sample_col);
+       }
+       else {
+               cumap->flag &= ~CUMA_DRAW_SAMPLE;
+       }
        uiTemplateCurveMapping(layout, ptr, "mapping", 'h', 0, 0);
  }
  
@@@ -2470,41 -2485,6 +2486,41 @@@ static void node_composit_buts_keying(u
        uiItemR(layout, ptr, "blur_post", 0, NULL, ICON_NONE);
  }
  
 +static void node_composit_buts_trackpos(uiLayout *layout, bContext *C, PointerRNA *ptr)
 +{
 +      bNode *node= ptr->data;
 +
 +      uiTemplateID(layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL);
 +
 +      if (node->id) {
 +              MovieClip *clip = (MovieClip *) node->id;
 +              MovieTracking *tracking = &clip->tracking;
 +              MovieTrackingObject *object;
 +              uiLayout *col;
 +              PointerRNA tracking_ptr;
 +              NodeTrackPosData *data = node->storage;
 +
 +              RNA_pointer_create(&clip->id, &RNA_MovieTracking, tracking, &tracking_ptr);
 +
 +              col = uiLayoutColumn(layout, 0);
 +              uiItemPointerR(col, ptr, "tracking_object", &tracking_ptr, "objects", "", ICON_OBJECT_DATA);
 +
 +              object = BKE_tracking_object_get_named(tracking, data->tracking_object);
 +              if (object) {
 +                      PointerRNA object_ptr;
 +
 +                      RNA_pointer_create(&clip->id, &RNA_MovieTrackingObject, object, &object_ptr);
 +
 +                      uiItemPointerR(col, ptr, "track_name", &object_ptr, "tracks", "", ICON_ANIM_DATA);
 +              }
 +              else {
 +                      uiItemR(layout, ptr, "track_name", 0, "", ICON_ANIM_DATA);
 +              }
 +
 +              uiItemR(layout, ptr, "use_relative", 0, NULL, ICON_NONE);
 +      }
 +}
 +
  /* only once called */
  static void node_composit_set_butfunc(bNodeType *ntype)
  {
                case CMP_NODE_KEYING:
                        ntype->uifunc = node_composit_buts_keying;
                        break;
 +              case CMP_NODE_TRACKPOS:
 +                      ntype->uifunc = node_composit_buts_trackpos;
 +                      break;
                default:
                        ntype->uifunc = NULL;
        }