Merging r38733 through r38779 from trunk into soc-2011-tomato
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 28 Jul 2011 11:01:38 +0000 (11:01 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 28 Jul 2011 11:01:38 +0000 (11:01 +0000)
1  2 
release/scripts/startup/bl_ui/space_view3d.py
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/transform/transform.h
source/blender/makesdna/DNA_scene_types.h
source/blender/makesrna/intern/rna_scene.c

index 6f167416a917ba64fdb49ae72fff60a2f3121909,acb0499c40fb3647dbb3d5c83ef118fc29335afc..be410eaabed46ba583743e83545edbda634eb52f
@@@ -79,19 -79,22 +79,22 @@@ class VIEW3D_HT_header(bpy.types.Header
                      row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
  
          # Snap
+         snap_element = toolsettings.snap_element
          row = layout.row(align=True)
          row.prop(toolsettings, "use_snap", text="")
          row.prop(toolsettings, "snap_element", text="", icon_only=True)
-         if toolsettings.snap_element != 'INCREMENT':
+         if snap_element != 'INCREMENT':
              row.prop(toolsettings, "snap_target", text="")
-             if obj and obj.mode == 'OBJECT':
-                 row.prop(toolsettings, "use_snap_align_rotation", text="")
-         if toolsettings.snap_element == 'VOLUME':
+             if obj:
+                 if obj.mode == 'OBJECT':
+                     row.prop(toolsettings, "use_snap_align_rotation", text="")
+                 elif obj.mode == 'EDIT':
+                     row.prop(toolsettings, "use_snap_self", text="")
+         if snap_element == 'VOLUME':
              row.prop(toolsettings, "use_snap_peel_object", text="")
-         elif toolsettings.snap_element == 'FACE':
+         elif snap_element == 'FACE':
              row.prop(toolsettings, "use_snap_project", text="")
-             if toolsettings.use_snap_project and obj.mode == 'EDIT':
-                 row.prop(toolsettings, "use_snap_project_self", text="")
  
          # OpenGL render
          row = layout.row(align=True)
@@@ -2172,16 -2175,6 +2175,16 @@@ class VIEW3D_PT_view3d_display(bpy.type
  
          layout.separator()
  
 +        layout.prop(view, "show_reconstruction")
 +        if view.show_reconstruction:
 +            layout.label(text="Bundle type:")
 +            layout.prop(view, "bundle_draw_type", text="")
 +            layout.prop(view, "bundle_draw_size")
 +            layout.prop(view, "show_bundle_name")
 +            layout.prop(view, "show_camera_path")
 +
 +        layout.separator()
 +
          region = view.region_quadview
  
          layout.operator("screen.region_quadview", text="Toggle Quad View")
@@@ -2287,10 -2280,8 +2290,10 @@@ class VIEW3D_PT_background_image(bpy.ty
              box = layout.box()
              row = box.row(align=True)
              row.prop(bg, "show_expanded", text="", emboss=False)
 -            if bg.image:
 +            if bg.source == 'IMAGE' and bg.image:
                  row.prop(bg.image, "name", text="", emboss=False)
 +            if bg.source == 'MOVIE' and bg.clip:
 +                row.prop(bg.clip, "name", text="", emboss=False)
              else:
                  row.label(text="Not Set")
              row.operator("view3d.background_image_remove", text="", emboss=False, icon='X').index = i
  
              if bg.show_expanded:
                  row = box.row()
 -                row.template_ID(bg, "image", open="image.open")
 -                if (bg.image):
 -                    box.template_image(bg, "image", bg.image_user, compact=True)
 +                row.prop(bg, "source", expand=True)
 +
 +                hasbg = False
 +                if bg.source == 'IMAGE':
 +                    row = box.row()
 +                    row.template_ID(bg, "image", open="image.open")
 +                    if (bg.image):
 +                        box.template_image(bg, "image", bg.image_user, compact=True)
 +                        hasbg = True
 +
 +                elif bg.source == 'MOVIE':
 +                    row = box.row()
 +                    row.template_ID(bg, "clip", open="clip.open")
 +
 +                    if bg.clip:
 +                        box.template_movieclip(bg, "clip", bg.clip_user, compact=True)
 +                        hasbg = True
  
 +                if hasbg:
                      box.prop(bg, "opacity", slider=True)
                      if bg.view_axis != 'CAMERA':
                          box.prop(bg, "size")
index 3a3cd6d136b383c72df4b6d0cce01534c8ad2c0c,c5275ea98b57f4871d78e9f67b395f0bafca22b6..237db58f36896da689e07d421000fa375b9f7178
@@@ -56,7 -56,6 +56,7 @@@
  #include "BKE_idprop.h"
  #include "BKE_report.h"
  #include "BKE_texture.h"
 +#include "BKE_tracking.h"
  #include "BKE_unit.h"
  
  #include "ED_screen.h"
@@@ -254,7 -253,7 +254,7 @@@ static uiBut *ui_but_last(uiBlock *bloc
  static int ui_is_a_warp_but(uiBut *but)
  {
        if(U.uiflag & USER_CONTINUOUS_MOUSE)
 -              if(ELEM3(but->type, NUM, NUMABS, HSVCIRCLE))
 +              if(ELEM4(but->type, NUM, NUMABS, HSVCIRCLE, TRACKPREVIEW))
                        return TRUE;
  
        return FALSE;
@@@ -918,13 -917,6 +918,13 @@@ static void ui_apply_but_WAVEFORM(bCont
        data->applied= 1;
  }
  
 +static void ui_apply_but_TRACKPREVIEW(bContext *C, uiBut *but, uiHandleButtonData *data)
 +{
 +      ui_apply_but_func(C, but);
 +      data->retval= but->retval;
 +      data->applied= 1;
 +}
 +
  
  static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, int interactive)
  {
                case WAVEFORM:
                        ui_apply_but_WAVEFORM(C, but, data);
                        break;
 +              case TRACKPREVIEW:
 +                      ui_apply_but_TRACKPREVIEW(C, but, data);
 +                      break;
                default:
                        break;
        }
@@@ -1890,7 -1879,6 +1890,6 @@@ static void ui_do_but_textedit(bContex
                                if(but->autocomplete_func || data->searchbox) {
                                        changed= ui_textedit_autocomplete(C, but, data);
                                        update= 1; /* do live update for tab key */
-                                       retval= WM_UI_HANDLER_BREAK;
                                }
                                /* the hotkey here is not well defined, was G.qual so we check all */
                                else if(event->shift || event->ctrl || event->alt || event->oskey) {
@@@ -2336,8 -2324,8 +2335,8 @@@ static float ui_numedit_apply_snapf(uiB
                if(fac != 1.0f) {
                        /* snap in unit-space */
                        tempf /= fac;
-                       softmin /= fac;
-                       softmax /= fac;
+                       /* softmin /= fac; */ /* UNUSED */
+                       /* softmax /= fac; */ /* UNUSED */
                        softrange /= fac;
                }
  
@@@ -3480,13 -3468,13 +3479,13 @@@ static int ui_numedit_but_CURVE(uiBut *
        CurveMapping *cumap= (CurveMapping*)but->poin;
        CurveMap *cuma= cumap->cm+cumap->cur;
        CurveMapPoint *cmp= cuma->curve;
-       float fx, fy, zoomx, zoomy, offsx, offsy;
+       float fx, fy, zoomx, zoomy /*, offsx, offsy */ /* UNUSED */;
        int a, changed= 0;
  
        zoomx= (but->x2-but->x1)/(cumap->curr.xmax-cumap->curr.xmin);
        zoomy= (but->y2-but->y1)/(cumap->curr.ymax-cumap->curr.ymin);
-       offsx= cumap->curr.xmin;
-       offsy= cumap->curr.ymin;
+       /* offsx= cumap->curr.xmin; */
+       /* offsy= cumap->curr.ymin; */
  
        if(snap) {
                float d[2];
@@@ -4068,89 -4056,6 +4067,89 @@@ static int ui_do_but_LINK(bContext *C, 
        return WM_UI_HANDLER_CONTINUE;
  }
  
 +static int ui_numedit_but_TRACKPREVIEW(bContext *C, uiBut *but, uiHandleButtonData *data, int mx, int my, int shift)
 +{
 +      MovieClipScopes *scopes = (MovieClipScopes *)but->poin;
 +      /* rcti rect; */
 +      int changed= 1;
 +      float dx, dy, yfac=1.f;
 +
 +      dx = mx - data->draglastx;
 +      dy = my - data->draglasty;
 +
 +      if(shift) {
 +              dx /= 5.0f;
 +              dy /= 5.0f;
 +      }
 +
 +      if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
 +               /* resize preview widget itself */
 +              scopes->track_preview_height = (but->y2 - but->y1) + (data->dragstarty - my);
 +      } else {
 +              if(scopes->marker) {
 +                      if(scopes->marker->framenr!=scopes->framenr)
 +                              scopes->marker= BKE_tracking_ensure_marker(scopes->track, scopes->framenr);
 +
 +                      scopes->marker->flag&= ~MARKER_DISABLED;
 +                      scopes->marker->pos[0]+= -dx*scopes->slide_scale[0] / (but->block->maxx-but->block->minx);
 +                      scopes->marker->pos[1]+= -dy*scopes->slide_scale[1] / (but->block->maxy-but->block->miny);
 +
 +                      WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, NULL);
 +              }
 +
 +              scopes->ok= 0;
 +      }
 +
 +      data->draglastx= mx;
 +      data->draglasty= my;
 +
 +      return changed;
 +}
 +
 +static int ui_do_but_TRACKPREVIEW(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 +{
 +      int mx, my;
 +
 +      mx= event->x;
 +      my= event->y;
 +      ui_window_to_block(data->region, block, &mx, &my);
 +
 +      if(data->state == BUTTON_STATE_HIGHLIGHT) {
 +              if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
 +                      data->dragstartx= mx;
 +                      data->dragstarty= my;
 +                      data->draglastx= mx;
 +                      data->draglasty= my;
 +                      button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 +
 +                      /* also do drag the first time */
 +                      if(ui_numedit_but_TRACKPREVIEW(C, but, data, mx, my, event->shift))
 +                              ui_numedit_apply(C, block, but, data);
 +
 +                      return WM_UI_HANDLER_BREAK;
 +              }
 +      }
 +      else if(data->state == BUTTON_STATE_NUM_EDITING) {
 +              if(event->type == ESCKEY) {
 +                      data->cancel= 1;
 +                      data->escapecancel= 1;
 +                      button_activate_state(C, but, BUTTON_STATE_EXIT);
 +              }
 +              else if(event->type == MOUSEMOVE) {
 +                      if(mx!=data->draglastx || my!=data->draglasty) {
 +                              if(ui_numedit_but_TRACKPREVIEW(C, but, data, mx, my, event->shift))
 +                                      ui_numedit_apply(C, block, but, data);
 +                      }
 +              }
 +              else if(event->type==LEFTMOUSE && event->val!=KM_PRESS) {
 +                      button_activate_state(C, but, BUTTON_STATE_EXIT);
 +              }
 +              return WM_UI_HANDLER_BREAK;
 +      }
 +
 +      return WM_UI_HANDLER_CONTINUE;
 +}
 +
  static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event))
  {
        uiBut *but = (uiBut *)arg1;
@@@ -4675,9 -4580,6 +4674,9 @@@ static int ui_do_button(bContext *C, ui
        case INLINK:
                retval= ui_do_but_LINK(C, but, data, event);
                break;
 +      case TRACKPREVIEW:
 +              retval= ui_do_but_TRACKPREVIEW(C, block, but, data, event);
 +              break;
        }
        
        return retval;
index 311684d5e7e99f3d1007183e56bf2744735ac2ab,34315494e14314274fda2e35413b1d2c2d05f599..b6e6bc1dfc2299a286c4d7b53d68099d03c03155
@@@ -2197,7 -2197,7 +2197,7 @@@ void uiTemplateList(uiLayout *layout, b
                        /* create list items */
                        RNA_PROP_BEGIN(ptr, itemptr, prop) {
                                /* create button */
-                               if(i == 9)
+                               if(!(i % 9))
                                        row= uiLayoutRow(col, 0);
  
                                icon= list_item_icon_get(C, &itemptr, rnaicon, 1);
        }
        else if(listtype == 'c') {
                /* compact layout */
-               found= 0;
  
                row= uiLayoutRow(layout, 1);
  
@@@ -2359,7 -2358,6 +2358,7 @@@ void uiTemplateOperatorSearch(uiLayout 
  #define B_STOPCAST            2
  #define B_STOPANIM            3
  #define B_STOPCOMPO           4
 +#define B_STOPCLIP            5
  
  static void do_running_jobs(bContext *C, void *UNUSED(arg), int event)
  {
                case B_STOPCOMPO:
                        WM_jobs_stop(CTX_wm_manager(C), CTX_wm_area(C), NULL);
                        break;
 +              case B_STOPCLIP:
 +                      WM_jobs_stop(CTX_wm_manager(C), CTX_wm_area(C), NULL);
 +                      break;
        }
  }
  
@@@ -2401,11 -2396,6 +2400,11 @@@ void uiTemplateRunningJobs(uiLayout *la
                   owner = sa;
                handle_event= B_STOPCOMPO;
        } 
 +      if(sa->spacetype==SPACE_CLIP) {
 +              if(WM_jobs_test(wm, sa))
 +                 owner = sa;
 +              handle_event= B_STOPCLIP;
 +      }
        else {
                Scene *scene;
                /* another scene can be rendering too, for example via compositor */
index 1ce962a8713984c4039d15de38e31815684b9b95,d8e424887871937c75504245c7f26ed21ed37a3c..4fa15ac85c4c4847e57d4a1b13fb4632e834384a
@@@ -96,7 -96,7 +96,7 @@@ typedef struct TransSnap 
        short   modeSelect;
        short   align;
        char    project;
-       char    project_self;
+       char    snap_self;
        short   peel;
        short   status;
        float   snapPoint[3]; /* snapping from this point */
@@@ -396,9 -396,6 +396,9 @@@ typedef struct TransInfo 
  
  #define T_RELEASE_CONFIRM     (1 << 23)
  
 +      /* relative position changes. used to add offset to tracking markers */
 +#define T_RELATIVE_POSITION   (1 << 24)
 +
  /* TransInfo->modifiers */
  #define       MOD_CONSTRAINT_SELECT   0x01
  #define       MOD_PRECISION                   0x02
@@@ -563,7 -560,6 +563,7 @@@ void flushTransParticles(TransInfo *t)
  int clipUVTransform(TransInfo *t, float *vec, int resize);
  void flushTransNodes(TransInfo *t);
  void flushTransSeq(TransInfo *t);
 +void flushTransTracking(TransInfo *t);
  
  /*********************** exported from transform_manipulator.c ********** */
  int gimbal_axis(struct Object *ob, float gmat[][3]); /* return 0 when no gimbal for selection */
index 21e001f9df1b5565f418ee0842c624d96be1c1cb,2211f93a8aebbc304759160e1df154ab7f55e77f..fdbbd441edaed532d0f3c41c09714a6695c292b5
@@@ -56,7 -56,6 +56,7 @@@ struct AnimData
  struct Editing;
  struct SceneStats;
  struct bGPdata;
 +struct MovieClip;
  
  typedef struct Base {
        struct Base *next, *prev;
@@@ -830,9 -829,6 +830,9 @@@ typedef struct Scene 
  
        /* Physics simulation settings */
        struct PhysicsSettings physics_settings;
 +
 +      /* Movie Tracking */
 +      struct MovieClip *clip;                 /* active movie clip */
  } Scene;
  
  
  #define SCE_SNAP_ROTATE                       2
  #define SCE_SNAP_PEEL_OBJECT  4
  #define SCE_SNAP_PROJECT              8
- #define SCE_SNAP_PROJECT_NO_SELF      16
+ #define SCE_SNAP_NO_SELF              16
  /* toolsettings->snap_target */
  #define SCE_SNAP_TARGET_CLOSEST       0
  #define SCE_SNAP_TARGET_CENTER        1
@@@ -1306,6 -1302,7 +1306,6 @@@ typedef enum SculptFlags 
  #define       USER_UNIT_OPT_SPLIT             1
  #define USER_UNIT_ROT_RADIANS 2
  
 -
  #ifdef __cplusplus
  }
  #endif
index 3625f321a024dd1b9a3dfd892bffdb4d5f321312,f4028e45e965e18bd2a95f4d0e7b4bbf01d78468..6c0228757488295a7093d8cf2cdec045b3abdfce
@@@ -1018,15 -1018,6 +1018,15 @@@ static KeyingSet *rna_Scene_keying_set_
        }
  }
  
 +static void rna_SceneCamera_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 +{
 +      Scene *scene= (Scene*)ptr->id.data;
 +      Object *camera= scene->camera;
 +
 +      if(camera)
 +              DAG_id_tag_update(&camera->id, 0);
 +}
 +
  #else
  
  static void rna_def_transform_orientation(BlenderRNA *brna)
@@@ -1187,9 -1178,9 +1187,9 @@@ static void rna_def_tool_settings(Blend
        RNA_def_property_ui_icon(prop, ICON_RETOPO, 0);
        RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */
  
-       prop= RNA_def_property(srna, "use_snap_project_self", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_negative_sdna(prop, NULL, "snap_flag", SCE_SNAP_PROJECT_NO_SELF);
-       RNA_def_property_ui_text(prop, "Project to Self", "Project into its self (editmode)");
+       prop= RNA_def_property(srna, "use_snap_self", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "snap_flag", SCE_SNAP_NO_SELF);
+       RNA_def_property_ui_text(prop, "Project to Self", "Snap onto its self (editmode)");
        RNA_def_property_ui_icon(prop, ICON_ORTHO, 0);
        RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */
        
@@@ -2211,13 -2202,13 +2211,13 @@@ static void rna_def_scene_render_data(B
        RNA_def_property_int_sdna(prop, NULL, "xsch");
        RNA_def_property_range(prop, 4, 10000);
        RNA_def_property_ui_text(prop, "Resolution X", "Number of horizontal pixels in the rendered image");
 -      RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 +      RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneCamera_update");
        
        prop= RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "ysch");
        RNA_def_property_range(prop, 4, 10000);
        RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the rendered image");
 -      RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 +      RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneCamera_update");
        
        prop= RNA_def_property(srna, "resolution_percentage", PROP_INT, PROP_PERCENTAGE);
        RNA_def_property_int_sdna(prop, NULL, "size");
        RNA_def_property_float_sdna(prop, NULL, "xasp");
        RNA_def_property_range(prop, 1.0f, 200.0f);
        RNA_def_property_ui_text(prop, "Pixel Aspect X", "Horizontal aspect ratio - for anamorphic or non-square pixel output");
 -      RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 +      RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneCamera_update");
        
        prop= RNA_def_property(srna, "pixel_aspect_y", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "yasp");
        RNA_def_property_range(prop, 1.0f, 200.0f);
        RNA_def_property_ui_text(prop, "Pixel Aspect Y", "Vertical aspect ratio - for anamorphic or non-square pixel output");
 -      RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 +      RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneCamera_update");
        
        /* JPEG and AVI JPEG */
        
@@@ -3477,14 -3468,6 +3477,14 @@@ void RNA_def_scene(BlenderRNA *brna
        RNA_def_property_struct_type(prop, "TransformOrientation");
        RNA_def_property_ui_text(prop, "Transform Orientations", "");
  
 +      /* acctive MovieClip */
 +      prop= RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
 +      RNA_def_property_pointer_sdna(prop, NULL, "clip");
 +      RNA_def_property_flag(prop, PROP_EDITABLE);
 +      RNA_def_property_struct_type(prop, "MovieClip");
 +      RNA_def_property_ui_text(prop, "Active Movie Clip", "Active movie clip used for constraints and viewport drawing");
 +      RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 +
        /* Nestled Data  */
        rna_def_tool_settings(brna);
        rna_def_unit_settings(brna);