Cleanup: style, use braces in source/ (include disabled blocks)

This commit is contained in:
Campbell Barton 2019-05-31 23:21:16 +10:00
parent 72a563cdee
commit aba4e6810f
106 changed files with 944 additions and 483 deletions

View File

@ -1173,8 +1173,9 @@ void CDDM_calc_normals(DerivedMesh *dm)
CDDerivedMesh *cddm = (CDDerivedMesh *)dm;
float(*poly_nors)[3];
if (dm->numVertData == 0)
if (dm->numVertData == 0) {
return;
}
/* we don't want to overwrite any referenced layers */
cddm->mvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT, dm->numVertData);

View File

@ -1732,8 +1732,9 @@ static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh)
cloth_free_edgelist(edgelist, mvert_num);
#if 0
if (G.debug_value > 0)
if (G.debug_value > 0) {
printf("avg_len: %f\n", clmd->sim_parms->avg_spring_len);
}
#endif
return 1;

View File

@ -3081,8 +3081,9 @@ int dynamicPaint_createUVSurface(Scene *scene,
for (int ty = 0; ty < h; ty++) {
for (int tx = 0; tx < w; tx++) {
const int index = tx + w * ty;
if (tempPoints[index].tri_index != -1)
if (tempPoints[index].tri_index != -1) {
tmp[final_index[index]] = index;
}
}
}
for (int ty = 0; ty < h; ty++) {
@ -3193,8 +3194,9 @@ int dynamicPaint_createUVSurface(Scene *scene,
pPoint->alpha = 1.0f;
/* Every pixel that is assigned as "edge pixel" gets blue color */
if (uvPoint->neighbour_pixel != -1)
if (uvPoint->neighbour_pixel != -1) {
pPoint->color[2] = 1.0f;
}
/* and every pixel that finally got an polygon gets red color */
/* green color shows pixel face index hash */
if (uvPoint->tri_index != -1) {

View File

@ -965,10 +965,12 @@ static bool vfont_to_curve(Object *ob,
/* XXX, has been unused for years, need to check if this is useful, r4613 r5282 - campbell */
#if 0
if (ascii == '\n')
if (ascii == '\n') {
xof = xof_scale;
else
}
else {
xof = MARGIN_X_MIN;
}
#else
xof = MARGIN_X_MIN;
#endif

View File

@ -239,28 +239,34 @@ static const char *ob_adrcodes_to_paths(int adrcode, int *array_index)
return "color";
#if 0
case OB_PD_FSTR:
if (ob->pd)
if (ob->pd) {
poin = &(ob->pd->f_strength);
}
break;
case OB_PD_FFALL:
if (ob->pd)
if (ob->pd) {
poin = &(ob->pd->f_power);
}
break;
case OB_PD_SDAMP:
if (ob->pd)
if (ob->pd) {
poin = &(ob->pd->pdef_damp);
}
break;
case OB_PD_RDAMP:
if (ob->pd)
if (ob->pd) {
poin = &(ob->pd->pdef_rdamp);
}
break;
case OB_PD_PERM:
if (ob->pd)
if (ob->pd) {
poin = &(ob->pd->pdef_perm);
}
break;
case OB_PD_FMAXD:
if (ob->pd)
if (ob->pd) {
poin = &(ob->pd->maxdist);
}
break;
#endif
}
@ -688,10 +694,12 @@ static const char *camera_adrcodes_to_paths(int adrcode, int *array_index)
case CAM_LENS:
#if 0 /* XXX this cannot be resolved easily... \
* perhaps we assume camera is perspective (works for most cases... */
if (ca->type == CAM_ORTHO)
if (ca->type == CAM_ORTHO) {
return "ortho_scale";
else
}
else {
return "lens";
}
#else // XXX lazy hack for now...
return "lens";
#endif // XXX this cannot be resolved easily
@ -884,28 +892,34 @@ static const char *particle_adrcodes_to_paths(int adrcode, int *array_index)
* as the similar object forces */
#if 0
case PART_PD_FSTR:
if (part->pd)
if (part->pd) {
poin = &(part->pd->f_strength);
}
break;
case PART_PD_FFALL:
if (part->pd)
if (part->pd) {
poin = &(part->pd->f_power);
}
break;
case PART_PD_FMAXD:
if (part->pd)
if (part->pd) {
poin = &(part->pd->maxdist);
}
break;
case PART_PD2_FSTR:
if (part->pd2)
if (part->pd2) {
poin = &(part->pd2->f_strength);
}
break;
case PART_PD2_FFALL:
if (part->pd2)
if (part->pd2) {
poin = &(part->pd2->f_power);
}
break;
case PART_PD2_FMAXD:
if (part->pd2)
if (part->pd2) {
poin = &(part->pd2->maxdist);
}
break;
#endif
}

View File

@ -1729,8 +1729,9 @@ bool BKE_id_new_name_validate(ListBase *lb, ID *id, const char *tname)
* sorting should not hurt, but noting just incase it alters the way other
* functions work, so sort every time */
#if 0
if (result)
if (result) {
id_sort_by_name(lb, id);
}
#endif
id_sort_by_name(lb, id);

View File

@ -1860,15 +1860,17 @@ static void dfdx_spring(int ia, int ic, int op, float dir[3], float L, float len
static void dfdx_goal(int ia, int ic, int op, float factor)
{
int i;
for (i = 0; i < 3; i++)
for (i = 0; i < 3; i++) {
EIG_linear_solver_matrix_add(ia + i, op + ic + i, factor);
}
}
static void dfdv_goal(int ia, int ic, float factor)
{
int i;
for (i = 0; i < 3; i++)
for (i = 0; i < 3; i++) {
EIG_linear_solver_matrix_add(ia + i, ic + i, factor);
}
}
#endif /* if 0 */
@ -2336,10 +2338,12 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
/* old one with homogeneous masses */
/* claim a minimum mass for vertex */
#if 0
if (sb->nodemass > 0.009999f)
if (sb->nodemass > 0.009999f) {
timeovermass = forcetime / sb->nodemass;
else
}
else {
timeovermass = forcetime / 0.009999f;
}
#endif
for (a = sb->totpoint, bp = sb->bpoint; a > 0; a--, bp++) {

View File

@ -230,23 +230,29 @@ MINLINE unsigned power_of_2_min_u(unsigned x)
#define _round_clamp_fl_impl(arg, ty, min, max) \
{ \
float r = floorf(arg + 0.5f); \
if (UNLIKELY(r <= (float)min)) \
if (UNLIKELY(r <= (float)min)) { \
return (ty)min; \
else if (UNLIKELY(r >= (float)max)) \
} \
else if (UNLIKELY(r >= (float)max)) { \
return (ty)max; \
else \
} \
else { \
return (ty)r; \
} \
}
#define _round_clamp_db_impl(arg, ty, min, max) \
{ \
double r = floor(arg + 0.5); \
if (UNLIKELY(r <= (double)min)) \
if (UNLIKELY(r <= (double)min)) { \
return (ty)min; \
else if (UNLIKELY(r >= (double)max)) \
} \
else if (UNLIKELY(r >= (double)max)) { \
return (ty)max; \
else \
} \
else { \
return (ty)r; \
} \
}
#define _round_fl_impl(arg, ty) \

View File

@ -1959,16 +1959,18 @@ bool isect_ray_tri_threshold_v3(const float ray_origin[3],
cross_v3_v3v3(p, ray_direction, e2);
a = dot_v3v3(e1, p);
if ((a > -epsilon) && (a < epsilon))
if ((a > -epsilon) && (a < epsilon)) {
return false;
}
f = 1.0f / a;
sub_v3_v3v3(s, ray_origin, v0);
cross_v3_v3v3(q, s, e1);
*r_lambda = f * dot_v3v3(e2, q);
if ((*r_lambda < 0.0f))
if ((*r_lambda < 0.0f)) {
return false;
}
u = f * dot_v3v3(s, p);
v = f * dot_v3v3(ray_direction, q);
@ -1979,19 +1981,25 @@ bool isect_ray_tri_threshold_v3(const float ray_origin[3],
dv = v - t;
}
else {
if (u < 0)
if (u < 0) {
du = u;
else if (u > 1)
}
else if (u > 1) {
du = u - 1;
else
}
else {
du = 0.0f;
}
if (v < 0)
if (v < 0) {
dv = v;
else if (v > 1)
}
else if (v > 1) {
dv = v - 1;
else
}
else {
dv = 0.0f;
}
}
mul_v3_fl(e1, du);

View File

@ -372,8 +372,9 @@ void BLI_smallhash_print(SmallHash *sh)
printf("%2x", (uint)sh->buckets[i].key);
}
if (i != sh->nbuckets - 1)
if (i != sh->nbuckets - 1) {
printf(", ");
}
c += 6;

View File

@ -7286,8 +7286,9 @@ static void direct_link_area(FileData *fd, ScrArea *area)
* committed: r28002 */
#if 0
sima->gpd = newdataadr(fd, sima->gpd);
if (sima->gpd)
if (sima->gpd) {
direct_link_gpencil(fd, sima->gpd);
}
#endif
}
else if (sl->spacetype == SPACE_NODE) {
@ -9844,8 +9845,9 @@ static BHead *find_bhead(FileData *fd, void *old)
#if 0
for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
if (bhead->old == old)
if (bhead->old == old) {
return bhead;
}
}
#endif

View File

@ -1168,15 +1168,19 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
* for minimal disruption. */
ts->gpencil_v3d_align = 0;
if (gpd->flag & GP_DATA_VIEWALIGN)
if (gpd->flag & GP_DATA_VIEWALIGN) {
ts->gpencil_v3d_align |= GP_PROJECT_VIEWSPACE;
if (gpd->flag & GP_DATA_DEPTH_VIEW)
}
if (gpd->flag & GP_DATA_DEPTH_VIEW) {
ts->gpencil_v3d_align |= GP_PROJECT_DEPTH_VIEW;
if (gpd->flag & GP_DATA_DEPTH_STROKE)
}
if (gpd->flag & GP_DATA_DEPTH_STROKE) {
ts->gpencil_v3d_align |= GP_PROJECT_DEPTH_STROKE;
}
if (gpd->flag & GP_DATA_DEPTH_STROKE_ENDPOINTS)
if (gpd->flag & GP_DATA_DEPTH_STROKE_ENDPOINTS) {
ts->gpencil_v3d_align |= GP_PROJECT_DEPTH_STROKE_ENDPOINTS;
}
}
else {
/* Default to cursor for all standard 3D views */

View File

@ -128,8 +128,9 @@ bool BM_disk_dissolve(BMesh *bm, BMVert *v)
BMLoop *l_a = BM_face_vert_share_loop(e->l->f, v);
BMLoop *l_b = (e->l->v == v) ? e->l->next : e->l;
if (!BM_face_split(bm, e->l->f, l_a, l_b, NULL, NULL, false))
if (!BM_face_split(bm, e->l->f, l_a, l_b, NULL, NULL, false)) {
return false;
}
if (!BM_disk_dissolve(bm, v)) {
return false;

View File

@ -734,8 +734,9 @@ void *bmo_slot_buffer_grow(BMesh *bm, BMOperator *op, int slot_code, int totadd)
BLI_assert(slot->slottype == BMO_OP_SLOT_ELEMENT_BUF);
/* check if its actually a buffer */
if (slot->slottype != BMO_OP_SLOT_ELEMENT_BUF)
if (slot->slottype != BMO_OP_SLOT_ELEMENT_BUF) {
return NULL;
}
if (slot->flag & BMOS_DYNAMIC_ARRAY) {
if (slot->len >= slot->size) {

View File

@ -1926,8 +1926,9 @@ BMEdge *BM_edge_exists(BMVert *v_a, BMVert *v_b)
BLI_assert(v_a->head.htype == BM_VERT && v_b->head.htype == BM_VERT);
BM_ITER_ELEM (e, &iter, v_a, BM_EDGES_OF_VERT) {
if (e->v1 == v_b || e->v2 == v_b)
if (e->v1 == v_b || e->v2 == v_b) {
return e;
}
}
return NULL;

View File

@ -66,24 +66,33 @@ static int erot_gsetutil_cmp(const void *a, const void *b)
{
const EdRotState *e_state_a = (const EdRotState *)a;
const EdRotState *e_state_b = (const EdRotState *)b;
if (e_state_a->v1 < e_state_b->v1)
if (e_state_a->v1 < e_state_b->v1) {
return -1;
else if (e_state_a->v1 > e_state_b->v1)
}
else if (e_state_a->v1 > e_state_b->v1) {
return 1;
else if (e_state_a->v2 < e_state_b->v2)
}
else if (e_state_a->v2 < e_state_b->v2) {
return -1;
else if (e_state_a->v2 > e_state_b->v2)
}
else if (e_state_a->v2 > e_state_b->v2) {
return 1;
else if (e_state_a->f1 < e_state_b->f1)
}
else if (e_state_a->f1 < e_state_b->f1) {
return -1;
else if (e_state_a->f1 > e_state_b->f1)
}
else if (e_state_a->f1 > e_state_b->f1) {
return 1;
else if (e_state_a->f2 < e_state_b->f2)
}
else if (e_state_a->f2 < e_state_b->f2) {
return -1;
else if (e_state_a->f2 > e_state_b->f2)
}
else if (e_state_a->f2 > e_state_b->f2) {
return 1;
else
}
else {
return 0;
}
}
#endif
static GSet *erot_gset_new(void)

View File

@ -389,8 +389,8 @@ bool AnimationExporter::is_bone_deform_group(Bone *bone)
/* Check if current bone is deform */
if ((bone->flag & BONE_NO_DEFORM) == 0) {
return true;
/* Check child bones */
}
/* Check child bones */
else {
for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) {
/* loop through all the children until deform bone is found, and then return */
@ -854,8 +854,9 @@ void AnimationExporter::export_morph_animation(Object *ob, BCAnimationSampler &s
{
FCurve *fcu;
Key *key = BKE_key_from_object(ob);
if (!key)
if (!key) {
return;
}
if (key->adt && key->adt->action) {
fcu = (FCurve *)key->adt->action->curves.first;

View File

@ -200,8 +200,9 @@ void AnimationImporter::add_fcurves_to_object(Main *bmain,
bool is_rotation = p && *(p + strlen("rotation_euler")) == '\0';
/* convert degrees to radians for rotation */
if (is_rotation)
if (is_rotation) {
fcurve_deg_to_rad(fcu);
}
#endif
for (it = curves.begin(), i = 0; it != curves.end(); it++, i++) {
@ -355,16 +356,19 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act)
FCurve *eulcu[3] = {NULL, NULL, NULL};
if (fcurves_actionGroup_map.find(grp) == fcurves_actionGroup_map.end())
if (fcurves_actionGroup_map.find(grp) == fcurves_actionGroup_map.end()) {
continue;
}
std::vector<FCurve *> &rot_fcurves = fcurves_actionGroup_map[grp];
if (rot_fcurves.size() > 3)
if (rot_fcurves.size() > 3) {
continue;
}
for (i = 0; i < rot_fcurves.size(); i++)
for (i = 0; i < rot_fcurves.size(); i++) {
eulcu[rot_fcurves[i]->array_index] = rot_fcurves[i];
}
char joint_path[100];
char rna_path[100];
@ -389,8 +393,9 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act)
FCurve *cu = eulcu[i];
if (!cu)
if (!cu) {
continue;
}
for (int j = 0; j < cu->totvert; j++) {
float frame = cu->bezt[j].vec[1][0];
@ -412,16 +417,18 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act)
eul_to_quat(quat, eul);
for (int k = 0; k < 4; k++)
for (int k = 0; k < 4; k++) {
create_bezt(quatcu[k], frame, quat[k], U.ipo_new);
}
}
}
/* now replace old Euler curves */
for (i = 0; i < 3; i++) {
if (!eulcu[i])
if (!eulcu[i]) {
continue;
}
action_groups_remove_channel(act, eulcu[i]);
free_fcurve(eulcu[i]);
@ -429,8 +436,9 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act)
chan->rotmode = ROT_MODE_QUAT;
for (i = 0; i < 4; i++)
for (i = 0; i < 4; i++) {
action_groups_add_channel(act, grp, quatcu[i]);
}
}
bPoseChannel *pchan;
@ -1671,8 +1679,9 @@ Object *AnimationImporter::translate_animation_OLD(
newcu[i] = create_fcurve(axis, rna_path);
#ifdef ARMATURE_TEST
if (is_joint)
if (is_joint) {
job_curves[i] = create_fcurve(axis, tm_str);
}
#endif
}
@ -1774,12 +1783,15 @@ Object *AnimationImporter::translate_animation_OLD(
for (i = 0; i < totcu; i++) {
if (is_matrix) {
if (i < 4)
if (i < 4) {
add_bezt(job_curves[i], fra, rot[i]);
else if (i < 7)
}
else if (i < 7) {
add_bezt(job_curves[i], fra, loc[i - 4]);
else
}
else {
add_bezt(job_curves[i], fra, scale[i - 7]);
}
}
else {
add_bezt(job_curves[i], fra, val[i]);
@ -1803,8 +1815,9 @@ Object *AnimationImporter::translate_animation_OLD(
}
#ifdef ARMATURE_TEST
if (is_joint)
if (is_joint) {
BLI_addtail(&job->adt->action->curves, job_curves[i]);
}
#endif
}
@ -2153,8 +2166,9 @@ bool AnimationImporter::evaluate_joint_world_transform_at_frame(
else {
COLLADAFW::NodePointerArray &children = node->getChildNodes();
for (int i = 0; i < children.getCount(); i++) {
if (evaluate_joint_world_transform_at_frame(mat, m, children[i], end, fra))
if (evaluate_joint_world_transform_at_frame(mat, m, children[i], end, fra)) {
return true;
}
}
}

View File

@ -439,14 +439,16 @@ Object *ArmatureImporter::get_empty_for_leaves()
Object *ArmatureImporter::find_armature(COLLADAFW::Node *node)
{
JointData *jd = get_joint_data(node);
if (jd)
if (jd) {
return jd->ob_arm;
}
COLLADAFW::NodePointerArray &children = node->getChildNodes();
for (int i = 0; i < children.getCount(); i++) {
Object *ob_arm = find_armature(children[i]);
if (ob_arm)
if (ob_arm) {
return ob_arm;
}
}
return NULL;
@ -457,8 +459,9 @@ ArmatureJoints &ArmatureImporter::get_armature_joints(Object *ob_arm)
/* try finding it */
std::vector<ArmatureJoints>::iterator it;
for (it = armature_joints.begin(); it != armature_joints.end(); it++) {
if ((*it).ob_arm == ob_arm)
if ((*it).ob_arm == ob_arm) {
return *it;
}
}
/* not found, create one */

View File

@ -201,8 +201,9 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
Image *ima = t->tex->ima;
// Image not set for texture
if (!ima)
if (!ima) {
continue;
}
std::string key(id_name(ima));
key = translate_id(key);

View File

@ -180,8 +180,9 @@ inline bool bc_startswith(std::string const &value, std::string const &starting)
#if 0 /* UNUSED */
inline bool bc_endswith(std::string const &value, std::string const &ending)
{
if (ending.size() > value.size())
if (ending.size() > value.size()) {
return false;
}
return std::equal(ending.rbegin(), ending.rend(), value.rbegin());
}
#endif

View File

@ -278,8 +278,9 @@ void ANIM_deselect_anim_channels(
break;
case ANIMTYPE_OBJECT:
#if 0 /* for now, do not take object selection into account, since it gets too annoying */
if (ale->flag & SELECT)
if (ale->flag & SELECT) {
sel = ACHANNEL_SETFLAG_CLEAR;
}
#endif
break;
case ANIMTYPE_GROUP:

View File

@ -455,10 +455,12 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
{ \
int _filter = filter_mode; \
short _doSubChannels = 0; \
if (!(filter_mode & ANIMFILTER_LIST_VISIBLE) || (expanded_check)) \
if (!(filter_mode & ANIMFILTER_LIST_VISIBLE) || (expanded_check)) { \
_doSubChannels = 1; \
else if (!(filter_mode & ANIMFILTER_LIST_CHANNELS)) \
} \
else if (!(filter_mode & ANIMFILTER_LIST_CHANNELS)) { \
_doSubChannels = 2; \
} \
else { \
filter_mode |= ANIMFILTER_TMP_PEEK; \
} \

View File

@ -1198,17 +1198,21 @@ static void meshdeform_bind_floodfill(MeshDeformBind *mdb)
{
int tb, ti, te, ts;
tb = ti = te = ts = 0;
for (a = 0; a < size * size * size; a++)
if (tag[a] == MESHDEFORM_TAG_BOUNDARY)
for (a = 0; a < size * size * size; a++) {
if (tag[a] == MESHDEFORM_TAG_BOUNDARY) {
tb++;
else if (tag[a] == MESHDEFORM_TAG_INTERIOR)
}
else if (tag[a] == MESHDEFORM_TAG_INTERIOR) {
ti++;
}
else if (tag[a] == MESHDEFORM_TAG_EXTERIOR) {
te++;
if (mdb->semibound[a])
if (mdb->semibound[a]) {
ts++;
}
}
}
printf("interior %d exterior %d boundary %d semi-boundary %d\n", ti, te, tb, ts);
}
@ -1557,14 +1561,17 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
#if 0
/* sanity check */
for (b = 0; b < mdb->size3; b++)
if (mdb->tag[b] != MESHDEFORM_TAG_EXTERIOR)
if (fabsf(mdb->totalphi[b] - 1.0f) > 1e-4f)
for (b = 0; b < mdb->size3; b++) {
if (mdb->tag[b] != MESHDEFORM_TAG_EXTERIOR) {
if (fabsf(mdb->totalphi[b] - 1.0f) > 1e-4f) {
printf("totalphi deficiency [%s|%d] %d: %.10f\n",
(mdb->tag[b] == MESHDEFORM_TAG_INTERIOR) ? "interior" : "boundary",
mdb->semibound[b],
mdb->varidx[b],
mdb->totalphi[b]);
}
}
}
#endif
/* free */

View File

@ -162,14 +162,16 @@ static bool pose_has_protected_selected(Object *ob, short warn)
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
if (pchan->bone && (pchan->bone->layer & arm->layer)) {
if (pchan->bone->layer & arm->layer_protected) {
if (pchan->bone->flag & BONE_SELECTED)
if (pchan->bone->flag & BONE_SELECTED) {
break;
}
}
}
}
if (pchan) {
if (warn)
if (warn) {
error("Cannot change Proxy protected bones");
}
return 1;
}
}

View File

@ -104,13 +104,15 @@ void printknots(Object *obedit)
if (ED_curve_nurb_select_check(nu) && nu->type == CU_NURBS) {
if (nu->knotsu) {
num = KNOTSU(nu);
for (a = 0; a < num; a++)
for (a = 0; a < num; a++) {
printf("knotu %d: %f\n", a, nu->knotsu[a]);
}
}
if (nu->knotsv) {
num = KNOTSV(nu);
for (a = 0; a < num; a++)
for (a = 0; a < num; a++) {
printf("knotv %d: %f\n", a, nu->knotsv[a]);
}
}
}
}

View File

@ -536,8 +536,9 @@ bool ED_gpencil_anim_copybuf_paste(bAnimContext *ac, const short offset_mode)
static short snap_gpf_nearest(bGPDframe *UNUSED(gpf), Scene *UNUSED(scene))
{
#if 0 /* note: gpf->framenum is already an int! */
if (gpf->flag & GP_FRAME_SELECT)
if (gpf->flag & GP_FRAME_SELECT) {
gpf->framenum = (int)(floor(gpf->framenum + 0.5));
}
#endif
return 0;
}

View File

@ -760,12 +760,15 @@ float ANIM_unit_mapping_get_factor(
*/
#define ACHANNEL_SET_FLAG(channel, smode, sflag) \
{ \
if (smode == ACHANNEL_SETFLAG_INVERT) \
if (smode == ACHANNEL_SETFLAG_INVERT) { \
(channel)->flag ^= (sflag); \
else if (smode == ACHANNEL_SETFLAG_ADD) \
} \
else if (smode == ACHANNEL_SETFLAG_ADD) { \
(channel)->flag |= (sflag); \
else \
} \
else { \
(channel)->flag &= ~(sflag); \
} \
} \
((void)0)
@ -776,12 +779,15 @@ float ANIM_unit_mapping_get_factor(
*/
#define ACHANNEL_SET_FLAG_NEG(channel, smode, sflag) \
{ \
if (smode == ACHANNEL_SETFLAG_INVERT) \
if (smode == ACHANNEL_SETFLAG_INVERT) { \
(channel)->flag ^= (sflag); \
else if (smode == ACHANNEL_SETFLAG_ADD) \
} \
else if (smode == ACHANNEL_SETFLAG_ADD) { \
(channel)->flag &= ~(sflag); \
else \
} \
else { \
(channel)->flag |= (sflag); \
} \
} \
((void)0)

View File

@ -1133,12 +1133,15 @@ void ED_mesh_geometry_add(Mesh *mesh, ReportList *reports, int verts, int edges,
return;
}
if (verts)
if (verts) {
mesh_add_verts(mesh, verts);
if (edges)
}
if (edges) {
mesh_add_edges(mesh, edges);
if (faces)
}
if (faces) {
mesh_add_faces(mesh, faces);
}
}
#endif

View File

@ -222,8 +222,9 @@ static void update_pyconstraint_cb(void *arg1, void *arg2)
# else
Object *owner = (Object *)arg1;
bConstraint *con = (bConstraint *)arg2;
if (owner && con)
if (owner && con) {
BPY_pyconstraint_update(owner, con);
}
# endif
}
#endif // UNUSED

View File

@ -1384,10 +1384,12 @@ static void link_to_scene(Main *UNUSED(bmain), unsigned short UNUSED(nr))
Scene *sce = (Scene *)BLI_findlink(&bmain->scene, G.curscreen->scenenr - 1);
Base *base, *nbase;
if (sce == NULL)
if (sce == NULL) {
return;
if (sce->id.lib)
}
if (sce->id.lib) {
return;
}
for (base = FIRSTBASE; base; base = base->next) {
if (BASE_SELECTED(v3d, base)) {

View File

@ -2437,8 +2437,9 @@ void ED_vgroup_mirror(Object *ob,
/* disabled, confusing when you have an active pose bone */
#if 0
/* flip active group index */
if (flip_vgroups && flip_map[def_nr] >= 0)
if (flip_vgroups && flip_map[def_nr] >= 0) {
ob->actdef = flip_map[def_nr] + 1;
}
#endif
cleanup:

View File

@ -3813,10 +3813,12 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
RV3D_ORTHO);
/* forcing camera is distracting */
#if 0
if (v3d->camera)
if (v3d->camera) {
region_quadview_init_rv3d(sa, (ar = ar->next), 0, RV3D_VIEW_CAMERA, RV3D_CAMOB);
else
}
else {
region_quadview_init_rv3d(sa, (ar = ar->next), 0, RV3D_VIEW_USER, RV3D_PERSP);
}
#else
(void)v3d;
#endif
@ -4580,12 +4582,15 @@ static int box_select_exec(bContext *C, wmOperator *op)
{
int event_type = RNA_int_get(op->ptr, "event_type");
if (event_type == LEFTMOUSE)
if (event_type == LEFTMOUSE) {
printf("box select do select\n");
else if (event_type == RIGHTMOUSE)
}
else if (event_type == RIGHTMOUSE) {
printf("box select deselect\n");
else
}
else {
printf("box select do something\n");
}
return 1;
}

View File

@ -653,16 +653,18 @@ static void paint_stroke_done(const bContext *C, struct PaintStroke *stroke)
/* duplicate warning, see texpaint_init */
#if 0
if (pop->s.warnmultifile)
if (pop->s.warnmultifile) {
BKE_reportf(op->reports,
RPT_WARNING,
"Image requires 4 color channels to paint: %s",
pop->s.warnmultifile);
if (pop->s.warnpackedfile)
}
if (pop->s.warnpackedfile) {
BKE_reportf(op->reports,
RPT_WARNING,
"Packed MultiLayer files cannot be painted: %s",
pop->s.warnpackedfile);
}
#endif
MEM_freeN(pop);
}

View File

@ -2256,8 +2256,9 @@ static bool project_bucket_isect_circle(const float cent[2],
* this is even less work then an intersection test.
*/
#if 0
if (BLI_rctf_isect_pt_v(bucket_bounds, cent))
if (BLI_rctf_isect_pt_v(bucket_bounds, cent)) {
return 1;
}
#endif
if ((bucket_bounds->xmin <= cent[0] && bucket_bounds->xmax >= cent[0]) ||

View File

@ -4225,8 +4225,9 @@ void sculpt_cache_calc_brushdata_symm(StrokeCache *cache,
printf("feather: %f frac: %f reduce: %f\n", feather, frac, reduce);
if (frac < 1)
if (frac < 1) {
mul_v3_fl(cache->grab_delta_symmetry, reduce);
}
}
#endif

View File

@ -654,8 +654,9 @@ static bool sculpt_undo_cleanup(bContext *C, ListBase *lb)
unode = lb->first;
if (unode && !STREQ(unode->idname, ob->id.name)) {
if (unode->bm_entry)
if (unode->bm_entry) {
BM_log_cleanup_entry(unode->bm_entry);
}
return true;
}

View File

@ -141,8 +141,9 @@ static void console_lb_debug__internal(ListBase *lb)
ConsoleLine *cl;
printf("%d: ", BLI_listbase_count(lb));
for (cl = lb->first; cl; cl = cl->next)
for (cl = lb->first; cl; cl = cl->next) {
printf("<%s> ", cl->line);
}
printf("\n");
}

View File

@ -2471,13 +2471,15 @@ static void filelist_readjob_main_rec(Main *bmain, FileList *filelist)
BLI_assert(filelist->filelist.entries == NULL);
if (filelist->filelist.root[0] == '/')
if (filelist->filelist.root[0] == '/') {
filelist->filelist.root[0] = '\0';
}
if (filelist->filelist.root[0]) {
idcode = groupname_to_code(filelist->filelist.root);
if (idcode == 0)
if (idcode == 0) {
filelist->filelist.root[0] = '\0';
}
}
if (filelist->dir[0] == 0) {
@ -2525,8 +2527,9 @@ static void filelist_readjob_main_rec(Main *bmain, FileList *filelist)
idcode = groupname_to_code(filelist->filelist.root);
lb = which_libbase(bmain, idcode);
if (lb == NULL)
if (lb == NULL) {
return;
}
filelist->filelist.nbr_entries = 0;
for (id = lb->first; id; id = id->next) {
@ -2537,8 +2540,9 @@ static void filelist_readjob_main_rec(Main *bmain, FileList *filelist)
/* XXX TODO: if databrowse F4 or append/link
* filelist->flags & FLF_HIDE_PARENT has to be set */
if (!(filelist->filter_data.flags & FLF_HIDE_PARENT))
if (!(filelist->filter_data.flags & FLF_HIDE_PARENT)) {
filelist->filelist.nbr_entries++;
}
if (filelist->filelist.nbr_entries > 0) {
filelist_resize(filelist, filelist->filelist.nbr_entries);
@ -2604,8 +2608,9 @@ static void filelist_readjob_main_rec(Main *bmain, FileList *filelist)
# endif
if (id->lib) {
if (totlib == 0)
if (totlib == 0) {
firstlib = files;
}
totlib++;
}

View File

@ -142,11 +142,14 @@ ImBuf *ED_space_image_acquire_buffer(SpaceImage *sima, void **r_lock)
if (sima && sima->image) {
#if 0
if (sima->image->type == IMA_TYPE_R_RESULT && BIF_show_render_spare())
if (sima->image->type == IMA_TYPE_R_RESULT && BIF_show_render_spare()) {
return BIF_render_spare_imbuf();
}
else
#endif
ibuf = BKE_image_acquire_ibuf(sima->image, &sima->iuser, r_lock);
{
ibuf = BKE_image_acquire_ibuf(sima->image, &sima->iuser, r_lock);
}
if (ibuf) {
if (ibuf->rect || ibuf->rect_float) {

View File

@ -77,16 +77,21 @@ int info_report_mask(SpaceInfo *UNUSED(sinfo))
#if 0
int report_mask = 0;
if (sinfo->rpt_mask & INFO_RPT_DEBUG)
if (sinfo->rpt_mask & INFO_RPT_DEBUG) {
report_mask |= RPT_DEBUG_ALL;
if (sinfo->rpt_mask & INFO_RPT_INFO)
}
if (sinfo->rpt_mask & INFO_RPT_INFO) {
report_mask |= RPT_INFO_ALL;
if (sinfo->rpt_mask & INFO_RPT_OP)
}
if (sinfo->rpt_mask & INFO_RPT_OP) {
report_mask |= RPT_OPERATOR_ALL;
if (sinfo->rpt_mask & INFO_RPT_WARN)
}
if (sinfo->rpt_mask & INFO_RPT_WARN) {
report_mask |= RPT_WARNING_ALL;
if (sinfo->rpt_mask & INFO_RPT_ERR)
}
if (sinfo->rpt_mask & INFO_RPT_ERR) {
report_mask |= RPT_ERROR_ALL;
}
return report_mask;
#endif

View File

@ -135,8 +135,9 @@ static void node_buts_time(uiLayout *layout, bContext *UNUSED(C), PointerRNA *pt
if (cumap) {
cumap->flag |= CUMA_DRAW_CFRA;
if (node->custom1 < node->custom2)
if (node->custom1 < node->custom2) {
cumap->sample[0] = (float)(CFRA - node->custom1) / (float)(node->custom2 - node->custom1);
}
}
#endif
@ -205,8 +206,9 @@ static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v)
bNode *node = node_v;
Tex *tex;
if (node->menunr < 1)
if (node->menunr < 1) {
return;
}
if (node->id) {
id_us_min(node->id);
@ -220,8 +222,9 @@ static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v)
nodeSetActive(ntree, node);
if (ntree->type == NTREE_TEXTURE)
if (ntree->type == NTREE_TEXTURE) {
ntreeTexCheckCyclics(ntree);
}
// allqueue(REDRAWBUTSSHADING, 0);
// allqueue(REDRAWNODE, 0);
@ -1143,8 +1146,9 @@ static void node_shader_buts_script_ex(uiLayout *layout, bContext *C, PointerRNA
node_shader_buts_script(layout, C, ptr);
#if 0 /* not implemented yet */
if (RNA_enum_get(ptr, "mode") == NODE_SCRIPT_EXTERNAL)
if (RNA_enum_get(ptr, "mode") == NODE_SCRIPT_EXTERNAL) {
uiItemR(layout, ptr, "use_auto_update", 0, NULL, ICON_NONE);
}
#endif
}

View File

@ -745,10 +745,11 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node)
else if (ntree->type == NTREE_TEXTURE) {
// XXX
#if 0
if (node->id)
; // XXX BIF_preview_changed(-1);
// allqueue(REDRAWBUTSSHADING, 1);
// allqueue(REDRAWIPO, 0);
if (node->id) {
// XXX BIF_preview_changed(-1);
// allqueue(REDRAWBUTSSHADING, 1);
// allqueue(REDRAWIPO, 0);
}
#endif
}
}
@ -784,17 +785,21 @@ static int edit_node_invoke_properties(bContext *C, wmOperator *op)
{
if (!RNA_struct_property_is_set(op->ptr, "node")) {
bNode *node = CTX_data_pointer_get_type(C, "node", &RNA_Node).data;
if (!node)
if (!node) {
return 0;
else
}
else {
RNA_string_set(op->ptr, "node", node->name);
}
}
if (!RNA_struct_property_is_set(op->ptr, "in_out"))
if (!RNA_struct_property_is_set(op->ptr, "in_out")) {
RNA_enum_set(op->ptr, "in_out", SOCK_IN);
}
if (!RNA_struct_property_is_set(op->ptr, "socket"))
if (!RNA_struct_property_is_set(op->ptr, "socket")) {
RNA_int_set(op->ptr, "socket", 0);
}
return 1;
}
@ -823,12 +828,15 @@ static void edit_node_properties_get(
break;
}
if (rnode)
if (rnode) {
*rnode = node;
if (rsock)
}
if (rsock) {
*rsock = sock;
if (rin_out)
}
if (rin_out) {
*rin_out = in_out;
}
}
#endif

View File

@ -1312,19 +1312,22 @@ static TreeElement *outliner_find_name(
if (found) {
/* name is right, but is element the previous one? */
if (prev) {
if ((te != prev) && (*prevFound))
if ((te != prev) && (*prevFound)) {
return te;
}
if (te == prev) {
*prevFound = 1;
}
}
else
else {
return te;
}
}
tes = outliner_find_name(soops, &te->subtree, name, flags, prev, prevFound);
if (tes)
if (tes) {
return tes;
}
}
/* nothing valid found */
@ -1372,8 +1375,9 @@ static void outliner_find_panel(
tselem = TREESTORE(te);
if (tselem) {
/* expand branches so that it will be visible, we need to get correct coordinates */
if (outliner_open_back(soops, te))
if (outliner_open_back(soops, te)) {
outliner_set_coordinates(ar, soops);
}
/* deselect all visible, and select found element */
outliner_flag_set(soops, &soops->tree, TSE_SELECTED, 0);
@ -1381,8 +1385,9 @@ static void outliner_find_panel(
/* make te->ys center of view */
ytop = (int)(te->ys + BLI_rctf_size_y(&ar->v2d.mask) / 2);
if (ytop > 0)
if (ytop > 0) {
ytop = 0;
}
ar->v2d.cur.ymax = (float)ytop;
ar->v2d.cur.ymin = (float)(ytop - BLI_rctf_size_y(&ar->v2d.mask));

View File

@ -376,12 +376,15 @@ static void outliner_add_object_contents(SpaceOutliner *soops,
soops, &tenla1->subtree, ob, tenla1, TSE_CONSTRAINT, const_index);
#if 0 /* disabled as it needs to be reworked for recoded constraints system */
target = get_constraint_target(con, &str);
if (str && str[0])
if (str && str[0]) {
ten1->name = str;
else if (target)
}
else if (target) {
ten1->name = target->id.name + 2;
else
}
else {
ten1->name = con->name;
}
#endif
ten1->name = con->name;
ten1->directdata = con;
@ -441,12 +444,15 @@ static void outliner_add_object_contents(SpaceOutliner *soops,
ten = outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_CONSTRAINT, a);
#if 0 /* disabled due to constraints system targets recode... code here needs review */
target = get_constraint_target(con, &str);
if (str && str[0])
if (str && str[0]) {
ten->name = str;
else if (target)
}
else if (target) {
ten->name = target->id.name + 2;
else
}
else {
ten->name = con->name;
}
#endif
ten->name = con->name;
ten->directdata = con;
@ -1678,20 +1684,25 @@ static int treesort_obtype_alpha(const void *v1, const void *v2)
else {
/* 2nd we check ob type */
if (x1->idcode == ID_OB && x2->idcode == ID_OB) {
if (((Object *)x1->id)->type > ((Object *)x2->id)->type)
if (((Object *)x1->id)->type > ((Object *)x2->id)->type) {
return 1;
else if (((Object *)x1->id)->type > ((Object *)x2->id)->type)
}
else if (((Object *)x1->id)->type > ((Object *)x2->id)->type) {
return -1;
else
}
else {
return 0;
}
}
else {
int comp = strcmp(x1->name, x2->name);
if (comp > 0)
if (comp > 0) {
return 1;
else if (comp < 0)
}
else if (comp < 0) {
return -1;
}
return 0;
}
}

View File

@ -1025,11 +1025,13 @@ static void set_filter_seq(Scene *scene)
Sequence *seq;
Editing *ed = BKE_sequencer_editing_get(scene, false);
if (ed == NULL)
if (ed == NULL) {
return;
}
if (okee("Set Deinterlace") == 0)
if (okee("Set Deinterlace") == 0) {
return;
}
SEQP_BEGIN (ed, seq) {
if (seq->flag & SELECT) {
@ -3159,8 +3161,9 @@ static Sequence *sequence_find_parent(Scene *scene, Sequence *child)
Sequence *parent = NULL;
Sequence *seq;
if (ed == NULL)
if (ed == NULL) {
return NULL;
}
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if ((seq != child) && seq_is_parent(seq, child)) {

View File

@ -149,8 +149,9 @@ void select_surround_from_last(Scene *scene)
{
Sequence *seq = get_last_seq(scene);
if (seq == NULL)
if (seq == NULL) {
return;
}
select_surrounding_handles(scene, seq);
}

View File

@ -107,11 +107,13 @@ static void txt_format_text(SpaceText *st)
{
TextLine *linep;
if (!st->text)
if (!st->text) {
return;
}
for (linep = st->text->lines.first; linep; linep = linep->next)
for (linep = st->text->lines.first; linep; linep = linep->next) {
txt_format_line(st, linep, 0);
}
}
#endif
@ -1024,23 +1026,29 @@ static void draw_documentation(const SpaceText *st, ARegion *ar)
int i, br, lines;
int boxw, boxh, l, x, y /* , top */ /* UNUSED */;
if (!st || !st->text)
if (!st || !st->text) {
return;
if (!texttool_text_is_active(st->text))
}
if (!texttool_text_is_active(st->text)) {
return;
}
docs = texttool_docs_get();
if (!docs)
if (!docs) {
return;
}
text_draw_context_init(st, &tdc);
/* Count the visible lines to the cursor */
for (tmp = st->text->curl, l = -st->top; tmp; tmp = tmp->prev, l++)
;
if (l < 0)
for (tmp = st->text->curl, l = -st->top; tmp; tmp = tmp->prev, l++) {
/* pass */
}
if (l < 0) {
return;
}
if (st->showlinenrs) {
x = st->cwidth * (st->text->curc - st->left) + TXT_OFFSET + TEXTXLOC - 4;
@ -1089,10 +1097,12 @@ static void draw_documentation(const SpaceText *st, ARegion *ar)
br = DOC_WIDTH;
lines = 0; // XXX -doc_scroll;
for (p = docs; *p; p++) {
if (*p == '\r' && *(++p) != '\n')
if (*p == '\r' && *(++p) != '\n') {
*(--p) = '\n'; /* Fix line endings */
if (*p == ' ' || *p == '\t')
}
if (*p == ' ' || *p == '\t') {
br = i;
}
else if (*p == '\n') {
buf[i] = '\0';
if (lines >= 0) {
@ -1115,8 +1125,9 @@ static void draw_documentation(const SpaceText *st, ARegion *ar)
br = DOC_WIDTH;
lines++;
}
if (lines >= DOC_HEIGHT)
if (lines >= DOC_HEIGHT) {
break;
}
}
}
#endif

View File

@ -718,8 +718,9 @@ static void view_editmove(unsigned short UNUSED(event))
/* only work in 3D window for now
* In the end, will have to send to event to a 2D window handler instead
*/
if (Trans.flag & T_2D_EDIT)
if (Trans.flag & T_2D_EDIT) {
return;
}
switch (event) {
case WHEELUPMOUSE:
@ -743,10 +744,12 @@ static void view_editmove(unsigned short UNUSED(event))
persptoetsen(PAD4);
}
}
else if (U.uiflag & USER_WHEELZOOMDIR)
else if (U.uiflag & USER_WHEELZOOMDIR) {
persptoetsen(PADMINUS);
else
}
else {
persptoetsen(PADPLUSKEY);
}
refresh = 1;
break;
@ -771,17 +774,20 @@ static void view_editmove(unsigned short UNUSED(event))
persptoetsen(PAD6);
}
}
else if (U.uiflag & USER_WHEELZOOMDIR)
else if (U.uiflag & USER_WHEELZOOMDIR) {
persptoetsen(PADPLUSKEY);
else
}
else {
persptoetsen(PADMINUS);
}
refresh = 1;
break;
}
if (refresh)
if (refresh) {
setTransformViewMatrices(&Trans);
}
#endif
}

View File

@ -2716,10 +2716,12 @@ static int uv_mouse_select_multi(bContext *C,
/* before bmesh */
#if 0
if (ts->selectmode != SCE_SELECT_FACE) {
if (flush == 1)
if (flush == 1) {
EDBM_select_flush(em);
else if (flush == -1)
}
else if (flush == -1) {
EDBM_deselect_flush(em);
}
}
#else
if (flush != 0) {

View File

@ -630,8 +630,9 @@ static void p_chart_topological_sanity_check(PChart *chart)
PVert *v;
PEdge *e;
for (v = chart->verts; v; v = v->nextlink)
for (v = chart->verts; v; v = v->nextlink) {
param_test_equals_ptr("v->edge->vert", v, v->edge->vert);
}
for (e = chart->edges; e; e = e->nextlink) {
if (e->pair) {
@ -1428,12 +1429,15 @@ static void p_chart_fill_boundaries(PChart *chart, PEdge *outer)
static int p_polygon_point_in(float *cp1, float *cp2, float *p)
{
if ((cp1[0] == p[0]) && (cp1[1] == p[1]))
if ((cp1[0] == p[0]) && (cp1[1] == p[1])) {
return 2;
else if ((cp2[0] == p[0]) && (cp2[1] == p[1]))
}
else if ((cp2[0] == p[0]) && (cp2[1] == p[1])) {
return 3;
else
}
else {
return (p_area_signed(cp1, cp2, p) >= 0.0f);
}
}
static void p_polygon_kernel_clip(float (*oldpoints)[2],
@ -1562,8 +1566,9 @@ static float p_vert_cotan(float *v1, float *v2, float *v3)
clen = len_v3(c);
if (clen == 0.0f)
if (clen == 0.0f) {
return 0.0f;
}
return dot_v3v3(a, b) / clen;
}
@ -1573,8 +1578,9 @@ static PBool p_vert_flipped_wheel_triangle(PVert *v)
PEdge *e = v->edge;
do {
if (p_face_uv_area_signed(e->face) < 0.0f)
if (p_face_uv_area_signed(e->face) < 0.0f) {
return P_TRUE;
}
e = p_wheel_edge_next(e);
} while (e && (e != v->edge));
@ -1672,8 +1678,9 @@ static void p_vert_harmonic_insert(PVert *v)
e = p_wheel_edge_next(e);
} while (e && (e != v->edge));
if (e == NULL)
if (e == NULL) {
npoints++;
}
points = MEM_mallocN(sizeof(float) * 2 * npoints, "PHarmonicPoints");
@ -1703,8 +1710,9 @@ static void p_vert_harmonic_insert(PVert *v)
e = v->edge;
do {
if (!(e->next->vert->flag & PVERT_PIN))
if (!(e->next->vert->flag & PVERT_PIN)) {
p_vert_map_harmonic_weights(e->next->vert);
}
e = p_wheel_edge_next(e);
} while (e && (e != v->edge));
@ -1719,8 +1727,9 @@ static void p_vert_fix_edge_pointer(PVert *v)
while (v->edge->pair) {
v->edge = p_wheel_edge_prev(v->edge);
if (v->edge == start)
if (v->edge == start) {
break;
}
}
}
@ -1747,37 +1756,44 @@ static void p_collapse_edge(PEdge *edge, PEdge *pair)
/* change e->vert pointers from old vertex to the target vertex */
e = oldv->edge;
do {
if ((e != edge) && !(pair && pair->next == e))
if ((e != edge) && !(pair && pair->next == e)) {
e->vert = keepv;
}
e = p_wheel_edge_next(e);
} while (e && (e != oldv->edge));
/* set keepv->edge pointer */
if ((edge && (keepv->edge == edge->next)) || (keepv->edge == pair)) {
if (edge && edge->next->pair)
if (edge && edge->next->pair) {
keepv->edge = edge->next->pair->next;
else if (pair && pair->next->next->pair)
}
else if (pair && pair->next->next->pair) {
keepv->edge = pair->next->next->pair;
else if (edge && edge->next->next->pair)
}
else if (edge && edge->next->next->pair) {
keepv->edge = edge->next->next->pair;
else
}
else {
keepv->edge = pair->next->pair->next;
}
}
/* update pairs and v->edge pointers */
if (edge) {
PEdge *e1 = edge->next, *e2 = e1->next;
if (e1->pair)
if (e1->pair) {
e1->pair->pair = e2->pair;
}
if (e2->pair) {
e2->pair->pair = e1->pair;
e2->vert->edge = p_wheel_edge_prev(e2);
}
else
else {
e2->vert->edge = p_wheel_edge_next(e2);
}
p_vert_fix_edge_pointer(e2->vert);
}
@ -1785,15 +1801,17 @@ static void p_collapse_edge(PEdge *edge, PEdge *pair)
if (pair) {
PEdge *e1 = pair->next, *e2 = e1->next;
if (e1->pair)
if (e1->pair) {
e1->pair->pair = e2->pair;
}
if (e2->pair) {
e2->pair->pair = e1->pair;
e2->vert->edge = p_wheel_edge_prev(e2);
}
else
else {
e2->vert->edge = p_wheel_edge_next(e2);
}
p_vert_fix_edge_pointer(e2->vert);
}
@ -1835,10 +1853,12 @@ static void p_split_vertex(PEdge *edge, PEdge *pair)
if (edge) {
PEdge *e1 = edge->next, *e2 = e1->next;
if (e1->pair)
if (e1->pair) {
e1->pair->pair = e1;
if (e2->pair)
}
if (e2->pair) {
e2->pair->pair = e2;
}
e2->vert->edge = e2;
p_vert_fix_edge_pointer(e2->vert);
@ -1848,10 +1868,12 @@ static void p_split_vertex(PEdge *edge, PEdge *pair)
if (pair) {
PEdge *e1 = pair->next, *e2 = e1->next;
if (e1->pair)
if (e1->pair) {
e1->pair->pair = e1;
if (e2->pair)
}
if (e2->pair) {
e2->pair->pair = e2;
}
e2->vert->edge = e2;
p_vert_fix_edge_pointer(e2->vert);
@ -1877,15 +1899,18 @@ static PBool p_collapse_allowed_topologic(PEdge *edge, PEdge *pair)
/* boundary edges */
if (!edge || !pair) {
/* avoid collapsing chart into an edge */
if (edge && !edge->next->pair && !edge->next->next->pair)
if (edge && !edge->next->pair && !edge->next->next->pair) {
return P_FALSE;
else if (pair && !pair->next->pair && !pair->next->next->pair)
}
else if (pair && !pair->next->pair && !pair->next->next->pair) {
return P_FALSE;
}
}
/* avoid merging two boundaries (oldv and keepv are on the 'other side' of
* the chart) */
else if (!p_vert_interior(oldv) && !p_vert_interior(keepv))
else if (!p_vert_interior(oldv) && !p_vert_interior(keepv)) {
return P_FALSE;
}
return P_TRUE;
}
@ -1931,8 +1956,9 @@ static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair)
continue;
}
if (p_collapse_normal_flipped(v1->co, v2->co, oldv->co, keepv->co))
if (p_collapse_normal_flipped(v1->co, v2->co, oldv->co, keepv->co)) {
return P_FALSE;
}
a[0] = angle;
a[1] = p_vec_angle(v2->co, v1->co, oldv->co);
@ -1947,10 +1973,12 @@ static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair)
maxangle = M_PI - minangle;
for (i = 0; i < 3; i++) {
if ((b[i] < a[i]) && (b[i] < minangle))
if ((b[i] < a[i]) && (b[i] < minangle)) {
return P_FALSE;
else if ((b[i] > a[i]) && (b[i] > maxangle))
}
else if ((b[i] > a[i]) && (b[i] > maxangle)) {
return P_FALSE;
}
}
e = p_wheel_edge_next(e);
@ -1958,21 +1986,24 @@ static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair)
if (p_vert_interior(oldv)) {
/* hlscm criterion: angular defect smaller than threshold */
if (fabsf(angulardefect) > (float)(M_PI * 30.0 / 180.0))
if (fabsf(angulardefect) > (float)(M_PI * 30.0 / 180.0)) {
return P_FALSE;
}
}
else {
PVert *v1 = p_boundary_edge_next(oldv->edge)->vert;
PVert *v2 = p_boundary_edge_prev(oldv->edge)->vert;
/* abf++ criterion 2: avoid collapsing verts inwards */
if (p_vert_interior(keepv))
if (p_vert_interior(keepv)) {
return P_FALSE;
}
/* don't collapse significant boundary changes */
angle = p_vec_angle(v1->co, oldv->co, v2->co);
if (angle < (M_PI * 160.0 / 180.0))
if (angle < (M_PI * 160.0 / 180.0)) {
return P_FALSE;
}
}
return P_TRUE;
@ -1984,8 +2015,9 @@ static PBool p_collapse_allowed(PEdge *edge, PEdge *pair)
p_collapsing_verts(edge, pair, &oldv, &keepv);
if (oldv->flag & PVERT_PIN)
if (oldv->flag & PVERT_PIN) {
return P_FALSE;
}
return (p_collapse_allowed_topologic(edge, pair) && p_collapse_allowed_geometric(edge, pair));
}
@ -2027,8 +2059,9 @@ static float p_collapse_cost(PEdge *edge, PEdge *pair)
# if 0
shapecost += dot_v3v3(co1, keepv->co);
if (p_wheel_edge_next(e) == NULL)
if (p_wheel_edge_next(e) == NULL) {
shapecost += dot_v3v3(co2, keepv->co);
}
# endif
p_triangle_angles(oldv->co, co1, co2, &a1, &a2, &a3);
@ -2239,19 +2272,23 @@ static void p_chart_simplify_compute(PChart *chart)
p_collapse_cost_vertex(v, &cost, &e);
if (e)
if (e) {
v->u.heaplink = BLI_heap_insert(heap, cost, e);
else
}
else {
v->u.heaplink = NULL;
}
}
for (e = chart->edges; e; e = e->nextlink)
for (e = chart->edges; e; e = e->nextlink) {
e->u.nextcollapse = NULL;
}
/* pop edge collapse out of heap one by one */
while (!BLI_heap_is_empty(heap)) {
if (ncollapsed == NCOLLAPSE)
if (ncollapsed == NCOLLAPSE) {
break;
}
HeapNode *link = BLI_heap_top(heap);
PEdge *edge = (PEdge *)BLI_heap_pop_min(heap), *pair = edge->pair;
@ -2282,8 +2319,9 @@ static void p_chart_simplify_compute(PChart *chart)
wheelverts[nwheelverts++] = wheele->next->vert;
nexte = p_wheel_edge_next(wheele);
if (nexte == NULL)
if (nexte == NULL) {
wheelverts[nwheelverts++] = wheele->next->next->vert;
}
wheele = nexte;
} while (wheele && (wheele != oldv->edge));
@ -2304,8 +2342,9 @@ static void p_chart_simplify_compute(PChart *chart)
p_collapse_cost_vertex(v, &cost, &collapse);
if (collapse)
if (collapse) {
v->u.heaplink = BLI_heap_insert(heap, cost, collapse);
}
}
ncollapsed++;
@ -2324,8 +2363,9 @@ static void p_chart_complexify(PChart *chart)
int x = 0;
for (e = chart->collapsed_edges; e; e = e->nextlink) {
if (!(e->flag & PEDGE_COLLAPSE_EDGE))
if (!(e->flag & PEDGE_COLLAPSE_EDGE)) {
break;
}
edge = e;
pair = e->pair;

View File

@ -144,14 +144,16 @@ Controller::~Controller()
#if 0
if (NULL != _SilhouetteNode) {
int ref = _SilhouetteNode->destroy();
if (0 == ref)
if (0 == ref) {
delete _SilhouetteNode;
}
}
if (NULL != _DebugNode) {
int ref = _DebugNode->destroy();
if (0 == ref)
if (0 == ref) {
delete _DebugNode;
}
}
#endif
@ -447,8 +449,9 @@ void Controller::DeleteViewMap(bool freeCache)
_pView->DetachDebug();
if (NULL != _DebugNode) {
int ref = _DebugNode->destroy();
if (0 == ref)
if (0 == ref) {
_DebugNode->addRef();
}
}
#endif
@ -636,8 +639,9 @@ void Controller::ComputeViewMap()
void Controller::ComputeSteerableViewMap()
{
#if 0 // soc
if ((!_Canvas) || (!_ViewMap))
if ((!_Canvas) || (!_ViewMap)) {
return;
}
// Build 4 nodes containing the edges in the 4 directions
NodeGroup *ng[Canvas::NB_STEERABLE_VIEWMAP];
@ -659,16 +663,18 @@ void Controller::ComputeSteerableViewMap()
NodeShape *ns;
for (ViewMap::fedges_container::iterator f = fedges.begin(), fend = fedges.end(); f != fend;
++f) {
if ((*f)->viewedge()->qi() != 0)
if ((*f)->viewedge()->qi() != 0) {
continue;
}
fRep = new LineRep((*f)->vertexA()->point2d(), (*f)->vertexB()->point2d());
completeNS->AddRep(fRep); // add to the complete map anyway
double *oweights = svm->AddFEdge(*f);
for (i = 0; i < (Canvas::NB_STEERABLE_VIEWMAP - 1); ++i) {
ns = new NodeShape;
double wc = oweights[i] * c;
if (oweights[i] == 0)
if (oweights[i] == 0) {
continue;
}
ns->material().setDiffuse(wc, wc, wc, 1);
ns->AddRep(fRep);
ng[i]->AddChild(ns);
@ -1096,12 +1102,14 @@ void Controller::displayDensityCurves(int x, int y)
// display the curves
#if 0
for (i = 0; i < nbCurves; ++i)
for (i = 0; i < nbCurves; ++i) {
_pDensityCurvesWindow->setOrientationCurve(
i, Vec2d(0, 0), Vec2d(nbPoints, 1), curves[i], "scale", "density");
for (i = 1; i <= 8; ++i)
}
for (i = 1; i <= 8; ++i) {
_pDensityCurvesWindow->setLevelCurve(
i, Vec2d(0, 0), Vec2d(nbCurves, 1), curvesDirection[i], "orientation", "density");
}
_pDensityCurvesWindow->show();
#endif
}

View File

@ -319,8 +319,9 @@ void BlenderFileLoader::addTriangle(struct LoaderState *ls,
#if 0
len = len_v3v3(fv[i], fv[(i + 1) % 3]);
if (_minEdgeSize > len)
if (_minEdgeSize > len) {
_minEdgeSize = len;
}
#endif
*ls->pvi = ls->currentIndex;

View File

@ -215,8 +215,9 @@ class Polygon3r : public Polygon<Vec3r> {
real epsilon = M_EPSILON) const
{
#if 0
if (_vertices.size() < 3)
if (_vertices.size() < 3) {
return false;
}
#endif
return GeomUtils::intersectRayTriangle(
orig, dir, _vertices[0], _vertices[1], _vertices[2], t, u, v, epsilon);

View File

@ -55,10 +55,12 @@ template<class Edge> class Intersection {
/*! returns the parameter giving the intersection, for the edge iEdge */
real getParameter(Edge *iEdge)
{
if (iEdge == EdgeA)
if (iEdge == EdgeA) {
return tA;
if (iEdge == EdgeB)
}
if (iEdge == EdgeB) {
return tB;
}
return 0;
}
@ -131,8 +133,9 @@ template<class T, class Point> class Segment {
inline bool operator==(const Segment<T, Point> &iBrother)
{
if (_edge == iBrother._edge)
if (_edge == iBrother._edge) {
return true;
}
return false;
}
@ -237,10 +240,12 @@ template<class T, class Point> class SweepLine {
vector<Segment<T, Point> *> toadd;
typename vector<Segment<T, Point> *>::iterator s, send;
for (s = segments.begin(), send = segments.end(); s != send; s++) {
if (p == (*(*s))[0])
if (p == (*(*s))[0]) {
toadd.push_back((*s));
else
}
else {
remove((*s));
}
}
for (s = toadd.begin(), send = toadd.end(); s != send; s++) {
add((*s), binrule, epsilon);
@ -275,8 +280,9 @@ template<class T, class Point> class SweepLine {
s != send;
s++) {
Segment<T, Point> *currentS = (*s);
if (true != binrule(*S, *currentS))
if (true != binrule(*S, *currentS)) {
continue;
}
if (true == currentS->order()) {
v2[0] = ((*currentS)[0])[0];
@ -290,8 +296,9 @@ template<class T, class Point> class SweepLine {
v2[0] = ((*currentS)[1])[0];
v2[1] = ((*currentS)[1])[1];
}
if (S->CommonVertex(*currentS, CP))
if (S->CommonVertex(*currentS, CP)) {
continue; // the two edges have a common vertex->no need to check
}
if (GeomUtils::intersect2dSeg2dSegParametric(v0, v1, v2, v3, t, u, epsilon) ==
GeomUtils::DO_INTERSECT) {
@ -312,8 +319,9 @@ template<class T, class Point> class SweepLine {
inline void remove(Segment<T, Point> *s)
{
if (s->intersections().size() > 0)
if (s->intersections().size() > 0) {
_IntersectedEdges.push_back(s);
}
_set.remove(s);
}

View File

@ -868,8 +868,9 @@ template<class T, unsigned N>
inline Vec<T, N> operator/(const Vec<T, N> &v, const typename Vec<T, N>::value_type r)
{
Vec<T, N> res(v);
if (r)
if (r) {
res /= r;
}
return res;
}
@ -878,8 +879,9 @@ template<class T, unsigned N>
inline typename Vec<T, N>::value_type operator*(const Vec<T, N> &v1, const Vec<T, N> &v2)
{
typename Vec<T, N>::value_type sum = 0;
for (unsigned int i = 0; i < N; i++)
for (unsigned int i = 0; i < N; i++) {
sum += v1[i] * v2[i];
}
return sum;
}

View File

@ -45,9 +45,9 @@ class SceneHash : public SceneVisitor {
{
}
VISIT_DECL(NodeCamera)
VISIT_DECL(NodeViewLayer)
VISIT_DECL(IndexedFaceSet)
VISIT_DECL(NodeCamera);
VISIT_DECL(NodeViewLayer);
VISIT_DECL(IndexedFaceSet);
string toString();

View File

@ -41,12 +41,12 @@ namespace Freestyle {
{ \
}
#define VISIT_DECL(type) virtual void visit##type(type &);
#define VISIT_DECL(type) virtual void visit##type(type &)
#define VISIT_COMPLETE_DECL(type) \
virtual void visit##type##Before(type &); \
virtual void visit##type(type &); \
virtual void visit##type##After(type &);
virtual void visit##type##After(type &)
class Node;
class NodeShape;

View File

@ -544,7 +544,7 @@ class CurvePiece {
int ns1 = ns / 2;
int ns2 = ns - ns1;
for (int i = 0; i < ns1; ++it, ++i) {
;
/* pass */
}
CurvePiece *second = new CurvePiece(it, _last, ns2 + 1);

View File

@ -311,15 +311,17 @@ Vec3r CurvePoint::normal() const
#if 0
Material CurvePoint::material() const
{
if (__A == 0)
if (__A == 0) {
return __B->material();
}
return __A->material();
}
Id CurvePoint::shape_id() const
{
if (__A == 0)
if (__A == 0) {
return __B->shape_id();
}
return __A->shape_id();
}
#endif
@ -335,17 +337,20 @@ const SShape *CurvePoint::shape() const
#if 0
float CurvePoint::shape_importance() const
{
if (__A == 0)
if (__A == 0) {
return __B->shape_importance();
}
return __A->shape_importance();
}
const unsigned CurvePoint::qi() const
{
if (__A == 0)
if (__A == 0) {
return __B->qi();
if (__B == 0)
}
if (__B == 0) {
return __A->qi();
}
return __A->getFEdge(*__B)->qi();
}
#endif
@ -463,19 +468,23 @@ Vec3r shaded_color() const;
Vec3r CurvePoint::orientation2d() const
{
if (__A == 0)
if (__A == 0) {
return __B->orientation2d();
if (__B == 0)
}
if (__B == 0) {
return __A->orientation2d();
}
return __B->point2d() - __A->point2d();
}
Vec3r CurvePoint::orientation3d() const
{
if (__A == 0)
if (__A == 0) {
return __B->orientation3d();
if (__B == 0)
}
if (__B == 0) {
return __A->orientation3d();
}
return __B->point3d() - __A->point3d();
}
@ -491,10 +500,12 @@ Vec3r CurvePoint::curvature2d_as_vector() const
Vec3r edgeB = (_FEdges[1])->orientation2d().normalize();
return edgeA + edgeB;
# endif
if (__A == 0)
if (__A == 0) {
return __B->curvature2d_as_vector();
if (__B == 0)
}
if (__B == 0) {
return __A->curvature2d_as_vector();
}
return ((1 - _t2d) * __A->curvature2d_as_vector() + _t2d * __B->curvature2d_as_vector());
}
@ -509,28 +520,34 @@ real CurvePoint::curvature2d_as_angle() const
N2.normalize();
return acos((N1 * N2));
# endif
if (__A == 0)
if (__A == 0) {
return __B->curvature2d_as_angle();
if (__B == 0)
}
if (__B == 0) {
return __A->curvature2d_as_angle();
}
return ((1 - _t2d) * __A->curvature2d_as_angle() + _t2d * __B->curvature2d_as_angle());
}
real CurvePoint::curvatureFredo() const
{
if (__A == 0)
if (__A == 0) {
return __B->curvatureFredo();
if (__B == 0)
}
if (__B == 0) {
return __A->curvatureFredo();
}
return ((1 - _t2d) * __A->curvatureFredo() + _t2d * __B->curvatureFredo());
}
Vec2d CurvePoint::directionFredo() const
{
if (__A == 0)
if (__A == 0) {
return __B->directionFredo();
if (__B == 0)
}
if (__B == 0) {
return __A->directionFredo();
}
return ((1 - _t2d) * __A->directionFredo() + _t2d * __B->directionFredo());
}
#endif
@ -745,8 +762,9 @@ Material Curve::material() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
const Material &mat = (*v)->material();
for (; v != vend; ++v) {
if ((*v)->material() != mat)
if ((*v)->material() != mat) {
Exception::raiseException();
}
}
return mat;
}
@ -756,8 +774,9 @@ int Curve::qi() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
int qi_ = (*v)->qi();
for (; v != vend; ++v) {
if ((*v)->qi() != qi_)
if ((*v)->qi() != qi_) {
Exception::raiseException();
}
}
return qi_;
}
@ -782,8 +801,9 @@ bool Curve::occluders_empty() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
bool empty = (*v)->occluders_empty();
for (; v != vend; ++v) {
if ((*v)->occluders_empty() != empty)
if ((*v)->occluders_empty() != empty) {
Exception::raiseException();
}
}
return empty;
}
@ -798,8 +818,9 @@ const SShape *Curve::occluded_shape() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
const SShape *sshape = (*v)->occluded_shape();
for (; v != vend; ++v) {
if ((*v)->occluded_shape() != sshape)
if ((*v)->occluded_shape() != sshape) {
Exception::raiseException();
}
}
return sshape;
}
@ -809,8 +830,9 @@ const bool Curve::occludee_empty() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
bool empty = (*v)->occludee_empty();
for (; v != vend; ++v) {
if ((*v)->occludee_empty() != empty)
if ((*v)->occludee_empty() != empty) {
Exception::raiseException();
}
}
return empty;
}
@ -824,8 +846,9 @@ int Curve::shape_id() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
Id id = (*v)->shape_id();
for (; v != vend; ++v) {
if ((*v)->shape_id() != id)
if ((*v)->shape_id() != id) {
Exception::raiseException();
}
}
return id.first;
}
@ -835,8 +858,9 @@ const SShape *Curve::shape() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
const SShape *sshape = (*v)->shape();
for (; v != vend; ++v) {
if ((*v)->shape() != sshape)
if ((*v)->shape() != sshape) {
Exception::raiseException();
}
}
return sshape;
}
@ -915,8 +939,9 @@ void Curve::computeCurvatureAndOrientation()
for (; v ! = vend; ++v) {
v2 = v;
++v2;
if (v2 == vend)
if (v2 == vend) {
break;
}
Vec3r p2 = (*v2)->point2d();
Vec2d BA = p0 - p1;
@ -930,10 +955,12 @@ void Curve::computeCurvatureAndOrientation()
normal.normalizeSafe();
real curvature = normalCurvature * normal;
if (lba + lbc > MY_EPSILON)
if (lba + lbc > MY_EPSILON) {
curvature /= (0.5 * lba + lbc);
if (dir.norm() < MY_EPSILON)
}
if (dir.norm() < MY_EPSILON) {
dir = 0.1 * prevDir;
}
(*v)->setCurvatureFredo(curvature);
(*v)->setDirectionFredo(dir);
@ -975,8 +1002,9 @@ void Curve::computeCurvatureAndOrientation()
for (; v != vend; ++v) {
v2 = v;
++v2;
if (v2 == vend)
if (v2 == vend) {
break;
}
Vec3r p2 = (*v2)->point2d();
Vec2d BA = p0 - p1;

View File

@ -226,8 +226,9 @@ void Operators::bidirectionalChain(ViewEdgeIterator &it,
UnaryPredicate1D &pred,
UnaryFunction1D_void &modifier)
{
if (_current_view_edges_set.empty())
if (_current_view_edges_set.empty()) {
return;
}
unsigned id = 0;
ViewEdge *edge;
@ -236,8 +237,9 @@ void Operators::bidirectionalChain(ViewEdgeIterator &it,
for (I1DContainer::iterator it_edge = _current_view_edges_set.begin();
it_edge != _current_view_edges_set.end();
++it_edge) {
if (pred(**it_edge))
if (pred(**it_edge)) {
continue;
}
edge = dynamic_cast<ViewEdge *>(*it_edge);
it.setBegin(edge);
@ -266,14 +268,16 @@ void Operators::bidirectionalChain(ViewEdgeIterator &it,
_current_chains_set.push_back(new_chain);
}
if (!_current_chains_set.empty())
if (!_current_chains_set.empty()) {
_current_set = &_current_chains_set;
}
}
void Operators::bidirectionalChain(ViewEdgeIterator &it, UnaryPredicate1D &pred)
{
if (_current_view_edges_set.empty())
if (_current_view_edges_set.empty()) {
return;
}
unsigned id = 0;
Functions1D::IncrementChainingTimeStampF1D ts;
@ -285,8 +289,9 @@ void Operators::bidirectionalChain(ViewEdgeIterator &it, UnaryPredicate1D &pred)
for (I1DContainer::iterator it_edge = _current_view_edges_set.begin();
it_edge != _current_view_edges_set.end();
++it_edge) {
if (pred(**it_edge) || pred_ts(**it_edge))
if (pred(**it_edge) || pred_ts(**it_edge)) {
continue;
}
edge = dynamic_cast<ViewEdge *>(*it_edge);
it.setBegin(edge);
@ -315,8 +320,9 @@ void Operators::bidirectionalChain(ViewEdgeIterator &it, UnaryPredicate1D &pred)
_current_chains_set.push_back(new_chain);
}
if (!_current_chains_set.empty())
if (!_current_chains_set.empty()) {
_current_set = &_current_chains_set;
}
}
#endif

View File

@ -869,8 +869,9 @@ Stroke::const_vertex_iterator Stroke::vertices_last() const
Stroke::vertex_container::reverse_iterator Stroke::vertices_last(float sampling)
{
// Resample if necessary
if (sampling < _sampling)
if (sampling < _sampling) {
Resample(sampling);
}
return _Vertices.rbegin();
}
@ -901,8 +902,9 @@ Material Stroke::material() const
const_vertex_iterator v = vertices_begin(), vend = strokeVerticesEnd();
Material mat = (*v)->material();
for (; v != vend; ++v) {
if (mat != (*v)->material())
if (mat != (*v)->material()) {
Exception::raiseException();
}
}
return mat;
}
@ -912,8 +914,9 @@ int Stroke::qi() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
int qi_ = (*v)->qi();
for (; v != vend; ++v) {
if ((*v)->qi() != qi_)
if ((*v)->qi() != qi_) {
Exception::raiseException();
}
}
return qi_;
}
@ -938,8 +941,9 @@ bool Stroke::occluders_empty() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
bool empty = (*v)->occluders_empty();
for (; v != vend; ++v) {
if ((*v)->occluders_empty() != empty)
if ((*v)->occluders_empty() != empty) {
Exception::raiseException();
}
}
return empty;
}
@ -956,8 +960,9 @@ const SShape *Stroke::occluded_shape() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
const SShape *sshape = (*v)->occluded_shape();
for (; v != vend; ++v) {
if ((*v)->occluded_shape() != sshape)
if ((*v)->occluded_shape() != sshape) {
Exception::raiseException();
}
}
return sshape;
}
@ -967,8 +972,9 @@ const bool Stroke::occludee_empty() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
bool empty = (*v)->occludee_empty();
for (; v != vend; ++v) {
if ((*v)->occludee_empty() != empty)
if ((*v)->occludee_empty() != empty) {
Exception::raiseException();
}
}
return empty;
}
@ -978,8 +984,9 @@ const SShape *Stroke::shape() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
const SShape *sshape = (*v)->shape();
for (; v != vend; ++v) {
if ((*v)->shape() != sshape)
if ((*v)->shape() != sshape) {
Exception::raiseException();
}
}
return sshape;
}

View File

@ -174,17 +174,21 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices)
real orientation = o1 * o2;
if (orientation > 0) {
// then the vertex to move is v0
if (o1 > 0)
if (o1 > 0) {
_vertex[0] = _vertex[1] + userDir;
else
}
else {
_vertex[0] = _vertex[1] - userDir;
}
}
if (orientation < 0) {
// then we must move v1
if (o1 < 0)
if (o1 < 0) {
_vertex[1] = _vertex[0] + userDir;
else
}
else {
_vertex[1] = _vertex[0] - userDir;
}
}
}
#endif
@ -336,17 +340,21 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices)
real orientation = o1 * o2;
if (orientation > 0) {
// then the vertex to move is vn
if (o1 < 0)
if (o1 < 0) {
_vertex[n] = _vertex[n - 1] + userDir;
else
}
else {
_vertex[n] = _vertex[n - 1] - userDir;
}
}
if (orientation < 0) {
// then we must move vn-1
if (o1 > 0)
if (o1 > 0) {
_vertex[n - 1] = _vertex[n] + userDir;
else
}
else {
_vertex[n - 1] = _vertex[n] - userDir;
}
}
}
#endif
@ -715,18 +723,22 @@ void Strip::computeTexCoordWithTips(const vector<StrokeVertex *> &iStrokeVertice
#if 0
cerr << "u=" << u << " i=" << i << "/" << _sizeStrip << endl;
for (i = 0; i < _sizeStrip; i++)
for (i = 0; i < _sizeStrip; i++) {
_alpha[i] = 1.0;
}
for (i = 0; i < _sizeStrip; i++)
for (i = 0; i < _sizeStrip; i++) {
cerr << "(" << _texCoord[i][0] << ", " << _texCoord[i][1] << ") ";
}
cerr << endl;
Vec2r vec_tmp;
for (i = 0; i < _sizeStrip / 2; i++)
for (i = 0; i < _sizeStrip / 2; i++) {
vec_tmp = _vertex[2 * i] - _vertex[2 * i + 1];
if (vec_tmp.norm() > 4 * _averageThickness)
}
if (vec_tmp.norm() > 4 * _averageThickness) {
cerr << "Warning (from Fredo): There is a pb in the texture coordinates computation" << endl;
}
#endif
}
@ -750,10 +762,12 @@ StrokeRep::StrokeRep()
}
#if 0
_averageTextureAlpha = 0.5; //default value
if (_strokeType == OIL_STROKE)
if (_strokeType == OIL_STROKE) {
_averageTextureAlpha = 0.75;
if (_strokeType >= NO_BLEND_STROKE)
_averageTextureAlpha = 1.0
}
if (_strokeType >= NO_BLEND_STROKE) {
_averageTextureAlpha = 1.0;
}
#endif
}
@ -782,10 +796,12 @@ StrokeRep::StrokeRep(Stroke *iStroke)
#if 0
_averageTextureAlpha = 0.5; //default value
if (_strokeType == OIL_STROKE)
if (_strokeType == OIL_STROKE) {
_averageTextureAlpha = 0.75;
if (_strokeType >= NO_BLEND_STROKE)
}
if (_strokeType >= NO_BLEND_STROKE) {
_averageTextureAlpha = 1.0;
}
#endif
create();
}

View File

@ -27,8 +27,9 @@ namespace Freestyle {
namespace Cast {
template<class T, class U> U *cast(T *in)
{
if (!in)
if (!in) {
return NULL;
}
return dynamic_cast<U *>(in);
}
} // end of namespace Cast

View File

@ -112,10 +112,12 @@ class Id {
/*! Operator< */
bool operator<(const Id &id) const
{
if (_first < id._first)
if (_first < id._first) {
return true;
if (_first == id._first && _second < id._second)
}
if (_first == id._first && _second < id._second) {
return true;
}
return false;
}

View File

@ -54,8 +54,9 @@ class RenderMonitor {
inline void progress(float i)
{
if (_re)
if (_re) {
_re->progress(_re->prh, i);
}
}
inline bool testBreak()

View File

@ -472,8 +472,9 @@ void FEdgeXDetector::ProcessRidgeFace(WXFace *iFace)
// find the ridge layer of the face
iFace->retrieveSmoothLayers(Nature::RIDGE, SmoothLayers);
if (SmoothLayers.size() != 1)
if (SmoothLayers.size() != 1) {
return;
}
faceLayer = SmoothLayers[0];
// retrieve the curvature info of this layer
layer_info = (Face_Curvature_Info *)faceLayer->userdata;
@ -491,8 +492,9 @@ void FEdgeXDetector::ProcessRidgeFace(WXFace *iFace)
for (; fit != fitend; ++fit) {
WXFace *wxf = dynamic_cast<WXFace *>(*fit);
WOEdge *oppositeEdge;
if (!(wxf->getOppositeEdge(v, oppositeEdge)))
if (!(wxf->getOppositeEdge(v, oppositeEdge))) {
continue;
}
v1v2 = oppositeEdge->GetbVertex()->GetVertex() - oppositeEdge->GetaVertex()->GetVertex();
GeomUtils::intersection_test res;
res = GeomUtils::intersectRayPlane(
@ -500,8 +502,9 @@ void FEdgeXDetector::ProcessRidgeFace(WXFace *iFace)
if ((res == GeomUtils::DO_INTERSECT) && (t >= 0.0) && (t <= 1.0)) {
vector<WXFaceLayer *> second_ridge_layer;
wxf->retrieveSmoothLayers(Nature::RIDGE, second_ridge_layer);
if (second_ridge_layer.size() != 1)
if (second_ridge_layer.size() != 1) {
continue;
}
Face_Curvature_Info *second_layer_info =
(Face_Curvature_Info *)second_ridge_layer[0]->userdata;
@ -542,12 +545,14 @@ void FEdgeXDetector::ProcessRidgeFace(WXFace *iFace)
e1.normalize();
Vec3r e2((layer_info->vec_curvature_info[2]->K1 * layer_info->vec_curvature_info[2]->e1));
e2.normalize();
if (e0 * e1 < 0)
if (e0 * e1 < 0) {
// invert dotP[1]
faceLayer->ReplaceDotP(1, -faceLayer->dotP(1));
if (e0 * e2 < 0)
}
if (e0 * e2 < 0) {
// invert dotP[2]
faceLayer->ReplaceDotP(2, -faceLayer->dotP(2));
}
# if 0 // remove the weakest values;
real minDiff = (_maxK1 - _minK1) / 10.0;

View File

@ -355,11 +355,13 @@ real FEdge::local_average_density(float sigma, int iCombination) const
Vec3r FEdge::normal(int &oException /* = Exception::NO_EXCEPTION */)
{
Vec3r Na = _VertexA->normal(oException);
if (oException != Exception::NO_EXCEPTION)
if (oException != Exception::NO_EXCEPTION) {
return Na;
}
Vec3r Nb = _VertexB->normal(oException);
if (oException != Exception::NO_EXCEPTION)
if (oException != Exception::NO_EXCEPTION) {
return Nb;
}
return (Na + Nb) / 2.0;
}

View File

@ -295,8 +295,9 @@ void SteerableViewMap::saveSteerableViewMap() const
for (unsigned int y = 0; y < oh; ++y) {
for (unsigned int x = 0; x < ow; ++x) {
int c = (int)(coeff * img->pixel(x, y));
if (c > 255)
if (c > 255) {
c = 255;
}
//int c = (int)(_imagesPyramids[i]->pixel(x, y, j));
qtmp.setPixel(x, y, qRgb(c, c, c));
}

View File

@ -348,7 +348,7 @@ void TVertex::setFrontEdgeA(ViewEdge *iFrontEdgeA, bool incoming)
if (!_sortedEdges.empty()) {
edge_pointers_container::iterator dve = _sortedEdges.begin(), dveend = _sortedEdges.end();
for (; (dve != dveend) && ViewEdgeComp(**dve, _FrontEdgeA); ++dve) {
;
/* pass */
}
_sortedEdges.insert(dve, &_FrontEdgeA);
}
@ -367,7 +367,7 @@ void TVertex::setFrontEdgeB(ViewEdge *iFrontEdgeB, bool incoming)
if (!_sortedEdges.empty()) {
edge_pointers_container::iterator dve = _sortedEdges.begin(), dveend = _sortedEdges.end();
for (; (dve != dveend) && ViewEdgeComp(**dve, _FrontEdgeB); ++dve) {
;
/* pass */
}
_sortedEdges.insert(dve, &_FrontEdgeB);
}
@ -405,7 +405,7 @@ void TVertex::setBackEdgeB(ViewEdge *iBackEdgeB, bool incoming)
if (!_sortedEdges.empty()) {
edge_pointers_container::iterator dve = _sortedEdges.begin(), dveend = _sortedEdges.end();
for (; (dve != dveend) && ViewEdgeComp(**dve, _BackEdgeB); ++dve) {
;
/* pass */
}
_sortedEdges.insert(dve, &_BackEdgeB);
}
@ -476,14 +476,18 @@ ViewVertex::edge_iterator TVertex::edges_iterator(ViewEdge *iEdge)
#if 0
directedViewEdge dEdge;
if (_FrontEdgeA.first == iEdge)
if (_FrontEdgeA.first == iEdge) {
dEdge = _FrontEdgeA;
else if (_FrontEdgeB.first == iEdge)
}
else if (_FrontEdgeB.first == iEdge) {
dEdge = _FrontEdgeB;
else if (_BackEdgeA.first == iEdge)
}
else if (_BackEdgeA.first == iEdge) {
dEdge = _BackEdgeA;
else if (_BackEdgeB.first == iEdge)
}
else if (_BackEdgeB.first == iEdge) {
dEdge = _BackEdgeB;
}
return edge_iterator(_FrontEdgeA, _FrontEdgeB, _BackEdgeA, _BackEdgeB, dEdge);
#endif
}
@ -502,14 +506,18 @@ ViewVertex::const_edge_iterator TVertex::edges_iterator(ViewEdge *iEdge) const
#if 0
directedViewEdge dEdge;
if (_FrontEdgeA.first == iEdge)
if (_FrontEdgeA.first == iEdge) {
dEdge = _FrontEdgeA;
else if (_FrontEdgeB.first == iEdge)
}
else if (_FrontEdgeB.first == iEdge) {
dEdge = _FrontEdgeB;
else if (_BackEdgeA.first == iEdge)
}
else if (_BackEdgeA.first == iEdge) {
dEdge = _BackEdgeA;
else if (_BackEdgeB.first == iEdge)
}
else if (_BackEdgeB.first == iEdge) {
dEdge = _BackEdgeB;
}
return const_edge_iterator(_FrontEdgeA, _FrontEdgeB, _BackEdgeA, _BackEdgeB, dEdge);
#endif
}
@ -571,7 +579,7 @@ void NonTVertex::AddIncomingViewEdge(ViewEdge *iVEdge)
if (!_ViewEdges.empty()) {
edges_container::iterator dve = _ViewEdges.begin(), dveend = _ViewEdges.end();
for (; (dve != dveend) && ViewEdgeComp(*dve, idve); ++dve) {
;
/* pass */
}
_ViewEdges.insert(dve, idve);
}

View File

@ -295,12 +295,15 @@ class edge_iterator_base : public IteratorBase<Traits, InputIteratorTag_Traits>
return;
}
if (_tvertex_iter.first == _feA.first)
if (_tvertex_iter.first == _feA.first) {
_tvertex_iter.first = _beB.first;
else if (_tvertex_iter.first == _beB.first)
}
else if (_tvertex_iter.first == _beB.first) {
_tvertex_iter.first = 0;
else
}
else {
_tvertex_iter.first = _feA.first;
}
return;
}
if (_feA.first == _beB.first) {
@ -309,12 +312,15 @@ class edge_iterator_base : public IteratorBase<Traits, InputIteratorTag_Traits>
return;
}
if (_tvertex_iter.first == _feB.first)
if (_tvertex_iter.first == _feB.first) {
_tvertex_iter.first = _beA.first;
else if (_tvertex_iter.first == _beA.first)
}
else if (_tvertex_iter.first == _beA.first) {
_tvertex_iter.first = 0;
else
}
else {
_tvertex_iter.first = _feB.first;
}
return;
}
// End of hack

View File

@ -152,7 +152,7 @@ static void findOccludee(FEdge *fe,
}
#endif
if (fabs(v * p->getNormal()) > 0.0001) {
if ((t > 0.0)) { // && (t<1.0))
if ((t > 0.0) /* && (t<1.0) */) {
if (t < mint) {
*oaWFace = oface;
mint = t;
@ -1820,7 +1820,9 @@ void ViewMapBuilder::ComputeFastRayCastingVisibility(ViewMap *ioViewMap, real ep
}
if (sameShape)
#endif
(*ve)->setaShape(vshape);
{
(*ve)->setaShape(vshape);
}
}
}
@ -2490,10 +2492,12 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi
printf("b1 %e, %e -- b2 %e, %e\n", b1[0], b1[1], b2[0], b2[1]);
//printf("line([%e, %e], [%e, %e]);\n", a1[0], a2[0], a1[1], a2[1]);
//printf("line([%e, %e], [%e, %e]);\n", b1[0], b2[0], b1[1], b2[1]);
if ((Ta < -epsilon) || (Ta > 1 + epsilon))
if ((Ta < -epsilon) || (Ta > 1 + epsilon)) {
printf("Ta %.12e\n", Ta);
if ((Tb < -epsilon) || (Tb > 1 + epsilon))
}
if ((Tb < -epsilon) || (Tb > 1 + epsilon)) {
printf("Tb %.12e\n", Tb);
}
printf("A1 %e, %e, %e -- A2 %e, %e, %e\n", A1[0], A1[1], A1[2], A2[0], A2[1], A2[2]);
printf("B1 %e, %e, %e -- B2 %e, %e, %e\n", B1[0], B1[1], B1[2], B2[0], B2[1], B2[2]);
}

View File

@ -819,7 +819,7 @@ static int save(ostream &out, SVertex *sv)
// we have to hack it...
set<Vec3r>::const_iterator i;
for (i = sv->normals().begin(), tmp = 0; i != sv->normals().end(); i++, tmp++) {
;
/* pass */
}
WRITE(tmp);
for (i = sv->normals().begin(); i != sv->normals().end(); i++) {

View File

@ -180,8 +180,9 @@ NodeGroup *ViewMapTesselator::Tesselate(ViewEdgesIterator begin, ViewEdgesIterat
firstEdge = (*c)->fedgeA();
#if 0
if (firstEdge->invisibility() > 0)
if (firstEdge->invisibility() > 0) {
continue;
}
#endif
line = new OrientedLineRep();

View File

@ -149,8 +149,9 @@ bool gts_vertex_mean_curvature_normal(WVertex *v, Vec3r &Kh)
for (itE = v->incoming_edges_begin(); itE != v->incoming_edges_end(); itE++) {
WOEdge *e = (*itE)->getPrevOnFace();
#if 0
if ((e->GetaVertex() == v) || (e->GetbVertex() == v))
if ((e->GetaVertex() == v) || (e->GetbVertex() == v)) {
cerr << "BUG ";
}
#endif
WVertex *v1 = e->GetaVertex();
WVertex *v2 = e->GetbVertex();

View File

@ -126,8 +126,9 @@ bool WVertex::isBoundary()
}
}
#if 0
if (!(*it)->GetaOEdge()->GetaFace())
if (!(*it)->GetaOEdge()->GetaFace()) {
return true;
}
#endif
_Border = 0;
return false;

View File

@ -799,8 +799,9 @@ class WFace {
inline WVertex *GetVertex(unsigned int index)
{
#if 0
if (index >= _OEdgeList.size())
if (index >= _OEdgeList.size()) {
return NULL;
}
#endif
return _OEdgeList[index]->GetaVertex();
}
@ -846,8 +847,9 @@ class WFace {
inline WFace *GetBordingFace(int index)
{
#if 0
if (index >= _OEdgeList.size())
if (index >= _OEdgeList.size()) {
return NULL;
}
#endif
return _OEdgeList[index]->GetaFace();
}
@ -1286,10 +1288,12 @@ class WShape {
wv++) {
for (unsigned int i = 0; i < 3; i++) {
v = (*wv)->GetVertex();
if (v[i] < _min[i])
if (v[i] < _min[i]) {
_min[i] = v[i];
if (v[i] > _max[i])
}
if (v[i] > _max[i]) {
_max[i] = v[i];
}
}
}
}

View File

@ -211,19 +211,23 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge()
if (!front()) { // is it in the right order ?
// the order of the WOEdge index is wrong
woea = _OEdgeList[(i + 1) % numberOfEdges()];
if (0 == i)
if (0 == i) {
woeb = _OEdgeList[numberOfEdges() - 1];
else
}
else {
woeb = _OEdgeList[(i - 1)];
}
ta = 0.0f;
tb = 1.0f;
}
else {
// the order of the WOEdge index is good
if (0 == i)
if (0 == i) {
woea = _OEdgeList[numberOfEdges() - 1];
else
}
else {
woea = _OEdgeList[(i - 1)];
}
woeb = _OEdgeList[(i + 1) % numberOfEdges()];
ta = 1.0f;
tb = 0.0f;

View File

@ -494,7 +494,7 @@ class WXFaceLayer {
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:WXFaceLayer")
#endif
};
}; // namespace Freestyle
class WXFace : public WFace {
protected:

View File

@ -37,7 +37,7 @@ class WXEdgeBuilder : public WingedEdgeBuilder {
virtual ~WXEdgeBuilder()
{
}
VISIT_DECL(IndexedFaceSet)
VISIT_DECL(IndexedFaceSet);
protected:
virtual void buildWVertices(WShape &shape, const float *vertices, unsigned vsize);

View File

@ -118,10 +118,12 @@ bool WingedEdgeBuilder::buildWShape(WShape &shape, IndexedFaceSet &ifs)
#if 0
const FrsMaterial *mat = (ifs.frs_material());
if (mat)
if (mat) {
shape.setFrsMaterial(*mat);
else if (_current_frs_material)
}
else if (_current_frs_material) {
shape.setFrsMaterial(*_current_frs_material);
}
#endif
const IndexedFaceSet::FaceEdgeMark *faceEdgeMarks = ifs.faceEdgeMarks();

View File

@ -54,9 +54,9 @@ class WingedEdgeBuilder : public SceneVisitor {
_matrices_stack.clear();
}
VISIT_DECL(IndexedFaceSet)
VISIT_DECL(NodeShape)
VISIT_DECL(NodeTransform)
VISIT_DECL(IndexedFaceSet);
VISIT_DECL(NodeShape);
VISIT_DECL(NodeTransform);
virtual void visitNodeTransformAfter(NodeTransform &);

View File

@ -328,23 +328,29 @@ static char *gpu_generate_function_prototyps(GHash *hash)
BLI_dynstr_appendf(ds, "void %s(", name);
for (a = 0; a < function->totparam; a++) {
if (function->paramqual[a] == FUNCTION_QUAL_OUT)
if (function->paramqual[a] == FUNCTION_QUAL_OUT) {
BLI_dynstr_append(ds, "out ");
else if (function->paramqual[a] == FUNCTION_QUAL_INOUT)
}
else if (function->paramqual[a] == FUNCTION_QUAL_INOUT) {
BLI_dynstr_append(ds, "inout ");
}
if (function->paramtype[a] == GPU_TEX2D)
if (function->paramtype[a] == GPU_TEX2D) {
BLI_dynstr_append(ds, "sampler2D");
else if (function->paramtype[a] == GPU_SHADOW2D)
}
else if (function->paramtype[a] == GPU_SHADOW2D) {
BLI_dynstr_append(ds, "sampler2DShadow");
else
}
else {
BLI_dynstr_append(ds, GPU_DATATYPE_STR[function->paramtype[a]]);
}
# if 0
BLI_dynstr_appendf(ds, " param%d", a);
# endif
if (a != function->totparam - 1)
if (a != function->totparam - 1) {
BLI_dynstr_append(ds, ", ");
}
}
BLI_dynstr_append(ds, ");\n");
}
@ -937,8 +943,9 @@ static char *code_generate_fragment(GPUMaterial *material,
BLI_dynstr_free(ds);
#if 0
if (G.debug & G_DEBUG)
if (G.debug & G_DEBUG) {
printf("%s\n", code);
}
#endif
return code;
@ -1209,8 +1216,9 @@ static char *code_generate_vertex(ListBase *nodes, const char *vert_code, bool u
BLI_dynstr_free(ds);
#if 0
if (G.debug & G_DEBUG)
if (G.debug & G_DEBUG) {
printf("%s\n", code);
}
#endif
return code;

View File

@ -155,14 +155,14 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t
while (a < size && t < tree->totchannel) {
/* locate first matching channel */
for (; t < tree->totchannel && tree->pchan[t] != chanlist[segcount - a - 1]; t++) {
;
/* pass */
}
if (t >= tree->totchannel) {
break;
}
for (; a < size && t < tree->totchannel && tree->pchan[t] == chanlist[segcount - a - 1];
a++, t++) {
;
/* pass */
}
}

View File

@ -180,8 +180,9 @@ bool ColorBlock::isSingleColorNoAlpha() const
Color32 c;
int i;
for (i = 0; i < 16; i++) {
if (m_color[i].a != 0)
if (m_color[i].a != 0) {
c = m_color[i];
}
}
Color32 mask(0xFF, 0xFF, 0xFF, 0x00);

View File

@ -446,9 +446,11 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter)
#if 0
k = 0;
for (i = -n; i <= n; i++)
for (j = -n; j <= n; j++)
for (i = -n; i <= n; i++) {
for (j = -n; j <= n; j++) {
weight[k++] = sqrt((float)i * i + j * j);
}
}
#endif
weight[0] = 1;

View File

@ -579,8 +579,9 @@ static int init_jpeg(FILE *outfile, struct jpeg_compress_struct *cinfo, struct I
/* just write RGBA as RGB,
* unsupported feature only confuses other s/w */
if (ibuf->planes == 32)
if (ibuf->planes == 32) {
cinfo->in_color_space = JCS_UNKNOWN;
}
#endif
switch (cinfo->in_color_space) {
case JCS_RGB:

View File

@ -322,8 +322,9 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
cross_v3_v3v3(axis_tmp, cross1, c2);
normalize_v3(axis_tmp);
if (len_v3v3(axis_tmp, axis_vec) > 1.0f)
if (len_v3v3(axis_tmp, axis_vec) > 1.0f) {
angle = -angle;
}
}
}
#endif
@ -691,8 +692,9 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
/* switch the flip option if set
* note: flip is now done at face level so copying vgroup slizes is easier */
#if 0
if (do_flip)
if (do_flip) {
ed_loop_flip = !ed_loop_flip;
}
#endif
if (angle < 0.0f) {

View File

@ -275,8 +275,9 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
/* If weight preview enabled... */
#if 0 /* XXX Currently done in mod stack :/ */
if (do_prev)
if (do_prev) {
DM_update_weight_mcol(ob, dm, 0, org_w, 0, NULL);
}
#endif
/* Freeing stuff. */

View File

@ -64,10 +64,12 @@ static float mix_weight(float weight, float weight2, char mix_mode)
return (weight * weight2);
case MOD_WVG_MIX_DIV:
/* Avoid dividing by zero (or really small values). */
if (0.0 <= weight2 < MOD_WVG_ZEROFLOOR)
if (0.0 <= weight2 < MOD_WVG_ZEROFLOOR) {
weight2 = MOD_WVG_ZEROFLOOR;
else if (-MOD_WVG_ZEROFLOOR < weight2)
}
else if (-MOD_WVG_ZEROFLOOR < weight2) {
weight2 = -MOD_WVG_ZEROFLOOR;
}
return (weight / weight2);
case MOD_WVG_MIX_DIF:
return (weight < weight2 ? weight2 - weight : weight - weight2);
@ -401,8 +403,9 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
/* If weight preview enabled... */
#if 0 /* XXX Currently done in mod stack :/ */
if (do_prev)
if (do_prev) {
DM_update_weight_mcol(ob, dm, 0, org_w, numIdx, indices);
}
#endif
/* Freeing stuff. */

View File

@ -580,8 +580,9 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
/* If weight preview enabled... */
#if 0 /* XXX Currently done in mod stack :/ */
if (do_prev)
if (do_prev) {
DM_update_weight_mcol(ob, dm, 0, org_w, numIdx, indices);
}
#endif
/* Freeing stuff. */

View File

@ -605,8 +605,9 @@ static void cloth_calc_force(
BPH_mass_spring_force_edge_wind(
data, spring->ij, spring->kl, hair_ij->radius, hair_kl->radius, winvec);
}
else
else {
BPH_mass_spring_force_edge_wind(data, spring->ij, spring->kl, 1.0f, 1.0f, winvec);
}
}
}
#else
@ -961,8 +962,9 @@ static void cloth_calc_volume_force(ClothModifierData *clmd)
for (i = 0; i < mvert_num; i++, vert++) {
float x[3], v[3], f[3], dfdx[3][3], dfdv[3][3];
if (vert->solver_index < 0)
if (vert->solver_index < 0) {
continue;
}
/* calculate volumetric forces */
BPH_mass_spring_get_motion_state(data, vert->solver_index, x, v);

View File

@ -94,8 +94,9 @@ EIGEN_DONT_INLINE void constrained_conjugate_gradient(const MatrixType &mat,
residual -= alpha * tmp; // update residue
residualNorm2 = residual.squaredNorm();
if (residualNorm2 < threshold)
if (residualNorm2 < threshold) {
break;
}
z = precond.solve(residual); // approximately solve for "A z = residual"

View File

@ -54,14 +54,16 @@ class Vector3 : public Eigen::Vector3f {
Vector3(const ctype &v)
{
for (int k = 0; k < 3; ++k)
for (int k = 0; k < 3; ++k) {
coeffRef(k) = v[k];
}
}
Vector3 &operator=(const ctype &v)
{
for (int k = 0; k < 3; ++k)
for (int k = 0; k < 3; ++k) {
coeffRef(k) = v[k];
}
return *this;
}
@ -84,16 +86,20 @@ class Matrix3 : public Eigen::Matrix3f {
Matrix3(const ctype &v)
{
for (int k = 0; k < 3; ++k)
for (int l = 0; l < 3; ++l)
for (int k = 0; k < 3; ++k) {
for (int l = 0; l < 3; ++l) {
coeffRef(l, k) = v[k][l];
}
}
}
Matrix3 &operator=(const ctype &v)
{
for (int k = 0; k < 3; ++k)
for (int l = 0; l < 3; ++l)
for (int k = 0; k < 3; ++k) {
for (int l = 0; l < 3; ++l) {
coeffRef(l, k) = v[k][l];
}
}
return *this;
}
@ -164,18 +170,22 @@ struct lMatrix3fCtor {
{
i *= 3;
j *= 3;
for (int k = 0; k < 3; ++k)
for (int l = 0; l < 3; ++l)
for (int k = 0; k < 3; ++k) {
for (int l = 0; l < 3; ++l) {
m_trips.push_back(Triplet(i + k, j + l, m.coeff(l, k)));
}
}
}
void sub(int i, int j, const Matrix3 &m)
{
i *= 3;
j *= 3;
for (int k = 0; k < 3; ++k)
for (int l = 0; l < 3; ++l)
for (int k = 0; k < 3; ++k) {
for (int l = 0; l < 3; ++l) {
m_trips.push_back(Triplet(i + k, j + l, -m.coeff(l, k)));
}
}
}
inline void construct(lMatrix &m)
@ -196,8 +206,9 @@ using Eigen::ComputationInfo;
BLI_INLINE void print_lvector(const lVector3f &v)
{
for (int i = 0; i < v.rows(); ++i) {
if (i > 0 && i % 3 == 0)
if (i > 0 && i % 3 == 0) {
printf("\n");
}
printf("%f,\n", v[i]);
}
@ -206,12 +217,14 @@ BLI_INLINE void print_lvector(const lVector3f &v)
BLI_INLINE void print_lmatrix(const lMatrix &m)
{
for (int j = 0; j < m.rows(); ++j) {
if (j > 0 && j % 3 == 0)
if (j > 0 && j % 3 == 0) {
printf("\n");
}
for (int i = 0; i < m.cols(); ++i) {
if (i > 0 && i % 3 == 0)
if (i > 0 && i % 3 == 0) {
printf(" ");
}
implicit_print_matrix_elem(m.coeff(j, i));
}

View File

@ -481,8 +481,9 @@ BLI_INLINE void hair_volume_add_segment_2D(HairGrid *grid,
grid_to_world(grid, x2w, x2);
grid_to_world(grid, x3w, x3);
if (vert_k->samples > 0)
if (vert_k->samples > 0) {
BKE_sim_debug_data_add_circle(wloc, 0.01f, 1.0, 1.0, 0.3, "grid", 2525, debug_i, j, k);
}
if (grid->debug_value) {
BKE_sim_debug_data_add_dot(wloc, 1, 0, 0, "grid", 93, debug_i, j, k);
@ -830,9 +831,10 @@ bool BPH_hair_volume_solve_divergence(HairGrid *grid,
fac = CLAMPIS(-divergence * target_strength, 0.0, 1.0);
interp_v3_v3v3(col, col0, coln, fac);
}
if (fac > 0.05f)
if (fac > 0.05f) {
BKE_sim_debug_data_add_circle(
grid->debug_data, wloc, 0.01f, col[0], col[1], col[2], "grid", 5522, i, j, k);
}
}
#endif
}
@ -969,8 +971,9 @@ bool BPH_hair_volume_solve_divergence(HairGrid *grid,
int u = i * strideA0 + j * strideA1 + k * strideA2;
bool is_margin = MARGIN_i0 || MARGIN_i1 || MARGIN_j0 || MARGIN_j1 || MARGIN_k0 ||
MARGIN_k1;
if (i != slice)
if (i != slice) {
continue;
}
vert = vert_start + i * stride0 + j * stride1 + k * stride2;
@ -995,9 +998,10 @@ bool BPH_hair_volume_solve_divergence(HairGrid *grid,
fac = CLAMPIS(-pressure * grid->debug1, 0.0, 1.0);
interp_v3_v3v3(col, col0, coln, fac);
}
if (fac > 0.05f)
if (fac > 0.05f) {
BKE_sim_debug_data_add_circle(
grid->debug_data, wloc, 0.01f, col[0], col[1], col[2], "grid", 5533, i, j, k);
}
if (!is_margin) {
float dvel[3];
@ -1084,8 +1088,9 @@ void BPH_hair_volume_vertex_grid_filter_box(HairVertexGrid *grid, int kernel_siz
float invD;
int i, j, k;
if (kernel_size <= 0)
if (kernel_size <= 0) {
return;
}
tot = kernel_size * 2 + 1;
invD = 1.0f / (float)(tot * tot * tot);
@ -1234,8 +1239,9 @@ static HairGridVert *hair_volume_create_collision_grid(ClothModifierData *clmd,
for (v = 0; v < col->collmd->numverts; v++, loc0++, loc1++) {
int offset;
if (!hair_grid_point_valid(loc1->co, gmin, gmax))
if (!hair_grid_point_valid(loc1->co, gmin, gmax)) {
continue;
}
offset = hair_grid_weights(res, gmin, scale, lX[v], weights);
@ -1260,8 +1266,9 @@ static HairGridVert *hair_volume_create_collision_grid(ClothModifierData *clmd,
/* divide velocity with density */
for (i = 0; i < size; i++) {
float density = collgrid[i].density;
if (density > 0.0f)
if (density > 0.0f) {
mul_v3_fl(collgrid[i].velocity, 1.0f / density);
}
}
return collgrid;

View File

@ -301,8 +301,9 @@ static void print_lvector(lfVector *v, int numverts)
{
int i;
for (i = 0; i < numverts; ++i) {
if (i > 0)
if (i > 0) {
printf("\n");
}
printf("%f,\n", v[i][0]);
printf("%f,\n", v[i][1]);
@ -340,12 +341,14 @@ static void print_bfmatrix(fmatrix3x3 *m)
}
for (j = 0; j < size; ++j) {
if (j > 0 && j % 3 == 0)
if (j > 0 && j % 3 == 0) {
printf("\n");
}
for (i = 0; i < size; ++i) {
if (i > 0 && i % 3 == 0)
if (i > 0 && i % 3 == 0) {
printf(" ");
}
implicit_print_matrix_elem(t[i + j * size]);
}

View File

@ -98,14 +98,16 @@ class fVector : public Eigen::Vector3f {
fVector(const ctype &v)
{
for (int k = 0; k < 3; ++k)
for (int k = 0; k < 3; ++k) {
coeffRef(k) = v[k];
}
}
fVector &operator=(const ctype &v)
{
for (int k = 0; k < 3; ++k)
for (int k = 0; k < 3; ++k) {
coeffRef(k) = v[k];
}
return *this;
}
@ -128,16 +130,20 @@ class fMatrix : public Eigen::Matrix3f {
fMatrix(const ctype &v)
{
for (int k = 0; k < 3; ++k)
for (int l = 0; l < 3; ++l)
for (int k = 0; k < 3; ++k) {
for (int l = 0; l < 3; ++l) {
coeffRef(l, k) = v[k][l];
}
}
}
fMatrix &operator=(const ctype &v)
{
for (int k = 0; k < 3; ++k)
for (int l = 0; l < 3; ++l)
for (int k = 0; k < 3; ++k) {
for (int l = 0; l < 3; ++l) {
coeffRef(l, k) = v[k][l];
}
}
return *this;
}
@ -206,18 +212,22 @@ struct lMatrixCtor {
{
i *= 3;
j *= 3;
for (int k = 0; k < 3; ++k)
for (int l = 0; l < 3; ++l)
for (int k = 0; k < 3; ++k) {
for (int l = 0; l < 3; ++l) {
m_trips.push_back(Triplet(i + k, j + l, m.coeff(l, k)));
}
}
}
void sub(int i, int j, const fMatrix &m)
{
i *= 3;
j *= 3;
for (int k = 0; k < 3; ++k)
for (int l = 0; l < 3; ++l)
for (int k = 0; k < 3; ++k) {
for (int l = 0; l < 3; ++l) {
m_trips.push_back(Triplet(i + k, j + l, -m.coeff(l, k)));
}
}
}
inline void construct(lMatrix &m)
@ -246,8 +256,9 @@ using Eigen::ComputationInfo;
static void print_lvector(const lVector &v)
{
for (int i = 0; i < v.rows(); ++i) {
if (i > 0 && i % 3 == 0)
if (i > 0 && i % 3 == 0) {
printf("\n");
}
printf("%f,\n", v[i]);
}
@ -256,12 +267,14 @@ static void print_lvector(const lVector &v)
static void print_lmatrix(const lMatrix &m)
{
for (int j = 0; j < m.rows(); ++j) {
if (j > 0 && j % 3 == 0)
if (j > 0 && j % 3 == 0) {
printf("\n");
}
for (int i = 0; i < m.cols(); ++i) {
if (i > 0 && i % 3 == 0)
if (i > 0 && i % 3 == 0) {
printf(" ");
}
implicit_print_matrix_elem(m.coeff(j, i));
}
@ -455,16 +468,19 @@ Implicit_Data *BPH_mass_spring_solver_create(int numverts, int numsprings)
void BPH_mass_spring_solver_free(Implicit_Data *id)
{
if (id)
if (id) {
delete id;
}
}
int BPH_mass_spring_solver_numvert(Implicit_Data *id)
{
if (id)
if (id) {
return id->numverts;
else
}
else {
return 0;
}
}
/* ==== Transformation from/to root reference frames ==== */
@ -625,10 +641,12 @@ void BPH_mass_spring_get_motion_state(struct Implicit_Data *data,
float x[3],
float v[3])
{
if (x)
if (x) {
root_to_world_v3(data, index, x, data->X.v3(index));
if (v)
}
if (v) {
root_to_world_v3(data, index, v, data->V.v3(index));
}
}
void BPH_mass_spring_get_position(struct Implicit_Data *data, int index, float x[3])
@ -910,10 +928,12 @@ BLI_INLINE float fbstar(float length, float L, float kb, float cb)
float tempfb_fl = kb * fb(length, L);
float fbstar_fl = cb * (length - L);
if (tempfb_fl < fbstar_fl)
if (tempfb_fl < fbstar_fl) {
return fbstar_fl;
else
}
else {
return tempfb_fl;
}
}
// function to calculae bending spring force (taken from Choi & Co)
@ -1015,22 +1035,28 @@ bool BPH_mass_spring_force_spring_linear(Implicit_Data *data,
apply_spring(data, i, j, f, dfdx, dfdv);
if (r_f)
if (r_f) {
copy_v3_v3(r_f, f);
if (r_dfdx)
}
if (r_dfdx) {
copy_m3_m3(r_dfdx, dfdx);
if (r_dfdv)
}
if (r_dfdv) {
copy_m3_m3(r_dfdv, dfdv);
}
return true;
}
else {
if (r_f)
if (r_f) {
zero_v3(r_f);
if (r_dfdx)
}
if (r_dfdx) {
zero_m3(r_dfdx);
if (r_dfdv)
}
if (r_dfdv) {
zero_m3(r_dfdv);
}
return false;
}
@ -1065,22 +1091,28 @@ bool BPH_mass_spring_force_spring_bending(Implicit_Data *data,
apply_spring(data, i, j, f, dfdx, dfdv);
if (r_f)
if (r_f) {
copy_v3_v3(r_f, f);
if (r_dfdx)
}
if (r_dfdx) {
copy_m3_m3(r_dfdx, dfdx);
if (r_dfdv)
}
if (r_dfdv) {
copy_m3_m3(r_dfdv, dfdv);
}
return true;
}
else {
if (r_f)
if (r_f) {
zero_v3(r_f);
if (r_dfdx)
}
if (r_dfdx) {
zero_m3(r_dfdx);
if (r_dfdv)
}
if (r_dfdv) {
zero_m3(r_dfdv);
}
return false;
}
@ -1132,30 +1164,38 @@ BLI_INLINE void spring_angbend_forces(Implicit_Data *data,
zero_v3(fk);
sub_v3_v3v3(edge_ij, data->X.v3(j), data->X.v3(i));
if (q == i)
if (q == i) {
sub_v3_v3(edge_ij, dx);
if (q == j)
}
if (q == j) {
add_v3_v3(edge_ij, dx);
}
normalize_v3_v3(dir_ij, edge_ij);
sub_v3_v3v3(edge_jk, data->X.v3(k), data->X.v3(j));
if (q == j)
if (q == j) {
sub_v3_v3(edge_jk, dx);
if (q == k)
}
if (q == k) {
add_v3_v3(edge_jk, dx);
}
normalize_v3_v3(dir_jk, edge_jk);
sub_v3_v3v3(vel_ij, data->V.v3(j), data->V.v3(i));
if (q == i)
if (q == i) {
sub_v3_v3(vel_ij, dv);
if (q == j)
}
if (q == j) {
add_v3_v3(vel_ij, dv);
}
sub_v3_v3v3(vel_jk, data->V.v3(k), data->V.v3(j));
if (q == j)
if (q == j) {
sub_v3_v3(vel_jk, dv);
if (q == k)
}
if (q == k) {
add_v3_v3(vel_jk, dv);
}
/* bending force */
sub_v3_v3v3(dist, goal, edge_jk);
@ -1439,22 +1479,28 @@ bool BPH_mass_spring_force_spring_goal(Implicit_Data *data,
data->idFdX.add(i, i, dfdx);
data->idFdV.add(i, i, dfdv);
if (r_f)
if (r_f) {
copy_v3_v3(r_f, f);
if (r_dfdx)
}
if (r_dfdx) {
copy_m3_m3(r_dfdx, dfdx);
if (r_dfdv)
}
if (r_dfdv) {
copy_m3_m3(r_dfdv, dfdv);
}
return true;
}
else {
if (r_f)
if (r_f) {
zero_v3(r_f);
if (r_dfdx)
}
if (r_dfdx) {
zero_m3(r_dfdx);
if (r_dfdv)
}
if (r_dfdv) {
zero_m3(r_dfdv);
}
return false;
}

View File

@ -2822,18 +2822,22 @@ static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self,
Py_ssize_t start = 0, stop = PY_SSIZE_T_MAX;
/* avoid PySlice_GetIndicesEx because it needs to know the length ahead of time. */
if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start))
if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) {
return NULL;
if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop))
}
if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) {
return NULL;
}
if (start < 0 || stop < 0) {
/* only get the length for negative values */
Py_ssize_t len = (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop);
if (start < 0)
if (start < 0) {
start += len;
if (stop < 0)
}
if (stop < 0) {
stop += len;
}
}
if (stop - start <= 0) {
@ -4301,8 +4305,9 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
static int pyrna_struct_pydict_contains(PyObject *self, PyObject *pyname)
{
PyObject *dict = *(_PyObject_GetDictPtr((PyObject *)self));
if (dict == NULL) /* unlikely */
if (UNLIKELY(dict == NULL)) {
return 0;
}
return PyDict_Contains(dict, pyname);
}
@ -4331,7 +4336,7 @@ static PyObject *pyrna_struct_meta_idprop_getattro(PyObject *cls, PyObject *attr
* Disable for now,
* this is faking internal behavior in a way that's too tricky to maintain well. */
# if 0
if (ret == NULL) { // || pyrna_is_deferred_prop(ret)
if ((ret == NULL) /* || pyrna_is_deferred_prop(ret) */ ) {
StructRNA *srna = srna_from_self(cls, "StructRNA.__getattr__");
if (srna) {
PropertyRNA *prop = RNA_struct_type_find_property(srna, _PyUnicode_AsString(attr));

View File

@ -27,10 +27,12 @@
#define BRICONT \
texres->tin = (texres->tin - 0.5f) * tex->contrast + tex->bright - 0.5f; \
if (!(tex->flag & TEX_NO_CLAMP)) { \
if (texres->tin < 0.0f) \
if (texres->tin < 0.0f) { \
texres->tin = 0.0f; \
else if (texres->tin > 1.0f) \
} \
else if (texres->tin > 1.0f) { \
texres->tin = 1.0f; \
} \
} \
((void)0)

View File

@ -1012,8 +1012,9 @@ static void build_permutation_table(unsigned short permutation[],
{
int i, k;
for (i = 0; i < number_of_rays; i++)
for (i = 0; i < number_of_rays; i++) {
temp_permutation[i] = i;
}
for (i = 0; i < number_of_rays; i++) {
const unsigned int nr_entries_left = number_of_rays - i;
@ -1225,12 +1226,14 @@ static void apply_ao_callback(DerivedMesh *lores_dm,
lores_dm, hires_dm, ao_data->orig_index_mp_to_orig, lvl, lt, uv[0], uv[1], pos, nrm);
/* offset ray origin by user bias along normal */
for (i = 0; i < 3; i++)
for (i = 0; i < 3; i++) {
cen[i] = pos[i] + ao_data->bias * nrm[i];
}
/* build tangent frame */
for (i = 0; i < 3; i++)
for (i = 0; i < 3; i++) {
axisZ[i] = nrm[i];
}
build_coordinate_frame(axisX, axisY, axisZ);
@ -1269,13 +1272,15 @@ static void apply_ao_callback(DerivedMesh *lores_dm,
/* transform ray direction out of tangent frame */
float dv[3];
for (k = 0; k < 3; k++)
for (k = 0; k < 3; k++) {
dv[k] = axisX[k] * dx + axisY[k] * dy + axisZ[k] * dz;
}
hit_something = trace_ao_ray(ao_data, cen, dv);
if (hit_something != 0)
if (hit_something != 0) {
shadow += 1;
}
}
value = 1.0f - (shadow / ao_data->number_of_rays);

Some files were not shown because too many files have changed in this diff Show More