Revision: 38288
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38288
Author:   nazgul
Date:     2011-07-10 18:12:29 +0000 (Sun, 10 Jul 2011)
Log Message:
-----------
Camera tracking integration
===========================

- Fixed sub-pixel precision error when sliding markers.
- Made sliding areas smaller.
- Remove "Debug" menu,
- pep8 cleanup.

Modified Paths:
--------------
    branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py
    branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c
    branches/soc-2011-tomato/source/blender/editors/space_clip/space_clip.c
    branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c
    branches/soc-2011-tomato/source/blender/makesdna/DNA_space_types.h
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_space.c

Modified: branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py        
2011-07-10 17:30:31 UTC (rev 38287)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py        
2011-07-10 18:12:29 UTC (rev 38288)
@@ -108,7 +108,8 @@
 
             op = row.operator("clip.track_markers", text="", icon='FRAME_PREV')
             op.backwards = True
-            op = row.operator("clip.track_markers", text="", 
icon='PLAY_REVERSE')
+            op = row.operator("clip.track_markers", text="", \
+                 icon='PLAY_REVERSE')
             op.backwards = True
             op.sequence = True
             op = row.operator("clip.track_markers", text="", icon='PLAY')
@@ -116,10 +117,16 @@
             row.operator("clip.track_markers", text="", icon='FRAME_NEXT')
 
             col = layout.column(align=True)
