Commit: fe312bab5e6eb60e58fb1b1c7506479a6073389a
Author: Tianwei Shen
Date:   Fri Jul 29 22:56:32 2016 +0800
Branches: soc-2016-multiview
https://developer.blender.org/rBfe312bab5e6eb60e58fb1b1c7506479a6073389a

WIP: correspondence update and drawing functions

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

M       source/blender/editors/include/ED_clip.h
M       source/blender/editors/space_clip/clip_editor.c
M       source/blender/makesdna/DNA_space_types.h
M       source/blender/makesrna/intern/rna_space.c

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

diff --git a/source/blender/editors/include/ED_clip.h 
b/source/blender/editors/include/ED_clip.h
index 4929f46..83b6b66 100644
--- a/source/blender/editors/include/ED_clip.h
+++ b/source/blender/editors/include/ED_clip.h
@@ -82,7 +82,7 @@ struct MovieClip *ED_space_clip_get_clip(struct SpaceClip 
*sc);
 struct MovieClip *ED_space_clip_get_secondary_clip(struct SpaceClip *sc);
 void ED_space_clip_set_clip(struct bContext *C, struct bScreen *screen, struct 
SpaceClip *sc, struct MovieClip *clip);
 void ED_space_clip_set_secondary_clip(struct bContext *C, struct bScreen 
*screen, struct SpaceClip *sc, struct MovieClip *secondary_clip);
-void ED_clip_update_correspondence_mode();
+void ED_clip_update_correspondence_mode(struct bContext *C, struct SpaceClip 
*sc);
 
 struct Mask *ED_space_clip_get_mask(struct SpaceClip *sc);
 void ED_space_clip_set_mask(struct bContext *C, struct SpaceClip *sc, struct 
Mask *mask);
diff --git a/source/blender/editors/space_clip/clip_editor.c 
b/source/blender/editors/space_clip/clip_editor.c
index 7ce487e..9577dae 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -49,6 +49,7 @@
 #include "BLI_math.h"
 #include "BLI_rect.h"
 #include "BLI_task.h"
+#include "BLI_listbase.h"
 
 #include "BKE_global.h"
 #include "BKE_main.h"
@@ -57,7 +58,7 @@
 #include "BKE_context.h"
 #include "BKE_tracking.h"
 #include "BKE_library.h"
-
+#include "BKE_screen.h"
 
 #include "IMB_colormanagement.h"
 #include "IMB_imbuf_types.h"
@@ -675,9 +676,99 @@ void ED_space_clip_set_secondary_clip(bContext *C, bScreen 
*screen, SpaceClip *s
                WM_event_add_notifier(C, NC_MOVIECLIP | NA_SELECTED, 
sc->secondary_clip);
 }
 
