[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37893] branches/soc-2011-tomato: Camera tracking integration

Sergey Sharybin g.ulairi at gmail.com
Tue Jun 28 12:09:57 CEST 2011


Revision: 37893
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37893
Author:   nazgul
Date:     2011-06-28 10:09:57 +0000 (Tue, 28 Jun 2011)
Log Message:
-----------
Camera tracking integration
===========================

- Internal changes:
  * Rename uiTemplateMarker to uiTemplateTrack.
  * Fixed some comments in movieclip.c.
- Control channels which are affect on track.
- Fixed track deletion when it's point isn't selected.

Modified Paths:
--------------
    branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py
    branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c
    branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c
    branches/soc-2011-tomato/source/blender/editors/include/UI_interface.h
    branches/soc-2011-tomato/source/blender/editors/space_clip/clip_buttons.c
    branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c
    branches/soc-2011-tomato/source/blender/makesdna/DNA_tracking_types.h
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_tracking.c
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_ui_api.c
    branches/soc-2011-tomato/source/blenderplayer/bad_level_call_stubs/stubs.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-06-28 10:06:06 UTC (rev 37892)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py	2011-06-28 10:09:57 UTC (rev 37893)
@@ -82,10 +82,10 @@
             layout.operator('clip.open')
 
 
