svn merge ^/trunk/blender -r48409:48411
authorCampbell Barton <ideasman42@gmail.com>
Fri, 29 Jun 2012 14:39:38 +0000 (14:39 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 29 Jun 2012 14:39:38 +0000 (14:39 +0000)
1  2 
source/blender/editors/space_node/drawnode.c

index 99d3a32ece260f9b225d09d4eda788fbcfecf78c,d644747413be7e7c70697d50691de680144a2368..9a3bf77843b57efab5782a7fa7ff311857bd4cc9
@@@ -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"
@@@ -2487,41 -2486,6 +2487,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;
        }
@@@ -3390,3 -3351,28 +3390,28 @@@ void node_draw_link(View2D *v2d, SpaceN
        node_draw_link_bezier(v2d, snode, link, th_col1, do_shaded, th_col2, do_triple, th_col3);
  //    node_draw_link_straight(v2d, snode, link, th_col1, do_shaded, th_col2, do_triple, th_col3);
  }
+ void drawnodesnap(View2D *v2d, const float cent[2], float size, NodeBorder border)
+ {
+       glBegin(GL_LINES);
+       
+       if (border & (NODE_LEFT | NODE_RIGHT)) {
+               glVertex2f(cent[0], v2d->cur.ymin);
+               glVertex2f(cent[0], v2d->cur.ymax);
+       }
+       else {
+               glVertex2f(cent[0], cent[1] - size);
+               glVertex2f(cent[0], cent[1] + size);
+       }
+       
+       if (border & (NODE_TOP | NODE_BOTTOM)) {
+               glVertex2f(v2d->cur.xmin, cent[1]);
+               glVertex2f(v2d->cur.xmax, cent[1]);
+       }
+       else {
+               glVertex2f(cent[0] - size, cent[1]);
+               glVertex2f(cent[0] + size, cent[1]);
+       }
+       
+       glEnd();
+ }