From b8e8c0e325d213f2dcf4adad5506989fa224716e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Jan 2019 23:24:20 +1100 Subject: Cleanup: comment line length (editors) Prevents clang-format wrapping text before comments. --- source/blender/editors/space_graph/graph_buttons.c | 34 +++++++++++++----- source/blender/editors/space_graph/graph_draw.c | 41 ++++++++++++++++------ source/blender/editors/space_graph/graph_edit.c | 24 ++++++++----- source/blender/editors/space_graph/graph_ops.c | 13 ++++--- source/blender/editors/space_graph/graph_select.c | 6 ++-- source/blender/editors/space_graph/space_graph.c | 20 +++++++---- 6 files changed, 98 insertions(+), 40 deletions(-) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 72ff0712a23..e3e7adb1786 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -687,7 +687,9 @@ static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar * uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", IFACE_("Bone"), ICON_BONE_DATA); } - uiLayoutSetRedAlert(col, false); /* we can clear it again now - it's only needed when creating the ID/Bone fields */ + /* we can clear it again now - it's only needed when creating the ID/Bone fields */ + uiLayoutSetRedAlert(col, false); + uiItemR(col, &dtar_ptr, "transform_space", 0, NULL, ICON_NONE); /* Object 2 */ @@ -702,7 +704,9 @@ static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar * uiItemPointerR(col, &dtar2_ptr, "bone_target", &tar_ptr, "bones", IFACE_("Bone"), ICON_BONE_DATA); } - uiLayoutSetRedAlert(col, false); /* we can clear it again now - it's only needed when creating the ID/Bone fields */ + /* we can clear it again now - it's only needed when creating the ID/Bone fields */ + uiLayoutSetRedAlert(col, false); + uiItemR(col, &dtar2_ptr, "transform_space", 0, NULL, ICON_NONE); } @@ -922,14 +926,22 @@ static void graph_draw_driver_settings_panel(uiLayout *layout, ID *id, FCurve *f subrow = uiLayoutRow(row, true); /* 1.1.1) variable type */ - sub = uiLayoutRow(subrow, true); /* HACK: special group just for the enum, otherwise we */ - uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); /* we get ugly layout with text included too... */ + + /* HACK: special group just for the enum, + * otherwise we get ugly layout with text included too... */ + sub = uiLayoutRow(subrow, true); + + uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); uiItemR(sub, &dvar_ptr, "type", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); /* 1.1.2) variable name */ - sub = uiLayoutRow(subrow, true); /* HACK: special group to counteract the effects of the previous */ - uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_EXPAND); /* enum, which now pushes everything too far right */ + + /* HACK: special group to counteract the effects of the previous enum, + * which now pushes everything too far right */ + sub = uiLayoutRow(subrow, true); + + uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_EXPAND); uiItemR(sub, &dvar_ptr, "name", 0, "", ICON_NONE); @@ -993,7 +1005,8 @@ static void graph_draw_driver_settings_panel(uiLayout *layout, ID *id, FCurve *f uiItemS(layout); uiItemS(layout); - /* XXX: This should become redundant. But sometimes the flushing fails, so keep this around for a while longer as a "last resort" */ + /* XXX: This should become redundant. But sometimes the flushing fails, + * so keep this around for a while longer as a "last resort" */ row = uiLayoutRow(layout, true); block = uiLayoutGetBlock(row); but = uiDefIconTextBut(block, UI_BTYPE_BUT, B_IPO_DEPCHANGE, ICON_FILE_REFRESH, IFACE_("Update Dependencies"), @@ -1020,7 +1033,8 @@ static void graph_panel_driven_property(const bContext *C, Panel *pa) MEM_freeN(ale); } -/* driver settings for active F-Curve (only for 'Drivers' mode in Graph Editor, i.e. the full "Drivers Editor") */ +/* driver settings for active F-Curve + * (only for 'Drivers' mode in Graph Editor, i.e. the full "Drivers Editor") */ static void graph_panel_drivers(const bContext *C, Panel *pa) { bAnimListElem *ale; @@ -1198,7 +1212,9 @@ void graph_buttons_register(ARegionType *art) pt->draw = graph_panel_drivers_popover; pt->poll = graph_panel_drivers_popover_poll; BLI_addtail(&art->paneltypes, pt); - WM_paneltype_add(pt); /* This panel isn't used in this region. Add explicitly to global list (so popovers work). */ + /* This panel isn't used in this region. + * Add explicitly to global list (so popovers work). */ + WM_paneltype_add(pt); pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel modifiers"); strcpy(pt->idname, "GRAPH_PT_modifiers"); diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index d4f6824ccdf..0d3b55df531 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -245,13 +245,21 @@ static void draw_fcurve_selected_handle_vertices(FCurve *fcu, View2D *v2d, bool */ if (!sel_handle_only || BEZT_ISSEL_ANY(bezt)) { if ((!prevbezt && (bezt->ipo == BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo == BEZT_IPO_BEZ))) { - if ((bezt->f1 & SELECT) == sel) /* && v2d->cur.xmin < bezt->vec[0][0] < v2d->cur.xmax)*/ + if ((bezt->f1 & SELECT) == sel + /* && v2d->cur.xmin < bezt->vec[0][0] < v2d->cur.xmax)*/ + ) + { immVertex2fv(pos, bezt->vec[0]); + } } if (bezt->ipo == BEZT_IPO_BEZ) { - if ((bezt->f3 & SELECT) == sel) /* && v2d->cur.xmin < bezt->vec[2][0] < v2d->cur.xmax)*/ + if ((bezt->f3 & SELECT) == sel + /* && v2d->cur.xmin < bezt->vec[2][0] < v2d->cur.xmax)*/ + ) + { immVertex2fv(pos, bezt->vec[2]); + } } } } @@ -291,7 +299,8 @@ static void draw_fcurve_vertices(ARegion *ar, FCurve *fcu, bool do_handles, bool GPU_blend(true); GPU_enable_program_point_size(); - /* draw the two handles first (if they're shown, the curve doesn't have just a single keyframe, and the curve is being edited) */ + /* draw the two handles first (if they're shown, the curve doesn't + * have just a single keyframe, and the curve is being edited) */ if (do_handles) { draw_fcurve_handle_vertices(fcu, v2d, sel_handle_only, pos); } @@ -308,13 +317,20 @@ static void draw_fcurve_vertices(ARegion *ar, FCurve *fcu, bool do_handles, bool static bool draw_fcurve_handles_check(SpaceIpo *sipo, FCurve *fcu) { /* don't draw handle lines if handles are not to be shown */ - if ( (sipo->flag & SIPO_NOHANDLES) || /* handles shouldn't be shown anywhere */ - (fcu->flag & FCURVE_PROTECTED) || /* keyframes aren't editable */ + if ( + /* handles shouldn't be shown anywhere */ + (sipo->flag & SIPO_NOHANDLES) || + /* keyframes aren't editable */ + (fcu->flag & FCURVE_PROTECTED) || #if 0 /* handles can still be selected and handle types set, better draw - campbell */ - (fcu->flag & FCURVE_INT_VALUES) || /* editing the handles here will cause weird/incorrect interpolation issues */ + /* editing the handles here will cause weird/incorrect interpolation issues */ + (fcu->flag & FCURVE_INT_VALUES) || #endif - ((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) || /* group that curve belongs to is not editable */ - (fcu->totvert <= 1) /* do not show handles if there is only 1 keyframe, otherwise they all clump together in an ugly ball */ + /* group that curve belongs to is not editable */ + ((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) || + /* do not show handles if there is only 1 keyframe, + * otherwise they all clump together in an ugly ball */ + (fcu->totvert <= 1) ) { return false; @@ -514,7 +530,8 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d * loop (i.e. too close to 0), then clamp it to a determined "safe" value. The value * chosen here is just the coarsest value which still looks reasonable... */ - /* grid->dx represents the number of 'frames' between gridlines, but we divide by U.v2d_min_gridsize to get pixels-steps */ + /* grid->dx represents the number of 'frames' between gridlines, + * but we divide by U.v2d_min_gridsize to get pixels-steps */ /* TODO: perhaps we should have 1.0 frames as upper limit so that curves don't get too distorted? */ samplefreq = dx / (U.v2d_min_gridsize * U.pixelsize); @@ -726,7 +743,8 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2 /* TODO: optimize this to not have to calc stuff out of view too? */ while (b--) { if (prevbezt->ipo == BEZT_IPO_CONST) { - /* Constant-Interpolation: draw segment between previous keyframe and next, but holding same value */ + /* Constant-Interpolation: draw segment between previous keyframe and next, + * but holding same value */ v1[0] = prevbezt->vec[1][0]; v1[1] = prevbezt->vec[1][1]; immVertex2fv(pos, v1); @@ -746,7 +764,8 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2 * - resol determines number of points to sample in between keyframes */ - /* resol depends on distance between points (not just horizontal) OR is a fixed high res */ + /* resol depends on distance between points + * (not just horizontal) OR is a fixed high res */ /* TODO: view scale should factor into this someday too... */ if (fcu->driver) { resol = 32; diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 00418d6482a..6a01f4a9d49 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -279,7 +279,8 @@ void GRAPH_OT_view_all(wmOperatorType *ot) /* api callbacks */ ot->exec = graphkeys_viewall_exec; - ot->poll = ED_operator_graphedit_active; /* XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier... */ + /* XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier... */ + ot->poll = ED_operator_graphedit_active; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -298,7 +299,8 @@ void GRAPH_OT_view_selected(wmOperatorType *ot) /* api callbacks */ ot->exec = graphkeys_view_selected_exec; - ot->poll = ED_operator_graphedit_active; /* XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier... */ + /* XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier... */ + ot->poll = ED_operator_graphedit_active; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1801,9 +1803,12 @@ void GRAPH_OT_handle_type(wmOperatorType *ot) typedef struct tEulerFilter { struct tEulerFilter *next, *prev; - ID *id; /* ID-block which owns the channels */ - FCurve *(fcurves[3]); /* 3 Pointers to F-Curves */ - const char *rna_path; /* Pointer to one of the RNA Path's used by one of the F-Curves */ + /** ID-block which owns the channels */ + ID *id; + /** 3 Pointers to F-Curves */ + FCurve *(fcurves[3]); + /** Pointer to one of the RNA Path's used by one of the F-Curves */ + const char *rna_path; } tEulerFilter; static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op) @@ -1864,7 +1869,8 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op) groups++; euf->id = ale->id; - euf->rna_path = fcu->rna_path; /* this should be safe, since we're only using it for a short time */ + /* this should be safe, since we're only using it for a short time */ + euf->rna_path = fcu->rna_path; euf->fcurves[fcu->array_index] = fcu; } @@ -1884,7 +1890,8 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op) int f; /* sanity check: ensure that there are enough F-Curves to work on in this group */ - /* TODO: also enforce assumption that there be a full set of keyframes at each position by ensuring that totvert counts are same? */ + /* TODO: also enforce assumption that there be a full set of keyframes + * at each position by ensuring that totvert counts are same? */ if (ELEM(NULL, euf->fcurves[0], euf->fcurves[1], euf->fcurves[2])) { /* report which components are missing */ BKE_reportf(op->reports, RPT_WARNING, @@ -1917,7 +1924,8 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op) /* > 180 degree flip? */ if ((sign * (prev->vec[1][1] - bezt->vec[1][1])) >= (float)M_PI) { - /* 360 degrees to add/subtract frame value until difference is acceptably small that there's no more flip */ + /* 360 degrees to add/subtract frame value until difference + * is acceptably small that there's no more flip */ const float fac = sign * 2.0f * (float)M_PI; while ((sign * (prev->vec[1][1] - bezt->vec[1][1])) >= (float)M_PI) { diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index 4ed6a980fcb..d09e9a713f0 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -84,7 +84,8 @@ static void graphview_cursor_apply(bContext *C, wmOperator *op) Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); SpaceIpo *sipo = CTX_wm_space_graph(C); - float frame = RNA_float_get(op->ptr, "frame"); /* this isn't technically "frame", but it'll do... */ + /* this isn't technically "frame", but it'll do... */ + float frame = RNA_float_get(op->ptr, "frame"); /* adjust the frame or the cursor x-value */ if (sipo->mode == SIPO_MODE_DRIVERS) { @@ -265,7 +266,8 @@ static int graphview_curves_hide_exec(bContext *C, wmOperator *op) ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); for (ale = anim_data.first; ale; ale = ale->next) { - /* hack: skip object channels for now, since flushing those will always flush everything, but they are always included */ + /* hack: skip object channels for now, since flushing those will always flush everything, + * but they are always included */ /* TODO: find out why this is the case, and fix that */ if (ale->type == ANIMTYPE_OBJECT) continue; @@ -291,7 +293,9 @@ static int graphview_curves_hide_exec(bContext *C, wmOperator *op) ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); for (ale = anim_data.first; ale; ale = ale->next) { - /* hack: skip object channels for now, since flushing those will always flush everything, but they are always included */ + /* hack: skip object channels for now, since flushing those + * will always flush everything, but they are always included */ + /* TODO: find out why this is the case, and fix that */ if (ale->type == ANIMTYPE_OBJECT) continue; @@ -359,7 +363,8 @@ static int graphview_curves_reveal_exec(bContext *C, wmOperator *op) ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); for (ale = anim_data.first; ale; ale = ale->next) { - /* hack: skip object channels for now, since flushing those will always flush everything, but they are always included */ + /* hack: skip object channels for now, since flushing those will always flush everything, + * but they are always included. */ /* TODO: find out why this is the case, and fix that */ if (ale->type == ANIMTYPE_OBJECT) continue; diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index cbea292c4ec..f053c9f74fe 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -1421,7 +1421,8 @@ static void mouse_graph_keys(bAnimContext *ac, const int mval[2], short select_m } /* set active F-Curve (NOTE: sync the filter flags with findnearest_fcurve_vert) */ - /* needs to be called with (sipo->flag & SIPO_SELCUVERTSONLY) otherwise the active flag won't be set [#26452] */ + /* needs to be called with (sipo->flag & SIPO_SELCUVERTSONLY) + * otherwise the active flag won't be set T26452. */ if (nvi->fcu->flag & FCURVE_SELECTED) { int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS); ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, nvi->fcu, nvi->ctype); @@ -1431,7 +1432,8 @@ static void mouse_graph_keys(bAnimContext *ac, const int mval[2], short select_m MEM_freeN(nvi); } -/* Option 2) Selects all the keyframes on either side of the current frame (depends on which side the mouse is on) */ +/* Option 2) Selects all the keyframes on either side of the current frame + * (depends on which side the mouse is on) */ /* (see graphkeys_select_leftright) */ /* Option 3) Selects all visible keyframes in the same frame as the mouse click */ diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 27e401c8948..4e37b0c7b3f 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -306,7 +306,8 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar) /* cursor x-value */ float x = sipo->cursorTime; - /* to help differentiate this from the current frame, draw slightly darker like the horizontal one */ + /* to help differentiate this from the current frame, + * draw slightly darker like the horizontal one */ immUniformThemeColorShadeAlpha(TH_CFRAME, -40, -50); GPU_blend(true); GPU_line_width(2.0); @@ -362,7 +363,10 @@ static void graph_channel_region_init(wmWindowManager *wm, ARegion *ar) /* make sure we keep the hide flags */ ar->v2d.scroll |= V2D_SCROLL_RIGHT; - ar->v2d.scroll &= ~(V2D_SCROLL_LEFT | V2D_SCROLL_TOP | V2D_SCROLL_BOTTOM); /* prevent any noise of past */ + + /* prevent any noise of past */ + ar->v2d.scroll &= ~(V2D_SCROLL_LEFT | V2D_SCROLL_TOP | V2D_SCROLL_BOTTOM); + ar->v2d.scroll |= V2D_SCROLL_HORIZONTAL_HIDE; ar->v2d.scroll |= V2D_SCROLL_VERTICAL_HIDE; @@ -576,7 +580,8 @@ static void graph_listener(wmWindow *UNUSED(win), ScrArea *sa, wmNotifier *wmn, /* context changes */ switch (wmn->category) { case NC_ANIMATION: - /* for selection changes of animation data, we can just redraw... otherwise autocolor might need to be done again */ + /* for selection changes of animation data, we can just redraw... + * otherwise autocolor might need to be done again */ if (ELEM(wmn->data, ND_KEYFRAME, ND_ANIMCHAN) && (wmn->action == NA_SELECTED)) ED_area_tag_redraw(sa); else @@ -584,7 +589,8 @@ static void graph_listener(wmWindow *UNUSED(win), ScrArea *sa, wmNotifier *wmn, break; case NC_SCENE: switch (wmn->data) { - case ND_OB_ACTIVE: /* selection changed, so force refresh to flush (needs flag set to do syncing) */ + case ND_OB_ACTIVE: /* selection changed, so force refresh to flush + * (needs flag set to do syncing) */ case ND_OB_SELECT: sipo->runtime.flag |= SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC; ED_area_tag_refresh(sa); @@ -597,7 +603,8 @@ static void graph_listener(wmWindow *UNUSED(win), ScrArea *sa, wmNotifier *wmn, break; case NC_OBJECT: switch (wmn->data) { - case ND_BONE_SELECT: /* selection changed, so force refresh to flush (needs flag set to do syncing) */ + case ND_BONE_SELECT: /* selection changed, so force refresh to flush + * (needs flag set to do syncing) */ case ND_BONE_ACTIVE: sipo->runtime.flag |= SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC; ED_area_tag_refresh(sa); @@ -877,7 +884,8 @@ void ED_spacetype_ipo(void) /* regions: channels */ art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region"); art->regionid = RGN_TYPE_CHANNELS; - art->prefsizex = 200 + V2D_SCROLL_WIDTH; /* 200 is the 'standard', but due to scrollers, we want a bit more to fit the lock icons in */ + /* 200 is the 'standard', but due to scrollers, we want a bit more to fit the lock icons in */ + art->prefsizex = 200 + V2D_SCROLL_WIDTH; art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES; art->listener = graph_region_listener; art->message_subscribe = graph_region_message_subscribe; -- cgit v1.2.3