diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-01-08 02:28:20 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-08 02:37:43 +0300 |
commit | 91a155833e59275089641b63ae9271672ac17713 (patch) | |
tree | 8057253d80b84de168b96f45ae5e5063d6e8f0fa /source/blender/editors/gpencil | |
parent | 3d2ff33c261593d5211456500e8a212fb6a2ce82 (diff) |
Cleanup: comments causing bad clang-format output
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r-- | source/blender/editors/gpencil/annotate_paint.c | 130 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 144 |
2 files changed, 179 insertions, 95 deletions
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c index b6f81c81823..c6f88287e3e 100644 --- a/source/blender/editors/gpencil/annotate_paint.c +++ b/source/blender/editors/gpencil/annotate_paint.c @@ -116,56 +116,84 @@ typedef enum eGPencil_PaintFlags { */ typedef struct tGPsdata { Main *bmain; - Scene *scene; /* current scene from context */ + /** current scene from context. */ + Scene *scene; struct Depsgraph *depsgraph; - wmWindow *win; /* window where painting originated */ - ScrArea *sa; /* area where painting originated */ - ARegion *ar; /* region where painting originated */ - View2D *v2d; /* needed for GP_STROKE_2DSPACE */ - rctf *subrect; /* for using the camera rect within the 3d view */ + /** window where painting originated. */ + wmWindow *win; + /** area where painting originated. */ + ScrArea *sa; + /** region where painting originated. */ + ARegion *ar; + /** needed for GP_STROKE_2DSPACE. */ + View2D *v2d; + /** for using the camera rect within the 3d view. */ + rctf *subrect; rctf subrect_data; - GP_SpaceConversion gsc; /* settings to pass to gp_points_to_xy() */ - - PointerRNA ownerPtr; /* pointer to owner of gp-datablock */ - bGPdata *gpd; /* gp-datablock layer comes from */ - bGPDlayer *gpl; /* layer we're working on */ - bGPDframe *gpf; /* frame we're working on */ - - char *align_flag; /* projection-mode flags (toolsettings - eGPencil_Placement_Flags) */ - - eGPencil_PaintStatus status; /* current status of painting */ - eGPencil_PaintModes paintmode; /* mode for painting */ - eGPencil_PaintFlags flags; /* flags that can get set during runtime (eGPencil_PaintFlags) */ - - short radius; /* radius of influence for eraser */ - - float mval[2]; /* current mouse-position */ - float mvalo[2]; /* previous recorded mouse-position */ - - float pressure; /* current stylus pressure */ - float opressure; /* previous stylus pressure */ + /** settings to pass to gp_points_to_xy(). */ + GP_SpaceConversion gsc; + + /** pointer to owner of gp-datablock. */ + PointerRNA ownerPtr; + /** gp-datablock layer comes from. */ + bGPdata *gpd; + /** layer we're working on. */ + bGPDlayer *gpl; + /** frame we're working on. */ + bGPDframe *gpf; + + /** projection-mode flags (toolsettings - eGPencil_Placement_Flags) */ + char *align_flag; + + /** current status of painting. */ + eGPencil_PaintStatus status; + /** mode for painting. */ + eGPencil_PaintModes paintmode; + /** flags that can get set during runtime (eGPencil_PaintFlags) */ + eGPencil_PaintFlags flags; + + /** radius of influence for eraser. */ + short radius; + + /** current mouse-position. */ + float mval[2]; + /** previous recorded mouse-position. */ + float mvalo[2]; + + /** current stylus pressure. */ + float pressure; + /** previous stylus pressure. */ + float opressure; /* These need to be doubles, as (at least under unix) they are in seconds since epoch, * float (and its 7 digits precision) is definitively not enough here! * double, with its 15 digits precision, ensures us millisecond precision for a few centuries at least. */ - double inittime; /* Used when converting to path */ - double curtime; /* Used when converting to path */ - double ocurtime; /* Used when converting to path */ - - float imat[4][4]; /* inverted transformation matrix applying when converting coords from screen-space - * to region space */ + /** Used when converting to path. */ + double inittime; + /** Used when converting to path. */ + double curtime; + /** Used when converting to path. */ + double ocurtime; + + /** Inverted transformation matrix applying when converting coords from screen-space + * to region space. */ + float imat[4][4]; float mat[4][4]; - float custom_color[4]; /* custom color - hack for enforcing a particular color for track/mask editing */ + /** custom color - hack for enforcing a particular color for track/mask editing. */ + float custom_color[4]; - void *erasercursor; /* radial cursor data for drawing eraser */ + /** radial cursor data for drawing eraser. */ + void *erasercursor; - short straight[2]; /* 1: line horizontal, 2: line vertical, other: not defined, second element position */ + /** 1: line horizontal, 2: line vertical, other: not defined, second element position. */ + short straight[2]; - short keymodifier; /* key used for invoking the operator */ + /** key used for invoking the operator. */ + short keymodifier; } tGPsdata; /* ------ */ @@ -348,7 +376,8 @@ static short gp_stroke_addpoint( /* store settings */ copy_v2_v2(&pt->x, mval); - pt->pressure = 1.0f; /* T44932 - Pressure vals are unreliable, so ignore for now */ + /* T44932 - Pressure vals are unreliable, so ignore for now */ + pt->pressure = 1.0f; pt->strength = 1.0f; pt->time = (float)(curtime - p->inittime); @@ -363,7 +392,8 @@ static short gp_stroke_addpoint( /* store settings */ copy_v2_v2(&pt->x, mval); - pt->pressure = 1.0f; /* T44932 - Pressure vals are unreliable, so ignore for now */ + /* T44932 - Pressure vals are unreliable, so ignore for now */ + pt->pressure = 1.0f; pt->strength = 1.0f; pt->time = (float)(curtime - p->inittime); @@ -385,7 +415,8 @@ static short gp_stroke_addpoint( /* store settings */ copy_v2_v2(&pt->x, mval); pt->pressure = pressure; - pt->strength = 1.0f; /* unused for annotations, but initialise for easier conversions to GP Object */ + /* unused for annotations, but initialise for easier conversions to GP Object */ + pt->strength = 1.0f; /* point time */ pt->time = (float)(curtime - p->inittime); @@ -405,7 +436,8 @@ static short gp_stroke_addpoint( /* store settings */ copy_v2_v2(&pt->x, mval); - pt->pressure = 1.0f; /* T44932 - Pressure vals are unreliable, so ignore for now */ + /* T44932 - Pressure vals are unreliable, so ignore for now */ + pt->pressure = 1.0f; pt->strength = 1.0f; pt->time = (float)(curtime - p->inittime); @@ -1297,7 +1329,8 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps /* for camera view set the subrect */ if (rv3d->persp == RV3D_CAMOB) { - ED_view3d_calc_camera_border(p->scene, depsgraph, p->ar, v3d, rv3d, &p->subrect_data, true); /* no shift */ + /* no shift */ + ED_view3d_calc_camera_border(p->scene, depsgraph, p->ar, v3d, rv3d, &p->subrect_data, true); p->subrect = &p->subrect_data; } } @@ -1689,7 +1722,8 @@ static void gpencil_draw_apply_event(wmOperator *op, const wmEvent *event, Depsg int tablet = 0; /* convert from window-space to area-space mouse coordinates - * NOTE: float to ints conversions, +1 factor is probably used to ensure a bit more accurate rounding... + * 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; @@ -1789,7 +1823,8 @@ static void gpencil_draw_apply_event(wmOperator *op, const wmEvent *event, Depsg gpencil_draw_apply(op, p, depsgraph); /* force refresh */ - ED_region_tag_redraw(p->ar); /* just active area for now, since doing whole screen is too slow */ + /* just active area for now, since doing whole screen is too slow */ + ED_region_tag_redraw(p->ar); } /* ------------------------------- */ @@ -2006,7 +2041,8 @@ static void gpencil_stroke_end(wmOperator *op) static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) { tGPsdata *p = op->customdata; - int estate = OPERATOR_PASS_THROUGH; /* default exit state - pass through to support MMB view nav, etc. */ + /* default exit state - pass through to support MMB view nav, etc. */ + int estate = OPERATOR_PASS_THROUGH; /* if (event->type == NDOF_MOTION) * return OPERATOR_PASS_THROUGH; @@ -2249,7 +2285,8 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) } /* force refresh */ - ED_region_tag_redraw(p->ar); /* just active area for now, since doing whole screen is too slow */ + /* just active area for now, since doing whole screen is too slow */ + ED_region_tag_redraw(p->ar); /* event handled, so just tag as running modal */ estate = OPERATOR_RUNNING_MODAL; @@ -2269,7 +2306,8 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) else { /* update status indicators - cursor, header, etc. */ gpencil_draw_status_indicators(C, p); - gpencil_draw_cursor_set(p); /* cursor may have changed outside our control - T44084 */ + /* cursor may have changed outside our control - T44084 */ + gpencil_draw_cursor_set(p); } /* process last operations before exiting */ diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 204d6fe267a..6543a65f67f 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -128,70 +128,107 @@ typedef enum eGPencil_PaintFlags { typedef struct tGPsdata { bContext *C; - Main *bmain; /* main database pointer */ - Scene *scene; /* current scene from context */ + /** main database pointer. */ + Main *bmain; + /** current scene from context. */ + Scene *scene; struct Depsgraph *depsgraph; - Object *ob; /* current object */ - wmWindow *win; /* window where painting originated */ - ScrArea *sa; /* area where painting originated */ - ARegion *ar; /* region where painting originated */ - View2D *v2d; /* needed for GP_STROKE_2DSPACE */ - rctf *subrect; /* for using the camera rect within the 3d view */ + /** current object. */ + Object *ob; + /** window where painting originated. */ + wmWindow *win; + /** area where painting originated. */ + ScrArea *sa; + /** region where painting originated. */ + ARegion *ar; + /** needed for GP_STROKE_2DSPACE. */ + View2D *v2d; + /** for using the camera rect within the 3d view. */ + rctf *subrect; rctf subrect_data; - GP_SpaceConversion gsc; /* settings to pass to gp_points_to_xy() */ + /** settings to pass to gp_points_to_xy(). */ + GP_SpaceConversion gsc; - PointerRNA ownerPtr; /* pointer to owner of gp-datablock */ - bGPdata *gpd; /* gp-datablock layer comes from */ - bGPDlayer *gpl; /* layer we're working on */ - bGPDframe *gpf; /* frame we're working on */ + /** pointer to owner of gp-datablock. */ + PointerRNA ownerPtr; + /** gp-datablock layer comes from. */ + bGPdata *gpd; + /** layer we're working on. */ + bGPDlayer *gpl; + /** frame we're working on. */ + bGPDframe *gpf; - char *align_flag; /* projection-mode flags (toolsettings - eGPencil_Placement_Flags) */ + /** projection-mode flags (toolsettings - eGPencil_Placement_Flags) */ + char *align_flag; - eGPencil_PaintStatus status; /* current status of painting */ - eGPencil_PaintModes paintmode; /* mode for painting */ - eGPencil_PaintFlags flags; /* flags that can get set during runtime (eGPencil_PaintFlags) */ + /** current status of painting. */ + eGPencil_PaintStatus status; + /** mode for painting. */ + eGPencil_PaintModes paintmode; + /** flags that can get set during runtime (eGPencil_PaintFlags) */ + eGPencil_PaintFlags flags; - short radius; /* radius of influence for eraser */ + /** radius of influence for eraser. */ + short radius; - float mval[2]; /* current mouse-position */ - float mvalo[2]; /* previous recorded mouse-position */ + /** current mouse-position. */ + float mval[2]; + /** previous recorded mouse-position. */ + float mvalo[2]; - float pressure; /* current stylus pressure */ - float opressure; /* previous stylus pressure */ + /** current stylus pressure. */ + float pressure; + /** previous stylus pressure. */ + float opressure; /* These need to be doubles, as (at least under unix) they are in seconds since epoch, * float (and its 7 digits precision) is definitively not enough here! * double, with its 15 digits precision, ensures us millisecond precision for a few centuries at least. */ - double inittime; /* Used when converting to path */ - double curtime; /* Used when converting to path */ - double ocurtime; /* Used when converting to path */ - - float imat[4][4]; /* inverted transformation matrix applying when converting coords from screen-space - * to region space */ + /** Used when converting to path. */ + double inittime; + /** Used when converting to path. */ + double curtime; + /** Used when converting to path. */ + double ocurtime; + + /** Inverted transformation matrix applying when converting coords from screen-space + * to region space. */ + float imat[4][4]; float mat[4][4]; - float custom_color[4]; /* custom color - hack for enforcing a particular color for track/mask editing */ + /** custom color - hack for enforcing a particular color for track/mask editing. */ + float custom_color[4]; - void *erasercursor; /* radial cursor data for drawing eraser */ + /** radial cursor data for drawing eraser. */ + void *erasercursor; /* mat settings are only used for 3D view */ - Material *material; /* current material */ - - Brush *brush; /* current drawing brush */ - Brush *eraser; /* default eraser brush */ - short straight[2]; /* 1: line horizontal, 2: line vertical, other: not defined, second element position */ - int lock_axis; /* lock drawing to one axis */ - bool disable_fill; /* the stroke is no fill mode */ + /** current material. */ + Material *material; + + /** current drawing brush. */ + Brush *brush; + /** default eraser brush. */ + Brush *eraser; + /** 1: line horizontal, 2: line vertical, other: not defined, second element position. */ + short straight[2]; + /** lock drawing to one axis. */ + int lock_axis; + /** the stroke is no fill mode. */ + bool disable_fill; RNG *rng; - short keymodifier; /* key used for invoking the operator */ - short shift; /* shift modifier flag */ + /** key used for invoking the operator. */ + short keymodifier; + /** shift modifier flag. */ + short shift; - float totpixlen; /* size in pixels for uv calculation */ + /** size in pixels for uv calculation. */ + float totpixlen; ReportList *reports; } tGPsdata; @@ -430,7 +467,8 @@ static void gp_brush_jitter( float curvef = curvemapping_evaluateF(brush->gpencil_settings->curve_jitter, 0, pressure); tmp_pressure = curvef * brush->gpencil_settings->draw_sensitivity; } - const float exfactor = (brush->gpencil_settings->draw_jitter + 2.0f) * (brush->gpencil_settings->draw_jitter + 2.0f); /* exponential value */ + /* exponential value */ + const float exfactor = (brush->gpencil_settings->draw_jitter + 2.0f) * (brush->gpencil_settings->draw_jitter + 2.0f); const float fac = BLI_rng_get_float(rng) * exfactor * tmp_pressure; /* Jitter is applied perpendicular to the mouse movement vector (2D space) */ float mvec[2], svec[2]; @@ -468,8 +506,10 @@ static void gp_brush_angle(bGPdata *gpd, Brush *brush, tGPspoint *pt, const floa float fac; float mpressure; - float angle = brush->gpencil_settings->draw_angle; /* default angle of brush in radians */; - float v0[2] = { cos(angle), sin(angle) }; /* angle vector of the brush with full thickness */ + /* default angle of brush in radians */; + float angle = brush->gpencil_settings->draw_angle; + /* angle vector of the brush with full thickness */ + float v0[2] = { cos(angle), sin(angle) }; /* Apply to first point (only if there are 2 points because before no data to do it ) */ if (gpd->runtime.sbuffer_size == 1) { @@ -582,7 +622,8 @@ static short gp_stroke_addpoint( /* store settings */ copy_v2_v2(&pt->x, mval); - pt->pressure = 1.0f; /* T44932 - Pressure vals are unreliable, so ignore for now */ + /* T44932 - Pressure vals are unreliable, so ignore for now */ + pt->pressure = 1.0f; pt->strength = 1.0f; pt->time = (float)(curtime - p->inittime); @@ -597,7 +638,8 @@ static short gp_stroke_addpoint( /* store settings */ copy_v2_v2(&pt->x, mval); - pt->pressure = 1.0f; /* T44932 - Pressure vals are unreliable, so ignore for now */ + /* T44932 - Pressure vals are unreliable, so ignore for now */ + pt->pressure = 1.0f; pt->strength = 1.0f; pt->time = (float)(curtime - p->inittime); @@ -754,7 +796,8 @@ static short gp_stroke_addpoint( /* store settings */ copy_v2_v2(&pt->x, mval); - pt->pressure = 1.0f; /* T44932 - Pressure vals are unreliable, so ignore for now */ + /* T44932 - Pressure vals are unreliable, so ignore for now */ + pt->pressure = 1.0f; pt->strength = 1.0f; pt->time = (float)(curtime - p->inittime); @@ -2121,7 +2164,8 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps /* for camera view set the subrect */ if (rv3d->persp == RV3D_CAMOB) { - ED_view3d_calc_camera_border(p->scene, depsgraph, p->ar, v3d, rv3d, &p->subrect_data, true); /* no shift */ + /* no shift */ + ED_view3d_calc_camera_border(p->scene, depsgraph, p->ar, v3d, rv3d, &p->subrect_data, true); p->subrect = &p->subrect_data; } } @@ -2979,7 +3023,8 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) { tGPsdata *p = op->customdata; ToolSettings *ts = CTX_data_tool_settings(C); - int estate = OPERATOR_PASS_THROUGH; /* default exit state - pass through to support MMB view nav, etc. */ + /* default exit state - pass through to support MMB view nav, etc. */ + int estate = OPERATOR_PASS_THROUGH; /* if (event->type == NDOF_MOTION) * return OPERATOR_PASS_THROUGH; @@ -3254,7 +3299,8 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) } /* force refresh */ - ED_region_tag_redraw(p->ar); /* just active area for now, since doing whole screen is too slow */ + /* just active area for now, since doing whole screen is too slow */ + ED_region_tag_redraw(p->ar); /* event handled, so just tag as running modal */ estate = OPERATOR_RUNNING_MODAL; |