-class CLIP_PT_marker_preview(bpy.types.Panel):
+class CLIP_PT_track(bpy.types.Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'UI'
-    bl_label = "Marker Preview"
+    bl_label = "Track"
 
     @classmethod
     def poll(cls, context):
@@ -99,9 +99,17 @@
         sc = context.space_data
         clip = context.space_data.clip
 
-        layout.template_marker(clip.tracking, "act_track", sc.clip_user, clip)
+        layout.template_track(clip.tracking, "act_track", sc.clip_user, clip)
 
+        act_track = clip.tracking.act_track
 
+        if act_track:
+            row = layout.row()
+            row.prop(act_track, "use_red_channel", text="Red")
+            row.prop(act_track, "use_green_channel", text="Green")
+            row.prop(act_track, "use_blue_channel", text="Blue")
+
+
 class CLIP_PT_track_settings(bpy.types.Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'UI'

Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c	2011-06-28 10:06:06 UTC (rev 37892)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c	2011-06-28 10:09:57 UTC (rev 37893)
@@ -357,11 +357,7 @@
 	else clip->source= MCLIP_SRC_SEQUENCE;
 }
 
-/* area - which part of marker should be selected:
-    0 - the whole marker and pattern/search
-	1 - only marker
-	2 - only pattern
-	3 - only search */
+/* area - which part of marker should be selected. see TRACK_AREA_* constants */
 void BKE_movieclip_select_track(MovieClip *clip, MovieTrackingTrack *track, int area, int extend)
 {
 	if(extend) {

Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c	2011-06-28 10:06:06 UTC (rev 37892)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c	2011-06-28 10:09:57 UTC (rev 37893)
@@ -354,6 +354,25 @@
 	MEM_freeN(context);
 }
 
+static void disable_imbuf_channels(ImBuf *ibuf, MovieTrackingTrack *track)
+{
+	int x, y;
+
+	if((track->flag&(TRACK_DISABLE_RED|TRACK_DISABLE_GREEN|TRACK_DISABLE_BLUE))==0)
+		return;
+
+	for(y= 0; y<ibuf->x; y++) {
+		for (x= 0; x<ibuf->y; x++) {
+			int pixel= ibuf->x*y + x;
+			char *rrgb= (char*)ibuf->rect + pixel*4;
+
+			if(track->flag&TRACK_DISABLE_RED)	rrgb[0]= 0;
+			if(track->flag&TRACK_DISABLE_GREEN)	rrgb[1]= 0;
+			if(track->flag&TRACK_DISABLE_BLUE)	rrgb[2]= 0;
+		}
+	}
+}
+
 static ImBuf *acquire_area_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, MovieTrackingMarker *marker, float min[2], float max[2], int pos[2])
 {
 	ImBuf *tmpibuf;
@@ -381,6 +400,8 @@
 	pos[0]= x-x1;
 	pos[1]= y-y1;
 
+	disable_imbuf_channels(tmpibuf, track);
+
 	return tmpibuf;
 }
 
@@ -409,6 +430,7 @@
 	IMB_rectcpy(tmpibuf, ibuf, 0, 0,
 			(track->search_min[0]+marker->pos[0])*ibuf->x,
 			(track->search_min[1]+marker->pos[1])*ibuf->y, width, height);
+	disable_imbuf_channels(tmpibuf, track);
 
 	*width_r= width;
 	*height_r= height;

Modified: branches/soc-2011-tomato/source/blender/editors/include/UI_interface.h
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/include/UI_interface.h	2011-06-28 10:06:06 UTC (rev 37892)
+++ branches/soc-2011-tomato/source/blender/editors/include/UI_interface.h	2011-06-28 10:09:57 UTC (rev 37893)
@@ -726,7 +726,7 @@
 void uiTemplateList(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *activeptr, const char *activeprop, int rows, int maxrows, int type);
 
 void uiTemplateMovieClip(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr, int compact);
-void uiTemplateMarker(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr, struct PointerRNA *clipptr);
+void uiTemplateTrack(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr, struct PointerRNA *clipptr);
 
 /* items */
 void uiItemO(uiLayout *layout, const char *name, int icon, const char *opname);

Modified: branches/soc-2011-tomato/source/blender/editors/space_clip/clip_buttons.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_clip/clip_buttons.c	2011-06-28 10:06:06 UTC (rev 37892)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/clip_buttons.c	2011-06-28 10:09:57 UTC (rev 37893)
@@ -278,8 +278,8 @@
 	PanelType *pt;
 
 	pt= MEM_callocN(sizeof(PanelType), "spacetype clip panel marker");
-	strcpy(pt->idname, "CLIP_PT_active_marker");
-	strcpy(pt->label, "Active Marker");
+	strcpy(pt->idname, "CLIP_PT_marker");
+	strcpy(pt->label, "Marker");
 	pt->draw= clip_panel_marker;
 	pt->poll= clip_panel_marker_poll;
 
@@ -336,7 +336,7 @@
 
 /********************* Marker Template ************************/
 
-void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *userptr, PointerRNA *clipptr)
+void uiTemplateTrack(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *userptr, PointerRNA *clipptr)
 {
 	PropertyRNA *prop;
 	PointerRNA trackptr;
@@ -352,12 +352,12 @@
 
 	prop= RNA_struct_find_property(ptr, propname);
 	if(!prop) {
-		printf("uiTemplateMarker: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname);
+		printf("uiTemplateTrack: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname);
 		return;
 	}
 
 	if(RNA_property_type(prop) != PROP_POINTER) {
-		printf("uiTemplateMarker: expected pointer property for %s.%s\n", RNA_struct_identifier(ptr->type), propname);
+		printf("uiTemplateTrack: expected pointer property for %s.%s\n", RNA_struct_identifier(ptr->type), propname);
 		return;
 	}
 

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-06-28 10:06:06 UTC (rev 37892)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c	2011-06-28 10:09:57 UTC (rev 37893)
@@ -216,7 +216,7 @@
 	while(track) {
 		next= track->next;
 
-		if(track->flag&SELECT) {
+		if(TRACK_SELECTED(track)) {
 			BKE_tracking_free_track(track);
 			BLI_freelinkN(&clip->tracking.tracks, track);
 		}

Modified: branches/soc-2011-tomato/source/blender/makesdna/DNA_tracking_types.h
===================================================================
--- branches/soc-2011-tomato/source/blender/makesdna/DNA_tracking_types.h	2011-06-28 10:06:06 UTC (rev 37892)
+++ branches/soc-2011-tomato/source/blender/makesdna/DNA_tracking_types.h	2011-06-28 10:09:57 UTC (rev 37893)
@@ -107,7 +107,10 @@
 #define MARKER_DISABLED	1
 
 /* MovieTrackingTrack->flag */
-#define TRACK_PROCESSED	2
+#define TRACK_PROCESSED	(1<<1)
+#define TRACK_DISABLE_RED	(1<<2)
+#define TRACK_DISABLE_GREEN	(1<<3)
+#define TRACK_DISABLE_BLUE	(1<<4)
 
 /* MovieTrackingSettings->speed */
 #define TRACKING_SPEED_FASTEST		0

Modified: branches/soc-2011-tomato/source/blender/makesrna/intern/rna_tracking.c
===================================================================
--- branches/soc-2011-tomato/source/blender/makesrna/intern/rna_tracking.c	2011-06-28 10:06:06 UTC (rev 37892)
+++ branches/soc-2011-tomato/source/blender/makesrna/intern/rna_tracking.c	2011-06-28 10:09:57 UTC (rev 37893)
@@ -235,6 +235,23 @@
 	RNA_def_property_struct_type(prop, "MovieTrackingMarker");
 	RNA_def_property_collection_sdna(prop, NULL, "markers", "markersnr");
 	RNA_def_property_ui_text(prop, "Markers", "Collection of markers in track");
+
+	/* ** channels ** */
+
+	/* use_red_channel */
+	prop= RNA_def_property(srna, "use_red_channel", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_RED);
+	RNA_def_property_ui_text(prop, "Use Red Channel", "Use red channel from footage for tracking");
+
+	/* use_green_channel */
+	prop= RNA_def_property(srna, "use_green_channel", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_GREEN);
+	RNA_def_property_ui_text(prop, "Use Green Channel", "Use green channel from footage for tracking");
+
+	/* use_blue_channel */
+	prop= RNA_def_property(srna, "use_blue_channel", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_BLUE);
+	RNA_def_property_ui_text(prop, "Use Blue Channel", "Use blue channel from footage for tracking");
 }
 
 static void rna_def_tracking(BlenderRNA *brna)

Modified: branches/soc-2011-tomato/source/blender/makesrna/intern/rna_ui_api.c
===================================================================
--- branches/soc-2011-tomato/source/blender/makesrna/intern/rna_ui_api.c	2011-06-28 10:06:06 UTC (rev 37892)
+++ branches/soc-2011-tomato/source/blender/makesrna/intern/rna_ui_api.c	2011-06-28 10:09:57 UTC (rev 37893)
@@ -400,8 +400,8 @@
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
 	RNA_def_boolean(func, "compact", 0, "", "Use more compact layout.");
 
-	func= RNA_def_function(srna, "template_marker", "uiTemplateMarker");
-	RNA_def_function_ui_description(func, "Item. A marker widget to analyze imaga marker is pointed to.");
+	func= RNA_def_function(srna, "template_track", "uiTemplateTrack");
+	RNA_def_function_ui_description(func, "Item. A tarck widget to analyze imaga marker is pointed to.");
 	api_ui_item_rna_common(func);
 	parm= RNA_def_pointer(func, "clip", "MovieClip", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);

Modified: branches/soc-2011-tomato/source/blenderplayer/bad_level_call_stubs/stubs.c
===================================================================

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list