[Bf-blender-cvs] [70a41a52000] greasepencil-object: Cleanup: Move modal operator draw callbacks out of ED_gpencil.h
Joshua Leung
noreply at git.blender.org
Wed Feb 7 01:09:36 CET 2018
Commit: 70a41a520009ddad4b1fa950b46a36b4888a26f8
Author: Joshua Leung
Date: Wed Feb 7 13:09:19 2018 +1300
Branches: greasepencil-object
https://developer.blender.org/rB70a41a520009ddad4b1fa950b46a36b4888a26f8
Cleanup: Move modal operator draw callbacks out of ED_gpencil.h
Turns out that these were only actually used from within the gpencil
module (i.e. they were defined in drawgpencil.c, and called from the
gpencil_<opname>.c files), so it's not even necessary to export these
function prototypes in the ED_gpencil.h header.
===================================================================
M source/blender/editors/gpencil/gpencil_fill.c
M source/blender/editors/gpencil/gpencil_intern.h
M source/blender/editors/include/ED_gpencil.h
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index 06b18c64f4a..a6e4d0e2fac 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -38,8 +38,9 @@
#include "BLT_translation.h"
-#include "DNA_object_types.h"
#include "DNA_gpencil_types.h"
+#include "DNA_image_types.h"
+#include "DNA_object_types.h"
#include "DNA_windowmanager_types.h"
#include "BKE_main.h"
@@ -76,6 +77,48 @@
#define LEAK_HORZ 0
#define LEAK_VERT 1
+
+/* Temporary fill operation data (op->customdata) */
+typedef struct tGPDfill {
+ struct Depsgraph *depsgraph;
+ struct wmWindow *win; /* window where painting originated */
+ struct Scene *scene; /* current scene from context */
+ struct Object *ob; /* current active gp object */
+ struct EvaluationContext *eval_ctx; /* eval context */
+ struct ScrArea *sa; /* area where painting originated */
+ struct RegionView3D *rv3d; /* region where painting originated */
+ struct View3D *v3d; /* view3 where painting originated */
+ struct ARegion *ar; /* region where painting originated */
+ struct bGPdata *gpd; /* current GP datablock */
+ struct Palette *palette; /* current palette */
+ struct PaletteColor *palcolor; /* current palette color */
+ struct bGPDlayer *gpl; /* layer */
+ struct bGPDframe *gpf; /* frame */
+
+ short flag; /* flags */
+ short oldkey; /* avoid too fast events */
+ bool on_back; /* send to back stroke */
+
+ int center[2]; /* mouse fill center position */
+ int sizex; /* windows width */
+ int sizey; /* window height */
+ int lock_axis; /* lock to viewport axis */
+
+ short fill_leak; /* number of pixel to consider the leak is too small (x 2) */
+ float fill_threshold; /* factor for transparency */
+ int fill_simplylvl; /* number of simplify steps */
+ int fill_draw_mode; /* boundary limits drawing mode */
+
+ short sbuffer_size; /* number of elements currently in cache */
+ void *sbuffer; /* temporary points */
+ float *depth_arr; /* depth array for reproject */
+
+ Image *ima; /* temp image */
+ BLI_Stack *stack; /* temp points data */
+ void *draw_handle_3d; /* handle for drawing strokes while operator is running 3d stuff */
+} tGPDfill;
+
+
/* draw a given stroke using same thickness and color for all points */
static void gp_draw_basic_stroke(bGPDstroke *gps, const float diff_mat[4][4],
bool cyclic, float ink[4], int flag, float thershold)
diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h
index a908e8599fe..08ea551c440 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -43,7 +43,6 @@ struct bGPDstroke;
struct bGPDspoint;
struct tGPspoint;
-struct BLI_Stack;
struct GHash;
struct Scene;
@@ -51,7 +50,6 @@ struct ARegion;
struct View3D;
struct View2D;
struct wmOperatorType;
-struct Image;
struct PointerRNA;
struct PropertyRNA;
@@ -59,16 +57,22 @@ struct EnumPropertyItem;
/* ***************************************************** */
-/* Internal Data Structures
+/* Modal Operator Geometry Preview
*
- * These are used to store the state data for modal operators
- * when they are running (i.e. op->customdata). They are exported
- * so that the drawing callbacks in drawgpencil.c can access the
- * necessary preview geometry that is shown when the operators run.
- * Since these are the *private (state) data* for the operators,
- * we shouldn't be exporting these in the public ED_gpencil.h header.
+ * Several modal operators (Fill, Interpolate, Primitive)
+ * need to run some drawing code to display previews, or
+ * to perform screen-space/image-based analysis routines.
+ * The following structs + function prototypes are used
+ * by these operators so that the operator code
+ * (in gpencil_<opname>.c) can communicate with the drawing
+ * code (in drawgpencil.c).
+ *
+ * NOTE: All this is within the gpencil module, so nothing needs
+ * to be exported to other modules.
*/
+/* Internal Operator-State Data ------------------------ */
+
/* Temporary draw data (no draw manager mode) */
typedef struct tGPDdraw {
struct RegionView3D *rv3d; /* region to draw */
@@ -157,46 +161,11 @@ typedef struct tGPDprimitive {
} tGPDprimitive;
-/* Temporary fill operation data */
-typedef struct tGPDfill {
- struct Depsgraph *depsgraph;
- struct wmWindow *win; /* window where painting originated */
- struct Scene *scene; /* current scene from context */
- struct Object *ob; /* current active gp object */
- struct EvaluationContext *eval_ctx; /* eval context */
- struct ScrArea *sa; /* area where painting originated */
- struct RegionView3D *rv3d; /* region where painting originated */
- struct View3D *v3d; /* view3 where painting originated */
- struct ARegion *ar; /* region where painting originated */
- struct bGPdata *gpd; /* current GP datablock */
- struct Palette *palette; /* current palette */
- struct PaletteColor *palcolor; /* current palette color */
- struct bGPDlayer *gpl; /* layer */
- struct bGPDframe *gpf; /* frame */
-
- short flag; /* flags */
- short oldkey; /* avoid too fast events */
- bool on_back; /* send to back stroke */
-
- int center[2]; /* mouse fill center position */
- int sizex; /* windows width */
- int sizey; /* window height */
- int lock_axis; /* lock to viewport axis */
-
- short fill_leak; /* number of pixel to consider the leak is too small (x 2) */
- float fill_threshold; /* factor for transparency */
- int fill_simplylvl; /* number of simplify steps */
- int fill_draw_mode; /* boundary limits drawing mode */
-
- short sbuffer_size; /* number of elements currently in cache */
- void *sbuffer; /* temporary points */
- float *depth_arr; /* depth array for reproject */
-
- struct Image *ima; /* temp image */
- struct BLI_Stack *stack; /* temp points data */
- void *draw_handle_3d; /* handle for drawing strokes while operator is running 3d stuff */
-} tGPDfill;
+/* Modal Operator Drawing Callbacks ------------------------ */
+void ED_gp_draw_interpolation(const struct bContext *C, struct tGPDinterpolate *tgpi, const int type);
+void ED_gp_draw_primitives(const struct bContext *C, struct tGPDprimitive *tgpi, const int type);
+void ED_gp_draw_fill(struct tGPDdraw *tgpw);
/* ***************************************************** */
/* Internal API */
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index de1128c3ef2..d834677eb69 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -64,11 +64,6 @@ struct wmOperator;
struct wmWindow;
struct wmWindowManager;
-struct tGPDdraw;
-struct tGPDinterpolate;
-struct tGPDprimitive;
-struct tGPDfill;
-
/* ------------- Grease-Pencil Runtime Data ---------------- */
/* Temporary 'Stroke Point' data (2D / screen-space)
@@ -149,12 +144,6 @@ void ED_gpencil_draw_view3d_object(struct wmWindowManager *wm,
void ED_gpencil_draw_ex(struct RegionView3D *rv3d, struct Scene *scene, struct bGPdata *gpd, int winx, int winy,
const int cfra, const char spacetype);
-/* Modal Operator Geometry Preview */
-// XXX: Are these called from the draw engine at all? Can we hide these?
-void ED_gp_draw_interpolation(const struct bContext *C, struct tGPDinterpolate *tgpi, const int type);
-void ED_gp_draw_primitives(const struct bContext *C, struct tGPDprimitive *tgpi, const int type);
-void ED_gp_draw_fill(struct tGPDdraw *tgpw);
-
/* ----------- Grease-Pencil AnimEdit API ------------------ */
bool ED_gplayer_frames_looper(struct bGPDlayer *gpl, struct Scene *scene,
short (*gpf_cb)(struct bGPDframe *, struct Scene *));
More information about the Bf-blender-cvs
mailing list