[Bf-blender-cvs] [9628be3] soc-2016-multiview: fix bug in secondary clip open button

Tianwei Shen noreply at git.blender.org
Thu Jul 21 13:17:41 CEST 2016


Commit: 9628be36799f623230da4b9e80863524427bdd1c
Author: Tianwei Shen
Date:   Thu Jul 21 19:15:27 2016 +0800
Branches: soc-2016-multiview
https://developer.blender.org/rB9628be36799f623230da4b9e80863524427bdd1c

fix bug in secondary clip open button

after consulting Sergey, I have exposed secondary_clip via RNA and then
fix the corresponding python ui bugs. The operator show now be able to load a
clip to secondary_clip pointer

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

M	release/scripts/startup/bl_ui/space_clip.py
M	source/blender/editors/space_clip/clip_buttons.c
M	source/blender/editors/space_clip/clip_draw.c
M	source/blender/editors/space_clip/clip_intern.h
M	source/blender/editors/space_clip/space_clip.c
M	source/blender/makesrna/intern/rna_space.c

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

diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py
index f4d53a2..577e47d 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -159,7 +159,7 @@ class CLIP_HT_header(Header):
         row.template_ID(sc, "clip", open="clip.open")
 
         row = layout.row()      # clip open for witness camera
-        row.template_ID(sc, "clip", open="clip.open_secondary")
+        row.template_ID(sc, "secondary_clip", open="clip.open_secondary")
 
         if clip:
             tracking = clip.tracking
diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c
index 91f28f8..71bd2c3 100644
--- a/source/blender/editors/space_clip/clip_buttons.c
+++ b/source/blender/editors/space_clip/clip_buttons.c
@@ -107,7 +107,6 @@ void uiTemplateMovieClip(uiLayout *layout, bContext *C, PointerRNA *ptr, const c
 
 	if (!compact) {
 		uiTemplateID(layout, C, ptr, propname, NULL, "CLIP_OT_open", NULL);
-		uiTemplateID(layout, C, ptr, propname, NULL, "CLIP_OT_open_secondary", NULL);
 	}
 
 	if (clip) {
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index 38d795e..455afb7 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -1748,6 +1748,11 @@ void clip_draw_main(const bContext *C, SpaceClip *sc, ARegion *ar)
 	}
 }
 
+void clip_draw_secondary_clip(const bContext *C, SpaceClip *sc, ARegion *ar)
+{
+
+}
+
 void clip_draw_cache_and_notes(const bContext *C, SpaceClip *sc, ARegion *ar)
 {
 	Scene *scene = CTX_data_scene(C);
diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h
index 69f39e1..91f394e 100644
--- a/source/blender/editors/space_clip/clip_intern.h
+++ b/source/blender/editors/space_clip/clip_intern.h
@@ -71,6 +71,7 @@ void CLIP_OT_dopesheet_view_all(struct wmOperatorType *ot);
 
 /* clip_draw.c */
 void clip_draw_main(const struct bContext *C, struct SpaceClip *sc, struct ARegion *ar);
+void clip_draw_secondary_clip(const struct bContext *C, struct SpaceClip *sc, struct ARegion *ar);
 void clip_draw_grease_pencil(struct bContext *C, int onlyv2d);
 void clip_draw_cache_and_notes(const bContext *C, SpaceClip *sc, ARegion *ar);
 
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index 18c6ef8..bf36cbb 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -1200,6 +1200,10 @@ static void clip_main_region_draw(const bContext *C, ARegion *ar)
 	movieclip_main_area_set_view2d(C, ar);
 
 	clip_draw_main(C, sc, ar);
+	if (sc->mode == SC_MODE_CORRESPONDENCE) {
+		//TODO(tianwei): draw correspondence related code
+		clip_draw_secondary_clip(C, sc, ar);
+	}
 
 	/* TODO(sergey): would be nice to find a way to de-duplicate all this space conversions */
 	UI_view2d_view_to_region_fl(&ar->v2d, 0.0f, 0.0f, &x, &y);
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 441d071..859def6 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -1543,6 +1543,14 @@ static void rna_SpaceClipEditor_clip_set(PointerRNA *ptr, PointerRNA value)
 	ED_space_clip_set_clip(NULL, screen, sc, (MovieClip *)value.data);
 }
 
+static void rna_SpaceClipEditor_secondary_clip_set(PointerRNA *ptr, PointerRNA value)
+{
+	SpaceClip *sc = (SpaceClip *)(ptr->data);
+	bScreen *screen = (bScreen *)ptr->id.data;
+
+	ED_space_clip_set_secondary_clip(NULL, screen, sc, (MovieClip *)value.data);
+}
+
 static void rna_SpaceClipEditor_mask_set(PointerRNA *ptr, PointerRNA value)
 {
 	SpaceClip *sc = (SpaceClip *)(ptr->data);
@@ -4512,6 +4520,13 @@ static void rna_def_space_clip(BlenderRNA *brna)
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceClipEditor_clip_set", NULL, NULL);
 	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
 
+	/* secondary movieclip */
+	prop = RNA_def_property(srna, "secondary_clip", PROP_POINTER, PROP_NONE);
+	RNA_def_property_flag(prop, PROP_EDITABLE);
+	RNA_def_property_ui_text(prop, "Secondary Movie Clip", "Secondary Movie clip displayed and edited in this space");
+	RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceClipEditor_secondary_clip_set", NULL, NULL);
+	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
 	/* clip user */
 	prop = RNA_def_property(srna, "clip_user", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);




More information about the Bf-blender-cvs mailing list