diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-21 17:18:34 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-21 23:30:04 +0300 |
commit | 0ac990d088d553c27f5360f62e142e99f087890a (patch) | |
tree | ef3637e9f8086bc937b56777ea9b1f36f97790a4 /source/blender/editors/space_graph | |
parent | f8b2268f4fbe92a1860c525f70fdc293304575ff (diff) |
Cleanup: comments (long lines) in editors
Diffstat (limited to 'source/blender/editors/space_graph')
-rw-r--r-- | source/blender/editors/space_graph/graph_buttons.c | 18 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_draw.c | 20 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_edit.c | 63 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_ops.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_select.c | 24 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_utils.c | 24 | ||||
-rw-r--r-- | source/blender/editors/space_graph/space_graph.c | 12 |
7 files changed, 106 insertions, 63 deletions
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 20ddf434f5f..f8f75234852 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -76,8 +76,10 @@ static int graph_panel_context(const bContext *C, bAnimListElem **ale, FCurve ** bAnimContext ac; bAnimListElem *elem = NULL; - /* for now, only draw if we could init the anim-context info (necessary for all animation-related tools) - * to work correctly is able to be correctly retrieved. There's no point showing empty panels? + /* For now, only draw if we could init the anim-context info + * (necessary for all animation-related tools) + * to work correctly is able to be correctly retrieved. + * There's no point showing empty panels? */ if (ANIM_animdata_get_context(C, &ac) == 0) return 0; @@ -869,7 +871,8 @@ static void graph_draw_driven_property_panel(uiLayout *layout, ID *id, FCurve *f uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_LEFT); /* -> user friendly 'name' for datablock that owns F-Curve */ - /* XXX: Actually, we may need the datablock icons only... (e.g. right now will show bone for bone props) */ + /* XXX: Actually, we may need the datablock icons only... + * (e.g. right now will show bone for bone props). */ uiItemL(row, id->name + 2, icon); /* -> user friendly 'name' for F-Curve/driver target */ @@ -915,7 +918,8 @@ static void graph_draw_driver_settings_panel(uiLayout *layout, uiItemS(layout); uiItemS(layout); - /* show expression box if doing scripted drivers, and/or error messages when invalid drivers exist */ + /* show expression box if doing scripted drivers, + * and/or error messages when invalid drivers exist */ if (driver->type == DRIVER_TYPE_PYTHON) { bool bpy_data_expr_error = (strstr(driver->expression, "bpy.data.") != NULL); bool bpy_ctx_expr_error = (strstr(driver->expression, "bpy.context.") != NULL); @@ -1190,7 +1194,8 @@ static void graph_draw_driver_settings_panel(uiLayout *layout, /* ----------------------------------------------------------------- */ -/* panel to show property driven by the driver (in Drivers Editor) - duplicates Active FCurve, but useful for clarity */ +/* Panel to show property driven by the driver (in Drivers Editor) - duplicates Active FCurve, + * but useful for clarity. */ static void graph_panel_driven_property(const bContext *C, Panel *pa) { bAnimListElem *ale; @@ -1223,7 +1228,8 @@ static void graph_panel_drivers(const bContext *C, Panel *pa) /* ----------------------------------------------------------------- */ -/* poll to make this not show up in the graph editor, as this is only to be used as a popup elsewhere */ +/* Poll to make this not show up in the graph editor, + * as this is only to be used as a popup elsewhere. */ static bool graph_panel_drivers_popover_poll(const bContext *C, PanelType *UNUSED(pt)) { return ED_operator_graphedit_active((bContext *)C) == false; diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 36c3ec21d2a..3c41b076738 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -175,8 +175,9 @@ static void draw_fcurve_selected_keyframe_vertices( BezTriple *bezt = fcu->bezt; for (int i = 0; i < fcu->totvert; i++, bezt++) { - /* as an optimization step, only draw those in view - * - we apply a correction factor to ensure that points don't pop in/out due to slight twitches of view size + /* As an optimization step, only draw those in view + * - We apply a correction factor to ensure that points + * don't pop in/out due to slight twitches of view size. */ if (IN_RANGE(bezt->vec[1][0], (v2d->cur.xmin - fac), (v2d->cur.xmax + fac))) { if (edit) { @@ -281,9 +282,10 @@ static void draw_fcurve_vertices(ARegion *ar, FCurve *fcu, bool do_handles, bool View2D *v2d = &ar->v2d; /* only draw points if curve is visible - * - draw unselected points before selected points as separate passes + * - Draw unselected points before selected points as separate passes * to make sure in the case of overlapping points that the selected is always visible - * - draw handles before keyframes, so that keyframes will overlap handles (keyframes are more important for users) + * - Draw handles before keyframes, so that keyframes will overlap handles + * (keyframes are more important for users). */ uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -484,7 +486,8 @@ static void draw_fcurve_samples(SpaceGraph *sipo, ARegion *ar, FCurve *fcu) /* Curve ---------------- */ -/* helper func - just draw the F-Curve by sampling the visible region (for drawing curves with modifiers) */ +/* Helper func - just draw the F-Curve by sampling the visible region + * (for drawing curves with modifiers). */ static void draw_fcurve_curve( bAnimContext *ac, ID *id, FCurve *fcu_, View2D *v2d, View2DGrid *grid, unsigned int pos) { @@ -496,8 +499,8 @@ static void draw_fcurve_curve( short mapping_flag = ANIM_get_normalization_flags(ac); int i, n; - /* when opening a blend file on a different sized screen or while dragging the toolbar this can happen - * best just bail out in this case */ + /* when opening a blend file on a different sized screen or while dragging the toolbar this can + * happen best just bail out in this case. */ UI_view2d_grid_size(grid, &dx, &dy); if (dx <= 0.0f) return; @@ -523,7 +526,8 @@ static void draw_fcurve_curve( */ /* 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? */ + /* 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); if (sipo->flag & SIPO_BEAUTYDRAW_OFF) { diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 29058e47199..a526ada2300 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -230,8 +230,8 @@ void GRAPH_OT_previewrange_set(wmOperatorType *ot) /* api callbacks */ ot->exec = graphkeys_previewrange_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; @@ -447,7 +447,8 @@ static int graphkeys_create_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op) if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; - /* ghost curves are snapshots of the visible portions of the curves, so set range to be the visible range */ + /* Ghost curves are snapshots of the visible portions of the curves, + * so set range to be the visible range. */ v2d = &ac.ar->v2d; start = (int)v2d->cur.xmin; end = (int)v2d->cur.xmax; @@ -638,13 +639,17 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode) FCurve *fcu = (FCurve *)ale->key_data; float cfra = (float)CFRA; - /* read value from property the F-Curve represents, or from the curve only? - * - ale->id != NULL: Typically, this means that we have enough info to try resolving the path - * - ale->owner != NULL: If this is set, then the path may not be resolvable from the ID alone, - * so it's easier for now to just read the F-Curve directly. - * (TODO: add the full-blown PointerRNA relative parsing case here...) - * - fcu->driver != NULL: If this is set, then it's a driver. If we don't check for this, we'd end - * up adding the keyframes on a new F-Curve in the action data instead. + /* Read value from property the F-Curve represents, or from the curve only? + * + * - ale->id != NULL: + * Typically, this means that we have enough info to try resolving the path. + * - ale->owner != NULL: + * If this is set, then the path may not be resolvable from the ID alone, + * so it's easier for now to just read the F-Curve directly. + * (TODO: add the full-blown PointerRNA relative parsing case here...) + * - fcu->driver != NULL: + * If this is set, then it's a driver. If we don't check for this, we'd end + * up adding the keyframes on a new F-Curve in the action data instead. */ if (ale->id && !ale->owner && !fcu->driver) { insert_keyframe(ac->bmain, @@ -760,9 +765,9 @@ static int graphkeys_click_insert_exec(bContext *C, wmOperator *op) /* preserve selection? */ if (RNA_boolean_get(op->ptr, "extend") == false) { - /* deselect all keyframes first, so that we can immediately start manipulating the newly added one(s) - * - only affect the keyframes themselves, as we don't want channels popping in and out... - */ + /* Deselect all keyframes first, + * so that we can immediately start manipulating the newly added one(s) + * - only affect the keyframes themselves, as we don't want channels popping in and out. */ deselect_graph_keys(&ac, false, SELECT_SUBTRACT, false); } @@ -1755,8 +1760,9 @@ static void setipo_graph_keys(bAnimContext *ac, short mode) ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); - /* loop through setting BezTriple interpolation - * Note: we do not supply KeyframeEditData to the looper yet. Currently that's not necessary here... + /* Loop through setting BezTriple interpolation + * Note: we do not supply KeyframeEditData to the looper yet. + * Currently that's not necessary here. */ for (ale = anim_data.first; ale; ale = ale->next) { ANIM_fcurve_keyframes_loop(NULL, ale->key_data, NULL, set_cb, calchandles_fcurve); @@ -1826,8 +1832,9 @@ static void seteasing_graph_keys(bAnimContext *ac, short mode) ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); - /* loop through setting BezTriple easing - * Note: we do not supply KeyframeEditData to the looper yet. Currently that's not necessary here... + /* Loop through setting BezTriple easing. + * Note: we do not supply KeyframeEditData to the looper yet. + * Currently that's not necessary here. */ for (ale = anim_data.first; ale; ale = ale->next) { ANIM_fcurve_keyframes_loop(NULL, ale->key_data, NULL, set_cb, calchandles_fcurve); @@ -1898,8 +1905,9 @@ static void sethandles_graph_keys(bAnimContext *ac, short mode) ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); - /* loop through setting flags for handles - * Note: we do not supply KeyframeEditData to the looper yet. Currently that's not necessary here... + /* Loop through setting flags for handles. + * Note: we do not supply KeyframeEditData to the looper yet. + * Currently that's not necessary here. */ for (ale = anim_data.first; ale; ale = ale->next) { FCurve *fcu = (FCurve *)ale->key_data; @@ -2081,8 +2089,10 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op) continue; } - /* simple method: just treat any difference between keys of greater than 180 degrees as being a flip */ - /* FIXME: there are more complicated methods that will be needed to fix more cases than just some */ + /* Simple method: just treat any difference between + * keys of greater than 180 degrees as being a flip. */ + /* FIXME: there are more complicated methods that + * will be needed to fix more cases than just some */ for (f = 0; f < 3; f++) { FCurve *fcu = euf->fcurves[f]; BezTriple *bezt, *prev; @@ -2787,7 +2797,13 @@ void GRAPH_OT_fmodifier_copy(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* id-props */ - //ot->prop = RNA_def_boolean(ot->srna, "all", 1, "All F-Modifiers", "Copy all the F-Modifiers, instead of just the active one"); +#if 0 + ot->prop = RNA_def_boolean(ot->srna, + "all", + 1, + "All F-Modifiers", + "Copy all the F-Modifiers, instead of just the active one"); +#endif } /* ******************** Paste F-Modifiers Operator *********************** */ @@ -2814,7 +2830,8 @@ static int graph_fmodifier_paste_exec(bContext *C, wmOperator *op) ANIMFILTER_NODUPLIS); } else { - /* This is only if the operator gets called from a hotkey or search - Paste to all visible curves */ + /* This is only if the operator gets called from a hotkey or search - + * Paste to all visible curves. */ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); } diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index f80041ff586..30f3960e18a 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -493,9 +493,11 @@ void graphedit_keymap(wmKeyConfig *keyconf) WM_keymap_ensure(keyconf, "Graph Editor Generic", SPACE_GRAPH, 0); /* channels */ - /* Channels are not directly handled by the Graph Editor module, but are inherited from the Animation module. - * All the relevant operations, keymaps, drawing, etc. can therefore all be found in that module instead, as these - * are all used for the Graph Editor too. + /* Channels are not directly handled by the Graph Editor module, + * but are inherited from the Animation module. + * All the relevant operations, keymaps, drawing, etc. + * can therefore all be found in that module instead, + * as these are all used for the Graph Editor too. */ /* keyframes */ diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index a109282978c..05d0ba38461 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -216,7 +216,8 @@ void GRAPH_OT_select_all(wmOperatorType *ot) * -> BKEY - 1) all keyframes within region are selected (validation with BEZT_OK_REGION) * -> ALT-BKEY - depending on which axis of the region was larger... * -> 2) x-axis, so select all frames within frame range (validation with BEZT_OK_FRAMERANGE) - * -> 3) y-axis, so select all frames within channels that region included (validation with BEZT_OK_VALUERANGE) + * -> 3) y-axis, so select all frames within channels that region included + * (validation with BEZT_OK_VALUERANGE). * * The selection backend is also reused for the Lasso and Circle select operators. */ @@ -243,7 +244,8 @@ static void box_select_graphkeys(bAnimContext *ac, View2D *v2d = &ac->ar->v2d; rctf rectf, scaled_rectf; - /* convert mouse coordinates to frame ranges and channel coordinates corrected for view pan/zoom */ + /* Convert mouse coordinates to frame ranges and + * channel coordinates corrected for view pan/zoom. */ UI_view2d_region_to_view_rctf(v2d, rectf_view, &rectf); /* filter data */ @@ -362,9 +364,11 @@ static int graphkeys_box_select_exec(bContext *C, wmOperator *op) /* selection 'mode' depends on whether box_select region only matters on one axis */ if (RNA_boolean_get(op->ptr, "axis_range")) { /* mode depends on which axis of the range is larger to determine which axis to use - * - checking this in region-space is fine, as it's fundamentally still going to be a different rect size - * - the frame-range select option is favored over the channel one (x over y), as frame-range one is often - * used for tweaking timing when "blocking", while channels is not that useful... + * - Checking this in region-space is fine, as it's fundamentally still going to be a + * different rect size. + * - The frame-range select option is favored over the channel one (x over y), + * as frame-range one is often used for tweaking timing when "blocking", + * while channels is not that useful. */ if ((BLI_rcti_size_x(&rect)) >= (BLI_rcti_size_y(&rect))) mode = BEZT_OK_FRAMERANGE; @@ -1319,8 +1323,11 @@ static tNearestVertInfo *get_best_nearest_fcurve_vert(ListBase *matches) return BLI_pophead(matches); } -/* Find the nearest vertices (either a handle or the keyframe) that are nearest to the mouse cursor (in area coordinates) - * NOTE: the match info found must still be freed +/** + * Find the nearest vertices (either a handle or the keyframe) + * that are nearest to the mouse cursor (in area coordinates) + * + * \note the match info found must still be freed. */ static tNearestVertInfo *find_nearest_fcurve_vert(bAnimContext *ac, const int mval[2]) { @@ -1445,7 +1452,8 @@ static void mouse_graph_keys(bAnimContext *ac, nvi->fcu->flag &= ~FCURVE_SELECTED; } else { - /* didn't hit any channel, so just apply that selection mode to the curve's selection status */ + /* Didn't hit any channel, + * so just apply that selection mode to the curve's selection status. */ if (select_mode == SELECT_INVERT) nvi->fcu->flag ^= FCURVE_SELECTED; else if (select_mode == SELECT_ADD) diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c index 8029f0b796e..d8cb173f944 100644 --- a/source/blender/editors/space_graph/graph_utils.c +++ b/source/blender/editors/space_graph/graph_utils.c @@ -91,11 +91,14 @@ void ED_drivers_editor_init(bContext *C, ScrArea *sa) /* ************************************************************** */ /* Active F-Curve */ -/* Find 'active' F-Curve. It must be editable, since that's the purpose of these buttons (subject to change). - * We return the 'wrapper' since it contains valuable context info (about hierarchy), which will need to be freed - * when the caller is done with it. +/** + * Find 'active' F-Curve. + * It must be editable, since that's the purpose of these buttons (subject to change). + * We return the 'wrapper' since it contains valuable context info (about hierarchy), + * which will need to be freed when the caller is done with it. * - * NOTE: curve-visible flag isn't included, otherwise selecting a curve via list to edit is too cumbersome + * \note curve-visible flag isn't included, + * otherwise selecting a curve via list to edit is too cumbersome. */ bAnimListElem *get_active_fcurve_channel(bAnimContext *ac) { @@ -244,9 +247,10 @@ bool graphop_active_fcurve_poll(bContext *C) if (ale == NULL) return 0; - /* do we have a suitable F-Curves? - * - For most cases, NLA Control Curves are sufficiently similar to NLA curves to serve this role too. - * Under the hood, they are F-Curves too. The only problems which will arise here are if these need to be + /* Do we have a suitable F-Curves? + * - For most cases, NLA Control Curves are sufficiently similar to NLA + * curves to serve this role too. Under the hood, they are F-Curves too. + * The only problems which will arise here are if these need to be * in an Action too (but drivers would then also be affected!) */ has_fcurve = ((ale->data) && ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE)); @@ -280,9 +284,9 @@ bool graphop_selected_fcurve_poll(bContext *C) if (ANIM_animdata_get_context(C, &ac) == 0) return 0; - /* get the editable + selected F-Curves, and as long as we got some, we can return - * NOTE: curve-visible flag isn't included, otherwise selecting a curve via list to edit is too cumbersome - */ + /* Get the editable + selected F-Curves, and as long as we got some, we can return. + * NOTE: curve-visible flag isn't included, + * otherwise selecting a curve via list to edit is too cumbersome. */ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT); items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); if (items == 0) diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 8fb5cb1d18a..7f6ee09813a 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -655,13 +655,15 @@ static void graph_refresh_fcurve_colors(const bContext *C) /* set color of curve here */ switch (fcu->color_mode) { case FCURVE_COLOR_CUSTOM: { - /* User has defined a custom color for this curve already (we assume it's not going to cause clashes with text colors), + /* User has defined a custom color for this curve already + * (we assume it's not going to cause clashes with text colors), * which should be left alone... Nothing needs to be done here. */ break; } case FCURVE_COLOR_AUTO_RGB: { - /* F-Curve's array index is automatically mapped to RGB values. This works best of 3-value vectors. + /* F-Curve's array index is automatically mapped to RGB values. + * This works best of 3-value vectors. * TODO: find a way to module the hue so that not all curves have same color... */ float *col = fcu->color; @@ -765,9 +767,9 @@ static void graph_refresh(const bContext *C, ScrArea *sa) /* region updates? */ // XXX re-sizing y-extents of tot should go here? - /* update the state of the animchannels in response to changes from the data they represent - * NOTE: the temp flag is used to indicate when this needs to be done, and will be cleared once handled - */ + /* Update the state of the animchannels in response to changes from the data they represent + * NOTE: the temp flag is used to indicate when this needs to be done, + * and will be cleared once handled. */ if (sipo->runtime.flag & SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC) { ANIM_sync_animchannels_to_data(C); sipo->runtime.flag &= ~SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC; |