Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.c179
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf_legacy.c17
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c25
-rw-r--r--source/blender/blenkernel/intern/anim_data.c15
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c33
-rw-r--r--source/blender/blenkernel/intern/anim_visualization.c6
-rw-r--r--source/blender/blenkernel/intern/appdir.c42
-rw-r--r--source/blender/blenkernel/intern/armature.c11
-rw-r--r--source/blender/blenkernel/intern/armature_deform.c18
-rw-r--r--source/blender/blenkernel/intern/armature_update.c7
-rw-r--r--source/blender/blenkernel/intern/boids.c159
-rw-r--r--source/blender/blenkernel/intern/bpath.c96
-rw-r--r--source/blender/blenkernel/intern/brush.c11
-rw-r--r--source/blender/blenkernel/intern/cloth.c8
-rw-r--r--source/blender/blenkernel/intern/curve.c67
15 files changed, 299 insertions, 395 deletions
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index 98deddb4316..e035d5cbb68 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -177,9 +177,7 @@ static void *_edge_getCoVert(CCGEdge *e, CCGVert *v, int lvl, int x, int dataSiz
if (v == e->v0) {
return &EDGE_getLevelData(e)[dataSize * (levelBase + x)];
}
- else {
- return &EDGE_getLevelData(e)[dataSize * (levelBase + (1 << lvl) - x)];
- }
+ return &EDGE_getLevelData(e)[dataSize * (levelBase + (1 << lvl) - x)];
}
static void _edge_free(CCGEdge *e, CCGSubSurf *ss)
@@ -260,46 +258,45 @@ CCGSubSurf *ccgSubSurf_new(CCGMeshIFC *ifc,
if (subdivLevels < 1) {
return NULL;
}
- else {
- CCGSubSurf *ss = allocatorIFC->alloc(allocator, sizeof(*ss));
- ss->allocatorIFC = *allocatorIFC;
- ss->allocator = allocator;
+ CCGSubSurf *ss = allocatorIFC->alloc(allocator, sizeof(*ss));
- ss->vMap = ccg_ehash_new(0, &ss->allocatorIFC, ss->allocator);
- ss->eMap = ccg_ehash_new(0, &ss->allocatorIFC, ss->allocator);
- ss->fMap = ccg_ehash_new(0, &ss->allocatorIFC, ss->allocator);
+ ss->allocatorIFC = *allocatorIFC;
+ ss->allocator = allocator;
- ss->meshIFC = *ifc;
+ ss->vMap = ccg_ehash_new(0, &ss->allocatorIFC, ss->allocator);
+ ss->eMap = ccg_ehash_new(0, &ss->allocatorIFC, ss->allocator);
+ ss->fMap = ccg_ehash_new(0, &ss->allocatorIFC, ss->allocator);
- ss->subdivLevels = subdivLevels;
- ss->numGrids = 0;
- ss->allowEdgeCreation = 0;
- ss->defaultCreaseValue = 0;
- ss->defaultEdgeUserData = NULL;
+ ss->meshIFC = *ifc;
- ss->useAgeCounts = 0;
- ss->vertUserAgeOffset = ss->edgeUserAgeOffset = ss->faceUserAgeOffset = 0;
+ ss->subdivLevels = subdivLevels;
+ ss->numGrids = 0;
+ ss->allowEdgeCreation = 0;
+ ss->defaultCreaseValue = 0;
+ ss->defaultEdgeUserData = NULL;
- ss->calcVertNormals = 0;
- ss->normalDataOffset = 0;
+ ss->useAgeCounts = 0;
+ ss->vertUserAgeOffset = ss->edgeUserAgeOffset = ss->faceUserAgeOffset = 0;
- ss->allocMask = 0;
+ ss->calcVertNormals = 0;
+ ss->normalDataOffset = 0;
- ss->q = CCGSUBSURF_alloc(ss, ss->meshIFC.vertDataSize);
- ss->r = CCGSUBSURF_alloc(ss, ss->meshIFC.vertDataSize);
+ ss->allocMask = 0;
- ss->currentAge = 0;
+ ss->q = CCGSUBSURF_alloc(ss, ss->meshIFC.vertDataSize);
+ ss->r = CCGSUBSURF_alloc(ss, ss->meshIFC.vertDataSize);
- ss->syncState = eSyncState_None;
+ ss->currentAge = 0;
- ss->oldVMap = ss->oldEMap = ss->oldFMap = NULL;
- ss->lenTempArrays = 0;
- ss->tempVerts = NULL;
- ss->tempEdges = NULL;
+ ss->syncState = eSyncState_None;
- return ss;
- }
+ ss->oldVMap = ss->oldEMap = ss->oldFMap = NULL;
+ ss->lenTempArrays = 0;
+ ss->tempVerts = NULL;
+ ss->tempEdges = NULL;
+
+ return ss;
}
void ccgSubSurf_free(CCGSubSurf *ss)
@@ -378,7 +375,7 @@ CCGError ccgSubSurf_setSubdivisionLevels(CCGSubSurf *ss, int subdivisionLevels)
if (subdivisionLevels <= 0) {
return eCCGError_InvalidValue;
}
- else if (subdivisionLevels != ss->subdivLevels) {
+ if (subdivisionLevels != ss->subdivLevels) {
ss->numGrids = 0;
ss->subdivLevels = subdivisionLevels;
ccg_ehash_free(ss->vMap, (EHEntryFreeFP)_vert_free, ss);
@@ -420,12 +417,10 @@ CCGError ccgSubSurf_setUseAgeCounts(
(faceUserOffset + 4 > ss->meshIFC.faceUserSize)) {
return eCCGError_InvalidValue;
}
- else {
- ss->useAgeCounts = 1;
- ss->vertUserAgeOffset = vertUserOffset;
- ss->edgeUserAgeOffset = edgeUserOffset;
- ss->faceUserAgeOffset = faceUserOffset;
- }
+ ss->useAgeCounts = 1;
+ ss->vertUserAgeOffset = vertUserOffset;
+ ss->edgeUserAgeOffset = edgeUserOffset;
+ ss->faceUserAgeOffset = faceUserOffset;
}
else {
ss->useAgeCounts = 0;
@@ -441,10 +436,8 @@ CCGError ccgSubSurf_setCalcVertexNormals(CCGSubSurf *ss, int useVertNormals, int
if (normalDataOffset < 0 || normalDataOffset + 12 > ss->meshIFC.vertDataSize) {
return eCCGError_InvalidValue;
}
- else {
- ss->calcVertNormals = 1;
- ss->normalDataOffset = normalDataOffset;
- }
+ ss->calcVertNormals = 1;
+ ss->normalDataOffset = normalDataOffset;
}
else {
ss->calcVertNormals = 0;
@@ -512,19 +505,17 @@ CCGError ccgSubSurf_syncVertDel(CCGSubSurf *ss, CCGVertHDL vHDL)
if (ss->syncState != eSyncState_Partial) {
return eCCGError_InvalidSyncState;
}
- else {
- void **prevp;
- CCGVert *v = ccg_ehash_lookupWithPrev(ss->vMap, vHDL, &prevp);
- if (!v || v->numFaces || v->numEdges) {
- return eCCGError_InvalidValue;
- }
- else {
- *prevp = v->next;
- _vert_free(v, ss);
- }
+ void **prevp;
+ CCGVert *v = ccg_ehash_lookupWithPrev(ss->vMap, vHDL, &prevp);
+
+ if (!v || v->numFaces || v->numEdges) {
+ return eCCGError_InvalidValue;
}
+ *prevp = v->next;
+ _vert_free(v, ss);
+
return eCCGError_None;
}
@@ -533,19 +524,17 @@ CCGError ccgSubSurf_syncEdgeDel(CCGSubSurf *ss, CCGEdgeHDL eHDL)
if (ss->syncState != eSyncState_Partial) {
return eCCGError_InvalidSyncState;
}
- else {
- void **prevp;
- CCGEdge *e = ccg_ehash_lookupWithPrev(ss->eMap, eHDL, &prevp);
- if (!e || e->numFaces) {
- return eCCGError_InvalidValue;
- }
- else {
- *prevp = e->next;
- _edge_unlinkMarkAndFree(e, ss);
- }
+ void **prevp;
+ CCGEdge *e = ccg_ehash_lookupWithPrev(ss->eMap, eHDL, &prevp);
+
+ if (!e || e->numFaces) {
+ return eCCGError_InvalidValue;
}
+ *prevp = e->next;
+ _edge_unlinkMarkAndFree(e, ss);
+
return eCCGError_None;
}
@@ -554,19 +543,17 @@ CCGError ccgSubSurf_syncFaceDel(CCGSubSurf *ss, CCGFaceHDL fHDL)
if (ss->syncState != eSyncState_Partial) {
return eCCGError_InvalidSyncState;
}
- else {
- void **prevp;
- CCGFace *f = ccg_ehash_lookupWithPrev(ss->fMap, fHDL, &prevp);
- if (!f) {
- return eCCGError_InvalidValue;
- }
- else {
- *prevp = f->next;
- _face_unlinkMarkAndFree(f, ss);
- }
+ void **prevp;
+ CCGFace *f = ccg_ehash_lookupWithPrev(ss->fMap, fHDL, &prevp);
+
+ if (!f) {
+ return eCCGError_InvalidValue;
}
+ *prevp = f->next;
+ _face_unlinkMarkAndFree(f, ss);
+
return eCCGError_None;
}
@@ -1264,9 +1251,7 @@ int ccgSubSurf_getEdgeLevelSize(const CCGSubSurf *ss, int level)
if (level < 1 || level > ss->subdivLevels) {
return -1;
}
- else {
- return ccg_edgesize(level);
- }
+ return ccg_edgesize(level);
}
int ccgSubSurf_getGridSize(const CCGSubSurf *ss)
{
@@ -1277,9 +1262,7 @@ int ccgSubSurf_getGridLevelSize(const CCGSubSurf *ss, int level)
if (level < 1 || level > ss->subdivLevels) {
return -1;
}
- else {
- return ccg_gridsize(level);
- }
+ return ccg_gridsize(level);
}
int ccgSubSurf_getSimpleSubdiv(const CCGSubSurf *ss)
@@ -1299,9 +1282,7 @@ int ccgSubSurf_getVertAge(CCGSubSurf *ss, CCGVert *v)
byte *userData = ccgSubSurf_getVertUserData(ss, v);
return ss->currentAge - *((int *)&userData[ss->vertUserAgeOffset]);
}
- else {
- return 0;
- }
+ return 0;
}
void *ccgSubSurf_getVertUserData(CCGSubSurf *ss, CCGVert *v)
{
@@ -1316,9 +1297,7 @@ CCGFace *ccgSubSurf_getVertFace(CCGVert *v, int index)
if (index < 0 || index >= v->numFaces) {
return NULL;
}
- else {
- return v->faces[index];
- }
+ return v->faces[index];
}
int ccgSubSurf_getVertNumEdges(CCGVert *v)
{
@@ -1329,9 +1308,7 @@ CCGEdge *ccgSubSurf_getVertEdge(CCGVert *v, int index)
if (index < 0 || index >= v->numEdges) {
return NULL;
}
- else {
- return v->edges[index];
- }
+ return v->edges[index];
}
void *ccgSubSurf_getVertData(CCGSubSurf *ss, CCGVert *v)
{
@@ -1342,9 +1319,7 @@ void *ccgSubSurf_getVertLevelData(CCGSubSurf *ss, CCGVert *v, int level)
if (level < 0 || level > ss->subdivLevels) {
return NULL;
}
- else {
- return ccg_vert_getCo(v, level, ss->meshIFC.vertDataSize);
- }
+ return ccg_vert_getCo(v, level, ss->meshIFC.vertDataSize);
}
/* Edge accessors */
@@ -1359,9 +1334,7 @@ int ccgSubSurf_getEdgeAge(CCGSubSurf *ss, CCGEdge *e)
byte *userData = ccgSubSurf_getEdgeUserData(ss, e);
return ss->currentAge - *((int *)&userData[ss->edgeUserAgeOffset]);
}
- else {
- return 0;
- }
+ return 0;
}
void *ccgSubSurf_getEdgeUserData(CCGSubSurf *ss, CCGEdge *e)
{
@@ -1376,9 +1349,7 @@ CCGFace *ccgSubSurf_getEdgeFace(CCGEdge *e, int index)
if (index < 0 || index >= e->numFaces) {
return NULL;
}
- else {
- return e->faces[index];
- }
+ return e->faces[index];
}
CCGVert *ccgSubSurf_getEdgeVert0(CCGEdge *e)
{
@@ -1401,9 +1372,7 @@ void *ccgSubSurf_getEdgeLevelData(CCGSubSurf *ss, CCGEdge *e, int x, int level)
if (level < 0 || level > ss->subdivLevels) {
return NULL;
}
- else {
- return ccg_edge_getCo(e, level, x, ss->meshIFC.vertDataSize);
- }
+ return ccg_edge_getCo(e, level, x, ss->meshIFC.vertDataSize);
}
float ccgSubSurf_getEdgeCrease(CCGEdge *e)
{
@@ -1422,9 +1391,7 @@ int ccgSubSurf_getFaceAge(CCGSubSurf *ss, CCGFace *f)
byte *userData = ccgSubSurf_getFaceUserData(ss, f);
return ss->currentAge - *((int *)&userData[ss->faceUserAgeOffset]);
}
- else {
- return 0;
- }
+ return 0;
}
void *ccgSubSurf_getFaceUserData(CCGSubSurf *ss, CCGFace *f)
{
@@ -1442,18 +1409,14 @@ CCGVert *ccgSubSurf_getFaceVert(CCGFace *f, int index)
if (index < 0 || index >= f->numVerts) {
return NULL;
}
- else {
- return FACE_getVerts(f)[index];
- }
+ return FACE_getVerts(f)[index];
}
CCGEdge *ccgSubSurf_getFaceEdge(CCGFace *f, int index)
{
if (index < 0 || index >= f->numVerts) {
return NULL;
}
- else {
- return FACE_getEdges(f)[index];
- }
+ return FACE_getEdges(f)[index];
}
int ccgSubSurf_getFaceEdgeIndex(CCGFace *f, CCGEdge *e)
{
diff --git a/source/blender/blenkernel/intern/CCGSubSurf_legacy.c b/source/blender/blenkernel/intern/CCGSubSurf_legacy.c
index f3f681baa01..8fc9afd58f1 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf_legacy.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf_legacy.c
@@ -38,9 +38,7 @@ static void *_edge_getCoVert(CCGEdge *e, CCGVert *v, int lvl, int x, int dataSiz
if (v == e->v0) {
return &EDGE_getLevelData(e)[dataSize * (levelBase + x)];
}
- else {
- return &EDGE_getLevelData(e)[dataSize * (levelBase + (1 << lvl) - x)];
- }
+ return &EDGE_getLevelData(e)[dataSize * (levelBase + (1 << lvl) - x)];
}
/* *************************************************** */
@@ -65,9 +63,8 @@ static CCGVert *_edge_getOtherVert(CCGEdge *e, CCGVert *vQ)
if (vQ == e->v0) {
return e->v1;
}
- else {
- return e->v0;
- }
+
+ return e->v0;
}
static float *_face_getIFNoEdge(CCGFace *f,
@@ -111,15 +108,13 @@ static float EDGE_getSharpness(CCGEdge *e, int lvl)
if (!lvl) {
return e->crease;
}
- else if (!e->crease) {
+ if (!e->crease) {
return 0.0f;
}
- else if (e->crease - lvl < 0.0f) {
+ if (e->crease - lvl < 0.0f) {
return 0.0f;
}
- else {
- return e->crease - lvl;
- }
+ return e->crease - lvl;
}
typedef struct CCGSubSurfCalcSubdivData {
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 8a5be6b9cb3..b40cc4e8b9f 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -424,15 +424,14 @@ int DM_release(DerivedMesh *dm)
return 1;
}
- else {
- CustomData_free_temporary(&dm->vertData, dm->numVertData);
- CustomData_free_temporary(&dm->edgeData, dm->numEdgeData);
- CustomData_free_temporary(&dm->faceData, dm->numTessFaceData);
- CustomData_free_temporary(&dm->loopData, dm->numLoopData);
- CustomData_free_temporary(&dm->polyData, dm->numPolyData);
- return 0;
- }
+ CustomData_free_temporary(&dm->vertData, dm->numVertData);
+ CustomData_free_temporary(&dm->edgeData, dm->numEdgeData);
+ CustomData_free_temporary(&dm->faceData, dm->numTessFaceData);
+ CustomData_free_temporary(&dm->loopData, dm->numLoopData);
+ CustomData_free_temporary(&dm->polyData, dm->numPolyData);
+
+ return 0;
}
void DM_DupPolys(DerivedMesh *source, DerivedMesh *target)
@@ -693,11 +692,9 @@ static float (*get_orco_coords(Object *ob, BMEditMesh *em, int layer, int *free)
if (em) {
return get_editbmesh_orco_verts(em);
}
- else {
- return BKE_mesh_orco_verts_get(ob);
- }
+ return BKE_mesh_orco_verts_get(ob);
}
- else if (layer == CD_CLOTH_ORCO) {
+ if (layer == CD_CLOTH_ORCO) {
/* apply shape key for cloth, this should really be solved
* by a more flexible customdata system, but not simple */
if (!em) {
@@ -1060,9 +1057,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
}
continue;
}
- else {
- BKE_modifier_set_error(md, "Sculpt: Hide, Mask and optimized display disabled");
- }
+ BKE_modifier_set_error(md, "Sculpt: Hide, Mask and optimized display disabled");
}
if (need_mapping && !BKE_modifier_supports_mapping(md)) {
diff --git a/source/blender/blenkernel/intern/anim_data.c b/source/blender/blenkernel/intern/anim_data.c
index 841fdaa3b2c..3e2c69fbcea 100644
--- a/source/blender/blenkernel/intern/anim_data.c
+++ b/source/blender/blenkernel/intern/anim_data.c
@@ -130,9 +130,7 @@ AnimData *BKE_animdata_from_id(ID *id)
IdAdtTemplate *iat = (IdAdtTemplate *)id;
return iat->adt;
}
- else {
- return NULL;
- }
+ return NULL;
}
/* Add AnimData to the given ID-block. In order for this to work, we assume that
@@ -161,9 +159,7 @@ AnimData *BKE_animdata_add_id(ID *id)
return iat->adt;
}
- else {
- return NULL;
- }
+ return NULL;
}
/* Action Setter --------------------------------------- */
@@ -775,10 +771,9 @@ static char *rna_path_rename_fix(ID *owner_id,
MEM_freeN(oldpath);
return newPath;
}
- else {
- /* still couldn't resolve the path... so, might as well just leave it alone */
- MEM_freeN(newPath);
- }
+
+ /* still couldn't resolve the path... so, might as well just leave it alone */
+ MEM_freeN(newPath);
}
}
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 5e4b280d0d0..09d6ba4ff44 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -619,9 +619,8 @@ static void action_idcode_patch_check(ID *id, bAction *act)
if (ELEM(NULL, id, act)) {
return;
}
- else {
- idcode = GS(id->name);
- }
+
+ idcode = GS(id->name);
/* the actual checks... hopefully not too much of a performance hit in the long run... */
if (act->idroot == 0) {
@@ -717,14 +716,13 @@ static float nlastrip_get_influence(NlaStrip *strip, float cframe)
/* there is some blend-in */
return fabsf(cframe - strip->start) / (strip->blendin);
}
- else if (IS_EQF(strip->blendout, 0.0f) == false && (cframe >= (strip->end - strip->blendout))) {
+ if (IS_EQF(strip->blendout, 0.0f) == false && (cframe >= (strip->end - strip->blendout))) {
/* there is some blend-out */
return fabsf(strip->end - cframe) / (strip->blendout);
}
- else {
- /* in the middle of the strip, we should be full strength */
- return 1.0f;
- }
+
+ /* in the middle of the strip, we should be full strength */
+ return 1.0f;
}
/* evaluate the evaluation time and influence for the strip, storing the results in the strip */
@@ -1115,9 +1113,7 @@ static int nlaevalchan_validate_index(NlaEvalChannel *nec, int index)
return -1;
}
- else {
- return 0;
- }
+ return 0;
}
/* Initialise default values for NlaEvalChannel from the property data. */
@@ -1209,15 +1205,13 @@ static char nlaevalchan_detect_mix_mode(NlaEvalChannelKey *key, int length)
if (subtype == PROP_QUATERNION && length == 4) {
return NEC_MIX_QUATERNION;
}
- else if (subtype == PROP_AXISANGLE && length == 4) {
+ if (subtype == PROP_AXISANGLE && length == 4) {
return NEC_MIX_AXIS_ANGLE;
}
- else if (RNA_property_flag(key->prop) & PROP_PROPORTIONAL) {
+ if (RNA_property_flag(key->prop) & PROP_PROPORTIONAL) {
return NEC_MIX_MULTIPLY;
}
- else {
- return NEC_MIX_ADD;
- }
+ return NEC_MIX_ADD;
}
/* Verify that an appropriate NlaEvalChannel for this property exists. */
@@ -1454,10 +1448,9 @@ static bool nla_invert_combine_value(int mix_mode,
/* Division by zero. */
return false;
}
- else {
- *r_value = base_value * powf(target_value / old_value, 1.0f / influence);
- return true;
- }
+
+ *r_value = base_value * powf(target_value / old_value, 1.0f / influence);
+ return true;
case NEC_MIX_QUATERNION:
default:
diff --git a/source/blender/blenkernel/intern/anim_visualization.c b/source/blender/blenkernel/intern/anim_visualization.c
index 04dbe4102cc..a6f63c2ba95 100644
--- a/source/blender/blenkernel/intern/anim_visualization.c
+++ b/source/blender/blenkernel/intern/anim_visualization.c
@@ -184,10 +184,8 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports,
/* return/use this as it is already valid length */
return mpath;
}
- else {
- /* clear the existing path (as the range has changed), and reallocate below */
- animviz_free_motionpath_cache(mpath);
- }
+ /* clear the existing path (as the range has changed), and reallocate below */
+ animviz_free_motionpath_cache(mpath);
}
}
else {
diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c
index 8189385a69d..58337bcf488 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -154,13 +154,12 @@ static bool test_path(char *targetpath,
#endif
return true;
}
- else {
+
#ifdef PATH_DEBUG
- printf("\t%s missing: %s\n", __func__, targetpath);
+ printf("\t%s missing: %s\n", __func__, targetpath);
#endif
- // targetpath[0] = '\0';
- return false;
- }
+ // targetpath[0] = '\0';
+ return false;
}
/**
@@ -181,13 +180,12 @@ static bool test_env_path(char *path, const char *envvar)
#endif
return true;
}
- else {
- path[0] = '\0';
+
+ path[0] = '\0';
#ifdef PATH_DEBUG
- printf("\t%s env %s missing: %s\n", __func__, envvar, env);
+ printf("\t%s env %s missing: %s\n", __func__, envvar, env);
#endif
- return false;
- }
+ return false;
}
/**
@@ -272,10 +270,8 @@ static bool get_path_environment(char *targetpath,
if (subfolder_name) {
return test_path(targetpath, targetpath_len, user_path, NULL, subfolder_name);
}
- else {
- BLI_strncpy(targetpath, user_path, FILE_MAX);
- return true;
- }
+ BLI_strncpy(targetpath, user_path, FILE_MAX);
+ return true;
}
return false;
}
@@ -300,10 +296,8 @@ static bool get_path_environment_notest(char *targetpath,
BLI_join_dirfile(targetpath, targetpath_len, user_path, subfolder_name);
return true;
}
- else {
- BLI_strncpy(targetpath, user_path, FILE_MAX);
- return true;
- }
+ BLI_strncpy(targetpath, user_path, FILE_MAX);
+ return true;
}
return false;
}
@@ -347,9 +341,8 @@ static bool get_path_user(char *targetpath,
if (subfolder_name) {
return test_path(targetpath, targetpath_len, user_path, folder_name, subfolder_name);
}
- else {
- return test_path(targetpath, targetpath_len, user_path, NULL, folder_name);
- }
+
+ return test_path(targetpath, targetpath_len, user_path, NULL, folder_name);
}
/**
@@ -401,10 +394,9 @@ static bool get_path_system(char *targetpath,
/* try $BLENDERPATH/folder_name/subfolder_name */
return test_path(targetpath, targetpath_len, system_path, folder_name, subfolder_name);
}
- else {
- /* try $BLENDERPATH/folder_name */
- return test_path(targetpath, targetpath_len, system_path, NULL, folder_name);
- }
+
+ /* try $BLENDERPATH/folder_name */
+ return test_path(targetpath, targetpath_len, system_path, NULL, folder_name);
}
/**
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 007062abb5b..e799fb16929 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -512,12 +512,10 @@ bool BKE_armature_bone_flag_test_recursive(const Bone *bone, int flag)
if (bone->flag & flag) {
return true;
}
- else if (bone->parent) {
+ if (bone->parent) {
return BKE_armature_bone_flag_test_recursive(bone->parent, flag);
}
- else {
- return false;
- }
+ return false;
}
/** \} */
@@ -687,10 +685,7 @@ int bone_autoside_name(
return 1;
}
-
- else {
- return 0;
- }
+ return 0;
}
/** \} */
diff --git a/source/blender/blenkernel/intern/armature_deform.c b/source/blender/blenkernel/intern/armature_deform.c
index 44b50ab96d3..8711a001e32 100644
--- a/source/blender/blenkernel/intern/armature_deform.c
+++ b/source/blender/blenkernel/intern/armature_deform.c
@@ -163,17 +163,15 @@ float distfactor_to_bone(
if (dist_sq < a) {
return 1.0f;
}
- else {
- l = rad + rdist;
- l *= l;
- if (rdist == 0.0f || dist_sq >= l) {
- return 0.0f;
- }
- else {
- a = sqrtf(dist_sq) - rad;
- return 1.0f - (a * a) / (rdist * rdist);
- }
+
+ l = rad + rdist;
+ l *= l;
+ if (rdist == 0.0f || dist_sq >= l) {
+ return 0.0f;
}
+
+ a = sqrtf(dist_sq) - rad;
+ return 1.0f - (a * a) / (rdist * rdist);
}
static float dist_bone_deform(
diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c
index d0a5e4348b9..d66991aed70 100644
--- a/source/blender/blenkernel/intern/armature_update.c
+++ b/source/blender/blenkernel/intern/armature_update.c
@@ -119,9 +119,8 @@ static void splineik_init_tree_from_pchan(Scene *UNUSED(scene),
if (segcount == 0) {
return;
}
- else {
- pchanRoot = pchanChain[segcount - 1];
- }
+
+ pchanRoot = pchanChain[segcount - 1];
/* perform binding step if required */
if ((ikData->flag & CONSTRAINT_SPLINEIK_BOUND) == 0) {
@@ -717,7 +716,7 @@ void BKE_pose_constraints_evaluate(struct Depsgraph *depsgraph,
if (armature->flag & ARM_RESTPOS) {
return;
}
- else if (pchan->flag & POSE_IKTREE || pchan->flag & POSE_IKSPLINE) {
+ if (pchan->flag & POSE_IKTREE || pchan->flag & POSE_IKSPLINE) {
/* IK are being solved separately/ */
}
else {
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index d5064629451..a0da1b1677d 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -872,91 +872,90 @@ static Object *boid_find_ground(BoidBrainData *bbd,
return bpa->ground;
}
- else {
- float zvec[3] = {0.0f, 0.0f, 2000.0f};
- ParticleCollision col;
- ColliderCache *coll;
- BVHTreeRayHit hit;
- float radius = 0.0f, t, ray_dir[3];
-
- if (!bbd->sim->colliders) {
- return NULL;
- }
-
- memset(&col, 0, sizeof(ParticleCollision));
- /* first try to find below boid */
- copy_v3_v3(col.co1, pa->state.co);
- sub_v3_v3v3(col.co2, pa->state.co, zvec);
- sub_v3_v3v3(ray_dir, col.co2, col.co1);
- col.f = 0.0f;
- hit.index = -1;
- hit.dist = col.original_ray_length = normalize_v3(ray_dir);
- col.pce.inside = 0;
+ float zvec[3] = {0.0f, 0.0f, 2000.0f};
+ ParticleCollision col;
+ ColliderCache *coll;
+ BVHTreeRayHit hit;
+ float radius = 0.0f, t, ray_dir[3];
- for (coll = bbd->sim->colliders->first; coll; coll = coll->next) {
- col.current = coll->ob;
- col.md = coll->collmd;
- col.fac1 = col.fac2 = 0.f;
+ if (!bbd->sim->colliders) {
+ return NULL;
+ }
- if (col.md && col.md->bvhtree) {
- BLI_bvhtree_ray_cast_ex(col.md->bvhtree,
- col.co1,
- ray_dir,
- radius,
- &hit,
- BKE_psys_collision_neartest_cb,
- &col,
- raycast_flag);
- }
+ memset(&col, 0, sizeof(ParticleCollision));
+
+ /* first try to find below boid */
+ copy_v3_v3(col.co1, pa->state.co);
+ sub_v3_v3v3(col.co2, pa->state.co, zvec);
+ sub_v3_v3v3(ray_dir, col.co2, col.co1);
+ col.f = 0.0f;
+ hit.index = -1;
+ hit.dist = col.original_ray_length = normalize_v3(ray_dir);
+ col.pce.inside = 0;
+
+ for (coll = bbd->sim->colliders->first; coll; coll = coll->next) {
+ col.current = coll->ob;
+ col.md = coll->collmd;
+ col.fac1 = col.fac2 = 0.f;
+
+ if (col.md && col.md->bvhtree) {
+ BLI_bvhtree_ray_cast_ex(col.md->bvhtree,
+ col.co1,
+ ray_dir,
+ radius,
+ &hit,
+ BKE_psys_collision_neartest_cb,
+ &col,
+ raycast_flag);
}
- /* then use that object */
- if (hit.index >= 0) {
- t = hit.dist / col.original_ray_length;
- interp_v3_v3v3(ground_co, col.co1, col.co2, t);
- normalize_v3_v3(ground_nor, col.pce.nor);
- return col.hit;
- }
-
- /* couldn't find below, so find upmost deflector object */
- add_v3_v3v3(col.co1, pa->state.co, zvec);
- sub_v3_v3v3(col.co2, pa->state.co, zvec);
- sub_v3_v3(col.co2, zvec);
- sub_v3_v3v3(ray_dir, col.co2, col.co1);
- col.f = 0.0f;
- hit.index = -1;
- hit.dist = col.original_ray_length = normalize_v3(ray_dir);
-
- for (coll = bbd->sim->colliders->first; coll; coll = coll->next) {
- col.current = coll->ob;
- col.md = coll->collmd;
+ }
+ /* then use that object */
+ if (hit.index >= 0) {
+ t = hit.dist / col.original_ray_length;
+ interp_v3_v3v3(ground_co, col.co1, col.co2, t);
+ normalize_v3_v3(ground_nor, col.pce.nor);
+ return col.hit;
+ }
- if (col.md && col.md->bvhtree) {
- BLI_bvhtree_ray_cast_ex(col.md->bvhtree,
- col.co1,
- ray_dir,
- radius,
- &hit,
- BKE_psys_collision_neartest_cb,
- &col,
- raycast_flag);
- }
+ /* couldn't find below, so find upmost deflector object */
+ add_v3_v3v3(col.co1, pa->state.co, zvec);
+ sub_v3_v3v3(col.co2, pa->state.co, zvec);
+ sub_v3_v3(col.co2, zvec);
+ sub_v3_v3v3(ray_dir, col.co2, col.co1);
+ col.f = 0.0f;
+ hit.index = -1;
+ hit.dist = col.original_ray_length = normalize_v3(ray_dir);
+
+ for (coll = bbd->sim->colliders->first; coll; coll = coll->next) {
+ col.current = coll->ob;
+ col.md = coll->collmd;
+
+ if (col.md && col.md->bvhtree) {
+ BLI_bvhtree_ray_cast_ex(col.md->bvhtree,
+ col.co1,
+ ray_dir,
+ radius,
+ &hit,
+ BKE_psys_collision_neartest_cb,
+ &col,
+ raycast_flag);
}
- /* then use that object */
- if (hit.index >= 0) {
- t = hit.dist / col.original_ray_length;
- interp_v3_v3v3(ground_co, col.co1, col.co2, t);
- normalize_v3_v3(ground_nor, col.pce.nor);
- return col.hit;
- }
-
- /* default to z=0 */
- copy_v3_v3(ground_co, pa->state.co);
- ground_co[2] = 0;
- ground_nor[0] = ground_nor[1] = 0.0f;
- ground_nor[2] = 1.0f;
- return NULL;
}
+ /* then use that object */
+ if (hit.index >= 0) {
+ t = hit.dist / col.original_ray_length;
+ interp_v3_v3v3(ground_co, col.co1, col.co2, t);
+ normalize_v3_v3(ground_nor, col.pce.nor);
+ return col.hit;
+ }
+
+ /* default to z=0 */
+ copy_v3_v3(ground_co, pa->state.co);
+ ground_co[2] = 0;
+ ground_nor[0] = ground_nor[1] = 0.0f;
+ ground_nor[2] = 1.0f;
+ return NULL;
}
static int boid_rule_applies(ParticleData *pa, BoidSettings *UNUSED(boids), BoidRule *rule)
{
@@ -1046,9 +1045,7 @@ static int apply_boid_rule(
fuzziness * len_v3(pa->prev_state.vel)) == 0) {
return 1;
}
- else {
- return 0;
- }
+ return 0;
}
static BoidState *get_boid_state(BoidSettings *boids, ParticleData *pa)
{
diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c
index 44873c54469..e2d17f34992 100644
--- a/source/blender/blenkernel/intern/bpath.c
+++ b/source/blender/blenkernel/intern/bpath.c
@@ -147,19 +147,16 @@ static bool bpath_relative_rebase_visit_cb(void *userdata, char *path_dst, const
data->count_changed++;
return true;
}
- else {
- /* Failed to make relative path absolute. */
- BLI_assert(0);
- BKE_reportf(data->reports, RPT_WARNING, "Path '%s' cannot be made absolute", path_src);
- data->count_failed++;
- return false;
- }
- return false;
- }
- else {
- /* Absolute, leave this as-is. */
+
+ /* Failed to make relative path absolute. */
+ BLI_assert(0);
+ BKE_reportf(data->reports, RPT_WARNING, "Path '%s' cannot be made absolute", path_src);
+ data->count_failed++;
return false;
}
+
+ /* Absolute, leave this as-is. */
+ return false;
}
void BKE_bpath_relative_rebase(Main *bmain,
@@ -211,18 +208,17 @@ static bool bpath_relative_convert_visit_cb(void *userdata, char *path_dst, cons
if (BLI_path_is_rel(path_src)) {
return false; /* already relative */
}
+
+ strcpy(path_dst, path_src);
+ BLI_path_rel(path_dst, data->basedir);
+ if (BLI_path_is_rel(path_dst)) {
+ data->count_changed++;
+ }
else {
- strcpy(path_dst, path_src);
- BLI_path_rel(path_dst, data->basedir);
- if (BLI_path_is_rel(path_dst)) {
- data->count_changed++;
- }
- else {
- BKE_reportf(data->reports, RPT_WARNING, "Path '%s' cannot be made relative", path_src);
- data->count_failed++;
- }
- return true;
+ BKE_reportf(data->reports, RPT_WARNING, "Path '%s' cannot be made relative", path_src);
+ data->count_failed++;
}
+ return true;
}
void BKE_bpath_relative_convert(Main *bmain, const char *basedir, ReportList *reports)
@@ -263,18 +259,17 @@ static bool bpath_absolute_convert_visit_cb(void *userdata, char *path_dst, cons
if (BLI_path_is_rel(path_src) == false) {
return false; /* already absolute */
}
+
+ strcpy(path_dst, path_src);
+ BLI_path_abs(path_dst, data->basedir);
+ if (BLI_path_is_rel(path_dst) == false) {
+ data->count_changed++;
+ }
else {
- strcpy(path_dst, path_src);
- BLI_path_abs(path_dst, data->basedir);
- if (BLI_path_is_rel(path_dst) == false) {
- data->count_changed++;
- }
- else {
- BKE_reportf(data->reports, RPT_WARNING, "Path '%s' cannot be made absolute", path_src);
- data->count_failed++;
- }
- return true;
+ BKE_reportf(data->reports, RPT_WARNING, "Path '%s' cannot be made absolute", path_src);
+ data->count_failed++;
}
+ return true;
}
/* similar to BKE_bpath_relative_convert - keep in sync! */
@@ -411,7 +406,7 @@ static bool missing_files_find__visit_cb(void *userdata, char *path_dst, const c
BLI_path_basename(data->searchdir));
return false;
}
- else if (found == false) {
+ if (found == false) {
BKE_reportf(data->reports,
RPT_WARNING,
"Could not find '%s' in '%s'",
@@ -419,18 +414,17 @@ static bool missing_files_find__visit_cb(void *userdata, char *path_dst, const c
data->searchdir);
return false;
}
- else {
- bool was_relative = BLI_path_is_rel(path_dst);
- BLI_strncpy(path_dst, filename_new, FILE_MAX);
+ bool was_relative = BLI_path_is_rel(path_dst);
- /* keep path relative if the previous one was relative */
- if (was_relative) {
- BLI_path_rel(path_dst, data->basedir);
- }
+ BLI_strncpy(path_dst, filename_new, FILE_MAX);
- return true;
+ /* keep path relative if the previous one was relative */
+ if (was_relative) {
+ BLI_path_rel(path_dst, data->basedir);
}
+
+ return true;
}
void BKE_bpath_missing_files_find(Main *bmain,
@@ -483,9 +477,8 @@ static bool rewrite_path_fixed(char *path,
BLI_strncpy(path, path_dst, FILE_MAX);
return true;
}
- else {
- return false;
- }
+
+ return false;
}
static bool rewrite_path_fixed_dirfile(char path_dir[FILE_MAXDIR],
@@ -510,9 +503,8 @@ static bool rewrite_path_fixed_dirfile(char path_dir[FILE_MAXDIR],
BLI_split_dirfile(path_dst, path_dir, path_file, FILE_MAXDIR, FILE_MAXFILE);
return true;
}
- else {
- return false;
- }
+
+ return false;
}
static bool rewrite_path_alloc(char **path,
@@ -538,9 +530,8 @@ static bool rewrite_path_alloc(char **path,
(*path) = BLI_strdup(path_dst);
return true;
}
- else {
- return false;
- }
+
+ return false;
}
/**
@@ -827,10 +818,9 @@ bool BKE_bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *pa
BLI_strncpy(path_dst, filepath, FILE_MAX);
return true;
}
- else {
- /* Path was not relative to begin with. */
- return false;
- }
+
+ /* Path was not relative to begin with. */
+ return false;
}
/** \} */
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index a8f52593429..522bf42105c 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -372,8 +372,8 @@ bool BKE_brush_delete(Main *bmain, Brush *brush)
if (brush->id.tag & LIB_TAG_INDIRECT) {
return false;
}
- else if (BKE_library_ID_is_indirectly_used(bmain, brush) && ID_REAL_USERS(brush) <= 1 &&
- ID_EXTRA_USERS(brush) == 0) {
+ if (BKE_library_ID_is_indirectly_used(bmain, brush) && ID_REAL_USERS(brush) <= 1 &&
+ ID_EXTRA_USERS(brush) == 0) {
return false;
}
@@ -2180,10 +2180,9 @@ float BKE_brush_curve_strength(const Brush *br, float p, const float len)
if (p >= len) {
return 0;
}
- else {
- p = p / len;
- p = 1.0f - p;
- }
+
+ p = p / len;
+ p = 1.0f - p;
switch (br->curve_preset) {
case BRUSH_CURVE_CUSTOM:
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 566954fd5fa..6b25095a87a 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -454,7 +454,7 @@ void clothModifier_do(ClothModifierData *clmd,
BKE_ptcache_invalidate(cache);
return;
}
- else if (framenr > endframe) {
+ if (framenr > endframe) {
framenr = endframe;
}
@@ -493,7 +493,7 @@ void clothModifier_do(ClothModifierData *clmd,
return;
}
- else if (cache_result == PTCACHE_READ_OLD) {
+ if (cache_result == PTCACHE_READ_OLD) {
BKE_cloth_solver_set_positions(clmd);
}
else if (
@@ -1557,9 +1557,9 @@ static bool find_internal_spring_target_vertex(BVHTreeFromMesh *treedata,
*r_tar_v_idx = vert_idx;
return true;
}
- else {
+
return false;
- }
+
}
static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh)
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 6b28297622c..c894534c504 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -1190,9 +1190,8 @@ static void basisNurb(
}
break;
}
- else {
- basis[i] = 0.0;
- }
+
+ basis[i] = 0.0;
}
basis[i] = 0.0;
@@ -2040,7 +2039,7 @@ static int vergxcobev(const void *a1, const void *a2)
if (x1->left > x2->left) {
return 1;
}
- else if (x1->left < x2->left) {
+ if (x1->left < x2->left) {
return -1;
}
return 0;
@@ -5064,32 +5063,31 @@ bool BKE_nurb_type_convert(Nurb *nu,
}
return false; /* conversion impossible */
}
- else {
- bezt = MEM_calloc_arrayN(nr, sizeof(BezTriple), "setsplinetype2");
- nu->bezt = bezt;
- a = nr;
- bp = nu->bp;
- while (a--) {
- copy_v3_v3(bezt->vec[0], bp->vec);
- bezt->f1 = bp->f1;
- bp++;
- copy_v3_v3(bezt->vec[1], bp->vec);
- bezt->f2 = bp->f1;
- bp++;
- copy_v3_v3(bezt->vec[2], bp->vec);
- bezt->f3 = bp->f1;
- bezt->radius = bp->radius;
- bezt->weight = bp->weight;
- bp++;
- bezt++;
- }
- MEM_freeN(nu->bp);
- nu->bp = NULL;
- MEM_freeN(nu->knotsu);
- nu->knotsu = NULL;
- nu->pntsu = nr;
- nu->type = CU_BEZIER;
+
+ bezt = MEM_calloc_arrayN(nr, sizeof(BezTriple), "setsplinetype2");
+ nu->bezt = bezt;
+ a = nr;
+ bp = nu->bp;
+ while (a--) {
+ copy_v3_v3(bezt->vec[0], bp->vec);
+ bezt->f1 = bp->f1;
+ bp++;
+ copy_v3_v3(bezt->vec[1], bp->vec);
+ bezt->f2 = bp->f1;
+ bp++;
+ copy_v3_v3(bezt->vec[2], bp->vec);
+ bezt->f3 = bp->f1;
+ bezt->radius = bp->radius;
+ bezt->weight = bp->weight;
+ bp++;
+ bezt++;
}
+ MEM_freeN(nu->bp);
+ nu->bp = NULL;
+ MEM_freeN(nu->knotsu);
+ nu->knotsu = NULL;
+ nu->pntsu = nr;
+ nu->type = CU_BEZIER;
}
}
@@ -5140,10 +5138,9 @@ int BKE_curve_nurb_vert_index_get(const Nurb *nu, const void *vert)
BLI_assert(ARRAY_HAS_ITEM((BezTriple *)vert, nu->bezt, nu->pntsu));
return (BezTriple *)vert - nu->bezt;
}
- else {
- BLI_assert(ARRAY_HAS_ITEM((BPoint *)vert, nu->bp, nu->pntsu * nu->pntsv));
- return (BPoint *)vert - nu->bp;
- }
+
+ BLI_assert(ARRAY_HAS_ITEM((BPoint *)vert, nu->bp, nu->pntsu * nu->pntsv));
+ return (BPoint *)vert - nu->bp;
}
/* Set active nurb and active vert for curve */
@@ -5516,9 +5513,7 @@ bool BKE_curve_material_index_validate(Curve *cu)
DEG_id_tag_update(&cu->id, ID_RECALC_GEOMETRY);
return true;
}
- else {
- return false;
- }
+ return false;
}
void BKE_curve_material_remap(Curve *cu, const unsigned int *remap, unsigned int remap_len)