[Bf-blender-cvs] [5d27929] soc-2016-multiview: add link and unlink button in scripts for python
Tianwei Shen
noreply at git.blender.org
Mon May 23 19:06:32 CEST 2016
Commit: 5d27929c1c2be88db6f68b7471fa54dd26ab24f1
Author: Tianwei Shen
Date: Tue May 24 00:57:46 2016 +0800
Branches: soc-2016-multiview
https://developer.blender.org/rB5d27929c1c2be88db6f68b7471fa54dd26ab24f1
add link and unlink button in scripts for python
===================================================================
M release/scripts/startup/bl_ui/space_clip.py
M source/blender/editors/space_clip/CMakeLists.txt
M source/blender/editors/space_clip/clip_intern.h
M source/blender/editors/space_clip/clip_ops.c
M source/blender/editors/space_clip/space_clip.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py
index e809ef9..03c677c 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -398,6 +398,22 @@ class CLIP_PT_tools_tracking(CLIP_PT_tracking_panel, Panel):
row.operator("clip.join_tracks", text="Join Tracks")
+class CLIP_PT_tools_correspondence(CLIP_PT_tracking_panel, Panel):
+ bl_space_type = 'CLIP_EDITOR'
+ bl_region_type = 'TOOLS'
+ bl_label = "Correspondence"
+ bl_category = "Track"
+
+ def draw(self, context):
+ layout = self.layout
+
+ col = layout.column(align=True)
+ row = col.row(align=True)
+ row.operator("clip.add_correspondence", text="Link")
+ row.operator("clip.delete_correspondence", text="Unlink")
+ #col.operator("clip.detect_features")
+
+
class CLIP_PT_tools_plane_tracking(CLIP_PT_tracking_panel, Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'TOOLS'
diff --git a/source/blender/editors/space_clip/CMakeLists.txt b/source/blender/editors/space_clip/CMakeLists.txt
index 32d48c9..d4e16f2 100644
--- a/source/blender/editors/space_clip/CMakeLists.txt
+++ b/source/blender/editors/space_clip/CMakeLists.txt
@@ -53,6 +53,7 @@ set(SRC
clip_utils.c
space_clip.c
tracking_ops.c
+ tracking_ops_correspondence.c
tracking_ops_detect.c
tracking_ops_orient.c
tracking_ops_plane.c
diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h
index 2a5d959..8c14c4e 100644
--- a/source/blender/editors/space_clip/clip_intern.h
+++ b/source/blender/editors/space_clip/clip_intern.h
@@ -201,6 +201,9 @@ void CLIP_OT_slide_plane_marker(struct wmOperatorType *ot);
void CLIP_OT_keyframe_insert(struct wmOperatorType *ot);
void CLIP_OT_keyframe_delete(struct wmOperatorType *ot);
+void CLIP_OT_add_correspondence(wmOperatorType *ot);
+void CLIP_OT_delete_correspondence(wmOperatorType *ot);
+
/* tracking_select.c */
void CLIP_OT_select(struct wmOperatorType *ot);
void CLIP_OT_select_all(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 085fdd5..6cf1f65 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -906,16 +906,21 @@ static int change_frame_poll(bContext *C)
static void change_frame_apply(bContext *C, wmOperator *op)
{
- Scene *scene = CTX_data_scene(C);
+ //Scene *scene = CTX_data_scene(C);
/* set the new frame number */
- CFRA = RNA_int_get(op->ptr, "frame");
- FRAMENUMBER_MIN_CLAMP(CFRA);
- SUBFRA = 0.0f;
+ //CFRA = RNA_int_get(op->ptr, "frame");
+ //FRAMENUMBER_MIN_CLAMP(CFRA);
+ //SUBFRA = 0.0f;
/* do updates */
- BKE_sound_seek_scene(CTX_data_main(C), scene);
- WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
+ //BKE_sound_seek_scene(CTX_data_main(C), scene);
+ //WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
+
+ // Todo(Tianwei): decouple frame for now, find a better way
+ SpaceClip *sc = CTX_wm_space_clip(C);
+ BKE_movieclip_user_set_frame(&sc->user, RNA_int_get(op->ptr, "frame"));
+ WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, NULL);
}
static int change_frame_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index e1d4e4f..c49491d 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -528,6 +528,10 @@ static void clip_operatortypes(void)
WM_operatortype_append(CLIP_OT_keyframe_insert);
WM_operatortype_append(CLIP_OT_keyframe_delete);
+ /* Correspondence */
+ WM_operatortype_append(CLIP_OT_add_correspondence);
+ WM_operatortype_append(CLIP_OT_delete_correspondence);
+
/* ** clip_graph_ops.c ** */
/* graph editing */
@@ -885,7 +889,7 @@ static void clip_refresh(const bContext *C, ScrArea *sa)
{
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *window = CTX_wm_window(C);
- Scene *scene = CTX_data_scene(C);
+ //Scene *scene = CTX_data_scene(C);
SpaceClip *sc = (SpaceClip *)sa->spacedata.first;
ARegion *ar_main = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
ARegion *ar_tools = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS);
@@ -1079,7 +1083,7 @@ static void clip_refresh(const bContext *C, ScrArea *sa)
ED_area_tag_redraw(sa);
}
- BKE_movieclip_user_set_frame(&sc->user, scene->r.cfra);
+ //BKE_movieclip_user_set_frame(&sc->user, scene->r.cfra);
}
/********************* main region ********************/
More information about the Bf-blender-cvs
mailing list