From 33e554799bd69e888b5114ba92871f8de94a8597 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 27 Jun 2011 03:36:14 +0000 Subject: Minor warning cleanup & fix - comment/remove assignments from values to themselves. - add case break statements (no functional change but some source code checkers notice). - fix python errors when the sculpt brush is None. --- intern/iksolver/intern/IK_QSegment.cpp | 3 --- intern/itasc/ConstraintSet.cpp | 1 + release/scripts/startup/bl_ui/space_view3d.py | 17 +++++++++-------- release/scripts/startup/bl_ui/space_view3d_toolbar.py | 10 +++++++++- source/blender/editors/object/object_bake.c | 1 - .../blender/editors/transform/transform_constraints.c | 8 ++++---- .../blender/nodes/intern/CMP_nodes/CMP_channelMatte.c | 1 + source/blender/nodes/intern/CMP_nodes/CMP_glare.c | 1 + source/blender/nodes/intern/CMP_nodes/CMP_rotate.c | 1 + source/blender/python/generic/mathutils_Matrix.c | 2 +- .../gameengine/Physics/Bullet/CcdPhysicsController.cpp | 1 + .../gameengine/Physics/Bullet/CcdPhysicsEnvironment.h | 2 +- 12 files changed, 29 insertions(+), 19 deletions(-) diff --git a/intern/iksolver/intern/IK_QSegment.cpp b/intern/iksolver/intern/IK_QSegment.cpp index 237edfd4594..df4fbc8fadd 100644 --- a/intern/iksolver/intern/IK_QSegment.cpp +++ b/intern/iksolver/intern/IK_QSegment.cpp @@ -905,9 +905,6 @@ void IK_QElbowSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax) lmin = MT_clamp(lmin, -MT_PI, MT_PI); lmax = MT_clamp(lmax, -MT_PI, MT_PI); - lmin = lmin; - lmax = lmax; - if (axis == 1) { m_min_twist = lmin; m_max_twist = lmax; diff --git a/intern/itasc/ConstraintSet.cpp b/intern/itasc/ConstraintSet.cpp index 3b50e353758..b07dc5bb983 100644 --- a/intern/itasc/ConstraintSet.cpp +++ b/intern/itasc/ConstraintSet.cpp @@ -134,6 +134,7 @@ bool ConstraintSet::setControlParameter(int id, ConstraintAction action, double break; default: assert(action==ACT_NONE); + break; } return setControlParameters(&values, 1, timestep); } diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index aead20f76e3..b989085939f 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -1106,17 +1106,18 @@ class VIEW3D_MT_sculpt(bpy.types.Menu): layout.operator_menu_enum("brush.curve_preset", "shape") layout.separator() - sculpt_tool = brush.sculpt_tool + if brush is not None: # unlikely but can happen + sculpt_tool = brush.sculpt_tool - if sculpt_tool != 'GRAB': - layout.prop_menu_enum(brush, "stroke_method") + if sculpt_tool != 'GRAB': + layout.prop_menu_enum(brush, "stroke_method") - if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}: - layout.prop_menu_enum(brush, "direction") + if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}: + layout.prop_menu_enum(brush, "direction") - if sculpt_tool == 'LAYER': - layout.prop(brush, "use_persistent") - layout.operator("sculpt.set_persistent_base") + if sculpt_tool == 'LAYER': + layout.prop(brush, "use_persistent") + layout.operator("sculpt.set_persistent_base") layout.separator() layout.prop(sculpt, "use_threaded", text="Threaded Sculpt") diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 503a1d806ac..52eb76d0710 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -997,7 +997,11 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel): @classmethod def poll(cls, context): - return (context.sculpt_object and context.tool_settings.sculpt) or (context.vertex_paint_object and context.tool_settings.vertex_paint) or (context.weight_paint_object and context.tool_settings.weight_paint) or (context.image_paint_object and context.tool_settings.image_paint) + ts = context.tool_settings + return ((context.sculpt_object and ts.sculpt) or + (context.vertex_paint_object and ts.vertex_paint) or + (context.weight_paint_object and ts.weight_paint) or + (context.image_paint_object and ts.image_paint)) def draw(self, context): layout = self.layout @@ -1005,6 +1009,10 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel): settings = __class__.paint_settings(context) brush = settings.brush + if brush is None: # unlikely but can happen + layout.label(text="Brush Unset") + return + col = layout.column() if context.sculpt_object and context.tool_settings.sculpt: diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index cc9a6f7f5f0..57f6c9de88e 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -852,7 +852,6 @@ static void finish_images(MultiresBakeRender *bkr) for(link= bkr->image.first; link; link= link->next) { Image *ima= (Image*)link->data; - int i; ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL); if(ibuf->x<=0 || ibuf->y<=0) diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 0ca0812f050..be5f539431f 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -105,8 +105,8 @@ void constraintNumInput(TransInfo *t, float vec[3]) if (getConstraintSpaceDimension(t) == 2) { int axis = mode & (CON_AXIS0|CON_AXIS1|CON_AXIS2); if (axis == (CON_AXIS0|CON_AXIS1)) { - vec[0] = vec[0]; - vec[1] = vec[1]; + /* vec[0] = vec[0]; */ /* same */ + /* vec[1] = vec[1]; */ /* same */ vec[2] = nval; } else if (axis == (CON_AXIS1|CON_AXIS2)) { @@ -115,14 +115,14 @@ void constraintNumInput(TransInfo *t, float vec[3]) vec[0] = nval; } else if (axis == (CON_AXIS0|CON_AXIS2)) { - vec[0] = vec[0]; + /* vec[0] = vec[0]; */ /* same */ vec[2] = vec[1]; vec[1] = nval; } } else if (getConstraintSpaceDimension(t) == 1) { if (mode & CON_AXIS0) { - vec[0] = vec[0]; + /* vec[0] = vec[0]; */ /* same */ vec[1] = nval; vec[2] = nval; } diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c index b32c531d8f9..e395716f36d 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c @@ -97,6 +97,7 @@ static void do_channel_matte(bNode *node, float *out, float *in) default: break; } + break; } default: break; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_glare.c b/source/blender/nodes/intern/CMP_nodes/CMP_glare.c index 1a339b45a05..2e0822a4511 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_glare.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_glare.c @@ -467,6 +467,7 @@ static void node_composit_exec_glare(void *UNUSED(data), bNode *node, bNodeStack case 2: default: streaks(ndg, new, src); + break; } free_compbuf(src); diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c index b6b1764ff0f..eccac4f0e6d 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c @@ -97,6 +97,7 @@ static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStac break; case 2: bicubic_interpolation(ibuf, obuf, u, v, xo, yo); + break; } } diff --git a/source/blender/python/generic/mathutils_Matrix.c b/source/blender/python/generic/mathutils_Matrix.c index 4b7f9dc0d97..bed7dd12f08 100644 --- a/source/blender/python/generic/mathutils_Matrix.c +++ b/source/blender/python/generic/mathutils_Matrix.c @@ -779,7 +779,7 @@ static PyObject *Matrix_resize_4x4(MatrixObject *self) for(blank_columns = (4 - self->col_size); blank_columns > 0; blank_columns--){ self->contigPtr[new_pos + blank_columns] = 0.0f; } - for(curr_pos = curr_pos; curr_pos >= first_row_elem; curr_pos--){ + for( ; curr_pos >= first_row_elem; curr_pos--){ self->contigPtr[new_pos] = self->contigPtr[curr_pos]; new_pos--; } diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index 0c5cbb22fbc..2bc11ef5f5b 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -2142,6 +2142,7 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin, b } collisionShape = compoundShape; } + break; } return collisionShape; } diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h index 51e00b9111f..18e1282b111 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h @@ -128,7 +128,7 @@ protected: virtual void setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep) { //based on DEFAULT_PHYSICS_TIC_RATE of 60 hertz - setNumTimeSubSteps(fixedTimeStep/60.f); + setNumTimeSubSteps((int)(fixedTimeStep / 60.f)); } //returns 0.f if no fixed timestep is used -- cgit v1.2.3