Camera tracking integration

===========================

- Added mode toggle operator.
- Hide Marker panel and show Display panel by default.
- Enable manual calibration by default.
This commit is contained in:
Sergey Sharybin 2011-08-16 15:56:21 +00:00
parent 4b97b4a93a
commit 592f1ab1ad
4 changed files with 57 additions and 2 deletions

@ -460,7 +460,6 @@ class CLIP_PT_display(Panel):
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 @@ class CLIP_PT_marker(Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'UI'
bl_label = "Marker"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):

@ -56,6 +56,7 @@ void CLIP_OT_view_all(struct wmOperatorType *ot);
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);

@ -933,6 +933,50 @@ void CLIP_OT_rebuild_proxy(wmOperatorType *ot)
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)

@ -105,7 +105,7 @@ static SpaceLink *clip_new(const bContext *UNUSED(C))
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 @@ static void clip_operatortypes(void)
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 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
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);