Code cleanup - Removing/commenting out various bits of legacy cruft related to
authorJoshua Leung <aligorith@gmail.com>
Mon, 11 Jun 2012 00:46:22 +0000 (00:46 +0000)
committerJoshua Leung <aligorith@gmail.com>
Mon, 11 Jun 2012 00:46:22 +0000 (00:46 +0000)
old Grease Pencil stuff

source/blender/editors/gpencil/drawgpencil.c
source/blender/editors/gpencil/gpencil_edit.c
source/blender/editors/gpencil/gpencil_paint.c
source/blender/editors/include/ED_gpencil.h
source/blender/editors/include/ED_sequencer.h
source/blender/editors/space_image/image_draw.c
source/blender/editors/space_node/node_draw.c
source/blender/editors/space_sequencer/sequencer_draw.c
source/blender/makesdna/DNA_space_types.h
source/blender/makesrna/intern/rna_space.c

index e4a24f13a0edaacc91ae36fee85cee0a34b04457..fa555b0ddb8644bad80388dcf68e871fc049425e 100644 (file)
@@ -664,7 +664,7 @@ static void gp_draw_data(bGPdata *gpd, int offsx, int offsy, int winx, int winy,
 // ............................
 
 /* draw grease-pencil sketches to specified 2d-view that uses ibuf corrections */
-void draw_gpencil_2dimage(bContext *C)
+void draw_gpencil_2dimage(const bContext *C)
 {
        ScrArea *sa = CTX_wm_area(C);
        ARegion *ar = CTX_wm_region(C);
@@ -726,7 +726,7 @@ void draw_gpencil_2dimage(bContext *C)
 /* draw grease-pencil sketches to specified 2d-view assuming that matrices are already set correctly 
  * Note: this gets called twice - first time with onlyv2d=1 to draw 'canvas' strokes, second time with onlyv2d=0 for screen-aligned strokes
  */
-void draw_gpencil_view2d(bContext *C, short onlyv2d)
+void draw_gpencil_view2d(const bContext *C, short onlyv2d)
 {
        ScrArea *sa = CTX_wm_area(C);
        ARegion *ar = CTX_wm_region(C);
index 7094aa086baf1a1b5786f8adb173bdab838c322f..7708d99e9908cb6df19b9e0bf8de080059869a3b 100644 (file)
@@ -78,7 +78,7 @@
 /* Context Wrangling... */
 
 /* Get pointer to active Grease Pencil datablock, and an RNA-pointer to trace back to whatever owns it */
-bGPdata **gpencil_data_get_pointers(bContext *C, PointerRNA *ptr)
+bGPdata **gpencil_data_get_pointers(const bContext *C, PointerRNA *ptr)
 {
        ID *screen_id = (ID *)CTX_wm_screen(C);
        Scene *scene = CTX_data_scene(C);
@@ -181,7 +181,7 @@ bGPdata **gpencil_data_get_pointers(bContext *C, PointerRNA *ptr)
 }
 
 /* Get the active Grease Pencil datablock */
-bGPdata *gpencil_data_get_active(bContext *C)
+bGPdata *gpencil_data_get_active(const bContext *C)
 {
        bGPdata **gpd_ptr = gpencil_data_get_pointers(C, NULL);
        return (gpd_ptr) ? *(gpd_ptr) : NULL;
index 5eef34f4afe19ab26d99766e8e43adc0b8dddb5e..9d5779e448e3e5e56cbefa1764d905ce534a759e 100644 (file)
@@ -968,16 +968,6 @@ static int gp_session_initdata(bContext *C, tGPsdata *p)
                                        printf("Error: 3D-View active region doesn't have any region data, so cannot be drawable\n");
                                return 0;
                        }
-
-#if 0 // XXX will this sort of antiquated stuff be restored?
-                       /* check that gpencil data is allowed to be drawn */
-                       if ((v3d->flag2 & V3D_DISPGP) == 0) {
-                               p->status = GP_STATUS_ERROR;
-                               if (G.debug & G_DEBUG)
-                                       printf("Error: In active view, Grease Pencil not shown\n");
-                               return 0;
-                       }
-#endif
                }
                break;
 
@@ -989,16 +979,6 @@ static int gp_session_initdata(bContext *C, tGPsdata *p)
                        p->sa = curarea;
                        p->ar = ar;
                        p->v2d = &ar->v2d;
-                       
-#if 0 // XXX will this sort of antiquated stuff be restored?
-                       /* check that gpencil data is allowed to be drawn */
-                       if ((snode->flag & SNODE_DISPGP) == 0) {
-                               p->status = GP_STATUS_ERROR;
-                               if (G.debug & G_DEBUG)
-                                       printf("Error: In active view, Grease Pencil not shown\n");
-                               return 0;
-                       }
-#endif
                }
                break;
                case SPACE_SEQ:
@@ -1017,14 +997,6 @@ static int gp_session_initdata(bContext *C, tGPsdata *p)
                                        printf("Error: In active view (sequencer), active mode doesn't support Grease Pencil\n");
                                return 0;
                        }
