[Bf-blender-cvs] [cdc2992] soc-2016-multiview: add a flag field to RegionSpaceClip

Tianwei Shen noreply at git.blender.org
Thu Aug 4 11:19:44 CEST 2016


Commit: cdc29928b211acde9699b04c3a30943c9fe4025d
Author: Tianwei Shen
Date:   Thu Aug 4 16:41:29 2016 +0800
Branches: soc-2016-multiview
https://developer.blender.org/rBcdc29928b211acde9699b04c3a30943c9fe4025d

add a flag field to RegionSpaceClip

- this field is to specify main clip or secondary clip, used in drawing
  code

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

M	source/blender/editors/space_clip/clip_editor.c
M	source/blender/editors/space_clip/space_clip.c
M	source/blender/makesdna/DNA_space_types.h

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

diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 580b6f6..f5b65d4 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -758,8 +758,14 @@ void ED_clip_update_correspondence_mode(bContext *C, SpaceClip *sc)
 		ScrArea *sa = CTX_wm_area(C);
 
 		ar->alignment = RGN_ALIGN_VSPLIT;
+		RegionSpaceClip *rsc = ar->regiondata;
+		rsc->flag = RSC_MAIN_CLIP;
 
+		/* set the region type to RSC_SECONDARY_CLIP so that
+		 * clip_main_region_draw is aware of this */
 		ARegion *newar = BKE_area_region_copy(sa->type, ar);
+		RegionSpaceClip *new_rsc = newar->regiondata;
+		new_rsc->flag = RSC_SECONDARY_CLIP;
 		BLI_addtail(&sa->regionbase, newar);
 
 		/* update split view */
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index fa2a36d..27925fa 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -306,6 +306,7 @@ static SpaceLink *clip_new(const bContext *C)
 	/* region data for main region */
 	RegionSpaceClip *rsc = MEM_callocN(sizeof(RegionSpaceClip), "region data for clip");
 	rsc->zoom = 1.0f;
+	rsc->flag = RSC_MAIN_CLIP;
 	ar->regiondata = rsc;
 
 	return (SpaceLink *) sc;
@@ -1254,7 +1255,11 @@ static void clip_main_region_draw(const bContext *C, ARegion *ar)
 	/* data... */
 	movieclip_main_area_set_view2d(C, ar);
 
-	clip_draw_main(C, sc, ar);
+	if (rsc->flag == RSC_MAIN_CLIP)
+		clip_draw_main(C, sc, ar);
+	else {		// rsc->flag = RSC_SECONDARY_CLIP
+		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/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 51bcd44..f123e67 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -1285,11 +1285,17 @@ typedef struct SpaceClip {
 	MaskSpaceInfo mask_info;
 } SpaceClip;
 
+typedef enum eRegionSpaceClip_Flag {
+	RSC_MAIN_CLIP      = (1 << 0),
+	RSC_SECONDARY_CLIP = (1 << 1),
+} eRegionSpaceClip_Flag;
+
 /* region-related settings for Clip Editor */
 typedef struct RegionSpaceClip {
 	float xof, yof;             /* user defined offset, image is centered */
 	float xlockof, ylockof;     /* user defined offset from locked position */
 	float zoom;                 /* user defined zoom level */
+	int flag;					/* region type (main clip/secondary_clip), used in correspondence mode */
 } RegionSpaceClip;
 
 /* SpaceClip->flag */




More information about the Bf-blender-cvs mailing list