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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-05-27 02:22:45 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-05-27 02:22:45 +0400
commitb6a9a953bc6aa7d81921a796e8ce1123fdedefc7 (patch)
tree44c587b017c6915bb750560fb56a0a7782358c07 /source/blender/blenkernel
parenta5152b7ca0d6d7f340b1955c0e8a15ba23fda336 (diff)
parenteda0f3b1863e2e41b9913e16af82407b63e145bf (diff)
Merged changes in the trunk up to revision 47056.
Conflicts resolved: source/blender/bmesh/bmesh_class.h source/blender/bmesh/intern/bmesh_construct.c source/blender/editors/interface/resources.c source/blender/render/intern/source/convertblender.c
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_blender.h4
-rw-r--r--source/blender/blenkernel/BKE_fcurve.h2
-rw-r--r--source/blender/blenkernel/BKE_key.h6
-rw-r--r--source/blender/blenkernel/BKE_mesh.h4
-rw-r--r--source/blender/blenkernel/BKE_node.h10
-rw-r--r--source/blender/blenkernel/BKE_object.h1
-rw-r--r--source/blender/blenkernel/BKE_screen.h2
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h8
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.c3
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c4
-rw-r--r--source/blender/blenkernel/intern/action.c4
-rw-r--r--source/blender/blenkernel/intern/anim.c14
-rw-r--r--source/blender/blenkernel/intern/armature.c31
-rw-r--r--source/blender/blenkernel/intern/blender.c6
-rw-r--r--source/blender/blenkernel/intern/brush.c2
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c81
-rw-r--r--source/blender/blenkernel/intern/cloth.c12
-rw-r--r--source/blender/blenkernel/intern/collision.c15
-rw-r--r--source/blender/blenkernel/intern/constraint.c2
-rw-r--r--source/blender/blenkernel/intern/context.c5
-rw-r--r--source/blender/blenkernel/intern/curve.c12
-rw-r--r--source/blender/blenkernel/intern/customdata.c53
-rw-r--r--source/blender/blenkernel/intern/deform.c2
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c4
-rw-r--r--source/blender/blenkernel/intern/displist.c3
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c49
-rw-r--r--source/blender/blenkernel/intern/editderivedmesh.c24
-rw-r--r--source/blender/blenkernel/intern/fcurve.c51
-rw-r--r--source/blender/blenkernel/intern/font.c21
-rw-r--r--source/blender/blenkernel/intern/group.c6
-rw-r--r--source/blender/blenkernel/intern/image.c2
-rw-r--r--source/blender/blenkernel/intern/image_gen.c52
-rw-r--r--source/blender/blenkernel/intern/key.c25
-rw-r--r--source/blender/blenkernel/intern/lattice.c26
-rw-r--r--source/blender/blenkernel/intern/mball.c12
-rw-r--r--source/blender/blenkernel/intern/mesh.c24
-rw-r--r--source/blender/blenkernel/intern/mesh_validate.c8
-rw-r--r--source/blender/blenkernel/intern/modifier.c3
-rw-r--r--source/blender/blenkernel/intern/movieclip.c6
-rw-r--r--source/blender/blenkernel/intern/node.c49
-rw-r--r--source/blender/blenkernel/intern/object.c37
-rw-r--r--source/blender/blenkernel/intern/ocean.c58
-rw-r--r--source/blender/blenkernel/intern/particle.c8
-rw-r--r--source/blender/blenkernel/intern/particle_system.c7
-rw-r--r--source/blender/blenkernel/intern/pointcache.c24
-rw-r--r--source/blender/blenkernel/intern/screen.c5
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c8
-rw-r--r--source/blender/blenkernel/intern/sequencer.c19
-rw-r--r--source/blender/blenkernel/intern/smoke.c48
-rw-r--r--source/blender/blenkernel/intern/softbody.c72
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c13
-rw-r--r--source/blender/blenkernel/intern/text.c18
-rw-r--r--source/blender/blenkernel/intern/texture.c3
-rw-r--r--source/blender/blenkernel/intern/tracking.c2
-rw-r--r--source/blender/blenkernel/intern/unit.c2
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c20
56 files changed, 570 insertions, 422 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 7cc5d16dcc1..e2bca1bb93e 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -42,14 +42,14 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 263
-#define BLENDER_SUBVERSION 5
+#define BLENDER_SUBVERSION 7
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0
/* used by packaging tools */
/* can be left blank, otherwise a,b,c... etc with no quotes */
-#define BLENDER_VERSION_CHAR
+#define BLENDER_VERSION_CHAR a
/* alpha/beta/rc/release, docs use this */
#define BLENDER_VERSION_CYCLE alpha
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h
index 9dae38d0a65..f7aa4470c19 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -218,7 +218,7 @@ void calc_fcurve_range(struct FCurve *fcu, float *min, float *max,
/* get the bounding-box extents for F-Curve */
void calc_fcurve_bounds(struct FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax,
- const short do_sel_only);
+ const short do_sel_only, const short include_handles);
/* .............. */
diff --git a/source/blender/blenkernel/BKE_key.h b/source/blender/blenkernel/BKE_key.h
index 4240ef16100..1ad451b0937 100644
--- a/source/blender/blenkernel/BKE_key.h
+++ b/source/blender/blenkernel/BKE_key.h
@@ -55,9 +55,9 @@ struct Key *copy_key_nolib(struct Key *key);
void BKE_key_make_local(struct Key *key);
void sort_keys(struct Key *key);
-void key_curve_position_weights(float t, float *data, int type);
-void key_curve_tangent_weights(float t, float *data, int type);
-void key_curve_normal_weights(float t, float *data, int type);
+void key_curve_position_weights(float t, float data[4], int type);
+void key_curve_tangent_weights(float t, float data[4], int type);
+void key_curve_normal_weights(float t, float data[4], int type);
float *do_ob_key(struct Scene *scene, struct Object *ob);
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index c168c39fd9f..7abec074647 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -111,6 +111,10 @@ int poly_find_loop_from_vert(const struct MPoly *poly,
int poly_get_adj_loops_from_vert(unsigned adj_r[3], const struct MPoly *poly,
const struct MLoop *mloop, unsigned vert);
+/* Return the index of the edge vert that is not equal to 'v'. If
+ * neither edge vertex is equal to 'v', returns -1. */
+int BKE_mesh_edge_other_vert(const struct MEdge *e, int v);
+
/* update the hide flag for edges and polys from the corresponding
* flag in verts */
void BKE_mesh_flush_hidden_from_verts(const struct MVert *mvert,
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index a6018a45821..2632a982a01 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -248,6 +248,12 @@ typedef struct bNodeType {
#define NODE_OLD_SHADING 1
#define NODE_NEW_SHADING 2
+/* node resize directions */
+#define NODE_RESIZE_TOP 1
+#define NODE_RESIZE_BOTTOM 2
+#define NODE_RESIZE_RIGHT 4
+#define NODE_RESIZE_LEFT 8
+
/* enum values for input/output */
#define SOCK_IN 1
#define SOCK_OUT 2
@@ -348,7 +354,8 @@ void nodeRemLink(struct bNodeTree *ntree, struct bNodeLink *link);
void nodeRemSocketLinks(struct bNodeTree *ntree, struct bNodeSocket *sock);
void nodeInternalRelink(struct bNodeTree *ntree, struct bNode *node);
-void nodeSpaceCoords(struct bNode *node, float *locx, float *locy);
+void nodeToView(struct bNode *node, float x, float y, float *rx, float *ry);
+void nodeFromView(struct bNode *node, float x, float y, float *rx, float *ry);
void nodeAttachNode(struct bNode *node, struct bNode *parent);
void nodeDetachNode(struct bNode *node);
@@ -516,6 +523,7 @@ struct ShadeResult;
#define SH_NODE_TEX_CHECKER 164
#define SH_NODE_BRIGHTCONTRAST 165
#define SH_NODE_LIGHT_FALLOFF 166
+#define SH_NODE_OBJECT_INFO 167
/* custom defines options for Material node */
#define SH_NODE_MAT_DIFF 1
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 1cdf2ee2e14..890fc40c284 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -53,6 +53,7 @@ struct MovieClip;
void BKE_object_workob_clear(struct Object *workob);
void BKE_object_workob_calc_parent(struct Scene *scene, struct Object *ob, struct Object *workob);
+void BKE_object_transform_copy(struct Object *ob_tar, const struct Object *ob_src);
struct SoftBody *copy_softbody(struct SoftBody *sb);
struct BulletSoftBody *copy_bulletsoftbody(struct BulletSoftBody *sb);
void BKE_object_copy_particlesystems(struct Object *obn, struct Object *ob);
diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h
index 7223008afad..e99fc413ca1 100644
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@ -153,6 +153,8 @@ typedef struct ARegionType {
int keymapflag;
/* return without drawing. lock is set by region definition, and copied to do_lock by render. can become flag */
short do_lock, lock;
+ /* call cursor function on each move event */
+ short event_cursor;
} ARegionType;
/* panel types */
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index 4ddafbbaae9..f06e0e2f71a 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -67,8 +67,8 @@ void seq_end(SeqIterator *iter);
void seq_array(struct Editing *ed, struct Sequence ***seqarray, int *tot, int use_pointer);
#define SEQP_BEGIN(ed, _seq) \
- { \
- SeqIterator iter; \
+ { \
+ SeqIterator iter; \
for (seq_begin(ed, &iter, 1); iter.valid; seq_next(&iter)) { \
_seq = iter.seq;
@@ -79,8 +79,8 @@ void seq_array(struct Editing *ed, struct Sequence ***seqarray, int *tot, int us
_seq = iter.seq;
#define SEQ_END \
- } \
- seq_end(&iter); \
+ } \
+ seq_end(&iter); \
}
typedef struct SeqRenderData {
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index 6f768a147f7..e4309a64e56 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -1166,7 +1166,8 @@ CCGError ccgSubSurf_syncVert(CCGSubSurf *ss, CCGVertHDL vHDL, const void *vertDa
v->flags = Vert_eEffected | seamflag;
}
else if (!VertDataEqual(vertData, _vert_getCo(v, 0, ss->meshIFC.vertDataSize), ss) ||
- ((v->flags & Vert_eSeam) != seamflag)) {
+ ((v->flags & Vert_eSeam) != seamflag))
+ {
*prevp = v->next;
_ehash_insert(ss->vMap, (EHEntry *) v);
VertDataCopy(_vert_getCo(v, 0, ss->meshIFC.vertDataSize), vertData, ss);
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 18560d3dbc0..7e2d881689c 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -1546,7 +1546,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
/* if this is not the last modifier in the stack then recalculate the normals
* to avoid giving bogus normals to the next modifier see: [#23673] */
- if (isPrevDeform && mti->dependsOnNormals && mti->dependsOnNormals(md)) {
+ if (isPrevDeform && mti->dependsOnNormals && mti->dependsOnNormals(md)) {
/* XXX, this covers bug #23673, but we may need normal calc for other types */
if (dm && dm->type == DM_TYPE_CDDM) {
CDDM_apply_vert_coords(dm, deformedVerts);
@@ -2942,7 +2942,7 @@ static void navmesh_drawColored(DerivedMesh *dm)
#endif
glDisable(GL_LIGHTING);
- /* if (GPU_buffer_legacy(dm) ) */ { /* TODO - VBO draw code, not high priority - campbell */
+ /* if (GPU_buffer_legacy(dm) ) */ { /* TODO - VBO draw code, not high priority - campbell */
DEBUG_VBO("Using legacy code. drawNavMeshColored\n");
//glShadeModel(GL_SMOOTH);
glBegin(glmode = GL_QUADS);
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 0f8716e2b04..233647c9ec6 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -247,7 +247,7 @@ void set_active_action_group(bAction *act, bActionGroup *agrp, short select)
for (grp = act->groups.first; grp; grp = grp->next) {
if ((grp == agrp) && (select))
grp->flag |= AGRP_ACTIVE;
- else
+ else
grp->flag &= ~AGRP_ACTIVE;
}
}
@@ -958,7 +958,7 @@ short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan,
RNA_pointer_create((ID *)ob, &RNA_PoseBone, pchan, &ptr);
else if (ob)
RNA_id_pointer_create((ID *)ob, &ptr);
- else
+ else
return 0;
/* get the basic path to the properties of interest */
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index ed6eceb036b..f73221066b1 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -452,7 +452,7 @@ void animviz_calc_motionpaths(Scene *scene, ListBase *targets)
/* get pointer to animviz settings for each target */
if (mpt->pchan)
avs = &mpt->ob->pose->avs;
- else
+ else
avs = &mpt->ob->avs;
/* clear the flag requesting recalculation of targets */
@@ -751,14 +751,14 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, i
dob = new_dupli_object(lb, go->ob, mat, ob->lay, 0, OB_DUPLIGROUP, animated);
/* check the group instance and object layers match, also that the object visible flags are ok. */
- if ( (dob->origlay & group->layer) == 0 ||
- (G.rendering == 0 && dob->ob->restrictflag & OB_RESTRICT_VIEW) ||
- (G.rendering && dob->ob->restrictflag & OB_RESTRICT_RENDER)
- ) {
- dob->no_draw = 1;
+ if ((dob->origlay & group->layer) == 0 ||
+ (G.rendering == 0 && dob->ob->restrictflag & OB_RESTRICT_VIEW) ||
+ (G.rendering && dob->ob->restrictflag & OB_RESTRICT_RENDER))
+ {
+ dob->no_draw = TRUE;
}
else {
- dob->no_draw = 0;
+ dob->no_draw = FALSE;
}
if (go->ob->transflag & OB_DUPLI) {
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index fe95d15f82e..752036c6b9f 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -437,7 +437,7 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest)
float h1[3], h2[3], scale[3], length, hlength1, hlength2, roll1 = 0.0f, roll2;
float mat3[3][3], imat[4][4], posemat[4][4], scalemat[4][4], iscalemat[4][4];
float data[MAX_BBONE_SUBDIV + 1][4], *fp;
- int a, doscale = 0;
+ int a, do_scale = 0;
length = bone->length;
@@ -455,7 +455,7 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest)
invert_m4_m4(iscalemat, scalemat);
length *= scale[1];
- doscale = 1;
+ do_scale = 1;
}
}
@@ -476,7 +476,7 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest)
if (rest) {
invert_m4_m4(imat, pchan->bone->arm_mat);
}
- else if (doscale) {
+ else if (do_scale) {
copy_m4_m4(posemat, pchan->pose_mat);
normalize_m4(posemat);
invert_m4_m4(imat, posemat);
@@ -581,7 +581,7 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest)
copy_m4_m3(result_array[a].mat, mat3);
copy_v3_v3(result_array[a].mat[3], fp);
- if (doscale) {
+ if (do_scale) {
/* correct for scaling when this matrix is used in scaled space */
mul_serie_m4(result_array[a].mat, iscalemat, result_array[a].mat, scalemat, NULL, NULL, NULL, NULL, NULL);
}
@@ -835,7 +835,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm, float
const short invert_vgroup = deformflag & ARM_DEF_INVERT_VGROUP;
int defbase_tot = 0; /* safety for vertexgroup index overflow */
int i, target_totvert = 0; /* safety for vertexgroup overflow */
- int use_dverts = 0;
+ int use_dverts = FALSE;
int armature_def_nr;
int totchan;
@@ -895,11 +895,12 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm, float
if (deformflag & ARM_DEF_VGROUP) {
if (ELEM(target->type, OB_MESH, OB_LATTICE)) {
/* if we have a DerivedMesh, only use dverts if it has them */
- if (dm)
- if (dm->getVertData(dm, 0, CD_MDEFORMVERT))
- use_dverts = 1;
- else use_dverts = 0;
- else if (dverts) use_dverts = 1;
+ if (dm) {
+ use_dverts = (dm->getVertData(dm, 0, CD_MDEFORMVERT) != NULL);
+ }
+ else if (dverts) {
+ use_dverts = TRUE;
+ }
if (use_dverts) {
defnrToPC = MEM_callocN(sizeof(*defnrToPC) * defbase_tot, "defnrToBone");
@@ -2245,13 +2246,13 @@ static void do_strip_modifiers(Scene *scene, Object *armob, Bone *bone, bPoseCha
int do_modif;
for (strip = armob->nlastrips.first; strip; strip = strip->next) {
- do_modif = 0;
+ do_modif = FALSE;
if (scene_cfra >= strip->start && scene_cfra <= strip->end)
- do_modif = 1;
+ do_modif = TRUE;
if ((scene_cfra > strip->end) && (strip->flag & ACTSTRIP_HOLDLASTFRAME)) {
- do_modif = 1;
+ do_modif = TRUE;
/* if there are any other strips active, ignore modifiers for this strip -
* 'hold' option should only hold action modifiers if there are
@@ -2261,7 +2262,7 @@ static void do_strip_modifiers(Scene *scene, Object *armob, Bone *bone, bPoseCha
if (scene_cfra >= strip2->start && scene_cfra <= strip2->end) {
if (!(strip2->flag & ACTSTRIP_MUTE))
- do_modif = 0;
+ do_modif = FALSE;
}
}
@@ -2270,7 +2271,7 @@ static void do_strip_modifiers(Scene *scene, Object *armob, Bone *bone, bPoseCha
for (strip2 = strip->next; strip2; strip2 = strip2->next) {
if (scene_cfra < strip2->start) continue;
if ((strip2->flag & ACTSTRIP_HOLDLASTFRAME) && !(strip2->flag & ACTSTRIP_MUTE)) {
- do_modif = 0;
+ do_modif = FALSE;
}
}
}
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index b2cbf0a1ce1..e6333ed74aa 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -334,8 +334,10 @@ static int handle_subversion_warning(Main *main, ReportList *reports)
{
if (main->minversionfile > BLENDER_VERSION ||
(main->minversionfile == BLENDER_VERSION &&
- main->minsubversionfile > BLENDER_SUBVERSION)) {
- BKE_reportf(reports, RPT_ERROR, "File written by newer Blender binary: %d.%d , expect loss of data!", main->minversionfile, main->minsubversionfile);
+ main->minsubversionfile > BLENDER_SUBVERSION))
+ {
+ BKE_reportf(reports, RPT_ERROR, "File written by newer Blender binary: %d.%d, expect loss of data!",
+ main->minversionfile, main->minsubversionfile);
}
return 1;
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index f019287144d..741d4b729ae 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -1329,7 +1329,7 @@ struct ImBuf *BKE_brush_gen_radial_control_imbuf(Brush *br)
for (i = 0; i < side; ++i) {
for (j = 0; j < side; ++j) {
- float magn = sqrt(pow(i - half, 2) + pow(j - half, 2));
+ float magn = sqrtf(powf(i - half, 2) + powf(j - half, 2));
im->rect_float[i * side + j] = BKE_brush_curve_strength_clamp(br, magn, half);
}
}
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 3450408a0a0..f6eee44b92c 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -636,13 +636,12 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
else {
if (index) {
orig = *index++;
- if (orig == ORIGINDEX_NONE) { if (nors) nors += 3; continue; }
- if (drawParamsMapped) draw_option = drawParamsMapped(userData, orig);
- else { if (nors) nors += 3; continue; }
+ if (orig == ORIGINDEX_NONE) { if (nors) nors += 3; continue; }
+ if (drawParamsMapped) { draw_option = drawParamsMapped(userData, orig); }
+ else { if (nors) nors += 3; continue; }
}
- else
- if (drawParamsMapped) draw_option = drawParamsMapped(userData, i);
- else { if (nors) nors += 3; continue; }
+ else if (drawParamsMapped) { draw_option = drawParamsMapped(userData, i); }
+ else { if (nors) nors += 3; continue; }
}
if (draw_option != DM_DRAW_OPTION_SKIP) {
@@ -1039,13 +1038,13 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
MFace *mface = cddm->mface;
/* MTFace *tf = dm->getTessFaceDataArray(dm, CD_MTFACE); */ /* UNUSED */
float (*nors)[3] = dm->getTessFaceDataArray(dm, CD_NORMAL);
- int a, b, dodraw, matnr, new_matnr;
+ int a, b, do_draw, matnr, new_matnr;
int orig, *index = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
cdDM_update_normals_from_pbvh(dm);
matnr = -1;
- dodraw = 0;
+ do_draw = FALSE;
glShadeModel(GL_SMOOTH);
@@ -1062,14 +1061,14 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
if (new_matnr != matnr) {
glEnd();
- dodraw = setMaterial(matnr = new_matnr, &gattribs);
- if (dodraw)
+ do_draw = setMaterial(matnr = new_matnr, &gattribs);
+ if (do_draw)
DM_vertex_attributes_from_gpu(dm, &gattribs, &attribs);
glBegin(GL_QUADS);
}
- if (!dodraw) {
+ if (!do_draw) {
continue;
}
else if (setDrawOptions) {
@@ -1139,7 +1138,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
numfaces = curface - start;
if (numfaces > 0) {
- if (dodraw) {
+ if (do_draw) {
if (numdata != 0) {
@@ -1161,9 +1160,9 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
}
numdata = 0;
start = curface;
- /* prevdraw = dodraw; */ /* UNUSED */
- dodraw = setMaterial(matnr = new_matnr, &gattribs);
- if (dodraw) {
+ /* prevdraw = do_draw; */ /* UNUSED */
+ do_draw = setMaterial(matnr = new_matnr, &gattribs);
+ if (do_draw) {
DM_vertex_attributes_from_gpu(dm, &gattribs, &attribs);
if (attribs.totorco) {
@@ -1215,7 +1214,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
}
}
- if (dodraw && numdata != 0) {
+ if (do_draw && numdata != 0) {
offset = 0;
if (attribs.totorco) {
copy_v3_v3((float *)&varray[elementsize * curface * 3], (float *)attribs.orco.array[mface->v1]);
@@ -1257,7 +1256,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
}
curface++;
if (mface->v4) {
- if (dodraw && numdata != 0) {
+ if (do_draw && numdata != 0) {
offset = 0;
if (attribs.totorco) {
copy_v3_v3((float *)&varray[elementsize * curface * 3], (float *)attribs.orco.array[mface->v3]);
@@ -1302,7 +1301,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
}
numfaces = curface - start;
if (numfaces > 0) {
- if (dodraw) {
+ if (do_draw) {
if (numdata != 0) {
GPU_buffer_unlock(buffer);
GPU_interleaved_attrib_setup(buffer, datatypes, numdata);
@@ -1472,9 +1471,9 @@ static void cdDM_foreachMappedFaceCenter(
void *userData)
{
CDDerivedMesh *cddm = (CDDerivedMesh *)dm;
- MVert *mv = cddm->mvert;
- MPoly *mp = cddm->mpoly;
- MLoop *ml = cddm->mloop;
+ MVert *mvert = cddm->mvert;
+ MPoly *mp;
+ MLoop *ml;
int i, j, orig, *index;
index = CustomData_get_layer(&dm->polyData, CD_ORIGINDEX);
@@ -1493,23 +1492,23 @@ static void cdDM_foreachMappedFaceCenter(
ml = &cddm->mloop[mp->loopstart];
cent[0] = cent[1] = cent[2] = 0.0f;
for (j = 0; j < mp->totloop; j++, ml++) {
- add_v3_v3v3(cent, cent, mv[ml->v].co);
+ add_v3_v3v3(cent, cent, mvert[ml->v].co);
}
mul_v3_fl(cent, 1.0f / (float)j);
ml = &cddm->mloop[mp->loopstart];
if (j > 3) {
normal_quad_v3(no,
- mv[(ml + 0)->v].co,
- mv[(ml + 1)->v].co,
- mv[(ml + 2)->v].co,
- mv[(ml + 3)->v].co);
+ mvert[(ml + 0)->v].co,
+ mvert[(ml + 1)->v].co,
+ mvert[(ml + 2)->v].co,
+ mvert[(ml + 3)->v].co);
}
else {
normal_tri_v3(no,
- mv[(ml + 0)->v].co,
- mv[(ml + 1)->v].co,
- mv[(ml + 2)->v].co);
+ mvert[(ml + 0)->v].co,
+ mvert[(ml + 1)->v].co,
+ mvert[(ml + 2)->v].co);
}
func(userData, orig, cent, no);
@@ -1892,6 +1891,14 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis
med->flag = BM_edge_flag_to_mflag(eed);
+ /* handle this differently to editmode switching,
+ * only enable draw for single user edges rather then calculating angle */
+ if ((med->flag & ME_EDGEDRAW) == 0) {
+ if (eed->l && eed->l == eed->l->radial_next) {
+ med->flag |= ME_EDGEDRAW;
+ }
+ }
+
CustomData_from_bmesh_block(&bm->edata, &dm->edgeData, eed->head.data, i);
if (add_orig) *index = i;
}
@@ -2397,11 +2404,13 @@ void CDDM_calc_edges_tessface(DerivedMesh *dm)
CustomData_add_layer(&edgeData, CD_MEDGE, CD_CALLOC, NULL, numEdges);
CustomData_add_layer(&edgeData, CD_ORIGINDEX, CD_CALLOC, NULL, numEdges);
- ehi = BLI_edgehashIterator_new(eh);
med = CustomData_get_layer(&edgeData, CD_MEDGE);
index = CustomData_get_layer(&edgeData, CD_ORIGINDEX);
- for (i = 0; !BLI_edgehashIterator_isDone(ehi);
- BLI_edgehashIterator_step(ehi), ++i, ++med, ++index) {
+
+ for (ehi = BLI_edgehashIterator_new(eh), i = 0;
+ BLI_edgehashIterator_isDone(ehi) == FALSE;
+ BLI_edgehashIterator_step(ehi), ++i, ++med, ++index)
+ {
BLI_edgehashIterator_getKey(ehi, &med->v1, &med->v2);
med->flag = ME_EDGEDRAW | ME_EDGERENDER;
@@ -2460,11 +2469,13 @@ void CDDM_calc_edges(DerivedMesh *dm)
CustomData_add_layer(&edgeData, CD_MEDGE, CD_CALLOC, NULL, numEdges);
CustomData_add_layer(&edgeData, CD_ORIGINDEX, CD_CALLOC, NULL, numEdges);
- ehi = BLI_edgehashIterator_new(eh);
med = CustomData_get_layer(&edgeData, CD_MEDGE);
index = CustomData_get_layer(&edgeData, CD_ORIGINDEX);
- for (i = 0; !BLI_edgehashIterator_isDone(ehi);
- BLI_edgehashIterator_step(ehi), ++i, ++med, ++index) {
+
+ for (ehi = BLI_edgehashIterator_new(eh), i = 0;
+ BLI_edgehashIterator_isDone(ehi) == FALSE;
+ BLI_edgehashIterator_step(ehi), ++i, ++med, ++index)
+ {
BLI_edgehashIterator_getKey(ehi, &med->v1, &med->v2);
j = GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi));
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index b38f0f78cdb..e067b7195ce 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -429,10 +429,10 @@ static DerivedMesh *cloth_to_triangles(DerivedMesh *dm)
MFace *mface2 = NULL;
/* calc faces */
- for(i = 0; i < numfaces; i++)
- {
- if(mface[i].v4)
+ for (i = 0; i < numfaces; i++) {
+ if (mface[i].v4) {
quads++;
+ }
}
result = CDDM_from_template(dm, dm->getNumVerts(dm), 0, numfaces + quads, 0, 0);
@@ -443,8 +443,7 @@ static DerivedMesh *cloth_to_triangles(DerivedMesh *dm)
DM_ensure_tessface(result);
mface2 = result->getTessFaceArray(result);
- for(i = 0, j = numfaces; i < numfaces; i++)
- {
+ for (i = 0, j = numfaces; i < numfaces; i++) {
// DG TODO: is this necessary?
mface2[i].v1 = mface[i].v1;
mface2[i].v2 = mface[i].v2;
@@ -453,8 +452,7 @@ static DerivedMesh *cloth_to_triangles(DerivedMesh *dm)
mface2[i].v4 = 0;
//test_index_face(&mface2[i], &result->faceData, i, 3);
- if(mface[i].v4)
- {
+ if (mface[i].v4) {
DM_copy_tessface_data(dm, result, i, j, 1);
mface2[j].v1 = mface[i].v1;
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index a93653537c7..7c5cf68affa 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -345,19 +345,17 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM
}
}
- if(result)
- {
+ if (result) {
int i = 0;
- for(i = 0; i < 3; i++)
- {
- if(cloth1->verts[collpair->ap1].impulse_count > 0 && ABS(cloth1->verts[collpair->ap1].impulse[i]) < ABS(i1[i]))
+ for (i = 0; i < 3; i++) {
+ if (cloth1->verts[collpair->ap1].impulse_count > 0 && ABS(cloth1->verts[collpair->ap1].impulse[i]) < ABS(i1[i]))
cloth1->verts[collpair->ap1].impulse[i] = i1[i];
- if(cloth1->verts[collpair->ap2].impulse_count > 0 && ABS(cloth1->verts[collpair->ap2].impulse[i]) < ABS(i2[i]))
+ if (cloth1->verts[collpair->ap2].impulse_count > 0 && ABS(cloth1->verts[collpair->ap2].impulse[i]) < ABS(i2[i]))
cloth1->verts[collpair->ap2].impulse[i] = i2[i];
- if(cloth1->verts[collpair->ap3].impulse_count > 0 && ABS(cloth1->verts[collpair->ap3].impulse[i]) < ABS(i3[i]))
+ if (cloth1->verts[collpair->ap3].impulse_count > 0 && ABS(cloth1->verts[collpair->ap3].impulse[i]) < ABS(i3[i]))
cloth1->verts[collpair->ap3].impulse[i] = i3[i];
}
}
@@ -681,8 +679,9 @@ static int cloth_bvh_objcollisions_resolve ( ClothModifierData * clmd, Collision
}
}
- if(!result)
+ if (!result) {
break;
+ }
}
return ret;
}
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index a1f87762db7..da9350cc7b9 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -3155,7 +3155,7 @@ static void clampto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
/* find bounding-box range where target is located */
if (ownLoc[clamp_axis] < curveMin[clamp_axis]) {
/* bounding-box range is before */
- offset = curveMin[clamp_axis] - ceil((curveMin[clamp_axis] - ownLoc[clamp_axis]) / len) * len;
+ offset = curveMin[clamp_axis] - ceilf((curveMin[clamp_axis] - ownLoc[clamp_axis]) / len) * len;
/* now, we calculate as per normal, except using offset instead of curveMin[clamp_axis] */
curvetime = (ownLoc[clamp_axis] - offset) / (len);
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index d736309f605..4cdb4e1b66e 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -44,6 +44,7 @@
#include "BLI_listbase.h"
#include "BLI_string.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_main.h"
@@ -251,7 +252,7 @@ static int ctx_data_get(bContext *C, const char *member, bContextDataResult *res
bScreen *sc;
ScrArea *sa;
ARegion *ar;
- int done = 0, recursion = C->data.recursion;
+ int done = FALSE, recursion = C->data.recursion;
int ret = 0;
memset(result, 0, sizeof(bContextDataResult));
@@ -279,7 +280,7 @@ static int ctx_data_get(bContext *C, const char *member, bContextDataResult *res
entry = BLI_rfindstring(&C->wm.store->entries, member, offsetof(bContextStoreEntry, name));
if (entry) {
result->ptr = entry->ptr;
- done = 1;
+ done = TRUE;
}
}
if (done != 1 && recursion < 2 && (ar = CTX_wm_region(C))) {
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 6a0991cf4e5..ce62b9c10dc 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -378,7 +378,7 @@ void BKE_curve_texspace_calc(Curve *cu)
DispList *dl;
BoundBox *bb;
float *fp, min[3], max[3];
- int tot, doit = 0;
+ int tot, do_it = FALSE;
if (cu->bb == NULL)
cu->bb = MEM_callocN(sizeof(BoundBox), "boundbox");
@@ -390,7 +390,7 @@ void BKE_curve_texspace_calc(Curve *cu)
while (dl) {
tot = ELEM(dl->type, DL_INDEX3, DL_INDEX4) ? dl->nr : dl->nr * dl->parts;
- if (tot) doit = 1;
+ if (tot) do_it = TRUE;
fp = dl->verts;
while (tot--) {
minmax_v3v3_v3(min, max, fp);
@@ -399,7 +399,7 @@ void BKE_curve_texspace_calc(Curve *cu)
dl = dl->next;
}
- if (!doit) {
+ if (do_it == FALSE) {
min[0] = min[1] = min[2] = -1.0f;
max[0] = max[1] = max[2] = 1.0f;
}
@@ -1272,12 +1272,12 @@ float *BKE_curve_surf_make_orco(Object *ob)
for (b = 0; b < sizeu; b++) {
int use_b = b;
if (b == sizeu - 1 && (nu->flagu & CU_NURB_CYCLIC))
- use_b = 0;
+ use_b = FALSE;
for (a = 0; a < sizev; a++) {
int use_a = a;
if (a == sizev - 1 && (nu->flagv & CU_NURB_CYCLIC))
- use_a = 0;
+ use_a = FALSE;
tdata = _tdata + 3 * (use_b * (nu->pntsv * resolv) + use_a);
@@ -2216,7 +2216,7 @@ void BKE_curve_bevelList_make(Object *ob)
/* check if we will calculate tilt data */
do_tilt = CU_DO_TILT(cu, nu);
do_radius = CU_DO_RADIUS(cu, nu); /* normal display uses the radius, better just to calculate them */
- do_weight = 1;
+ do_weight = TRUE;
/* check we are a single point? also check we are not a surface and that the orderu is sane,
* enforced in the UI but can go wrong possibly */
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 90a3e617477..4e7653e2473 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -992,6 +992,38 @@ static void layerInterp_shapekey(void **sources, float *weights,
}
}
+static void layerDefault_mvert_skin(void *data, int count)
+{
+ MVertSkin *vs = data;
+ int i;
+
+ for (i = 0; i < count; i++) {
+ copy_v3_fl(vs[i].radius, 0.25f);
+ vs[i].flag = 0;
+ }
+}
+
+static void layerInterp_mvert_skin(void **sources, float *weights,
+ float *UNUSED(sub_weights),
+ int count, void *dest)
+{
+ float radius[3], w;
+ MVertSkin *vs;
+ int i;
+
+ zero_v3(radius);
+ for (i = 0; i < count; i++) {
+ w = weights ? weights[i] : 1.0f;
+ vs = sources[i];
+
+ madd_v3_v3fl(radius, vs->radius, w);
+ }
+
+ vs = dest;
+ copy_v3_v3(vs->radius, radius);
+ vs->flag &= ~MVERT_SKIN_ROOT;
+}
+
static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
/* 0: CD_MVERT */
{sizeof(MVert), "MVert", 1, NULL, NULL, NULL, NULL, NULL, NULL},
@@ -1093,7 +1125,10 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
{sizeof(float), "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
/* 35: CD_GRID_PAINT_MASK */
{sizeof(GridPaintMask), "GridPaintMask", 1, NULL, layerCopy_grid_paint_mask,
- layerFree_grid_paint_mask, NULL, NULL, NULL}
+ layerFree_grid_paint_mask, NULL, NULL, NULL},
+ /* 36: CD_SKIN_NODE */
+ {sizeof(MVertSkin), "MVertSkin", 1, "Skin", NULL, NULL,
+ layerInterp_mvert_skin, NULL, layerDefault_mvert_skin}
};
/* note, numbers are from trunk and need updating for bmesh */
@@ -1108,10 +1143,7 @@ static const char *LAYERTYPENAMES[CD_NUMTYPES] = {
/* BMESH ONLY */
/* 25-29 */ "CDMPoly", "CDMLoop", "CDShapeKeyIndex", "CDShapeKey", "CDBevelWeight",
/* 30-34 */ "CDSubSurfCrease", "CDOrigSpaceLoop", "CDPreviewLoopCol", "CDBMElemPyPtr", "CDPaintMask",
- /* 35 */ "CDGridPaintMask"
-
-/* END BMESH ONLY */
-
+ /* 35-36 */ "CDGridPaintMask", "CDMVertSkin"
};
@@ -1123,26 +1155,26 @@ const CustomDataMask CD_MASK_MESH =
CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_PROP_STR | CD_MASK_MDISPS |
CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_MPOLY | CD_MASK_MLOOP |
CD_MASK_MTEXPOLY | CD_MASK_NORMAL | CD_MASK_RECAST | CD_MASK_PAINT_MASK |
- CD_MASK_GRID_PAINT_MASK;
+ CD_MASK_GRID_PAINT_MASK | CD_MASK_MVERT_SKIN;
const CustomDataMask CD_MASK_EDITMESH =
CD_MASK_MSTICKY | CD_MASK_MDEFORMVERT | CD_MASK_MTFACE | CD_MASK_MLOOPUV |
CD_MASK_MLOOPCOL | CD_MASK_MTEXPOLY | CD_MASK_SHAPE_KEYINDEX |
CD_MASK_MCOL | CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_PROP_STR |
CD_MASK_MDISPS | CD_MASK_SHAPEKEY | CD_MASK_RECAST | CD_MASK_PAINT_MASK |
- CD_MASK_GRID_PAINT_MASK;
+ CD_MASK_GRID_PAINT_MASK | CD_MASK_MVERT_SKIN;
const CustomDataMask CD_MASK_DERIVEDMESH =
CD_MASK_MSTICKY | CD_MASK_MDEFORMVERT | CD_MASK_MTFACE |
CD_MASK_MCOL | CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_CLOTH_ORCO |
CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_MTEXPOLY | CD_MASK_PREVIEW_MLOOPCOL |
CD_MASK_PROP_STR | CD_MASK_ORIGSPACE | CD_MASK_ORIGSPACE_MLOOP | CD_MASK_ORCO | CD_MASK_TANGENT |
CD_MASK_PREVIEW_MCOL | CD_MASK_NORMAL | CD_MASK_SHAPEKEY | CD_MASK_RECAST |
- CD_MASK_ORIGINDEX | CD_MASK_POLYINDEX;
+ CD_MASK_ORIGINDEX | CD_MASK_POLYINDEX | CD_MASK_MVERT_SKIN;
const CustomDataMask CD_MASK_BMESH =
CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_MTEXPOLY |
CD_MASK_MSTICKY | CD_MASK_MDEFORMVERT | CD_MASK_PROP_FLT | CD_MASK_PROP_INT |
CD_MASK_PROP_STR | CD_MASK_SHAPEKEY | CD_MASK_SHAPE_KEYINDEX | CD_MASK_MDISPS |
CD_MASK_CREASE | CD_MASK_BWEIGHT | CD_MASK_RECAST | CD_MASK_PAINT_MASK |
- CD_MASK_GRID_PAINT_MASK;
+ CD_MASK_GRID_PAINT_MASK | CD_MASK_MVERT_SKIN;
const CustomDataMask CD_MASK_FACECORNERS =
CD_MASK_MTFACE | CD_MASK_MCOL | CD_MASK_MTEXPOLY | CD_MASK_MLOOPUV |
CD_MASK_MLOOPCOL;
@@ -2323,7 +2355,8 @@ void CustomData_bmesh_copy_data(const CustomData *source, CustomData *dest,
/* if we found a matching layer, copy the data */
if (dest->layers[dest_i].type == source->layers[src_i].type &&
- strcmp(dest->layers[dest_i].name, source->layers[src_i].name) == 0) {
+ strcmp(dest->layers[dest_i].name, source->layers[src_i].name) == 0)
+ {
char *src_data = (char *)src_block + source->layers[src_i].offset;
char *dest_data = (char *)*dest_block + dest->layers[dest_i].offset;
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 0396733760f..547a64a70d4 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -538,7 +538,7 @@ void flip_side_name(char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP_
break;
}
}
- /* case; beginning with r R l L , with separator after it */
+ /* case; beginning with r R l L, with separator after it */
else if (is_char_sep(name[1])) {
switch (name[0]) {
case 'l':
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index e44264c8d4b..2b08c085417 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -2631,7 +2631,7 @@ void DAG_ids_flush_tagged(Main *bmain)
ListBase *lbarray[MAX_LIBARRAY];
Scene *sce;
unsigned int lay;
- int a, do_flush = 0;
+ int a, do_flush = FALSE;
dag_current_scene_layers(bmain, &sce, &lay);
@@ -2651,7 +2651,7 @@ void DAG_ids_flush_tagged(Main *bmain)
for (; id; id = id->next) {
if (id->flag & (LIB_ID_RECALC | LIB_ID_RECALC_DATA)) {
dag_id_flush_update(sce, id);
- do_flush = 1;
+ do_flush = TRUE;
}
}
}
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 9274d7aefcb..2493507dca4 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -901,7 +901,8 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
continue;
if (mti->type == eModifierTypeType_OnlyDeform ||
- (mti->type == eModifierTypeType_DeformOrConstruct && !dm)) {
+ (mti->type == eModifierTypeType_DeformOrConstruct && !dm))
+ {
if (editmode)
appf |= MOD_APPLY_USECACHE;
if (dm) {
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index b3ed3dcaf1d..eb5e4e4f8b5 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -276,12 +276,12 @@ DynamicPaintSurface *get_activeSurface(DynamicPaintCanvasSettings *canvas)
void dynamicPaint_resetPreview(DynamicPaintCanvasSettings *canvas)
{
DynamicPaintSurface *surface = canvas->surfaces.first;
- int done = 0;
+ int done = FALSE;
for (; surface; surface = surface->next) {
if (!done && dynamicPaint_surfaceHasColorPreview(surface)) {
surface->flags |= MOD_DPAINT_PREVIEW;
- done = 1;
+ done = TRUE;
}
else
surface->flags &= ~MOD_DPAINT_PREVIEW;
@@ -575,16 +575,16 @@ static int surface_getBrushFlags(DynamicPaintSurface *surface, Scene *scene)
brushObj = NULL;
/* select object */
- if (surface->brush_group) {
+ if (surface->brush_group) {
if (go->ob) brushObj = go->ob;
- }
- else
+ }
+ else
brushObj = base->object;
if (!brushObj) {
if (surface->brush_group) go = go->next;
else base = base->next;
- continue;
+ continue;
}
if (surface->brush_group)
@@ -2035,7 +2035,8 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh
int v4 = (mface[i].v4) ? mface[i].v4 : -1;
if ((e1_index == mface[i].v1 || e1_index == mface[i].v2 || e1_index == mface[i].v3 || e1_index == v4) &&
- (e2_index == mface[i].v1 || e2_index == mface[i].v2 || e2_index == mface[i].v3 || e2_index == v4)) {
+ (e2_index == mface[i].v1 || e2_index == mface[i].v2 || e2_index == mface[i].v3 || e2_index == v4))
+ {
if (i == cPoint->face_index) continue;
target_face = i;
@@ -3511,7 +3512,8 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
}
/* get final object space depth */
else if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE ||
- surface->type == MOD_DPAINT_SURFACE_T_WAVE) {
+ surface->type == MOD_DPAINT_SURFACE_T_WAVE)
+ {
depth /= bData->bNormal[index].normal_scale * total_sample;
}
@@ -3569,7 +3571,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
tree = BLI_kdtree_new(psys->totpart);
/* loop through particles and insert valid ones to the tree */
- for (p = 0, pa = psys->particles; p < psys->totpart; p++, pa++) {
+ for (p = 0, pa = psys->particles; p < psys->totpart; p++, pa++) {
/* Proceed only if particle is active */
if (pa->alive == PARS_UNBORN && (part->flag & PART_UNBORN) == 0) continue;
@@ -3803,8 +3805,8 @@ static int dynamicPaint_paintSinglePoint(DynamicPaintSurface *surface, float *po
/* Smooth range or color ramp */
if (brush->proximity_falloff == MOD_DPAINT_PRFALL_SMOOTH ||
- brush->proximity_falloff == MOD_DPAINT_PRFALL_RAMP) {
-
+ brush->proximity_falloff == MOD_DPAINT_PRFALL_RAMP)
+ {
strength = 1.0f - distance / brush_radius;
CLAMP(strength, 0.0f, 1.0f);
}
@@ -3855,7 +3857,8 @@ static int dynamicPaint_paintSinglePoint(DynamicPaintSurface *surface, float *po
if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) {
if (brush->proximity_falloff == MOD_DPAINT_PRFALL_RAMP &&
- !(brush->flags & MOD_DPAINT_RAMP_ALPHA)) {
+ !(brush->flags & MOD_DPAINT_RAMP_ALPHA))
+ {
paintColor[0] = colorband[0];
paintColor[1] = colorband[1];
paintColor[2] = colorband[2];
@@ -4400,7 +4403,8 @@ void dynamicPaint_doWaveStep(DynamicPaintSurface *surface, float timescale)
avg_dist = (numOfN) ? avg_dist / numOfN : 0.0f;
if (surface->flags & MOD_DPAINT_WAVE_OPEN_BORDERS &&
- sData->adj_data->flags[index] & ADJ_ON_MESH_EDGE) {
+ sData->adj_data->flags[index] & ADJ_ON_MESH_EDGE)
+ {
/* if open borders, apply a fake height to keep waves going on */
avg_height = (numOfRN) ? avg_height / numOfRN : 0.0f;
wPoint->height = (dt * wave_speed * avg_height + wPoint->height * avg_dist) / (avg_dist + dt * wave_speed);
@@ -4507,7 +4511,8 @@ static void dynamicPaint_surfacePreStep(DynamicPaintSurface *surface, float time
/* dissolve for float types */
else if (surface->flags & MOD_DPAINT_DISSOLVE &&
(surface->type == MOD_DPAINT_SURFACE_T_DISPLACE ||
- surface->type == MOD_DPAINT_SURFACE_T_WEIGHT)) {
+ surface->type == MOD_DPAINT_SURFACE_T_WEIGHT))
+ {
float *point = &((float *)sData->type_data)[index];
/* log or linear */
@@ -4727,7 +4732,8 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, Scene *sc
/* Prepare surface normal directional scale to easily convert
* brush intersection amount between global and local space */
if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE ||
- surface->type == MOD_DPAINT_SURFACE_T_WAVE) {
+ surface->type == MOD_DPAINT_SURFACE_T_WAVE)
+ {
float temp_nor[3];
if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) {
normal_short_to_float_v3(temp_nor, mvert[index].no);
@@ -4805,17 +4811,17 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
while (base || go) {
brushObj = NULL;
/* select object */
- if (surface->brush_group) {
+ if (surface->brush_group) {
if (go->ob) brushObj = go->ob;
- }
- else
+ }
+ else
brushObj = base->object;
- if (!brushObj) {
+ if (!brushObj) {
/* skip item */
if (surface->brush_group) go = go->next;
else base = base->next;
- continue;
+ continue;
}
/* next item */
@@ -4856,7 +4862,8 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
/* Particle brush: */
if (brush->collision == MOD_DPAINT_COL_PSYS) {
if (brush && brush->psys && brush->psys->part && brush->psys->part->type == PART_EMITTER &&
- psys_check_enabled(brushObj, brush->psys)) {
+ psys_check_enabled(brushObj, brush->psys))
+ {
/* Paint a particle system */
BKE_animsys_evaluate_animdata(scene, &brush->psys->part->id, brush->psys->part->adt, BKE_scene_frame_get(scene), ADT_RECALC_ANIM);
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index 3e25281dd08..e0c3b257273 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -980,9 +980,9 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
DMVertexAttribs attribs;
GPUVertexAttribs gattribs;
- int i, b, matnr, new_matnr, dodraw;
+ int i, b, matnr, new_matnr, do_draw;
- dodraw = 0;
+ do_draw = FALSE;
matnr = -1;
memset(&attribs, 0, sizeof(attribs));
@@ -1026,12 +1026,12 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
new_matnr = efa->mat_nr + 1;
if (new_matnr != matnr) {
- dodraw = setMaterial(matnr = new_matnr, &gattribs);
- if (dodraw)
+ do_draw = setMaterial(matnr = new_matnr, &gattribs);
+ if (do_draw)
DM_vertex_attributes_from_gpu(dm, &gattribs, &attribs);
}
- if (dodraw) {
+ if (do_draw) {
glBegin(GL_TRIANGLES);
if (!drawSmooth) {
if (vertexCos) glNormal3fv(bmdm->polyNos[BM_elem_index_get(efa)]);
@@ -1688,6 +1688,20 @@ DerivedMesh *getEditDerivedBMesh(BMEditMesh *em,
}
}
+ if (CustomData_has_layer(&bm->vdata, CD_MVERT_SKIN)) {
+ BMIter iter;
+ BMVert *eve;
+ int i;
+
+ DM_add_vert_layer(&bmdm->dm, CD_MVERT_SKIN, CD_CALLOC, NULL);
+
+ BM_ITER_MESH_INDEX (eve, &iter, bmdm->tc->bm, BM_VERTS_OF_MESH, i) {
+ DM_set_vert_data(&bmdm->dm, i, CD_MVERT_SKIN,
+ CustomData_bmesh_get(&bm->vdata, eve->head.data,
+ CD_MVERT_SKIN));
+ }
+ }
+
if (vertexCos) {
BMFace *efa;
BMVert *eve;
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 9d878cd185f..e20a74e713c 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -477,7 +477,7 @@ static void get_fcurve_end_keyframes(FCurve *fcu, BezTriple **first, BezTriple *
/* Calculate the extents of F-Curve's data */
void calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax,
- const short do_sel_only)
+ const short do_sel_only, const short include_handles)
{
float xminv = 999999999.0f, xmaxv = -999999999.0f;
float yminv = 999999999.0f, ymaxv = -999999999.0f;
@@ -495,8 +495,14 @@ void calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, floa
if (bezt_first) {
BLI_assert(bezt_last != NULL);
- xminv = MIN2(xminv, bezt_first->vec[1][0]);
- xmaxv = MAX2(xmaxv, bezt_last->vec[1][0]);
+ if (include_handles) {
+ xminv = MIN3(xminv, bezt_first->vec[0][0], bezt_first->vec[1][0]);
+ xmaxv = MAX3(xmaxv, bezt_last->vec[1][0], bezt_last->vec[2][0]);
+ }
+ else {
+ xminv = MIN2(xminv, bezt_first->vec[1][0]);
+ xmaxv = MAX2(xmaxv, bezt_last->vec[1][0]);
+ }
}
}
@@ -505,11 +511,16 @@ void calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, floa
BezTriple *bezt;
for (bezt = fcu->bezt, i = 0; i < fcu->totvert; bezt++, i++) {
- if ((do_sel_only == 0) || BEZSELECTED(bezt)) {
- if (bezt->vec[1][1] < yminv)
- yminv = bezt->vec[1][1];
- if (bezt->vec[1][1] > ymaxv)
- ymaxv = bezt->vec[1][1];
+ if ((do_sel_only == FALSE) || BEZSELECTED(bezt)) {
+ if (include_handles) {
+ yminv = MIN4(yminv, bezt->vec[1][1], bezt->vec[0][1], bezt->vec[2][1]);
+ ymaxv = MAX4(ymaxv, bezt->vec[1][1], bezt->vec[0][1], bezt->vec[2][1]);
+ }
+ else {
+ yminv = MIN2(yminv, bezt->vec[1][1]);
+ ymaxv = MAX2(ymaxv, bezt->vec[1][1]);
+ }
+
foundvert = TRUE;
}
}
@@ -531,7 +542,7 @@ void calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, floa
yminv = fpt->vec[1];
if (fpt->vec[1] > ymaxv)
ymaxv = fpt->vec[1];
-
+
foundvert = TRUE;
}
}
@@ -570,20 +581,20 @@ void calc_fcurve_range(FCurve *fcu, float *start, float *end,
/* get endpoint keyframes */
get_fcurve_end_keyframes(fcu, &bezt_first, &bezt_last, do_sel_only);
-
+
if (bezt_first) {
BLI_assert(bezt_last != NULL);
-
+
min = MIN2(min, bezt_first->vec[1][0]);
max = MAX2(max, bezt_last->vec[1][0]);
-
+
foundvert = TRUE;
}
}
else if (fcu->fpt) {
min = MIN2(min, fcu->fpt[0].vec[0]);
max = MAX2(max, fcu->fpt[fcu->totvert - 1].vec[0]);
-
+
foundvert = TRUE;
}
@@ -1241,7 +1252,7 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar)
bPoseChannel *pchan;
float mat[4][4];
float oldEul[3] = {0.0f, 0.0f, 0.0f};
- short useEulers = 0, rotOrder = ROT_MODE_EUL;
+ short use_eulers = FALSE, rot_order = ROT_MODE_EUL;
/* check if this target has valid data */
if ((ob == NULL) || (GS(ob->id.name) != ID_OB)) {
@@ -1263,8 +1274,8 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar)
/* bone */
if (pchan->rotmode > 0) {
copy_v3_v3(oldEul, pchan->eul);
- rotOrder = pchan->rotmode;
- useEulers = 1;
+ rot_order = pchan->rotmode;
+ use_eulers = TRUE;
}
if (dtar->flag & DTAR_FLAG_LOCALSPACE) {
@@ -1290,8 +1301,8 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar)
/* object */
if (ob->rotmode > 0) {
copy_v3_v3(oldEul, ob->rot);
- rotOrder = ob->rotmode;
- useEulers = 1;
+ rot_order = ob->rotmode;
+ use_eulers = TRUE;
}
if (dtar->flag & DTAR_FLAG_LOCALSPACE) {
@@ -1334,9 +1345,9 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar)
*/
float eul[3];
- mat4_to_eulO(eul, rotOrder, mat);
+ mat4_to_eulO(eul, rot_order, mat);
- if (useEulers) {
+ if (use_eulers) {
compatible_eul(eul, oldEul);
}
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 07c5d6d0329..061530965ef 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -634,7 +634,7 @@ makebreak:
* But if the font is FO_BUILTIN_NAME then do not try loading since
* whole font is in the memory already
*/
- if (che == NULL && strcmp(vfont->name, FO_BUILTIN_NAME)) {
+ if (che == NULL && strcmp(vfont->name, FO_BUILTIN_NAME)) {
BLI_vfontchar_from_freetypefont(vfont, ascii);
}
@@ -705,9 +705,10 @@ makebreak:
linedata3[lnr] = tb->w / cu->fsize;
linedata4[lnr] = wsnr;
- if ( (tb->h != 0.0f) &&
- ((-(yof - (tb->y / cu->fsize))) > ((tb->h / cu->fsize) - (linedist * cu->fsize)) - cu->yof) &&
- (cu->totbox > (curbox + 1)) ) {
+ if ((tb->h != 0.0f) &&
+ ((-(yof - (tb->y / cu->fsize))) > ((tb->h / cu->fsize) - (linedist * cu->fsize)) - cu->yof) &&
+ (cu->totbox > (curbox + 1)) )
+ {
maxlen = 0;
tb++;
curbox++;
@@ -802,8 +803,7 @@ makebreak:
ct++;
}
}
- else if ((cu->spacemode == CU_FLUSH) &&
- (cu->tb[0].w != 0.0f)) {
+ else if ((cu->spacemode == CU_FLUSH) && (cu->tb[0].w != 0.0f)) {
for (i = 0; i < lnr; i++)
if (linedata2[i] > 1)
linedata[i] = (linedata3[i] - linedata[i]) / (linedata2[i] - 1);
@@ -829,7 +829,8 @@ makebreak:
}
if ((mem[j] != '\r') && (mem[j] != '\n') &&
- ((chartransdata[j].dobreak != 0))) {
+ ((chartransdata[j].dobreak != 0)))
+ {
if (mem[i] == ' ') curofs += (linedata3[ct->linenr] - linedata[ct->linenr]) / linedata4[ct->linenr];
ct->xof += curofs;
}
@@ -1029,9 +1030,9 @@ makebreak:
if ((info->flag & CU_CHINFO_UNDERLINE) && (cu->textoncurve == NULL) && (cha != '\n') && (cha != '\r')) {
float ulwidth, uloverlap = 0.0f;
- if ( (i < (slen - 1)) && (mem[i + 1] != '\n') && (mem[i + 1] != '\r') &&
- ((mem[i + 1] != ' ') || (custrinfo[i + 1].flag & CU_CHINFO_UNDERLINE)) && ((custrinfo[i + 1].flag & CU_CHINFO_WRAP) == 0)
- ) {
+ if ((i < (slen - 1)) && (mem[i + 1] != '\n') && (mem[i + 1] != '\r') &&
+ ((mem[i + 1] != ' ') || (custrinfo[i + 1].flag & CU_CHINFO_UNDERLINE)) && ((custrinfo[i + 1].flag & CU_CHINFO_WRAP) == 0))
+ {
uloverlap = xtrax + 0.1f;
}
// Find the character, the characters has to be in the memory already
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c
index ceffe269e85..2ff58e2c3f9 100644
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@ -306,7 +306,7 @@ static void group_replaces_nla(Object *parent, Object *target, char mode)
{
static ListBase nlastrips = {NULL, NULL};
static bAction *action = NULL;
- static int done = 0;
+ static int done = FALSE;
bActionStrip *strip, *nstrip;
if (mode == 's') {
@@ -320,7 +320,7 @@ static void group_replaces_nla(Object *parent, Object *target, char mode)
action = target->action;
target->action = NULL;
target->nlaflag |= OB_NLA_OVERRIDE;
- done = 1;
+ done = TRUE;
}
nstrip = MEM_dupallocN(strip);
BLI_addtail(&target->nlastrips, nstrip);
@@ -335,7 +335,7 @@ static void group_replaces_nla(Object *parent, Object *target, char mode)
nlastrips.first = nlastrips.last = NULL; /* not needed, but yah... :) */
action = NULL;
- done = 0;
+ done = FALSE;
}
}
}
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 797a2093729..80b192c7a42 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -592,10 +592,12 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char
if (floatbuf) {
ibuf = IMB_allocImBuf(width, height, depth, IB_rectfloat);
rect_float = (float *)ibuf->rect_float;
+ ibuf->profile = IB_PROFILE_LINEAR_RGB;
}
else {
ibuf = IMB_allocImBuf(width, height, depth, IB_rect);
rect = (unsigned char *)ibuf->rect;
+ ibuf->profile = IB_PROFILE_SRGB;
}
BLI_strncpy(ibuf->name, name, sizeof(ibuf->name));
diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c
index 4579e6f92aa..d460368784a 100644
--- a/source/blender/blenkernel/intern/image_gen.c
+++ b/source/blender/blenkernel/intern/image_gen.c
@@ -78,7 +78,9 @@ void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int widt
float *rect_float_orig = rect_float;
- float h = 0.0, hoffs = 0.0, hue = 0.0, s = 0.9, v = 0.9, r, g, b;
+ float h = 0.0, hoffs = 0.0;
+ float hsv[3] = {0.0f, 0.9f, 0.9f};
+ float rgb[3];
/* checkers */
for (y = 0; y < height; y++) {
@@ -123,25 +125,25 @@ void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int widt
h = 0.125f * floorf(x / checkerwidth);
if ((fabs((x % checkerwidth) - (checkerwidth / 2)) < 4) &&
- (fabs((y % checkerwidth) - (checkerwidth / 2)) < 4)) {
-
+ (fabs((y % checkerwidth) - (checkerwidth / 2)) < 4))
+ {
if ((fabs((x % checkerwidth) - (checkerwidth / 2)) < 1) ||
- (fabs((y % checkerwidth) - (checkerwidth / 2)) < 1)) {
-
- hue = fmodf(fabs(h - hoffs), 1.0f);
- hsv_to_rgb(hue, s, v, &r, &g, &b);
+ (fabs((y % checkerwidth) - (checkerwidth / 2)) < 1))
+ {
+ hsv[0] = fmodf(fabs(h - hoffs), 1.0f);
+ hsv_to_rgb_v(hsv, rgb);
if (rect) {
- rect[0] = (char)(r * 255.0f);
- rect[1] = (char)(g * 255.0f);
- rect[2] = (char)(b * 255.0f);
+ rect[0] = (char)(rgb[0] * 255.0f);
+ rect[1] = (char)(rgb[1] * 255.0f);
+ rect[2] = (char)(rgb[2] * 255.0f);
rect[3] = 255;
}
if (rect_float) {
- rect_float[0] = r;
- rect_float[1] = g;
- rect_float[2] = b;
+ rect_float[0] = rgb[0];
+ rect_float[1] = rgb[1];
+ rect_float[2] = rgb[2];
rect_float[3] = 1.0f;
}
}
@@ -162,33 +164,33 @@ void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int widt
static void checker_board_color_fill(unsigned char *rect, float *rect_float, int width, int height)
{
int hue_step, y, x;
- float hue, val, sat, r, g, b;
+ float hsv[3], rgb[3];
- sat = 1.0;
+ hsv[1] = 1.0;
hue_step = power_of_2_max_i(width / 8);
if (hue_step < 8) hue_step = 8;
for (y = 0; y < height; y++) {
- val = 0.1 + (y * (0.4 / height)); /* use a number lower then 1.0 else its too bright */
+ hsv[2] = 0.1 + (y * (0.4 / height)); /* use a number lower then 1.0 else its too bright */
for (x = 0; x < width; x++) {
- hue = (float)((double)(x / hue_step) * 1.0 / width * hue_step);
- hsv_to_rgb(hue, sat, val, &r, &g, &b);
+ hsv[0] = (float)((double)(x / hue_step) * 1.0 / width * hue_step);
+ hsv_to_rgb_v(hsv, rgb);
if (rect) {
- rect[0] = (char)(r * 255.0f);
- rect[1] = (char)(g * 255.0f);
- rect[2] = (char)(b * 255.0f);
+ rect[0] = (char)(rgb[0] * 255.0f);
+ rect[1] = (char)(rgb[1] * 255.0f);
+ rect[2] = (char)(rgb[2] * 255.0f);
rect[3] = 255;
rect += 4;
}
if (rect_float) {
- rect_float[0] = r;
- rect_float[1] = g;
- rect_float[2] = b;
+ rect_float[0] = rgb[0];
+ rect_float[1] = rgb[1];
+ rect_float[2] = rgb[2];
rect_float[3] = 1.0f;
rect_float += 4;
@@ -250,7 +252,7 @@ static void checker_board_grid_fill(unsigned char *rect, float *rect_float, int
int x, y;
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
- if (((y % 32) == 0) || ((x % 32) == 0) || x == 0) {
+ if (((y % 32) == 0) || ((x % 32) == 0) || x == 0) {
if (rect) {
rect[0] = BLEND_CHAR(rect[0], blend);
rect[1] = BLEND_CHAR(rect[1], blend);
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index f4ec223a2fe..deb294a6738 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -271,7 +271,7 @@ void sort_keys(Key *key)
/**************** do the key ****************/
-void key_curve_position_weights(float t, float *data, int type)
+void key_curve_position_weights(float t, float data[4], int type)
{
float t2, t3, fc;
@@ -303,7 +303,7 @@ void key_curve_position_weights(float t, float *data, int type)
}
/* first derivative */
-void key_curve_tangent_weights(float t, float *data, int type)
+void key_curve_tangent_weights(float t, float data[4], int type)
{
float t2, fc;
@@ -333,7 +333,7 @@ void key_curve_tangent_weights(float t, float *data, int type)
}
/* second derivative */
-void key_curve_normal_weights(float t, float *data, int type)
+void key_curve_normal_weights(float t, float data[4], int type)
{
float fc;
@@ -359,11 +359,11 @@ void key_curve_normal_weights(float t, float *data, int type)
}
}
-static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl)
+static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float t[4], int cycl)
{
/* return 1 means k[2] is the position, return 0 means interpolate */
KeyBlock *k1, *firstkey;
- float d, dpos, ofs = 0, lastpos, temp, fval[4];
+ float d, dpos, ofs = 0, lastpos;
short bsplinetype;
firstkey = lb->first;
@@ -467,17 +467,12 @@ static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl)
}
/* interpolation */
-
key_curve_position_weights(d, t, k[1]->type);
if (k[1]->type != k[2]->type) {
- key_curve_position_weights(d, fval, k[2]->type);
-
- temp = 1.0f - d;
- t[0] = temp * t[0] + d * fval[0];
- t[1] = temp * t[1] + d * fval[1];
- t[2] = temp * t[2] + d * fval[2];
- t[3] = temp * t[3] + d * fval[3];
+ float t_other[4];
+ key_curve_position_weights(d, t_other, k[2]->type);
+ interp_v4_v4v4(t, t, t_other, d);
}
return 0;
@@ -721,7 +716,6 @@ void do_rel_key(const int start, int end, const int tot, char *basispoin, Key *k
KeyBlock *kb;
int *ofsp, ofs[3], elemsize, b;
char *cp, *poin, *reffrom, *from, elemstr[8];
- char *freefrom, *freereffrom;
int poinsize;
/* currently always 0, in future key_pointer_size may assign */
@@ -754,6 +748,7 @@ void do_rel_key(const int start, int end, const int tot, char *basispoin, Key *k
if (!(kb->flag & KEYBLOCK_MUTE) && icuval != 0.0f && kb->totelem == tot) {
KeyBlock *refb;
float weight, *weights = kb->weights;
+ char *freefrom = NULL, *freereffrom = NULL;
/* reference now can be any block */
refb = BLI_findlink(&key->block, kb->relative);
@@ -1260,7 +1255,7 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int
float t[4];
int flag;
- if (key->slurph && key->type != KEY_RELATIVE) {
+ if (key->slurph && key->type != KEY_RELATIVE) {
const float ctime_scaled = key->ctime / 100.0f;
float delta = (float)key->slurph / tot;
float cfra = (float)scene->r.cfra;
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 6a69ffb474a..15db290ff14 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -658,13 +658,16 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target,
*/
if (target && target->type == OB_MESH) {
/* if there's derived data without deformverts, don't use vgroups */
- if (dm && !dm->getVertData(dm, 0, CD_MDEFORMVERT))
- use_vgroups = 0;
- else
- use_vgroups = 1;
+ if (dm) {
+ use_vgroups = (dm->getVertData(dm, 0, CD_MDEFORMVERT) != NULL);
+ }
+ else {
+ Mesh *me = target->data;
+ use_vgroups = (me->dvert != NULL);
+ }
}
else {
- use_vgroups = 0;
+ use_vgroups = FALSE;
}
if (vgroup && vgroup[0] && use_vgroups) {
@@ -801,13 +804,16 @@ void lattice_deform_verts(Object *laOb, Object *target, DerivedMesh *dm,
*/
if (target && target->type == OB_MESH) {
/* if there's derived data without deformverts, don't use vgroups */
- if (dm && !dm->getVertData(dm, 0, CD_MDEFORMVERT))
- use_vgroups = 0;
- else
- use_vgroups = 1;
+ if (dm) {
+ use_vgroups = (dm->getVertData(dm, 0, CD_MDEFORMVERT) != NULL);
+ }
+ else {
+ Mesh *me = target->data;
+ use_vgroups = (me->dvert != NULL);
+ }
}
else {
- use_vgroups = 0;
+ use_vgroups = FALSE;
}
if (vgroup && vgroup[0] && use_vgroups) {
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index 7da0661fef6..bef5f2e18a3 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -351,7 +351,7 @@ void BKE_mball_texspace_calc(Object *ob)
DispList *dl;
BoundBox *bb;
float *data, min[3], max[3] /*, loc[3], size[3] */;
- int tot, doit = 0;
+ int tot, do_it = FALSE;
if (ob->bb == NULL) ob->bb = MEM_callocN(sizeof(BoundBox), "mb boundbox");
bb = ob->bb;
@@ -364,7 +364,7 @@ void BKE_mball_texspace_calc(Object *ob)
dl = ob->disp.first;
while (dl) {
tot = dl->nr;
- if (tot) doit = 1;
+ if (tot) do_it = TRUE;
data = dl->verts;
while (tot--) {
/* Also weird... but longer. From utildefines. */
@@ -374,7 +374,7 @@ void BKE_mball_texspace_calc(Object *ob)
dl = dl->next;
}
- if (!doit) {
+ if (!do_it) {
min[0] = min[1] = min[2] = -1.0f;
max[0] = max[1] = max[2] = 1.0f;
}
@@ -1135,11 +1135,11 @@ static int otherface(int edge, int face)
static void makecubetable(void)
{
- static int isdone = 0;
+ static int is_done = FALSE;
int i, e, c, done[12], pos[8];
- if (isdone) return;
- isdone = 1;
+ if (is_done) return;
+ is_done = TRUE;
for (i = 0; i < 256; i++) {
for (e = 0; e < 12; e++) done[e] = 0;
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 7a5c43b28f8..9eb74986b29 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -50,6 +50,7 @@
#include "BLI_math.h"
#include "BLI_edgehash.h"
#include "BLI_scanfill.h"
+#include "BLI_array.h"
#include "BKE_animsys.h"
#include "BKE_main.h"
@@ -70,11 +71,6 @@
#include "BKE_tessmesh.h"
#include "BLI_edgehash.h"
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
-#include "BLI_array.h"
-#include "BLI_edgehash.h"
-
#include "bmesh.h"
enum {
@@ -88,7 +84,7 @@ enum {
MESHCMP_POLYMISMATCH,
MESHCMP_EDGEUNKNOWN,
MESHCMP_VERTCOMISMATCH,
- MESHCMP_CDLAYERS_MISMATCH,
+ MESHCMP_CDLAYERS_MISMATCH
};
static const char *cmpcode_to_str(int code)
@@ -812,8 +808,8 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr)
mface->v4 == mface->v1 ||
/* across the face */
mface->v1 == mface->v3 ||
- mface->v2 == mface->v4
- ) {
+ mface->v2 == mface->v4)
+ {
return 0;
}
}
@@ -3000,6 +2996,18 @@ int poly_get_adj_loops_from_vert(unsigned adj_r[3], const MPoly *poly,
return corner;
}
+/* Return the index of the edge vert that is not equal to 'v'. If
+ * neither edge vertex is equal to 'v', returns -1. */
+int BKE_mesh_edge_other_vert(const MEdge *e, int v)
+{
+ if (e->v1 == v)
+ return e->v2;
+ else if (e->v2 == v)
+ return e->v1;
+ else
+ return -1;
+}
+
/* update the hide flag for edges and faces from the corresponding
* flag in verts */
void BKE_mesh_flush_hidden_from_verts(const MVert *mvert,
diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c
index 1645a8c9c9b..a60bb98ac18 100644
--- a/source/blender/blenkernel/intern/mesh_validate.c
+++ b/source/blender/blenkernel/intern/mesh_validate.c
@@ -667,11 +667,11 @@ void BKE_mesh_calc_edges(Mesh *mesh, int update)
memset(&edata, 0, sizeof(edata));
CustomData_add_layer(&edata, CD_MEDGE, CD_CALLOC, NULL, totedge);
- ehi = BLI_edgehashIterator_new(eh);
med = CustomData_get_layer(&edata, CD_MEDGE);
- for (i = 0; !BLI_edgehashIterator_isDone(ehi);
- BLI_edgehashIterator_step(ehi), ++i, ++med) {
-
+ for (ehi = BLI_edgehashIterator_new(eh), i = 0;
+ BLI_edgehashIterator_isDone(ehi) == FALSE;
+ BLI_edgehashIterator_step(ehi), ++i, ++med)
+ {
if (update && (med_orig = BLI_edgehashIterator_getValue(ehi))) {
*med = *med_orig; /* copy from the original */
}
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index 2159837c9a0..b4c30203000 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -250,8 +250,7 @@ int modifier_couldBeCage(struct Scene *scene, ModifierData *md)
int modifier_sameTopology(ModifierData *md)
{
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- return ELEM3(mti->type, eModifierTypeType_OnlyDeform, eModifierTypeType_Nonconstructive,
- eModifierTypeType_NonGeometrical);
+ return ELEM(mti->type, eModifierTypeType_OnlyDeform, eModifierTypeType_NonGeometrical);
}
int modifier_nonGeometrical(ModifierData *md)
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index f07de7f0127..ccf64639967 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -195,7 +195,7 @@ static ImBuf *movieclip_load_sequence_file(MovieClip *clip, MovieClipUser *user,
{
struct ImBuf *ibuf;
char name[FILE_MAX];
- int loadflag, use_proxy = 0;
+ int loadflag, use_proxy = FALSE;
use_proxy = (flag & MCLIP_USE_PROXY) && user->render_size != MCLIP_PROXY_RENDER_SIZE_FULL;
if (use_proxy) {
@@ -540,10 +540,6 @@ static ImBuf *get_undistorted_ibuf(MovieClip *clip, struct MovieDistortion *dist
{
ImBuf *undistibuf;
- /* XXX: because of #27997 do not use float buffers to undistort,
- * otherwise, undistorted proxy can be darker than it should */
- imb_freerectfloatImBuf(ibuf);
-
if (distortion)
undistibuf = BKE_tracking_distortion_exec(distortion, &clip->tracking, ibuf, ibuf->x, ibuf->y, 0.0f, 1);
else
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index c6424580a31..445105d254a 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -336,6 +336,7 @@ bNode *nodeAddNode(bNodeTree *ntree, struct bNodeTemplate *ntemp)
node->width= ntype->width;
node->miniwidth= 42.0f;
node->height= ntype->height;
+ node->color[0] = node->color[1] = node->color[2] = 0.608; /* default theme color */
node_add_sockets_from_type(ntree, node, ntype);
@@ -591,40 +592,49 @@ void nodeInternalRelink(bNodeTree *ntree, bNode *node)
BLI_freelistN(&intlinks);
}
-/* transforms node location to area coords */
-void nodeSpaceCoords(bNode *node, float *locx, float *locy)
+void nodeToView(bNode *node, float x, float y, float *rx, float *ry)
{
if (node->parent) {
- nodeSpaceCoords(node->parent, locx, locy);
- *locx += node->locx;
- *locy += node->locy;
+ nodeToView(node->parent, x + node->locx, y + node->locy, rx, ry);
}
else {
- *locx = node->locx;
- *locy = node->locy;
+ *rx = x + node->locx;
+ *ry = y + node->locy;
+ }
+}
+
+void nodeFromView(bNode *node, float x, float y, float *rx, float *ry)
+{
+ if (node->parent) {
+ nodeFromView(node->parent, x, y, rx, ry);
+ *rx -= node->locx;
+ *ry -= node->locy;
+ }
+ else {
+ *rx = x - node->locx;
+ *ry = y - node->locy;
}
}
void nodeAttachNode(bNode *node, bNode *parent)
{
- float parentx, parenty;
+ float locx, locy;
+ nodeToView(node, 0.0f, 0.0f, &locx, &locy);
node->parent = parent;
/* transform to parent space */
- nodeSpaceCoords(parent, &parentx, &parenty);
- node->locx -= parentx;
- node->locy -= parenty;
+ nodeFromView(parent, locx, locy, &node->locx, &node->locy);
}
void nodeDetachNode(struct bNode *node)
{
- float parentx, parenty;
+ float locx, locy;
if (node->parent) {
- /* transform to "global" (area) space */
- nodeSpaceCoords(node->parent, &parentx, &parenty);
- node->locx += parentx;
- node->locy += parenty;
+ /* transform to view space */
+ nodeToView(node, 0.0f, 0.0f, &locx, &locy);
+ node->locx = locx;
+ node->locy = locy;
node->parent = NULL;
}
}
@@ -1392,7 +1402,7 @@ static int node_get_deplist_recurs(bNode *node, bNode ***nsort)
bNodeSocket *sock;
int level = 0xFFF;
- node->done= 1;
+ node->done = TRUE;
/* check linked nodes */
for (sock= node->inputs.first; sock; sock= sock->next) {
@@ -1431,7 +1441,7 @@ void ntreeGetDependencyList(struct bNodeTree *ntree, struct bNode ***deplist, in
/* first clear data */
for (node= ntree->nodes.first; node; node= node->next) {
- node->done= 0;
+ node->done = FALSE;
(*totnodes)++;
}
if (*totnodes==0) {
@@ -1456,7 +1466,7 @@ static void ntree_update_node_level(bNodeTree *ntree)
/* first clear tag */
for (node= ntree->nodes.first; node; node= node->next) {
- node->done= 0;
+ node->done = FALSE;
}
/* recursive check */
@@ -1977,6 +1987,7 @@ static void registerShaderNodes(bNodeTreeType *ttype)
register_node_type_sh_geometry(ttype);
register_node_type_sh_light_path(ttype);
register_node_type_sh_light_falloff(ttype);
+ register_node_type_sh_object_info(ttype);
register_node_type_sh_fresnel(ttype);
register_node_type_sh_layer_weight(ttype);
register_node_type_sh_tex_coord(ttype);
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 6fec35add8b..0968358a815 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1046,6 +1046,10 @@ static void copy_object_pose(Object *obn, Object *ob)
chan->flag &= ~(POSE_LOC | POSE_ROT | POSE_SIZE);
+ if (chan->custom) {
+ id_us_plus(&chan->custom->id);
+ }
+
for (con = chan->constraints.first; con; con = con->next) {
bConstraintTypeInfo *cti = constraint_get_typeinfo(con);
ListBase targets = {NULL, NULL};
@@ -1096,7 +1100,7 @@ Object *BKE_object_pose_armature_get(Object *ob)
return NULL;
}
-static void copy_object_transform(Object *ob_tar, Object *ob_src)
+void BKE_object_transform_copy(Object *ob_tar, const Object *ob_src)
{
copy_v3_v3(ob_tar->loc, ob_src->loc);
copy_v3_v3(ob_tar->rot, ob_src->rot);
@@ -1371,7 +1375,7 @@ void BKE_object_make_proxy(Object *ob, Object *target, Object *gob)
BKE_object_apply_mat4(ob, ob->obmat, FALSE, TRUE);
}
else {
- copy_object_transform(ob, target);
+ BKE_object_transform_copy(ob, target);
ob->parent = target->parent; /* libdata */
copy_m4_m4(ob->parentinv, target->parentinv);
}
@@ -2264,8 +2268,15 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3])
{
Curve *cu = ob->data;
- if (cu->bb == NULL) BKE_curve_texspace_calc(cu);
- bb = *(cu->bb);
+ /* Use the object bounding box so that modifier output
+ gets taken into account */
+ if (ob->bb)
+ bb = *(ob->bb);
+ else {
+ if (cu->bb == NULL)
+ BKE_curve_texspace_calc(cu);
+ bb = *(cu->bb);
+ }
for (a = 0; a < 8; a++) {
mul_m4_v3(ob->obmat, bb.vec[a]);
@@ -2773,11 +2784,11 @@ int BKE_object_obdata_texspace_get(Object *ob, short **r_texflag, float **r_loc,
int BKE_boundbox_ray_hit_check(struct BoundBox *bb, float ray_start[3], float ray_normal[3])
{
static int triangle_indexes[12][3] = {{0, 1, 2}, {0, 2, 3},
- {3, 2, 6}, {3, 6, 7},
- {1, 2, 6}, {1, 6, 5},
- {5, 6, 7}, {4, 5, 7},
- {0, 3, 7}, {0, 4, 7},
- {0, 1, 5}, {0, 4, 5}};
+ {3, 2, 6}, {3, 6, 7},
+ {1, 2, 6}, {1, 6, 5},
+ {5, 6, 7}, {4, 5, 7},
+ {0, 3, 7}, {0, 4, 7},
+ {0, 1, 5}, {0, 4, 5}};
int result = 0;
int i;
@@ -3036,10 +3047,12 @@ int BKE_object_is_animated(Scene *scene, Object *ob)
ModifierData *md;
for (md = modifiers_getVirtualModifierList(ob); md; md = md->next)
- if(modifier_dependsOnTime(md) &&
- (modifier_isEnabled(scene, md, eModifierMode_Realtime) ||
- modifier_isEnabled(scene, md, eModifierMode_Render)))
+ if (modifier_dependsOnTime(md) &&
+ (modifier_isEnabled(scene, md, eModifierMode_Realtime) ||
+ modifier_isEnabled(scene, md, eModifierMode_Render)))
+ {
return 1;
+ }
return 0;
}
diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c
index e76cde652c8..3d3a5ed7556 100644
--- a/source/blender/blenkernel/intern/ocean.c
+++ b/source/blender/blenkernel/intern/ocean.c
@@ -500,10 +500,10 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
// compute a new htilda
#pragma omp parallel for private(i, j)
- for (i = 0; i < o->_M; ++i) {
+ for (i = 0; i < o->_M; ++i) {
// note the <= _N/2 here, see the fftw doco about
// the mechanics of the complex->real fft storage
- for (j = 0; j <= o->_N / 2; ++j) {
+ for (j = 0; j <= o->_N / 2; ++j) {
fftw_complex exp_param1;
fftw_complex exp_param2;
fftw_complex conj_param;
@@ -538,8 +538,8 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
{
if (o->_do_chop) {
// x displacement
- for (i = 0; i < o->_M; ++i) {
- for (j = 0; j <= o->_N / 2; ++j) {
+ for (i = 0; i < o->_M; ++i) {
+ for (j = 0; j <= o->_N / 2; ++j) {
fftw_complex mul_param;
fftw_complex minus_i;
@@ -560,8 +560,8 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
{
if (o->_do_chop) {
// z displacement
- for (i = 0; i < o->_M; ++i) {
- for (j = 0; j <= o->_N / 2; ++j) {
+ for (i = 0; i < o->_M; ++i) {
+ for (j = 0; j <= o->_N / 2; ++j) {
fftw_complex mul_param;
fftw_complex minus_i;
@@ -582,8 +582,8 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
{
if (o->_do_jacobian) {
// Jxx
- for (i = 0; i < o->_M; ++i) {
- for (j = 0; j <= o->_N / 2; ++j) {
+ for (i = 0; i < o->_M; ++i) {
+ for (j = 0; j <= o->_N / 2; ++j) {
fftw_complex mul_param;
//init_complex(mul_param, -scale, 0);
@@ -597,8 +597,8 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
}
fftw_execute(o->_Jxx_plan);
- for (i = 0; i < o->_M; ++i) {
- for (j = 0; j < o->_N; ++j) {
+ for (i = 0; i < o->_M; ++i) {
+ for (j = 0; j < o->_N; ++j) {
o->_Jxx[i * o->_N + j] += 1.0;
}
}
@@ -609,8 +609,8 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
{
if (o->_do_jacobian) {
// Jzz
- for (i = 0; i < o->_M; ++i) {
- for (j = 0; j <= o->_N / 2; ++j) {
+ for (i = 0; i < o->_M; ++i) {
+ for (j = 0; j <= o->_N / 2; ++j) {
fftw_complex mul_param;
//init_complex(mul_param, -scale, 0);
@@ -623,8 +623,8 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
}
}
fftw_execute(o->_Jzz_plan);
- for (i = 0; i < o->_M; ++i) {
- for (j = 0; j < o->_N; ++j) {
+ for (i = 0; i < o->_M; ++i) {
+ for (j = 0; j < o->_N; ++j) {
o->_Jzz[i * o->_N + j] += 1.0;
}
}
@@ -635,8 +635,8 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
{
if (o->_do_jacobian) {
// Jxz
- for (i = 0; i < o->_M; ++i) {
- for (j = 0; j <= o->_N / 2; ++j) {
+ for (i = 0; i < o->_M; ++i) {
+ for (j = 0; j <= o->_N / 2; ++j) {
fftw_complex mul_param;
//init_complex(mul_param, -scale, 0);
@@ -656,8 +656,8 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
{
// fft normals
if (o->_do_normals) {
- for (i = 0; i < o->_M; ++i) {
- for (j = 0; j <= o->_N / 2; ++j) {
+ for (i = 0; i < o->_M; ++i) {
+ for (j = 0; j <= o->_N / 2; ++j) {
fftw_complex mul_param;
init_complex(mul_param, 0.0, -1.0);
@@ -674,8 +674,8 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
#pragma omp section
{
if (o->_do_normals) {
- for (i = 0; i < o->_M; ++i) {
- for (j = 0; j <= o->_N / 2; ++j) {
+ for (i = 0; i < o->_M; ++i) {
+ for (j = 0; j <= o->_N / 2; ++j) {
fftw_complex mul_param;
init_complex(mul_param, 0.0, -1.0);
@@ -687,8 +687,8 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
fftw_execute(o->_N_z_plan);
#if 0
- for (i = 0; i < o->_M; ++i) {
- for (j = 0; j < o->_N; ++j) {
+ for (i = 0; i < o->_M; ++i) {
+ for (j = 0; j < o->_N; ++j) {
o->_N_y[i * o->_N + j] = 1.0f / scale;
}
}
@@ -802,21 +802,21 @@ void BKE_init_ocean(struct Ocean *o, int M, int N, float Lx, float Lz, float V,
o->_kz[i] = -2.0f * (float)M_PI * ii / o->_Lz;
// pre-calculate the k matrix
- for (i = 0; i < o->_M; ++i)
- for (j = 0; j <= o->_N / 2; ++j)
+ for (i = 0; i < o->_M; ++i)
+ for (j = 0; j <= o->_N / 2; ++j)
o->_k[i * (1 + o->_N / 2) + j] = sqrt(o->_kx[i] * o->_kx[i] + o->_kz[j] * o->_kz[j]);
/*srand(seed);*/
BLI_srand(seed);
- for (i = 0; i < o->_M; ++i) {
- for (j = 0; j < o->_N; ++j) {
+ for (i = 0; i < o->_M; ++i) {
+ for (j = 0; j < o->_N; ++j) {
float r1 = gaussRand();
float r2 = gaussRand();
fftw_complex r1r2;
init_complex(r1r2, r1, r2);
- mul_complex_f(o->_h0[i * o->_N + j], r1r2, (float)(sqrt(Ph(o, o->_kx[i], o->_kz[j]) / 2.0f)));
+ mul_complex_f(o->_h0[i * o->_N + j], r1r2, (float)(sqrt(Ph(o, o->_kx[i], o->_kz[j]) / 2.0f)));
mul_complex_f(o->_h0_minus[i * o->_N + j], r1r2, (float)(sqrt(Ph(o, -o->_kx[i], -o->_kz[j]) / 2.0f)));
}
}
@@ -1253,13 +1253,13 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v
printf("Cannot save Displacement File Output to %s\n", string);
if (o->_do_jacobian) {
- cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_FOAM);
+ cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_FOAM);
if (0 == BKE_imbuf_write(ibuf_foam, string, &imf))
printf("Cannot save Foam File Output to %s\n", string);
}
if (o->_do_normals) {
- cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_NORMAL);
+ cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_NORMAL);
if (0 == BKE_imbuf_write(ibuf_normal, string, &imf))
printf("Cannot save Normal File Output to %s\n", string);
}
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 8676a3e75a0..66dd23e76b9 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -614,7 +614,7 @@ typedef struct ParticleRenderData {
float viewmat[4][4], winmat[4][4];
int winx, winy;
- int dosimplify;
+ int do_simplify;
int timeoffset;
ParticleRenderElem *elems;
int *origindex;
@@ -821,7 +821,7 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
if (data->elems)
MEM_freeN(data->elems);
- data->dosimplify = 1;
+ data->do_simplify = TRUE;
data->elems = elems;
data->origindex = origindex;
@@ -960,7 +960,7 @@ int psys_render_simplify_params(ParticleSystem *psys, ChildParticle *cpa, float
return 0;
data = psys->renderdata;
- if (!data->dosimplify)
+ if (!data->do_simplify)
return 0;
b = (data->origindex) ? data->origindex[cpa->num] : cpa->num;
@@ -3465,7 +3465,7 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n
md = modifier_new(eModifierType_ParticleSystem);
- if (name) BLI_strncpy(md->name, name, sizeof(md->name));
+ if (name) BLI_strncpy_utf8(md->name, name, sizeof(md->name));
else BLI_snprintf(md->name, sizeof(md->name), "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
modifier_unique_name(&ob->modifiers, md);
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 5397b1729f9..fa47600deb2 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -206,7 +206,7 @@ static void realloc_particles(ParticleSimulationData *sim, int new_totpart)
int totpart, totsaved = 0;
if (new_totpart<0) {
- if (part->distr==PART_DISTR_GRID && part->from != PART_FROM_VERT) {
+ if ((part->distr == PART_DISTR_GRID) && (part->from != PART_FROM_VERT)) {
totpart= part->grid_res;
totpart*=totpart*totpart;
}
@@ -4135,7 +4135,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
pa->dietime = sim->scene->r.efra + 1;
pa->lifetime = sim->scene->r.efra;
pa->alive = PARS_ALIVE;
- //if (a < 25) fprintf(stderr,"FSPARTICLE debug set %s , a%d = %f,%f,%f , life=%f\n", filename, a, pa->co[0],pa->co[1],pa->co[2], pa->lifetime );
+ //if (a < 25) fprintf(stderr,"FSPARTICLE debug set %s, a%d = %f,%f,%f, life=%f\n", filename, a, pa->co[0],pa->co[1],pa->co[2], pa->lifetime );
}
else {
// skip...
@@ -4444,7 +4444,8 @@ static void psys_prepare_physics(ParticleSimulationData *sim)
static int hair_needs_recalc(ParticleSystem *psys)
{
if (!(psys->flag & PSYS_EDITED) && (!psys->edit || !psys->edit->edited) &&
- ((psys->flag & PSYS_HAIR_DONE)==0 || psys->recalc & PSYS_RECALC_RESET || (psys->part->flag & PART_HAIR_REGROW && !psys->edit))) {
+ ((psys->flag & PSYS_HAIR_DONE)==0 || psys->recalc & PSYS_RECALC_RESET || (psys->part->flag & PART_HAIR_REGROW && !psys->edit)))
+ {
return 1;
}
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 69808db52b6..90d17e53349 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -2190,8 +2190,9 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
BLI_strncpy(num, de->d_name + (strlen(de->d_name) - 15), sizeof(num));
frame = atoi(num);
- if ((mode==PTCACHE_CLEAR_BEFORE && frame < cfra) ||
- (mode==PTCACHE_CLEAR_AFTER && frame > cfra) ) {
+ if ((mode == PTCACHE_CLEAR_BEFORE && frame < cfra) ||
+ (mode == PTCACHE_CLEAR_AFTER && frame > cfra))
+ {
BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name);
BLI_delete(path_full, 0, 0);
@@ -2226,8 +2227,9 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
}
else {
while (pm) {
- if ((mode==PTCACHE_CLEAR_BEFORE && pm->frame < cfra) ||
- (mode==PTCACHE_CLEAR_AFTER && pm->frame > cfra) ) {
+ if ((mode == PTCACHE_CLEAR_BEFORE && pm->frame < cfra) ||
+ (mode == PTCACHE_CLEAR_AFTER && pm->frame > cfra))
+ {
link = pm;
if (pid->cache->cached_frames && pm->frame >=sta && pm->frame <= end)
pid->cache->cached_frames[pm->frame-sta] = 0;
@@ -2732,7 +2734,7 @@ static void ptcache_dt_to_str(char *str, double dtime)
static void *ptcache_bake_thread(void *ptr)
{
- int usetimer = 0, sfra, efra;
+ int use_timer = FALSE, sfra, efra;
double stime, ptime, ctime, fetd;
char run[32], cur[32], etd[32];
@@ -2752,8 +2754,8 @@ static void *ptcache_bake_thread(void *ptr)
fetd = (ctime-ptime)*(efra-*data->cfra_ptr)/data->step;
- if (usetimer || fetd > 60.0) {
- usetimer = 1;
+ if (use_timer || fetd > 60.0) {
+ use_timer = TRUE;
ptcache_dt_to_str(cur, ctime-ptime);
ptcache_dt_to_str(run, ctime-stime);
@@ -2765,7 +2767,7 @@ static void *ptcache_bake_thread(void *ptr)
}
}
- if (usetimer) {
+ if (use_timer) {
ptcache_dt_to_str(run, PIL_check_seconds_timer()-stime);
printf("Bake %s %s (%i frames simulated).\n", (data->break_operation ? "canceled after" : "finished in"), run, *data->cfra_ptr-sfra);
}
@@ -3292,9 +3294,9 @@ void BKE_ptcache_update_info(PTCacheID *pid)
mb = (bytes > 1024.0f * 1024.0f);
BLI_snprintf(mem_info, sizeof(mem_info), "%i frames in memory (%.1f %s)",
- totframes,
- bytes / (mb ? 1024.0f * 1024.0f : 1024.0f),
- mb ? "Mb" : "kb");
+ totframes,
+ bytes / (mb ? 1024.0f * 1024.0f : 1024.0f),
+ mb ? "Mb" : "kb");
}
if (cache->flag & PTCACHE_OUTDATED) {
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index 1f129b1c547..4dfa9f7e12e 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -44,7 +44,8 @@
#include "DNA_space_types.h"
#include "DNA_view3d_types.h"
-#include "BLI_blenlib.h"
+#include "BLI_listbase.h"
+#include "BLI_utildefines.h"
#include "BKE_screen.h"
@@ -251,7 +252,7 @@ void BKE_spacedata_draw_locks(int set)
if (set)
art->do_lock = art->lock;
else
- art->do_lock = 0;
+ art->do_lock = FALSE;
}
}
}
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index ca851fd4c81..fac74d27e0d 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -291,9 +291,9 @@ static ImBuf *do_plugin_effect(
{
char *cp;
int float_rendering;
- int use_temp_bufs = 0; /* Are needed since blur.c (and maybe some other
- * old plugins) do very bad stuff
- * with imbuf-internals */
+ int use_temp_bufs = FALSE; /* Are needed since blur.c (and maybe some other
+ * old plugins) do very bad stuff
+ * with imbuf-internals */
struct ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
int x = context.rectx;
@@ -319,7 +319,7 @@ static ImBuf *do_plugin_effect(
float_rendering = (out->rect_float != NULL);
if (seq->plugin->version <= 3 && float_rendering) {
- use_temp_bufs = 1;
+ use_temp_bufs = TRUE;
if (ibuf1) {
ibuf1 = IMB_dupImBuf(ibuf1);
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 41858eeecb4..8fbb3ee9800 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -1448,7 +1448,8 @@ void seq_proxy_rebuild(SeqIndexBuildContext *context, short *stop, short *do_upd
100);
for (cfra = seq->startdisp + seq->startstill;
- cfra < seq->enddisp - seq->endstill; cfra++) {
+ cfra < seq->enddisp - seq->endstill; cfra++)
+ {
if (context->size_flags & IMB_PROXY_25) {
seq_proxy_build_frame(render_context, seq, cfra, 25);
}
@@ -1464,7 +1465,7 @@ void seq_proxy_rebuild(SeqIndexBuildContext *context, short *stop, short *do_upd
*progress = (float)cfra / (seq->enddisp - seq->endstill -
seq->startdisp + seq->startstill);
- *do_update = 1;
+ *do_update = TRUE;
if (*stop || G.afbreek)
break;
@@ -1675,7 +1676,8 @@ int input_have_to_preprocess(
float mul;
if (seq->flag & (SEQ_FILTERY | SEQ_USE_CROP | SEQ_USE_TRANSFORM | SEQ_FLIPX |
- SEQ_FLIPY | SEQ_USE_COLOR_BALANCE | SEQ_MAKE_PREMUL)) {
+ SEQ_FLIPY | SEQ_USE_COLOR_BALANCE | SEQ_MAKE_PREMUL))
+ {
return TRUE;
}
@@ -1762,8 +1764,10 @@ static ImBuf *input_preprocess(
}
}
- if (c.top + c.bottom >= ibuf->y || c.left + c.right >= ibuf->x ||
- t.xofs >= dx || t.yofs >= dy) {
+ if (c.top + c.bottom >= ibuf->y ||
+ c.left + c.right >= ibuf->x ||
+ t.xofs >= dx || t.yofs >= dy)
+ {
make_black_ibuf(ibuf);
}
else {
@@ -3168,7 +3172,7 @@ void seq_tx_handle_xlimits(Sequence *seq, int leftflag, int rightflag)
}
if (rightflag) {
- if (seq_tx_get_final_right(seq, 0) <= seq_tx_get_final_left(seq, 0)) {
+ if (seq_tx_get_final_right(seq, 0) <= seq_tx_get_final_left(seq, 0)) {
seq_tx_set_final_right(seq, seq_tx_get_final_left(seq, 0) + 1);
}
@@ -3508,7 +3512,8 @@ Sequence *seq_metastrip(ListBase *seqbase, Sequence *meta, Sequence *seq)
return meta;
}
else if (iseq->seqbase.first &&
- (rval = seq_metastrip(&iseq->seqbase, iseq, seq))) {
+ (rval = seq_metastrip(&iseq->seqbase, iseq, seq)))
+ {
return rval;
}
}
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 4b814a5b22b..edb4348dc5a 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -103,7 +103,7 @@ static void tend ( void )
{
QueryPerformanceCounter ( &liCurrentTime );
}
-static double tval( void )
+static double UNUSED_FUNCTION(tval)( void )
{
return ((double)( (liCurrentTime.QuadPart - liStartTime.QuadPart)* (double)1000.0/(double)liFrequency.QuadPart ));
}
@@ -120,7 +120,7 @@ static void tend ( void )
gettimeofday ( &_tend,&tz );
}
-static double tval( void )
+static double UNUSED_FUNCTION(tval)( void )
{
double t1, t2;
t1 = ( double ) _tstart.tv_sec*1000 + ( double ) _tstart.tv_usec/ ( 1000 );
@@ -198,8 +198,6 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
// calc other res with max_res provided
sub_v3_v3v3(size, max, min);
- // printf("size: %f, %f, %f\n", size[0], size[1], size[2]);
-
// prevent crash when initializing a plane as domain
if((size[0] < FLT_EPSILON) || (size[1] < FLT_EPSILON) || (size[2] < FLT_EPSILON))
return 0;
@@ -209,14 +207,16 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
if(size[0] > size[2])
{
scale = res / size[0];
- smd->domain->dx = size[0] / res; // dx is in global coords
+ smd->domain->scale = size[0];
+ smd->domain->dx = 1.0f / res;
smd->domain->res[0] = res;
smd->domain->res[1] = (int)(size[1] * scale + 0.5);
smd->domain->res[2] = (int)(size[2] * scale + 0.5);
}
else {
scale = res / size[2];
- smd->domain->dx = size[2] / res; // dx is in global coords
+ smd->domain->scale = size[2];
+ smd->domain->dx = 1.0f / res;
smd->domain->res[2] = res;
smd->domain->res[0] = (int)(size[0] * scale + 0.5);
smd->domain->res[1] = (int)(size[1] * scale + 0.5);
@@ -226,25 +226,24 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
if(size[1] > size[2])
{
scale = res / size[1];
- smd->domain->dx = size[1] / res; // dx is in global coords
+ smd->domain->scale = size[1];
+ smd->domain->dx = 1.0f / res;
smd->domain->res[1] = res;
smd->domain->res[0] = (int)(size[0] * scale + 0.5);
smd->domain->res[2] = (int)(size[2] * scale + 0.5);
}
else {
scale = res / size[2];
- smd->domain->dx = size[2] / res;
+ smd->domain->scale = size[2];
+ smd->domain->dx = 1.0f / res;
smd->domain->res[2] = res;
smd->domain->res[0] = (int)(size[0] * scale + 0.5);
smd->domain->res[1] = (int)(size[1] * scale + 0.5);
}
}
- // printf("smd->domain->dx: %f\n", smd->domain->dx);
-
// TODO: put in failsafe if res<=0 - dg
- // printf("res[0]: %d, res[1]: %d, res[2]: %d\n", smd->domain->res[0], smd->domain->res[1], smd->domain->res[2]);
// dt max is 0.1
smd->domain->fluid = smoke_init(smd->domain->res, smd->domain->p0, DT_DEFAULT);
smd->time = scene->r.cfra;
@@ -256,8 +255,6 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
smd->domain->res_wt[1] = smd->domain->res[1] * (smd->domain->amplify + 1);
smd->domain->res_wt[2] = smd->domain->res[2] * (smd->domain->amplify + 1);
smd->domain->dx_wt = smd->domain->dx / (smd->domain->amplify + 1);
- // printf("smd->domain->amplify: %d\n", smd->domain->amplify);
- // printf("(smd->domain->flags & MOD_SMOKE_HIGHRES)\n");
}
if(!smd->domain->shadow)
@@ -268,7 +265,6 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
if(smd->domain->wt)
{
smoke_initWaveletBlenderRNA(smd->domain->wt, &(smd->domain->strength));
- // printf("smoke_initWaveletBlenderRNA\n");
}
return 1;
}
@@ -303,8 +299,6 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
DM_ensure_tessface(dm);
fill_scs_points(ob, dm, scs);
-
- // DEBUG printf("scs->dx: %f\n", scs->dx);
}
if(!smd->coll->bvhtree)
@@ -1184,7 +1178,7 @@ static void update_obstacles(Scene *scene, Object *ob, SmokeDomainSettings *sds,
// DG TODO: cap velocity to maxVelMag (or maxvel)
// oldpos + velocity * dt = newpos
- get_cell(sds->p0, sds->res, sds->dx, cOldpos /* use current position here instead of "pos" */, cell, 0);
+ get_cell(sds->p0, sds->res, sds->dx*sds->scale, cOldpos /* use current position here instead of "pos" */, cell, 0);
// check if cell is valid (in the domain boundary)
for(j = 0; j < 3; j++)
@@ -1329,7 +1323,7 @@ static void update_flowsfluids(Scene *scene, Object *ob, SmokeDomainSettings *sd
// copy_v3_v3(pos, pa->state.co);
// mul_m4_v3(ob->imat, pos);
// 1. get corresponding cell
- get_cell(sds->p0, sds->res, sds->dx, state.co, cell, 0);
+ get_cell(sds->p0, sds->res, sds->dx*sds->scale, state.co, cell, 0);
// check if cell is valid (in the domain boundary)
for(i = 0; i < 3; i++)
{
@@ -1555,9 +1549,9 @@ static void update_effectors(Scene *scene, Object *ob, SmokeDomainSettings *sds,
vel[1] = velocity_y[index];
vel[2] = velocity_z[index];
- voxelCenter[0] = sds->p0[0] + sds->dx * x + sds->dx * 0.5;
- voxelCenter[1] = sds->p0[1] + sds->dx * y + sds->dx * 0.5;
- voxelCenter[2] = sds->p0[2] + sds->dx * z + sds->dx * 0.5;
+ voxelCenter[0] = sds->p0[0] + sds->dx * sds->scale * x + sds->dx * sds->scale * 0.5;
+ voxelCenter[1] = sds->p0[1] + sds->dx * sds->scale * y + sds->dx * sds->scale * 0.5;
+ voxelCenter[2] = sds->p0[2] + sds->dx * sds->scale * z + sds->dx * sds->scale * 0.5;
pd_point_from_loc(scene, voxelCenter, vel, index, &epoint);
pdDoEffectors(effectors, NULL, sds->effector_weights, &epoint, retvel, NULL);
@@ -1598,8 +1592,8 @@ static void step(Scene *scene, Object *ob, SmokeModifierData *smd, float fps)
/* adapt timestep for different framerates, dt = 0.1 is at 25fps */
dt *= (25.0f / fps);
- // printf("test maxVel: %f\n", (sds->dx * 1.5) / dt); // gives 0.9
- maxVel = (sds->dx * 1.5);
+ // maximum timestep/"CFL" constraint: dt < dx * maxVel
+ maxVel = (sds->dx * 1.0);
for(i = 0; i < size; i++)
{
@@ -1667,6 +1661,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
Base *base = scene->base.first;
int changed = 0;
float dx = FLT_MAX;
+ float scale = 1.0f;
int haveDomain = 0;
for ( ; base; base = base->next)
@@ -1677,9 +1672,10 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
{
SmokeDomainSettings *sds = smd2->domain;
- if(sds->dx < dx)
+ if(sds->dx * sds->scale < dx)
{
dx = sds->dx;
+ scale = sds->scale;
changed = 1;
}
@@ -1692,9 +1688,9 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
if(changed)
{
- if(dx != scs->dx)
+ if(dx*scale != scs->dx)
{
- scs->dx = dx;
+ scs->dx = dx*scale;
smokeModifier_reset(smd);
}
}
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 1041fb12305..5abc4bc3830 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -697,7 +697,7 @@ static void add_2nd_order_roller(Object *ob, float UNUSED(stiffness), int *count
if (bpo) {/* so now we have a 2nd order humpdidump */
for (c=bpo->nofsprings;c>0;c--) {
bs2 = sb->bspring + bpo->springs[c-1];
- if ((bs2->v1 != notthis) && (bs2->v1 > v0)) {
+ if ((bs2->v1 != notthis) && (bs2->v1 > v0)) {
(*counter)++;/*hit */
if (addsprings) {
bs3->v1= v0;
@@ -1054,11 +1054,12 @@ static int sb_detect_aabb_collisionCached(float UNUSED(force[3]), unsigned int U
a = ccdm->totface;
#endif
if ((aabbmax[0] < ccdm->bbmin[0]) ||
- (aabbmax[1] < ccdm->bbmin[1]) ||
- (aabbmax[2] < ccdm->bbmin[2]) ||
- (aabbmin[0] > ccdm->bbmax[0]) ||
- (aabbmin[1] > ccdm->bbmax[1]) ||
- (aabbmin[2] > ccdm->bbmax[2]) ) {
+ (aabbmax[1] < ccdm->bbmin[1]) ||
+ (aabbmax[2] < ccdm->bbmin[2]) ||
+ (aabbmin[0] > ccdm->bbmax[0]) ||
+ (aabbmin[1] > ccdm->bbmax[1]) ||
+ (aabbmin[2] > ccdm->bbmax[2]) )
+ {
/* boxes don't intersect */
BLI_ghashIterator_step(ihash);
continue;
@@ -1125,11 +1126,12 @@ static int sb_detect_face_pointCached(float face_v1[3], float face_v2[3], float
mprevvert= ccdm->mprevvert;
outerfacethickness = ob->pd->pdef_sboft;
if ((aabbmax[0] < ccdm->bbmin[0]) ||
- (aabbmax[1] < ccdm->bbmin[1]) ||
- (aabbmax[2] < ccdm->bbmin[2]) ||
- (aabbmin[0] > ccdm->bbmax[0]) ||
- (aabbmin[1] > ccdm->bbmax[1]) ||
- (aabbmin[2] > ccdm->bbmax[2]) ) {
+ (aabbmax[1] < ccdm->bbmin[1]) ||
+ (aabbmax[2] < ccdm->bbmin[2]) ||
+ (aabbmin[0] > ccdm->bbmax[0]) ||
+ (aabbmin[1] > ccdm->bbmax[1]) ||
+ (aabbmin[2] > ccdm->bbmax[2]) )
+ {
/* boxes don't intersect */
BLI_ghashIterator_step(ihash);
continue;
@@ -1220,11 +1222,12 @@ static int sb_detect_face_collisionCached(float face_v1[3], float face_v2[3], fl
a = ccdm->totface;
if ((aabbmax[0] < ccdm->bbmin[0]) ||
- (aabbmax[1] < ccdm->bbmin[1]) ||
- (aabbmax[2] < ccdm->bbmin[2]) ||
- (aabbmin[0] > ccdm->bbmax[0]) ||
- (aabbmin[1] > ccdm->bbmax[1]) ||
- (aabbmin[2] > ccdm->bbmax[2]) ) {
+ (aabbmax[1] < ccdm->bbmin[1]) ||
+ (aabbmax[2] < ccdm->bbmin[2]) ||
+ (aabbmin[0] > ccdm->bbmax[0]) ||
+ (aabbmin[1] > ccdm->bbmax[1]) ||
+ (aabbmin[2] > ccdm->bbmax[2]) )
+ {
/* boxes don't intersect */
BLI_ghashIterator_step(ihash);
continue;
@@ -1447,11 +1450,12 @@ static int sb_detect_edge_collisionCached(float edge_v1[3], float edge_v2[3], fl
a = ccdm->totface;
if ((aabbmax[0] < ccdm->bbmin[0]) ||
- (aabbmax[1] < ccdm->bbmin[1]) ||
- (aabbmax[2] < ccdm->bbmin[2]) ||
- (aabbmin[0] > ccdm->bbmax[0]) ||
- (aabbmin[1] > ccdm->bbmax[1]) ||
- (aabbmin[2] > ccdm->bbmax[2]) ) {
+ (aabbmax[1] < ccdm->bbmin[1]) ||
+ (aabbmax[2] < ccdm->bbmin[2]) ||
+ (aabbmin[0] > ccdm->bbmax[0]) ||
+ (aabbmin[1] > ccdm->bbmax[1]) ||
+ (aabbmin[2] > ccdm->bbmax[2]) )
+ {
/* boxes don't intersect */
BLI_ghashIterator_step(ihash);
continue;
@@ -1685,7 +1689,7 @@ static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,
else
sb_threads[i].ifirst = 0;
sb_threads[i].do_effector = do_effector;
- sb_threads[i].do_deflector = 0;// not used here
+ sb_threads[i].do_deflector = FALSE;// not used here
sb_threads[i].fieldfactor = 0.0f;// not used here
sb_threads[i].windfactor = 0.0f;// not used here
sb_threads[i].nr= i;
@@ -1785,14 +1789,15 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
maxz = ccdm->bbmax[2];
if ((opco[0] < minx) ||
- (opco[1] < miny) ||
- (opco[2] < minz) ||
- (opco[0] > maxx) ||
- (opco[1] > maxy) ||
- (opco[2] > maxz) ) {
- /* outside the padded boundbox --> collision object is too far away */
- BLI_ghashIterator_step(ihash);
- continue;
+ (opco[1] < miny) ||
+ (opco[2] < minz) ||
+ (opco[0] > maxx) ||
+ (opco[1] > maxy) ||
+ (opco[2] > maxz) )
+ {
+ /* outside the padded boundbox --> collision object is too far away */
+ BLI_ghashIterator_step(ihash);
+ continue;
}
}
else {
@@ -2228,7 +2233,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
attached = 0;
for (b=obp->nofsprings;b>0;b--) {
bs = sb->bspring + obp->springs[b-1];
- if (( ilast-bb == bs->v2) || ( ilast-bb == bs->v1)) {
+ if (( ilast-bb == bs->v2) || ( ilast-bb == bs->v1)) {
attached=1;
continue;}
}
@@ -2600,7 +2605,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
attached = 0;
for (b=obp->nofsprings;b>0;b--) {
bs = sb->bspring + obp->springs[b-1];
- if (( sb->totpoint-a == bs->v2) || ( sb->totpoint-a == bs->v1)) {
+ if (( sb->totpoint-a == bs->v2) || ( sb->totpoint-a == bs->v1)) {
attached=1;
continue;}
}
@@ -4078,7 +4083,8 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i
/* verify if we need to create the softbody data */
if (sb->bpoint == NULL ||
- ((ob->softflag & OB_SB_EDGES) && !ob->soft->bspring && object_has_edges(ob))) {
+ ((ob->softflag & OB_SB_EDGES) && !ob->soft->bspring && object_has_edges(ob)))
+ {
switch (ob->type) {
case OB_MESH:
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 127f5369ca5..8deee97f01a 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -610,7 +610,8 @@ static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm,
* other parts of code significantly to handle missing faces.
* since this really shouldn't even be possible we just bail.*/
if (ccgSubSurf_syncFace(ss, SET_INT_IN_POINTER(i), mp->totloop,
- fVerts, &f) == eCCGError_InvalidValue) {
+ fVerts, &f) == eCCGError_InvalidValue)
+ {
static int hasGivenError = 0;
if (!hasGivenError) {
@@ -1788,12 +1789,12 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
int gridFaces = gridSize - 1;
int edgeSize = ccgSubSurf_getEdgeSize(ss);
DMFlagMat *faceFlags = ccgdm->faceFlags;
- int a, b, i, doDraw, numVerts, matnr, new_matnr, totface;
+ int a, b, i, do_draw, numVerts, matnr, new_matnr, totface;
CCG_key_top_level(&key, ss);
ccgdm_pbvh_update(ccgdm);
- doDraw = 0;
+ do_draw = 0;
matnr = -1;
#define PASSATTRIB(dx, dy, vert) { \
@@ -1837,12 +1838,12 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
}
if (new_matnr != matnr) {
- doDraw = setMaterial(matnr = new_matnr, &gattribs);
- if (doDraw)
+ do_draw = setMaterial(matnr = new_matnr, &gattribs);
+ if (do_draw)
DM_vertex_attributes_from_gpu(dm, &gattribs, &attribs);
}
- if (!doDraw || (setDrawOptions && (origIndex != ORIGINDEX_NONE) &&
+ if (!do_draw || (setDrawOptions && (origIndex != ORIGINDEX_NONE) &&
(setDrawOptions(userData, origIndex) == DM_DRAW_OPTION_SKIP)))
{
a += gridFaces * gridFaces * numVerts;
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 7634528927a..7bfd4189cc3 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -912,7 +912,7 @@ void txt_move_left(Text *text, short sel)
void txt_move_right(Text *text, short sel)
{
TextLine **linep;
- int *charp, oundoing = undoing, do_tab = 0, i;
+ int *charp, oundoing = undoing, do_tab = FALSE, i;
if (!text) return;
if (sel) txt_curs_sel(text, &linep, &charp);
@@ -931,10 +931,10 @@ void txt_move_right(Text *text, short sel)
// do nice right only if there are only spaces
// spaces hardcoded in DNA_text_types.h
if (text->flags & TXT_TABSTOSPACES && (*linep)->line[*charp] == ' ') {
- do_tab = 1;
+ do_tab = TRUE;
for (i = 0; i < *charp; i++)
if ((*linep)->line[i] != ' ') {
- do_tab = 0;
+ do_tab = FALSE;
break;
}
}
@@ -1124,7 +1124,8 @@ static void txt_pop_first(Text *text)
{
if (txt_get_span(text->curl, text->sell) < 0 ||
- (text->curl == text->sell && text->curc > text->selc)) {
+ (text->curl == text->sell && text->curc > text->selc))
+ {
txt_curs_swap(text);
}
@@ -1140,7 +1141,8 @@ static void txt_pop_first(Text *text)
static void txt_pop_last(Text *text)
{
if (txt_get_span(text->curl, text->sell) > 0 ||
- (text->curl == text->sell && text->curc < text->selc)) {
+ (text->curl == text->sell && text->curc < text->selc))
+ {
txt_curs_swap(text);
}
@@ -3214,7 +3216,8 @@ short txt_clear_marker_region(Text *text, TextLine *line, int start, int end, in
else if (marker->lineno > lineno) break;
if ((marker->start == marker->end && start <= marker->start && marker->start <= end) ||
- (marker->start < end && marker->end > start)) {
+ (marker->start < end && marker->end > start))
+ {
BLI_freelinkN(&text->markers, marker);
cleared = 1;
}
@@ -3234,7 +3237,8 @@ short txt_clear_markers(Text *text, int group, int flags)
next = marker->next;
if ((!group || marker->group == group) &&
- (marker->flags & flags) == flags) {
+ (marker->flags & flags) == flags)
+ {
BLI_freelinkN(&text->markers, marker);
cleared = 1;
}
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 2c868ca2601..2ec42b47e5c 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -233,7 +233,8 @@ void init_tex_mapping(TexMapping *texmap)
float smat[3][3], rmat[3][3], mat[3][3], proj[3][3];
if (texmap->projx == PROJ_X && texmap->projy == PROJ_Y && texmap->projz == PROJ_Z &&
- is_zero_v3(texmap->loc) && is_zero_v3(texmap->rot) && is_one_v3(texmap->size)) {
+ is_zero_v3(texmap->loc) && is_zero_v3(texmap->rot) && is_one_v3(texmap->size))
+ {
unit_m4(texmap->mat);
texmap->flag |= TEXMAP_UNIT_MATRIX;
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 8339e973d43..b0745ebf1c8 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -2916,7 +2916,7 @@ ImBuf *BKE_tracking_distortion_exec(MovieDistortion *distortion, MovieTracking *
}
#endif
- ibuf->userflags |= IB_RECT_INVALID;
+ resibuf->userflags |= IB_RECT_INVALID;
}
else {
#ifdef WITH_LIBMV
diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index 03afc97f324..aa9cc40f71f 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -663,7 +663,7 @@ int bUnit_ReplaceString(char *str, int len_max, const char *str_prev, double sca
if (*ch == ' ' || *ch == '\t') {
/* do nothing */
}
- else if (ch_is_op(*ch) || *ch == ',') { /* found an op, no need to insert a ,*/
+ else if (ch_is_op(*ch) || *ch == ',') { /* found an op, no need to insert a ',' */
op_found = 1;
break;
}
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index a3fdb41fe37..91e93bbd05d 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -472,7 +472,8 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
c->time_base.num = 100;
}
else if ((double) ((int) rd->frs_sec_base) ==
- rd->frs_sec_base) {
+ rd->frs_sec_base)
+ {
c->time_base.den = rd->frs_sec;
c->time_base.num = (int) rd->frs_sec_base;
}
@@ -523,7 +524,7 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
if (codec_id == CODEC_ID_FFV1) {
#ifdef FFMPEG_FFV1_ALPHA_SUPPORTED
- if (rd->im_format.planes == R_IMF_PLANES_RGBA) {
+ if (rd->im_format.planes == R_IMF_PLANES_RGBA) {
c->pix_fmt = PIX_FMT_RGB32;
}
else {
@@ -535,7 +536,7 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
}
if (codec_id == CODEC_ID_QTRLE) {
- if (rd->im_format.planes == R_IMF_PLANES_RGBA) {
+ if (rd->im_format.planes == R_IMF_PLANES_RGBA) {
c->pix_fmt = PIX_FMT_ARGB;
}
}
@@ -544,7 +545,8 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
// || !strcmp(of->oformat->name, "mp4")
// || !strcmp(of->oformat->name, "mov")
// || !strcmp(of->oformat->name, "3gp")
- ) {
+ )
+ {
fprintf(stderr, "Using global header\n");
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
}
@@ -903,7 +905,8 @@ void BKE_ffmpeg_filepath_get(char *string, RenderData *rd)
while (*fe) {
if (BLI_strcasecmp(string + strlen(string) - strlen(*fe),
- *fe) == 0) {
+ *fe) == 0)
+ {
break;
}
fe++;
@@ -955,7 +958,8 @@ static void write_audio_frames(double to_pts)
while (audio_stream && !finished) {
if ((audio_time >= to_pts) ||
- (write_audio_frame())) {
+ (write_audio_frame()))
+ {
finished = 1;
}
}
@@ -1406,8 +1410,8 @@ void BKE_ffmpeg_image_type_verify(RenderData *rd, ImageFormatData *imf)
if (rd->ffcodecdata.type <= 0 ||
rd->ffcodecdata.codec <= 0 ||
rd->ffcodecdata.audio_codec <= 0 ||
- rd->ffcodecdata.video_bitrate <= 1) {
-
+ rd->ffcodecdata.video_bitrate <= 1)
+ {
rd->ffcodecdata.codec = CODEC_ID_MPEG2VIDEO;
BKE_ffmpeg_preset_set(rd, FFMPEG_PRESET_DVD);