style cleanup

This commit is contained in:
Campbell Barton 2013-01-15 23:45:41 +00:00
parent 769ab3eed8
commit 761ac89877
10 changed files with 102 additions and 75 deletions

@ -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;
}
}

@ -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");

@ -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));

@ -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;

@ -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;

@ -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));

@ -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);

@ -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;
}

@ -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));

@ -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 :)