-void ED_clip_update_correspondence_mode()
+/* ******** split view when changing to correspondence mode ******** */
+void ED_clip_update_correspondence_mode(bContext *C, SpaceClip *sc)
 {
+       ARegion *ar = CTX_wm_region(C);
 
+       /* some rules related to changing between correspondence mode and other 
mode*/
+       if (ar->regiontype != RGN_TYPE_WINDOW) {
+               return;
+       }
+       else if (ar->alignment == RGN_ALIGN_VSPLIT) {
+               ///* Exit split-view */
+               //ScrArea *sa = CTX_wm_area(C);
+               //ARegion *arn;
+
+               ///* keep current region */
+               //ar->alignment = 0;
+
+               //if (sa->spacetype == SPACE_VIEW3D) {
+               //      ARegion *ar_iter;
+               //      RegionView3D *rv3d = ar->regiondata;
+
+               //      /* if this is a locked view, use settings from 'User' 
view */
+               //      if (rv3d->viewlock) {
+               //              View3D *v3d_user;
+               //              ARegion *ar_user;
+
+               //              if (ED_view3d_context_user_region(C, &v3d_user, 
&ar_user)) {
+               //                      if (ar != ar_user) {
+               //                              SWAP(void *, ar->regiondata, 
ar_user->regiondata);
+               //                              rv3d = ar->regiondata;
+               //                      }
+               //              }
+               //      }
+
+               //      rv3d->viewlock_quad = RV3D_VIEWLOCK_INIT;
+               //      rv3d->viewlock = 0;
+               //      rv3d->rflag &= ~RV3D_CLIPPING;
+
+               //      /* accumulate locks, incase they're mixed */
+               //      for (ar_iter = sa->regionbase.first; ar_iter; ar_iter = 
ar_iter->next) {
+               //              if (ar_iter->regiontype == RGN_TYPE_WINDOW) {
+               //                      RegionView3D *rv3d_iter = 
ar_iter->regiondata;
+               //                      rv3d->viewlock_quad |= 
rv3d_iter->viewlock;
+               //              }
+               //      }
+               //}
+
+               //for (ar = sa->regionbase.first; ar; ar = arn) {
+               //      arn = ar->next;
+               //      if (ar->alignment == RGN_ALIGN_QSPLIT) {
+               //              ED_region_exit(C, ar);
+               //              BKE_area_region_free(sa->type, ar);
+               //              BLI_remlink(&sa->regionbase, ar);
+               //              MEM_freeN(ar);
+               //      }
+               //}
+               //ED_area_tag_redraw(sa);
+               //WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
+       }
+       else if (ar->next) {
+               return;         // Only last region can be splitted
+       }
+       else {
+               /* Enter split-view */
+               ScrArea *sa = CTX_wm_area(C);
+
+               ar->alignment = RGN_ALIGN_VSPLIT;
+
+               ARegion *newar = BKE_area_region_copy(sa->type, ar);
+               BLI_addtail(&sa->regionbase, newar);
+
+               ///* lock views and set them */
+               //if (sa->spacetype == SPACE_CLIP) {
+               //      View3D *v3d = sa->spacedata.first;
+               //      int index_qsplit = 0;
+
+               //      /* run ED_view3d_lock() so the correct 'rv3d->viewquat' 
is set,
+               //       * otherwise when restoring rv3d->localvd the 
'viewquat' won't
+               //       * match the 'view', set on entering localview See: 
[#26315],
+               //       *
+               //       * We could avoid manipulating rv3d->localvd here if 
exiting
+               //       * localview with a 4-split would assign these view 
locks */
+               //      RegionView3D *rv3d = ar->regiondata;
+               //      const char viewlock = (rv3d->viewlock_quad & 
RV3D_VIEWLOCK_INIT) ?
+               //                            (rv3d->viewlock_quad & 
~RV3D_VIEWLOCK_INIT) : RV3D_LOCKED;
+
+               //      region_quadview_init_rv3d(sa, ar,              
viewlock, ED_view3d_lock_view_from_index(index_qsplit++), RV3D_ORTHO);
+               //      region_quadview_init_rv3d(sa, (ar = ar->next), 
viewlock, ED_view3d_lock_view_from_index(index_qsplit++), RV3D_ORTHO);
+               //      region_quadview_init_rv3d(sa, (ar = ar->next), 
viewlock, ED_view3d_lock_view_from_index(index_qsplit++), RV3D_ORTHO);
+               //}
+               ED_area_tag_redraw(sa);
+               WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
+       }
 }
 
 /* ******** masking editing functions ******** */
diff --git a/source/blender/makesdna/DNA_space_types.h 
b/source/blender/makesdna/DNA_space_types.h
index f97b8a7..6b10acd 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -1290,6 +1290,7 @@ 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 */
+       float loc[2], scale, angle; /* pre-composed stabilization data */
        float stabmat[4][4], unistabmat[4][4];  /* current stabilization matrix 
and the same matrix in unified space,
                                                 * defined when drawing and 
used for mouse position calculation */
 } RegionSpaceClip;
diff --git a/source/blender/makesrna/intern/rna_space.c 
b/source/blender/makesrna/intern/rna_space.c
index da4290a..9038871 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -1558,14 +1558,14 @@ static void rna_SpaceClipEditor_mask_set(PointerRNA 
*ptr, PointerRNA value)
        ED_space_clip_set_mask(NULL, sc, (Mask *)value.data);
 }
 
-static void rna_SpaceClipEditor_clip_mode_update(Main *UNUSED(bmain), Scene 
*UNUSED(scene), PointerRNA *ptr)
+static void rna_SpaceClipEditor_clip_mode_update(bContext *C, PointerRNA *ptr)
 {
        SpaceClip *sc = (SpaceClip *)(ptr->data);
 
        sc->scopes.ok = 0;
 
        /* update split view if in correspondence mode */
-       ED_clip_update_correspondence_mode();
+       ED_clip_update_correspondence_mode(C, sc);
 }
 
 static void rna_SpaceClipEditor_lock_selection_update(Main *UNUSED(bmain), 
Scene *UNUSED(scene), PointerRNA *ptr)
@@ -4547,6 +4547,7 @@ static void rna_def_space_clip(BlenderRNA *brna)
        RNA_def_property_enum_sdna(prop, NULL, "mode");
        RNA_def_property_enum_items(prop, rna_enum_clip_editor_mode_items);
        RNA_def_property_ui_text(prop, "Mode", "Editing context being 
displayed");
+       RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, 
"rna_SpaceClipEditor_clip_mode_update");
 
        /* view */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to