-            col.operator("clip.clear_track_path", text="Clear Remained 
Path").action = 'REMAINED'
-            col.operator("clip.clear_track_path", text="Clear Path Up 
To").action = 'UPTO'
-            col.operator("clip.clear_track_path", text="Clear Track 
Path").action = 'ALL'
+            op = col.operator("clip.clear_track_path", \
+                 text="Clear Remained Path")
+            op.action = 'REMAINED'
 
+            op = col.operator("clip.clear_track_path", text="Clear Path Up To")
+            op.action = 'UPTO'
+
+            op = col.operator("clip.clear_track_path", text="Clear Track Path")
+            op.action = 'ALL'
+
             col = layout.column(align=True)
             col.label(text="Reconstruction:")
             col.operator("clip.solve_camera")
@@ -152,7 +159,8 @@
 
         layout.prop(act_track, "name")
 
-        layout.template_track(clip.tracking, "active_track", sc.clip_user, 
clip)
+        layout.template_track(clip.tracking, "active_track", \
+            sc.clip_user, clip)
 
         if act_track:
             row = layout.row()
@@ -240,7 +248,9 @@
         row.active = sc.show_marker_path
         row.prop(sc, "path_length")
 
+        layout.prop(sc, "show_tiny_markers")
 
+
 class CLIP_PT_test(bpy.types.Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'TOOLS'
@@ -255,20 +265,6 @@
         layout.operator("clip.track_to_fcurves")
 
 
-class CLIP_PT_debug(bpy.types.Panel):
-    bl_space_type = 'CLIP_EDITOR'
-    bl_region_type = 'UI'
-    bl_label = "Debug"
-    bl_options = {'DEFAULT_CLOSED'}
-
-    def draw(self, context):
-        layout = self.layout
-        sc = context.space_data
-
-        layout.prop(sc, "show_cache")
-        layout.prop(sc, "show_tiny_markers")
-
-
 class CLIP_PT_footage(bpy.types.Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'UI'
@@ -351,16 +347,27 @@
         layout.operator("clip.solve_camera")
 
         layout.separator()
-        layout.operator("clip.clear_track_path", text="Clear Remained 
Path").action = 'REMAINED'
-        layout.operator("clip.clear_track_path", text="Clear Path Up 
To").action = 'UPTO'
-        layout.operator("clip.clear_track_path", text="Clear Track 
Path").action = 'ALL'
+        op = layout.operator("clip.clear_track_path", \
+             text="Clear Remained Path")
+        op.action = 'REMAINED'
 
+        op = layout.operator("clip.clear_track_path", \
+             text="Clear Path Up To")
+        op.action = 'UPTO'
+
+        op = layout.operator("clip.clear_track_path", \
+             text="Clear Track Path")
+        op.action = 'ALL'
+
         layout.separator()
-        op = layout.operator("clip.track_markers", text="Track Frame 
Backwards")
+        op = layout.operator("clip.track_markers", \
+            text="Track Frame Backwards")
         op.backwards = True
+
         op = layout.operator("clip.track_markers", text="Track Backwards")
         op.backwards = True
         op.sequence = True
+
         op = layout.operator("clip.track_markers", text="Track Forwards")
         op.sequence = True
         layout.operator("clip.track_markers", text="Track Frame Forwards")
@@ -385,9 +392,11 @@
 
         layout.operator("clip.hide_tracks_clear", text="Show Hidden")
         layout.operator("clip.hide_tracks", text="Hide Selected")
-        layout.operator("clip.hide_tracks", text="Hide Unselected").unselected 
= True
 
+        op = layout.operator("clip.hide_tracks", text="Hide Unselected")
+        op.unselected = True
 
+
 class CLIP_MT_track_transform(bpy.types.Menu):
     bl_label = "Transform"
 
@@ -411,6 +420,7 @@
         layout.operator("clip.select_all", text="Select/Deselect all")
         layout.operator("clip.select_all", text="Inverse").action = 'INVERT'
 
+
 class CLIP_MT_tracking_specials(bpy.types.Menu):
     bl_label = "Specials"
 
@@ -421,9 +431,17 @@
     def draw(self, context):
         layout = self.layout
 
-        layout.operator("clip.disable_markers", text="Enable Markers").action 
= 'ENABLE'
-        layout.operator("clip.disable_markers", text="Disable markers").action 
= 'DISABLE'
+        op = layout.operator("clip.disable_markers", text="Enable Markers")
+        op.action = 'ENABLE'
+
+        op = layout.operator("clip.disable_markers", text="Disable markers")
+        op.action = 'DISABLE'
+
         layout.operator("clip.set_origin")
 
+        layout.separator()
+        layout.operator("clip.hide_tracks")
+        layout.operator("clip.hide_tracks_clear", text="Show Tracks")
+
 if __name__ == "__main__":  # only for live edit.
     bpy.utils.register_module(__name__)

Modified: branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c      
2011-07-10 17:30:31 UTC (rev 38287)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c      
2011-07-10 18:12:29 UTC (rev 38288)
@@ -400,8 +400,8 @@
        x= track->search_min[0];
        y= track->search_max[1];
 
-       dx= 15.0f/width/sc->zoom;
-       dy= 15.0f/height/sc->zoom;
+       dx= 12.0f/width/sc->zoom;
+       dy= 12.0f/height/sc->zoom;
 
        if(sc->flag&SC_SHOW_MARKER_SEARCH) {
                tdx=MIN2(dx, (track->search_max[0]-track->search_min[0])/5);
@@ -435,6 +435,10 @@
        }
 
        if(sc->flag&SC_SHOW_MARKER_PATTERN) {
+               /* use smaller slider for pattern area */
+               dx= 10.0f/width/sc->zoom;
+               dy= 10.0f/height/sc->zoom;
+
                if(!outline) {
                        if(track->pat_flag&SELECT) UI_ThemeColor(color);
                        else UI_ThemeColor(TH_MARKER);
@@ -583,8 +587,7 @@
                draw_tracking(sc, ar, clip, zoomx, zoomy);
        }
 
-       if(sc->debug_flag&SC_DBG_SHOW_CACHE)
-               draw_movieclip_cache(sc, ar, clip, scene);
+       draw_movieclip_cache(sc, ar, clip, scene);
 }
 
 static ImBuf *scale_ibuf(ImBuf *ibuf, float zoomx, float zoomy)

Modified: 
branches/soc-2011-tomato/source/blender/editors/space_clip/space_clip.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_clip/space_clip.c     
2011-07-10 17:30:31 UTC (rev 38287)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/space_clip.c     
2011-07-10 18:12:29 UTC (rev 38288)
@@ -78,7 +78,6 @@
        sc= MEM_callocN(sizeof(SpaceClip), "initclip");
        sc->spacetype= SPACE_CLIP;
        sc->flag= 
SC_SHOW_MARKER_PATTERN|SC_SHOW_MARKER_SEARCH|SC_SHOW_MARKER_PATH;
-       sc->debug_flag= SC_DBG_SHOW_CACHE;
        sc->zoom= 1.0f;
        sc->path_length= 20;
 

Modified: 
branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c   
2011-07-10 17:30:31 UTC (rev 38287)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c   
2011-07-10 18:12:29 UTC (rev 38288)
@@ -1288,28 +1288,31 @@
 
 /* corner = 0: right-bottom corner,
    corner = 1: left-top corner */
-static int mouse_on_corner(SpaceClip *sc, MovieTrackingTrack *track, float 
co[2], int corner,
+static int mouse_on_corner(SpaceClip *sc, MovieTrackingTrack *track, float 
size, float co[2], int corner,
                        float *pos, float *min, float *max, int width, int 
height)
 {
-       int crn[2], inside= 0;
-       float dx, dy;
+       int inside= 0;
+       float nco[2], crn[2], dx, dy;
 
-       dx= 15.0f/sc->zoom;
-       dy= 15.0f/sc->zoom;
+       nco[0]= co[0]/width;
+       nco[1]= co[1]/height;
 
-       dx=MIN2(dx, (track->search_max[0]-track->search_min[0])*width/5);
-       dy=MIN2(dy, (track->search_max[1]-track->search_min[1])*height/5);
+       dx= size/width/sc->zoom;
+       dy= size/height/sc->zoom;
 
+       dx=MIN2(dx, (track->search_max[0]-track->search_min[0])/5);
+       dy=MIN2(dy, (track->search_max[1]-track->search_min[1])/5);
+
        if(corner==0) {
-               crn[0]= (pos[0]+max[0])*width;
-               crn[1]= (pos[1]+min[1])*height;
+               crn[0]= pos[0]+max[0];
+               crn[1]= pos[1]+min[1];
 
-               inside= co[0]>=crn[0]-dx && co[0]<=crn[0] && co[1]>=crn[1] && 
co[1]<=crn[1]+dy;
+               inside= nco[0]>=crn[0]-dx && nco[0]<=crn[0] && nco[1]>=crn[1] 
&& nco[1]<=crn[1]+dy;
        } else {
-               crn[0]= (pos[0]+min[0])*width;
-               crn[1]= (pos[1]+max[1])*height;
+               crn[0]= pos[0]+min[0];
+               crn[1]= pos[1]+max[1];
 
-               inside= co[0]>=crn[0] && co[0]<=crn[0]+dx && co[1]>=crn[1]-dy 
&& co[1]<=crn[1];
+               inside= nco[0]>=crn[0] && nco[0]<=crn[0]+dx && 
nco[1]>=crn[1]-dy && nco[1]<=crn[1];
        }
 
        return inside;
@@ -1337,15 +1340,15 @@
 
                        if(marker && (marker->flag&MARKER_DISABLED)==0) {
                                if(sc->flag&SC_SHOW_MARKER_SEARCH) {
-                                       if(mouse_on_corner(sc, track, co, 1, 
marker->pos, track->search_min, track->search_max, width, height))
+                                       if(mouse_on_corner(sc, track, 15.0f, 
co, 1, marker->pos, track->search_min, track->search_max, width, height))
                                                op->customdata= 
create_slide_marker_data(track, marker, event, TRACK_AREA_POINT, width, height);
 
-                                       if(mouse_on_corner(sc, track, co, 0, 
marker->pos, track->search_min, track->search_max, width, height))
+                                       if(mouse_on_corner(sc, track, 15.0f, 
co, 0, marker->pos, track->search_min, track->search_max, width, height))
                                                op->customdata= 
create_slide_marker_data(track, marker, event, TRACK_AREA_SEARCH, width, 
height);
                                }
 
                                if(sc->flag&SC_SHOW_MARKER_PATTERN)
-                                       if(mouse_on_corner(sc, track, co, 0, 
marker->pos, track->pat_min, track->pat_max, width, height))
+                                       if(mouse_on_corner(sc, track, 10.0f, 
co, 0, marker->pos, track->pat_min, track->pat_max, width, height))

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to