From 761ac8987799050c860f2b649d626aaa4258a8bd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Jan 2013 23:45:41 +0000 Subject: style cleanup --- source/blender/blenlib/intern/noise.c | 24 ++++--- source/blender/collada/CameraExporter.cpp | 3 +- source/blender/compositor/nodes/COM_ScaleNode.cpp | 22 +++--- .../operations/COM_ChannelMatteOperation.cpp | 15 ++-- source/blender/editors/mesh/editmesh_loopcut.c | 3 +- source/blender/makesrna/intern/makesrna.c | 3 +- source/blender/makesrna/intern/rna_access.c | 15 ++-- source/blender/windowmanager/intern/wm_playanim.c | 3 +- source/gameengine/Expressions/InputParser.cpp | 6 +- source/gameengine/Expressions/Operator2Expr.cpp | 83 +++++++++++----------- 10 files changed, 102 insertions(+), 75 deletions(-) diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index f37e1e03f39..c159f707b98 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -1460,7 +1460,8 @@ float BLI_gNoise(float noisesize, float x, float y, float z, int hard, int noise noisefunc = cellNoiseU; break; case 0: - default: { + default: + { noisefunc = orgBlenderNoise; /* add one to make return value same as BLI_hnoise */ x += 1; @@ -1592,7 +1593,8 @@ float mg_fBm(float x, float y, float z, float H, float lacunarity, float octaves noisefunc = cellNoise; break; case 0: - default: { + default: + { noisefunc = orgBlenderNoiseS; } } @@ -1662,7 +1664,8 @@ float mg_MultiFractal(float x, float y, float z, float H, float lacunarity, floa noisefunc = cellNoise; break; case 0: - default: { + default: + { noisefunc = orgBlenderNoiseS; } } @@ -1728,7 +1731,8 @@ float mg_HeteroTerrain(float x, float y, float z, float H, float lacunarity, flo noisefunc = cellNoise; break; case 0: - default: { + default: + { noisefunc = orgBlenderNoiseS; } } @@ -1801,7 +1805,8 @@ float mg_HybridMultiFractal(float x, float y, float z, float H, float lacunarity noisefunc = cellNoise; break; case 0: - default: { + default: + { noisefunc = orgBlenderNoiseS; } } @@ -1876,7 +1881,8 @@ float mg_RidgedMultiFractal(float x, float y, float z, float H, float lacunarity noisefunc = cellNoise; break; case 0: - default: { + default: + { noisefunc = orgBlenderNoiseS; } } @@ -1941,7 +1947,8 @@ float mg_VLNoise(float x, float y, float z, float distortion, int nbas1, int nba noisefunc1 = cellNoise; break; case 0: - default: { + default: + { noisefunc1 = orgBlenderNoiseS; } } @@ -1975,7 +1982,8 @@ float mg_VLNoise(float x, float y, float z, float distortion, int nbas1, int nba noisefunc2 = cellNoise; break; case 0: - default: { + default: + { noisefunc2 = orgBlenderNoiseS; } } diff --git a/source/blender/collada/CameraExporter.cpp b/source/blender/collada/CameraExporter.cpp index 7d438f7f12f..fc56ff8c63c 100644 --- a/source/blender/collada/CameraExporter.cpp +++ b/source/blender/collada/CameraExporter.cpp @@ -70,7 +70,8 @@ void CamerasExporter::operator()(Object *ob, Scene *sce) switch (cam->type) { case CAM_PANO: - case CAM_PERSP: { + case CAM_PERSP: + { COLLADASW::PerspectiveOptic persp(mSW); persp.setXFov(RAD2DEGF(focallength_to_fov(cam->lens, cam->sensor_x)), "xfov"); persp.setAspectRatio((float)(sce->r.xsch) / (float)(sce->r.ysch), false, "aspect_ratio"); diff --git a/source/blender/compositor/nodes/COM_ScaleNode.cpp b/source/blender/compositor/nodes/COM_ScaleNode.cpp index 6f7bd33db6f..e139eb83e04 100644 --- a/source/blender/compositor/nodes/COM_ScaleNode.cpp +++ b/source/blender/compositor/nodes/COM_ScaleNode.cpp @@ -43,7 +43,8 @@ void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c bNode *bnode = this->getbNode(); switch (bnode->custom1) { - case CMP_SCALE_RELATIVE: { + case CMP_SCALE_RELATIVE: + { ScaleOperation *operation = new ScaleOperation(); inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph); @@ -51,9 +52,10 @@ void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c inputYSocket->relinkConnections(operation->getInputSocket(2), 2, graph); scaleoperation = operation; + break; } - break; - case CMP_SCALE_SCENEPERCENT: { + case CMP_SCALE_SCENEPERCENT: + { SetValueOperation *scaleFactorOperation = new SetValueOperation(); scaleFactorOperation->setValue(context->getRenderData()->size / 100.0f); ScaleOperation *operation = new ScaleOperation(); @@ -63,10 +65,10 @@ void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c graph->addOperation(scaleFactorOperation); scaleoperation = operation; + break; } - break; - - case CMP_SCALE_RENDERPERCENT: { + case CMP_SCALE_RENDERPERCENT: + { const RenderData *rd = context->getRenderData(); ScaleFixedSizeOperation *operation = new ScaleFixedSizeOperation(); @@ -81,10 +83,10 @@ void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c operation->getInputSocket(0)->getConnection()->setIgnoreResizeCheck(true); scaleoperation = operation; + break; } - break; - - case CMP_SCALE_ABSOLUTE: { + case CMP_SCALE_ABSOLUTE: + { ScaleAbsoluteOperation *operation = new ScaleAbsoluteOperation(); // TODO: what is the use of this one.... perhaps some issues when the ui was updated.... inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph); @@ -92,8 +94,8 @@ void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c inputYSocket->relinkConnections(operation->getInputSocket(2), 2, graph); scaleoperation = operation; + break; } - break; } outputSocket->relinkConnections(scaleoperation->getOutputSocket(0)); diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp index 234a1c7b1e5..84cc8aad950 100644 --- a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp @@ -38,7 +38,8 @@ void ChannelMatteOperation::initExecution() switch (this->m_limit_method) { /* SINGLE */ - case 0: { + case 0: + { /* 123 / RGB / HSV / YUV / YCC */ const int matte_channel = this->m_matte_channel - 1; const int limit_channel = this->m_limit_channel - 1; @@ -48,21 +49,25 @@ void ChannelMatteOperation::initExecution() break; } /* MAX */ - case 1: { + case 1: + { switch (this->m_matte_channel) { - case 1: { + case 1: + { this->m_ids[0] = 0; this->m_ids[1] = 1; this->m_ids[2] = 2; break; } - case 2: { + case 2: + { this->m_ids[0] = 1; this->m_ids[1] = 0; this->m_ids[2] = 2; break; } - case 3: { + case 3: + { this->m_ids[0] = 2; this->m_ids[1] = 0; this->m_ids[2] = 1; diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 93090a236fe..d1373363992 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -502,7 +502,8 @@ static int loopcut_modal(bContext *C, wmOperator *op, wmEvent *event) ED_region_tag_redraw(lcd->ar); break; - case MOUSEMOVE: { /* mouse moved somewhere to select another loop */ + case MOUSEMOVE: /* mouse moved somewhere to select another loop */ + { float dist = 75.0f; BMEdge *edge; diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 2eacdfd4880..4b512b650a5 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -2466,7 +2466,8 @@ static const char *rna_property_subtypename(PropertySubType type) case PROP_LAYER: return "PROP_LAYER"; case PROP_LAYER_MEMBER: return "PROP_LAYER_MEMBER"; case PROP_PASSWORD: return "PROP_PASSWORD"; - default: { + default: + { /* in case we don't have a type preset that includes the subtype */ if (RNA_SUBTYPE_UNIT(type)) { return rna_property_subtypename(type & ~RNA_SUBTYPE_UNIT(type)); diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 59bcb1506af..eb4b5d5eed9 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -6097,7 +6097,8 @@ int RNA_property_equals(PointerRNA *a, PointerRNA *b, PropertyRNA *prop) /* get and set the default values as appropriate for the various types */ switch (RNA_property_type(prop)) { - case PROP_BOOLEAN: { + case PROP_BOOLEAN: + { if (len) { int fixed_a[16], fixed_b[16]; int *array_a, *array_b; @@ -6122,7 +6123,8 @@ int RNA_property_equals(PointerRNA *a, PointerRNA *b, PropertyRNA *prop) } } - case PROP_INT: { + case PROP_INT: + { if (len) { int fixed_a[16], fixed_b[16]; int *array_a, *array_b; @@ -6147,7 +6149,8 @@ int RNA_property_equals(PointerRNA *a, PointerRNA *b, PropertyRNA *prop) } } - case PROP_FLOAT: { + case PROP_FLOAT: + { if (len) { float fixed_a[16], fixed_b[16]; float *array_a, *array_b; @@ -6172,12 +6175,14 @@ int RNA_property_equals(PointerRNA *a, PointerRNA *b, PropertyRNA *prop) } } - case PROP_ENUM: { + case PROP_ENUM: + { int value = RNA_property_enum_get(a, prop); return value == RNA_property_enum_get(b, prop); } - case PROP_STRING: { + case PROP_STRING: + { char fixed_a[128], fixed_b[128]; int len_a, len_b; char *value_a = RNA_property_string_get_alloc(a, prop, fixed_a, sizeof(fixed_a), &len_a); diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c index 8b387196da7..fd44f4a7169 100644 --- a/source/blender/windowmanager/intern/wm_playanim.c +++ b/source/blender/windowmanager/intern/wm_playanim.c @@ -689,7 +689,8 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void) break; } case GHOST_kEventWindowActivate: - case GHOST_kEventWindowDeactivate: { + case GHOST_kEventWindowDeactivate: + { g_WS.qual &= ~WS_QUAL_MOUSE; break; } diff --git a/source/gameengine/Expressions/InputParser.cpp b/source/gameengine/Expressions/InputParser.cpp index 5a2075d52df..ed89fb13337 100644 --- a/source/gameengine/Expressions/InputParser.cpp +++ b/source/gameengine/Expressions/InputParser.cpp @@ -260,7 +260,8 @@ void CParser::NextSym() opkind = OPless; } break; - case '\"' : { + case '\"' : + { int start; sym = constsym; constkind = stringtype; @@ -464,7 +465,8 @@ CExpression *CParser::Ex(int i) } else { switch (sym) { - case constsym: { + case constsym: + { switch (constkind) { case booltype: e1 = new CConstExpr(new CBoolValue(boolvalue)); diff --git a/source/gameengine/Expressions/Operator2Expr.cpp b/source/gameengine/Expressions/Operator2Expr.cpp index d0240b5ec75..b03d00e7f77 100644 --- a/source/gameengine/Expressions/Operator2Expr.cpp +++ b/source/gameengine/Expressions/Operator2Expr.cpp @@ -113,61 +113,61 @@ and m_rhs } -/* +#if 0 bool COperator2Expr::IsInside(float x, float y, float z,bool bBorderInclude) { bool inside; inside = false; - switch (m_op) - { - case VALUE_ADD_OPERATOR: { - // inside = first || second; // optimized with early out if first is inside - // todo: calculate smallest leaf first ! is much faster... - - bool second;//first ;//,second; - - //first = m_lhs->IsInside(x,y,z); - second = m_rhs->IsInside(x,y,z,bBorderInclude); - if (second) - return true; //early out - - // second = m_rhs->IsInside(x,y,z); + switch (m_op) { + case VALUE_ADD_OPERATOR: + { + // inside = first || second; // optimized with early out if first is inside + // todo: calculate smallest leaf first ! is much faster... - return m_lhs->IsInside(x,y,z,bBorderInclude); - - break; - } - - case VALUE_SUB_OPERATOR: { - //inside = first && !second; // optimized with early out - // todo: same as with add_operator: calc smallest leaf first + bool second;//first ;//,second; - bool second;//first ;//,second; - //first = m_lhs->IsInside(x,y,z); - second = m_rhs->IsInside(x,y,z,bBorderInclude); - if (second) - return false; + //first = m_lhs->IsInside(x,y,z); + second = m_rhs->IsInside(x,y,z,bBorderInclude); + if (second) + return true; //early out - // second space get subtracted -> negate! - //second = m_rhs->IsInside(x,y,z); + // second = m_rhs->IsInside(x,y,z); - return (m_lhs->IsInside(x,y,z,bBorderInclude)); + return m_lhs->IsInside(x,y,z,bBorderInclude); - - break; - } - default:{ - assert(false); - // not yet implemented, only add or sub csg operations - } + break; + } + + case VALUE_SUB_OPERATOR: + { + //inside = first && !second; // optimized with early out + // todo: same as with add_operator: calc smallest leaf first + + bool second;//first ;//,second; + //first = m_lhs->IsInside(x,y,z); + second = m_rhs->IsInside(x,y,z,bBorderInclude); + if (second) + return false; + + // second space get subtracted -> negate! + //second = m_rhs->IsInside(x,y,z); + + return (m_lhs->IsInside(x,y,z,bBorderInclude)); + + + break; + } + default: + { + assert(false); + // not yet implemented, only add or sub csg operations + } } return inside; } - - bool COperator2Expr::IsRightInside(float x, float y, float z,bool bBorderInclude) { return m_rhs->IsInside(x,y,z,bBorderInclude); @@ -177,7 +177,8 @@ bool COperator2Expr::IsLeftInside(float x, float y, float z,bool bBorderInclude) { return m_lhs->IsInside(x,y,z,bBorderInclude); } -*/ +#endif + bool COperator2Expr::NeedsRecalculated() { // added some lines, just for debugging purposes, it could be a one-liner :) -- cgit v1.2.3