-#if 0 // XXX will this sort of antiquated stuff be restored?
-                       if ((sseq->flag & SEQ_DRAW_GPENCIL) == 0) {
-                               p->status = GP_STATUS_ERROR;
-                               if (G.debug & G_DEBUG)
-                                       printf("Error: In active view, Grease Pencil not shown\n");
-                               return 0;
-                       }
-#endif
                }
                break;
                case SPACE_IMAGE:
@@ -1035,48 +1007,36 @@ static int gp_session_initdata(bContext *C, tGPsdata *p)
                        p->sa = curarea;
                        p->ar = ar;
                        p->v2d = &ar->v2d;
-                       //p->ibuf= BKE_image_get_ibuf(sima->image, &sima->iuser);
-                       
-#if 0 // XXX disabled for now
-                       /* check that gpencil data is allowed to be drawn */
-                       if ((sima->flag & SI_DISPGP) == 0) {
-                               p->status = GP_STATUS_ERROR;
-                               if (G.debug & G_DEBUG)
-                                       printf("Error: In active view, Grease Pencil not shown\n");
-                               return 0;
-                       }
-#endif
                }
                break;
                case SPACE_CLIP:
                {
                        SpaceClip *sc = curarea->spacedata.first;
-
+                       
                        /* set the current area */
                        p->sa = curarea;
                        p->ar = ar;
                        p->v2d = &ar->v2d;
-                       //p->ibuf= BKE_image_get_ibuf(sima->image, &sima->iuser);
-
+                       
                        invert_m4_m4(p->imat, sc->unistabmat);
-
+                       
                        /* custom color for new layer */
                        p->custom_color[0] = 1.0f;
                        p->custom_color[1] = 0.0f;
                        p->custom_color[2] = 0.5f;
                        p->custom_color[3] = 0.9f;
-
+                       
                        if (sc->gpencil_src == SC_GPENCIL_SRC_TRACK) {
                                int framenr = sc->user.framenr;
                                MovieTrackingTrack *track = BKE_tracking_active_track(&sc->clip->tracking);
                                MovieTrackingMarker *marker = BKE_tracking_exact_marker(track, framenr);
-
+                               
                                p->imat[3][0] -= marker->pos[0];
                                p->imat[3][1] -= marker->pos[1];
                        }
                }
                break;
