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

Sergey Sharybin g.ulairi at gmail.com
Tue Aug 16 17:56:21 CEST 2011


Revision: 39455
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39455
Author:   nazgul
Date:     2011-08-16 15:56:21 +0000 (Tue, 16 Aug 2011)
Log Message:
-----------
Camera tracking integration
===========================

- Added mode toggle operator.
- Hide Marker panel and show Display panel by default.
- Enable manual calibration by default.

Modified Paths:
--------------
    branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py
    branches/soc-2011-tomato/source/blender/editors/space_clip/clip_intern.h
    branches/soc-2011-tomato/source/blender/editors/space_clip/clip_ops.c
    branches/soc-2011-tomato/source/blender/editors/space_clip/space_clip.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-08-16 15:46:48 UTC (rev 39454)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py	2011-08-16 15:56:21 UTC (rev 39455)
@@ -460,7 +460,6 @@
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'UI'
     bl_label = "Display"
-    bl_options = {'DEFAULT_CLOSED'}
 
     def draw(self, context):
         layout = self.layout
@@ -573,6 +572,7 @@
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'UI'
     bl_label = "Marker"
+    bl_options = {'DEFAULT_CLOSED'}
 
     @classmethod
     def poll(cls, context):

Modified: branches/soc-2011-tomato/source/blender/editors/space_clip/clip_intern.h
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_clip/clip_intern.h	2011-08-16 15:46:48 UTC (rev 39454)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/clip_intern.h	2011-08-16 15:56:21 UTC (rev 39455)
@@ -56,6 +56,7 @@
 void CLIP_OT_view_selected(struct wmOperatorType *ot);
 void CLIP_OT_change_frame(wmOperatorType *ot);
 void CLIP_OT_rebuild_proxy(struct wmOperatorType *ot);
+void CLIP_OT_mode_set(struct wmOperatorType *ot);
 
 /* tracking_ops.c */
 void CLIP_OT_select(struct wmOperatorType *ot);

Modified: branches/soc-2011-tomato/source/blender/editors/space_clip/clip_ops.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_clip/clip_ops.c	2011-08-16 15:46:48 UTC (rev 39454)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/clip_ops.c	2011-08-16 15:56:21 UTC (rev 39455)
@@ -933,6 +933,50 @@
 	ot->flag= OPTYPE_REGISTER;
 }
 
+/********************** mode set operator *********************/
+
+static int mode_set_exec(bContext *C, wmOperator *op)
+{
+	SpaceClip *sc= CTX_wm_space_clip(C);
+	int mode= RNA_enum_get(op->ptr, "mode");
+	int toggle= RNA_boolean_get(op->ptr, "toggle");
+
+	if(sc->mode==mode) {
+		if(toggle)
+			sc->mode= SC_MODE_TRACKING;
+	} else {
+		sc->mode= mode;
+	}
+
+	WM_event_add_notifier(C, NC_SPACE|ND_SPACE_CLIP, NULL);
+
+	return OPERATOR_FINISHED;
+}
+
+void CLIP_OT_mode_set(wmOperatorType *ot)
+{
+	static EnumPropertyItem mode_items[] = {
+		{SC_MODE_TRACKING, "TRACKING", 0, "Tracking", "Show tracking and solving tools"},
+		{SC_MODE_RECONSTRUCTION, "RECONSTRUCTION", 0, "Reconstruction", "Show tracking/reconstruction tools"},
+		{SC_MODE_DISTORTION, "DISTORTION", 0, "Distortion", "Show distortion tools"},
+		{0, NULL, 0, NULL, NULL}};
+
+
+	/* identifiers */
+	ot->name= "Set Clip Mode";
+	ot->description = "Sets the clip interaction mode";
+	ot->idname= "CLIP_OT_mode_set";
+
+	/* api callbacks */
+	ot->exec= mode_set_exec;
+
+	ot->poll= ED_space_clip_poll;
+
+	/* properties */
+	RNA_def_enum(ot->srna, "mode", mode_items, SC_MODE_TRACKING, "Mode", "");
+	RNA_def_boolean(ot->srna, "toggle", 0, "Toggle", "");
+}
+
 /********************** macroses *********************/
 
 void ED_operatormacros_clip(void)

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-08-16 15:46:48 UTC (rev 39454)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/space_clip.c	2011-08-16 15:56:21 UTC (rev 39455)
@@ -105,7 +105,7 @@
 
 	sc= MEM_callocN(sizeof(SpaceClip), "initclip");
 	sc->spacetype= SPACE_CLIP;
-	sc->flag= SC_SHOW_MARKER_PATTERN|SC_SHOW_TRACK_PATH|SC_SHOW_GPENCIL;
+	sc->flag= SC_SHOW_MARKER_PATTERN|SC_SHOW_TRACK_PATH|SC_SHOW_GPENCIL|SC_MANUAL_CALIBRATION;
 	sc->zoom= 1.0f;
 	sc->path_length= 20;
 	sc->scopes.track_preview_height= 120;
@@ -250,6 +250,7 @@
 	WM_operatortype_append(CLIP_OT_view_selected);
 	WM_operatortype_append(CLIP_OT_change_frame);
 	WM_operatortype_append(CLIP_OT_rebuild_proxy);
+	WM_operatortype_append(CLIP_OT_mode_set);
 
 	/* ** clip_toolbar.c ** */
 	WM_operatortype_append(CLIP_OT_tools);
@@ -338,6 +339,15 @@
 
 	keymap= WM_keymap_find(keyconf, "Clip Editor", SPACE_CLIP, 0);
 
+	/* mode */
+	kmi= WM_keymap_add_item(keymap, "CLIP_OT_mode_set", TABKEY, KM_PRESS, 0, 0);
+	RNA_enum_set(kmi->ptr, "mode", SC_MODE_RECONSTRUCTION);
+	RNA_boolean_set(kmi->ptr, "toggle", 1);
+
+	kmi= WM_keymap_add_item(keymap, "CLIP_OT_mode_set", TABKEY, KM_PRESS, KM_CTRL, 0);
+	RNA_enum_set(kmi->ptr, "mode", SC_MODE_DISTORTION);
+	RNA_boolean_set(kmi->ptr, "toggle", 1);
+
 	/* ** View/navigation ** */
 
 	WM_keymap_add_item(keymap, "CLIP_OT_view_pan", MIDDLEMOUSE, KM_PRESS, 0, 0);




More information about the Bf-blender-cvs mailing list