diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-01-06 04:35:07 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-01-06 04:35:07 +0300 |
commit | a15189f845efdc78a146813ed8aedb35a043120d (patch) | |
tree | 16c58e070115a8dcc731956b4aa2f6dcf86f46e8 /source/blender/editors/space_graph/space_graph.c | |
parent | 5f64450726e1efbfad97525bb36bfea2c51afa09 (diff) |
fix for clang static check warnings.
- convertblender.c, remove assignments to unused vars.
- readfile.c, fix 2 possible crashes. null pointers were being checked for then used later without checking.
- space_graph.c, use switch statement for automatic color assignment rather then a float array.
Diffstat (limited to 'source/blender/editors/space_graph/space_graph.c')
-rw-r--r-- | source/blender/editors/space_graph/space_graph.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index ff2d233ccdb..b3636f6ccf2 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -538,24 +538,22 @@ static void graph_refresh(const bContext *C, ScrArea *sa) /* 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... */ - - /* standard table of colors to use */ - const float _colorsets[4][3]= - { - {1.0f, 0.0f, 0.0f}, /* red */ - {0.0f, 1.0f, 0.0f}, /* green */ - {0.0f, 0.0f, 1.0f}, /* blue */ - {0.3f, 0.8f, 1.0f}, /* 'unknown' color - bluish so as to not conflict with handles */ - }; - - /* simply copy the relevant color over to the F-Curve */ - if ((fcu->array_index >= 0) && (fcu->array_index < 3)) { - /* if the index is within safe bounds, use index to access table */ - VECCOPY(fcu->color, _colorsets[fcu->array_index]); - } - else { - /* use the 'unknown' color... */ - VECCOPY(fcu->color, _colorsets[3]); + float *col= fcu->color; + + switch(fcu->array_index) { + case 0: + col[0]= 1.0f; col[1]= 0.0f; col[2]= 0.0f; + break; + case 1: + col[0]= 0.0f; col[1]= 1.0f; col[2]= 0.0f; + break; + case 2: + col[0]= 0.0f; col[1]= 0.0f; col[2]= 1.0f; + break; + default: + /* 'unknown' color - bluish so as to not conflict with handles */ + col[0]= 0.3f; col[1]= 0.8f; col[2]= 1.0f; + break; } } break; |