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:
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf_intern.h2
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c12
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c36
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c8
-rw-r--r--source/blender/blenkernel/intern/action.c32
-rw-r--r--source/blender/blenkernel/intern/anim.c20
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c146
-rw-r--r--source/blender/blenkernel/intern/armature.c24
-rw-r--r--source/blender/blenkernel/intern/armature_update.c12
-rw-r--r--source/blender/blenkernel/intern/blender_undo.c6
-rw-r--r--source/blender/blenkernel/intern/blendfile.c63
-rw-r--r--source/blender/blenkernel/intern/bmfont.c2
-rw-r--r--source/blender/blenkernel/intern/boids.c4
-rw-r--r--source/blender/blenkernel/intern/brush.c6
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c22
-rw-r--r--source/blender/blenkernel/intern/cloth.c14
-rw-r--r--source/blender/blenkernel/intern/collision.c8
-rw-r--r--source/blender/blenkernel/intern/constraint.c96
-rw-r--r--source/blender/blenkernel/intern/context.c2
-rw-r--r--source/blender/blenkernel/intern/curve.c10
-rw-r--r--source/blender/blenkernel/intern/customdata.c2
-rw-r--r--source/blender/blenkernel/intern/data_transfer.c2
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c264
-rw-r--r--source/blender/blenkernel/intern/editderivedmesh.c2
-rw-r--r--source/blender/blenkernel/intern/effect.c394
-rw-r--r--source/blender/blenkernel/intern/fcurve.c64
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c60
-rw-r--r--source/blender/blenkernel/intern/font.c4
-rw-r--r--source/blender/blenkernel/intern/gpencil.c4
-rw-r--r--source/blender/blenkernel/intern/icons.c18
-rw-r--r--source/blender/blenkernel/intern/image.c20
-rw-r--r--source/blender/blenkernel/intern/ipo.c60
-rw-r--r--source/blender/blenkernel/intern/lamp.c13
-rw-r--r--source/blender/blenkernel/intern/library.c2
-rw-r--r--source/blender/blenkernel/intern/library_remap.c2
-rw-r--r--source/blender/blenkernel/intern/mask_rasterize.c6
-rw-r--r--source/blender/blenkernel/intern/material.c17
-rw-r--r--source/blender/blenkernel/intern/mball_tessellate.c22
-rw-r--r--source/blender/blenkernel/intern/mesh.c12
-rw-r--r--source/blender/blenkernel/intern/mesh_convert.c6
-rw-r--r--source/blender/blenkernel/intern/mesh_evaluate.c16
-rw-r--r--source/blender/blenkernel/intern/mesh_mapping.c2
-rw-r--r--source/blender/blenkernel/intern/mesh_remap.c20
-rw-r--r--source/blender/blenkernel/intern/mesh_validate.c18
-rw-r--r--source/blender/blenkernel/intern/modifier.c4
-rw-r--r--source/blender/blenkernel/intern/modifiers_bmesh.c2
-rw-r--r--source/blender/blenkernel/intern/nla.c118
-rw-r--r--source/blender/blenkernel/intern/node.c2
-rw-r--r--source/blender/blenkernel/intern/object.c14
-rw-r--r--source/blender/blenkernel/intern/object_deform.c2
-rw-r--r--source/blender/blenkernel/intern/object_dupli.c8
-rw-r--r--source/blender/blenkernel/intern/packedFile.c4
-rw-r--r--source/blender/blenkernel/intern/paint.c64
-rw-r--r--source/blender/blenkernel/intern/particle.c2
-rw-r--r--source/blender/blenkernel/intern/particle_system.c16
-rw-r--r--source/blender/blenkernel/intern/pbvh.c16
-rw-r--r--source/blender/blenkernel/intern/pointcache.c2
-rw-r--r--source/blender/blenkernel/intern/report.c2
-rw-r--r--source/blender/blenkernel/intern/rigidbody.c48
-rw-r--r--source/blender/blenkernel/intern/scene.c12
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c14
-rw-r--r--source/blender/blenkernel/intern/sequencer.c6
-rw-r--r--source/blender/blenkernel/intern/shrinkwrap.c6
-rw-r--r--source/blender/blenkernel/intern/smoke.c18
-rw-r--r--source/blender/blenkernel/intern/softbody.c24
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c98
-rw-r--r--source/blender/blenkernel/intern/suggestions.c4
-rw-r--r--source/blender/blenkernel/intern/text.c10
-rw-r--r--source/blender/blenkernel/intern/texture.c13
-rw-r--r--source/blender/blenkernel/intern/tracking.c6
-rw-r--r--source/blender/blenkernel/intern/tracking_region_tracker.c2
-rw-r--r--source/blender/blenkernel/intern/tracking_stabilize.c2
-rw-r--r--source/blender/blenkernel/intern/tracking_util.c22
-rw-r--r--source/blender/blenkernel/intern/unit.c4
-rw-r--r--source/blender/blenkernel/intern/world.c13
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c20
76 files changed, 1112 insertions, 1021 deletions
diff --git a/source/blender/blenkernel/intern/CCGSubSurf_intern.h b/source/blender/blenkernel/intern/CCGSubSurf_intern.h
index 9df1c9021ef..50959d21425 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf_intern.h
+++ b/source/blender/blenkernel/intern/CCGSubSurf_intern.h
@@ -229,7 +229,7 @@ struct CCGSubSurf {
*/
bool osd_coarse_coords_invalid;
- /* GL mesh descriptor, used for refinment and draw. */
+ /* GL mesh descriptor, used for refinement and draw. */
struct OpenSubdiv_GLMesh *osd_mesh;
/* Refiner which is used to create GL mesh.
*
diff --git a/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c b/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c
index f568bb94ac5..65c6518cee4 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c
@@ -75,7 +75,7 @@ static bool compare_ccg_derivedmesh_topology(CCGSubSurf *ss, DerivedMesh *dm)
ccgFaceIterator_next(&ccg_face_iter))
{
/*const*/ CCGFace *ccg_face = ccgFaceIterator_getCurrent(&ccg_face_iter);
- const int poly_index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ccg_face));
+ const int poly_index = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(ccg_face));
const MPoly *mp = &mpoly[poly_index];
int corner;
if (ccg_face->numVerts != mp->totloop) {
@@ -83,7 +83,7 @@ static bool compare_ccg_derivedmesh_topology(CCGSubSurf *ss, DerivedMesh *dm)
}
for (corner = 0; corner < ccg_face->numVerts; corner++) {
/*const*/ CCGVert *ccg_vert = FACE_getVerts(ccg_face)[corner];
- const int vert_index = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ccg_vert));
+ const int vert_index = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(ccg_vert));
if (vert_index != mloop[mp->loopstart + corner].v) {
return false;
}
@@ -101,9 +101,9 @@ static bool compare_ccg_derivedmesh_topology(CCGSubSurf *ss, DerivedMesh *dm)
/* const */ CCGEdge *ccg_edge = ccgEdgeIterator_getCurrent(&ccg_edge_iter);
/* const */ CCGVert *ccg_vert1 = ccg_edge->v0;
/* const */ CCGVert *ccg_vert2 = ccg_edge->v1;
- const int ccg_vert1_index = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ccg_vert1));
- const int ccg_vert2_index = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ccg_vert2));
- const int edge_index = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(ccg_edge));
+ const int ccg_vert1_index = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(ccg_vert1));
+ const int ccg_vert2_index = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(ccg_vert2));
+ const int edge_index = POINTER_AS_INT(ccgSubSurf_getEdgeEdgeHandle(ccg_edge));
const MEdge *me = &medge[edge_index];
if (me->v1 != ccg_vert1_index || me->v2 != ccg_vert2_index) {
return false;
@@ -119,7 +119,7 @@ static bool compare_ccg_derivedmesh_topology(CCGSubSurf *ss, DerivedMesh *dm)
ccgEdgeIterator_next(&ccg_edge_iter))
{
/* const */ CCGEdge *ccg_edge = ccgEdgeIterator_getCurrent(&ccg_edge_iter);
- const int edge_index = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(ccg_edge));
+ const int edge_index = POINTER_AS_INT(ccgSubSurf_getEdgeEdgeHandle(ccg_edge));
if (ccg_edge->crease != medge[edge_index].crease) {
return false;
}
diff --git a/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c b/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c
index 8c1ba0c3782..d6b15148ed1 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c
@@ -562,7 +562,7 @@ static int conv_ccg_get_num_face_verts(const OpenSubdiv_Converter *converter,
int face)
{
CCGSubSurf *ss = converter->user_data;
- CCGFace *ccg_face = ccgSubSurf_getFace(ss, SET_INT_IN_POINTER(face));
+ CCGFace *ccg_face = ccgSubSurf_getFace(ss, POINTER_FROM_INT(face));
return ccgSubSurf_getFaceNumVerts(ccg_face);
}
@@ -571,12 +571,12 @@ static void conv_ccg_get_face_verts(const OpenSubdiv_Converter *converter,
int *face_verts)
{
CCGSubSurf *ss = converter->user_data;
- CCGFace *ccg_face = ccgSubSurf_getFace(ss, SET_INT_IN_POINTER(face));
+ CCGFace *ccg_face = ccgSubSurf_getFace(ss, POINTER_FROM_INT(face));
int num_face_verts = ccgSubSurf_getFaceNumVerts(ccg_face);
int loop;
for (loop = 0; loop < num_face_verts; loop++) {
CCGVert *ccg_vert = ccgSubSurf_getFaceVert(ccg_face, loop);
- face_verts[loop] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ccg_vert));
+ face_verts[loop] = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(ccg_vert));
}
}
@@ -585,12 +585,12 @@ static void conv_ccg_get_face_edges(const OpenSubdiv_Converter *converter,
int *face_edges)
{
CCGSubSurf *ss = converter->user_data;
- CCGFace *ccg_face = ccgSubSurf_getFace(ss, SET_INT_IN_POINTER(face));
+ CCGFace *ccg_face = ccgSubSurf_getFace(ss, POINTER_FROM_INT(face));
int num_face_verts = ccgSubSurf_getFaceNumVerts(ccg_face);
int loop;
for (loop = 0; loop < num_face_verts; loop++) {
CCGEdge *ccg_edge = ccgSubSurf_getFaceEdge(ccg_face, loop);
- face_edges[loop] = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(ccg_edge));
+ face_edges[loop] = POINTER_AS_INT(ccgSubSurf_getEdgeEdgeHandle(ccg_edge));
}
}
@@ -599,18 +599,18 @@ static void conv_ccg_get_edge_verts(const OpenSubdiv_Converter *converter,
int *edge_verts)
{
CCGSubSurf *ss = converter->user_data;
- CCGEdge *ccg_edge = ccgSubSurf_getEdge(ss, SET_INT_IN_POINTER(edge));
+ CCGEdge *ccg_edge = ccgSubSurf_getEdge(ss, POINTER_FROM_INT(edge));
CCGVert *ccg_vert0 = ccgSubSurf_getEdgeVert0(ccg_edge);
CCGVert *ccg_vert1 = ccgSubSurf_getEdgeVert1(ccg_edge);
- edge_verts[0] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ccg_vert0));
- edge_verts[1] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ccg_vert1));
+ edge_verts[0] = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(ccg_vert0));
+ edge_verts[1] = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(ccg_vert1));
}
static int conv_ccg_get_num_edge_faces(const OpenSubdiv_Converter *converter,
int edge)
{
CCGSubSurf *ss = converter->user_data;
- CCGEdge *ccg_edge = ccgSubSurf_getEdge(ss, SET_INT_IN_POINTER(edge));
+ CCGEdge *ccg_edge = ccgSubSurf_getEdge(ss, POINTER_FROM_INT(edge));
return ccgSubSurf_getEdgeNumFaces(ccg_edge);
}
@@ -619,12 +619,12 @@ static void conv_ccg_get_edge_faces(const OpenSubdiv_Converter *converter,
int *edge_faces)
{
CCGSubSurf *ss = converter->user_data;
- CCGEdge *ccg_edge = ccgSubSurf_getEdge(ss, SET_INT_IN_POINTER(edge));
+ CCGEdge *ccg_edge = ccgSubSurf_getEdge(ss, POINTER_FROM_INT(edge));
int num_edge_faces = ccgSubSurf_getEdgeNumFaces(ccg_edge);
int face;
for (face = 0; face < num_edge_faces; face++) {
CCGFace *ccg_face = ccgSubSurf_getEdgeFace(ccg_edge, face);
- edge_faces[face] = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ccg_face));
+ edge_faces[face] = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(ccg_face));
}
}
@@ -632,7 +632,7 @@ static float conv_ccg_get_edge_sharpness(const OpenSubdiv_Converter *converter,
int edge)
{
CCGSubSurf *ss = converter->user_data;
- CCGEdge *ccg_edge = ccgSubSurf_getEdge(ss, SET_INT_IN_POINTER(edge));
+ CCGEdge *ccg_edge = ccgSubSurf_getEdge(ss, POINTER_FROM_INT(edge));
/* TODO(sergey): Multiply by subdivision level once CPU evaluator
* is switched to uniform subdivision type.
*/
@@ -643,7 +643,7 @@ static int conv_ccg_get_num_vert_edges(const OpenSubdiv_Converter *converter,
int vert)
{
CCGSubSurf *ss = converter->user_data;
- CCGVert *ccg_vert = ccgSubSurf_getVert(ss, SET_INT_IN_POINTER(vert));
+ CCGVert *ccg_vert = ccgSubSurf_getVert(ss, POINTER_FROM_INT(vert));
return ccgSubSurf_getVertNumEdges(ccg_vert);
}
@@ -652,12 +652,12 @@ static void conv_ccg_get_vert_edges(const OpenSubdiv_Converter *converter,
int *vert_edges)
{
CCGSubSurf *ss = converter->user_data;
- CCGVert *ccg_vert = ccgSubSurf_getVert(ss, SET_INT_IN_POINTER(vert));
+ CCGVert *ccg_vert = ccgSubSurf_getVert(ss, POINTER_FROM_INT(vert));
int num_vert_edges = ccgSubSurf_getVertNumEdges(ccg_vert);
int edge;
for (edge = 0; edge < num_vert_edges; edge++) {
CCGEdge *ccg_edge = ccgSubSurf_getVertEdge(ccg_vert, edge);
- vert_edges[edge] = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(ccg_edge));
+ vert_edges[edge] = POINTER_AS_INT(ccgSubSurf_getEdgeEdgeHandle(ccg_edge));
}
}
@@ -665,7 +665,7 @@ static int conv_ccg_get_num_vert_faces(const OpenSubdiv_Converter *converter,
int vert)
{
CCGSubSurf *ss = converter->user_data;
- CCGVert *ccg_vert = ccgSubSurf_getVert(ss, SET_INT_IN_POINTER(vert));
+ CCGVert *ccg_vert = ccgSubSurf_getVert(ss, POINTER_FROM_INT(vert));
return ccgSubSurf_getVertNumFaces(ccg_vert);
}
@@ -674,12 +674,12 @@ static void conv_ccg_get_vert_faces(const OpenSubdiv_Converter *converter,
int *vert_faces)
{
CCGSubSurf *ss = converter->user_data;
- CCGVert *ccg_vert = ccgSubSurf_getVert(ss, SET_INT_IN_POINTER(vert));
+ CCGVert *ccg_vert = ccgSubSurf_getVert(ss, POINTER_FROM_INT(vert));
int num_vert_faces = ccgSubSurf_getVertNumFaces(ccg_vert);
int face;
for (face = 0; face < num_vert_faces; face++) {
CCGFace *ccg_face = ccgSubSurf_getVertFace(ccg_vert, face);
- vert_faces[face] = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ccg_face));
+ vert_faces[face] = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(ccg_face));
}
}
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 9c0fc79a358..e099ceaea53 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -561,7 +561,7 @@ void DM_update_tessface_data(DerivedMesh *dm)
int *polyindex = CustomData_get_layer(fdata, CD_ORIGINDEX);
unsigned int (*loopindex)[4];
- /* Should never occure, but better abort than segfault! */
+ /* Should never occur, but better abort than segfault! */
if (!polyindex)
return;
@@ -624,7 +624,7 @@ void DM_generate_tangent_tessface_data(DerivedMesh *dm, bool generate)
int *polyindex = CustomData_get_layer(fdata, CD_ORIGINDEX);
unsigned int (*loopindex)[4] = NULL;
- /* Should never occure, but better abort than segfault! */
+ /* Should never occur, but better abort than segfault! */
if (!polyindex)
return;
@@ -4182,7 +4182,7 @@ void DM_init_origspace(DerivedMesh *dm)
scale[1] = 1e-9f;
invert_v2(scale);
- /* Finally, transform all vcos_2d into ((0, 0), (1, 1)) square and assing them as origspace. */
+ /* Finally, transform all vcos_2d into ((0, 0), (1, 1)) square and assign them as origspace. */
for (j = 0; j < mp->totloop; j++, lof++) {
add_v2_v2v2(lof->uv, vcos_2d[j], translate);
mul_v2_v2(lof->uv, scale);
@@ -4210,7 +4210,7 @@ static void dm_debug_info_layers(
for (type = 0; type < CD_NUMTYPES; type++) {
if (CustomData_has_layer(cd, type)) {
- /* note: doesnt account for multiple layers */
+ /* note: doesn't account for multiple layers */
const char *name = CustomData_layertype_name(type);
const int size = CustomData_sizeof(type);
const void *pt = getElemDataArray(dm, type);
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index e6848876425..7612e9a3fdb 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -19,7 +19,7 @@
* All rights reserved.
*
* Contributor(s): Full recode, Ton Roosendaal, Crete 2005
- * Full recode, Joshua Leung, 2009
+ * Full recode, Joshua Leung, 2009
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -198,7 +198,7 @@ void set_active_action_group(bAction *act, bActionGroup *agrp, short select)
if (act == NULL)
return;
- /* Deactive all others */
+ /* Deactivate all others */
for (grp = act->groups.first; grp; grp = grp->next) {
if ((grp == agrp) && (select))
grp->flag |= AGRP_ACTIVE;
@@ -263,8 +263,8 @@ bActionGroup *action_groups_add_new(bAction *act, const char name[])
}
/* Add given channel into (active) group
- * - assumes that channel is not linked to anything anymore
- * - always adds at the end of the group
+ * - assumes that channel is not linked to anything anymore
+ * - always adds at the end of the group
*/
void action_groups_add_channel(bAction *act, bActionGroup *agrp, FCurve *fcurve)
{
@@ -309,8 +309,8 @@ void action_groups_add_channel(bAction *act, bActionGroup *agrp, FCurve *fcurve)
for (grp = agrp->prev; grp; grp = grp->prev) {
/* if this group has F-Curves, we want weave the given one in right after the last channel there,
* but via the Action's list not this group's list
- * - this is so that the F-Curve is in the right place in the Action,
- * but won't be included in the previous group
+ * - this is so that the F-Curve is in the right place in the Action,
+ * but won't be included in the previous group
*/
if (grp->channels.last) {
/* once we've added, break here since we don't need to search any further... */
@@ -1063,8 +1063,8 @@ void BKE_pose_remove_group(bPose *pose, bActionGroup *grp, const int index)
BLI_assert(idx > 0);
/* adjust group references (the trouble of using indices!):
- * - firstly, make sure nothing references it
- * - also, make sure that those after this item get corrected
+ * - firstly, make sure nothing references it
+ * - also, make sure that those after this item get corrected
*/
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
if (pchan->agrp_index == idx)
@@ -1147,7 +1147,7 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
}
/* if incl_modifiers is enabled, need to consider modifiers too
- * - only really care about the last modifier
+ * - only really care about the last modifier
*/
if ((incl_modifiers) && (fcu->modifiers.last)) {
FModifier *fcm = fcu->modifiers.last;
@@ -1203,7 +1203,7 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
}
/* Return flags indicating which transforms the given object/posechannel has
- * - if 'curves' is provided, a list of links to these curves are also returned
+ * - if 'curves' is provided, a list of links to these curves are also returned
*/
short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan, ListBase *curves)
{
@@ -1226,7 +1226,7 @@ short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan,
return 0;
/* search F-Curves for the given properties
- * - we cannot use the groups, since they may not be grouped in that way...
+ * - we cannot use the groups, since they may not be grouped in that way...
*/
for (fcu = act->curves.first; fcu; fcu = fcu->next) {
const char *bPtr = NULL, *pPtr = NULL;
@@ -1249,11 +1249,11 @@ short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan,
bPtr += strlen(basePath);
/* step 2: check for some property with transforms
- * - to speed things up, only check for the ones not yet found
- * unless we're getting the curves too
- * - if we're getting the curves, the BLI_genericNodeN() creates a LinkData
- * node wrapping the F-Curve, which then gets added to the list
- * - once a match has been found, the curve cannot possibly be any other one
+ * - to speed things up, only check for the ones not yet found
+ * unless we're getting the curves too
+ * - if we're getting the curves, the BLI_genericNodeN() creates a LinkData
+ * node wrapping the F-Curve, which then gets added to the list
+ * - once a match has been found, the curve cannot possibly be any other one
*/
if ((curves) || (flags & ACT_TRANS_LOC) == 0) {
pPtr = strstr(bPtr, "location");
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index b3c6fb4f3a9..d5f269b82a8 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -235,7 +235,7 @@ typedef struct MPathTarget {
/* ........ */
/* get list of motion paths to be baked for the given object
- * - assumes the given list is ready to be used
+ * - assumes the given list is ready to be used
*/
/* TODO: it would be nice in future to be able to update objects dependent on these bones too? */
void animviz_get_object_motionpaths(Object *ob, ListBase *targets)
@@ -349,9 +349,9 @@ static void motionpaths_calc_update_scene(Main *bmain, Scene *scene)
}
#else // original, 'always correct' version
/* do all updates
- * - if this is too slow, resort to using a more efficient way
- * that doesn't force complete update, but for now, this is the
- * most accurate way!
+ * - if this is too slow, resort to using a more efficient way
+ * that doesn't force complete update, but for now, this is the
+ * most accurate way!
*/
BKE_scene_update_for_newframe(bmain->eval_ctx, bmain, scene, scene->lay); /* XXX this is the best way we can get anything moving */
#endif
@@ -370,7 +370,7 @@ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets)
bMotionPathVert *mpv;
/* current frame must be within the range the cache works for
- * - is inclusive of the first frame, but not the last otherwise we get buffer overruns
+ * - is inclusive of the first frame, but not the last otherwise we get buffer overruns
*/
if ((CFRA < mpath->start_frame) || (CFRA >= mpath->end_frame))
continue;
@@ -399,9 +399,9 @@ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets)
}
/* Perform baking of the given object's and/or its bones' transforms to motion paths
- * - scene: current scene
- * - ob: object whose flagged motionpaths should get calculated
- * - recalc: whether we need to
+ * - scene: current scene
+ * - ob: object whose flagged motionpaths should get calculated
+ * - recalc: whether we need to
*/
/* TODO: include reports pointer? */
void animviz_calc_motionpaths(Main *bmain, Scene *scene, ListBase *targets)
@@ -474,7 +474,7 @@ void free_path(Path *path)
}
/* calculate a curve-deform path for a curve
- * - only called from displist.c -> do_makeDispListCurveTypes
+ * - only called from displist.c -> do_makeDispListCurveTypes
*/
void calc_curvepath(Object *ob, ListBase *nurbs)
{
@@ -643,7 +643,7 @@ int where_on_path(Object *ob, float ctime, float vec[4], float dir[3], float qua
s1 = (int)floor(ctime);
fac = (float)(s1 + 1) - ctime;
- /* path->len is corected for cyclic */
+ /* path->len is corrected for cyclic */
s0 = interval_test(0, path->len - 1 - cycl, s1 - 1, cycl);
s1 = interval_test(0, path->len - 1 - cycl, s1, cycl);
s2 = interval_test(0, path->len - 1 - cycl, s1 + 1, cycl);
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 05cb10ab7a4..b17bc70c51a 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -422,8 +422,8 @@ static bool animpath_matches_basepath(const char path[], const char basepath[])
/* Move F-Curves in src action to dst action, setting up all the necessary groups
* for this to happen, but only if the F-Curves being moved have the appropriate
* "base path".
- * - This is used when data moves from one datablock to another, causing the
- * F-Curves to need to be moved over too
+ * - This is used when data moves from one datablock to another, causing the
+ * F-Curves to need to be moved over too
*/
void action_move_fcurves_by_basepath(bAction *srcAct, bAction *dstAct, const char basepath[])
{
@@ -449,7 +449,7 @@ void action_move_fcurves_by_basepath(bAction *srcAct, bAction *dstAct, const cha
fcn = fcu->next;
/* should F-Curve be moved over?
- * - we only need the start of the path to match basepath
+ * - we only need the start of the path to match basepath
*/
if (animpath_matches_basepath(fcu->rna_path, basepath)) {
bActionGroup *agrp = NULL;
@@ -1188,8 +1188,8 @@ void BKE_animdata_fix_paths_rename_all(ID *ref_id, const char *prefix, const cha
ID *id;
/* macro for less typing
- * - whether animdata exists is checked for by the main renaming callback, though taking
- * this outside of the function may make things slightly faster?
+ * - whether animdata exists is checked for by the main renaming callback, though taking
+ * this outside of the function may make things slightly faster?
*/
#define RENAMEFIX_ANIM_IDS(first) \
for (id = first; id; id = id->next) { \
@@ -1465,7 +1465,7 @@ void BKE_keyingsets_free(ListBase *list)
return;
/* loop over KeyingSets freeing them
- * - BKE_keyingset_free() doesn't free the set itself, but it frees its sub-data
+ * - BKE_keyingset_free() doesn't free the set itself, but it frees its sub-data
*/
for (ks = list->first; ks; ks = ksn) {
ksn = ks->next;
@@ -1481,9 +1481,9 @@ void BKE_keyingsets_free(ListBase *list)
* It returns whether the string needs to be freed (i.e. if it was a temp remapped one)
* // FIXME: maybe it would be faster if we didn't have to alloc/free strings like this all the time, but for now it's safer
*
- * - remap: remapping table to use
- * - path: original path string (as stored in F-Curve data)
- * - dst: destination string to write data to
+ * - remap: remapping table to use
+ * - path: original path string (as stored in F-Curve data)
+ * - dst: destination string to write data to
*/
static bool animsys_remap_path(AnimMapper *UNUSED(remap), char *path, char **dst)
{
@@ -1781,8 +1781,8 @@ static void action_idcode_patch_check(ID *id, bAction *act)
/* the actual checks... hopefully not too much of a performance hit in the long run... */
if (act->idroot == 0) {
/* use the current root if not set already (i.e. newly created actions and actions from 2.50-2.57 builds)
- * - this has problems if there are 2 users, and the first one encountered is the invalid one
- * in which case, the user will need to manually fix this (?)
+ * - this has problems if there are 2 users, and the first one encountered is the invalid one
+ * in which case, the user will need to manually fix this (?)
*/
act->idroot = idcode;
}
@@ -1878,8 +1878,8 @@ static void nlastrip_evaluate_controls(NlaStrip *strip, float ctime)
}
/* analytically generate values for influence and time (if applicable)
- * - we do this after the F-Curves have been evaluated to override the effects of those
- * in case the override has been turned off.
+ * - we do this after the F-Curves have been evaluated to override the effects of those
+ * in case the override has been turned off.
*/
if ((strip->flag & NLASTRIP_FLAG_USR_TIME) == 0)
strip->strip_time = nlastrip_get_frame(strip, ctime, NLATIME_CONVERT_EVAL);
@@ -1925,8 +1925,8 @@ NlaEvalStrip *nlastrips_ctime_get_strip(ListBase *list, ListBase *strips, short
else {
/* before next strip - previous strip has ended, but next hasn't begun,
* so blending mode depends on whether strip is being held or not...
- * - only occurs when no transition strip added, otherwise the transition would have
- * been picked up above...
+ * - only occurs when no transition strip added, otherwise the transition would have
+ * been picked up above...
*/
strip = strip->prev;
@@ -1953,7 +1953,7 @@ NlaEvalStrip *nlastrips_ctime_get_strip(ListBase *list, ListBase *strips, short
}
/* check if a valid strip was found
- * - must not be muted (i.e. will have contribution
+ * - must not be muted (i.e. will have contribution
*/
if ((estrip == NULL) || (estrip->flag & NLASTRIP_FLAG_MUTED))
return NULL;
@@ -1969,8 +1969,8 @@ NlaEvalStrip *nlastrips_ctime_get_strip(ListBase *list, ListBase *strips, short
}
/* evaluate strip's evaluation controls
- * - skip if no influence (i.e. same effect as muting the strip)
- * - negative influence is not supported yet... how would that be defined?
+ * - skip if no influence (i.e. same effect as muting the strip)
+ * - negative influence is not supported yet... how would that be defined?
*/
/* TODO: this sounds a bit hacky having a few isolated F-Curves stuck on some data it operates on... */
nlastrip_evaluate_controls(estrip, ctime);
@@ -2014,7 +2014,7 @@ NlaEvalStrip *nlastrips_ctime_get_strip(ListBase *list, ListBase *strips, short
/* ---------------------- */
/* find an NlaEvalChannel that matches the given criteria
- * - ptr and prop are the RNA data to find a match for
+ * - ptr and prop are the RNA data to find a match for
*/
static NlaEvalChannel *nlaevalchan_find_match(ListBase *channels, PointerRNA *ptr, PropertyRNA *prop, int array_index)
{
@@ -2029,7 +2029,7 @@ static NlaEvalChannel *nlaevalchan_find_match(ListBase *channels, PointerRNA *pt
/* - comparing the PointerRNA's is done by comparing the pointers
* to the actual struct the property resides in, since that all the
* other data stored in PointerRNA cannot allow us to definitively
- * identify the data
+ * identify the data
*/
if ((nec->ptr.data == ptr->data) && (nec->prop == prop) && (nec->index == array_index))
return nec;
@@ -2176,8 +2176,8 @@ static void nlaevalchan_accumulate(NlaEvalChannel *nec, NlaEvalStrip *nes, float
case NLASTRIP_MODE_REPLACE:
default: /* TODO: do we really want to blend by default? it seems more uses might prefer add... */
/* do linear interpolation
- * - the influence of the accumulated data (elsewhere, that is called dstweight)
- * is 1 - influence, since the strip's influence is srcweight
+ * - the influence of the accumulated data (elsewhere, that is called dstweight)
+ * is 1 - influence, since the strip's influence is srcweight
*/
nec->value = nec->value * (1.0f - inf) + (value * inf);
break;
@@ -2238,7 +2238,7 @@ static void nlaeval_fmodifiers_join_stacks(ListBase *result, ListBase *list1, Li
}
else {
/* list1 should be added first, and list2 second, with the endpoints of these being the endpoints for result
- * - the original lists must be left unchanged though, as we need that fact for restoring
+ * - the original lists must be left unchanged though, as we need that fact for restoring
*/
result->first = list1->first;
result->last = list2->last;
@@ -2350,11 +2350,11 @@ static void nlastrip_evaluate_transition(PointerRNA *ptr, ListBase *channels, Li
nlaeval_fmodifiers_join_stacks(&tmp_modifiers, &nes->strip->modifiers, modifiers);
/* get the two strips to operate on
- * - we use the endpoints of the strips directly flanking our strip
- * using these as the endpoints of the transition (destination and source)
- * - these should have already been determined to be valid...
- * - if this strip is being played in reverse, we need to swap these endpoints
- * otherwise they will be interpolated wrong
+ * - we use the endpoints of the strips directly flanking our strip
+ * using these as the endpoints of the transition (destination and source)
+ * - these should have already been determined to be valid...
+ * - if this strip is being played in reverse, we need to swap these endpoints
+ * otherwise they will be interpolated wrong
*/
if (nes->strip->flag & NLASTRIP_FLAG_REVERSE) {
s1 = nes->strip->next;
@@ -2366,11 +2366,11 @@ static void nlastrip_evaluate_transition(PointerRNA *ptr, ListBase *channels, Li
}
/* prepare template for 'evaluation strip'
- * - based on the transition strip's evaluation strip data
- * - strip_mode is NES_TIME_TRANSITION_* based on which endpoint
- * - strip_time is the 'normalized' (i.e. in-strip) time for evaluation,
- * which doubles up as an additional weighting factor for the strip influences
- * which allows us to appear to be 'interpolating' between the two extremes
+ * - based on the transition strip's evaluation strip data
+ * - strip_mode is NES_TIME_TRANSITION_* based on which endpoint
+ * - strip_time is the 'normalized' (i.e. in-strip) time for evaluation,
+ * which doubles up as an additional weighting factor for the strip influences
+ * which allows us to appear to be 'interpolating' between the two extremes
*/
tmp_nes = *nes;
@@ -2551,7 +2551,7 @@ static void animsys_evaluate_nla(ListBase *echannels, PointerRNA *ptr, AnimData
}
/* if this track has strips (but maybe they won't be suitable), set has_strips
- * - used for mainly for still allowing normal action evaluation...
+ * - used for mainly for still allowing normal action evaluation...
*/
if (nlt->strips.first)
has_strips = true;
@@ -2562,9 +2562,9 @@ static void animsys_evaluate_nla(ListBase *echannels, PointerRNA *ptr, AnimData
}
/* add 'active' Action (may be tweaking track) as last strip to evaluate in NLA stack
- * - only do this if we're not exclusively evaluating the 'solo' NLA-track
- * - however, if the 'solo' track houses the current 'tweaking' strip,
- * then we should allow this to play, otherwise nothing happens
+ * - only do this if we're not exclusively evaluating the 'solo' NLA-track
+ * - however, if the 'solo' track houses the current 'tweaking' strip,
+ * then we should allow this to play, otherwise nothing happens
*/
if ((adt->action) && ((adt->flag & ADT_NLA_SOLO_TRACK) == 0 || (adt->flag & ADT_NLA_EDIT_ON))) {
/* if there are strips, evaluate action as per NLA rules */
@@ -2636,8 +2636,8 @@ static void animsys_evaluate_nla(ListBase *echannels, PointerRNA *ptr, AnimData
}
/* NLA Evaluation function (mostly for use through do_animdata)
- * - All channels that will be affected are not cleared anymore. Instead, we just evaluate into
- * some temp channels, where values can be accumulated in one go.
+ * - All channels that will be affected are not cleared anymore. Instead, we just evaluate into
+ * some temp channels, where values can be accumulated in one go.
*/
static void animsys_calculate_nla(PointerRNA *ptr, AnimData *adt, float ctime)
{
@@ -2690,34 +2690,34 @@ static void animsys_evaluate_overrides(PointerRNA *ptr, AnimData *adt)
/* Evaluation System - Public API */
/* Overview of how this system works:
- * 1) Depsgraph sorts data as necessary, so that data is in an order that means
- * that all dependencies are resolved before dependents.
- * 2) All normal animation is evaluated, so that drivers have some basis values to
- * work with
- * a. NLA stacks are done first, as the Active Actions act as 'tweaking' tracks
- * which modify the effects of the NLA-stacks
- * b. Active Action is evaluated as per normal, on top of the results of the NLA tracks
+ * 1) Depsgraph sorts data as necessary, so that data is in an order that means
+ * that all dependencies are resolved before dependents.
+ * 2) All normal animation is evaluated, so that drivers have some basis values to
+ * work with
+ * a. NLA stacks are done first, as the Active Actions act as 'tweaking' tracks
+ * which modify the effects of the NLA-stacks
+ * b. Active Action is evaluated as per normal, on top of the results of the NLA tracks
*
* --------------< often in a separate phase... >------------------
*
- * 3) Drivers/expressions are evaluated on top of this, in an order where dependencies are
- * resolved nicely.
- * Note: it may be necessary to have some tools to handle the cases where some higher-level
- * drivers are added and cause some problematic dependencies that didn't exist in the local levels...
+ * 3) Drivers/expressions are evaluated on top of this, in an order where dependencies are
+ * resolved nicely.
+ * Note: it may be necessary to have some tools to handle the cases where some higher-level
+ * drivers are added and cause some problematic dependencies that didn't exist in the local levels...
*
* --------------< always executed >------------------
*
* Maintenance of editability of settings (XXX):
- * In order to ensure that settings that are animated can still be manipulated in the UI without requiring
- * that keyframes are added to prevent these values from being overwritten, we use 'overrides'.
+ * In order to ensure that settings that are animated can still be manipulated in the UI without requiring
+ * that keyframes are added to prevent these values from being overwritten, we use 'overrides'.
*
* Unresolved things:
- * - Handling of multi-user settings (i.e. time-offset, group-instancing) -> big cache grids or nodal system? but stored where?
- * - Multiple-block dependencies (i.e. drivers for settings are in both local and higher levels) -> split into separate lists?
+ * - Handling of multi-user settings (i.e. time-offset, group-instancing) -> big cache grids or nodal system? but stored where?
+ * - Multiple-block dependencies (i.e. drivers for settings are in both local and higher levels) -> split into separate lists?
*
* Current Status:
- * - Currently (as of September 2009), overrides we haven't needed to (fully) implement overrides.
- * However, the code for this is relatively harmless, so is left in the code for now.
+ * - Currently (as of September 2009), overrides we haven't needed to (fully) implement overrides.
+ * However, the code for this is relatively harmless, so is left in the code for now.
*/
/* Evaluation loop for evaluation animation data
@@ -2738,15 +2738,15 @@ void BKE_animsys_evaluate_animdata(Scene *scene, ID *id, AnimData *adt, float ct
RNA_id_pointer_create(id, &id_ptr);
/* recalculate keyframe data:
- * - NLA before Active Action, as Active Action behaves as 'tweaking track'
- * that overrides 'rough' work in NLA
+ * - NLA before Active Action, as Active Action behaves as 'tweaking track'
+ * that overrides 'rough' work in NLA
*/
/* TODO: need to double check that this all works correctly */
if ((recalc & ADT_RECALC_ANIM) || (adt->recalc & ADT_RECALC_ANIM)) {
/* evaluate NLA data */
if ((adt->nla_tracks.first) && !(adt->flag & ADT_NLA_EVAL_OFF)) {
/* evaluate NLA-stack
- * - active action is evaluated as part of the NLA stack as the last item
+ * - active action is evaluated as part of the NLA stack as the last item
*/
animsys_calculate_nla(&id_ptr, adt, ctime);
}
@@ -2759,9 +2759,9 @@ void BKE_animsys_evaluate_animdata(Scene *scene, ID *id, AnimData *adt, float ct
}
/* recalculate drivers
- * - Drivers need to be evaluated afterwards, as they can either override
- * or be layered on top of existing animation data.
- * - Drivers should be in the appropriate order to be evaluated without problems...
+ * - Drivers need to be evaluated afterwards, as they can either override
+ * or be layered on top of existing animation data.
+ * - Drivers should be in the appropriate order to be evaluated without problems...
*/
if ((recalc & ADT_RECALC_DRIVERS)
/* XXX for now, don't check yet, as depsgraph hasn't been updated */
@@ -2771,10 +2771,10 @@ void BKE_animsys_evaluate_animdata(Scene *scene, ID *id, AnimData *adt, float ct
}
/* always execute 'overrides'
- * - Overrides allow editing, by overwriting the value(s) set from animation-data, with the
- * value last set by the user (and not keyframed yet).
- * - Overrides are cleared upon frame change and/or keyframing
- * - It is best that we execute this every time, so that no errors are likely to occur.
+ * - Overrides allow editing, by overwriting the value(s) set from animation-data, with the
+ * value last set by the user (and not keyframed yet).
+ * - Overrides are cleared upon frame change and/or keyframing
+ * - It is best that we execute this every time, so that no errors are likely to occur.
*/
animsys_evaluate_overrides(&id_ptr, adt);
@@ -2804,9 +2804,9 @@ void BKE_animsys_evaluate_all_animation(Main *main, Scene *scene, float ctime)
printf("Evaluate all animation - %f\n", ctime);
/* macros for less typing
- * - only evaluate animation data for id if it has users (and not just fake ones)
- * - whether animdata exists is checked for by the evaluation function, though taking
- * this outside of the function may make things slightly faster?
+ * - only evaluate animation data for id if it has users (and not just fake ones)
+ * - whether animdata exists is checked for by the evaluation function, though taking
+ * this outside of the function may make things slightly faster?
*/
#define EVAL_ANIM_IDS(first, aflag) \
for (id = first; id; id = id->next) { \
@@ -2817,10 +2817,10 @@ void BKE_animsys_evaluate_all_animation(Main *main, Scene *scene, float ctime)
} (void)0
/* another macro for the "embedded" nodetree cases
- * - this is like EVAL_ANIM_IDS, but this handles the case "embedded nodetrees"
- * (i.e. scene/material/texture->nodetree) which we need a special exception
- * for, otherwise they'd get skipped
- * - ntp = "node tree parent" = datablock where node tree stuff resides
+ * - this is like EVAL_ANIM_IDS, but this handles the case "embedded nodetrees"
+ * (i.e. scene/material/texture->nodetree) which we need a special exception
+ * for, otherwise they'd get skipped
+ * - ntp = "node tree parent" = datablock where node tree stuff resides
*/
#define EVAL_ANIM_NODETREE_IDS(first, NtId_Type, aflag) \
for (id = first; id; id = id->next) { \
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index b7a811b7574..4ad9e9c8205 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -295,12 +295,12 @@ int bone_autoside_name(char name[MAXBONENAME], int UNUSED(strip_number), short a
BLI_strncpy(basename, name, sizeof(basename));
/* Figure out extension to append:
- * - The extension to append is based upon the axis that we are working on.
- * - If head happens to be on 0, then we must consider the tail position as well to decide
- * which side the bone is on
- * -> If tail is 0, then it's bone is considered to be on axis, so no extension should be added
- * -> Otherwise, extension is added from perspective of object based on which side tail goes to
- * - If head is non-zero, extension is added from perspective of object based on side head is on
+ * - The extension to append is based upon the axis that we are working on.
+ * - If head happens to be on 0, then we must consider the tail position as well to decide
+ * which side the bone is on
+ * -> If tail is 0, then it's bone is considered to be on axis, so no extension should be added
+ * -> Otherwise, extension is added from perspective of object based on which side tail goes to
+ * - If head is non-zero, extension is added from perspective of object based on side head is on
*/
if (axis == 2) {
/* z-axis - vertical (top/bottom) */
@@ -350,8 +350,8 @@ int bone_autoside_name(char name[MAXBONENAME], int UNUSED(strip_number), short a
}
/* Simple name truncation
- * - truncate if there is an extension and it wouldn't be able to fit
- * - otherwise, just append to end
+ * - truncate if there is an extension and it wouldn't be able to fit
+ * - otherwise, just append to end
*/
if (extension[0]) {
bool changed = true;
@@ -1068,7 +1068,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm, float
GHash *idx_hash = BLI_ghash_ptr_new("pose channel index by name");
int pchan_index = 0;
for (pchan = armOb->pose->chanbase.first; pchan != NULL; pchan = pchan->next, ++pchan_index) {
- BLI_ghash_insert(idx_hash, pchan, SET_INT_IN_POINTER(pchan_index));
+ BLI_ghash_insert(idx_hash, pchan, POINTER_FROM_INT(pchan_index));
}
for (i = 0, dg = target->defbase.first; dg; i++, dg = dg->next) {
defnrToPC[i] = BKE_pose_channel_find_name(armOb->pose, dg->name);
@@ -1078,7 +1078,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm, float
defnrToPC[i] = NULL;
}
else {
- defnrToPCIndex[i] = GET_INT_FROM_POINTER(BLI_ghash_lookup(idx_hash, defnrToPC[i]));
+ defnrToPCIndex[i] = POINTER_AS_INT(BLI_ghash_lookup(idx_hash, defnrToPC[i]));
}
}
}
@@ -2314,8 +2314,8 @@ void BKE_pose_where_is(Scene *scene, Object *ob)
BIK_initialize_tree(scene, ob, ctime);
/* 2b. construct the Spline IK trees
- * - this is not integrated as an IK plugin, since it should be able
- * to function in conjunction with standard IK
+ * - this is not integrated as an IK plugin, since it should be able
+ * to function in conjunction with standard IK
*/
BKE_pose_splineik_init_tree(scene, ob, ctime);
diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c
index cb4237f51b4..241a842d73f 100644
--- a/source/blender/blenkernel/intern/armature_update.c
+++ b/source/blender/blenkernel/intern/armature_update.c
@@ -160,7 +160,7 @@ static void splineik_init_tree_from_pchan(Scene *scene, Object *UNUSED(ob), bPos
*/
for (i = 0; i < segcount; i++) {
/* 'head' joints, traveling towards the root of the chain
- * - 2 methods; the one chosen depends on whether we've got usable lengths
+ * - 2 methods; the one chosen depends on whether we've got usable lengths
*/
if ((ikData->flag & CONSTRAINT_SPLINEIK_EVENSPLITS) || (totLength == 0.0f)) {
/* 1) equi-spaced joints */
@@ -363,7 +363,7 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
rangle *= tree->con->enforce;
/* construct rotation matrix from the axis-angle rotation found above
- * - this call takes care to make sure that the axis provided is a unit vector first
+ * - this call takes care to make sure that the axis provided is a unit vector first
*/
axis_angle_to_mat3(dmat, raxis, rangle);
@@ -486,8 +486,8 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
}
else if (tree->con->enforce < 1.0f) {
/* when the influence is too low
- * - blend the positions for the 'root' bone
- * - stick to the parent for any other
+ * - blend the positions for the 'root' bone
+ * - stick to the parent for any other
*/
if (pchan->parent) {
copy_v3_v3(poseHead, pchan->pose_head);
@@ -604,8 +604,8 @@ void BKE_pose_eval_init_ik(EvaluationContext *UNUSED(eval_ctx),
/* construct the IK tree (standard IK) */
BIK_initialize_tree(scene, ob, ctime);
/* construct the Spline IK trees
- * - this is not integrated as an IK plugin, since it should be able
- * to function in conjunction with standard IK
+ * - this is not integrated as an IK plugin, since it should be able
+ * to function in conjunction with standard IK
*/
BKE_pose_splineik_init_tree(scene, ob, ctime);
}
diff --git a/source/blender/blenkernel/intern/blender_undo.c b/source/blender/blenkernel/intern/blender_undo.c
index df2caba0208..441687c1c01 100644
--- a/source/blender/blenkernel/intern/blender_undo.c
+++ b/source/blender/blenkernel/intern/blender_undo.c
@@ -55,6 +55,7 @@
#include "BKE_main.h"
#include "BLO_undofile.h"
+#include "BLO_readfile.h"
#include "BLO_writefile.h"
/* -------------------------------------------------------------------- */
@@ -79,7 +80,10 @@ bool BKE_memfile_undo_decode(MemFileUndoData *mfu, bContext *C)
success = (BKE_blendfile_read(C, mfu->filename, NULL, 0) != BKE_BLENDFILE_READ_FAIL);
}
else {
- success = BKE_blendfile_read_from_memfile(C, &mfu->memfile, NULL, 0);
+ success = BKE_blendfile_read_from_memfile(
+ C, &mfu->memfile,
+ &(const struct BlendFileReadParams){0},
+ NULL);
}
/* Restore, bmain has been re-allocated. */
diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c
index aa5530704c6..c6cb8a412fe 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -111,11 +111,12 @@ static bool wm_scene_is_visible(wmWindowManager *wm, Scene *scene)
*/
static void setup_app_data(
bContext *C, BlendFileData *bfd,
- const char *filepath, ReportList *reports)
+ const char *filepath,
+ const bool is_startup,
+ ReportList *reports)
{
Main *bmain = G_MAIN;
Scene *curscene = NULL;
- const bool is_startup = (bfd->filename[0] == '\0');
const bool recover = (G.fileflags & G_FILE_RECOVER) != 0;
enum {
LOAD_UI = 1,
@@ -296,7 +297,7 @@ static void setup_app_data(
bmain->recovered = 0;
/* startup.blend or recovered startup */
- if (bfd->filename[0] == 0) {
+ if (is_startup) {
bmain->name[0] = '\0';
}
else if (recover && G.relbase_valid) {
@@ -351,7 +352,8 @@ static int handle_subversion_warning(Main *main, ReportList *reports)
int BKE_blendfile_read(
bContext *C, const char *filepath,
- ReportList *reports, int skip_flags)
+ const struct BlendFileReadParams *params,
+ ReportList *reports)
{
BlendFileData *bfd;
int retval = BKE_BLENDFILE_READ_OK;
@@ -361,7 +363,7 @@ int BKE_blendfile_read(
printf("Read blend: %s\n", filepath);
}
- bfd = BLO_read_from_file(filepath, reports, skip_flags);
+ bfd = BLO_read_from_file(filepath, params->skip_flags, reports);
if (bfd) {
if (bfd->user) {
retval = BKE_BLENDFILE_READ_OK_USERPREFS;
@@ -374,7 +376,7 @@ int BKE_blendfile_read(
retval = BKE_BLENDFILE_READ_FAIL;
}
else {
- setup_app_data(C, bfd, filepath, reports);
+ setup_app_data(C, bfd, filepath, params->is_startup, reports);
}
}
else
@@ -384,16 +386,17 @@ int BKE_blendfile_read(
}
bool BKE_blendfile_read_from_memory(
- bContext *C, const void *filebuf, int filelength,
- ReportList *reports, int skip_flags, bool update_defaults)
+ bContext *C, const void *filebuf, int filelength, bool update_defaults,
+ const struct BlendFileReadParams *params,
+ ReportList *reports)
{
BlendFileData *bfd;
- bfd = BLO_read_from_memory(filebuf, filelength, reports, skip_flags);
+ bfd = BLO_read_from_memory(filebuf, filelength, params->skip_flags, reports);
if (bfd) {
if (update_defaults)
BLO_update_defaults_startup_blend(bfd->main);
- setup_app_data(C, bfd, "<memory2>", reports);
+ setup_app_data(C, bfd, "<memory2>", params->is_startup, reports);
}
else {
BKE_reports_prepend(reports, "Loading failed: ");
@@ -405,12 +408,13 @@ bool BKE_blendfile_read_from_memory(
/* memfile is the undo buffer */
bool BKE_blendfile_read_from_memfile(
bContext *C, struct MemFile *memfile,
- ReportList *reports, int skip_flags)
+ const struct BlendFileReadParams *params,
+ ReportList *reports)
{
Main *bmain = CTX_data_main(C);
BlendFileData *bfd;
- bfd = BLO_read_from_memfile(bmain, BKE_main_blendfile_path(bmain), memfile, reports, skip_flags);
+ bfd = BLO_read_from_memfile(bmain, BKE_main_blendfile_path(bmain), memfile, params->skip_flags, reports);
if (bfd) {
/* remove the unused screens and wm */
while (bfd->main->wm.first)
@@ -418,7 +422,7 @@ bool BKE_blendfile_read_from_memfile(
while (bfd->main->screen.first)
BKE_libblock_free(bfd->main, bfd->main->screen.first);
- setup_app_data(C, bfd, "<memory1>", reports);
+ setup_app_data(C, bfd, "<memory1>", params->is_startup, reports);
}
else {
BKE_reports_prepend(reports, "Loading failed: ");
@@ -459,7 +463,7 @@ UserDef *BKE_blendfile_userdef_read(const char *filepath, ReportList *reports)
BlendFileData *bfd;
UserDef *userdef = NULL;
- bfd = BLO_read_from_file(filepath, reports, BLO_READ_SKIP_ALL & ~BLO_READ_SKIP_USERDEF);
+ bfd = BLO_read_from_file(filepath, BLO_READ_SKIP_ALL & ~BLO_READ_SKIP_USERDEF, reports);
if (bfd) {
if (bfd->user) {
userdef = bfd->user;
@@ -479,7 +483,10 @@ UserDef *BKE_blendfile_userdef_read_from_memory(
BlendFileData *bfd;
UserDef *userdef = NULL;
- bfd = BLO_read_from_memory(filebuf, filelength, reports, BLO_READ_SKIP_ALL & ~BLO_READ_SKIP_USERDEF);
+ bfd = BLO_read_from_memory(
+ filebuf, filelength,
+ BLO_READ_SKIP_ALL & ~BLO_READ_SKIP_USERDEF,
+ reports);
if (bfd) {
if (bfd->user) {
userdef = bfd->user;
@@ -590,10 +597,6 @@ bool BKE_blendfile_write_partial(
* (otherwise main->name will not be set at read time). */
BLI_strncpy(bmain_dst->name, bmain_src->name, sizeof(bmain_dst->name));
- if (write_flags & G_FILE_RELATIVE_REMAP) {
- path_list_backup = BKE_bpath_list_backup(bmain_src, path_list_flag);
- }
-
BLO_main_expander(blendfile_write_partial_cb);
BLO_expand_main(NULL, bmain_src);
@@ -613,10 +616,27 @@ bool BKE_blendfile_write_partial(
}
}
+ /* Backup paths because remap relative will overwrite them.
+ *
+ * NOTE: we do this only on the list of datablocks that we are writing
+ * because the restored full list is not guaranteed to be in the same
+ * order as before, as expected by BKE_bpath_list_restore.
+ *
+ * This happens because id_sort_by_name does not take into account
+ * string case or the library name, so the order is not strictly
+ * defined for two linked datablocks with the same name! */
+ if (write_flags & G_FILE_RELATIVE_REMAP) {
+ path_list_backup = BKE_bpath_list_backup(bmain_dst, path_list_flag);
+ }
/* save the buffer */
retval = BLO_write_file(bmain_dst, filepath, write_flags, reports, NULL);
+ if (path_list_backup) {
+ BKE_bpath_list_restore(bmain_dst, path_list_flag, path_list_backup);
+ BKE_bpath_list_free(path_list_backup);
+ }
+
/* move back the main, now sorted again */
set_listbasepointers(bmain_src, lbarray_dst);
a = set_listbasepointers(bmain_dst, lbarray_src);
@@ -632,11 +652,6 @@ bool BKE_blendfile_write_partial(
MEM_freeN(bmain_dst);
- if (path_list_backup) {
- BKE_bpath_list_restore(bmain_src, path_list_flag, path_list_backup);
- BKE_bpath_list_free(path_list_backup);
- }
-
return retval;
}
diff --git a/source/blender/blenkernel/intern/bmfont.c b/source/blender/blenkernel/intern/bmfont.c
index c99894bfbaf..b33b07e3a4f 100644
--- a/source/blender/blenkernel/intern/bmfont.c
+++ b/source/blender/blenkernel/intern/bmfont.c
@@ -85,7 +85,7 @@ void readBitmapFontVersion0(ImBuf *ibuf, unsigned char *rect, int step)
{
int glyphcount, bytes, i, index, linelength, ysize;
unsigned char *buffer;
- bmFont * bmfont;
+ bmFont *bmfont;
linelength = ibuf->x * step;
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index 18b2a5b2fcc..810056f8fc7 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -1282,8 +1282,8 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
/* integrate new location & velocity */
- /* by regarding the acceleration as a force at this stage we*/
- /* can get better control allthough it's a bit unphysical */
+ /* by regarding the acceleration as a force at this stage we
+ * can get better control although it's a bit unphysical */
mul_v3_fl(acc, 1.0f/pa_mass);
copy_v3_v3(dvec, acc);
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 42cd7968321..5b76d75f261 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -461,7 +461,7 @@ void BKE_brush_curve_preset(Brush *b, eCurveMappingPreset preset)
* region space mouse coordinates, or 3d world coordinates for 3D mapping.
*
* rgba outputs straight alpha. */
-float BKE_brush_sample_tex_3D(const Scene *scene, const Brush *br,
+float BKE_brush_sample_tex_3d(const Scene *scene, const Brush *br,
const float point[3],
float rgba[4], const int thread,
struct ImagePool *pool)
@@ -954,7 +954,7 @@ unsigned int *BKE_brush_gen_texture_cache(Brush *br, int half_side, bool use_sec
texcache = MEM_callocN(sizeof(int) * side * side, "Brush texture cache");
- /* do normalized cannonical view coords for texture */
+ /* do normalized canonical view coords for texture */
for (y = -1.0, iy = 0; iy < side; iy++, y += step) {
for (x = -1.0, ix = 0; ix < side; ix++, x += step) {
co[0] = x;
@@ -962,7 +962,7 @@ unsigned int *BKE_brush_gen_texture_cache(Brush *br, int half_side, bool use_sec
co[2] = 0.0f;
/* This is copied from displace modifier code */
- /* TODO(sergey): brush are always cacheing with CM enabled for now. */
+ /* TODO(sergey): brush are always caching with CM enabled for now. */
externtex(mtex, co, &intensity,
rgba, rgba + 1, rgba + 2, rgba + 3, 0, NULL, false, false);
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 1c5b1ca242c..ed2b8cddc14 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -2735,7 +2735,7 @@ void CDDM_calc_loop_normals_spacearr(
r_lnors_spacearr->lspacearr[i]->ref_beta, r_lnors_spacearr->lspacearr[i]->loops);
printf("\t\t(shared with loops");
while (loops) {
- printf(" %d", GET_INT_FROM_POINTER(loops->link));
+ printf(" %d", POINTER_AS_INT(loops->link));
loops = loops->next;
}
printf(")\n");
@@ -3067,13 +3067,13 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int
void **val_p;
if (BLI_edgehash_ensure_p(ehash, v1, v2, &val_p)) {
- newe[i] = GET_INT_FROM_POINTER(*val_p);
+ newe[i] = POINTER_AS_INT(*val_p);
}
else {
STACK_PUSH(olde, i);
STACK_PUSH(medge, *med);
newe[i] = c;
- *val_p = SET_INT_IN_POINTER(c);
+ *val_p = POINTER_FROM_INT(c);
c++;
}
}
@@ -3235,7 +3235,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int
uint v2 = mlv;
BLI_assert(v1 != v2);
if (BLI_edgehash_ensure_p(ehash, v1, v2, &val_p)) {
- last_valid_ml->e = GET_INT_FROM_POINTER(*val_p);
+ last_valid_ml->e = POINTER_AS_INT(*val_p);
}
else {
const int new_eidx = STACK_SIZE(medge);
@@ -3244,7 +3244,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int
medge[new_eidx].v1 = last_valid_ml->v;
medge[new_eidx].v2 = ml->v;
/* DO NOT change newe mapping, could break actual values due to some deleted original edges. */
- *val_p = SET_INT_IN_POINTER(new_eidx);
+ *val_p = POINTER_FROM_INT(new_eidx);
created_edges++;
last_valid_ml->e = new_eidx;
@@ -3287,7 +3287,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int
uint v2 = (vtargetmap[first_valid_ml->v] != -1) ? vtargetmap[first_valid_ml->v] : first_valid_ml->v;
BLI_assert(v1 != v2);
if (BLI_edgehash_ensure_p(ehash, v1, v2, &val_p)) {
- last_valid_ml->e = GET_INT_FROM_POINTER(*val_p);
+ last_valid_ml->e = POINTER_AS_INT(*val_p);
}
else {
const int new_eidx = STACK_SIZE(medge);
@@ -3296,7 +3296,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int
medge[new_eidx].v1 = last_valid_ml->v;
medge[new_eidx].v2 = first_valid_ml->v;
/* DO NOT change newe mapping, could break actual values due to some deleted original edges. */
- *val_p = SET_INT_IN_POINTER(new_eidx);
+ *val_p = POINTER_FROM_INT(new_eidx);
created_edges++;
last_valid_ml->e = new_eidx;
@@ -3491,7 +3491,7 @@ void CDDM_calc_edges(DerivedMesh *dm)
eh = BLI_edgehash_new_ex(__func__, eh_reserve);
if (med) {
for (i = 0; i < numEdges; i++, med++) {
- BLI_edgehash_insert(eh, med->v1, med->v2, SET_INT_IN_POINTER(i + 1));
+ BLI_edgehash_insert(eh, med->v1, med->v2, POINTER_FROM_INT(i + 1));
}
}
@@ -3520,7 +3520,7 @@ void CDDM_calc_edges(DerivedMesh *dm)
BLI_edgehashIterator_step(ehi), ++i, ++med, ++index)
{
BLI_edgehashIterator_getKey(ehi, &med->v1, &med->v2);
- j = GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi));
+ j = POINTER_AS_INT(BLI_edgehashIterator_getValue(ehi));
if (j == 0 || !eindex) {
med->flag = ME_EDGEDRAW | ME_EDGERENDER;
@@ -3531,7 +3531,7 @@ void CDDM_calc_edges(DerivedMesh *dm)
*index = eindex[j - 1];
}
- BLI_edgehashIterator_setValue(ehi, SET_INT_IN_POINTER(i));
+ BLI_edgehashIterator_setValue(ehi, POINTER_FROM_INT(i));
}
BLI_edgehashIterator_free(ehi);
@@ -3548,7 +3548,7 @@ void CDDM_calc_edges(DerivedMesh *dm)
for (j = 0; j < mp->totloop; j++, ml++) {
v1 = ml->v;
v2 = ME_POLY_LOOP_NEXT(cddm->mloop, mp, j)->v;
- ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(eh, v1, v2));
+ ml->e = POINTER_AS_INT(BLI_edgehash_lookup(eh, v1, v2));
}
}
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 4597eb9b114..88d4766048f 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -1439,13 +1439,13 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
}
}
else {
- /* bending springs for hair strands */
- /* The current algorightm only goes through the edges in order of the mesh edges list */
- /* and makes springs between the outer vert of edges sharing a vertice. This works just */
- /* fine for hair, but not for user generated string meshes. This could/should be later */
- /* extended to work with non-ordered edges so that it can be used for general "rope */
- /* dynamics" without the need for the vertices or edges to be ordered through the length*/
- /* of the strands. -jahka */
+ /* bending springs for hair strands
+ * The current algorithm only goes through the edges in order of the mesh edges list
+ * and makes springs between the outer vert of edges sharing a vertice. This works just
+ * fine for hair, but not for user generated string meshes. This could/should be later
+ * extended to work with non-ordered edges so that it can be used for general "rope
+ * dynamics" without the need for the vertices or edges to be ordered through the length
+ * of the strands. -jahka */
search = cloth->springs;
search2 = search->next;
while (search && search2) {
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 1df749ee842..84490ba3ee2 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -1062,9 +1062,11 @@ BLI_INLINE bool cloth_point_face_collision_params(const float p1[3], const float
*r_lambda = f * dot_v3v3(edge2, q);
/* don't care about 0..1 lambda range here */
- /*if ((*r_lambda < 0.0f) || (*r_lambda > 1.0f))
- * return 0;
- */
+#if 0
+ if ((*r_lambda < 0.0f) || (*r_lambda > 1.0f)) {
+ return 0;
+ }
+#endif
r_w[0] = 1.0f - u - v;
r_w[1] = u;
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 7d861658993..66147c44352 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -452,10 +452,10 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[
/* derive the rotation from the average normal:
- * - code taken from transform_manipulator.c,
- * calc_manipulator_stats, V3D_MANIP_NORMAL case
+ * - code taken from transform_manipulator.c,
+ * calc_manipulator_stats, V3D_MANIP_NORMAL case
*/
- /* we need the transpose of the inverse for a normal... */
+ /* we need the transpose of the inverse for a normal... */
copy_m3_m4(imat, ob->obmat);
invert_m3_m3(tmat, imat);
@@ -543,7 +543,7 @@ static void contarget_get_lattice_mat(Object *ob, const char *substring, float m
/* The cases where the target can be object data have not been implemented */
static void constraint_target_to_mat4(Object *ob, const char *substring, float mat[4][4], short from, short to, short flag, float headtail)
{
- /* Case OBJECT */
+ /* Case OBJECT */
if (substring[0] == '\0') {
copy_m4_m4(mat, ob->obmat);
BKE_constraint_mat_convertspace(ob, NULL, mat, from, to, false);
@@ -555,7 +555,7 @@ static void constraint_target_to_mat4(Object *ob, const char *substring, float m
* 'average' vertex normal, and deriving the rotation from that.
*
* NOTE: EditMode is not currently supported, and will most likely remain that
- * way as constraints can only really affect things on object/bone level.
+ * way as constraints can only really affect things on object/bone level.
*/
else if (ob->type == OB_MESH) {
contarget_get_mesh_mat(ob, substring, mat);
@@ -565,7 +565,7 @@ static void constraint_target_to_mat4(Object *ob, const char *substring, float m
contarget_get_lattice_mat(ob, substring, mat);
BKE_constraint_mat_convertspace(ob, NULL, mat, from, to, false);
}
- /* Case BONE */
+ /* Case BONE */
else {
bPoseChannel *pchan;
@@ -659,15 +659,15 @@ static void constraint_target_to_mat4(Object *ob, const char *substring, float m
*/
/* Template for type-info data:
- * - make a copy of this when creating new constraints, and just change the functions
- * pointed to as necessary
- * - although the naming of functions doesn't matter, it would help for code
- * readability, to follow the same naming convention as is presented here
- * - any functions that a constraint doesn't need to define, don't define
- * for such cases, just use NULL
- * - these should be defined after all the functions have been defined, so that
- * forward-definitions/prototypes don't need to be used!
- * - keep this copy #if-def'd so that future constraints can get based off this
+ * - make a copy of this when creating new constraints, and just change the functions
+ * pointed to as necessary
+ * - although the naming of functions doesn't matter, it would help for code
+ * readability, to follow the same naming convention as is presented here
+ * - any functions that a constraint doesn't need to define, don't define
+ * for such cases, just use NULL
+ * - these should be defined after all the functions have been defined, so that
+ * forward-definitions/prototypes don't need to be used!
+ * - keep this copy #if-def'd so that future constraints can get based off this
*/
#if 0
static bConstraintTypeInfo CTI_CONSTRNAME = {
@@ -1257,7 +1257,7 @@ static void followpath_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstra
unit_m4(ct->matrix);
/* note: when creating constraints that follow path, the curve gets the CU_PATH set now,
- * currently for paths to work it needs to go through the bevlist/displist system (ton)
+ * currently for paths to work it needs to go through the bevlist/displist system (ton)
*/
#ifdef CYCLIC_DEPENDENCY_WORKAROUND
@@ -2163,9 +2163,9 @@ static void actcon_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstraintT
/* determine where in transform range target is */
/* data->type is mapped as follows for backwards compatibility:
- * 00,01,02 - rotation (it used to be like this)
- * 10,11,12 - scaling
- * 20,21,22 - location
+ * 00,01,02 - rotation (it used to be like this)
+ * 10,11,12 - scaling
+ * 20,21,22 - location
*/
if (data->type < 10) {
/* extract rotation (is in whatever space target should be in) */
@@ -2209,7 +2209,7 @@ static void actcon_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstraintT
bPoseChannel *pchan, *tchan;
/* make a copy of the bone of interest in the temp pose before evaluating action, so that it can get set
- * - we need to manually copy over a few settings, including rotation order, otherwise this fails
+ * - we need to manually copy over a few settings, including rotation order, otherwise this fails
*/
pchan = cob->pchan;
@@ -2551,7 +2551,7 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
unit_m3(totmat);
}
- /* apply out transformaton to the object */
+ /* apply out transformation to the object */
mul_m4_m3m4(cob->matrix, totmat, cob->matrix);
}
}
@@ -2764,12 +2764,14 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
normalize_v3_v3(zz, cob->matrix[2]);
/* XXX That makes the constraint buggy with asymmetrically scaled objects, see #29940. */
-/* sub_v3_v3v3(vec, cob->matrix[3], ct->matrix[3]);*/
-/* vec[0] /= size[0];*/
-/* vec[1] /= size[1];*/
-/* vec[2] /= size[2];*/
+#if 0
+ sub_v3_v3v3(vec, cob->matrix[3], ct->matrix[3]);
+ vec[0] /= size[0];
+ vec[1] /= size[1];
+ vec[2] /= size[2];
-/* dist = normalize_v3(vec);*/
+ dist = normalize_v3(vec);
+#endif
dist = len_v3v3(cob->matrix[3], ct->matrix[3]);
/* Only Y constrained object axis scale should be used, to keep same length when scaling it. */
@@ -3678,9 +3680,9 @@ static void damptrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
float rmat[3][3], tmat[4][4];
/* find the (unit) direction that the axis we're interested in currently points
- * - mul_mat3_m4_v3() only takes the 3x3 (rotation+scaling) components of the 4x4 matrix
- * - the normalization step at the end should take care of any unwanted scaling
- * left over in the 3x3 matrix we used
+ * - mul_mat3_m4_v3() only takes the 3x3 (rotation+scaling) components of the 4x4 matrix
+ * - the normalization step at the end should take care of any unwanted scaling
+ * left over in the 3x3 matrix we used
*/
copy_v3_v3(obvec, track_dir_vecs[data->trackflag]);
mul_mat3_m4_v3(cob->matrix, obvec);
@@ -3703,11 +3705,11 @@ static void damptrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
/* determine the axis-angle rotation, which represents the smallest possible rotation
* between the two rotation vectors (i.e. the 'damping' referred to in the name)
- * - we take this to be the rotation around the normal axis/vector to the plane defined
- * by the current and destination vectors, which will 'map' the current axis to the
- * destination vector
- * - the min/max wrappers around (obvec . tarvec) result (stored temporarily in rangle)
- * are used to ensure that the smallest angle is chosen
+ * - we take this to be the rotation around the normal axis/vector to the plane defined
+ * by the current and destination vectors, which will 'map' the current axis to the
+ * destination vector
+ * - the min/max wrappers around (obvec . tarvec) result (stored temporarily in rangle)
+ * are used to ensure that the smallest angle is chosen
*/
cross_v3_v3v3_hi_prec(raxis, obvec, tarvec);
@@ -3715,15 +3717,15 @@ static void damptrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
rangle = acosf(max_ff(-1.0f, min_ff(1.0f, rangle)));
/* construct rotation matrix from the axis-angle rotation found above
- * - this call takes care to make sure that the axis provided is a unit vector first
+ * - this call takes care to make sure that the axis provided is a unit vector first
*/
float norm = normalize_v3(raxis);
if (norm < FLT_EPSILON) {
/* if dot product is nonzero, while cross is zero, we have two opposite vectors!
- * - this is an ambiguity in the math that needs to be resolved arbitrarily,
- * or there will be a case where damped track strangely does nothing
- * - to do that, rotate around a different local axis
+ * - this is an ambiguity in the math that needs to be resolved arbitrarily,
+ * or there will be a case where damped track strangely does nothing
+ * - to do that, rotate around a different local axis
*/
float tmpvec[3];
@@ -4970,13 +4972,13 @@ void BKE_constraint_targets_for_solving_get(bConstraint *con, bConstraintOb *cob
bConstraintTarget *ct;
/* get targets
- * - constraints should use ct->matrix, not directly accessing values
- * - ct->matrix members have not yet been calculated here!
+ * - constraints should use ct->matrix, not directly accessing values
+ * - ct->matrix members have not yet been calculated here!
*/
cti->get_constraint_targets(con, targets);
/* set matrices
- * - calculate if possible, otherwise just initialize as identity matrix
+ * - calculate if possible, otherwise just initialize as identity matrix
*/
if (cti->get_target_matrix) {
for (ct = targets->first; ct; ct = ct->next)
@@ -5021,7 +5023,7 @@ void BKE_constraints_solve(ListBase *conlist, bConstraintOb *cob, float ctime)
if (con->enforce == 0.0f) continue;
/* influence of constraint
- * - value should have been set from animation data already
+ * - value should have been set from animation data already
*/
enf = con->enforce;
@@ -5038,8 +5040,8 @@ void BKE_constraints_solve(ListBase *conlist, bConstraintOb *cob, float ctime)
cti->evaluate_constraint(con, cob, &targets);
/* clear targets after use
- * - this should free temp targets but no data should be copied back
- * as constraints may have done some nasty things to it...
+ * - this should free temp targets but no data should be copied back
+ * as constraints may have done some nasty things to it...
*/
if (cti->flush_constraint_targets) {
cti->flush_constraint_targets(con, &targets, 1);
@@ -5050,9 +5052,9 @@ void BKE_constraints_solve(ListBase *conlist, bConstraintOb *cob, float ctime)
BKE_constraint_mat_convertspace(cob->ob, cob->pchan, cob->matrix, con->ownspace, CONSTRAINT_SPACE_WORLD, false);
/* Interpolate the enforcement, to blend result of constraint into final owner transform
- * - all this happens in worldspace to prevent any weirdness creeping in ([#26014] and [#25725]),
- * since some constraints may not convert the solution back to the input space before blending
- * but all are guaranteed to end up in good "worldspace" result
+ * - all this happens in worldspace to prevent any weirdness creeping in ([#26014] and [#25725]),
+ * since some constraints may not convert the solution back to the input space before blending
+ * but all are guaranteed to end up in good "worldspace" result
*/
/* Note: all kind of stuff here before (caused trouble), much easier to just interpolate,
* or did I miss something? -jahka (r.32105) */
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 517d2ebe10e..c9468c7d95c 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -206,7 +206,7 @@ void CTX_store_free_list(ListBase *contexts)
}
}
-/* is python initialied? */
+/* is python initialized? */
int CTX_py_init_get(bContext *C)
{
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 792ba08358e..b395df49061 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -275,7 +275,7 @@ void BKE_curve_curve_dimension_update(Curve *cu)
else {
for (; nu; nu = nu->next) {
nu->flag |= CU_2D;
- BKE_nurb_test2D(nu);
+ BKE_nurb_test_2d(nu);
/* since the handles are moved they need to be auto-located again */
if (nu->type == CU_BEZIER)
@@ -547,7 +547,7 @@ void BKE_nurbList_duplicate(ListBase *lb1, const ListBase *lb2)
}
}
-void BKE_nurb_test2D(Nurb *nu)
+void BKE_nurb_test_2d(Nurb *nu)
{
BezTriple *bezt;
BPoint *bp;
@@ -2077,7 +2077,7 @@ static bool bevelinside(BevList *bl1, BevList *bl2)
copy_v3_v3(hvec2, hvec1);
hvec2[0] += 1000;
- /* test it with all edges of potential surounding poly */
+ /* test it with all edges of potential surrounding poly */
/* count number of transitions left-right */
bevp = bl1->bevpoints;
@@ -2640,7 +2640,7 @@ static void make_bevel_list_segment_2D(BevList *bl)
static void make_bevel_list_2D(BevList *bl)
{
/* note: bevp->dir and bevp->quat are not needed for beveling but are
- * used when making a path from a 2D curve, therefor they need to be set - Campbell */
+ * used when making a path from a 2D curve, therefore they need to be set - Campbell */
BevPoint *bevp0, *bevp1, *bevp2;
int nr;
@@ -3938,7 +3938,7 @@ static void bezier_handle_calc_smooth_fcurve(BezTriple *bezt, int total, int sta
float first_handle_adj = 0.0f, last_handle_adj = 0.0f;
if (full_cycle) {
- /* reduce the number of uknowns by one */
+ /* reduce the number of unknowns by one */
int i = solve_count = count - 1;
dx[0] = dx[i];
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 28280c45922..8fa117dfce1 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -2890,7 +2890,7 @@ void CustomData_bmesh_copy_data(const CustomData *source, CustomData *dest,
}
}
-/*Bmesh Custom Data Functions. Should replace editmesh ones with these as well, due to more effecient memory alloc*/
+/*Bmesh Custom Data Functions. Should replace editmesh ones with these as well, due to more efficient memory alloc*/
void *CustomData_bmesh_get(const CustomData *data, void *block, int type)
{
int layer_index;
diff --git a/source/blender/blenkernel/intern/data_transfer.c b/source/blender/blenkernel/intern/data_transfer.c
index 38340575e74..7407fc2051f 100644
--- a/source/blender/blenkernel/intern/data_transfer.c
+++ b/source/blender/blenkernel/intern/data_transfer.c
@@ -833,7 +833,7 @@ static bool data_transfer_layersmapping_generate(
return ret;
}
else if (cddata_type == CD_FAKE_SHAPEKEY) {
- /* TODO: leaving shapekeys asside for now, quite specific case, since we can't access them from MVert :/ */
+ /* TODO: leaving shapekeys aside for now, quite specific case, since we can't access them from MVert :/ */
return false;
}
}
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index ed4ee1f8b17..e129251157e 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -75,11 +75,11 @@
#include "BKE_pointcache.h"
#include "BKE_scene.h"
-/* for image output */
+/* for image output */
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
-/* to read material/texture color */
+/* to read material/texture color */
#include "RE_render_ext.h"
#include "RE_shader_ext.h"
@@ -90,7 +90,7 @@
//# pragma GCC diagnostic ignored "-Wdouble-promotion"
#endif
-/* precalculated gaussian factors for 5x super sampling */
+/* precalculated gaussian factors for 5x super sampling */
static const float gaussianFactors[5] = {
0.996849f,
0.596145f,
@@ -169,7 +169,7 @@ typedef struct BakeAdjPoint {
float dist; /* distance to */
} BakeAdjPoint;
-/* Surface data used while processing a frame */
+/* Surface data used while processing a frame */
typedef struct PaintBakeNormal {
float invNorm[3]; /* current pixel world-space inverted normal */
float normal_scale; /* normal directional scale for displace mapping */
@@ -201,7 +201,7 @@ typedef struct PaintBakeData {
int clear; /* flag to check if surface was cleared/reset -> have to redo velocity etc. */
} PaintBakeData;
-/* UV Image sequence format point */
+/* UV Image sequence format point */
typedef struct PaintUVPoint {
/* Pixel / mesh data */
unsigned int tri_index, pixel_index; /* tri index on domain derived mesh */
@@ -778,7 +778,7 @@ static void surfaceGenerateGrid(struct DynamicPaintSurface *surface)
error = 1;
if (!error) {
- /* calculate number of points withing each cell */
+ /* calculate number of points within each cell */
{
ParallelRangeSettings settings;
BLI_parallel_range_settings_defaults(&settings);
@@ -1132,7 +1132,7 @@ bool dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, str
if (!brush->paint_ramp)
return false;
ramp = brush->paint_ramp->data;
- /* Add default smooth-falloff ramp. */
+ /* Add default smooth-falloff ramp. */
ramp[0].r = ramp[0].g = ramp[0].b = ramp[0].a = 1.0f;
ramp[0].pos = 0.0f;
ramp[1].r = ramp[1].g = ramp[1].b = ramp[1].pos = 1.0f;
@@ -1163,14 +1163,14 @@ bool dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, str
void dynamicPaint_Modifier_copy(const struct DynamicPaintModifierData *pmd, struct DynamicPaintModifierData *tpmd)
{
- /* Init modifier */
+ /* Init modifier */
tpmd->type = pmd->type;
if (pmd->canvas)
dynamicPaint_createType(tpmd, MOD_DYNAMICPAINT_TYPE_CANVAS, NULL);
if (pmd->brush)
dynamicPaint_createType(tpmd, MOD_DYNAMICPAINT_TYPE_BRUSH, NULL);
- /* Copy data */
+ /* Copy data */
if (tpmd->canvas) {
DynamicPaintSurface *surface;
tpmd->canvas->pmd = tpmd;
@@ -1880,7 +1880,7 @@ static void dynamic_paint_apply_surface_wave_cb(
}
/*
- * Apply canvas data to the object derived mesh
+ * Apply canvas data to the object derived mesh
*/
static DerivedMesh *dynamicPaint_Modifier_apply(
DynamicPaintModifierData *pmd, Object *ob, DerivedMesh *dm)
@@ -1988,7 +1988,7 @@ static DerivedMesh *dynamicPaint_Modifier_apply(
DM_update_weight_mcol(ob, result, 0, weight, 0, NULL);
}
- /* apply weights into a vertex group, if doesnt exists add a new layer */
+ /* apply weights into a vertex group, if doesn't exists add a new layer */
if (defgrp_index != -1 && !dvert && (surface->output_name[0] != '\0')) {
dvert = CustomData_add_layer(&result->vertData, CD_MDEFORMVERT, CD_CALLOC,
NULL, sData->total_points);
@@ -2070,7 +2070,7 @@ static void canvas_copyDerivedMesh(DynamicPaintCanvasSettings *canvas, DerivedMe
}
/*
- * Updates derived mesh copy and processes dynamic paint step / caches.
+ * Updates derived mesh copy and processes dynamic paint step / caches.
*/
static void dynamicPaint_frameUpdate(
Main *bmain, EvaluationContext *eval_ctx, DynamicPaintModifierData *pmd, Scene *scene, Object *ob, DerivedMesh *dm)
@@ -2182,7 +2182,7 @@ DerivedMesh *dynamicPaint_Modifier_do(Main *bmain,
/***************************** Image Sequence / UV Image Surface Calls ******************************/
/*
- * Create a surface for uv image sequence format
+ * Create a surface for uv image sequence format
*/
#define JITTER_SAMPLES { \
0.0f, 0.0f, \
@@ -2240,7 +2240,7 @@ static void dynamic_paint_create_uv_surface_direct_cb(
tPoint->neighbour_pixel = -1;
tPoint->pixel_index = index;
- /* Actual pixel center, used when collision is found */
+ /* Actual pixel center, used when collision is found */
point[0][0] = ((float)tx + 0.5f) / w;
point[0][1] = ((float)ty + 0.5f) / h;
@@ -2261,12 +2261,12 @@ static void dynamic_paint_create_uv_surface_direct_cb(
point[4][1] = ((float)ty + 1) / h;
- /* Loop through samples, starting from middle point */
+ /* Loop through samples, starting from middle point */
for (int sample = 0; sample < 5; sample++) {
- /* Loop through every face in the mesh */
+ /* Loop through every face in the mesh */
/* XXX TODO This is *horrible* with big meshes, should use a 2D BVHTree over UV tris here! */
for (int i = 0; i < tottri; i++) {
- /* Check uv bb */
+ /* Check uv bb */
if ((faceBB[i].min[0] > point[sample][0]) ||
(faceBB[i].min[1] > point[sample][1]) ||
(faceBB[i].max[0] < point[sample][0]) ||
@@ -2283,7 +2283,7 @@ static void dynamic_paint_create_uv_surface_direct_cb(
if (isect_point_tri_v2(point[sample], uv1, uv2, uv3) != 0) {
float uv[2];
- /* Add b-weights per anti-aliasing sample */
+ /* Add b-weights per anti-aliasing sample */
for (int j = 0; j < aa_samples; j++) {
uv[0] = point[0][0] + jitter5sample[j * 2] / w;
uv[1] = point[0][1] + jitter5sample[j * 2 + 1] / h;
@@ -2291,10 +2291,10 @@ static void dynamic_paint_create_uv_surface_direct_cb(
barycentric_weights_v2(uv1, uv2, uv3, uv, tempWeights[index * aa_samples + j].v);
}
- /* Set surface point face values */
+ /* Set surface point face values */
tPoint->tri_index = i;
- /* save vertex indexes */
+ /* save vertex indexes */
tPoint->v1 = mloop[mlooptri[i].tri[0]].v;
tPoint->v2 = mloop[mlooptri[i].tri[1]].v;
tPoint->v3 = mloop[mlooptri[i].tri[2]].v;
@@ -2333,11 +2333,11 @@ static void dynamic_paint_create_uv_surface_neighbor_cb(
const int index = tx + w * ty;
PaintUVPoint *tPoint = &tempPoints[index];
- /* If point isn't on canvas mesh */
+ /* If point isn't on canvas mesh */
if (tPoint->tri_index == -1) {
float point[2];
- /* get loop area */
+ /* get loop area */
const int u_min = (tx > 0) ? -1 : 0;
const int u_max = (tx < (w - 1)) ? 1 : 0;
const int v_min = (ty > 0) ? -1 : 0;
@@ -2352,7 +2352,7 @@ static void dynamic_paint_create_uv_surface_neighbor_cb(
int v = neighStraightY[ni];
if (u >= u_min && u <= u_max && v >= v_min && v <= v_max) {
- /* if not this pixel itself */
+ /* if not this pixel itself */
if (u != 0 || v != 0) {
const int ind = (tx + u) + w * (ty + v);
@@ -2377,14 +2377,14 @@ static void dynamic_paint_create_uv_surface_neighbor_cb(
tPoint->tri_index = i;
/* Now calculate pixel data for this pixel as it was on polygon surface */
- /* Add b-weights per anti-aliasing sample */
+ /* Add b-weights per anti-aliasing sample */
for (int j = 0; j < aa_samples; j++) {
uv[0] = point[0] + jitter5sample[j * 2] / w;
uv[1] = point[1] + jitter5sample[j * 2 + 1] / h;
barycentric_weights_v2(uv1, uv2, uv3, uv, tempWeights[index * aa_samples + j].v);
}
- /* save vertex indexes */
+ /* save vertex indexes */
tPoint->v1 = mloop[mlooptri[i].tri[0]].v;
tPoint->v2 = mloop[mlooptri[i].tri[1]].v;
tPoint->v3 = mloop[mlooptri[i].tri[2]].v;
@@ -2609,8 +2609,8 @@ static void dynamic_paint_find_island_border(
continue;
/*
- * Find a point that is relatively at same edge position
- * on this other face UV
+ * Find a point that is relatively at same edge position
+ * on this other face UV
*/
float closest_point[2], dir_vec[2], tgt_pixel[2];
@@ -2624,7 +2624,7 @@ static void dynamic_paint_find_island_border(
int final_pixel[2] = { (int)floorf(tgt_pixel[0] * w), (int)floorf(tgt_pixel[1] * h) };
- /* If current pixel uv is outside of texture */
+ /* If current pixel uv is outside of texture */
if (final_pixel[0] < 0 || final_pixel[0] >= w || final_pixel[1] < 0 || final_pixel[1] >= h) {
if (bdata->best_index == NOT_FOUND)
bdata->best_index = OUT_OF_TEXTURE;
@@ -2635,7 +2635,7 @@ static void dynamic_paint_find_island_border(
const PaintUVPoint *tempPoints = data->tempPoints;
int final_index = final_pixel[0] + w * final_pixel[1];
- /* If we ended up to our origin point ( mesh has smaller than pixel sized faces) */
+ /* If we ended up to our origin point ( mesh has smaller than pixel sized faces) */
if (final_index == (px + w * py))
continue;
@@ -2648,7 +2648,7 @@ static void dynamic_paint_find_island_border(
continue;
}
- /* If found pixel still lies on wrong face ( mesh has smaller than pixel sized faces) */
+ /* If found pixel still lies on wrong face ( mesh has smaller than pixel sized faces) */
if (tempPoints[final_index].tri_index != target_tri) {
/* Check if it's close enough to likely touch the intended triangle. Any triangle
* becomes thinner than a pixel at its vertices, so robustness requires some margin. */
@@ -2768,7 +2768,7 @@ static bool dynamicPaint_symmetrizeAdjData(PaintAdjData *ed, int active_points)
int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface, float *progress, short *do_update)
{
- /* Antialias jitter point relative coords */
+ /* Antialias jitter point relative coords */
const int aa_samples = (surface->flags & MOD_DPAINT_ANTIALIAS) ? 5 : 1;
char uvname[MAX_CUSTOMDATA_LAYER_NAME];
uint32_t active_points = 0;
@@ -2805,7 +2805,7 @@ int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface, flo
mloopuv = CustomData_get_layer_named(&dm->loopData, CD_MLOOPUV, uvname);
}
- /* Check for validity */
+ /* Check for validity */
if (!mloopuv)
return setError(canvas, N_("No UV data on canvas"));
if (surface->image_resolution < 16 || surface->image_resolution > 8192)
@@ -2815,7 +2815,7 @@ int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface, flo
const int h = w;
/*
- * Start generating the surface
+ * Start generating the surface
*/
printf("DynamicPaint: Preparing UV surface of %ix%i pixels and %i tris.\n", w, h, tottri);
@@ -2839,8 +2839,8 @@ int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface, flo
error = true;
/*
- * Generate a temporary bounding box array for UV faces to optimize
- * the pixel-inside-a-face search.
+ * Generate a temporary bounding box array for UV faces to optimize
+ * the pixel-inside-a-face search.
*/
if (!error) {
faceBB = MEM_mallocN(tottri * sizeof(*faceBB), "MPCanvasFaceBB");
@@ -2884,10 +2884,10 @@ int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface, flo
*do_update = true;
/*
- * Now loop through every pixel that was left without index
- * and find if they have neighboring pixels that have an index.
- * If so use that polygon as pixel surface.
- * (To avoid seams on uv island edges)
+ * Now loop through every pixel that was left without index
+ * and find if they have neighboring pixels that have an index.
+ * If so use that polygon as pixel surface.
+ * (To avoid seams on uv island edges)
*/
data.active_points = &active_points;
{
@@ -2903,7 +2903,7 @@ int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface, flo
*progress = 0.06f;
*do_update = true;
- /* Generate surface adjacency data. */
+ /* Generate surface adjacency data. */
{
int cursor = 0;
@@ -2987,9 +2987,9 @@ int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface, flo
}
#if 0
- /* -----------------------------------------------------------------
- * For debug, write a dump of adjacency data to a file.
- * -----------------------------------------------------------------*/
+ /* -----------------------------------------------------------------
+ * For debug, write a dump of adjacency data to a file.
+ * -----------------------------------------------------------------*/
FILE *dump_file = fopen("dynpaint-adj-data.txt", "w");
int *tmp = MEM_callocN(sizeof(int) * active_points, "tmp");
for (int ty = 0; ty < h; ty++) {
@@ -3080,20 +3080,20 @@ int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface, flo
dynamicPaint_allocateSurfaceType(surface);
#if 0
- /* -----------------------------------------------------------------
- * For debug, output pixel statuses to the color map
- * -----------------------------------------------------------------*/
+ /* -----------------------------------------------------------------
+ * For debug, output pixel statuses to the color map
+ * -----------------------------------------------------------------*/
for (index = 0; index < sData->total_points; index++) {
ImgSeqFormatData *f_data = (ImgSeqFormatData *)sData->format_data;
PaintUVPoint *uvPoint = &((PaintUVPoint *)f_data->uv_p)[index];
PaintPoint *pPoint = &((PaintPoint *)sData->type_data)[index];
pPoint->alpha = 1.0f;
- /* Every pixel that is assigned as "edge pixel" gets blue color */
+ /* Every pixel that is assigned as "edge pixel" gets blue color */
if (uvPoint->neighbour_pixel != -1)
pPoint->color[2] = 1.0f;
- /* and every pixel that finally got an polygon gets red color */
- /* green color shows pixel face index hash */
+ /* and every pixel that finally got an polygon gets red color */
+ /* green color shows pixel face index hash */
if (uvPoint->tri_index != -1) {
pPoint->color[0] = 1.0f;
pPoint->color[1] = (float)(uvPoint->tri_index % 255) / 256.0f;
@@ -3111,7 +3111,7 @@ int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface, flo
}
/*
- * Outputs an image file from uv surface data.
+ * Outputs an image file from uv surface data.
*/
typedef struct DynamicPaintOutputSurfaceImageData {
const DynamicPaintSurface *surface;
@@ -3135,7 +3135,7 @@ static void dynamic_paint_output_surface_image_paint_cb(
/* blend wet and dry layers */
blendColors(point->color, point->color[3], point->e_color, point->e_color[3], &ibuf->rect_float[pos]);
- /* Multiply color by alpha if enabled */
+ /* Multiply color by alpha if enabled */
if (surface->flags & MOD_DPAINT_MULALPHA) {
mul_v3_fl(&ibuf->rect_float[pos], ibuf->rect_float[pos + 3]);
}
@@ -3215,7 +3215,7 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char *filenam
{
ImBuf *ibuf = NULL;
PaintSurfaceData *sData = surface->data;
- /* OpenEXR or PNG */
+ /* OpenEXR or PNG */
int format = (surface->image_fileformat & MOD_DPAINT_IMGFORMAT_OPENEXR) ? R_IMF_IMTYPE_OPENEXR : R_IMF_IMTYPE_PNG;
char output_file[FILE_MAX];
@@ -3223,7 +3223,7 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char *filenam
setError(surface->canvas, N_("Image save failed: invalid surface"));
return;
}
- /* if selected format is openexr, but current build doesnt support one */
+ /* if selected format is openexr, but current build doesn't support one */
#ifndef WITH_OPENEXR
if (format == R_IMF_IMTYPE_OPENEXR)
format = R_IMF_IMTYPE_PNG;
@@ -3231,11 +3231,11 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char *filenam
BLI_strncpy(output_file, filename, sizeof(output_file));
BKE_image_path_ensure_ext_from_imtype(output_file, format);
- /* Validate output file path */
+ /* Validate output file path */
BLI_path_abs(output_file, BKE_main_blendfile_path_from_global());
BLI_make_existing_file(output_file);
- /* Init image buffer */
+ /* Init image buffer */
ibuf = IMB_allocImBuf(surface->image_resolution, surface->image_resolution, 32, IB_rectfloat);
if (ibuf == NULL) {
setError(surface->canvas, N_("Image save failed: not enough free memory"));
@@ -3396,7 +3396,7 @@ static void dynamicPaint_freeBrushMaterials(BrushMaterials *bMats)
}
/*
- * Get material diffuse color and alpha (including linked textures) in given coordinates
+ * Get material diffuse color and alpha (including linked textures) in given coordinates
*/
static void dynamicPaint_doMaterialTex(
const BrushMaterials *bMats, float color[3], float *alpha, Object *brushOb,
@@ -3432,7 +3432,7 @@ static void dynamicPaint_doMaterialTex(
/* A modified callback to bvh tree raycast. The tree must have been built using bvhtree_from_mesh_looptri.
* userdata must be a BVHMeshCallbackUserdata built from the same mesh as the tree.
*
- * To optimize brush detection speed this doesn't calculate hit coordinates or normal.
+ * To optimize brush detection speed this doesn't calculate hit coordinates or normal.
*/
static void mesh_tris_spherecast_dp(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit)
{
@@ -3505,7 +3505,7 @@ static void dynamicPaint_mixPaintColors(
{
PaintPoint *pPoint = &((PaintPoint *)surface->data->type_data)[index];
- /* Add paint */
+ /* Add paint */
if (!(paintFlags & MOD_DPAINT_ERASE)) {
float mix[4];
float temp_alpha = paintAlpha * ((paintFlags & MOD_DPAINT_ABS_ALPHA) ? 1.0f : timescale);
@@ -3516,7 +3516,7 @@ static void dynamicPaint_mixPaintColors(
/* mix wetness and alpha depending on selected alpha mode */
if (paintFlags & MOD_DPAINT_ABS_ALPHA) {
- /* update values to the brush level unless theyre higher already */
+ /* update values to the brush level unless they're higher already */
CLAMP_MIN(pPoint->e_color[3], paintAlpha);
CLAMP_MIN(pPoint->wetness, paintWetness);
}
@@ -3531,15 +3531,15 @@ static void dynamicPaint_mixPaintColors(
pPoint->state = DPAINT_PAINT_NEW;
}
- /* Erase paint */
+ /* Erase paint */
else {
float a_ratio, a_highest;
float wetness;
float invFact = 1.0f - paintAlpha;
/*
- * Make highest alpha to match erased value
- * but maintain alpha ratio
+ * Make highest alpha to match erased value
+ * but maintain alpha ratio
*/
if (paintFlags & MOD_DPAINT_ABS_ALPHA) {
a_highest = max_ff(pPoint->color[3], pPoint->e_color[3]);
@@ -3607,7 +3607,7 @@ static void dynamicPaint_mixWaveHeight(
}
/*
- * add brush results to the surface data depending on surface type
+ * add brush results to the surface data depending on surface type
*/
static void dynamicPaint_updatePointData(
const DynamicPaintSurface *surface, const int index, const DynamicPaintBrushSettings *brush,
@@ -3874,7 +3874,7 @@ typedef struct DynamicPaintPaintData {
} DynamicPaintPaintData;
/*
- * Paint a brush object mesh to the surface
+ * Paint a brush object mesh to the surface
*/
static void dynamic_paint_paint_mesh_cell_point_cb_ex(
void *__restrict userdata,
@@ -3921,7 +3921,7 @@ static void dynamic_paint_paint_mesh_cell_point_cb_ex(
if (samples > 1 && surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ)
total_sample = gaussianTotal;
- /* Supersampling */
+ /* Supersampling */
for (ss = 0; ss < samples; ss++) {
float ray_start[3], ray_dir[3];
float sample_factor = 0.0f;
@@ -3938,17 +3938,17 @@ static void dynamic_paint_paint_mesh_cell_point_cb_ex(
const bool inner_proximity = (brush->flags & MOD_DPAINT_INVERSE_PROX &&
brush->collision == MOD_DPAINT_COL_VOLDIST);
- /* hit data */
+ /* hit data */
float hitCoord[3];
int hitTri = -1;
- /* Supersampling factor */
+ /* Supersampling factor */
if (samples > 1 && surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ)
sample_factor = gaussianFactors[ss];
else
sample_factor = 1.0f;
- /* Get current sample position in world coordinates */
+ /* Get current sample position in world coordinates */
copy_v3_v3(ray_start, bData->realCoord[bData->s_pos[index] + ss].v);
copy_v3_v3(ray_dir, bData->bNormal[index].invNorm);
@@ -3960,13 +3960,13 @@ static void dynamic_paint_paint_mesh_cell_point_cb_ex(
nearest.index = -1;
nearest.dist_sq = brush_radius * brush_radius; /* find_nearest uses squared distance */
- /* Check volume collision */
+ /* Check volume collision */
if (ELEM(brush->collision, MOD_DPAINT_COL_VOLUME, MOD_DPAINT_COL_VOLDIST)) {
BLI_bvhtree_ray_cast(treeData->tree, ray_start, ray_dir, 0.0f, &hit, mesh_tris_spherecast_dp, treeData);
if (hit.index != -1) {
- /* We hit a triangle, now check if collision point normal is facing the point */
+ /* We hit a triangle, now check if collision point normal is facing the point */
- /* For optimization sake, hit point normal isn't calculated in ray cast loop */
+ /* For optimization sake, hit point normal isn't calculated in ray cast loop */
const int vtri[3] = {
mloop[mlooptri[hit.index].tri[0]].v,
mloop[mlooptri[hit.index].tri[1]].v,
@@ -3977,8 +3977,8 @@ static void dynamic_paint_paint_mesh_cell_point_cb_ex(
normal_tri_v3(hit.no, mvert[vtri[0]].co, mvert[vtri[1]].co, mvert[vtri[2]].co);
dot = dot_v3v3(ray_dir, hit.no);
- /* If ray and hit face normal are facing same direction
- * hit point is inside a closed mesh. */
+ /* If ray and hit face normal are facing same direction
+ * hit point is inside a closed mesh. */
if (dot >= 0.0f) {
const float dist = hit.dist;
const int f_index = hit.index;
@@ -3993,7 +3993,7 @@ static void dynamic_paint_paint_mesh_cell_point_cb_ex(
treeData->tree, ray_start, ray_dir, 0.0f, &hit, mesh_tris_spherecast_dp, treeData);
if (hit.index != -1) {
- /* Add factor on supersample filter */
+ /* Add factor on supersample filter */
volume_factor = 1.0f;
hit_found = HIT_VOLUME;
@@ -4006,7 +4006,7 @@ static void dynamic_paint_paint_mesh_cell_point_cb_ex(
}
}
- /* Check proximity collision */
+ /* Check proximity collision */
if (ELEM(brush->collision, MOD_DPAINT_COL_DIST, MOD_DPAINT_COL_VOLDIST) &&
(!hit_found || (brush->flags & MOD_DPAINT_INVERSE_PROX)))
{
@@ -4043,7 +4043,7 @@ static void dynamic_paint_paint_mesh_cell_point_cb_ex(
hit.index = -1;
hit.dist = brush_radius;
- /* Do a face normal directional raycast, and use that distance */
+ /* Do a face normal directional raycast, and use that distance */
BLI_bvhtree_ray_cast(
treeData->tree, ray_start, proj_ray, 0.0f, &hit, mesh_tris_spherecast_dp, treeData);
if (hit.index != -1) {
@@ -4053,7 +4053,7 @@ static void dynamic_paint_paint_mesh_cell_point_cb_ex(
}
}
- /* If a hit was found, calculate required values */
+ /* If a hit was found, calculate required values */
if (proxDist >= 0.0f && proxDist <= brush_radius) {
proximity_factor = proxDist / brush_radius;
CLAMP(proximity_factor, 0.0f, 1.0f);
@@ -4146,7 +4146,7 @@ static void dynamic_paint_paint_mesh_cell_point_cb_ex(
}
/*
- * Process hit color and alpha
+ * Process hit color and alpha
*/
if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) {
float sampleColor[3];
@@ -4156,14 +4156,14 @@ static void dynamic_paint_paint_mesh_cell_point_cb_ex(
sampleColor[1] = brush->g;
sampleColor[2] = brush->b;
- /* Get material+textures color on hit point if required */
+ /* Get material+textures color on hit point if required */
if (brush_usesMaterial(brush, scene)) {
dynamicPaint_doMaterialTex(bMats, sampleColor, &alpha_factor, brushOb,
bData->realCoord[bData->s_pos[index] + ss].v,
hitCoord, hitTri, dm);
}
- /* Sample proximity colorband if required */
+ /* Sample proximity colorband if required */
if ((hit_found == HIT_PROXIMITY) &&
(brush->proximity_falloff == MOD_DPAINT_PRFALL_RAMP))
{
@@ -4187,16 +4187,16 @@ static void dynamic_paint_paint_mesh_cell_point_cb_ex(
} // end supersampling
- /* if any sample was inside paint range */
+ /* if any sample was inside paint range */
if (brushStrength > 0.0f || depth > 0.0f) {
- /* apply supersampling results */
+ /* apply supersampling results */
if (samples > 1) {
brushStrength /= total_sample;
}
CLAMP(brushStrength, 0.0f, 1.0f);
if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) {
- /* Get final pixel color and alpha */
+ /* Get final pixel color and alpha */
paintColor[0] /= numOfHits;
paintColor[1] /= numOfHits;
paintColor[2] /= numOfHits;
@@ -4248,9 +4248,9 @@ static int dynamicPaint_paintMesh(Main *bmain,
mloop = dm->getLoopArray(dm);
numOfVerts = dm->getNumVerts(dm);
- /* Transform collider vertices to global space
- * (Faster than transforming per surface point
- * coordinates and normals to object space) */
+ /* Transform collider vertices to global space
+ * (Faster than transforming per surface point
+ * coordinates and normals to object space) */
for (ii = 0; ii < numOfVerts; ii++) {
mul_m4_v3(brushOb->obmat, mvert[ii].co);
boundInsert(&mesh_bb, mvert[ii].co);
@@ -4276,7 +4276,7 @@ static int dynamicPaint_paintMesh(Main *bmain,
/* check bounding box collision */
if (grid && meshBrush_boundsIntersect(&grid->grid_bounds, &mesh_bb, brush, brush_radius)) {
- /* Build a bvh tree from transformed vertices */
+ /* Build a bvh tree from transformed vertices */
if (bvhtree_from_mesh_get(&treeData, dm, BVHTREE_FROM_LOOPTRI, 4)) {
int c_index;
int total_cells = grid->dim[0] * grid->dim[1] * grid->dim[2];
@@ -4323,7 +4323,7 @@ static int dynamicPaint_paintMesh(Main *bmain,
}
/*
- * Paint a particle system to the surface
+ * Paint a particle system to the surface
*/
static void dynamic_paint_paint_particle_cell_point_cb_ex(
void *__restrict userdata,
@@ -4358,14 +4358,14 @@ static void dynamic_paint_paint_particle_cell_point_cb_ex(
int part_index = -1;
/*
- * With predefined radius, there is no variation between particles.
- * It's enough to just find the nearest one.
+ * With predefined radius, there is no variation between particles.
+ * It's enough to just find the nearest one.
*/
{
KDTreeNearest nearest;
float smooth_range, part_solidradius;
- /* Find nearest particle and get distance to it */
+ /* Find nearest particle and get distance to it */
BLI_kdtree_find_nearest(tree, bData->realCoord[bData->s_pos[index]].v, &nearest);
/* if outside maximum range, no other particle can influence either */
if (nearest.dist > range)
@@ -4381,9 +4381,9 @@ static void dynamic_paint_paint_particle_cell_point_cb_ex(
}
radius = part_solidradius + smooth;
if (nearest.dist < radius) {
- /* distances inside solid radius has maximum influence -> dist = 0 */
+ /* distances inside solid radius has maximum influence -> dist = 0 */
smooth_range = max_ff(0.0f, (nearest.dist - part_solidradius));
- /* do smoothness if enabled */
+ /* do smoothness if enabled */
if (smooth)
smooth_range /= smooth;
@@ -4392,11 +4392,11 @@ static void dynamic_paint_paint_particle_cell_point_cb_ex(
part_index = nearest.index;
}
}
- /* If using random per particle radius and closest particle didn't give max influence */
+ /* If using random per particle radius and closest particle didn't give max influence */
if (brush->flags & MOD_DPAINT_PART_RAD && strength < 1.0f && psys->part->randsize > 0.0f) {
/*
- * If we use per particle radius, we have to sample all particles
- * within max radius range
+ * If we use per particle radius, we have to sample all particles
+ * within max radius range
*/
KDTreeNearest *nearest;
@@ -4444,13 +4444,13 @@ static void dynamic_paint_paint_particle_cell_point_cb_ex(
radius = rad;
}
- /* do smoothness if enabled */
+ /* do smoothness if enabled */
CLAMP_MIN(smooth_range, 0.0f);
if (smooth)
smooth_range /= smooth;
const float str = 1.0f - smooth_range;
- /* if influence is greater, use this one */
+ /* if influence is greater, use this one */
if (str > strength)
strength = str;
}
@@ -4485,7 +4485,7 @@ static void dynamic_paint_paint_particle_cell_point_cb_ex(
copy_v3_v3(paintColor, &brush->r);
}
else if (ELEM(surface->type, MOD_DPAINT_SURFACE_T_DISPLACE, MOD_DPAINT_SURFACE_T_WAVE)) {
- /* get displace depth */
+ /* get displace depth */
disp_intersect = (1.0f - sqrtf(disp_intersect / radius)) * radius;
depth = max_ff(0.0f, (radius - disp_intersect) / bData->bNormal[index].normal_scale);
}
@@ -4521,14 +4521,14 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
return 1;
/*
- * Build a kd-tree to optimize distance search
+ * Build a kd-tree to optimize distance search
*/
tree = BLI_kdtree_new(psys->totpart);
/* loop through particles and insert valid ones to the tree */
p = 0;
for (ParticleData *pa = psys->particles; p < psys->totpart; p++, pa++) {
- /* Proceed only if particle is active */
+ /* Proceed only if particle is active */
if ((pa->alive == PARS_UNBORN && (part->flag & PART_UNBORN) == 0) ||
(pa->alive == PARS_DEAD && (part->flag & PART_DIED) == 0) ||
(pa->flag & PARS_UNEXIST))
@@ -4536,8 +4536,8 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
continue;
}
- /* for debug purposes check if any NAN particle proceeds
- * For some reason they get past activity check, this should rule most of them out */
+ /* for debug purposes check if any NAN particle proceeds
+ * For some reason they get past activity check, this should rule most of them out */
if (isnan(pa->state.co[0]) || isnan(pa->state.co[1]) || isnan(pa->state.co[2])) {
invalidParticles++;
continue;
@@ -4557,7 +4557,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
if (invalidParticles)
printf("Warning: Invalid particle(s) found!\n");
- /* If no suitable particles were found, exit */
+ /* If no suitable particles were found, exit */
if (particlesAdded < 1) {
BLI_kdtree_free(tree);
return 1;
@@ -4571,7 +4571,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
int c_index;
int total_cells = grid->dim[0] * grid->dim[1] * grid->dim[2];
- /* balance tree */
+ /* balance tree */
BLI_kdtree_balance(tree);
/* loop through space partitioning grid */
@@ -4637,7 +4637,7 @@ static void dynamic_paint_paint_single_point_cb_ex(
if (distance > brush_radius)
return;
- /* Smooth range or color ramp */
+ /* Smooth range or color ramp */
if (brush->proximity_falloff == MOD_DPAINT_PRFALL_SMOOTH ||
brush->proximity_falloff == MOD_DPAINT_PRFALL_RAMP)
{
@@ -4709,7 +4709,7 @@ static void dynamic_paint_paint_single_point_cb_ex(
}
}
else if (ELEM(surface->type, MOD_DPAINT_SURFACE_T_DISPLACE, MOD_DPAINT_SURFACE_T_WAVE)) {
- /* get displace depth */
+ /* get displace depth */
const float disp_intersect = (1.0f - sqrtf((brush_radius - distance) / brush_radius)) * brush_radius;
depth = max_ff(0.0f, (brush_radius - disp_intersect) / bData->bNormal[index].normal_scale);
}
@@ -4731,7 +4731,7 @@ static int dynamicPaint_paintSinglePoint(
const MVert *mvert = brush->dm->getVertArray(brush->dm);
/*
- * Loop through every surface point
+ * Loop through every surface point
*/
DynamicPaintPaintData data = {
.surface = surface,
@@ -4756,7 +4756,7 @@ static int dynamicPaint_paintSinglePoint(
/***************************** Dynamic Paint Step / Baking ******************************/
/*
- * Calculate current frame distances and directions for adjacency data
+ * Calculate current frame distances and directions for adjacency data
*/
static void dynamic_paint_prepare_adjacency_cb(
@@ -4991,8 +4991,8 @@ typedef struct DynamicPaintEffectData {
} DynamicPaintEffectData;
/*
- * Prepare data required by effects for current frame.
- * Returns number of steps required
+ * Prepare data required by effects for current frame.
+ * Returns number of steps required
*/
static void dynamic_paint_prepare_effect_cb(
void *__restrict userdata,
@@ -5105,7 +5105,7 @@ static int dynamicPaint_prepareEffectStep(
}
/**
- * Processes active effect step.
+ * Processes active effect step.
*/
static void dynamic_paint_effect_spread_cb(
void *__restrict userdata,
@@ -5129,7 +5129,7 @@ static void dynamic_paint_effect_spread_cb(
const int *n_index = sData->adj_data->n_index;
const int *n_target = sData->adj_data->n_target;
- /* Loop through neighboring points */
+ /* Loop through neighboring points */
for (int i = 0; i < numOfNeighs; i++) {
const int n_idx = n_index[index] + i;
float w_factor;
@@ -5178,7 +5178,7 @@ static void dynamic_paint_effect_shrink_cb(
const int *n_index = sData->adj_data->n_index;
const int *n_target = sData->adj_data->n_target;
- /* Loop through neighboring points */
+ /* Loop through neighboring points */
for (int i = 0; i < numOfNeighs; i++) {
const int n_idx = n_index[index] + i;
const float speed_scale = (bNeighs[n_idx].dist < eff_scale) ? 1.0f : eff_scale / bNeighs[n_idx].dist;
@@ -5333,12 +5333,12 @@ static void dynamicPaint_doEffectStep(
return;
/*
- * Spread Effect
+ * Spread Effect
*/
if (surface->effect & MOD_DPAINT_EFFECT_DO_SPREAD) {
const float eff_scale = distance_scale * EFF_MOVEMENT_PER_FRAME * surface->spread_speed * timescale;
- /* Copy current surface to the previous points array to read unmodified values */
+ /* Copy current surface to the previous points array to read unmodified values */
memcpy(prevPoint, sData->type_data, sData->total_points * sizeof(struct PaintPoint));
DynamicPaintEffectData data = {
@@ -5354,12 +5354,12 @@ static void dynamicPaint_doEffectStep(
}
/*
- * Shrink Effect
+ * Shrink Effect
*/
if (surface->effect & MOD_DPAINT_EFFECT_DO_SHRINK) {
const float eff_scale = distance_scale * EFF_MOVEMENT_PER_FRAME * surface->shrink_speed * timescale;
- /* Copy current surface to the previous points array to read unmodified values */
+ /* Copy current surface to the previous points array to read unmodified values */
memcpy(prevPoint, sData->type_data, sData->total_points * sizeof(struct PaintPoint));
DynamicPaintEffectData data = {
@@ -5375,7 +5375,7 @@ static void dynamicPaint_doEffectStep(
}
/*
- * Drip Effect
+ * Drip Effect
*/
if (surface->effect & MOD_DPAINT_EFFECT_DO_DRIP && force) {
const float eff_scale = distance_scale * EFF_MOVEMENT_PER_FRAME * timescale / 2.0f;
@@ -5384,7 +5384,7 @@ static void dynamicPaint_doEffectStep(
const size_t point_locks_size = (sData->total_points / 8) + 1;
uint8_t *point_locks = MEM_callocN(sizeof(*point_locks) * point_locks_size, __func__);
- /* Copy current surface to the previous points array to read unmodified values */
+ /* Copy current surface to the previous points array to read unmodified values */
memcpy(prevPoint, sData->type_data, sData->total_points * sizeof(struct PaintPoint));
DynamicPaintEffectData data = {
@@ -5573,7 +5573,7 @@ static void dynamic_paint_wave_step_cb(
}
if (data->reset_wave) {
- /* if there wasnt any brush intersection, clear isect height */
+ /* if there wasn't any brush intersection, clear isect height */
if (wPoint->state == DPAINT_WAVE_NONE) {
wPoint->brush_isect = 0.0f;
}
@@ -5685,7 +5685,7 @@ static void dynamic_paint_surface_pre_step_cb(
dry_ratio = pPoint->wetness / p_wetness;
/*
- * Slowly "shift" paint from wet layer to dry layer as it drys:
+ * Slowly "shift" paint from wet layer to dry layer as it drys:
*/
/* make sure alpha values are within proper range */
CLAMP(pPoint->color[3], 0.0f, 1.0f);
@@ -5699,7 +5699,7 @@ static void dynamic_paint_surface_pre_step_cb(
/* now calculate new alpha for dry layer that keeps final blended color unchanged */
pPoint->color[3] = (f_color[3] - pPoint->e_color[3]) / (1.0f - pPoint->e_color[3]);
/* for each rgb component, calculate a new dry layer color that keeps the final blend color
- * with these new alpha values. (wet layer color doesnt change)*/
+ * with these new alpha values. (wet layer color doesn't change)*/
if (pPoint->color[3]) {
for (i = 0; i < 3; i++) {
pPoint->color[i] = (f_color[i] * f_color[3] - pPoint->e_color[i] * pPoint->e_color[3]) /
@@ -5810,7 +5810,7 @@ static void dynamic_paint_generate_bake_data_cb(
}
/*
- * Calculate current 3D-position and normal of each surface point
+ * Calculate current 3D-position and normal of each surface point
*/
if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) {
float n1[3], n2[3], n3[3];
@@ -5829,7 +5829,7 @@ static void dynamic_paint_generate_bake_data_cb(
f_data->barycentricWeights[index * bData->s_num[index] + ss].v);
}
- /* Calculate current pixel surface normal */
+ /* Calculate current pixel surface normal */
normal_short_to_float_v3(n1, mvert[tPoint->v1].no);
normal_short_to_float_v3(n2, mvert[tPoint->v2].no);
normal_short_to_float_v3(n3, mvert[tPoint->v3].no);
@@ -5972,7 +5972,7 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, const Sce
}
/*
- * Make a transformed copy of canvas derived mesh vertices to avoid recalculation.
+ * Make a transformed copy of canvas derived mesh vertices to avoid recalculation.
*/
bData->mesh_bounds.valid = false;
for (index = 0; index < canvasNumOfVerts; index++) {
@@ -5982,7 +5982,7 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, const Sce
}
/*
- * Prepare each surface point for a new step
+ * Prepare each surface point for a new step
*/
DynamicPaintGenerateBakeData data = {
.surface = surface, .ob = ob,
@@ -6079,11 +6079,11 @@ static int dynamicPaint_doStep(
continue;
}
- /* check if target has an active dp modifier */
+ /* check if target has an active dp modifier */
md = modifiers_findByType(brushObj, eModifierType_DynamicPaint);
if (md && md->mode & (eModifierMode_Realtime | eModifierMode_Render)) {
DynamicPaintModifierData *pmd2 = (DynamicPaintModifierData *)md;
- /* make sure we're dealing with a brush */
+ /* make sure we're dealing with a brush */
if (pmd2->brush) {
DynamicPaintBrushSettings *brush = pmd2->brush;
BrushMaterials bMats = {NULL};
@@ -6104,7 +6104,7 @@ static int dynamicPaint_doStep(
BKE_object_modifier_update_subframe(bmain, eval_ctx, scene, brushObj, true, SUBFRAME_RECURSION,
BKE_scene_frame_get(scene), eModifierType_DynamicPaint);
}
- /* Prepare materials if required */
+ /* Prepare materials if required */
if (brush_usesMaterial(brush, scene))
dynamicPaint_updateBrushMaterials(brushObj, brush->mat, scene, &bMats);
@@ -6167,7 +6167,7 @@ static int dynamicPaint_doStep(
PaintPoint *prevPoint;
float *force = NULL;
- /* Allocate memory for surface previous points to read unchanged values from */
+ /* Allocate memory for surface previous points to read unchanged values from */
prevPoint = MEM_mallocN(sData->total_points * sizeof(struct PaintPoint), "PaintSurfaceDataCopy");
if (!prevPoint)
return setError(canvas, N_("Not enough free memory"));
@@ -6178,7 +6178,7 @@ static int dynamicPaint_doStep(
dynamicPaint_doEffectStep(surface, force, prevPoint, timescale, (float)steps);
}
- /* Free temporary effect data */
+ /* Free temporary effect data */
if (prevPoint)
MEM_freeN(prevPoint);
if (force)
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index fa4e4372273..db9ce6c9b7d 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -229,7 +229,7 @@ static void emDM_calcLoopNormalsSpaceArray(
r_lnors_spacearr->lspacearr[i]->ref_beta, r_lnors_spacearr->lspacearr[i]->loops);
printf("\t\t(shared with loops");
while (loops) {
- printf(" %d", GET_INT_FROM_POINTER(loops->link));
+ printf(" %d", POINTER_AS_INT(loops->link));
loops = loops->next;
}
printf(")\n");
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 89f85530439..82bf65993a8 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -56,7 +56,7 @@
#include "PIL_time.h"
-#include "BKE_anim.h" /* needed for where_on_path */
+#include "BKE_anim.h" /* needed for where_on_path */
#include "BKE_collision.h"
#include "BKE_curve.h"
#include "BKE_displist.h"
@@ -87,8 +87,9 @@ EffectorWeights *BKE_add_effector_weights(Group *group)
EffectorWeights *weights = MEM_callocN(sizeof(EffectorWeights), "EffectorWeights");
int i;
- for (i=0; i<NUM_PFIELD_TYPES; i++)
+ for (i = 0; i < NUM_PFIELD_TYPES; i++) {
weights->weight[i] = 1.0f;
+ }
weights->global_gravity = 1.0f;
@@ -100,13 +101,13 @@ PartDeflect *object_add_collision_fields(int type)
{
PartDeflect *pd;
- pd= MEM_callocN(sizeof(PartDeflect), "PartDeflect");
+ pd = MEM_callocN(sizeof(PartDeflect), "PartDeflect");
pd->forcefield = type;
pd->pdef_sbdamp = 0.1f;
pd->pdef_sbift = 0.2f;
pd->pdef_sboft = 0.02f;
- pd->seed = ((unsigned int)(ceil(PIL_check_seconds_timer()))+1) % 128;
+ pd->seed = ((uint)(ceil(PIL_check_seconds_timer())) + 1) % 128;
pd->f_strength = 1.0f;
pd->f_damp = 1.0f;
@@ -126,7 +127,7 @@ PartDeflect *object_add_collision_fields(int type)
pd->f_flow = 1.0f;
break;
}
- pd->flag = PFIELD_DO_LOCATION|PFIELD_DO_ROTATION;
+ pd->flag = PFIELD_DO_LOCATION | PFIELD_DO_ROTATION;
return pd;
}
@@ -136,12 +137,12 @@ PartDeflect *object_add_collision_fields(int type)
/* -------------------------- Effectors ------------------ */
void free_partdeflect(PartDeflect *pd)
{
- if (!pd)
+ if (!pd) {
return;
-
- if (pd->rng)
+ }
+ if (pd->rng) {
BLI_rng_free(pd->rng);
-
+ }
MEM_freeN(pd);
}
@@ -159,15 +160,18 @@ static void add_object_to_effectors(ListBase **effectors, Scene *scene, Effector
{
EffectorCache *eff = NULL;
- if ( ob == ob_src )
+ if (ob == ob_src) {
return;
+ }
if (for_simulation) {
- if (weights->weight[ob->pd->forcefield] == 0.0f )
+ if (weights->weight[ob->pd->forcefield] == 0.0f) {
return;
+ }
- if (ob->pd->shape == PFIELD_SHAPE_POINTS && !ob->derivedFinal )
+ if (ob->pd->shape == PFIELD_SHAPE_POINTS && !ob->derivedFinal) {
return;
+ }
}
if (*effectors == NULL)
@@ -182,72 +186,70 @@ static void add_object_to_effectors(ListBase **effectors, Scene *scene, Effector
}
static void add_particles_to_effectors(ListBase **effectors, Scene *scene, EffectorWeights *weights, Object *ob, ParticleSystem *psys, ParticleSystem *psys_src, bool for_simulation)
{
- ParticleSettings *part= psys->part;
+ ParticleSettings *part = psys->part;
- if ( !psys_check_enabled(ob, psys, G.is_rendering) )
+ if (!psys_check_enabled(ob, psys, G.is_rendering)) {
return;
-
- if ( psys == psys_src && (part->flag & PART_SELF_EFFECT) == 0)
+ }
+ if (psys == psys_src && (part->flag & PART_SELF_EFFECT) == 0) {
return;
-
- if ( part->pd && part->pd->forcefield && (!for_simulation || weights->weight[part->pd->forcefield] != 0.0f)) {
- if (*effectors == NULL)
+ }
+ if (part->pd && part->pd->forcefield && (!for_simulation || weights->weight[part->pd->forcefield] != 0.0f)) {
+ if (*effectors == NULL) {
*effectors = MEM_callocN(sizeof(ListBase), "effectors list");
-
+ }
BLI_addtail(*effectors, new_effector_cache(scene, ob, psys, part->pd));
}
if (part->pd2 && part->pd2->forcefield && (!for_simulation || weights->weight[part->pd2->forcefield] != 0.0f)) {
- if (*effectors == NULL)
+ if (*effectors == NULL) {
*effectors = MEM_callocN(sizeof(ListBase), "effectors list");
-
+ }
BLI_addtail(*effectors, new_effector_cache(scene, ob, psys, part->pd2));
}
}
/* returns ListBase handle with objects taking part in the effecting */
-ListBase *pdInitEffectors(Scene *scene, Object *ob_src, ParticleSystem *psys_src,
- EffectorWeights *weights, bool for_simulation)
+ListBase *pdInitEffectors(
+ Scene *scene, Object *ob_src, ParticleSystem *psys_src,
+ EffectorWeights *weights, bool for_simulation)
{
- Base *base;
- unsigned int layer= ob_src->lay;
+ const uint layer = ob_src->lay;
ListBase *effectors = NULL;
if (weights->group) {
- GroupObject *go;
-
- for (go= weights->group->gobject.first; go; go= go->next) {
- if ( (go->ob->lay & layer) ) {
- if ( go->ob->pd && go->ob->pd->forcefield )
+ for (GroupObject *go = weights->group->gobject.first; go; go = go->next) {
+ if ((go->ob->lay & layer)) {
+ if (go->ob->pd && go->ob->pd->forcefield) {
add_object_to_effectors(&effectors, scene, weights, go->ob, ob_src, for_simulation);
+ }
- if ( go->ob->particlesystem.first ) {
- ParticleSystem *psys= go->ob->particlesystem.first;
-
- for ( ; psys; psys=psys->next )
+ if (go->ob->particlesystem.first) {
+ for (ParticleSystem *psys = go->ob->particlesystem.first; psys; psys = psys->next) {
add_particles_to_effectors(&effectors, scene, weights, go->ob, psys, psys_src, for_simulation);
+ }
}
}
}
}
else {
- for (base = scene->base.first; base; base= base->next) {
- if ( (base->lay & layer) ) {
- if ( base->object->pd && base->object->pd->forcefield )
+ for (Base *base = scene->base.first; base; base = base->next) {
+ if ((base->lay & layer)) {
+ if (base->object->pd && base->object->pd->forcefield) {
add_object_to_effectors(&effectors, scene, weights, base->object, ob_src, for_simulation);
-
- if ( base->object->particlesystem.first ) {
- ParticleSystem *psys= base->object->particlesystem.first;
-
- for ( ; psys; psys=psys->next )
+ }
+ if (base->object->particlesystem.first) {
+ for (ParticleSystem *psys = base->object->particlesystem.first; psys; psys = psys->next) {
add_particles_to_effectors(&effectors, scene, weights, base->object, psys, psys_src, for_simulation);
+ }
}
}
}
}
- if (for_simulation)
+ if (for_simulation) {
pdPrecalculateEffectors(effectors);
+ }
return effectors;
}
@@ -255,11 +257,10 @@ ListBase *pdInitEffectors(Scene *scene, Object *ob_src, ParticleSystem *psys_src
void pdEndEffectors(ListBase **effectors)
{
if (*effectors) {
- EffectorCache *eff = (*effectors)->first;
-
- for (; eff; eff=eff->next) {
- if (eff->guide_data)
+ for (EffectorCache *eff = (*effectors)->first; eff; eff = eff->next) {
+ if (eff->guide_data) {
MEM_freeN(eff->guide_data);
+ }
}
BLI_freelistN(*effectors);
@@ -270,17 +271,23 @@ void pdEndEffectors(ListBase **effectors)
static void precalculate_effector(EffectorCache *eff)
{
- unsigned int cfra = (unsigned int)(eff->scene->r.cfra >= 0 ? eff->scene->r.cfra : -eff->scene->r.cfra);
- if (!eff->pd->rng)
+ uint cfra = (uint)(eff->scene->r.cfra >= 0 ? eff->scene->r.cfra : -eff->scene->r.cfra);
+ if (!eff->pd->rng) {
eff->pd->rng = BLI_rng_new(eff->pd->seed + cfra);
- else
+ }
+ else {
BLI_rng_srandom(eff->pd->rng, eff->pd->seed + cfra);
+ }
- if (eff->pd->forcefield == PFIELD_GUIDE && eff->ob->type==OB_CURVE) {
- Curve *cu= eff->ob->data;
+ if (eff->pd->forcefield == PFIELD_GUIDE && eff->ob->type == OB_CURVE) {
+ Curve *cu = eff->ob->data;
if (cu->flag & CU_PATH) {
- if (eff->ob->curve_cache == NULL || eff->ob->curve_cache->path==NULL || eff->ob->curve_cache->path->data==NULL)
+ if ((eff->ob->curve_cache == NULL) ||
+ (eff->ob->curve_cache->path == NULL) ||
+ (eff->ob->curve_cache->path->data == NULL))
+ {
BKE_displist_make_curveTypes(eff->scene, eff->ob, 0);
+ }
if (eff->ob->curve_cache->path && eff->ob->curve_cache->path->data) {
where_on_path(eff->ob, 0.0, eff->guide_loc, eff->guide_dir, NULL, &eff->guide_radius, NULL);
@@ -290,12 +297,14 @@ static void precalculate_effector(EffectorCache *eff)
}
}
else if (eff->pd->shape == PFIELD_SHAPE_SURFACE) {
- eff->surmd = (SurfaceModifierData *)modifiers_findByType( eff->ob, eModifierType_Surface );
- if (eff->ob->type == OB_CURVE)
+ eff->surmd = (SurfaceModifierData *)modifiers_findByType(eff->ob, eModifierType_Surface);
+ if (eff->ob->type == OB_CURVE) {
eff->flag |= PE_USE_NORMAL_DATA;
+ }
}
- else if (eff->psys)
+ else if (eff->psys) {
psys_update_particle_tree(eff->psys, eff->scene->r.cfra);
+ }
/* Store object velocity */
if (eff->ob) {
@@ -311,9 +320,9 @@ static void precalculate_effector(EffectorCache *eff)
void pdPrecalculateEffectors(ListBase *effectors)
{
if (effectors) {
- EffectorCache *eff = effectors->first;
- for (; eff; eff=eff->next)
+ for (EffectorCache *eff = effectors->first; eff; eff = eff->next) {
precalculate_effector(eff);
+ }
}
}
@@ -400,14 +409,15 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect
float norm[3], len = 0.0;
float visibility = 1.0, absorption = 0.0;
- if (!(eff->pd->flag & PFIELD_VISIBILITY))
+ if (!(eff->pd->flag & PFIELD_VISIBILITY)) {
return visibility;
-
- if (!colls)
+ }
+ if (!colls) {
colls = get_collider_cache(eff->scene, eff->ob, NULL);
-
- if (!colls)
+ }
+ if (!colls) {
return visibility;
+ }
negate_v3_v3(norm, efd->vec_to_point);
len = normalize_v3(norm);
@@ -416,9 +426,9 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect
for (col = colls->first; col; col = col->next) {
CollisionModifierData *collmd = col->collmd;
- if (col->ob == eff->ob)
+ if (col->ob == eff->ob) {
continue;
-
+ }
if (collmd->bvhtree) {
BVHTreeRayHit hit;
@@ -430,13 +440,14 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect
collmd->bvhtree, point->loc, norm, 0.0f, &hit,
eff_tri_ray_hit, NULL, raycast_flag) != -1)
{
- absorption= col->ob->pd->absorption;
+ absorption = col->ob->pd->absorption;
/* visibility is only between 0 and 1, calculated from 1-absorption */
- visibility *= CLAMPIS(1.0f-absorption, 0.0f, 1.0f);
+ visibility *= CLAMPIS(1.0f - absorption, 0.0f, 1.0f);
- if (visibility <= 0.0f)
+ if (visibility <= 0.0f) {
break;
+ }
}
}
}
@@ -450,14 +461,15 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect
// noise function for wind e.g.
static float wind_func(struct RNG *rng, float strength)
{
- int random = (BLI_rng_get_int(rng)+1) % 128; // max 2357
+ int random = (BLI_rng_get_int(rng) + 1) % 128; /* max 2357 */
float force = BLI_rng_get_float(rng) + 1.0f;
float ret;
float sign = 0;
- sign = ((float)random > 64.0f) ? 1.0f: -1.0f; // dividing by 2 is not giving equal sign distribution
+ /* Dividing by 2 is not giving equal sign distribution. */
+ sign = ((float)random > 64.0f) ? 1.0f : -1.0f;
- ret = sign*((float)random / force)*strength/128.0f;
+ ret = sign * ((float)random / force) * strength / 128.0f;
return ret;
}
@@ -477,17 +489,17 @@ static float falloff_func(float fac, int usemin, float mindist, int usemax, floa
if (!usemin)
mindist = 0.0;
- return pow((double)(1.0f+fac-mindist), (double)(-power));
+ return pow((double)(1.0f + fac - mindist), (double)(-power));
}
static float falloff_func_dist(PartDeflect *pd, float fac)
{
- return falloff_func(fac, pd->flag&PFIELD_USEMIN, pd->mindist, pd->flag&PFIELD_USEMAX, pd->maxdist, pd->f_power);
+ return falloff_func(fac, pd->flag & PFIELD_USEMIN, pd->mindist, pd->flag & PFIELD_USEMAX, pd->maxdist, pd->f_power);
}
static float falloff_func_rad(PartDeflect *pd, float fac)
{
- return falloff_func(fac, pd->flag&PFIELD_USEMINR, pd->minrad, pd->flag&PFIELD_USEMAXR, pd->maxrad, pd->f_power_r);
+ return falloff_func(fac, pd->flag & PFIELD_USEMINR, pd->minrad, pd->flag & PFIELD_USEMAXR, pd->maxrad, pd->f_power_r);
}
float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNUSED(point), EffectorWeights *weights)
@@ -499,31 +511,31 @@ float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNU
fac = dot_v3v3(efd->nor, efd->vec_to_point2);
if (eff->pd->zdir == PFIELD_Z_POS && fac < 0.0f)
- falloff=0.0f;
+ falloff = 0.0f;
else if (eff->pd->zdir == PFIELD_Z_NEG && fac > 0.0f)
- falloff=0.0f;
+ falloff = 0.0f;
else {
switch (eff->pd->falloff) {
case PFIELD_FALL_SPHERE:
- falloff*= falloff_func_dist(eff->pd, efd->distance);
+ falloff *= falloff_func_dist(eff->pd, efd->distance);
break;
case PFIELD_FALL_TUBE:
- falloff*= falloff_func_dist(eff->pd, ABS(fac));
+ falloff *= falloff_func_dist(eff->pd, ABS(fac));
if (falloff == 0.0f)
break;
madd_v3_v3v3fl(temp, efd->vec_to_point2, efd->nor, -fac);
- r_fac= len_v3(temp);
- falloff*= falloff_func_rad(eff->pd, r_fac);
+ r_fac = len_v3(temp);
+ falloff *= falloff_func_rad(eff->pd, r_fac);
break;
case PFIELD_FALL_CONE:
- falloff*= falloff_func_dist(eff->pd, ABS(fac));
+ falloff *= falloff_func_dist(eff->pd, ABS(fac));
if (falloff == 0.0f)
break;
- r_fac= RAD2DEGF(saacos(fac/len_v3(efd->vec_to_point)));
- falloff*= falloff_func_rad(eff->pd, r_fac);
+ r_fac = RAD2DEGF(saacos(fac / len_v3(efd->vec_to_point)));
+ falloff *= falloff_func_rad(eff->pd, r_fac);
break;
}
@@ -570,7 +582,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
/* In case surface object is in Edit mode when loading the .blend, surface modifier is never executed
* and bvhtree never built, see T48415. */
- if (eff->pd && eff->pd->shape==PFIELD_SHAPE_SURFACE && eff->surmd && eff->surmd->bvhtree) {
+ if (eff->pd && eff->pd->shape == PFIELD_SHAPE_SURFACE && eff->surmd && eff->surmd->bvhtree) {
/* closest point in the object surface is an effector */
float vec[3];
@@ -583,7 +595,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
efd->size = 0.0f;
}
- else if (eff->pd && eff->pd->shape==PFIELD_SHAPE_POINTS) {
+ else if (eff->pd && eff->pd->shape == PFIELD_SHAPE_POINTS) {
if (eff->ob->derivedFinal) {
DerivedMesh *dm = eff->ob->derivedFinal;
@@ -611,10 +623,10 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
/* pass */
}
else {
- ParticleSimulationData sim= {NULL};
- sim.scene= eff->scene;
- sim.ob= eff->ob;
- sim.psys= eff->psys;
+ ParticleSimulationData sim = {NULL};
+ sim.scene = eff->scene;
+ sim.ob = eff->ob;
+ sim.psys = eff->psys;
/* TODO: time from actual previous calculated frame (step might not be 1) */
state.time = cfra - 1.0f;
@@ -633,9 +645,9 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
efd->nor[1] = efd->nor[2] = 0.f;
mul_qt_v3(state.rot, efd->nor);
- if (real_velocity)
+ if (real_velocity) {
copy_v3_v3(efd->vel, state.vel);
-
+ }
efd->size = pa->size;
}
}
@@ -652,18 +664,20 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
project_v3_v3v3(translate, temp, efd->nor);
/* for vortex the shape chooses between old / new force */
- if (eff->pd->forcefield == PFIELD_VORTEX)
+ if (eff->pd->forcefield == PFIELD_VORTEX) {
add_v3_v3v3(efd->loc, ob->obmat[3], translate);
- else /* normally efd->loc is closest point on effector xy-plane */
+ }
+ else { /* normally efd->loc is closest point on effector xy-plane */
sub_v3_v3v3(efd->loc, point->loc, translate);
+ }
}
else {
copy_v3_v3(efd->loc, ob->obmat[3]);
}
- if (real_velocity)
+ if (real_velocity) {
copy_v3_v3(efd->vel, eff->velocity);
-
+ }
efd->size = 0.0f;
ret = 1;
@@ -675,7 +689,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
/* rest length for harmonic effector, will have to see later if this could be extended to other effectors */
if (eff->pd && eff->pd->forcefield == PFIELD_HARMONIC && eff->pd->f_size)
- mul_v3_fl(efd->vec_to_point, (efd->distance-eff->pd->f_size)/efd->distance);
+ mul_v3_fl(efd->vec_to_point, (efd->distance - eff->pd->f_size) / efd->distance);
if (eff->flag & PE_USE_NORMAL_DATA) {
copy_v3_v3(efd->vec_to_point2, efd->vec_to_point);
@@ -700,7 +714,7 @@ static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoin
if (*tot && eff->pd->forcefield == PFIELD_HARMONIC && point->index >= 0) {
*p = point->index % *tot;
- *tot = *p+1;
+ *tot = *p + 1;
}
}
else if (eff->psys) {
@@ -715,17 +729,17 @@ static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoin
*/
efd->charge = eff->pd->f_strength;
}
- else if (eff->pd->forcefield == PFIELD_HARMONIC && (eff->pd->flag & PFIELD_MULTIPLE_SPRINGS)==0) {
+ else if (eff->pd->forcefield == PFIELD_HARMONIC && (eff->pd->flag & PFIELD_MULTIPLE_SPRINGS) == 0) {
/* every particle is mapped to only one harmonic effector particle */
- *p= point->index % eff->psys->totpart;
- *tot= *p + 1;
+ *p = point->index % eff->psys->totpart;
+ *tot = *p + 1;
}
if (eff->psys->part->effector_amount) {
int totpart = eff->psys->totpart;
int amount = eff->psys->part->effector_amount;
- *step = (totpart > amount) ? totpart/amount : 1;
+ *step = (totpart > amount) ? totpart / amount : 1;
}
}
else {
@@ -746,7 +760,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
result[0].nor = result[1].nor = result[2].nor = result[3].nor = NULL;
- strength= eff->pd->f_strength * efd->falloff;
+ strength = eff->pd->f_strength * efd->falloff;
copy_v3_v3(tex_co, point->loc);
@@ -757,7 +771,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
tex_co[2] = 0.0f;
}
else if (eff->pd->flag & PFIELD_TEX_2D) {
- float fac=-dot_v3v3(tex_co, efd->nor);
+ float fac = -dot_v3v3(tex_co, efd->nor);
madd_v3_v3fl(tex_co, efd->nor, fac);
}
@@ -765,31 +779,31 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
hasrgb = multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result, 0, NULL, scene_color_manage, false);
- if (hasrgb && mode==PFIELD_TEX_RGB) {
+ if (hasrgb && mode == PFIELD_TEX_RGB) {
force[0] = (0.5f - result->tr) * strength;
force[1] = (0.5f - result->tg) * strength;
force[2] = (0.5f - result->tb) * strength;
}
else if (nabla != 0) {
- strength/=nabla;
+ strength /= nabla;
tex_co[0] += nabla;
- multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+1, 0, NULL, scene_color_manage, false);
+ multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result + 1, 0, NULL, scene_color_manage, false);
tex_co[0] -= nabla;
tex_co[1] += nabla;
- multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+2, 0, NULL, scene_color_manage, false);
+ multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result + 2, 0, NULL, scene_color_manage, false);
tex_co[1] -= nabla;
tex_co[2] += nabla;
- multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+3, 0, NULL, scene_color_manage, false);
+ multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result + 3, 0, NULL, scene_color_manage, false);
if (mode == PFIELD_TEX_GRAD || !hasrgb) { /* if we don't have rgb fall back to grad */
/* generate intensity if texture only has rgb value */
if (hasrgb & TEX_RGB) {
- int i;
- for (i=0; i<4; i++)
+ for (int i = 0; i < 4; i++) {
result[i].tin = (1.0f / 3.0f) * (result[i].tr + result[i].tg + result[i].tb);
+ }
}
force[0] = (result[0].tin - result[1].tin) * strength;
force[1] = (result[0].tin - result[2].tin) * strength;
@@ -835,8 +849,9 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
if (noise_factor > 0.0f) {
strength += wind_func(rng, noise_factor);
- if (ELEM(pd->forcefield, PFIELD_HARMONIC, PFIELD_DRAG))
+ if (ELEM(pd->forcefield, PFIELD_HARMONIC, PFIELD_DRAG)) {
damp += wind_func(rng, noise_factor);
+ }
}
copy_v3_v3(force, efd->vec_to_point);
@@ -848,8 +863,8 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
break;
case PFIELD_FORCE:
normalize_v3(force);
- if (pd->flag & PFIELD_GRAVITATION){ /* Option: Multiply by 1/distance^2 */
- if (efd->distance < FLT_EPSILON){
+ if (pd->flag & PFIELD_GRAVITATION) { /* Option: Multiply by 1/distance^2 */
+ if (efd->distance < FLT_EPSILON) {
strength = 0.0f;
}
else {
@@ -901,10 +916,10 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
case PFIELD_LENNARDJ:
fac = pow((efd->size + point->size) / efd->distance, 6.0);
- fac = - fac * (1.0f - fac) / efd->distance;
+ fac = -fac * (1.0f - fac) / efd->distance;
/* limit the repulsive term drastically to avoid huge forces */
- fac = ((fac>2.0f) ? 2.0f : fac);
+ fac = ((fac > 2.0f) ? 2.0f : fac);
mul_v3_fl(force, strength * fac);
break;
@@ -938,8 +953,9 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
float density;
if ((density = smoke_get_velocity_at(pd->f_source, point->loc, force)) >= 0.0f) {
float influence = strength * efd->falloff;
- if (pd->flag & PFIELD_SMOKE_DENSITY)
+ if (pd->flag & PFIELD_SMOKE_DENSITY) {
influence *= density;
+ }
mul_v3_fl(force, influence);
/* apply flow */
madd_v3_v3fl(total_force, point->vel, -pd->f_flow * influence);
@@ -950,15 +966,16 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
}
if (pd->flag & PFIELD_DO_LOCATION) {
- madd_v3_v3fl(total_force, force, 1.0f/point->vel_to_sec);
+ madd_v3_v3fl(total_force, force, 1.0f / point->vel_to_sec);
- if (ELEM(pd->forcefield, PFIELD_HARMONIC, PFIELD_DRAG, PFIELD_SMOKEFLOW)==0 && pd->f_flow != 0.0f) {
+ if (ELEM(pd->forcefield, PFIELD_HARMONIC, PFIELD_DRAG, PFIELD_SMOKEFLOW) == 0 && pd->f_flow != 0.0f) {
madd_v3_v3fl(total_force, point->vel, -pd->f_flow * efd->falloff);
}
}
- if (point->ave)
+ if (point->ave) {
zero_v3(point->ave);
+ }
if (pd->flag & PFIELD_DO_ROTATION && point->ave && point->rot) {
float xvec[3] = {1.0f, 0.0f, 0.0f};
float dave[3];
@@ -1001,45 +1018,47 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we
*/
EffectorCache *eff;
EffectorData efd;
- int p=0, tot = 1, step = 1;
+ int p = 0, tot = 1, step = 1;
/* Cycle through collected objects, get total of (1/(gravity_strength * dist^gravity_power)) */
/* Check for min distance here? (yes would be cool to add that, ton) */
- if (effectors) for (eff = effectors->first; eff; eff=eff->next) {
- /* object effectors were fully checked to be OK to evaluate! */
-
- get_effector_tot(eff, &efd, point, &tot, &p, &step);
+ if (effectors) {
+ for (eff = effectors->first; eff; eff = eff->next) {
+ /* object effectors were fully checked to be OK to evaluate! */
- for (; p<tot; p+=step) {
- if (get_effector_data(eff, &efd, point, 0)) {
- efd.falloff= effector_falloff(eff, &efd, point, weights);
+ get_effector_tot(eff, &efd, point, &tot, &p, &step);
- if (efd.falloff > 0.0f)
- efd.falloff *= eff_calc_visibility(colliders, eff, &efd, point);
+ for (; p < tot; p += step) {
+ if (get_effector_data(eff, &efd, point, 0)) {
+ efd.falloff = effector_falloff(eff, &efd, point, weights);
- if (efd.falloff <= 0.0f) {
- /* don't do anything */
- }
- else if (eff->pd->forcefield == PFIELD_TEXTURE) {
- do_texture_effector(eff, &efd, point, force);
- }
- else {
- float temp1[3] = {0, 0, 0}, temp2[3];
- copy_v3_v3(temp1, force);
+ if (efd.falloff > 0.0f) {
+ efd.falloff *= eff_calc_visibility(colliders, eff, &efd, point);
+ }
+ if (efd.falloff <= 0.0f) {
+ /* don't do anything */
+ }
+ else if (eff->pd->forcefield == PFIELD_TEXTURE) {
+ do_texture_effector(eff, &efd, point, force);
+ }
+ else {
+ float temp1[3] = {0, 0, 0}, temp2[3];
+ copy_v3_v3(temp1, force);
- do_physical_effector(eff, &efd, point, force);
+ do_physical_effector(eff, &efd, point, force);
- /* for softbody backward compatibility */
- if (point->flag & PE_WIND_AS_SPEED && impulse) {
- sub_v3_v3v3(temp2, force, temp1);
- sub_v3_v3v3(impulse, impulse, temp2);
+ /* for softbody backward compatibility */
+ if (point->flag & PE_WIND_AS_SPEED && impulse) {
+ sub_v3_v3v3(temp2, force, temp1);
+ sub_v3_v3v3(impulse, impulse, temp2);
+ }
}
}
- }
- else if (eff->flag & PE_VELOCITY_TO_IMPULSE && impulse) {
- /* special case for harmonic effector */
- add_v3_v3v3(impulse, impulse, efd.vel);
+ else if (eff->flag & PE_VELOCITY_TO_IMPULSE && impulse) {
+ /* special case for harmonic effector */
+ add_v3_v3v3(impulse, impulse, efd.vel);
+ }
}
}
}
@@ -1049,35 +1068,35 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we
SimDebugData *_sim_debug_data = NULL;
-unsigned int BKE_sim_debug_data_hash(int i)
+uint BKE_sim_debug_data_hash(int i)
{
- return BLI_ghashutil_uinthash((unsigned int)i);
+ return BLI_ghashutil_uinthash((uint)i);
}
-unsigned int BKE_sim_debug_data_hash_combine(unsigned int kx, unsigned int ky)
+uint BKE_sim_debug_data_hash_combine(uint kx, uint ky)
{
-#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k))))
+#define rot(x, k) (((x) << (k)) | ((x) >> (32 - (k))))
- unsigned int a, b, c;
+ uint a, b, c;
a = b = c = 0xdeadbeef + (2 << 2) + 13;
a += kx;
b += ky;
- c ^= b; c -= rot(b,14);
- a ^= c; a -= rot(c,11);
- b ^= a; b -= rot(a,25);
- c ^= b; c -= rot(b,16);
- a ^= c; a -= rot(c,4);
- b ^= a; b -= rot(a,14);
- c ^= b; c -= rot(b,24);
+ c ^= b; c -= rot(b, 14);
+ a ^= c; a -= rot(c, 11);
+ b ^= a; b -= rot(a, 25);
+ c ^= b; c -= rot(b, 16);
+ a ^= c; a -= rot(c, 4);
+ b ^= a; b -= rot(a, 14);
+ c ^= b; c -= rot(b, 24);
return c;
#undef rot
}
-static unsigned int debug_element_hash(const void *key)
+static uint debug_element_hash(const void *key)
{
const SimDebugElement *elem = key;
return elem->hash;
@@ -1121,8 +1140,9 @@ bool BKE_sim_debug_data_get_enabled(void)
void BKE_sim_debug_data_free(void)
{
if (_sim_debug_data) {
- if (_sim_debug_data->gh)
+ if (_sim_debug_data->gh) {
BLI_ghash_free(_sim_debug_data->gh, NULL, debug_element_free);
+ }
MEM_freeN(_sim_debug_data);
}
}
@@ -1134,20 +1154,23 @@ static void debug_data_insert(SimDebugData *debug_data, SimDebugElement *elem)
*old_elem = *elem;
MEM_freeN(elem);
}
- else
+ else {
BLI_ghash_insert(debug_data->gh, elem, elem);
+ }
}
-void BKE_sim_debug_data_add_element(int type, const float v1[3], const float v2[3], const char *str, float r, float g, float b, const char *category, unsigned int hash)
+void BKE_sim_debug_data_add_element(int type, const float v1[3], const float v2[3], const char *str, float r, float g, float b, const char *category, uint hash)
{
- unsigned int category_hash = BLI_ghashutil_strhash_p(category);
+ uint category_hash = BLI_ghashutil_strhash_p(category);
SimDebugElement *elem;
if (!_sim_debug_data) {
- if (G.debug & G_DEBUG_SIMDATA)
+ if (G.debug & G_DEBUG_SIMDATA) {
BKE_sim_debug_data_set_enabled(true);
- else
+ }
+ else {
return;
+ }
}
elem = MEM_callocN(sizeof(SimDebugElement), "sim debug data element");
@@ -1157,47 +1180,55 @@ void BKE_sim_debug_data_add_element(int type, const float v1[3], const float v2[
elem->color[0] = r;
elem->color[1] = g;
elem->color[2] = b;
- if (v1)
+ if (v1) {
copy_v3_v3(elem->v1, v1);
- else
+ }
+ else {
zero_v3(elem->v1);
- if (v2)
+ }
+ if (v2) {
copy_v3_v3(elem->v2, v2);
- else
+ }
+ else {
zero_v3(elem->v2);
- if (str)
+ }
+ if (str) {
BLI_strncpy(elem->str, str, sizeof(elem->str));
- else
+ }
+ else {
elem->str[0] = '\0';
+ }
debug_data_insert(_sim_debug_data, elem);
}
-void BKE_sim_debug_data_remove_element(unsigned int hash)
+void BKE_sim_debug_data_remove_element(uint hash)
{
SimDebugElement dummy;
- if (!_sim_debug_data)
+ if (!_sim_debug_data) {
return;
-
+ }
dummy.hash = hash;
BLI_ghash_remove(_sim_debug_data->gh, &dummy, NULL, debug_element_free);
}
void BKE_sim_debug_data_clear(void)
{
- if (!_sim_debug_data)
+ if (!_sim_debug_data) {
return;
-
- if (_sim_debug_data->gh)
+ }
+ if (_sim_debug_data->gh) {
BLI_ghash_clear(_sim_debug_data->gh, NULL, debug_element_free);
+ }
}
void BKE_sim_debug_data_clear_category(const char *category)
{
int category_hash = (int)BLI_ghashutil_strhash_p(category);
- if (!_sim_debug_data)
+ if (!_sim_debug_data) {
return;
+ }
if (_sim_debug_data->gh) {
GHashIterator iter;
@@ -1206,8 +1237,9 @@ void BKE_sim_debug_data_clear_category(const char *category)
const SimDebugElement *elem = BLI_ghashIterator_getValue(&iter);
BLI_ghashIterator_step(&iter); /* removing invalidates the current iterator, so step before removing */
- if (elem->category_hash == category_hash)
+ if (elem->category_hash == category_hash) {
BLI_ghash_remove(_sim_debug_data->gh, elem, NULL, debug_element_free);
+ }
}
}
}
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 6ee6d877b9c..d4e69ad06ac 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -270,12 +270,12 @@ FCurve *iter_step_fcurve(FCurve *fcu_iter, const char rna_path[])
/* Get list of LinkData's containing pointers to the F-Curves which control the types of data indicated
* Lists...
- * - dst: list of LinkData's matching the criteria returned.
- * List must be freed after use, and is assumed to be empty when passed.
- * - src: list of F-Curves to search through
+ * - dst: list of LinkData's matching the criteria returned.
+ * List must be freed after use, and is assumed to be empty when passed.
+ * - src: list of F-Curves to search through
* Filters...
- * - dataPrefix: i.e. 'pose.bones[' or 'nodes['
- * - dataName: name of entity within "" immediately following the prefix
+ * - dataPrefix: i.e. 'pose.bones[' or 'nodes['
+ * - dataName: name of entity within "" immediately following the prefix
*/
int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix, const char *dataName)
{
@@ -428,8 +428,8 @@ static int binarysearch_bezt_index_ex(BezTriple array[], float frame, int arrayl
*r_replace = false;
/* sneaky optimizations (don't go through searching process if...):
- * - keyframe to be added is to be added out of current bounds
- * - keyframe to be added would replace one of the existing ones on bounds
+ * - keyframe to be added is to be added out of current bounds
+ * - keyframe to be added would replace one of the existing ones on bounds
*/
if ((arraylen <= 0) || (array == NULL)) {
printf("Warning: binarysearch_bezt_index() encountered invalid array\n");
@@ -829,7 +829,7 @@ void bezt_add_to_cfra_elem(ListBase *lb, BezTriple *bezt)
/* Basic sampling callback which acts as a wrapper for evaluate_fcurve()
- * 'data' arg here is unneeded here...
+ * 'data' arg here is unneeded here...
*/
float fcurve_samplingcb_evalcurve(FCurve *fcu, void *UNUSED(data), float evaltime)
{
@@ -931,9 +931,9 @@ void calchandles_fcurve(FCurve *fcu)
int a = fcu->totvert;
/* Error checking:
- * - need at least two points
- * - need bezier keys
- * - only bezier-interpolation has handles (for now)
+ * - need at least two points
+ * - need bezier keys
+ * - only bezier-interpolation has handles (for now)
*/
if (ELEM(NULL, fcu, fcu->bezt) || (a < 2) /*|| ELEM(fcu->ipo, BEZT_IPO_CONST, BEZT_IPO_LIN)*/)
return;
@@ -1527,10 +1527,10 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar)
pchan = BKE_pose_channel_find_name(ob->pose, dtar->pchan_name);
/* check if object or bone, and get transform matrix accordingly
- * - "useEulers" code is used to prevent the problems associated with non-uniqueness
- * of euler decomposition from matrices [#20870]
- * - localspace is for [#21384], where parent results are not wanted
- * but local-consts is for all the common "corrective-shapes-for-limbs" situations
+ * - "useEulers" code is used to prevent the problems associated with non-uniqueness
+ * of euler decomposition from matrices [#20870]
+ * - localspace is for [#21384], where parent results are not wanted
+ * but local-consts is for all the common "corrective-shapes-for-limbs" situations
*/
if (pchan) {
/* bone */
@@ -1596,12 +1596,12 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar)
}
else if (dtar->transChan >= DTAR_TRANSCHAN_ROTX) {
/* extract rotation as eulers (if needed)
- * - definitely if rotation order isn't eulers already
- * - if eulers, then we have 2 options:
- * a) decompose transform matrix as required, then try to make eulers from
- * there compatible with original values
- * b) [NOT USED] directly use the original values (no decomposition)
- * - only an option for "transform space", if quality is really bad with a)
+ * - definitely if rotation order isn't eulers already
+ * - if eulers, then we have 2 options:
+ * a) decompose transform matrix as required, then try to make eulers from
+ * there compatible with original values
+ * b) [NOT USED] directly use the original values (no decomposition)
+ * - only an option for "transform space", if quality is really bad with a)
*/
float eul[3];
@@ -1672,9 +1672,9 @@ void driver_free_variable(ListBase *variables, DriverVar *dvar)
return;
/* free target vars
- * - need to go over all of them, not just up to the ones that are used
- * currently, since there may be some lingering RNA paths from
- * previous users needing freeing
+ * - need to go over all of them, not just up to the ones that are used
+ * currently, since there may be some lingering RNA paths from
+ * previous users needing freeing
*/
DRIVER_TARGETS_LOOPER(dvar)
{
@@ -1920,8 +1920,8 @@ float driver_get_variable_value(ChannelDriver *driver, DriverVar *dvar)
}
/* Evaluate an Channel-Driver to get a 'time' value to use instead of "evaltime"
- * - "evaltime" is the frame at which F-Curve is being evaluated
- * - has to return a float value
+ * - "evaltime" is the frame at which F-Curve is being evaluated
+ * - has to return a float value
*/
float evaluate_driver(PathResolvedRNA *anim_rna, ChannelDriver *driver, const float evaltime)
{
@@ -2005,7 +2005,7 @@ float evaluate_driver(PathResolvedRNA *anim_rna, ChannelDriver *driver, const fl
}
else {
/* this evaluates the expression using Python, and returns its result:
- * - on errors it reports, then returns 0.0f
+ * - on errors it reports, then returns 0.0f
*/
BLI_mutex_lock(&python_driver_lock);
@@ -2050,9 +2050,9 @@ void correct_bezpart(float v1[2], float v2[2], float v3[2], float v4[2])
h2[1] = v4[1] - v3[1];
/* calculate distances:
- * - len = span of time between keyframes
- * - len1 = length of handle of start key
- * - len2 = length of handle of end key
+ * - len = span of time between keyframes
+ * - len1 = length of handle of start key
+ * - len2 = length of handle of end key
*/
len = v4[0] - v1[0];
len1 = fabsf(h1[0]);
@@ -2675,8 +2675,8 @@ static float evaluate_fcurve_ex(FCurve *fcu, float evaltime, float cvalue)
devaltime = evaluate_time_fmodifiers(storage, &fcu->modifiers, fcu, cvalue, evaltime);
/* evaluate curve-data
- * - 'devaltime' instead of 'evaltime', as this is the time that the last time-modifying
- * F-Curve modifier on the stack requested the curve to be evaluated at
+ * - 'devaltime' instead of 'evaltime', as this is the time that the last time-modifying
+ * F-Curve modifier on the stack requested the curve to be evaluated at
*/
if (fcu->bezt)
cvalue = fcurve_eval_keyframes(fcu, fcu->bezt, devaltime);
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index 5911d155278..f5915e1ddb9 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -69,15 +69,15 @@ void *fmodifiers_storage_get(FModifierStackStorage *storage, FModifier *fcm);
*/
/* Template for type-info data:
- * - make a copy of this when creating new modifiers, and just change the functions
- * pointed to as necessary
- * - although the naming of functions doesn't matter, it would help for code
- * readability, to follow the same naming convention as is presented here
- * - any functions that a constraint doesn't need to define, don't define
- * for such cases, just use NULL
- * - these should be defined after all the functions have been defined, so that
- * forward-definitions/prototypes don't need to be used!
- * - keep this copy #if-def'd so that future constraints can get based off this
+ * - make a copy of this when creating new modifiers, and just change the functions
+ * pointed to as necessary
+ * - although the naming of functions doesn't matter, it would help for code
+ * readability, to follow the same naming convention as is presented here
+ * - any functions that a constraint doesn't need to define, don't define
+ * for such cases, just use NULL
+ * - these should be defined after all the functions have been defined, so that
+ * forward-definitions/prototypes don't need to be used!
+ * - keep this copy #if-def'd so that future constraints can get based off this
*/
#if 0
static FModifierTypeInfo FMI_MODNAME = {
@@ -260,7 +260,7 @@ static FModifierTypeInfo FMI_GENERATOR = {
* x is the evaluation 'time', and 'y' is the resultant value
*
* Functions available are
- * sin, cos, tan, sinc (normalized sin), natural log, square root
+ * sin, cos, tan, sinc (normalized sin), natural log, square root
*/
static void fcm_fn_generator_new_data(void *mdata)
@@ -460,8 +460,8 @@ static void fcm_envelope_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *cv
}
/* adjust *cvalue
- * - fac is the ratio of how the current y-value corresponds to the reference range
- * - thus, the new value is found by mapping the old range to the new!
+ * - fac is the ratio of how the current y-value corresponds to the reference range
+ * - thus, the new value is found by mapping the old range to the new!
*/
fac = (*cvalue - (env->midval + env->min)) / (env->max - env->min);
*cvalue = min + fac * (max - min);
@@ -638,8 +638,8 @@ static float fcm_cycles_time(FModifierStackStorage *storage, FCurve *fcu, FModif
return evaltime;
/* check if modifier will do anything
- * 1) if in data range, definitely don't do anything
- * 2) if before first frame or after last frame, make sure some cycling is in use
+ * 1) if in data range, definitely don't do anything
+ * 2) if before first frame or after last frame, make sure some cycling is in use
*/
if (evaltime < prevkey[0]) {
if (data->before_mode) {
@@ -711,8 +711,8 @@ static float fcm_cycles_time(FModifierStackStorage *storage, FCurve *fcu, FModif
/* calculate where in the cycle we are (overwrite evaltime to reflect this) */
else if ((mode == FCM_EXTRAPOLATE_MIRROR) && ((int)(cycle + 1) % 2)) {
/* when 'mirror' option is used and cycle number is odd, this cycle is played in reverse
- * - for 'before' extrapolation, we need to flip in a different way, otherwise values past
- * then end of the curve get referenced (result of fmod will be negative, and with different phase)
+ * - for 'before' extrapolation, we need to flip in a different way, otherwise values past
+ * then end of the curve get referenced (result of fmod will be negative, and with different phase)
*/
if (side < 0)
evaltime = prevkey[0] - cyct;
@@ -795,8 +795,8 @@ static void fcm_noise_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *cvalu
float noise;
/* generate noise using good ol' Blender Noise
- * - 0.1 is passed as the 'z' value, otherwise evaluation fails for size = phase = 1
- * with evaltime being an integer (which happens when evaluating on frame by frame basis)
+ * - 0.1 is passed as the 'z' value, otherwise evaluation fails for size = phase = 1
+ * with evaltime being an integer (which happens when evaluating on frame by frame basis)
*/
noise = BLI_turbulence(data->size, evaltime - data->offset, data->phase, 0.1f, data->depth);
@@ -891,7 +891,7 @@ static void fcm_python_evaluate(FCurve *UNUSED(fcu), FModifier *UNUSED(fcm), flo
//FMod_Python *data = (FMod_Python *)fcm->data;
/* FIXME... need to implement this modifier...
- * It will need it execute a script using the custom properties
+ * It will need it execute a script using the custom properties
*/
#endif /* WITH_PYTHON */
}
@@ -986,7 +986,7 @@ static float fcm_stepped_time(FCurve *UNUSED(fcu), FModifier *fcm, float UNUSED(
/* we snap to the start of the previous closest block of 'step_size' frames
* after the start offset has been discarded
- * - i.e. round down
+ * - i.e. round down
*/
snapblock = (int)((evaltime - data->offset) / data->step_size);
@@ -1264,8 +1264,8 @@ void set_active_fmodifier(ListBase *modifiers, FModifier *fcm)
}
/* Do we have any modifiers which match certain criteria
- * - mtype - type of modifier (if 0, doesn't matter)
- * - acttype - type of action to perform (if -1, doesn't matter)
+ * - mtype - type of modifier (if 0, doesn't matter)
+ * - acttype - type of action to perform (if -1, doesn't matter)
*/
bool list_has_suitable_fmodifier(ListBase *modifiers, int mtype, short acttype)
{
@@ -1284,7 +1284,7 @@ bool list_has_suitable_fmodifier(ListBase *modifiers, int mtype, short acttype)
const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm);
short mOk = 1, aOk = 1; /* by default 1, so that when only one test, won't fail */
- /* check if applicable ones are fullfilled */
+ /* check if applicable ones are fulfilled */
if (mtype)
mOk = (fcm->type == mtype);
if (acttype > -1)
@@ -1397,13 +1397,13 @@ static float eval_fmodifier_influence(FModifier *fcm, float evaltime)
}
/* evaluate time modifications imposed by some F-Curve Modifiers
- * - this step acts as an optimization to prevent the F-Curve stack being evaluated
- * several times by modifiers requesting the time be modified, as the final result
- * would have required using the modified time
- * - modifiers only ever receive the unmodified time, as subsequent modifiers should be
- * working on the 'global' result of the modified curve, not some localised segment,
- * so nevaltime gets set to whatever the last time-modifying modifier likes...
- * - we start from the end of the stack, as only the last one matters for now
+ * - this step acts as an optimization to prevent the F-Curve stack being evaluated
+ * several times by modifiers requesting the time be modified, as the final result
+ * would have required using the modified time
+ * - modifiers only ever receive the unmodified time, as subsequent modifiers should be
+ * working on the 'global' result of the modified curve, not some localised segment,
+ * so nevaltime gets set to whatever the last time-modifying modifier likes...
+ * - we start from the end of the stack, as only the last one matters for now
*
* Note: *fcu might be NULL
*/
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index cf2521509b5..e51b10a97a4 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -360,7 +360,7 @@ VFont *BKE_vfont_builtin_get(void)
static VChar *find_vfont_char(VFontData *vfd, unsigned int character)
{
- return BLI_ghash_lookup(vfd->characters, SET_UINT_IN_POINTER(character));
+ return BLI_ghash_lookup(vfd->characters, POINTER_FROM_UINT(character));
}
static void build_underline(Curve *cu, ListBase *nubase, const rctf *rect,
@@ -605,7 +605,7 @@ void BKE_vfont_select_clamp(Object *ob)
static float char_width(Curve *cu, VChar *che, CharInfo *info)
{
- /* The character wasn't found, propably ascii = 0, then the width shall be 0 as well */
+ /* The character wasn't found, probably ascii = 0, then the width shall be 0 as well */
if (che == NULL) {
return 0.0f;
}
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index e89508fd6c0..a0d759118ec 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -907,8 +907,8 @@ bGPDframe *BKE_gpencil_layer_find_frame(bGPDlayer *gpl, int cframe)
}
/* get the appropriate gp-frame from a given layer
- * - this sets the layer's actframe var (if allowed to)
- * - extension beyond range (if first gp-frame is after all frame in interest and cannot add)
+ * - this sets the layer's actframe var (if allowed to)
+ * - extension beyond range (if first gp-frame is after all frame in interest and cannot add)
*/
bGPDframe *BKE_gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode addnew)
{
diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c
index 071c10acaa5..e49f24c8120 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -107,7 +107,7 @@ static int get_next_free_id(void)
return gNextIconId++;
/* now we try to find the smallest icon id not stored in the gIcons hash */
- while (BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(startId)) && startId >= gFirstIconId)
+ while (BLI_ghash_lookup(gIcons, POINTER_FROM_INT(startId)) && startId >= gFirstIconId)
startId++;
/* if we found a suitable one that isn't used yet, return it */
@@ -161,7 +161,7 @@ void BKE_icons_deferred_free(void)
node != NULL;
node = node->next)
{
- BLI_ghash_remove(gIcons, SET_INT_IN_POINTER(node->icon_id), NULL, icon_free);
+ BLI_ghash_remove(gIcons, POINTER_FROM_INT(node->icon_id), NULL, icon_free);
}
BLI_linklist_lockfree_clear(&g_icon_delete_queue, MEM_freeN);
}
@@ -471,7 +471,7 @@ void BKE_icon_changed(const int icon_id)
if (!icon_id || G.background) return;
- icon = BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(icon_id));
+ icon = BLI_ghash_lookup(gIcons, POINTER_FROM_INT(icon_id));
if (icon) {
/* We *only* expect ID-tied icons here, not non-ID icon/preview! */
@@ -507,7 +507,7 @@ static int icon_id_ensure_create_icon(struct ID *id)
new_icon->drawinfo = NULL;
new_icon->drawinfo_free = NULL;
- BLI_ghash_insert(gIcons, SET_INT_IN_POINTER(id->icon_id), new_icon);
+ BLI_ghash_insert(gIcons, POINTER_FROM_INT(id->icon_id), new_icon);
return id->icon_id;
}
@@ -587,7 +587,7 @@ int BKE_icon_preview_ensure(ID *id, PreviewImage *preview)
new_icon->drawinfo = NULL;
new_icon->drawinfo_free = NULL;
- BLI_ghash_insert(gIcons, SET_INT_IN_POINTER(preview->icon_id), new_icon);
+ BLI_ghash_insert(gIcons, POINTER_FROM_INT(preview->icon_id), new_icon);
return preview->icon_id;
}
@@ -598,7 +598,7 @@ Icon *BKE_icon_get(const int icon_id)
Icon *icon = NULL;
- icon = BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(icon_id));
+ icon = BLI_ghash_lookup(gIcons, POINTER_FROM_INT(icon_id));
if (!icon) {
printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id);
@@ -614,7 +614,7 @@ void BKE_icon_set(const int icon_id, struct Icon *icon)
void **val_p;
- if (BLI_ghash_ensure_p(gIcons, SET_INT_IN_POINTER(icon_id), &val_p)) {
+ if (BLI_ghash_ensure_p(gIcons, POINTER_FROM_INT(icon_id), &val_p)) {
printf("%s: Internal error, icon already set: %d\n", __func__, icon_id);
return;
}
@@ -643,7 +643,7 @@ void BKE_icon_id_delete(struct ID *id)
}
BKE_icons_deferred_free();
- BLI_ghash_remove(gIcons, SET_INT_IN_POINTER(icon_id), NULL, icon_free);
+ BLI_ghash_remove(gIcons, POINTER_FROM_INT(icon_id), NULL, icon_free);
}
/**
@@ -655,7 +655,7 @@ void BKE_icon_delete(const int icon_id)
if (!icon_id) return; /* no icon defined for library object */
- icon = BLI_ghash_popkey(gIcons, SET_INT_IN_POINTER(icon_id), NULL);
+ icon = BLI_ghash_popkey(gIcons, POINTER_FROM_INT(icon_id), NULL);
if (icon) {
if (icon->id_type != 0) {
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index c520714b076..1d209dec935 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1612,7 +1612,7 @@ typedef struct StampDataCustomField {
struct StampDataCustomField *next, *prev;
/* TODO(sergey): Think of better size here, maybe dynamically allocated even. */
char key[512];
- char value[512];
+ char *value;
/* TODO(sergey): Support non-string values. */
} StampDataCustomField;
@@ -2177,12 +2177,9 @@ void BKE_stamp_info_callback(void *data, struct StampData *stamp_data, StampCall
CALL(rendertime, "RenderTime");
CALL(memory, "Memory");
- for (StampDataCustomField *custom_field = stamp_data->custom_fields.first;
- custom_field != NULL;
- custom_field = custom_field->next)
- {
+ LISTBASE_FOREACH(StampDataCustomField *, custom_field, &stamp_data->custom_fields) {
if (noskip || custom_field->value[0]) {
- callback(data, custom_field->key, custom_field->value, sizeof(custom_field->value));
+ callback(data, custom_field->key, custom_field->value, strlen(custom_field->value) + 1);
}
}
@@ -2199,7 +2196,7 @@ void BKE_render_result_stamp_data(RenderResult *rr, const char *key, const char
StampDataCustomField *field = MEM_mallocN(sizeof(StampDataCustomField),
"StampData Custom Field");
STRNCPY(field->key, key);
- STRNCPY(field->value, value);
+ field->value = BLI_strdup(value);
BLI_addtail(&stamp_data->custom_fields, field);
}
@@ -2208,6 +2205,9 @@ void BKE_stamp_data_free(struct StampData *stamp_data)
if (stamp_data == NULL) {
return;
}
+ LISTBASE_FOREACH(StampDataCustomField *, custom_field, &stamp_data->custom_fields) {
+ MEM_freeN(custom_field->value);
+ }
BLI_freelistN(&stamp_data->custom_fields);
MEM_freeN(stamp_data);
}
@@ -2898,7 +2898,7 @@ static RenderPass *image_render_pass_get(RenderLayer *rl, const int pass, const
}
/* if layer or pass changes, we need an index for the imbufs list */
-/* note it is called for rendered results, but it doesnt use the index! */
+/* note it is called for rendered results, but it doesn't use the index! */
/* and because rendered results use fake layer/passes, don't correct for wrong indices here */
RenderPass *BKE_image_multilayer_index(RenderResult *rr, ImageUser *iuser)
{
@@ -2950,7 +2950,7 @@ void BKE_image_multiview_index(Image *ima, ImageUser *iuser)
}
/* if layer or pass changes, we need an index for the imbufs list */
-/* note it is called for rendered results, but it doesnt use the index! */
+/* note it is called for rendered results, but it doesn't use the index! */
/* and because rendered results use fake layer/passes, don't correct for wrong indices here */
bool BKE_image_is_multilayer(Image *ima)
{
@@ -3784,7 +3784,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **r_loc
*
* This is mainly to make it so color management treats byte buffer
* from render result with Save Buffers enabled as final display buffer
- * and doesnt' apply any color management on it.
+ * and doesn't apply any color management on it.
*
* For other cases we need to be sure it stays to default byte buffer space.
*/
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index fd8cb6d6d98..c11f2368197 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -503,7 +503,7 @@ static const char *texture_adrcodes_to_paths(int adrcode, int *array_index)
case TE_BRIGHT:
return "brightness";
case TE_CONTRA:
- return "constrast";
+ return "contrast";
}
return NULL;
@@ -811,13 +811,13 @@ static const char *particle_adrcodes_to_paths(int adrcode, int *array_index)
/* ------- */
/* Allocate memory for RNA-path for some property given a blocktype, adrcode, and 'root' parts of path
- * Input:
- * - id - the datablock that the curve's IPO block is attached to and/or which the new paths will start from
- * - blocktype, adrcode - determines setting to get
- * - actname, constname,seq - used to build path
- * Output:
- * - array_index - index in property's array (if applicable) to use
- * - return - the allocated path...
+ * Input:
+ * - id - the datablock that the curve's IPO block is attached to and/or which the new paths will start from
+ * - blocktype, adrcode - determines setting to get
+ * - actname, constname,seq - used to build path
+ * Output:
+ * - array_index - index in property's array (if applicable) to use
+ * - return - the allocated path...
*/
static char *get_rna_access(ID *id, int blocktype, int adrcode, char actname[], char constname[], Sequence *seq, int *array_index)
{
@@ -913,7 +913,7 @@ static char *get_rna_access(ID *id, int blocktype, int adrcode, char actname[],
}
/* check if any property found
- * - blocktype < 0 is special case for a specific type of driver, where we don't need a property name...
+ * - blocktype < 0 is special case for a specific type of driver, where we don't need a property name...
*/
if ((propname == NULL) && (blocktype > 0)) {
/* nothing was found, so exit */
@@ -1095,7 +1095,7 @@ static ChannelDriver *idriver_to_cdriver(IpoDriver *idriver)
}
/* Add F-Curve to the correct list
- * - grpname is needed to be used as group name where relevant, and is usually derived from actname
+ * - grpname is needed to be used as group name where relevant, and is usually derived from actname
*/
static void fcurve_add_to_list(ListBase *groups, ListBase *list, FCurve *fcu, char *grpname, int muteipo)
{
@@ -1153,8 +1153,8 @@ static void fcurve_add_to_list(ListBase *groups, ListBase *list, FCurve *fcu, ch
/* Convert IPO-Curve to F-Curve (including Driver data), and free any of the old data that
* is not relevant, BUT do not free the IPO-Curve itself...
- * actname: name of Action-Channel (if applicable) that IPO-Curve's IPO-block belonged to
- * constname: name of Constraint-Channel (if applicable) that IPO-Curve's IPO-block belonged to
+ * actname: name of Action-Channel (if applicable) that IPO-Curve's IPO-block belonged to
+ * constname: name of Constraint-Channel (if applicable) that IPO-Curve's IPO-block belonged to
* seq: sequencer-strip (if applicable) that IPO-Curve's IPO-block belonged to
*/
static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *icu, char *actname, char *constname, Sequence *seq, int muteipo)
@@ -1237,8 +1237,8 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i
fcurve->array_index = abp->array_index;
/* convert keyframes
- * - beztriples and bpoints are mutually exclusive, so we won't have both at the same time
- * - beztriples are more likely to be encountered as they are keyframes (the other type wasn't used yet)
+ * - beztriples and bpoints are mutually exclusive, so we won't have both at the same time
+ * - beztriples are more likely to be encountered as they are keyframes (the other type wasn't used yet)
*/
fcurve->totvert = icu->totvert;
@@ -1286,15 +1286,15 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i
unsigned int i = 0;
/* get rna-path
- * - we will need to set the 'disabled' flag if no path is able to be made (for now)
+ * - we will need to set the 'disabled' flag if no path is able to be made (for now)
*/
fcu->rna_path = get_rna_access(id, icu->blocktype, icu->adrcode, actname, constname, seq, &fcu->array_index);
if (fcu->rna_path == NULL)
fcu->flag |= FCURVE_DISABLED;
/* convert keyframes
- * - beztriples and bpoints are mutually exclusive, so we won't have both at the same time
- * - beztriples are more likely to be encountered as they are keyframes (the other type wasn't used yet)
+ * - beztriples and bpoints are mutually exclusive, so we won't have both at the same time
+ * - beztriples are more likely to be encountered as they are keyframes (the other type wasn't used yet)
*/
fcu->totvert = icu->totvert;
@@ -1323,8 +1323,8 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i
}
/* correct values for euler rotation curves
- * - they were degrees/10
- * - we need radians for RNA to do the right thing
+ * - they were degrees/10
+ * - we need radians for RNA to do the right thing
*/
if ( ((icu->blocktype == ID_OB) && ELEM(icu->adrcode, OB_ROT_X, OB_ROT_Y, OB_ROT_Z)) ||
((icu->blocktype == ID_PO) && ELEM(icu->adrcode, AC_EUL_X, AC_EUL_Y, AC_EUL_Z)) )
@@ -1337,8 +1337,8 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i
}
/* correct values for path speed curves
- * - their values were 0-1
- * - we now need as 'frames'
+ * - their values were 0-1
+ * - we now need as 'frames'
*/
if ( (id) && (icu->blocktype == GS(id->name)) &&
(fcu->rna_path && STREQ(fcu->rna_path, "eval_time")) )
@@ -1351,9 +1351,9 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i
}
/* correct times for rotation drivers
- * - need to go from degrees to radians...
- * - there's only really 1 target to worry about
- * - were also degrees/10
+ * - need to go from degrees to radians...
+ * - there's only really 1 target to worry about
+ * - were also degrees/10
*/
if (fcu->driver && fcu->driver->variables.first) {
DriverVar *dvar = fcu->driver->variables.first;
@@ -1412,10 +1412,10 @@ static void ipo_to_animato(ID *id, Ipo *ipo, char actname[], char constname[], S
if (G.debug & G_DEBUG) printf("ipo_to_animato\n");
/* validate actname and constname
- * - clear actname if it was one of the generic <builtin> ones (i.e. 'Object', or 'Shapes')
- * - actname can then be used to assign F-Curves in Action to Action Groups
- * (i.e. thus keeping the benefits that used to be provided by Action Channels for grouping
- * F-Curves for bones). This may be added later... for now let's just dump without them...
+ * - clear actname if it was one of the generic <builtin> ones (i.e. 'Object', or 'Shapes')
+ * - actname can then be used to assign F-Curves in Action to Action Groups
+ * (i.e. thus keeping the benefits that used to be provided by Action Channels for grouping
+ * F-Curves for bones). This may be added later... for now let's just dump without them...
*/
if (actname) {
if ((ipo->blocktype == ID_OB) && STREQ(actname, "Object"))
@@ -1623,8 +1623,8 @@ static void nlastrips_to_animdata(ID *id, ListBase *strips)
/* create a new-style NLA-strip which references this Action, then copy over relevant settings */
{
/* init a new strip, and assign the action to it
- * - no need to muck around with the user-counts, since this is just
- * passing over the ref to the new owner, not creating an additional ref
+ * - no need to muck around with the user-counts, since this is just
+ * passing over the ref to the new owner, not creating an additional ref
*/
strip = MEM_callocN(sizeof(NlaStrip), "NlaStrip");
strip->act = as->act;
diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c
index b8ebdd9cda5..84a8e11bdc8 100644
--- a/source/blender/blenkernel/intern/lamp.c
+++ b/source/blender/blenkernel/intern/lamp.c
@@ -157,12 +157,15 @@ Lamp *BKE_lamp_copy(Main *bmain, const Lamp *la)
Lamp *BKE_lamp_localize(Lamp *la)
{
- /* TODO replace with something like
- * Lamp *la_copy;
- * BKE_id_copy_ex(bmain, &la->id, (ID **)&la_copy, LIB_ID_COPY_NO_MAIN | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_NO_USER_REFCOUNT, false);
- * return la_copy;
+ /* TODO(bastien): Replace with something like:
*
- * ... Once f*** nodes are fully converted to that too :( */
+ * Lamp *la_copy;
+ * BKE_id_copy_ex(bmain, &la->id, (ID **)&la_copy,
+ * LIB_ID_COPY_NO_MAIN | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_NO_USER_REFCOUNT,
+ * false);
+ * return la_copy;
+ *
+ * NOTE: Only possible once nested node trees are fully converted to that too. */
Lamp *lan;
int a;
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 0eb943cc15b..a6cee54d81f 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -286,7 +286,7 @@ static int id_expand_local_callback(
return IDWALK_RET_NOP;
}
- /* Can hapen that we get unlinkable ID here, e.g. with shapekey referring to itself (through drivers)...
+ /* Can happen that we get unlinkable ID here, e.g. with shapekey referring to itself (through drivers)...
* Just skip it, shape key can only be either indirectly linked, or fully local, period.
* And let's curse one more time that stupid useless shapekey ID type! */
if (*id_pointer && *id_pointer != id_self && BKE_idcode_is_linkable(GS((*id_pointer)->name))) {
diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c
index 2819b0312aa..f791d9a6591 100644
--- a/source/blender/blenkernel/intern/library_remap.c
+++ b/source/blender/blenkernel/intern/library_remap.c
@@ -499,7 +499,7 @@ ATTR_NONNULL(1) static void libblock_remap_data(
}
#ifdef DEBUG_PRINT
- printf("%s: %d occurences skipped (%d direct and %d indirect ones)\n", __func__,
+ printf("%s: %d occurrences skipped (%d direct and %d indirect ones)\n", __func__,
r_id_remap_data->skipped_direct + r_id_remap_data->skipped_indirect,
r_id_remap_data->skipped_direct, r_id_remap_data->skipped_indirect);
#endif
diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c
index 76d16334630..2f2b82a00eb 100644
--- a/source/blender/blenkernel/intern/mask_rasterize.c
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -35,7 +35,7 @@
* - free the handle.
*
* This file is admittedly a bit confusticated, in quite few areas speed was chosen over readability,
- * though it is commented - so shouldn't be so hard to see whats going on.
+ * though it is commented - so shouldn't be so hard to see what's going on.
*
*
* Implementation:
@@ -486,7 +486,7 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size)
unsigned int xi_max = (unsigned int) ((xmax - layer->bounds.xmin) * layer->buckets_xy_scalar[0]);
unsigned int yi_min = (unsigned int) ((ymin - layer->bounds.ymin) * layer->buckets_xy_scalar[1]);
unsigned int yi_max = (unsigned int) ((ymax - layer->bounds.ymin) * layer->buckets_xy_scalar[1]);
- void *face_index_void = SET_UINT_IN_POINTER(face_index);
+ void *face_index_void = POINTER_FROM_UINT(face_index);
unsigned int xi, yi;
@@ -538,7 +538,7 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size)
buckets_face[bucket_index] = bucket;
for (bucket_node = bucketstore[bucket_index]; bucket_node; bucket_node = bucket_node->next) {
- *bucket = GET_UINT_FROM_POINTER(bucket_node->link);
+ *bucket = POINTER_AS_UINT(bucket_node->link);
bucket++;
}
*bucket = TRI_TERMINATOR_ID;
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 91658a140f0..3414d08b8e7 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -273,12 +273,15 @@ Material *BKE_material_copy(Main *bmain, const Material *ma)
/* XXX (see above) material copy without adding to main dbase */
Material *BKE_material_localize(Material *ma)
{
- /* TODO replace with something like
- * Material *ma_copy;
- * BKE_id_copy_ex(bmain, &ma->id, (ID **)&ma_copy, LIB_ID_COPY_NO_MAIN | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_NO_USER_REFCOUNT, false);
- * return ma_copy;
+ /* TODO(bastien): Replace with something like:
*
- * ... Once f*** nodes are fully converted to that too :( */
+ * Material *ma_copy;
+ * BKE_id_copy_ex(bmain, &ma->id, (ID **)&ma_copy,
+ * LIB_ID_COPY_NO_MAIN | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_NO_USER_REFCOUNT,
+ * false);
+ * return ma_copy;
+ *
+ * NOTE: Only possible once nested node trees are fully converted to that too. */
Material *man;
int a;
@@ -844,7 +847,7 @@ void BKE_material_remap_object_calc(
for (int i = 0; i < ob_dst->totcol; i++) {
Material *ma_src = give_current_material(ob_dst, i + 1);
- BLI_ghash_reinsert(gh_mat_map, ma_src, SET_INT_IN_POINTER(i), NULL, NULL);
+ BLI_ghash_reinsert(gh_mat_map, ma_src, POINTER_FROM_INT(i), NULL, NULL);
}
/* setup default mapping (when materials don't match) */
@@ -874,7 +877,7 @@ void BKE_material_remap_object_calc(
else {
void **index_src_p = BLI_ghash_lookup_p(gh_mat_map, ma_src);
if (index_src_p) {
- remap_src_to_dst[i] = GET_INT_FROM_POINTER(*index_src_p);
+ remap_src_to_dst[i] = POINTER_AS_INT(*index_src_p);
}
}
}
diff --git a/source/blender/blenkernel/intern/mball_tessellate.c b/source/blender/blenkernel/intern/mball_tessellate.c
index cc82d12a776..840062df3a3 100644
--- a/source/blender/blenkernel/intern/mball_tessellate.c
+++ b/source/blender/blenkernel/intern/mball_tessellate.c
@@ -447,18 +447,18 @@ static void freepolygonize(PROCESS *process)
/**** Cubical Polygonization (optional) ****/
-#define LB 0 /* left bottom edge */
-#define LT 1 /* left top edge */
-#define LN 2 /* left near edge */
-#define LF 3 /* left far edge */
+#define LB 0 /* left bottom edge */
+#define LT 1 /* left top edge */
+#define LN 2 /* left near edge */
+#define LF 3 /* left far edge */
#define RB 4 /* right bottom edge */
-#define RT 5 /* right top edge */
-#define RN 6 /* right near edge */
-#define RF 7 /* right far edge */
-#define BN 8 /* bottom near edge */
-#define BF 9 /* bottom far edge */
-#define TN 10 /* top near edge */
-#define TF 11 /* top far edge */
+#define RT 5 /* right top edge */
+#define RN 6 /* right near edge */
+#define RF 7 /* right far edge */
+#define BN 8 /* bottom near edge */
+#define BF 9 /* bottom far edge */
+#define TN 10 /* top near edge */
+#define TF 11 /* top far edge */
static INTLISTS *cubetable[256];
static char faces[256];
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 6d481472074..5758e00a28d 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -152,7 +152,7 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2
for (j = 0; j < vtot; j++, v1++, v2++) {
if (len_squared_v3v3(v1->co, v2->co) > thresh_sq)
return MESHCMP_VERTCOMISMATCH;
- /* I don't care about normals, let's just do coodinates */
+ /* I don't care about normals, let's just do coordinates */
}
}
@@ -1445,7 +1445,7 @@ static int split_faces_prepare_new_verts(
if ((*lnor_space)->flags & MLNOR_SPACE_IS_SINGLE) {
/* Single loop in this fan... */
- BLI_assert(GET_INT_FROM_POINTER((*lnor_space)->loops) == loop_idx);
+ BLI_assert(POINTER_AS_INT((*lnor_space)->loops) == loop_idx);
BLI_BITMAP_ENABLE(done_loops, loop_idx);
if (vert_used) {
ml->v = new_vert_idx;
@@ -1453,7 +1453,7 @@ static int split_faces_prepare_new_verts(
}
else {
for (LinkNode *lnode = (*lnor_space)->loops; lnode; lnode = lnode->next) {
- const int ml_fan_idx = GET_INT_FROM_POINTER(lnode->link);
+ const int ml_fan_idx = POINTER_AS_INT(lnode->link);
BLI_BITMAP_ENABLE(done_loops, ml_fan_idx);
if (vert_used) {
mloop[ml_fan_idx].v = new_vert_idx;
@@ -1514,7 +1514,7 @@ static int split_faces_prepare_new_edges(
if (BLI_BITMAP_TEST(edges_used, edge_idx)) {
/* Original edge has already been used, we need to define a new one. */
const int new_edge_idx = num_edges++;
- *eval = SET_INT_IN_POINTER(new_edge_idx);
+ *eval = POINTER_FROM_INT(new_edge_idx);
ml_prev->e = new_edge_idx;
SplitFaceNewEdge *new_edge = BLI_memarena_alloc(memarena, sizeof(*new_edge));
@@ -1529,13 +1529,13 @@ static int split_faces_prepare_new_edges(
/* We can re-use original edge. */
medge[edge_idx].v1 = ml_prev->v;
medge[edge_idx].v2 = ml->v;
- *eval = SET_INT_IN_POINTER(edge_idx);
+ *eval = POINTER_FROM_INT(edge_idx);
BLI_BITMAP_ENABLE(edges_used, edge_idx);
}
}
else {
/* Edge already known, just update loop's edge index. */
- ml_prev->e = GET_INT_FROM_POINTER(*eval);
+ ml_prev->e = POINTER_AS_INT(*eval);
}
ml_prev = ml;
diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c
index c801c5dcb01..bfee7f3924c 100644
--- a/source/blender/blenkernel/intern/mesh_convert.c
+++ b/source/blender/blenkernel/intern/mesh_convert.c
@@ -145,7 +145,7 @@ static void make_edges_mdata_extend(
totedge_new = BLI_edgehash_len(eh);
#ifdef DEBUG
- /* ensure that theres no overlap! */
+ /* ensure that there's no overlap! */
if (totedge_new) {
MEdge *medge = *r_alledge;
for (i = 0; i < totedge; i++, medge++) {
@@ -171,7 +171,7 @@ static void make_edges_mdata_extend(
BLI_edgehashIterator_step(ehi), ++medge, e_index++)
{
BLI_edgehashIterator_getKey(ehi, &medge->v1, &medge->v2);
- BLI_edgehashIterator_setValue(ehi, SET_UINT_IN_POINTER(e_index));
+ BLI_edgehashIterator_setValue(ehi, POINTER_FROM_UINT(e_index));
medge->crease = medge->bweight = 0;
medge->flag = ME_EDGEDRAW | ME_EDGERENDER;
@@ -187,7 +187,7 @@ static void make_edges_mdata_extend(
int j;
for (j = 0; j < mp->totloop; j++, l++) {
/* lookup hashed edge index */
- l_prev->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(eh, l_prev->v, l->v));
+ l_prev->e = POINTER_AS_UINT(BLI_edgehash_lookup(eh, l_prev->v, l->v));
l_prev = l;
}
}
diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c
index 279ab777529..e3b1f20e583 100644
--- a/source/blender/blenkernel/intern/mesh_evaluate.c
+++ b/source/blender/blenkernel/intern/mesh_evaluate.c
@@ -569,7 +569,7 @@ void BKE_lnor_space_add_loop(
lnors_spacearr->lspacearr[ml_index] = lnor_space;
if (bm_loop == NULL) {
- bm_loop = SET_INT_IN_POINTER(ml_index);
+ bm_loop = POINTER_FROM_INT(ml_index);
}
if (is_single) {
BLI_assert(lnor_space->loops == NULL);
@@ -1658,7 +1658,7 @@ static void mesh_normals_loop_custom_set(
const float *org_nor = NULL;
while (loops) {
- const int lidx = GET_INT_FROM_POINTER(loops->link);
+ const int lidx = POINTER_AS_INT(loops->link);
MLoop *ml = &mloops[lidx];
const int nidx = lidx;
float *nor = r_custom_loopnors[nidx];
@@ -1689,7 +1689,7 @@ static void mesh_normals_loop_custom_set(
* See T45984. */
loops = lnors_spacearr.lspacearr[i]->loops;
if (loops && org_nor) {
- const int lidx = GET_INT_FROM_POINTER(loops->link);
+ const int lidx = POINTER_AS_INT(loops->link);
MLoop *ml = &mloops[lidx];
const int nidx = lidx;
float *nor = r_custom_loopnors[nidx];
@@ -1731,7 +1731,7 @@ static void mesh_normals_loop_custom_set(
*/
LinkNode *loops = lnors_spacearr.lspacearr[i]->loops;
if (lnors_spacearr.lspacearr[i]->flags & MLNOR_SPACE_IS_SINGLE) {
- BLI_assert(GET_INT_FROM_POINTER(loops) == i);
+ BLI_assert(POINTER_AS_INT(loops) == i);
const int nidx = use_vertices ? (int)mloops[i].v : i;
float *nor = r_custom_loopnors[nidx];
@@ -1745,7 +1745,7 @@ static void mesh_normals_loop_custom_set(
zero_v3(avg_nor);
while (loops) {
- const int lidx = GET_INT_FROM_POINTER(loops->link);
+ const int lidx = POINTER_AS_INT(loops->link);
const int nidx = use_vertices ? (int)mloops[lidx].v : lidx;
float *nor = r_custom_loopnors[nidx];
@@ -2424,7 +2424,7 @@ bool BKE_mesh_center_of_volume(const Mesh *me, float r_cent[3])
}
/* otherwise we get NAN for 0 polys */
if (total_volume != 0.0f) {
- /* multipy by 0.25 to get the correct centroid */
+ /* multiply by 0.25 to get the correct centroid */
/* no need to divide volume by 6 as the centroid is weighted by 6x the volume, so it all cancels out */
mul_v3_fl(r_cent, 0.25f / total_volume);
}
@@ -3356,7 +3356,7 @@ void BKE_mesh_convert_mfaces_to_mpolys_ex(
/* build edge hash */
me = medge;
for (i = 0; i < totedge_i; i++, me++) {
- BLI_edgehash_insert(eh, me->v1, me->v2, SET_UINT_IN_POINTER(i));
+ BLI_edgehash_insert(eh, me->v1, me->v2, POINTER_FROM_UINT(i));
/* unrelated but avoid having the FGON flag enabled, so we can reuse it later for something else */
me->flag &= ~ME_FGON;
@@ -3378,7 +3378,7 @@ void BKE_mesh_convert_mfaces_to_mpolys_ex(
# define ML(v1, v2) { \
ml->v = mf->v1; \
- ml->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(eh, mf->v1, mf->v2)); \
+ ml->e = POINTER_AS_UINT(BLI_edgehash_lookup(eh, mf->v1, mf->v2)); \
ml++; j++; \
} (void)0
diff --git a/source/blender/blenkernel/intern/mesh_mapping.c b/source/blender/blenkernel/intern/mesh_mapping.c
index 5c9849f6b74..2d82a5102b0 100644
--- a/source/blender/blenkernel/intern/mesh_mapping.c
+++ b/source/blender/blenkernel/intern/mesh_mapping.c
@@ -1109,7 +1109,7 @@ bool BKE_mesh_calc_islands_loop_poly_edgeseam(
*
* \note If no MLoopUV layer is passed, we only consider edges tagged as seams as UV boundaries.
* This has the advantages of simplicity, and being valid/common to all UV maps.
- * However, it means actual UV islands whithout matching UV seams will not be handled correctly...
+ * However, it means actual UV islands without matching UV seams will not be handled correctly...
* If a valid UV layer is passed as \a luvs parameter, UV coordinates are also used to detect islands boundaries.
*
* \note All this could be optimized...
diff --git a/source/blender/blenkernel/intern/mesh_remap.c b/source/blender/blenkernel/intern/mesh_remap.c
index 77aefc04f5f..62c81bf8cba 100644
--- a/source/blender/blenkernel/intern/mesh_remap.c
+++ b/source/blender/blenkernel/intern/mesh_remap.c
@@ -281,7 +281,7 @@ void BKE_mesh_remap_find_best_match_from_dm(
best_match = match;
copy_m4_m4(best_mat_dst, mat_dst);
- /* And now, we have to check the otehr sixth possible mirrored versions... */
+ /* And now, we have to check the other sixth possible mirrored versions... */
for (mirr = mirrors; (*mirr)[0]; mirr++) {
mul_v3_fl(mat_dst[0], (*mirr)[0]);
mul_v3_fl(mat_dst[1], (*mirr)[1]);
@@ -972,7 +972,7 @@ static void mesh_island_to_astar_graph_edge_process(
const int pidx = edge_to_poly_map[edge_idx].indices[i];
MPoly *mp = &polys[pidx];
const int pidx_isld = islands ? poly_island_index_map[pidx] : pidx;
- void *custom_data = is_edge_innercut ? SET_INT_IN_POINTER(edge_idx) : SET_INT_IN_POINTER(-1);
+ void *custom_data = is_edge_innercut ? POINTER_FROM_INT(edge_idx) : POINTER_FROM_INT(-1);
if (UNLIKELY(islands && (islands->items_to_islands[mp->loopstart] != island_index))) {
/* poly not in current island, happens with border edges... */
@@ -1088,12 +1088,12 @@ static float mesh_remap_calc_loops_astar_f_cost(
{
float *co_next, *co_dest;
- if (link && (GET_INT_FROM_POINTER(link->custom_data) != -1)) {
+ if (link && (POINTER_AS_INT(link->custom_data) != -1)) {
/* An innercut edge... We tag our solution as potentially crossing innercuts.
* Note it might not be the case in the end (AStar will explore around optimal path), but helps
* trimming off some processing later... */
- if (!GET_INT_FROM_POINTER(as_solution->custom_data)) {
- as_solution->custom_data = SET_INT_IN_POINTER(true);
+ if (!POINTER_AS_INT(as_solution->custom_data)) {
+ as_solution->custom_data = POINTER_FROM_INT(true);
}
}
@@ -1691,7 +1691,7 @@ void BKE_mesh_remap_calc_loops_from_dm(
continue;
}
- as_solution.custom_data = SET_INT_IN_POINTER(false);
+ as_solution.custom_data = POINTER_FROM_INT(false);
isld_res = &islands_res[best_island_index][plidx_dst];
if (use_from_vert) {
@@ -1714,7 +1714,7 @@ void BKE_mesh_remap_calc_loops_from_dm(
BLI_astar_graph_solve(
as_graph, pidx_isld_src_prev, pidx_isld_src,
mesh_remap_calc_loops_astar_f_cost, &as_solution, isld_steps_src);
- if (GET_INT_FROM_POINTER(as_solution.custom_data) && (as_solution.steps > 0)) {
+ if (POINTER_AS_INT(as_solution.custom_data) && (as_solution.steps > 0)) {
/* Find first 'cutting edge' on path, and bring back lidx_src on poly just
* before that edge.
* Note we could try to be much smarter (like e.g. storing a whole poly's indices,
@@ -1726,7 +1726,7 @@ void BKE_mesh_remap_calc_loops_from_dm(
/* Note we go backward here, from dest to src poly. */
for (i = as_solution.steps - 1; i--;) {
BLI_AStarGNLink *as_link = as_solution.prev_links[pidx_isld_src];
- const int eidx = GET_INT_FROM_POINTER(as_link->custom_data);
+ const int eidx = POINTER_AS_INT(as_link->custom_data);
pidx_isld_src = as_solution.prev_nodes[pidx_isld_src];
BLI_assert(pidx_isld_src != -1);
if (eidx != -1) {
@@ -1799,7 +1799,7 @@ void BKE_mesh_remap_calc_loops_from_dm(
BLI_astar_graph_solve(
as_graph, pidx_isld_src_prev, pidx_isld_src,
mesh_remap_calc_loops_astar_f_cost, &as_solution, isld_steps_src);
- if (GET_INT_FROM_POINTER(as_solution.custom_data) && (as_solution.steps > 0)) {
+ if (POINTER_AS_INT(as_solution.custom_data) && (as_solution.steps > 0)) {
/* Find first 'cutting edge' on path, and bring back lidx_src on poly just
* before that edge.
* Note we could try to be much smarter (like e.g. storing a whole poly's indices,
@@ -1811,7 +1811,7 @@ void BKE_mesh_remap_calc_loops_from_dm(
/* Note we go backward here, from dest to src poly. */
for (i = as_solution.steps - 1; i--;) {
BLI_AStarGNLink *as_link = as_solution.prev_links[pidx_isld_src];
- int eidx = GET_INT_FROM_POINTER(as_link->custom_data);
+ int eidx = POINTER_AS_INT(as_link->custom_data);
pidx_isld_src = as_solution.prev_nodes[pidx_isld_src];
BLI_assert(pidx_isld_src != -1);
diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c
index 5c835bbf0fa..82b3edb5b49 100644
--- a/source/blender/blenkernel/intern/mesh_validate.c
+++ b/source/blender/blenkernel/intern/mesh_validate.c
@@ -326,13 +326,13 @@ bool BKE_mesh_validate_arrays(
if ((me->v1 != me->v2) && BLI_edgehash_haskey(edge_hash, me->v1, me->v2)) {
PRINT_ERR("\tEdge %u: is a duplicate of %d\n", i,
- GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, me->v1, me->v2)));
+ POINTER_AS_INT(BLI_edgehash_lookup(edge_hash, me->v1, me->v2)));
remove = do_fixes;
}
if (remove == false) {
if (me->v1 != me->v2) {
- BLI_edgehash_insert(edge_hash, me->v1, me->v2, SET_INT_IN_POINTER(i));
+ BLI_edgehash_insert(edge_hash, me->v1, me->v2, POINTER_FROM_INT(i));
}
}
else {
@@ -362,7 +362,7 @@ bool BKE_mesh_validate_arrays(
SortFace *sf_prev;
unsigned int totsortface = 0;
- PRINT_ERR("No Polys, only tesselated Faces\n");
+ PRINT_ERR("No Polys, only tessellated Faces\n");
for (i = 0, mf = mfaces, sf = sort_faces; i < totface; i++, mf++) {
bool remove = false;
@@ -566,7 +566,7 @@ bool BKE_mesh_validate_arrays(
* We already know from previous text that a valid edge exists, use it (if allowed)! */
if (do_fixes) {
int prev_e = ml->e;
- ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, v1, v2));
+ ml->e = POINTER_AS_INT(BLI_edgehash_lookup(edge_hash, v1, v2));
fix_flag.loops_edge = true;
PRINT_ERR("\tLoop %u has invalid edge reference (%d), fixed using edge %u\n",
sp->loopstart + j, prev_e, ml->e);
@@ -583,7 +583,7 @@ bool BKE_mesh_validate_arrays(
* and we already know from previous test that a valid one exists, use it (if allowed)! */
if (do_fixes) {
int prev_e = ml->e;
- ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, v1, v2));
+ ml->e = POINTER_AS_INT(BLI_edgehash_lookup(edge_hash, v1, v2));
fix_flag.loops_edge = true;
PRINT_ERR("\tPoly %u has invalid edge reference (%d, is_removed: %d), fixed using edge %u\n",
sp->index, prev_e, IS_REMOVED_EDGE(me), ml->e);
@@ -1390,7 +1390,7 @@ static void mesh_calc_edges_mdata(
/* set edge members of mloops */
hash = BLI_edgehash_new_ex(__func__, totedge_final);
for (edge_index = 0, med = medge; edge_index < totedge_final; edge_index++, med++) {
- BLI_edgehash_insert(hash, med->v1, med->v2, SET_UINT_IN_POINTER(edge_index));
+ BLI_edgehash_insert(hash, med->v1, med->v2, POINTER_FROM_UINT(edge_index));
}
mpoly = allpoly;
@@ -1402,7 +1402,7 @@ static void mesh_calc_edges_mdata(
ml = &ml_next[i - 1]; /* last loop */
while (i-- != 0) {
- ml->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(hash, ml->v, ml_next->v));
+ ml->e = POINTER_AS_UINT(BLI_edgehash_lookup(hash, ml->v, ml_next->v));
ml = ml_next;
ml_next++;
}
@@ -1511,7 +1511,7 @@ void BKE_mesh_calc_edges(Mesh *mesh, bool update, const bool select)
}
/* store the new edge index in the hash value */
- BLI_edgehashIterator_setValue(ehi, SET_INT_IN_POINTER(i));
+ BLI_edgehashIterator_setValue(ehi, POINTER_FROM_INT(i));
}
BLI_edgehashIterator_free(ehi);
@@ -1524,7 +1524,7 @@ void BKE_mesh_calc_edges(Mesh *mesh, bool update, const bool select)
int j;
for (j = 0; j < mp->totloop; j++, l++) {
/* lookup hashed edge index */
- med_index = GET_INT_FROM_POINTER(BLI_edgehash_lookup(eh, l_prev->v, l->v));
+ med_index = POINTER_AS_INT(BLI_edgehash_lookup(eh, l_prev->v, l->v));
l_prev->e = med_index;
l_prev = l;
}
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index 9fc3fc4ba64..723b4a5aa97 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -287,7 +287,7 @@ void modifier_copyData_generic(const ModifierData *md_src, ModifierData *md_dst)
{
const ModifierTypeInfo *mti = modifierType_getInfo(md_src->type);
- /* md_dst may have alredy be fully initialized with some extra allocated data,
+ /* md_dst may have already be fully initialized with some extra allocated data,
* we need to free it now to avoid memleak. */
if (mti->freeData) {
mti->freeData(md_dst);
@@ -754,7 +754,7 @@ void test_object_modifiers(Object *ob)
}
}
-/* where should this go?, it doesnt fit well anywhere :S - campbell */
+/* where should this go?, it doesn't fit well anywhere :S - campbell */
/* elubie: changed this to default to the same dir as the render output
* to prevent saving to C:\ on Windows */
diff --git a/source/blender/blenkernel/intern/modifiers_bmesh.c b/source/blender/blenkernel/intern/modifiers_bmesh.c
index a1172d3f110..4de876f1060 100644
--- a/source/blender/blenkernel/intern/modifiers_bmesh.c
+++ b/source/blender/blenkernel/intern/modifiers_bmesh.c
@@ -106,7 +106,7 @@ void DM_to_bmesh_ex(DerivedMesh *dm, BMesh *bm, const bool calc_face_normal)
/*do verts*/
bool vert_allocated;
- mv = mvert = DM_get_vert_array(dm, &vert_allocated);;
+ mv = mvert = DM_get_vert_array(dm, &vert_allocated);
for (i = 0; i < totvert; i++, mv++) {
v = BM_vert_create(bm, mv->co, NULL, BM_CREATE_SKIP_CD);
normal_short_to_float_v3(v->no, mv->no);
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index f91d88a8a4a..2f0af028abd 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -254,7 +254,7 @@ void BKE_nla_tracks_copy(Main *bmain, ListBase *dst, ListBase *src)
/* Adding ------------------------------------------- */
/* Add a NLA Track to the given AnimData
- * - prev: NLA-Track to add the new one after
+ * - prev: NLA-Track to add the new one after
*/
NlaTrack *BKE_nlatrack_add(AnimData *adt, NlaTrack *prev)
{
@@ -299,11 +299,11 @@ NlaStrip *BKE_nlastrip_new(bAction *act)
strip = MEM_callocN(sizeof(NlaStrip), "NlaStrip");
/* generic settings
- * - selected flag to highlight this to the user
- * - (XXX) disabled Auto-Blends, as this was often causing some unwanted effects
- * - (XXX) synchronization of strip-length in accordance with changes to action-length
- * is not done though, since this should only really happens in editmode for strips now
- * though this decision is still subject to further review...
+ * - selected flag to highlight this to the user
+ * - (XXX) disabled Auto-Blends, as this was often causing some unwanted effects
+ * - (XXX) synchronization of strip-length in accordance with changes to action-length
+ * is not done though, since this should only really happens in editmode for strips now
+ * though this decision is still subject to further review...
*/
strip->flag = NLASTRIP_FLAG_SELECT;
@@ -312,7 +312,7 @@ NlaStrip *BKE_nlastrip_new(bAction *act)
id_us_plus(&act->id);
/* determine initial range
- * - strip length cannot be 0... ever...
+ * - strip length cannot be 0... ever...
*/
calc_action_range(strip->act, &strip->actstart, &strip->actend, 0);
@@ -401,7 +401,7 @@ NlaStrip *BKE_nla_add_soundstrip(Scene *scene, Speaker *speaker)
/* Strip Mapping ------------------------------------- */
/* non clipped mapping for strip-time <-> global time (for Action-Clips)
- * invert = convert action-strip time to global time
+ * invert = convert action-strip time to global time
*/
static float nlastrip_get_frame_actionclip(NlaStrip *strip, float cframe, short mode)
{
@@ -471,7 +471,7 @@ static float nlastrip_get_frame_actionclip(NlaStrip *strip, float cframe, short
}
/* non clipped mapping for strip-time <-> global time (for Transitions)
- * invert = convert action-strip time to global time
+ * invert = convert action-strip time to global time
*/
static float nlastrip_get_frame_transition(NlaStrip *strip, float cframe, short mode)
{
@@ -516,7 +516,7 @@ float nlastrip_get_frame(NlaStrip *strip, float cframe, short mode)
/* Non clipped mapping for strip-time <-> global time
- * mode = eNlaTime_ConvertModes -> NLATIME_CONVERT_*
+ * mode = eNlaTime_ConvertModes -> NLATIME_CONVERT_*
*
* Public API method - perform this mapping using the given AnimData block
* and perform any necessary sanity checks on the value
@@ -526,9 +526,9 @@ float BKE_nla_tweakedit_remap(AnimData *adt, float cframe, short mode)
NlaStrip *strip;
/* sanity checks
- * - obviously we've got to have some starting data
- * - when not in tweakmode, the active Action does not have any scaling applied :)
- * - when in tweakmode, if the no-mapping flag is set, do not map
+ * - obviously we've got to have some starting data
+ * - when not in tweakmode, the active Action does not have any scaling applied :)
+ * - when in tweakmode, if the no-mapping flag is set, do not map
*/
if ((adt == NULL) || (adt->flag & ADT_NLA_EDIT_ON) == 0 || (adt->flag & ADT_NLA_EDIT_NOMAP))
return cframe;
@@ -548,9 +548,9 @@ float BKE_nla_tweakedit_remap(AnimData *adt, float cframe, short mode)
strip = adt->actstrip;
/* sanity checks
- * - in rare cases, we may not be able to find this strip for some reason (internal error)
- * - for now, if the user has defined a curve to control the time, this correction cannot be performed
- * reliably...
+ * - in rare cases, we may not be able to find this strip for some reason (internal error)
+ * - for now, if the user has defined a curve to control the time, this correction cannot be performed
+ * reliably...
*/
if ((strip == NULL) || (strip->flag & NLASTRIP_FLAG_USR_TIME))
return cframe;
@@ -680,7 +680,7 @@ bool BKE_nlastrips_add_strip(ListBase *strips, NlaStrip *strip)
/* Convert 'islands' (i.e. continuous string of) selected strips to be
* contained within 'Meta-Strips' which act as strips which contain strips.
- * temp: are the meta-strips to be created 'temporary' ones used for transforms?
+ * temp: are the meta-strips to be created 'temporary' ones used for transforms?
*/
void BKE_nlastrips_make_metas(ListBase *strips, bool is_temp)
{
@@ -756,8 +756,8 @@ void BKE_nlastrips_clear_metastrip(ListBase *strips, NlaStrip *strip)
}
/* Remove meta-strips (i.e. flatten the list of strips) from the top-level of the list of strips
- * sel: only consider selected meta-strips, otherwise all meta-strips are removed
- * onlyTemp: only remove the 'temporary' meta-strips used for transforms
+ * sel: only consider selected meta-strips, otherwise all meta-strips are removed
+ * onlyTemp: only remove the 'temporary' meta-strips used for transforms
*/
void BKE_nlastrips_clear_metas(ListBase *strips, bool only_sel, bool only_temp)
{
@@ -844,8 +844,8 @@ void BKE_nlameta_flush_transforms(NlaStrip *mstrip)
short scaleChanged = 0;
/* sanity checks
- * - strip must exist
- * - strip must be a meta-strip with some contents
+ * - strip must exist
+ * - strip must be a meta-strip with some contents
*/
if (ELEM(NULL, mstrip, mstrip->strips.first))
return;
@@ -853,8 +853,8 @@ void BKE_nlameta_flush_transforms(NlaStrip *mstrip)
return;
/* get the original start/end points, and calculate the start-frame offset
- * - these are simply the start/end frames of the child strips,
- * since we assume they weren't transformed yet
+ * - these are simply the start/end frames of the child strips,
+ * since we assume they weren't transformed yet
*/
oStart = ((NlaStrip *)mstrip->strips.first)->start;
oEnd = ((NlaStrip *)mstrip->strips.last)->end;
@@ -862,7 +862,7 @@ void BKE_nlameta_flush_transforms(NlaStrip *mstrip)
/* optimization:
* don't flush if nothing changed yet
- * TODO: maybe we need a flag to say always flush?
+ * TODO: maybe we need a flag to say always flush?
*/
if (IS_EQF(oStart, mstrip->start) && IS_EQF(oEnd, mstrip->end))
return;
@@ -1008,7 +1008,7 @@ void BKE_nlatrack_set_active(ListBase *tracks, NlaTrack *nlt_a)
if (ELEM(NULL, tracks, tracks->first))
return;
- /* deactive all the rest */
+ /* deactivate all the rest */
for (nlt = tracks->first; nlt; nlt = nlt->next)
nlt->flag &= ~NLATRACK_ACTIVE;
@@ -1021,9 +1021,9 @@ void BKE_nlatrack_set_active(ListBase *tracks, NlaTrack *nlt_a)
bool BKE_nlatrack_has_space(NlaTrack *nlt, float start, float end)
{
/* sanity checks
- * - track must exist
- * - track must be editable
- * - bounds cannot be equal (0-length is nasty)
+ * - track must exist
+ * - track must be editable
+ * - bounds cannot be equal (0-length is nasty)
*/
if ((nlt == NULL) || (nlt->flag & NLATRACK_PROTECTED) || IS_EQF(start, end))
return false;
@@ -1150,8 +1150,8 @@ bool BKE_nlastrip_within_bounds(NlaStrip *strip, float min, float max)
return false;
/* only ok if at least part of the strip is within the bounding window
- * - first 2 cases cover when the strip length is less than the bounding area
- * - second 2 cases cover when the strip length is greater than the bounding area
+ * - first 2 cases cover when the strip length is less than the bounding area
+ * - second 2 cases cover when the strip length is greater than the bounding area
*/
if ((stripLen < boundsLen) &&
!(IN_RANGE(strip->start, min, max) ||
@@ -1180,7 +1180,7 @@ static void nlastrip_fix_resize_overlaps(NlaStrip *strip)
float offset = 0.0f;
if (nls->type == NLASTRIP_TYPE_TRANSITION) {
- /* transition strips should grow/shrink to accomodate the resized strip,
+ /* transition strips should grow/shrink to accommodate the resized strip,
* but if the strip's bounds now exceed the transition, we're forced to
* offset everything to maintain the balance
*/
@@ -1227,7 +1227,7 @@ static void nlastrip_fix_resize_overlaps(NlaStrip *strip)
float offset = 0.0f;
if (nls->type == NLASTRIP_TYPE_TRANSITION) {
- /* transition strips should grow/shrink to accomodate the resized strip,
+ /* transition strips should grow/shrink to accommodate the resized strip,
* but if the strip's bounds now exceed the transition, we're forced to
* offset everything to maintain the balance
*/
@@ -1276,8 +1276,8 @@ void BKE_nlastrip_recalculate_bounds(NlaStrip *strip)
float actlen, mapping;
/* sanity checks
- * - must have a strip
- * - can only be done for action clips
+ * - must have a strip
+ * - can only be done for action clips
*/
if ((strip == NULL) || (strip->type != NLASTRIP_TYPE_CLIP))
return;
@@ -1297,7 +1297,7 @@ void BKE_nlastrip_recalculate_bounds(NlaStrip *strip)
}
/* Is the given NLA-strip the first one to occur for the given AnimData block */
-// TODO: make this an api method if necesary, but need to add prefix first
+// TODO: make this an api method if necessary, but need to add prefix first
static bool nlastrip_is_first(AnimData *adt, NlaStrip *strip)
{
NlaTrack *nlt;
@@ -1500,8 +1500,8 @@ void BKE_nlastrip_validate_name(AnimData *adt, NlaStrip *strip)
}
/* build a hash-table of all the strips in the tracks
- * - this is easier than iterating over all the tracks+strips hierarchy every time
- * (and probably faster)
+ * - this is easier than iterating over all the tracks+strips hierarchy every time
+ * (and probably faster)
*/
gh = BLI_ghash_str_new("nlastrip_validate_name gh");
@@ -1517,7 +1517,7 @@ void BKE_nlastrip_validate_name(AnimData *adt, NlaStrip *strip)
}
/* if the hash-table has a match for this name, try other names...
- * - in an extreme case, it might not be able to find a name, but then everything else in Blender would fail too :)
+ * - in an extreme case, it might not be able to find a name, but then everything else in Blender would fail too :)
*/
BLI_uniquename_cb(nla_editbone_name_check, (void *)gh, DATA_("NlaStrip"), '.', strip->name, sizeof(strip->name));
@@ -1528,9 +1528,9 @@ void BKE_nlastrip_validate_name(AnimData *adt, NlaStrip *strip)
/* ---- */
/* Get strips which overlap the given one at the start/end of its range
- * - strip: strip that we're finding overlaps for
- * - track: nla-track that the overlapping strips should be found from
- * - start, end: frames for the offending endpoints
+ * - strip: strip that we're finding overlaps for
+ * - track: nla-track that the overlapping strips should be found from
+ * - start, end: frames for the offending endpoints
*/
static void nlastrip_get_endpoint_overlaps(NlaStrip *strip, NlaTrack *track, float **start, float **end)
{
@@ -1555,7 +1555,7 @@ static void nlastrip_get_endpoint_overlaps(NlaStrip *strip, NlaTrack *track, flo
return; /* the range we're after has already passed */
/* if this strip is not part of an island of continuous strips, it can be used
- * - this check needs to be done for each end of the strip we try and use...
+ * - this check needs to be done for each end of the strip we try and use...
*/
if ((nls->next == NULL) || IS_EQF(nls->next->start, nls->end) == 0) {
if ((nls->end > strip->start) && (nls->end < strip->end))
@@ -1589,9 +1589,9 @@ static void BKE_nlastrip_validate_autoblends(NlaTrack *nlt, NlaStrip *nls)
nlastrip_get_endpoint_overlaps(nls, nlt->next, &ns, &ne);
/* set overlaps for this strip
- * - don't use the values obtained though if the end in question
- * is directly followed/preceded by another strip, forming an
- * 'island' of continuous strips
+ * - don't use the values obtained though if the end in question
+ * is directly followed/preceded by another strip, forming an
+ * 'island' of continuous strips
*/
if ((ps || ns) && ((nls->prev == NULL) || IS_EQF(nls->prev->end, nls->start) == 0)) {
/* start overlaps - pick the largest overlap */
@@ -1809,7 +1809,7 @@ void BKE_nla_action_pushdown(AnimData *adt)
* NOTE: An alternative way would have been to instead hack the influence
* to not get always get reset to full strength if NLASTRIP_FLAG_USR_INFLUENCE
* is disabled but auto-blending isn't being used. However, that approach
- * is a bit hacky/hard to discover, and may cause backwards compatability issues,
+ * is a bit hacky/hard to discover, and may cause backwards compatibility issues,
* so it's better to just do it this way.
*/
strip->flag |= NLASTRIP_FLAG_USR_INFLUENCE;
@@ -1854,7 +1854,7 @@ bool BKE_nla_tweakmode_enter(AnimData *adt)
return true;
/* go over the tracks, finding the active one, and its active strip
- * - if we cannot find both, then there's nothing to do
+ * - if we cannot find both, then there's nothing to do
*/
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
/* check if active */
@@ -1924,16 +1924,16 @@ bool BKE_nla_tweakmode_enter(AnimData *adt)
}
/* go over all the tracks after AND INCLUDING the active one, tagging them as being disabled
- * - the active track needs to also be tagged, otherwise, it'll overlap with the tweaks going on
+ * - the active track needs to also be tagged, otherwise, it'll overlap with the tweaks going on
*/
for (nlt = activeTrack; nlt; nlt = nlt->next)
nlt->flag |= NLATRACK_DISABLED;
/* handle AnimData level changes:
- * - 'real' active action to temp storage (no need to change user-counts)
- * - action of active strip set to be the 'active action', and have its usercount incremented
- * - editing-flag for this AnimData block should also get turned on (for more efficient restoring)
- * - take note of the active strip for mapping-correction of keyframes in the action being edited
+ * - 'real' active action to temp storage (no need to change user-counts)
+ * - action of active strip set to be the 'active action', and have its usercount incremented
+ * - editing-flag for this AnimData block should also get turned on (for more efficient restoring)
+ * - take note of the active strip for mapping-correction of keyframes in the action being edited
*/
adt->tmpact = adt->action;
adt->action = activeStrip->act;
@@ -1999,11 +1999,11 @@ void BKE_nla_tweakmode_exit(AnimData *adt)
}
/* handle AnimData level changes:
- * - 'temporary' active action needs its usercount decreased, since we're removing this reference
- * - 'real' active action is restored from storage
- * - storage pointer gets cleared (to avoid having bad notes hanging around)
- * - editing-flag for this AnimData block should also get turned off
- * - clear pointer to active strip
+ * - 'temporary' active action needs its usercount decreased, since we're removing this reference
+ * - 'real' active action is restored from storage
+ * - storage pointer gets cleared (to avoid having bad notes hanging around)
+ * - editing-flag for this AnimData block should also get turned off
+ * - clear pointer to active strip
*/
if (adt->action)
id_us_min(&adt->action->id);
@@ -2020,8 +2020,8 @@ static void UNUSED_FUNCTION(BKE_nla_bake) (Scene *scene, ID *UNUSED(id), AnimDat
{
/* verify that data is valid
- * 1) Scene and AnimData must be provided
- * 2) there must be tracks to merge...
+ * 1) Scene and AnimData must be provided
+ * 2) there must be tracks to merge...
*/
if (ELEM(NULL, scene, adt, adt->nla_tracks.first))
return;
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index c830917a547..b3f210dfba5 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -2067,7 +2067,7 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree)
/* sync local composite with real tree */
/* local tree is supposed to be running, be careful moving previews! */
-/* is called by jobs manager, outside threads, so it doesnt happen during draw */
+/* is called by jobs manager, outside threads, so it doesn't happen during draw */
void ntreeLocalSync(bNodeTree *localtree, bNodeTree *ntree)
{
if (localtree && ntree) {
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 9f635966ee7..add7c1fd992 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1785,7 +1785,7 @@ static void ob_parbone(Object *ob, Object *par, float mat[4][4])
/* get bone transform */
if (pchan->bone->flag & BONE_RELATIVE_PARENTING) {
- /* the new option uses the root - expected bahaviour, but differs from old... */
+ /* the new option uses the root - expected behaviour, but differs from old... */
/* XXX check on version patching? */
copy_m4_m4(mat, pchan->chan_mat);
}
@@ -1855,7 +1855,7 @@ static void give_parvert(Object *par, int nr, float vec[3])
if (use_special_ss_case) {
/* Special case if the last modifier is SS and no constructive modifier are in front of it. */
CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
- CCGVert *ccg_vert = ccgSubSurf_getVert(ccgdm->ss, SET_INT_IN_POINTER(nr));
+ CCGVert *ccg_vert = ccgSubSurf_getVert(ccgdm->ss, POINTER_FROM_INT(nr));
/* In case we deleted some verts, nr may refer to inexistent one now, see T42557. */
if (ccg_vert) {
float *co = ccgSubSurf_getVertData(ccgdm->ss, ccg_vert);
@@ -2770,7 +2770,7 @@ int BKE_object_obdata_texspace_get(Object *ob, short **r_texflag, float **r_loc,
static int pc_cmp(const void *a, const void *b)
{
const LinkData *ad = a, *bd = b;
- if (GET_INT_FROM_POINTER(ad->data) > GET_INT_FROM_POINTER(bd->data))
+ if (POINTER_AS_INT(ad->data) > POINTER_AS_INT(bd->data))
return 1;
else return 0;
}
@@ -2783,14 +2783,14 @@ int BKE_object_insert_ptcache(Object *ob)
BLI_listbase_sort(&ob->pc_ids, pc_cmp);
for (link = ob->pc_ids.first, i = 0; link; link = link->next, i++) {
- int index = GET_INT_FROM_POINTER(link->data);
+ int index = POINTER_AS_INT(link->data);
if (i < index)
break;
}
link = MEM_callocN(sizeof(LinkData), "PCLink");
- link->data = SET_INT_IN_POINTER(i);
+ link->data = POINTER_FROM_INT(i);
BLI_addtail(&ob->pc_ids, link);
return i;
@@ -2805,7 +2805,7 @@ static int pc_findindex(ListBase *listbase, int index)
link = listbase->first;
while (link) {
- if (GET_INT_FROM_POINTER(link->data) == index)
+ if (POINTER_AS_INT(link->data) == index)
return number;
number++;
@@ -3089,7 +3089,7 @@ int BKE_object_is_modified(Scene *scene, Object *ob)
* This makes it possible to give some degree of false-positives here,
* but it's currently an acceptable tradeoff between complexity and check
* speed. In combination with checks of modifier stack and real life usage
- * percentage of false-positives shouldn't be that hight.
+ * percentage of false-positives shouldn't be that height.
*/
static bool object_moves_in_time(Object *object)
{
diff --git a/source/blender/blenkernel/intern/object_deform.c b/source/blender/blenkernel/intern/object_deform.c
index dc36f2ed202..47f86c28dfc 100644
--- a/source/blender/blenkernel/intern/object_deform.c
+++ b/source/blender/blenkernel/intern/object_deform.c
@@ -624,7 +624,7 @@ bool *BKE_object_defgroup_validmap_get(Object *ob, const int defbase_tot)
val_p = BLI_ghash_lookup_p(gh, chan->name);
if (val_p) {
- *val_p = SET_INT_IN_POINTER(1);
+ *val_p = POINTER_FROM_INT(1);
}
}
}
diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c
index 589c4468000..1406a7dd66b 100644
--- a/source/blender/blenkernel/intern/object_dupli.c
+++ b/source/blender/blenkernel/intern/object_dupli.c
@@ -254,7 +254,7 @@ static void make_child_duplis(const DupliContext *ctx, void *userdata, MakeChild
/* mballs have a different dupli handling */
if (ob->type != OB_MBALL)
- ob->flag |= OB_DONE; /* doesnt render */
+ ob->flag |= OB_DONE; /* doesn't render */
make_child_duplis_cb(&pctx, userdata, ob);
}
@@ -373,8 +373,8 @@ static void make_duplis_frames(const DupliContext *ctx)
/* make a copy of the object's original data (before any dupli-data overwrites it)
* as we'll need this to keep track of unkeyed data
- * - this doesn't take into account other data that can be reached from the object,
- * for example it's shapekeys or bones, hence the need for an update flush at the end
+ * - this doesn't take into account other data that can be reached from the object,
+ * for example it's shapekeys or bones, hence the need for an update flush at the end
*/
copyob = *ob;
@@ -585,7 +585,7 @@ static Object *find_family_object(Main *bmain, const char *family, size_t family
{
Object **ob_pt;
Object *ob;
- void *ch_key = SET_UINT_IN_POINTER(ch);
+ void *ch_key = POINTER_FROM_UINT(ch);
if ((ob_pt = (Object **)BLI_ghash_lookup_p(family_gh, ch_key))) {
ob = *ob_pt;
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index da455faaa86..0637fc4f00c 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -268,7 +268,7 @@ void packAll(Main *bmain, ReportList *reports, bool verbose)
#if 0
// attempt to create a function that generates an unique filename
-// this will work when all funtions in fileops.c understand relative filenames...
+// this will work when all functions in fileops.c understand relative filenames...
static char *find_new_name(char *name)
{
@@ -362,7 +362,7 @@ int writePackedFile(
*
* - PF_EQUAL: the packed file and original file are identical
* - PF_DIFFERENT: the packed file and original file differ
- * - PF_NOFILE: the original file doens't exist
+ * - PF_NOFILE: the original file doesn't exist
*/
int checkPackedFile(const char *ref_file_name, const char *filename, PackedFile *pf)
{
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 2c17fa44229..dd5d801d2ac 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -83,9 +83,9 @@ void BKE_paint_invalidate_overlay_tex(Scene *scene, const Tex *tex)
return;
if (br->mtex.tex == tex)
- overlay_flags |= PAINT_INVALID_OVERLAY_TEXTURE_PRIMARY;
+ overlay_flags |= PAINT_OVERLAY_INVALID_TEXTURE_PRIMARY;
if (br->mask_mtex.tex == tex)
- overlay_flags |= PAINT_INVALID_OVERLAY_TEXTURE_SECONDARY;
+ overlay_flags |= PAINT_OVERLAY_INVALID_TEXTURE_SECONDARY;
}
void BKE_paint_invalidate_cursor_overlay(Scene *scene, CurveMapping *curve)
@@ -94,14 +94,14 @@ void BKE_paint_invalidate_cursor_overlay(Scene *scene, CurveMapping *curve)
Brush *br = p->brush;
if (br && br->curve == curve)
- overlay_flags |= PAINT_INVALID_OVERLAY_CURVE;
+ overlay_flags |= PAINT_OVERLAY_INVALID_CURVE;
}
void BKE_paint_invalidate_overlay_all(void)
{
- overlay_flags |= (PAINT_INVALID_OVERLAY_TEXTURE_SECONDARY |
- PAINT_INVALID_OVERLAY_TEXTURE_PRIMARY |
- PAINT_INVALID_OVERLAY_CURVE);
+ overlay_flags |= (PAINT_OVERLAY_INVALID_TEXTURE_SECONDARY |
+ PAINT_OVERLAY_INVALID_TEXTURE_PRIMARY |
+ PAINT_OVERLAY_INVALID_CURVE);
}
eOverlayControlFlags BKE_paint_get_overlay_flags(void)
@@ -135,18 +135,18 @@ Paint *BKE_paint_get_active_from_paintmode(Scene *sce, ePaintMode mode)
ToolSettings *ts = sce->toolsettings;
switch (mode) {
- case ePaintSculpt:
+ case PAINT_MODE_SCULPT:
return &ts->sculpt->paint;
- case ePaintVertex:
+ case PAINT_MODE_VERTEX:
return &ts->vpaint->paint;
- case ePaintWeight:
+ case PAINT_MODE_WEIGHT:
return &ts->wpaint->paint;
- case ePaintTexture2D:
- case ePaintTextureProjective:
+ case PAINT_MODE_TEXTURE_2D:
+ case PAINT_MODE_TEXTURE_3D:
return &ts->imapaint.paint;
- case ePaintSculptUV:
+ case PAINT_MODE_SCULPT_UV:
return &ts->uvsculpt->paint;
- case ePaintInvalid:
+ case PAINT_MODE_INVALID:
return NULL;
default:
return &ts->imapaint.paint;
@@ -231,39 +231,39 @@ ePaintMode BKE_paintmode_get_active_from_context(const bContext *C)
if ((sima = CTX_wm_space_image(C)) != NULL) {
if (obact && obact->mode == OB_MODE_EDIT) {
if (sima->mode == SI_MODE_PAINT)
- return ePaintTexture2D;
+ return PAINT_MODE_TEXTURE_2D;
else if (ts->use_uv_sculpt)
- return ePaintSculptUV;
+ return PAINT_MODE_SCULPT_UV;
}
else {
- return ePaintTexture2D;
+ return PAINT_MODE_TEXTURE_2D;
}
}
else if (obact) {
switch (obact->mode) {
case OB_MODE_SCULPT:
- return ePaintSculpt;
+ return PAINT_MODE_SCULPT;
case OB_MODE_VERTEX_PAINT:
- return ePaintVertex;
+ return PAINT_MODE_VERTEX;
case OB_MODE_WEIGHT_PAINT:
- return ePaintWeight;
+ return PAINT_MODE_WEIGHT;
case OB_MODE_TEXTURE_PAINT:
- return ePaintTextureProjective;
+ return PAINT_MODE_TEXTURE_3D;
case OB_MODE_EDIT:
if (ts->use_uv_sculpt)
- return ePaintSculptUV;
- return ePaintTexture2D;
+ return PAINT_MODE_SCULPT_UV;
+ return PAINT_MODE_TEXTURE_2D;
default:
- return ePaintTexture2D;
+ return PAINT_MODE_TEXTURE_2D;
}
}
else {
/* default to image paint */
- return ePaintTexture2D;
+ return PAINT_MODE_TEXTURE_2D;
}
}
- return ePaintInvalid;
+ return PAINT_MODE_INVALID;
}
Brush *BKE_paint_brush(Paint *p)
@@ -480,19 +480,19 @@ void BKE_paint_cavity_curve_preset(Paint *p, int preset)
eObjectMode BKE_paint_object_mode_from_paint_mode(ePaintMode mode)
{
switch (mode) {
- case ePaintSculpt:
+ case PAINT_MODE_SCULPT:
return OB_MODE_SCULPT;
- case ePaintVertex:
+ case PAINT_MODE_VERTEX:
return OB_MODE_VERTEX_PAINT;
- case ePaintWeight:
+ case PAINT_MODE_WEIGHT:
return OB_MODE_WEIGHT_PAINT;
- case ePaintTextureProjective:
+ case PAINT_MODE_TEXTURE_3D:
return OB_MODE_TEXTURE_PAINT;
- case ePaintTexture2D:
+ case PAINT_MODE_TEXTURE_2D:
return OB_MODE_TEXTURE_PAINT;
- case ePaintSculptUV:
+ case PAINT_MODE_SCULPT_UV:
return OB_MODE_EDIT;
- case ePaintInvalid:
+ case PAINT_MODE_INVALID:
default:
return 0;
}
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index b43c5376af4..40c0e1f8184 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -1507,7 +1507,7 @@ int psys_particle_dm_face_lookup(
LinkNode *tessface_node = poly_nodes[pindex_orig];
for (; tessface_node; tessface_node = tessface_node->next) {
- int findex_dst = GET_INT_FROM_POINTER(tessface_node->link);
+ int findex_dst = POINTER_AS_INT(tessface_node->link);
faceuv = osface_final[findex_dst].uv;
/* check that this intersects - Its possible this misses :/ -
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 353c75d63c6..cc6e28b2a82 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -366,7 +366,7 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm_final, DerivedMesh *dm_deform
for (i=0, node=nodedmelem; i<totdmelem; i++, node++) {
int origindex_final;
- node->link = SET_INT_IN_POINTER(i);
+ node->link = POINTER_FROM_INT(i);
/* may be vertex or face origindex */
if (use_modifier_stack) {
@@ -409,7 +409,7 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm_final, DerivedMesh *dm_deform
else {
if (psys->part->from == PART_FROM_VERT) {
if (pa->num < totelem && nodearray[pa->num])
- pa->num_dmcache= GET_INT_FROM_POINTER(nodearray[pa->num]->link);
+ pa->num_dmcache= POINTER_AS_INT(nodearray[pa->num]->link);
else
pa->num_dmcache = DMCACHE_NOTFOUND;
}
@@ -1546,7 +1546,7 @@ static EdgeHash *sph_springhash_build(ParticleSystem *psys)
springhash = BLI_edgehash_new_ex(__func__, psys->tot_fluidsprings);
for (i=0, spring=psys->fluid_springs; i<psys->tot_fluidsprings; i++, spring++)
- BLI_edgehash_insert(springhash, spring->particle_index[0], spring->particle_index[1], SET_INT_IN_POINTER(i+1));
+ BLI_edgehash_insert(springhash, spring->particle_index[0], spring->particle_index[1], POINTER_FROM_INT(i+1));
return springhash;
}
@@ -1610,9 +1610,9 @@ static void sph_density_accum_cb(void *userdata, int index, const float co[3], f
/* Ugh! One particle has too many neighbors! If some aren't taken into
* account, the forces will be biased by the tree search order. This
- * effectively adds enery to the system, and results in a churning motion.
+ * effectively adds energy to the system, and results in a churning motion.
* But, we have to stop somewhere, and it's not the end of the world.
- * - jahka and z0r
+ * - jahka and z0r
*/
if (pfr->tot_neighbors >= SPH_NEIGHBORS)
return;
@@ -1748,7 +1748,7 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa
/* Viscoelastic spring force */
if (pfn->psys == psys[0] && fluid->flag & SPH_VISCOELASTIC_SPRINGS && springhash) {
/* BLI_edgehash_lookup appears to be thread-safe. - z0r */
- spring_index = GET_INT_FROM_POINTER(BLI_edgehash_lookup(springhash, index, pfn->index));
+ spring_index = POINTER_AS_INT(BLI_edgehash_lookup(springhash, index, pfn->index));
if (spring_index) {
spring = psys[0]->fluid_springs + spring_index - 1;
@@ -2187,7 +2187,7 @@ static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, f
}
/************************************************
- * Collisions
+ * Collisions
*
* The algorithm is roughly:
* 1. Use a BVH tree to search for faces that a particle may collide with.
@@ -4335,7 +4335,7 @@ void particle_system_update(Main *bmain, Scene *scene, Object *ob, ParticleSyste
pa->flag &= ~PARS_NO_DISP;
}
- /* free unexisting after reseting particles */
+ /* free unexisting after resetting particles */
if (free_unexisting)
free_unexisting_particles(&sim);
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index 772cda7266e..746e8b63a18 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -246,7 +246,7 @@ static int map_insert_vert(PBVH *bvh, GHash *map,
{
void *key, **value_p;
- key = SET_INT_IN_POINTER(vertex);
+ key = POINTER_FROM_INT(vertex);
if (!BLI_ghash_ensure_p(map, key, &value_p)) {
int value_i;
if (BLI_BITMAP_TEST(bvh->vert_bitmap, vertex) == 0) {
@@ -258,11 +258,11 @@ static int map_insert_vert(PBVH *bvh, GHash *map,
value_i = ~(*face_verts);
(*face_verts)++;
}
- *value_p = SET_INT_IN_POINTER(value_i);
+ *value_p = POINTER_FROM_INT(value_i);
return value_i;
}
else {
- return GET_INT_FROM_POINTER(*value_p);
+ return POINTER_AS_INT(*value_p);
}
}
@@ -303,13 +303,13 @@ static void build_mesh_leaf_node(PBVH *bvh, PBVHNode *node)
GHashIterator gh_iter;
GHASH_ITER (gh_iter, map) {
void *value = BLI_ghashIterator_getValue(&gh_iter);
- int ndx = GET_INT_FROM_POINTER(value);
+ int ndx = POINTER_AS_INT(value);
if (ndx < 0)
ndx = -ndx + node->uniq_verts - 1;
vert_indices[ndx] =
- GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&gh_iter));
+ POINTER_AS_INT(BLI_ghashIterator_getKey(&gh_iter));
}
for (int i = 0; i < totface; ++i) {
@@ -915,7 +915,7 @@ static void BKE_pbvh_search_callback_occluded(PBVH *bvh,
static bool update_search_cb(PBVHNode *node, void *data_v)
{
- int flag = GET_INT_FROM_POINTER(data_v);
+ int flag = POINTER_AS_INT(data_v);
if (node->flag & PBVH_Leaf)
return (node->flag & flag) != 0;
@@ -1232,7 +1232,7 @@ void BKE_pbvh_update(PBVH *bvh, int flag, float (*fnors)[3])
PBVHNode **nodes;
int totnode;
- BKE_pbvh_search_gather(bvh, update_search_cb, SET_INT_IN_POINTER(flag),
+ BKE_pbvh_search_gather(bvh, update_search_cb, POINTER_FROM_INT(flag),
&nodes, &totnode);
if (flag & PBVH_UpdateNormals)
@@ -2122,7 +2122,7 @@ void BKE_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*fnors)[3],
pbvh_node_check_mask_changed(bvh, &bvh->nodes[a]);
}
- BKE_pbvh_search_gather(bvh, update_search_cb, SET_INT_IN_POINTER(PBVH_UpdateNormals | PBVH_UpdateDrawBuffers),
+ BKE_pbvh_search_gather(bvh, update_search_cb, POINTER_FROM_INT(PBVH_UpdateNormals | PBVH_UpdateDrawBuffers),
&nodes, &totnode);
pbvh_update_normals(bvh, nodes, totnode, fnors);
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 7311b17134d..f611e7a94cd 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -137,7 +137,7 @@ static int ptcache_extra_datasize[] = {
sizeof(ParticleSpring)
};
-/* forward declerations */
+/* forward declarations */
static int ptcache_file_compressed_read(PTCacheFile *pf, unsigned char *result, unsigned int len);
static int ptcache_file_compressed_write(PTCacheFile *pf, unsigned char *in, unsigned int in_len, unsigned char *out, int mode);
static int ptcache_file_write(PTCacheFile *pf, const void *f, unsigned int tot, unsigned int size);
diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c
index a9b36a85602..9204bc69ee9 100644
--- a/source/blender/blenkernel/intern/report.c
+++ b/source/blender/blenkernel/intern/report.c
@@ -140,7 +140,7 @@ void BKE_reportf(ReportList *reports, ReportType type, const char *_format, ...)
va_start(args, _format);
vprintf(format, args);
va_end(args);
- fprintf(stdout, "\n"); /* otherise each report needs to include a \n */
+ fprintf(stdout, "\n"); /* otherwise each report needs to include a \n */
fflush(stdout); /* this ensures the message is printed before a crash */
}
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index bfc61794935..7fb313c838f 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -385,9 +385,9 @@ static void rigidbody_validate_sim_shape(Object *ob, bool rebuild)
return;
/* if automatically determining dimensions, use the Object's boundbox
- * - assume that all quadrics are standing upright on local z-axis
- * - assume even distribution of mass around the Object's pivot
- * (i.e. Object pivot is centralized in boundbox)
+ * - assume that all quadrics are standing upright on local z-axis
+ * - assume even distribution of mass around the Object's pivot
+ * (i.e. Object pivot is centralized in boundbox)
*/
// XXX: all dimensions are auto-determined now... later can add stored settings for this
/* get object dimensions without scaling */
@@ -472,10 +472,10 @@ void BKE_rigidbody_calc_volume(Object *ob, float *r_vol)
float volume = 0.0f;
/* if automatically determining dimensions, use the Object's boundbox
- * - assume that all quadrics are standing upright on local z-axis
- * - assume even distribution of mass around the Object's pivot
- * (i.e. Object pivot is centralized in boundbox)
- * - boundbox gives full width
+ * - assume that all quadrics are standing upright on local z-axis
+ * - assume even distribution of mass around the Object's pivot
+ * (i.e. Object pivot is centralized in boundbox)
+ * - boundbox gives full width
*/
// XXX: all dimensions are auto-determined now... later can add stored settings for this
BKE_object_dimensions_get(ob, size);
@@ -568,10 +568,10 @@ void BKE_rigidbody_calc_center_of_mass(Object *ob, float r_center[3])
zero_v3(r_center);
/* if automatically determining dimensions, use the Object's boundbox
- * - assume that all quadrics are standing upright on local z-axis
- * - assume even distribution of mass around the Object's pivot
- * (i.e. Object pivot is centralized in boundbox)
- * - boundbox gives full width
+ * - assume that all quadrics are standing upright on local z-axis
+ * - assume even distribution of mass around the Object's pivot
+ * (i.e. Object pivot is centralized in boundbox)
+ * - boundbox gives full width
*/
// XXX: all dimensions are auto-determined now... later can add stored settings for this
BKE_object_dimensions_get(ob, size);
@@ -647,7 +647,7 @@ static void rigidbody_validate_sim_object(RigidBodyWorld *rbw, Object *ob, bool
float rot[4];
/* sanity checks:
- * - object doesn't have RigidBody info already: then why is it here?
+ * - object doesn't have RigidBody info already: then why is it here?
*/
if (rbo == NULL)
return;
@@ -778,8 +778,8 @@ static void rigidbody_validate_sim_constraint(RigidBodyWorld *rbw, Object *ob, b
float ang_upper;
/* sanity checks:
- * - object should have a rigid body constraint
- * - rigid body constraint should have at least one constrained object
+ * - object should have a rigid body constraint
+ * - rigid body constraint should have at least one constrained object
*/
if (rbc == NULL) {
return;
@@ -939,8 +939,8 @@ RigidBodyWorld *BKE_rigidbody_create_world(Scene *scene)
RigidBodyWorld *rbw;
/* sanity checks
- * - there must be a valid scene to add world to
- * - there mustn't be a sim world using this group already
+ * - there must be a valid scene to add world to
+ * - there mustn't be a sim world using this group already
*/
if (scene == NULL)
return NULL;
@@ -1015,9 +1015,9 @@ RigidBodyOb *BKE_rigidbody_create_object(Scene *scene, Object *ob, short type)
RigidBodyWorld *rbw = scene->rigidbody_world;
/* sanity checks
- * - rigidbody world must exist
- * - object must exist
- * - cannot add rigid body if it already exists
+ * - rigidbody world must exist
+ * - object must exist
+ * - cannot add rigid body if it already exists
*/
if (ob == NULL || (ob->rigidbody_object != NULL))
return NULL;
@@ -1070,9 +1070,9 @@ RigidBodyCon *BKE_rigidbody_create_constraint(Scene *scene, Object *ob, short ty
RigidBodyWorld *rbw = scene->rigidbody_world;
/* sanity checks
- * - rigidbody world must exist
- * - object must exist
- * - cannot add constraint if it already exists
+ * - rigidbody world must exist
+ * - object must exist
+ * - cannot add constraint if it already exists
*/
if (ob == NULL || (ob->rigidbody_constraint != NULL))
return NULL;
@@ -1312,7 +1312,7 @@ static void rigidbody_update_sim_ob(Scene *scene, RigidBodyWorld *rbw, Object *o
pd_point_from_loc(scene, eff_loc, eff_vel, 0, &epoint);
/* calculate net force of effectors, and apply to sim object
- * - we use 'central force' since apply force requires a "relative position" which we don't have...
+ * - we use 'central force' since apply force requires a "relative position" which we don't have...
*/
pdDoEffectors(effectors, NULL, effector_weights, &epoint, eff_force, NULL);
if (G.f & G_DEBUG)
@@ -1382,7 +1382,7 @@ static void rigidbody_update_simulation(Scene *scene, RigidBodyWorld *rbw, bool
if (rbo == NULL) {
/* Since this object is included in the sim group but doesn't have
* rigid body settings (perhaps it was added manually), add!
- * - assume object to be active? That is the default for newly added settings...
+ * - assume object to be active? That is the default for newly added settings...
*/
ob->rigidbody_object = BKE_rigidbody_create_object(scene, ob, RBO_TYPE_ACTIVE);
rigidbody_validate_sim_object(rbw, ob, true);
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 1eb65519596..9689ab173a8 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -402,6 +402,7 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
for (SceneRenderLayer *srl_dst = sce_copy->r.layers.first; srl_dst; srl_dst = srl_dst->next) {
for (FreestyleLineSet *lineset = srl_dst->freestyleConfig.linesets.first; lineset; lineset = lineset->next) {
if (lineset->linestyle) {
+ id_us_min(&lineset->linestyle->id);
/* XXX Not copying anim/actions here? */
BKE_id_copy_ex(bmain, (ID *)lineset->linestyle, (ID **)&lineset->linestyle, 0, false);
}
@@ -410,12 +411,14 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
/* Full copy of world (included animations) */
if (sce_copy->world) {
+ id_us_min(&sce_copy->world->id);
BKE_id_copy_ex(bmain, (ID *)sce_copy->world, (ID **)&sce_copy->world, LIB_ID_COPY_ACTIONS, false);
}
/* Full copy of GreasePencil. */
/* XXX Not copying anim/actions here? */
if (sce_copy->gpd) {
+ id_us_min(&sce_copy->gpd->id);
BKE_id_copy_ex(bmain, (ID *)sce_copy->gpd, (ID **)&sce_copy->gpd, 0, false);
}
}
@@ -430,6 +433,7 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
* are done outside of blenkernel with ED_objects_single_users! */
/* camera */
+ /* XXX This is most certainly useless? Object have not yet been duplicated... */
if (ELEM(type, SCE_COPY_LINK_DATA, SCE_COPY_FULL)) {
ID_NEW_REMAP(sce_copy->camera);
}
@@ -1310,10 +1314,10 @@ void BKE_scene_frame_set(struct Scene *scene, double cfra)
#ifdef WITH_LEGACY_DEPSGRAPH
/* drivers support/hacks
- * - this method is called from scene_update_tagged_recursive(), so gets included in viewport + render
- * - these are always run since the depsgraph can't handle non-object data
- * - these happen after objects are all done so that we can read in their final transform values,
- * though this means that objects can't refer to scene info for guidance...
+ * - this method is called from scene_update_tagged_recursive(), so gets included in viewport + render
+ * - these are always run since the depsgraph can't handle non-object data
+ * - these happen after objects are all done so that we can read in their final transform values,
+ * though this means that objects can't refer to scene info for guidance...
*/
static void scene_update_drivers(Main *UNUSED(bmain), Scene *scene)
{
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 1a0e3958dc0..c69f8ff074f 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -1202,8 +1202,8 @@ static void do_mul_effect_byte(
fac3 = (int)(256.0f * facf1);
/* formula:
- * fac * (a * b) + (1 - fac) * a => fac * a * (b - 1) + axaux = c * px + py * s; //+centx
- * yaux = -s * px + c * py; //+centy
+ * fac * (a * b) + (1 - fac) * a => fac * a * (b - 1) + axaux = c * px + py * s; //+centx
+ * yaux = -s * px + c * py; //+centy
*/
while (y--) {
@@ -2175,7 +2175,7 @@ static ImBuf *do_transform_effect(
static void RVBlurBitmap2_float(float *map, int width, int height, float blur, int quality)
/* MUUUCCH better than the previous blur. */
/* We do the blurring in two passes which is a whole lot faster. */
-/* I changed the math arount to implement an actual Gaussian */
+/* I changed the math around to implement an actual Gaussian */
/* distribution. */
/* */
/* Watch out though, it tends to misbehaven with large blur values on */
@@ -3021,7 +3021,7 @@ static void do_gaussian_blur_effect_byte_x(
const int size_x = (int) (data->size_x + 0.5f);
int i, j;
- /* Make gaussian weight tabke. */
+ /* Make gaussian weight table. */
float *gausstab_x;
gausstab_x = make_gaussian_blur_kernel(data->size_x, size_x);
@@ -3074,7 +3074,7 @@ static void do_gaussian_blur_effect_byte_y(
const int size_y = (int) (data->size_y + 0.5f);
int i, j;
- /* Make gaussian weight tabke. */
+ /* Make gaussian weight table. */
float *gausstab_y;
gausstab_y = make_gaussian_blur_kernel(data->size_y, size_y);
@@ -3127,7 +3127,7 @@ static void do_gaussian_blur_effect_float_x(
const int size_x = (int) (data->size_x + 0.5f);
int i, j;
- /* Make gaussian weight tabke. */
+ /* Make gaussian weight table. */
float *gausstab_x;
gausstab_x = make_gaussian_blur_kernel(data->size_x, size_x);
@@ -3171,7 +3171,7 @@ static void do_gaussian_blur_effect_float_y(
const int size_y = (int) (data->size_y + 0.5f);
int i, j;
- /* Make gaussian weight tabke. */
+ /* Make gaussian weight table. */
float *gausstab_y;
gausstab_y = make_gaussian_blur_kernel(data->size_y, size_y);
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 0768fba3e0b..c2a96d4f1ff 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -413,7 +413,7 @@ void BKE_sequence_clipboard_pointers_restore(Sequence *seq, Main *bmain)
seqclipboard_ptr_restore(bmain, (ID **)&seq->sound);
}
-/* recursive versions of funcions above */
+/* recursive versions of functions above */
void BKE_sequencer_base_clipboard_pointers_free(ListBase *seqbase)
{
Sequence *seq;
@@ -1060,7 +1060,7 @@ void BKE_sequencer_sort(Scene *scene)
*(ed->seqbasep) = seqbase;
}
-/** Comparision function suitable to be used with BLI_listbase_sort()... */
+/** Comparison function suitable to be used with BLI_listbase_sort()... */
int BKE_sequencer_cmp_time_startdisp(const void *a, const void *b)
{
const Sequence *seq_a = a;
@@ -4507,7 +4507,7 @@ Sequence *BKE_sequencer_foreground_frame_get(Scene *scene, int frame)
return best_seq;
}
-/* return 0 if there werent enough space */
+/* return 0 if there weren't enough space */
bool BKE_sequence_base_shuffle_ex(ListBase *seqbasep, Sequence *test, Scene *evil_scene, int channel_delta)
{
const int orig_machine = test->machine;
diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c
index e28b4ccc23d..65d42467f67 100644
--- a/source/blender/blenkernel/intern/shrinkwrap.c
+++ b/source/blender/blenkernel/intern/shrinkwrap.c
@@ -187,8 +187,8 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
* Returns true if "hit" was updated.
* Opts control whether an hit is valid or not
* Supported options are:
- * MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE (front faces hits are ignored)
- * MOD_SHRINKWRAP_CULL_TARGET_BACKFACE (back faces hits are ignored)
+ * - MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE (front faces hits are ignored)
+ * - MOD_SHRINKWRAP_CULL_TARGET_BACKFACE (back faces hits are ignored)
*/
bool BKE_shrinkwrap_project_normal(
char options, const float vert[3], const float dir[3],
@@ -384,7 +384,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc, bool for
SpaceTransform local2aux;
/* If the user doesn't allows to project in any direction of projection axis
- * then theres nothing todo. */
+ * then there's nothing todo. */
if ((calc->smd->shrinkOpts & (MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR | MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR)) == 0)
return;
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 12bc40e62a0..ccc991ed24a 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -724,7 +724,7 @@ static int get_lamp(Scene *scene, float *light)
}
/**********************************************************
- * Obstacles
+ * Obstacles
**********************************************************/
typedef struct ObstaclesFromDMData {
@@ -982,7 +982,7 @@ static void update_obstacles(Scene *scene, Object *ob, SmokeDomainSettings *sds,
}
/**********************************************************
- * Flow emission code
+ * Flow emission code
**********************************************************/
typedef struct EmissionMap {
@@ -1460,8 +1460,8 @@ static void sample_derivedmesh(
if (sfs->volume_density) {
if (BLI_bvhtree_ray_cast(treeData->tree, ray_start, ray_dir, 0.0f, &hit, treeData->raycast_callback, treeData) != -1) {
float dot = ray_dir[0] * hit.no[0] + ray_dir[1] * hit.no[1] + ray_dir[2] * hit.no[2];
- /* If ray and hit face normal are facing same direction
- * hit point is inside a closed mesh. */
+ /* If ray and hit face normal are facing same direction
+ * hit point is inside a closed mesh. */
if (dot >= 0) {
/* Also cast a ray in opposite direction to make sure
* point is at least surrounded by two faces */
@@ -1508,7 +1508,7 @@ static void sample_derivedmesh(
interp_v3_v3v3v3(hit_normal, n1, n2, n3, weights);
normalize_v3(hit_normal);
/* apply normal directional and random velocity
- * - TODO: random disabled for now since it doesnt really work well as pressure calc smoothens it out... */
+ * - TODO: random disabled for now since it doesn't really work well as pressure calc smoothens it out... */
velocity_map[index * 3] += hit_normal[0] * sfs->vel_normal * 0.25f;
velocity_map[index * 3 + 1] += hit_normal[1] * sfs->vel_normal * 0.25f;
velocity_map[index * 3 + 2] += hit_normal[2] * sfs->vel_normal * 0.25f;
@@ -1691,8 +1691,8 @@ static void emit_from_derivedmesh(Object *flow_ob, SmokeDomainSettings *sds, Smo
}
}
- /* Transform dm vertices to
- * domain grid space for fast lookups */
+ /* Transform dm vertices to
+ * domain grid space for fast lookups */
for (i = 0; i < numOfVerts; i++) {
float n[3];
/* vert pos */
@@ -1775,7 +1775,7 @@ static void emit_from_derivedmesh(Object *flow_ob, SmokeDomainSettings *sds, Smo
}
/**********************************************************
- * Smoke step
+ * Smoke step
**********************************************************/
static void adjustDomainResolution(SmokeDomainSettings *sds, int new_shift[3], EmissionMap *emaps, unsigned int numflowobj, float dt)
@@ -2140,7 +2140,7 @@ static void update_flowsfluids(
VECSUB(new_shift, total_shift, sds->shift);
copy_v3_v3_int(sds->shift, total_shift);
- /* calculate new domain boundary points so that smoke doesnt slide on sub-cell movement */
+ /* calculate new domain boundary points so that smoke doesn't slide on sub-cell movement */
sds->p0[0] = sds->dp0[0] - sds->cell_size[0] * (sds->shift_f[0] - total_shift[0] - 0.5f);
sds->p0[1] = sds->dp0[1] - sds->cell_size[1] * (sds->shift_f[1] - total_shift[1] - 0.5f);
sds->p0[2] = sds->dp0[2] - sds->cell_size[2] * (sds->shift_f[2] - total_shift[2] - 0.5f);
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 93039bdace6..940f7f72d62 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -110,7 +110,7 @@ typedef struct ReferenceVert {
typedef struct ReferenceState {
float com[3]; /* center of mass*/
- ReferenceVert *ivert; /* list of intial values */
+ ReferenceVert *ivert; /* list of initial values */
} ReferenceState;
@@ -211,7 +211,7 @@ static float sb_time_scale(Object *ob)
* will cause unwanted responses of the softbody system (which does inter frame calculations )
* so first 'cure' would be: interpolate linear in time ..
* Q: why do i write this?
- * A: because it happend once, that some eger coder 'streamlined' code to fail.
+ * A: because it happened once, that some eger coder 'streamlined' code to fail.
* We DO linear interpolation for goals .. and i think we should do on animated properties as well
*/
@@ -952,7 +952,7 @@ static void free_softbody_intern(SoftBody *sb)
*
* it actually checks if the particle intrudes a short range force field generated
* by the faces of the target object and returns a force to drive the particel out
- * the strenght of the field grows exponetially if the particle is on the 'wrong' side of the face
+ * the strength of the field grows exponetially if the particle is on the 'wrong' side of the face
* 'wrong' side : projection to the face normal is negative (all referred to a vertex in the face)
*
* flaw of this: 'fast' particles as well as 'fast' colliding faces
@@ -1977,7 +1977,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
SoftBody *sb= ob->soft; /* is supposed to be there */
BodyPoint *bp;
- /* intitialize */
+ /* initialize */
if (sb) {
/* check conditions for various options */
/* +++ could be done on object level to squeeze out the last bits of it */
@@ -2019,7 +2019,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
for (c=sb->totpoint, obp= sb->bpoint; c>0; c--, obp++) {
compare = (obp->colball + bp->colball);
sub_v3_v3v3(def, bp->pos, obp->pos);
- /* rather check the AABBoxes before ever calulating the real distance */
+ /* rather check the AABBoxes before ever calculating the real distance */
/* mathematically it is completely nuts, but performance is pretty much (3) times faster */
if ((ABS(def[0]) > compare) || (ABS(def[1]) > compare) || (ABS(def[2]) > compare)) continue;
distance = normalize_v3(def);
@@ -2061,7 +2061,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
bp->force[1]+= -ks*(auxvect[1]);
bp->force[2]+= -ks*(auxvect[2]);
- /* calulate damping forces generated by goals*/
+ /* calculate damping forces generated by goals*/
sub_v3_v3v3(velgoal, bp->origS, bp->origE);
kd = sb->goalfrict * sb_fric_force_scale(ob);
add_v3_v3v3(auxvect, velgoal, bp->vec);
@@ -2162,7 +2162,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
}/* existing spring list */
}/*any edges*/
/* ---springs */
- }/*omit on snap */
+ }/*omit on snap */
}/*loop all bp's*/
return 0; /*done fine*/
}
@@ -2348,7 +2348,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
compare = (obp->colball + bp->colball);
sub_v3_v3v3(def, bp->pos, obp->pos);
- /* rather check the AABBoxes before ever calulating the real distance */
+ /* rather check the AABBoxes before ever calculating the real distance */
/* mathematically it is completely nuts, but performance is pretty much (3) times faster */
if ((ABS(def[0]) > compare) || (ABS(def[1]) > compare) || (ABS(def[2]) > compare)) continue;
@@ -2397,7 +2397,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
bp->force[1]+= -ks*(auxvect[1]);
bp->force[2]+= -ks*(auxvect[2]);
- /* calulate damping forces generated by goals*/
+ /* calculate damping forces generated by goals*/
sub_v3_v3v3(velgoal, bp->origS, bp->origE);
kd = sb->goalfrict * sb_fric_force_scale(ob);
add_v3_v3v3(auxvect, velgoal, bp->vec);
@@ -2514,7 +2514,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
}/* existing spring list */
}/*any edges*/
/* ---springs */
- }/*omit on snap */
+ }/*omit on snap */
}/*loop all bp's*/
@@ -2827,7 +2827,7 @@ static void springs_from_mesh(Object *ob)
sb= ob->soft;
if (me && sb) {
- /* using bp->origS as a container for spring calcualtions here
+ /* using bp->origS as a container for spring calculations here
* will be overwritten sbObjectStep() to receive
* actual modifier stack positions
*/
@@ -3402,7 +3402,7 @@ static void softbody_update_positions(Object *ob, SoftBody *sb, float (*vertexCo
* that is:
* a precise position vector denoting the motion of the center of mass
* give a rotation/scale matrix using averaging method, that's why estimate and not calculate
- * see: this is kind of reverse engineering: having to states of a point cloud and recover what happend
+ * see: this is kind of reverse engineering: having to states of a point cloud and recover what happened
* our advantage here we know the identity of the vertex
* there are others methods giving other results.
* lloc, lrot, lscale are allowed to be NULL, just in case you don't need it.
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 221c600f502..3c4e1f92344 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -89,7 +89,7 @@
# include "opensubdiv_capi.h"
#endif
-/* assumes MLoop's are layed out 4 for each poly, in order */
+/* assumes MLoop's are laid out 4 for each poly, in order */
#define USE_LOOP_LAYOUT_FAST
static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
@@ -289,7 +289,7 @@ static void get_face_uv_map_vert(UvVertMap *vmap, struct MPoly *mpoly, struct ML
break;
}
- fverts[j] = SET_UINT_IN_POINTER(mpoly[nv->poly_index].loopstart + nv->loop_of_poly_index);
+ fverts[j] = POINTER_FROM_UINT(mpoly[nv->poly_index].loopstart + nv->loop_of_poly_index);
}
}
@@ -336,7 +336,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm,
if (v->separate) {
CCGVert *ssv;
int loopid = mpoly[v->poly_index].loopstart + v->loop_of_poly_index;
- CCGVertHDL vhdl = SET_INT_IN_POINTER(loopid);
+ CCGVertHDL vhdl = POINTER_FROM_INT(loopid);
copy_v2_v2(uv, mloopuv[loopid].uv);
@@ -352,7 +352,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm,
MPoly *mp = &mpoly[i];
int nverts = mp->totloop;
int j, j_next;
- CCGFace *origf = ccgSubSurf_getFace(origss, SET_INT_IN_POINTER(i));
+ CCGFace *origf = ccgSubSurf_getFace(origss, POINTER_FROM_INT(i));
/* unsigned int *fv = &mp->v1; */
MLoop *ml = mloop + mp->loopstart;
@@ -366,12 +366,12 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm,
get_face_uv_map_vert(vmap, mpoly, ml, i, fverts);
for (j = 0, j_next = nverts - 1; j < nverts; j_next = j++) {
- unsigned int v0 = GET_UINT_FROM_POINTER(fverts[j_next]);
- unsigned int v1 = GET_UINT_FROM_POINTER(fverts[j]);
+ unsigned int v0 = POINTER_AS_UINT(fverts[j_next]);
+ unsigned int v1 = POINTER_AS_UINT(fverts[j]);
if (BLI_edgeset_add(eset, v0, v1)) {
CCGEdge *e, *orige = ccgSubSurf_getFaceEdge(origf, j_next);
- CCGEdgeHDL ehdl = SET_INT_IN_POINTER(mp->loopstart + j_next);
+ CCGEdgeHDL ehdl = POINTER_FROM_INT(mp->loopstart + j_next);
float crease = ccgSubSurf_getEdgeCrease(orige);
ccgSubSurf_syncEdge(ss, ehdl, fverts[j_next], fverts[j], crease, &e);
@@ -396,7 +396,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm,
#endif
get_face_uv_map_vert(vmap, mpoly, ml, i, fverts);
- ccgSubSurf_syncFace(ss, SET_INT_IN_POINTER(i), nverts, fverts, &f);
+ ccgSubSurf_syncFace(ss, POINTER_FROM_INT(i), nverts, fverts, &f);
}
#ifndef USE_DYNSIZE
@@ -441,7 +441,7 @@ static void UNUSED_FUNCTION(set_subsurf_osd_ccg_uv)(CCGSubSurf *ss,
faceMap = MEM_mallocN(totface * sizeof(*faceMap), "facemapuv");
for (ccgSubSurf_initFaceIterator(ss, &fi); !ccgFaceIterator_isStopped(&fi); ccgFaceIterator_next(&fi)) {
CCGFace *f = ccgFaceIterator_getCurrent(&fi);
- faceMap[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f))] = f;
+ faceMap[POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f))] = f;
}
/* load coordinates from uvss into tface */
@@ -527,7 +527,7 @@ static void set_subsurf_legacy_uv(CCGSubSurf *ss, DerivedMesh *dm, DerivedMesh *
faceMap = MEM_mallocN(totface * sizeof(*faceMap), "facemapuv");
for (ccgSubSurf_initFaceIterator(uvss, &fi); !ccgFaceIterator_isStopped(&fi); ccgFaceIterator_next(&fi)) {
CCGFace *f = ccgFaceIterator_getCurrent(&fi);
- faceMap[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f))] = f;
+ faceMap[POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f))] = f;
}
/* load coordinates from uvss into tface */
@@ -703,10 +703,10 @@ static void ss_sync_ccg_from_derivedmesh(CCGSubSurf *ss,
CCGVert *v;
if (vertexCos) {
- ccgSubSurf_syncVert(ss, SET_INT_IN_POINTER(i), vertexCos[i], 0, &v);
+ ccgSubSurf_syncVert(ss, POINTER_FROM_INT(i), vertexCos[i], 0, &v);
}
else {
- ccgSubSurf_syncVert(ss, SET_INT_IN_POINTER(i), mv->co, 0, &v);
+ ccgSubSurf_syncVert(ss, POINTER_FROM_INT(i), mv->co, 0, &v);
}
((int *)ccgSubSurf_getVertUserData(ss, v))[1] = (index) ? *index++ : i;
@@ -721,8 +721,8 @@ static void ss_sync_ccg_from_derivedmesh(CCGSubSurf *ss,
crease = useFlatSubdiv ? creaseFactor :
me->crease * creaseFactor / 255.0f;
- ccgSubSurf_syncEdge(ss, SET_INT_IN_POINTER(i), SET_UINT_IN_POINTER(me->v1),
- SET_UINT_IN_POINTER(me->v2), crease, &e);
+ ccgSubSurf_syncEdge(ss, POINTER_FROM_INT(i), POINTER_FROM_UINT(me->v1),
+ POINTER_FROM_UINT(me->v2), crease, &e);
((int *)ccgSubSurf_getEdgeUserData(ss, e))[1] = (index) ? *index++ : i;
}
@@ -741,14 +741,14 @@ static void ss_sync_ccg_from_derivedmesh(CCGSubSurf *ss,
ml = mloop + mp->loopstart;
for (j = 0; j < mp->totloop; j++, ml++) {
- fVerts[j] = SET_UINT_IN_POINTER(ml->v);
+ fVerts[j] = POINTER_FROM_UINT(ml->v);
}
/* this is very bad, means mesh is internally inconsistent.
* it is not really possible to continue without modifying
* 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,
+ if (ccgSubSurf_syncFace(ss, POINTER_FROM_INT(i), mp->totloop,
fVerts, &f) == eCCGError_InvalidValue)
{
static int hasGivenError = 0;
@@ -1276,7 +1276,7 @@ void subsurf_copy_grid_paint_mask(DerivedMesh *dm, const MPoly *mpoly,
}
}
-/* utility functon */
+/* utility function */
BLI_INLINE void ccgDM_to_MVert(MVert *mv, const CCGKey *key, CCGElem *elem)
{
copy_v3_v3(mv->co, CCG_elem_co(key, elem));
@@ -1349,7 +1349,7 @@ static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert)
}
-/* utility functon */
+/* utility function */
BLI_INLINE void ccgDM_to_MEdge(MEdge *med, const int v1, const int v2, const short flag)
{
med->v1 = v1;
@@ -1403,7 +1403,7 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge)
CCGEdge *e = ccgdm->edgeMap[index].edge;
short ed_flag = 0;
int x;
- int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e));
+ int edgeIdx = POINTER_AS_INT(ccgSubSurf_getEdgeEdgeHandle(e));
if (!ccgSubSurf_getEdgeNumFaces(e)) {
ed_flag |= ME_LOOSEEDGE;
@@ -1507,19 +1507,19 @@ static void copyFinalLoopArray_task_cb(
edge_size, grid_size);
ml->v = v1;
- ml->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v1, v2));
+ ml->e = POINTER_AS_UINT(BLI_edgehash_lookup(ccgdm->ehash, v1, v2));
ml++;
ml->v = v2;
- ml->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v2, v3));
+ ml->e = POINTER_AS_UINT(BLI_edgehash_lookup(ccgdm->ehash, v2, v3));
ml++;
ml->v = v3;
- ml->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v3, v4));
+ ml->e = POINTER_AS_UINT(BLI_edgehash_lookup(ccgdm->ehash, v3, v4));
ml++;
ml->v = v4;
- ml->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v4, v1));
+ ml->e = POINTER_AS_UINT(BLI_edgehash_lookup(ccgdm->ehash, v4, v1));
ml++;
}
}
@@ -1541,7 +1541,7 @@ static void ccgDM_copyFinalLoopArray(DerivedMesh *dm, MLoop *mloop)
medge = ccgdm->dm.getEdgeArray((DerivedMesh *)ccgdm);
for (int i = 0; i < ccgdm->dm.numEdgeData; i++) {
- BLI_edgehash_insert(ehash, medge[i].v1, medge[i].v2, SET_INT_IN_POINTER(i));
+ BLI_edgehash_insert(ehash, medge[i].v1, medge[i].v2, POINTER_FROM_INT(i));
}
atomic_cas_ptr((void **)&ccgdm->ehash, ccgdm->ehash, ehash);
@@ -1628,7 +1628,7 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3])
for (ccgSubSurf_initVertIterator(ss, &vi); !ccgVertIterator_isStopped(&vi); ccgVertIterator_next(&vi)) {
CCGVert *v = ccgVertIterator_getCurrent(&vi);
- vertMap2[GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v))] = v;
+ vertMap2[POINTER_AS_INT(ccgSubSurf_getVertVertHandle(v))] = v;
}
totedge = ccgSubSurf_getNumEdges(ss);
@@ -1636,7 +1636,7 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3])
for (ccgSubSurf_initEdgeIterator(ss, &ei), i = 0; !ccgEdgeIterator_isStopped(&ei); i++, ccgEdgeIterator_next(&ei)) {
CCGEdge *e = ccgEdgeIterator_getCurrent(&ei);
- edgeMap2[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e))] = e;
+ edgeMap2[POINTER_AS_INT(ccgSubSurf_getEdgeEdgeHandle(e))] = e;
}
totface = ccgSubSurf_getNumFaces(ss);
@@ -1644,7 +1644,7 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3])
for (ccgSubSurf_initFaceIterator(ss, &fi); !ccgFaceIterator_isStopped(&fi); ccgFaceIterator_next(&fi)) {
CCGFace *f = ccgFaceIterator_getCurrent(&fi);
- faceMap2[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f))] = f;
+ faceMap2[POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f))] = f;
}
i = 0;
@@ -1951,7 +1951,7 @@ static void ccgDM_buffer_copy_normal(
for (i = 0; i < totface; i++) {
CCGFace *f = ccgdm->faceMap[i].face;
int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
- int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
+ int index = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f));
const float (*ln)[3] = NULL;
if (faceFlags) {
@@ -2067,7 +2067,7 @@ static void ccgDM_buffer_copy_triangles(
for (i = 0; i < totface; i++) {
CCGFace *f = ccgdm->faceMap[i].face;
int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
- int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
+ int index = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f));
bool is_hidden;
int mati;
@@ -2300,7 +2300,7 @@ static void ccgDM_buffer_copy_uv_texpaint(
for (i = 0; i < totface; i++) {
CCGFace *f = ccgdm->faceMap[i].face;
int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
- int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
+ int index = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f));
int matnr;
if (faceFlags) {
@@ -2431,7 +2431,7 @@ static void ccgDM_buffer_copy_edge(
CCGVert *ev2 = ccgSubSurf_getEdgeVert1(e);
f = ccgSubSurf_getEdgeFace(e, 0);
- fhandle = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
+ fhandle = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f));
totvert = ccgSubSurf_getFaceNumVerts(f);
/* find the index of vertices in the face */
@@ -2594,7 +2594,7 @@ static GPUDrawObject *ccgDM_GPUObjectNew(DerivedMesh *dm)
for (i = 0; i < totface; i++) {
CCGFace *f = ccgdm->faceMap[i].face;
int numVerts = ccgSubSurf_getFaceNumVerts(f);
- int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
+ int index = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f));
const short new_matnr = ME_MAT_NR_TEST(faceFlags[index].mat_nr, dm_totmat);
matinfo[new_matnr].totelements += numVerts * gridFaces * gridFaces * 6;
matinfo[new_matnr].totloops += numVerts * gridFaces * gridFaces * 4;
@@ -2856,7 +2856,7 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
CCGFace *f = ccgdm->faceMap[i].face;
const float (*ln)[3] = NULL;
int S, x, y, drawSmooth;
- int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
+ int index = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f));
int origIndex = ccgDM_getFaceMapIndex(ss, f);
int numVerts = ccgSubSurf_getFaceNumVerts(f);
@@ -3079,7 +3079,7 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
for (a = 0; a < totpoly; a++) {
CCGFace *f = ccgdm->faceMap[a].face;
- int orig_index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
+ int orig_index = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f));
int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
int i;
@@ -3297,7 +3297,7 @@ static void ccgDM_drawMappedFacesMat(DerivedMesh *dm,
CCGFace *f = ccgdm->faceMap[i].face;
const float (*ln)[3] = NULL;
int S, x, y, drawSmooth;
- int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
+ int index = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f));
int origIndex = ccgDM_getFaceMapIndex(ss, f);
int new_matnr;
@@ -3577,7 +3577,7 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
CCGFace *f = ccgdm->faceMap[polyindex].face;
int numVerts = ccgSubSurf_getFaceNumVerts(f);
int index = ccgDM_getFaceMapIndex(ss, f);
- int orig_index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
+ int orig_index = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f));
int mat_nr;
int facequads = numVerts * gridFaces * gridFaces;
int actualFace = ccgdm->faceMap[polyindex].startFace;
@@ -3770,7 +3770,7 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm,
unsigned char *cp = NULL;
const float (*ln)[3] = NULL;
- origIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
+ origIndex = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f));
if (flag & DM_DRAW_ALWAYS_SMOOTH) drawSmooth = 1;
else if (faceFlags) drawSmooth = (lnors || (faceFlags[origIndex].flag & ME_SMOOTH));
@@ -4707,7 +4707,7 @@ static void create_ccgdm_maps(CCGDerivedMesh *ccgdm,
{
CCGVert *v = ccgVertIterator_getCurrent(&vi);
- ccgdm->vertMap[GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v))].vert = v;
+ ccgdm->vertMap[POINTER_AS_INT(ccgSubSurf_getVertVertHandle(v))].vert = v;
}
totedge = ccgSubSurf_getNumEdges(ss);
@@ -4718,7 +4718,7 @@ static void create_ccgdm_maps(CCGDerivedMesh *ccgdm,
{
CCGEdge *e = ccgEdgeIterator_getCurrent(&ei);
- ccgdm->edgeMap[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e))].edge = e;
+ ccgdm->edgeMap[POINTER_AS_INT(ccgSubSurf_getEdgeEdgeHandle(e))].edge = e;
}
totface = ccgSubSurf_getNumFaces(ss);
@@ -4729,7 +4729,7 @@ static void create_ccgdm_maps(CCGDerivedMesh *ccgdm,
{
CCGFace *f = ccgFaceIterator_getCurrent(&fi);
- ccgdm->faceMap[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f))].face = f;
+ ccgdm->faceMap[POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f))].face = f;
}
}
@@ -4803,7 +4803,7 @@ static void set_ccgdm_all_geometry(CCGDerivedMesh *ccgdm,
CCGFace *f = ccgdm->faceMap[index].face;
int numVerts = ccgSubSurf_getFaceNumVerts(f);
int numFinalEdges = numVerts * (gridSideEdges + gridInternalEdges);
- int origIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
+ int origIndex = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f));
int g2_wid = gridCuts + 2;
float *w, *w2;
int s, x, y;
@@ -4837,7 +4837,7 @@ static void set_ccgdm_all_geometry(CCGDerivedMesh *ccgdm,
#endif
for (s = 0; s < numVerts; s++) {
CCGVert *v = ccgSubSurf_getFaceVert(f, s);
- vertidx[s] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
+ vertidx[s] = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(v));
}
/*I think this is for interpolating the center vert?*/
@@ -4950,13 +4950,13 @@ static void set_ccgdm_all_geometry(CCGDerivedMesh *ccgdm,
int mapIndex = ccgDM_getEdgeMapIndex(ss, e);
int x;
int vertIdx[2];
- int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e));
+ int edgeIdx = POINTER_AS_INT(ccgSubSurf_getEdgeEdgeHandle(e));
CCGVert *v;
v = ccgSubSurf_getEdgeVert0(e);
- vertIdx[0] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
+ vertIdx[0] = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(v));
v = ccgSubSurf_getEdgeVert1(e);
- vertIdx[1] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
+ vertIdx[1] = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(v));
ccgdm->edgeMap[index].startVert = vertNum;
ccgdm->edgeMap[index].startEdge = edgeNum;
@@ -5010,7 +5010,7 @@ static void set_ccgdm_all_geometry(CCGDerivedMesh *ccgdm,
int mapIndex = ccgDM_getVertMapIndex(ccgdm->ss, v);
int vertIdx;
- vertIdx = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
+ vertIdx = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(v));
ccgdm->vertMap[index].startVert = vertNum;
@@ -5134,7 +5134,7 @@ static bool subsurf_use_gpu_backend(SubsurfFlags flags)
{
#ifdef WITH_OPENSUBDIV
/* Use GPU backend if it's a last modifier in the stack
- * and user choosed to use any of the OSD compute devices,
+ * and user chose to use any of the OSD compute devices,
* but also check if GPU has all needed features.
*/
return
@@ -5234,7 +5234,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
if (smd->mCache && (flags & SUBSURF_IS_FINAL_CALC)) {
#ifdef WITH_OPENSUBDIV
- /* With OpenSubdiv enabled we always tries to re-use previos
+ /* With OpenSubdiv enabled we always tries to re-use previous
* subsurf structure in order to save computation time since
* re-creation is rather a complicated business.
*
@@ -5295,7 +5295,7 @@ void subsurf_calculate_limit_positions(Mesh *me, float (*r_positions)[3])
for (ccgSubSurf_initVertIterator(ss, &vi); !ccgVertIterator_isStopped(&vi); ccgVertIterator_next(&vi)) {
CCGVert *v = ccgVertIterator_getCurrent(&vi);
- int idx = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
+ int idx = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(v));
int N = ccgSubSurf_getVertNumEdges(v);
int numFaces = ccgSubSurf_getVertNumFaces(v);
float *co;
diff --git a/source/blender/blenkernel/intern/suggestions.c b/source/blender/blenkernel/intern/suggestions.c
index 043fc813b95..2e48599a113 100644
--- a/source/blender/blenkernel/intern/suggestions.c
+++ b/source/blender/blenkernel/intern/suggestions.c
@@ -246,12 +246,12 @@ void texttool_docs_show(const char *docs)
/* Ensure documentation ends with a '\n' */
if (docs[len - 1] != '\n') {
documentation = MEM_mallocN(len + 2, "Documentation");
- BLI_strncpy(documentation, docs, len);
+ memcpy(documentation, docs, len);
documentation[len++] = '\n';
}
else {
documentation = MEM_mallocN(len + 1, "Documentation");
- BLI_strncpy(documentation, docs, len);
+ memcpy(documentation, docs, len);
}
documentation[len] = '\0';
}
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 76df163ee3a..63b9f838632 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -355,7 +355,7 @@ static void text_from_buf(Text *text, const unsigned char *buffer, const int len
* - rest of line (if last line in file hasn't got \n terminator).
* in this case content of such line would be used to fill text line buffer
* - file is empty. in this case new line is needed to start editing from.
- * - last characted in buffer is \n. in this case new line is needed to
+ * - last character in buffer is \n. in this case new line is needed to
* deal with newline at end of file. (see [#28087]) (sergey) */
if (llen != 0 || text->nlines == 0 || buffer[len - 1] == '\n') {
TextLine *tmp;
@@ -1705,7 +1705,7 @@ static void txt_undo_add_blockop(Text *text, TextUndoBuf *utxt, int op, const ch
/* 4 bytes */
txt_undo_store_uint32(utxt->buf, &utxt->pos, length);
/* 'length' bytes */
- BLI_strncpy(utxt->buf + utxt->pos, buf, length);
+ memcpy(utxt->buf + utxt->pos, buf, length);
utxt->pos += length;
/* 4 bytes */
txt_undo_store_uint32(utxt->buf, &utxt->pos, length);
@@ -2968,9 +2968,9 @@ int txt_setcurr_tab_spaces(Text *text, int space)
}
if (strstr(text->curl->line, word)) {
/* if we find a ':' on this line, then add a tab but not if it is:
- * 1) in a comment
- * 2) within an identifier
- * 3) after the cursor (text->curc), i.e. when creating space before a function def [#25414]
+ * 1) in a comment
+ * 2) within an identifier
+ * 3) after the cursor (text->curc), i.e. when creating space before a function def [#25414]
*/
int a;
bool is_indent = false;
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index a0399c74be1..bd6199d91b4 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -548,12 +548,15 @@ Tex *BKE_texture_copy(Main *bmain, const Tex *tex)
/* texture copy without adding to main dbase */
Tex *BKE_texture_localize(Tex *tex)
{
- /* TODO replace with something like
- * Tex *tex_copy;
- * BKE_id_copy_ex(bmain, &tex->id, (ID **)&tex_copy, LIB_ID_COPY_NO_MAIN | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_NO_USER_REFCOUNT, false);
- * return tex_copy;
+ /* TODO(bastien): Replace with something like:
*
- * ... Once f*** nodes are fully converted to that too :( */
+ * Tex *tex_copy;
+ * BKE_id_copy_ex(bmain, &tex->id, (ID **)&tex_copy,
+ * LIB_ID_COPY_NO_MAIN | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_NO_USER_REFCOUNT,
+ * false);
+ * return tex_copy;
+ *
+ * NOTE: Only possible once nested node trees are fully converted to that too. */
Tex *texn;
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 830732f4ce2..a3536cd0d68 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -1606,7 +1606,7 @@ MovieTrackingPlaneMarker *BKE_tracking_plane_marker_insert(MovieTrackingPlaneTra
int a = plane_track->markersnr;
/* Find position in array where to add new marker. */
- /* TODO(sergey): we coud use bisect to speed things up. */
+ /* TODO(sergey): we could use bisect to speed things up. */
while (a--) {
if (plane_track->markers[a].framenr < plane_marker->framenr) {
break;
@@ -1992,10 +1992,10 @@ void BKE_tracking_camera_to_blender(MovieTracking *tracking, Scene *scene, Camer
camera->sensor_fit = CAMERA_SENSOR_FIT_AUTO;
camera->lens = focal * camera->sensor_x / width;
- scene->r.xsch = width * tracking->camera.pixel_aspect;
+ scene->r.xsch = width;
scene->r.ysch = height;
- scene->r.xasp = 1.0f;
+ scene->r.xasp = tracking->camera.pixel_aspect;
scene->r.yasp = 1.0f;
BKE_tracking_camera_shift_get(tracking, width, height, &camera->shiftx, &camera->shifty);
diff --git a/source/blender/blenkernel/intern/tracking_region_tracker.c b/source/blender/blenkernel/intern/tracking_region_tracker.c
index 106dd125575..dcc61f409fc 100644
--- a/source/blender/blenkernel/intern/tracking_region_tracker.c
+++ b/source/blender/blenkernel/intern/tracking_region_tracker.c
@@ -149,7 +149,7 @@ static ImBuf *tracking_context_get_keyframed_ibuf(MovieClip *clip, MovieClipUser
return tracking_context_get_frame_ibuf(clip, user, clip_flag, keyed_framenr);
}
-/* Get image buffer which si used as referece for track. */
+/* Get image buffer which si used as reference for track. */
static ImBuf *tracking_context_get_reference_ibuf(MovieClip *clip, MovieClipUser *user, int clip_flag,
MovieTrackingTrack *track, int curfra, bool backwards,
MovieTrackingMarker **reference_marker)
diff --git a/source/blender/blenkernel/intern/tracking_stabilize.c b/source/blender/blenkernel/intern/tracking_stabilize.c
index cbf1a02a46c..331db5b6ff0 100644
--- a/source/blender/blenkernel/intern/tracking_stabilize.c
+++ b/source/blender/blenkernel/intern/tracking_stabilize.c
@@ -992,7 +992,7 @@ static void initialize_all_tracks(StabContext *ctx, float aspect)
* By definition, offset contribution is zero there.
*/
int reference_frame = tracking->stabilization.anchor_frame;
- float average_angle=0, average_scale_step=0;
+ float average_angle = 0, average_scale_step = 0;
float average_translation[2], average_pos[2], pivot[2];
zero_v2(average_translation);
zero_v2(pivot);
diff --git a/source/blender/blenkernel/intern/tracking_util.c b/source/blender/blenkernel/intern/tracking_util.c
index 8c1b846db84..621e0cc6a2e 100644
--- a/source/blender/blenkernel/intern/tracking_util.c
+++ b/source/blender/blenkernel/intern/tracking_util.c
@@ -853,17 +853,17 @@ static ImBuf *accessor_get_ibuf(TrackingImageAccessor *accessor,
}
static libmv_CacheKey accessor_get_image_callback(
- struct libmv_FrameAccessorUserData *user_data,
- int clip_index,
- int frame,
- libmv_InputMode input_mode,
- int downscale,
- const libmv_Region *region,
- const libmv_FrameTransform *transform,
- float **destination,
- int *width,
- int *height,
- int *channels)
+ struct libmv_FrameAccessorUserData *user_data,
+ int clip_index,
+ int frame,
+ libmv_InputMode input_mode,
+ int downscale,
+ const libmv_Region *region,
+ const libmv_FrameTransform *transform,
+ float **destination,
+ int *width,
+ int *height,
+ int *channels)
{
TrackingImageAccessor *accessor = (TrackingImageAccessor *) user_data;
ImBuf *ibuf;
diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index 8606da0743b..3a903eb31c1 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -321,7 +321,7 @@ static const bUnitDef *unit_best_fit(
if (suppress && (unit->flag & B_UNIT_DEF_SUPPRESS))
continue;
- /* scale down scalar so 1cm doesnt convert to 10mm because of float error */
+ /* scale down scalar so 1cm doesn't convert to 10mm because of float error */
if (UNLIKELY(unit->flag & B_UNIT_DEF_TENTH)) {
if (value_abs >= unit->scalar * (0.1 - EPS)) {
return unit;
@@ -418,7 +418,7 @@ static size_t unit_as_string(char *str, int len_max, double value, int prec, con
#endif
}
- /* terminate no matter whats done with padding above */
+ /* terminate no matter what's done with padding above */
if (i >= len_max)
i = len_max - 1;
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index 545ca41c9c0..a44d717bbdd 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -159,12 +159,15 @@ World *BKE_world_copy(Main *bmain, const World *wrld)
World *BKE_world_localize(World *wrld)
{
- /* TODO replace with something like
- * World *wrld_copy;
- * BKE_id_copy_ex(bmain, &wrld->id, (ID **)&wrld_copy, LIB_ID_COPY_NO_MAIN | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_NO_USER_REFCOUNT, false);
- * return wrld_copy;
+ /* TODO(bastien): Replace with something like:
*
- * ... Once f*** nodes are fully converted to that too :( */
+ * World *wrld_copy;
+ * BKE_id_copy_ex(bmain, &wrld->id, (ID **)&wrld_copy,
+ * LIB_ID_COPY_NO_MAIN | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_NO_USER_REFCOUNT,
+ * false);
+ * return wrld_copy;
+ *
+ * NOTE: Only possible once nested node trees are fully converted to that too. */
World *wrldn;
int a;
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 2bee16a30c8..68083b499f3 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -736,6 +736,26 @@ static AVStream *alloc_audio_stream(FFMpegContext *context, RenderData *rd, int
c->sample_fmt = AV_SAMPLE_FMT_S16;
c->channels = rd->ffcodecdata.audio_channels;
+#ifdef FFMPEG_HAVE_FRAME_CHANNEL_LAYOUT
+ switch (rd->ffcodecdata.audio_channels) {
+ case FFM_CHANNELS_MONO:
+ c->channel_layout = AV_CH_LAYOUT_MONO;
+ break;
+ case FFM_CHANNELS_STEREO:
+ c->channel_layout = AV_CH_LAYOUT_STEREO;
+ break;
+ case FFM_CHANNELS_SURROUND4:
+ c->channel_layout = AV_CH_LAYOUT_QUAD;
+ break;
+ case FFM_CHANNELS_SURROUND51:
+ c->channel_layout = AV_CH_LAYOUT_5POINT1_BACK;
+ break;
+ case FFM_CHANNELS_SURROUND71:
+ c->channel_layout = AV_CH_LAYOUT_7POINT1;
+ break;
+ }
+#endif
+
if (request_float_audio_buffer(codec_id)) {
/* mainly for AAC codec which is experimental */
c->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;