-
+               
                /* unsupported views */
                default:
                {
@@ -1157,7 +1117,7 @@ static void gp_paint_initstroke(tGPsdata *p, short paintmode)
        p->gpl = gpencil_layer_getactive(p->gpd);
        if (p->gpl == NULL) {
                p->gpl = gpencil_layer_addnew(p->gpd);
-
+               
                if (p->custom_color[3])
                        copy_v3_v3(p->gpl->color, p->custom_color);
        }
@@ -1465,8 +1425,9 @@ static void gpencil_draw_apply_event(wmOperator *op, wmEvent *event)
        float mousef[2];
        int tablet = 0;
 
-       /* convert from window-space to area-space mouse coordintes */
-       // NOTE: float to ints conversions, +1 factor is probably used to ensure a bit more accurate rounding...
+       /* convert from window-space to area-space mouse coordintes 
+        * NOTE: float to ints conversions, +1 factor is probably used to ensure a bit more accurate rounding... 
+        */
        p->mval[0] = event->mval[0] + 1;
        p->mval[1] = event->mval[1] + 1;
 
index 8a480271635f8506afb606cac93bb971bcb6ff18..1d461f797d6f805775a387dd6b630b5309e5b60b 100644 (file)
@@ -64,8 +64,8 @@ typedef struct tGPspoint {
 
 /* ----------- Grease Pencil Tools/Context ------------- */
 
-struct bGPdata **gpencil_data_get_pointers(struct bContext *C, struct PointerRNA *ptr);
-struct bGPdata *gpencil_data_get_active(struct bContext *C);
+struct bGPdata **gpencil_data_get_pointers(const struct bContext *C, struct PointerRNA *ptr);
+struct bGPdata *gpencil_data_get_active(const struct bContext *C);
 struct bGPdata *gpencil_data_get_active_v3d(struct Scene *scene); /* for offscreen rendering */
 
 /* ----------- Grease Pencil Operators ----------------- */
@@ -76,8 +76,8 @@ void ED_operatortypes_gpencil(void);
 /* ------------ Grease-Pencil Drawing API ------------------ */
 /* drawgpencil.c */
 
-void draw_gpencil_2dimage(struct bContext *C);
-void draw_gpencil_view2d(struct bContext *C, short onlyv2d);
+void draw_gpencil_2dimage(const struct bContext *C);
+void draw_gpencil_view2d(const struct bContext *C, short onlyv2d);
 void draw_gpencil_view3d(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, short only3d);
 
 void gpencil_panel_standard(const struct bContext *C, struct Panel *pa);
index c731245949e4bb09166e824b205b8a3cea715149..cea567254de5cb8d71f64428d3e02518b9d5f008 100644 (file)
@@ -27,8 +27,6 @@
 #ifndef __ED_SEQUENCER_H__
 #define __ED_SEQUENCER_H__
 
-#define SEQ_ZOOM_FAC(szoom) ((szoom) > 0.0f) ? (szoom) : ((szoom) == 0.0f) ? (1.0f) : (-1.0f / (szoom))
-
 struct Scene;
 struct Sequence;
 
index 998ebac1cb9b91e728bc9c24226941a73ebe1810..ac71eb972f64788530c753f12ccd7c7b1067815b 100644 (file)
@@ -565,7 +565,6 @@ void draw_image_grease_pencil(bContext *C, short onlyv2d)
        /* draw in View2D space? */
        if (onlyv2d) {
                /* draw grease-pencil ('image' strokes) */
-               //if (sima->flag & SI_DISPGP)
                draw_gpencil_2dimage(C);
        }
        else {
@@ -573,7 +572,6 @@ void draw_image_grease_pencil(bContext *C, short onlyv2d)
                //SpaceImage *sima= (SpaceImage *)CTX_wm_space_data(C);
                
                /* draw grease-pencil ('screen' strokes) */
-               //if (sima->flag & SI_DISPGP)
                draw_gpencil_view2d(C, 0);
        }
 }
index 921aceb7b2ee6a4c364eb625d6e53920c70068b5..c65bbd6e15f61494571c3c76efb3cae42b1ac020 100644 (file)
@@ -1138,15 +1138,15 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
        glDisable(GL_BLEND);
        
        /* draw grease-pencil ('canvas' strokes) */
-       if (/*(snode->flag & SNODE_DISPGP) &&*/ (snode->nodetree))
-               draw_gpencil_view2d((bContext*)C, 1);
+       if (snode->nodetree)
+               draw_gpencil_view2d(C, 1);
        
        /* reset view matrix */
        UI_view2d_view_restore(C);
        
        /* draw grease-pencil (screen strokes, and also paintbuffer) */
-       if (/*(snode->flag & SNODE_DISPGP) && */(snode->nodetree))
-               draw_gpencil_view2d((bContext*)C, 0);
+       if (snode->nodetree)
+               draw_gpencil_view2d(C, 0);
        
        /* scrollers */
        scrollers= UI_view2d_scrollers_calc(C, v2d, 10, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
index 3119c2d44f8787dc2e3a1d3c5939444a27d3d92c..e48450e93bdd33e9036608a19ba12ec0eaaf06f9 100644 (file)
@@ -976,7 +976,6 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
        }
        
        /* draw grease-pencil (image aligned) */
-//     if (sseq->flag & SEQ_DRAW_GPENCIL)
        draw_gpencil_2dimage(C);
 
        IMB_freeImBuf(ibuf);
@@ -985,7 +984,6 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
        UI_view2d_view_restore(C);
        
        /* draw grease-pencil (screen aligned) */
-//     if (sseq->flag & SEQ_DRAW_GPENCIL)
        draw_gpencil_view2d(C, 0);
 
        //if (sc->mode == SC_MODE_MASKEDIT) {
index 0b5b21773422b92510122783f1915ab95690a4bf..cb905d7f768c161eade04eef6933acaeca691a78 100644 (file)
@@ -491,7 +491,7 @@ typedef enum eSpaceSeq_Flag {
        SEQ_MARKER_TRANS            = (1 << 1),
        SEQ_DRAW_COLOR_SEPARATED    = (1 << 2),
        SEQ_DRAW_SAFE_MARGINS       = (1 << 3),
-       SEQ_DRAW_GPENCIL            = (1 << 4), /* DEPRECATED */
+/*  SEQ_DRAW_GPENCIL            = (1 << 4), */ /* DEPRECATED */
        SEQ_NO_DRAW_CFRANUM         = (1 << 5),
 } eSpaceSeq_Flag;
 
@@ -746,7 +746,7 @@ typedef enum eSpaceImage_Flag {
        SI_DRAW_TILE          = (1 << 19),
        SI_SMOOTH_UV          = (1 << 20),
        SI_DRAW_STRETCH       = (1 << 21),
-       SI_DISPGP             = (1 << 22), /* DEPRECATED */
+/*  SI_DISPGP             = (1 << 22), */ /* DEPRECATED */
        SI_DRAW_OTHER         = (1 << 23),
 
        SI_COLOR_CORRECTION   = (1 << 24),
@@ -876,7 +876,7 @@ typedef struct SpaceNode {
 /* snode->flag */
 typedef enum eSpaceNode_Flag {
        SNODE_BACKDRAW     = (1 << 1),
-       SNODE_DISPGP       = (1 << 2), /* XXX: Grease Pencil - deprecated? */
+/*  SNODE_DISPGP       = (1 << 2), */ /* XXX: Grease Pencil - deprecated? */
        SNODE_USE_ALPHA    = (1 << 3),
        SNODE_SHOW_ALPHA   = (1 << 4),
        SNODE_AUTO_RENDER  = (1 << 5),
index 3ff54076f822a21e400c126dede54219b8593c69..81538d20a507b59f003087ac14f29a98737bd151 100644 (file)
@@ -1969,14 +1969,7 @@ static void rna_def_space_image(BlenderRNA *brna)
        RNA_def_property_struct_type(prop, "GreasePencil");
        RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this space");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
-#if 0 // XXX: unused - old stuff which may not be restored
-       prop = RNA_def_property(srna, "use_grease_pencil", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DISPGP);
-       RNA_def_property_ui_text(prop, "Use Grease Pencil",
-                                "Display and edit the grease pencil freehand annotations overlay");
-#endif
-
+       
        /* update */
        prop = RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "lock", 0);