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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-27 05:07:07 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-27 05:07:07 +0300
commitaa42da03859d28900a1d01130f07c38b1e2ad34b (patch)
tree4d2a9206a19497bfcb0fc34eeb4c9bd87cea300f /source
parentfd1dd1134b5e351955a7323025d4b6cfab4afa50 (diff)
Cleanup: comments (long lines) in blenkernel
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_DerivedMesh.h5
-rw-r--r--source/blender/blenkernel/BKE_animsys.h3
-rw-r--r--source/blender/blenkernel/BKE_bvhutils.h5
-rw-r--r--source/blender/blenkernel/BKE_constraint.h15
-rw-r--r--source/blender/blenkernel/BKE_customdata.h47
-rw-r--r--source/blender/blenkernel/BKE_deform.h3
-rw-r--r--source/blender/blenkernel/BKE_effect.h10
-rw-r--r--source/blender/blenkernel/BKE_fcurve.h44
-rw-r--r--source/blender/blenkernel/BKE_gpencil_modifier.h4
-rw-r--r--source/blender/blenkernel/BKE_library.h43
-rw-r--r--source/blender/blenkernel/BKE_library_query.h7
-rw-r--r--source/blender/blenkernel/BKE_library_remap.h45
-rw-r--r--source/blender/blenkernel/BKE_main.h15
-rw-r--r--source/blender/blenkernel/BKE_mesh.h6
-rw-r--r--source/blender/blenkernel/BKE_mesh_remap.h17
-rw-r--r--source/blender/blenkernel/BKE_modifier.h4
-rw-r--r--source/blender/blenkernel/BKE_node.h24
-rw-r--r--source/blender/blenkernel/BKE_pointcache.h7
-rw-r--r--source/blender/blenkernel/BKE_rigidbody.h3
-rw-r--r--source/blender/blenkernel/BKE_screen.h6
-rw-r--r--source/blender/blenkernel/BKE_shrinkwrap.h6
-rw-r--r--source/blender/blenkernel/BKE_undo_system.h3
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf_intern.h5
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c32
-rw-r--r--source/blender/blenkernel/intern/action.c48
-rw-r--r--source/blender/blenkernel/intern/anim.c6
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c151
-rw-r--r--source/blender/blenkernel/intern/appdir.c11
-rw-r--r--source/blender/blenkernel/intern/armature.c132
-rw-r--r--source/blender/blenkernel/intern/armature_update.c38
-rw-r--r--source/blender/blenkernel/intern/blender.c4
-rw-r--r--source/blender/blenkernel/intern/blender_copybuffer.c3
-rw-r--r--source/blender/blenkernel/intern/blendfile.c3
-rw-r--r--source/blender/blenkernel/intern/brush.c9
-rw-r--r--source/blender/blenkernel/intern/bvhutils.c12
-rw-r--r--source/blender/blenkernel/intern/cachefile.c6
-rw-r--r--source/blender/blenkernel/intern/camera.c6
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c6
-rw-r--r--source/blender/blenkernel/intern/cloth.c12
-rw-r--r--source/blender/blenkernel/intern/collection.c31
-rw-r--r--source/blender/blenkernel/intern/collision.c22
-rw-r--r--source/blender/blenkernel/intern/colorband.c5
-rw-r--r--source/blender/blenkernel/intern/constraint.c80
-rw-r--r--source/blender/blenkernel/intern/curve.c48
-rw-r--r--source/blender/blenkernel/intern/customdata.c61
-rw-r--r--source/blender/blenkernel/intern/data_transfer.c58
-rw-r--r--source/blender/blenkernel/intern/deform.c17
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c153
-rw-r--r--source/blender/blenkernel/intern/editmesh.c10
-rw-r--r--source/blender/blenkernel/intern/editmesh_tangent.c8
-rw-r--r--source/blender/blenkernel/intern/effect.c7
-rw-r--r--source/blender/blenkernel/intern/fcurve.c73
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c38
-rw-r--r--source/blender/blenkernel/intern/font.c9
-rw-r--r--source/blender/blenkernel/intern/gpencil.c22
-rw-r--r--source/blender/blenkernel/intern/icons.c13
-rw-r--r--source/blender/blenkernel/intern/idprop.c12
-rw-r--r--source/blender/blenkernel/intern/image.c12
-rw-r--r--source/blender/blenkernel/intern/ipo.c91
-rw-r--r--source/blender/blenkernel/intern/key.c18
-rw-r--r--source/blender/blenkernel/intern/lattice.c19
-rw-r--r--source/blender/blenkernel/intern/layer.c3
-rw-r--r--source/blender/blenkernel/intern/library.c158
-rw-r--r--source/blender/blenkernel/intern/library_idmap.c3
-rw-r--r--source/blender/blenkernel/intern/library_override.c102
-rw-r--r--source/blender/blenkernel/intern/library_query.c65
-rw-r--r--source/blender/blenkernel/intern/library_remap.c145
-rw-r--r--source/blender/blenkernel/intern/light.c6
-rw-r--r--source/blender/blenkernel/intern/lightprobe.c6
-rw-r--r--source/blender/blenkernel/intern/linestyle.c6
-rw-r--r--source/blender/blenkernel/intern/main.c13
-rw-r--r--source/blender/blenkernel/intern/mask.c14
-rw-r--r--source/blender/blenkernel/intern/mask_rasterize.c47
-rw-r--r--source/blender/blenkernel/intern/material.c6
-rw-r--r--source/blender/blenkernel/intern/mball.c27
-rw-r--r--source/blender/blenkernel/intern/mball_tessellate.c8
-rw-r--r--source/blender/blenkernel/intern/mesh.c41
-rw-r--r--source/blender/blenkernel/intern/mesh_convert.c17
-rw-r--r--source/blender/blenkernel/intern/mesh_evaluate.c297
-rw-r--r--source/blender/blenkernel/intern/mesh_iterators.c3
-rw-r--r--source/blender/blenkernel/intern/mesh_mapping.c69
-rw-r--r--source/blender/blenkernel/intern/mesh_merge.c41
-rw-r--r--source/blender/blenkernel/intern/mesh_remap.c120
-rw-r--r--source/blender/blenkernel/intern/mesh_runtime.c7
-rw-r--r--source/blender/blenkernel/intern/mesh_tangent.c11
-rw-r--r--source/blender/blenkernel/intern/mesh_validate.c11
-rw-r--r--source/blender/blenkernel/intern/modifier.c10
-rw-r--r--source/blender/blenkernel/intern/movieclip.c6
-rw-r--r--source/blender/blenkernel/intern/multires.c3
-rw-r--r--source/blender/blenkernel/intern/nla.c86
-rw-r--r--source/blender/blenkernel/intern/node.c47
-rw-r--r--source/blender/blenkernel/intern/object.c85
-rw-r--r--source/blender/blenkernel/intern/object_deform.c7
-rw-r--r--source/blender/blenkernel/intern/object_dupli.c9
-rw-r--r--source/blender/blenkernel/intern/ocean.c37
-rw-r--r--source/blender/blenkernel/intern/packedFile.c3
-rw-r--r--source/blender/blenkernel/intern/paint.c20
-rw-r--r--source/blender/blenkernel/intern/particle.c45
-rw-r--r--source/blender/blenkernel/intern/particle_distribute.c17
-rw-r--r--source/blender/blenkernel/intern/particle_system.c52
-rw-r--r--source/blender/blenkernel/intern/pbvh.c14
-rw-r--r--source/blender/blenkernel/intern/pbvh_bmesh.c3
-rw-r--r--source/blender/blenkernel/intern/pointcache.c3
-rw-r--r--source/blender/blenkernel/intern/rigidbody.c53
-rw-r--r--source/blender/blenkernel/intern/scene.c38
-rw-r--r--source/blender/blenkernel/intern/screen.c3
-rw-r--r--source/blender/blenkernel/intern/sequencer.c23
-rw-r--r--source/blender/blenkernel/intern/shrinkwrap.c21
-rw-r--r--source/blender/blenkernel/intern/smoke.c20
-rw-r--r--source/blender/blenkernel/intern/softbody.c77
-rw-r--r--source/blender/blenkernel/intern/sound.c6
-rw-r--r--source/blender/blenkernel/intern/speaker.c6
-rw-r--r--source/blender/blenkernel/intern/studiolight.c3
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c29
-rw-r--r--source/blender/blenkernel/intern/text.c11
-rw-r--r--source/blender/blenkernel/intern/texture.c9
-rw-r--r--source/blender/blenkernel/intern/tracking.c9
-rw-r--r--source/blender/blenkernel/intern/tracking_region_tracker.c3
-rw-r--r--source/blender/blenkernel/intern/undo_system.c12
-rw-r--r--source/blender/blenkernel/intern/workspace.c16
-rw-r--r--source/blender/blenkernel/intern/world.c6
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c13
-rw-r--r--source/blender/blenkernel/nla_private.h3
123 files changed, 2241 insertions, 1406 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h
index 4fc519ecd6d..f835f4332ed 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -134,8 +134,9 @@ struct DerivedMesh {
* \warning Typical access is done via #getLoopTriArray, #getNumLoopTri.
*/
struct {
- /* WARNING! swapping between array (ready-to-be-used data) and array_wip (where data is actually computed)
- * shall always be protected by same lock as one used for looptris computing. */
+ /* WARNING! swapping between array (ready-to-be-used data) and array_wip
+ * (where data is actually computed) shall always be protected by same
+ * lock as one used for looptris computing. */
struct MLoopTri *array, *array_wip;
int num;
int num_alloc;
diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h
index 0503efb1661..583a90b2dee 100644
--- a/source/blender/blenkernel/BKE_animsys.h
+++ b/source/blender/blenkernel/BKE_animsys.h
@@ -95,7 +95,8 @@ void BKE_animdata_merge_copy(struct Main *bmain,
/* ************************************* */
/* KeyingSets API */
-/* Used to create a new 'custom' KeyingSet for the user, that will be automatically added to the stack */
+/* Used to create a new 'custom' KeyingSet for the user,
+ * that will be automatically added to the stack */
struct KeyingSet *BKE_keyingset_add(
struct ListBase *list, const char idname[], const char name[], short flag, short keyingflag);
diff --git a/source/blender/blenkernel/BKE_bvhutils.h b/source/blender/blenkernel/BKE_bvhutils.h
index 1d40ba0bc78..4b64b6fa269 100644
--- a/source/blender/blenkernel/BKE_bvhutils.h
+++ b/source/blender/blenkernel/BKE_bvhutils.h
@@ -84,11 +84,12 @@ typedef struct BVHTreeFromMesh {
/**
* Builds a bvh tree where nodes are the relevant elements of the given mesh.
- * Configures BVHTreeFromMesh.
+ * Configures #BVHTreeFromMesh.
*
* The tree is build in mesh space coordinates, this means special care must be made on queries
* so that the coordinates and rays are first translated on the mesh local coordinates.
- * Reason for this is that bvh_from_mesh_* can use a cache in some cases and so it becomes possible to reuse a BVHTree.
+ * Reason for this is that bvh_from_mesh_* can use a cache in some cases and so it
+ * becomes possible to reuse a #BVHTree.
*
* free_bvhtree_from_mesh should be called when the tree is no longer needed.
*/
diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h
index 9ad3657284d..8fe3bd77a26 100644
--- a/source/blender/blenkernel/BKE_constraint.h
+++ b/source/blender/blenkernel/BKE_constraint.h
@@ -101,13 +101,22 @@ typedef struct bConstraintTypeInfo {
void (*id_looper)(struct bConstraint *con, ConstraintIDFunc func, void *userdata);
/** copy any special data that is allocated separately (optional) */
void (*copy_data)(struct bConstraint *con, struct bConstraint *src);
- /** set settings for data that will be used for bConstraint.data (memory already allocated using MEM_callocN) */
+ /**
+ * Set settings for data that will be used for #bConstraint.data
+ * (memory already allocated using #MEM_callocN).
+ */
void (*new_data)(void *cdata);
/* target handling function pointers */
- /** for multi-target constraints: return that list; otherwise make a temporary list (returns number of targets) */
+ /**
+ * For multi-target constraints: return that list;
+ * otherwise make a temporary list (returns number of targets).
+ */
int (*get_constraint_targets)(struct bConstraint *con, struct ListBase *list);
- /** for single-target constraints only: flush data back to source data, and the free memory used */
+ /**
+ * For single-target constraints only:
+ * flush data back to source data, and the free memory used.
+ */
void (*flush_constraint_targets)(struct bConstraint *con, struct ListBase *list, bool no_copy);
/* evaluation */
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index e4dc8ffae02..f354e5e6de3 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -113,7 +113,8 @@ bool CustomData_has_referenced(const struct CustomData *data);
* implemented for mloopuv/mloopcol, for now.*/
void CustomData_data_copy_value(int type, const void *source, void *dest);
-/* Same as above, but doing advanced mixing. Only available for a few types of data (like colors...). */
+/* Same as above, but doing advanced mixing.
+ * Only available for a few types of data (like colors...). */
void CustomData_data_mix_value(
int type, const void *source, void *dest, const int mixmode, const float mixfactor);
@@ -478,8 +479,8 @@ typedef void (*cd_datatransfer_interp)(const struct CustomDataTransferLayerMap *
const float mix_factor);
/**
- * Fake CD_LAYERS (those are actually 'real' data stored directly into elements' structs, or otherwise not (directly)
- * accessible to usual CDLayer system). */
+ * Fake CD_LAYERS (those are actually 'real' data stored directly into elements' structs,
+ * or otherwise not (directly) accessible to usual CDLayer system). */
enum {
CD_FAKE = 1 << 8,
@@ -531,23 +532,29 @@ typedef struct CustomDataTransferLayerMap {
int data_type;
int mix_mode;
float mix_factor;
- const float *
- mix_weights; /* If non-NULL, array of weights, one for each dest item, replaces mix_factor. */
-
- const void *
- data_src; /* Data source array (can be regular CD data, vertices/edges/etc., keyblocks...). */
- void *data_dst; /* Data dest array (same type as dat_src). */
- int data_src_n; /* Index to affect in data_src (used e.g. for vgroups). */
- int data_dst_n; /* Index to affect in data_dst (used e.g. for vgroups). */
- size_t elem_size; /* Size of one element of data_src/data_dst. */
-
- size_t data_size; /* Size of actual data we transfer. */
- size_t
- data_offset; /* Offset of actual data we transfer (in element contained in data_src/dst). */
- uint64_t data_flag; /* For bitflag transfer, flag(s) to affect in transferred data. */
-
- void *
- interp_data; /* Opaque pointer, to be used by specific interp callback (e.g. transformspace for normals). */
+ /** If non-NULL, array of weights, one for each dest item, replaces mix_factor. */
+ const float *mix_weights;
+
+ /** Data source array (can be regular CD data, vertices/edges/etc., keyblocks...). */
+ const void *data_src;
+ /** Data dest array (same type as dat_src). */
+ void *data_dst;
+ /** Index to affect in data_src (used e.g. for vgroups). */
+ int data_src_n;
+ /** Index to affect in data_dst (used e.g. for vgroups). */
+ int data_dst_n;
+ /** Size of one element of data_src/data_dst. */
+ size_t elem_size;
+
+ /** Size of actual data we transfer. */
+ size_t data_size;
+ /** Offset of actual data we transfer (in element contained in data_src/dst). */
+ size_t data_offset;
+ /** For bitflag transfer, flag(s) to affect in transferred data. */
+ uint64_t data_flag;
+
+ /** Opaque pointer, to be used by specific interp callback (e.g. transformspace for normals). */
+ void *interp_data;
cd_datatransfer_interp interp;
} CustomDataTransferLayerMap;
diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h
index 510e989a087..fd7fa632999 100644
--- a/source/blender/blenkernel/BKE_deform.h
+++ b/source/blender/blenkernel/BKE_deform.h
@@ -109,7 +109,8 @@ void defvert_normalize_lock_map(struct MDeformVert *dvert,
const bool *lock_flags,
const int defbase_tot);
-/* Utilities to 'extract' a given vgroup into a simple float array, for verts, but also edges/polys/loops. */
+/* Utilities to 'extract' a given vgroup into a simple float array,
+ * for verts, but also edges/polys/loops. */
void BKE_defvert_extract_vgroup_to_vertweights(struct MDeformVert *dvert,
const int defgroup,
const int num_verts,
diff --git a/source/blender/blenkernel/BKE_effect.h b/source/blender/blenkernel/BKE_effect.h
index 15b59993d77..94e8f4304b8 100644
--- a/source/blender/blenkernel/BKE_effect.h
+++ b/source/blender/blenkernel/BKE_effect.h
@@ -154,8 +154,14 @@ int get_effector_data(struct EffectorCache *eff,
int real_velocity);
/* required for particle_system.c */
-//void do_physical_effector(struct EffectorData *eff, struct EffectorPoint *point, float *total_force);
-//float effector_falloff(struct EffectorData *eff, struct EffectorPoint *point, struct EffectorWeights *weights);
+#if 0
+void do_physical_effector(struct EffectorData *eff,
+ struct EffectorPoint *point,
+ float *total_force);
+float effector_falloff(struct EffectorData *eff,
+ struct EffectorPoint *point,
+ struct EffectorWeights *weights);
+#endif
/* EffectedPoint->flag */
#define PE_WIND_AS_SPEED 1
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h
index 5e45faf1d0b..c1232addee3 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -128,29 +128,38 @@ float evaluate_driver(struct PathResolvedRNA *anim_rna,
*/
typedef struct FModifierTypeInfo {
/* admin/ident */
- short type; /* FMODIFIER_TYPE_### */
- short size; /* size in bytes of the struct */
- short acttype; /* eFMI_Action_Types */
- short requires; /* eFMI_Requirement_Flags */
- char name[64]; /* name of modifier in interface */
- char structName[64]; /* name of struct for SDNA */
- uint storage_size; /* size of buffer that can be reused between time and value evaluation */
+ /** #FMODIFIER_TYPE_* */
+ short type;
+ /** size in bytes of the struct. */
+ short size;
+ /** #eFMI_Action_Types. */
+ short acttype;
+ /** #eFMI_Requirement_Flags. */
+ short requires;
+ /** name of modifier in interface. */
+ char name[64];
+ /** name of struct for SDNA. */
+ char structName[64];
+ /** Size of buffer that can be reused between time and value evaluation. */
+ uint storage_size;
/* data management function pointers - special handling */
- /* free any data that is allocated separately (optional) */
+ /** Free any data that is allocated separately (optional). */
void (*free_data)(struct FModifier *fcm);
- /* copy any special data that is allocated separately (optional) */
+ /** Copy any special data that is allocated separately (optional). */
void (*copy_data)(struct FModifier *fcm, const struct FModifier *src);
- /* set settings for data that will be used for FCuModifier.data (memory already allocated using MEM_callocN) */
+ /**
+ * Set settings for data that will be used for FCuModifier.data
+ * (memory already allocated using #MEM_callocN). */
void (*new_data)(void *mdata);
- /* verifies that the modifier settings are valid */
+ /** Verifies that the modifier settings are valid */
void (*verify_data)(struct FModifier *fcm);
/* evaluation */
- /* evaluate time that the modifier requires the F-Curve to be evaluated at */
+ /** Evaluate time that the modifier requires the F-Curve to be evaluated at */
float (*evaluate_modifier_time)(
struct FCurve *fcu, struct FModifier *fcm, float cvalue, float evaltime, void *storage);
- /* evaluate the modifier for the given time and 'accumulated' value */
+ /** Evaluate the modifier for the given time and 'accumulated' value */
void (*evaluate_modifier)(
struct FCurve *fcu, struct FModifier *fcm, float *cvalue, float evaltime, void *storage);
} FModifierTypeInfo;
@@ -223,7 +232,8 @@ int BKE_fcm_envelope_find_index(struct FCM_EnvelopeData *array,
/* ************** F-Curves API ******************** */
-/* threshold for binary-searching keyframes - threshold here should be good enough for now, but should become userpref */
+/* threshold for binary-searching keyframes - threshold here should be good enough for now,
+ * but should become userpref */
#define BEZT_BINARYSEARCH_THRESH 0.01f /* was 0.00001, but giving errors */
/* -------- Data Management -------- */
@@ -243,7 +253,8 @@ struct FCurve *iter_step_fcurve(struct FCurve *fcu_iter, const char rna_path[]);
struct FCurve *id_data_find_fcurve(
ID *id, void *data, struct StructRNA *type, const char *prop_name, int index, bool *r_driven);
-/* Get list of LinkData's containing pointers to the F-Curves which control the types of data indicated
+/* Get list of LinkData's containing pointers to the F-Curves which control the types of data
+ * indicated
* e.g. numMatches = list_find_data_fcurves(matches, &act->curves, "pose.bones[", "MyFancyBone");
*/
int list_find_data_fcurves(ListBase *dst,
@@ -259,7 +270,8 @@ struct FCurve *rna_get_fcurve(struct PointerRNA *ptr,
struct bAction **r_action,
bool *r_driven,
bool *r_special);
-/* Same as above, but takes a context data, temp hack needed for complex paths like texture ones. */
+/* Same as above, but takes a context data,
+ * temp hack needed for complex paths like texture ones. */
struct FCurve *rna_get_fcurve_context_ui(struct bContext *C,
struct PointerRNA *ptr,
struct PropertyRNA *prop,
diff --git a/source/blender/blenkernel/BKE_gpencil_modifier.h b/source/blender/blenkernel/BKE_gpencil_modifier.h
index 128ff39de7a..4655abf6e02 100644
--- a/source/blender/blenkernel/BKE_gpencil_modifier.h
+++ b/source/blender/blenkernel/BKE_gpencil_modifier.h
@@ -38,8 +38,8 @@ struct Object;
struct Scene;
struct ViewLayer;
struct bArmature;
-struct
- bContext; /* NOTE: bakeModifier() - called from UI - needs to create new datablocks, hence the need for this */
+/* NOTE: bakeModifier() called from UI: needs to create new datablocks, hence the need for this. */
+struct bContext;
struct bGPDframe;
struct bGPDlayer;
struct bGPDstroke;
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index 82ae832c73e..54b9fdac5b4 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -34,13 +34,13 @@ extern "C" {
* WARNING: description below is ideal goal, current status of naming does not yet
* fully follow it (this is WIP).
*
- * BKE_id_ should be used for rather high-level operations, that involve Main database and
- * relations with other IDs, and can be considered as 'safe' (as in, in themselves, they leave
- * affected IDs/Main in a consistent status).
+ * - BKE_id_ should be used for rather high-level operations, that involve Main database and
+ * relations with other IDs, and can be considered as 'safe'
+ * (as in, in themselves, they leave affected IDs/Main in a consistent status).
*
- * BKE_libblock_ should be used for lower level operations, that perform some parts of BKE_id_ ones,
- * but will generally not ensure caller that affected data is in a consistent state
- * by their own execution alone.
+ * - BKE_libblock_ should be used for lower level operations,
+ * that perform some parts of BKE_id_ ones, but will generally not ensure caller that affected
+ * data is in a consistent state by their own execution alone.
*
* Consequently, external code should not typically use BKE_libblock_ functions,
* except in some specific cases requiring advanced (and potentially dangerous) handling.
@@ -72,44 +72,47 @@ void *BKE_id_new_nomain(const short type, const char *name);
*/
enum {
/* *** Generic options (should be handled by all ID types copying, ID creation, etc.). *** */
- /* Create datablock outside of any main database - similar to 'localize' functions of materials etc. */
+ /** Create datablock outside of any main database -
+ * similar to 'localize' functions of materials etc. */
LIB_ID_CREATE_NO_MAIN = 1 << 0,
- /* Do not affect user refcount of datablocks used by new one (which also gets zero usercount then).
+ /** Do not affect user refcount of datablocks used by new one
+ * (which also gets zero usercount then).
* Implies LIB_ID_CREATE_NO_MAIN. */
LIB_ID_CREATE_NO_USER_REFCOUNT = 1 << 1,
- /* Assume given 'newid' already points to allocated memory for whole datablock (ID + data) - USE WITH CAUTION!
+ /** Assume given 'newid' already points to allocated memory for whole datablock
+ * (ID + data) - USE WITH CAUTION!
* Implies LIB_ID_CREATE_NO_MAIN. */
LIB_ID_CREATE_NO_ALLOCATE = 1 << 2,
- /* Do not tag new ID for update in depsgraph. */
+ /** Do not tag new ID for update in depsgraph. */
LIB_ID_CREATE_NO_DEG_TAG = 1 << 8,
/* *** Specific options to some ID types or usages. *** */
/* *** May be ignored by unrelated ID copying functions. *** */
- /* Object only, needed by make_local code. */
+ /** Object only, needed by make_local code. */
LIB_ID_COPY_NO_PROXY_CLEAR = 1 << 16,
- /* Do not copy preview data, when supported. */
+ /** Do not copy preview data, when supported. */
LIB_ID_COPY_NO_PREVIEW = 1 << 17,
- /* Copy runtime data caches. */
+ /** Copy runtime data caches. */
LIB_ID_COPY_CACHES = 1 << 18,
- /* Don't copy id->adt, used by ID datablock localization routines. */
+ /** Don't copy id->adt, used by ID datablock localization routines. */
LIB_ID_COPY_NO_ANIMDATA = 1 << 19,
- /* Mesh: Reference CD data layers instead of doing real copy - USE WITH CAUTION! */
+ /** Mesh: Reference CD data layers instead of doing real copy - USE WITH CAUTION! */
LIB_ID_COPY_CD_REFERENCE = 1 << 20,
/* *** XXX Hackish/not-so-nice specific behaviors needed for some corner cases. *** */
/* *** Ideally we should not have those, but we need them for now... *** */
- /* EXCEPTION! Deep-copy actions used by animdata of copied ID. */
+ /** EXCEPTION! Deep-copy actions used by animdata of copied ID. */
LIB_ID_COPY_ACTIONS = 1 << 24,
- /* Keep the library pointer when copying datablock outside of bmain. */
+ /** Keep the library pointer when copying datablock outside of bmain. */
LIB_ID_COPY_KEEP_LIB = 1 << 25,
- /* EXCEPTION! Deep-copy shapekeys used by copied obdata ID. */
+ /** EXCEPTION! Deep-copy shapekeys used by copied obdata ID. */
LIB_ID_COPY_SHAPEKEY = 1 << 26,
/* *** Helper 'defines' gathering most common flag sets. *** */
- /* Shapekeys are not real ID's, more like local data to geometry IDs... */
+ /** Shapekeys are not real ID's, more like local data to geometry IDs... */
LIB_ID_COPY_DEFAULT = LIB_ID_COPY_SHAPEKEY,
- /* Generate a local copy, outside of bmain, to work on (used by COW e.g.). */
+ /** Generate a local copy, outside of bmain, to work on (used by COW e.g.). */
LIB_ID_COPY_LOCALIZE = LIB_ID_CREATE_NO_MAIN | LIB_ID_CREATE_NO_USER_REFCOUNT |
LIB_ID_CREATE_NO_DEG_TAG | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_CACHES,
};
diff --git a/source/blender/blenkernel/BKE_library_query.h b/source/blender/blenkernel/BKE_library_query.h
index caa36742f76..94e7830aabe 100644
--- a/source/blender/blenkernel/BKE_library_query.h
+++ b/source/blender/blenkernel/BKE_library_query.h
@@ -38,9 +38,12 @@ enum {
*/
IDWALK_CB_INDIRECT_USAGE = (1 << 2),
- /** That ID is used as mere sub-data by its owner
+ /**
+ * That ID is used as mere sub-data by its owner
* (only case currently: those f***ing nodetrees in materials etc.).
- * This means callback shall not *do* anything, only use this as informative data if it needs it. */
+ * This means callback shall not *do* anything,
+ * only use this as informative data if it needs it.
+ */
IDWALK_CB_PRIVATE = (1 << 3),
/** That ID is not really used by its owner, it's just an internal hint/helper.
diff --git a/source/blender/blenkernel/BKE_library_remap.h b/source/blender/blenkernel/BKE_library_remap.h
index da104c4c205..41ac8c8c8e6 100644
--- a/source/blender/blenkernel/BKE_library_remap.h
+++ b/source/blender/blenkernel/BKE_library_remap.h
@@ -29,29 +29,44 @@ extern "C" {
/* Also IDRemap->flag. */
enum {
- /* Do not remap indirect usages of IDs (that is, when user is some linked data). */
+ /** Do not remap indirect usages of IDs (that is, when user is some linked data). */
ID_REMAP_SKIP_INDIRECT_USAGE = 1 << 0,
- /* This flag should always be set, *except for 'unlink' scenarios* (only relevant when new_id == NULL).
- * Basically, when unset, NEVER_NULL ID usages will keep pointing to old_id, but (if needed) old_id user count
- * will still be decremented. This is mandatory for 'delete ID' case, but in all other situation this would lead
- * to invalid user counts! */
+ /**
+ * This flag should always be set, *except for 'unlink' scenarios*
+ * (only relevant when new_id == NULL).
+ * Basically, when unset, NEVER_NULL ID usages will keep pointing to old_id, but (if needed)
+ * old_id user count will still be decremented.
+ * This is mandatory for 'delete ID' case,
+ * but in all other situation this would lead to invalid user counts!
+ */
ID_REMAP_SKIP_NEVER_NULL_USAGE = 1 << 1,
- /* This tells the callback func to flag with LIB_DOIT all IDs using target one with a 'never NULL' pointer
- * (like e.g. Object->data). */
+ /**
+ * This tells the callback func to flag with #LIB_DOIT all IDs
+ * using target one with a 'never NULL' pointer (like e.g. #Object.data).
+ */
ID_REMAP_FLAG_NEVER_NULL_USAGE = 1 << 2,
- /* This tells the callback func to force setting IDs using target one with a 'never NULL' pointer to NULL.
- * WARNING! Use with extreme care, this will leave database in broken state and can cause crashes very easily! */
+ /**
+ * This tells the callback func to force setting IDs
+ * using target one with a 'never NULL' pointer to NULL.
+ * \warning Use with extreme care, this will leave database in broken state
+ * and can cause crashes very easily!
+ */
ID_REMAP_FORCE_NEVER_NULL_USAGE = 1 << 3,
- /* Do not consider proxy/_group pointers of local objects as indirect usages...
- * Our oh-so-beloved proxies again... Do not consider data used by local proxy object as indirect usage.
- * This is needed e.g. in reload scenario, since we have to ensure remapping of Armature data of local proxy
- * is also performed. Usual nightmare... */
+ /**
+ * Do not consider proxy/_group pointers of local objects as indirect usages...
+ * Our oh-so-beloved proxies again...
+ * Do not consider data used by local proxy object as indirect usage.
+ * This is needed e.g. in reload scenario,
+ * since we have to ensure remapping of Armature data of local proxy
+ * is also performed. Usual nightmare...
+ */
ID_REMAP_NO_INDIRECT_PROXY_DATA_USAGE = 1 << 4,
- /* Do not remap static override pointers. */
+ /** Do not remap static override pointers. */
ID_REMAP_SKIP_STATIC_OVERRIDE = 1 << 5,
};
-/* Note: Requiring new_id to be non-null, this *may* not be the case ultimately, but makes things simpler for now. */
+/* Note: Requiring new_id to be non-null, this *may* not be the case ultimately,
+ * but makes things simpler for now. */
void BKE_libblock_remap_locked(struct Main *bmain,
void *old_idv,
void *new_idv,
diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h
index b8721f61371..1c987d5eb8e 100644
--- a/source/blender/blenkernel/BKE_main.h
+++ b/source/blender/blenkernel/BKE_main.h
@@ -57,7 +57,8 @@ typedef struct BlendThumbnail {
/* Structs caching relations between data-blocks in a given Main. */
typedef struct MainIDRelationsEntry {
struct MainIDRelationsEntry *next;
- /* WARNING! for user_to_used, that pointer is really an ID** one, but for used_to_user, it’s only an ID* one! */
+ /* WARNING! for user_to_used,
+ * that pointer is really an ID** one, but for used_to_user, it’s only an ID* one! */
struct ID **id_pointer;
int usage_flag; /* Using IDWALK_ enums, in BKE_library_query.h */
} MainIDRelationsEntry;
@@ -121,9 +122,11 @@ typedef struct Main {
ListBase cachefiles;
ListBase workspaces;
- /* Must be generated, used and freed by same code - never assume this is valid data unless you know
- * when, who and how it was created.
- * Used by code doing a lot of remapping etc. at once to speed things up. */
+ /**
+ * Must be generated, used and freed by same code - never assume this is valid data unless you
+ * know when, who and how it was created.
+ * Used by code doing a lot of remapping etc. at once to speed things up.
+ */
struct MainIDRelations *relations;
struct MainLock *lock;
@@ -165,7 +168,9 @@ struct GSet *BKE_main_gset_create(struct Main *bmain, struct GSet *gset);
} \
((void)0)
-/* DO NOT use break statement with that macro, use FOREACH_MAIN_LISTBASE and FOREACH_MAIN_LISTBASE_ID instead
+/**
+ * DO NOT use break statement with that macro,
+ * use #FOREACH_MAIN_LISTBASE and #FOREACH_MAIN_LISTBASE_ID instead
* if you need that kind of control flow. */
#define FOREACH_MAIN_ID_BEGIN(_bmain, _id) \
{ \
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index d4ad0e771d3..f95a824fd94 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -123,10 +123,12 @@ struct Mesh *BKE_mesh_new_nomain_from_template(const struct Mesh *me_src,
int loops_len,
int polys_len);
-/* Performs copy for use during evaluation, optional referencing original arrays to reduce memory. */
+/* Performs copy for use during evaluation,
+ * optional referencing original arrays to reduce memory. */
struct Mesh *BKE_mesh_copy_for_eval(struct Mesh *source, bool reference);
-/* These functions construct a new Mesh, contrary to BKE_mesh_from_nurbs which modifies ob itself. */
+/* These functions construct a new Mesh,
+ * contrary to BKE_mesh_from_nurbs which modifies ob itself. */
struct Mesh *BKE_mesh_new_nomain_from_curve(struct Object *ob);
struct Mesh *BKE_mesh_new_nomain_from_curve_displist(struct Object *ob, struct ListBase *dispbase);
diff --git a/source/blender/blenkernel/BKE_mesh_remap.h b/source/blender/blenkernel/BKE_mesh_remap.h
index 54f263a8bfb..36cc5bedb79 100644
--- a/source/blender/blenkernel/BKE_mesh_remap.h
+++ b/source/blender/blenkernel/BKE_mesh_remap.h
@@ -54,10 +54,12 @@ void BKE_mesh_remap_item_define_invalid(MeshPairRemap *map, const int index);
/* TODO:
* Add other 'from/to' mapping sources, like e.g. using an UVMap, etc.
- * http://blenderartists.org/forum/showthread.php?346458-Move-Vertices-to-the-location-of-the-Reference-Mesh-based-on-the-UV-Position
+ * https://blenderartists.org/t/619105
+ *
* We could also use similar topology mappings inside a same mesh
* (cf. Campbell's 'select face islands from similar topology' wip work).
- * Also, users will have to check, whether we can get rid of some modes here, not sure all will be useful!
+ * Also, users will have to check, whether we can get rid of some modes here,
+ * not sure all will be useful!
*/
enum {
MREMAP_USE_VERT = 1 << 4,
@@ -104,13 +106,15 @@ enum {
/* Nearest edge of nearest poly (using mid-point). */
MREMAP_MODE_EDGE_POLY_NEAREST = MREMAP_MODE_EDGE | MREMAP_USE_POLY | MREMAP_USE_NEAREST,
- /* Cast a set of rays from along dest edge, interpolating its vertices' normals, and use hit source edges. */
+ /* Cast a set of rays from along dest edge,
+ * interpolating its vertices' normals, and use hit source edges. */
MREMAP_MODE_EDGE_EDGEINTERP_VNORPROJ = MREMAP_MODE_EDGE | MREMAP_USE_VERT | MREMAP_USE_NORPROJ |
MREMAP_USE_INTERP,
/* ***** Target's loops ***** */
- /* Note: when islands are given to loop mapping func, all loops from the same destination face will always be mapped
- * to loops of source faces within a same island, regardless of mapping mode. */
+ /* Note: when islands are given to loop mapping func,
+ * all loops from the same destination face will always be mapped
+ * to loops of source faces within a same island, regardless of mapping mode. */
MREMAP_MODE_LOOP = 1 << 26,
/* Best normal-matching loop from nearest vert. */
@@ -138,7 +142,8 @@ enum {
/* Source poly from best normal-matching dest poly. */
MREMAP_MODE_POLY_NOR = MREMAP_MODE_POLY | MREMAP_USE_POLY | MREMAP_USE_NORMAL,
- /* Project dest poly onto source mesh using its normal, and use interpolation of all intersecting source polys. */
+ /* Project dest poly onto source mesh using its normal,
+ * and use interpolation of all intersecting source polys. */
MREMAP_MODE_POLY_POLYINTERP_PNORPROJ = MREMAP_MODE_POLY | MREMAP_USE_POLY | MREMAP_USE_NORPROJ |
MREMAP_USE_INTERP,
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index 5b6f3cf17c4..a34f570ad1f 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -83,8 +83,8 @@ typedef enum {
*/
eModifierTypeFlag_RequiresOriginalData = (1 << 5),
- /* For modifiers that support pointcache, so we can check to see if it has files we need to deal with
- */
+ /* For modifiers that support pointcache,
+ * so we can check to see if it has files we need to deal with. */
eModifierTypeFlag_UsesPointCache = (1 << 6),
/* For physics modifiers, max one per type */
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 70b4903e746..b760be29dae 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -400,8 +400,9 @@ void ntreeUpdateAllUsers(struct Main *main, struct ID *id);
void ntreeGetDependencyList(struct bNodeTree *ntree, struct bNode ***deplist, int *totnodes);
-/* XXX old trees handle output flags automatically based on special output node types and last active selection.
- * new tree types have a per-output socket flag to indicate the final output to use explicitly.
+/* XXX old trees handle output flags automatically based on special output
+ * node types and last active selection.
+ * New tree types have a per-output socket flag to indicate the final output to use explicitly.
*/
void ntreeSetOutput(struct bNodeTree *ntree);
@@ -775,16 +776,20 @@ void BKE_node_tree_unlink_id(ID *id, struct bNodeTree *ntree);
/* -------------------------------------------------------------------- */
/** \name Node Tree Iterator
*
- * Utility macro for visiting every node tree in the library data, including local bNodeTree blocks in other IDs.
- * This avoids the need for callback functions and allows executing code in a single inner code block.
+ * Utility macro for visiting every node tree in the library data,
+ * including local bNodeTree blocks in other IDs.
+ * This avoids the need for callback functions and allows executing code
+ * in a single inner code block.
*
* Variables:
*
- * nodetree: The actual bNodeTree data block.
- * Check nodetree->idname or nodetree->typeinfo to use only specific types.
+ * - nodetree:
+ * The actual bNodeTree data block.
+ * Check nodetree->idname or nodetree->typeinfo to use only specific types.
*
- * id: The owner of the bNodeTree data block.
- * Same as nodetree if it's a linkable node tree from the library.
+ * - id:
+ * The owner of the bNodeTree data block.
+ * Same as nodetree if it's a linkable node tree from the library.
*
* Examples:
*
@@ -852,7 +857,8 @@ void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree,
/* note: types are needed to restore callbacks, don't change values */
/* range 1 - 100 is reserved for common nodes */
-/* using toolbox, we add node groups by assuming the values below don't exceed NODE_GROUP_MENU for now */
+/* using toolbox, we add node groups by assuming the values below
+ * don't exceed NODE_GROUP_MENU for now. */
//#define SH_NODE_OUTPUT 1
diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h
index 8a8ae3e2566..6ce60081f5b 100644
--- a/source/blender/blenkernel/BKE_pointcache.h
+++ b/source/blender/blenkernel/BKE_pointcache.h
@@ -167,7 +167,8 @@ typedef struct PTCacheID {
void (*interpolate_extra_data)(
void *calldata, struct PTCacheMem *pm, float cfra, float cfra1, float cfra2);
- /* total number of simulated points (the cfra parameter is just for using same function pointer with totwrite) */
+ /* Total number of simulated points
+ * (the cfra parameter is just for using same function pointer with totwrite). */
int (*totpoint)(void *calldata, int cfra);
/* report error if number of points does not match */
void (*error)(void *calldata, const char *message);
@@ -265,8 +266,8 @@ typedef struct PTCacheEdit {
struct ParticleSystemModifierData *psmd;
struct ParticleSystemModifierData *psmd_eval;
struct KDTree_3d *emitter_field;
- float *
- emitter_cosnos; /* localspace face centers and normals (average of its verts), from the derived mesh */
+ /* Localspace face centers and normals (average of its verts), from the derived mesh. */
+ float *emitter_cosnos;
int *mirror_cache;
struct ParticleCacheKey **pathcache; /* path cache (runtime) */
diff --git a/source/blender/blenkernel/BKE_rigidbody.h b/source/blender/blenkernel/BKE_rigidbody.h
index 72bc95028da..c940e646d95 100644
--- a/source/blender/blenkernel/BKE_rigidbody.h
+++ b/source/blender/blenkernel/BKE_rigidbody.h
@@ -106,7 +106,8 @@ void BKE_rigidbody_remove_constraint(struct Scene *scene, struct Object *ob);
(rbo->flag & RBO_FLAG_DISABLED))) ? \
(0.0f) : \
(rbo->mass))
-/* get collision margin for Rigid Body Object, triangle mesh and cone shapes cannot embed margin, convex hull always uses custom margin */
+/* Get collision margin for Rigid Body Object, triangle mesh and cone shapes cannot embed margin,
+ * convex hull always uses custom margin. */
#define RBO_GET_MARGIN(rbo) \
((rbo->flag & RBO_FLAG_USE_MARGIN || rbo->shape == RB_SHAPE_CONVEXH || \
rbo->shape == RB_SHAPE_TRIMESH || rbo->shape == RB_SHAPE_CONE) ? \
diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h
index 6a9711dd316..93c9c41e482 100644
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@ -182,7 +182,8 @@ typedef struct ARegionType {
int prefsizex, prefsizey;
/* default keymaps to add */
int keymapflag;
- /* return without drawing. lock is set by region definition, and copied to do_lock by render. can become flag */
+ /* return without drawing.
+ * lock is set by region definition, and copied to do_lock by render. can become flag. */
short do_lock, lock;
/* call cursor function on each move event */
short event_cursor;
@@ -337,7 +338,8 @@ struct ARegion *BKE_area_region_copy(struct SpaceType *st, struct ARegion *ar);
void BKE_area_region_free(struct SpaceType *st, struct ARegion *ar);
void BKE_area_region_panels_free(struct ListBase *panels);
void BKE_screen_area_free(struct ScrArea *sa);
-/* Gizmo-maps of a region need to be freed with the region. Uses callback to avoid low-level call. */
+/* Gizmo-maps of a region need to be freed with the region.
+ * Uses callback to avoid low-level call. */
void BKE_region_callback_free_gizmomap_set(void (*callback)(struct wmGizmoMap *));
void BKE_region_callback_refresh_tag_gizmomap_set(void (*callback)(struct wmGizmoMap *));
diff --git a/source/blender/blenkernel/BKE_shrinkwrap.h b/source/blender/blenkernel/BKE_shrinkwrap.h
index d97525d4094..8993654254e 100644
--- a/source/blender/blenkernel/BKE_shrinkwrap.h
+++ b/source/blender/blenkernel/BKE_shrinkwrap.h
@@ -112,7 +112,8 @@ void shrinkwrapModifier_deform(struct ShrinkwrapModifierData *smd,
int numVerts);
/*
- * This function casts a ray in the given BVHTree.. but it takes into consideration the space_transform, that is:
+ * This function casts a ray in the given BVHTree.
+ * but it takes into consideration the space_transform, that is:
*
* if transf was configured with "SPACE_TRANSFORM_SETUP( &transf, ob1, ob2 )"
* then the input (vert, dir, BVHTreeRayHit) must be defined in ob1 coordinates space
@@ -129,7 +130,8 @@ bool BKE_shrinkwrap_project_normal(char options,
struct ShrinkwrapTreeData *tree,
BVHTreeRayHit *hit);
-/* Maps the point to the nearest surface, either by simple nearest, or by target normal projection. */
+/* Maps the point to the nearest surface, either by simple nearest,
+ * or by target normal projection. */
void BKE_shrinkwrap_find_nearest_surface(struct ShrinkwrapTreeData *tree,
struct BVHTreeNearest *nearest,
float co[3],
diff --git a/source/blender/blenkernel/BKE_undo_system.h b/source/blender/blenkernel/BKE_undo_system.h
index fc6fc6ff336..d4cb9331605 100644
--- a/source/blender/blenkernel/BKE_undo_system.h
+++ b/source/blender/blenkernel/BKE_undo_system.h
@@ -92,7 +92,8 @@ typedef struct UndoType {
/**
* When NULL, we don't consider this undo type for context checks.
* Operators must explicitly set the undo type and handle adding the undo step.
- * This is needed when tools operate on data which isn't the primary mode (eg, paint-curve in sculpt mode).
+ * This is needed when tools operate on data which isn't the primary mode
+ * (eg, paint-curve in sculpt mode).
*/
bool (*poll)(struct bContext *C);
diff --git a/source/blender/blenkernel/intern/CCGSubSurf_intern.h b/source/blender/blenkernel/intern/CCGSubSurf_intern.h
index f89545e802e..41a34b65381 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf_intern.h
+++ b/source/blender/blenkernel/intern/CCGSubSurf_intern.h
@@ -269,7 +269,10 @@ struct CCGSubSurf {
#define EDGE_getNo(e, lvl, x) ccg_edge_getNo(e, lvl, x, vertDataSize, normalDataOffset)
#define FACE_getIFNo(f, lvl, S, x, y) \
ccg_face_getIFNo(f, lvl, S, x, y, subdivLevels, vertDataSize, normalDataOffset)
-//#define FACE_calcIFNo(f, lvl, S, x, y, no) _face_calcIFNo(f, lvl, S, x, y, no, subdivLevels, vertDataSize)
+#if 0
+# define FACE_calcIFNo(f, lvl, S, x, y, no) \
+ _face_calcIFNo(f, lvl, S, x, y, no, subdivLevels, vertDataSize)
+#endif
#define FACE_getIENo(f, lvl, S, x) \
ccg_face_getIENo(f, lvl, S, x, subdivLevels, vertDataSize, normalDataOffset)
#define FACE_getIECo(f, lvl, S, x) ccg_face_getIECo(f, lvl, S, x, subdivLevels, vertDataSize)
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 566135592be..959435ad486 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -246,8 +246,8 @@ static const MLoopTri *dm_getLoopTriArray(DerivedMesh *dm)
}
else {
BLI_rw_mutex_lock(&loops_cache_lock, THREAD_LOCK_WRITE);
- /* We need to ensure array is still NULL inside mutex-protected code, some other thread might have already
- * recomputed those looptris. */
+ /* We need to ensure array is still NULL inside mutex-protected code,
+ * some other thread might have already recomputed those looptris. */
if (dm->looptris.array == NULL) {
dm->recalcLoopTri(dm);
}
@@ -485,7 +485,8 @@ void DM_ensure_normals(DerivedMesh *dm)
/**
* Ensure the array is large enough
*
- * \note This function must always be thread-protected by caller. It should only be used by internal code.
+ * \note This function must always be thread-protected by caller.
+ * It should only be used by internal code.
*/
void DM_ensure_looptri_data(DerivedMesh *dm)
{
@@ -1039,7 +1040,8 @@ static void mesh_calc_modifier_final_normals(const Mesh *mesh_input,
/* Compute normals. */
const bool do_loop_normals = ((mesh_input->flag & ME_AUTOSMOOTH) != 0 ||
(dataMask->lmask & CD_MASK_NORMAL) != 0);
- /* Some modifiers may need this info from their target (other) object, simpler to generate it here as well.
+ /* Some modifiers may need this info from their target (other) object,
+ * simpler to generate it here as well.
* Note that they will always be generated when no loop normals are comptuted,
* since they are needed by drawing code. */
const bool do_poly_normals = ((dataMask->pmask & CD_MASK_NORMAL) != 0);
@@ -1087,8 +1089,9 @@ static void mesh_calc_modifier_final_normals(const Mesh *mesh_input,
}
}
- /* Some modifiers, like datatransfer, may generate those data as temp layer, we do not want to keep them,
- * as they are used by display code when available (i.e. even if autosmooth is disabled). */
+ /* Some modifiers, like data-transfer, may generate those data as temp layer,
+ * we do not want to keep them, as they are used by display code when available
+ * (i.e. even if autosmooth is disabled). */
if (!do_loop_normals && CustomData_has_layer(&mesh_final->ldata, CD_NORMAL)) {
CustomData_free_layers(&mesh_final->ldata, CD_NORMAL, mesh_final->totloop);
}
@@ -1365,7 +1368,8 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
CustomData_add_layer(
&mesh_final->pdata, CD_ORIGINDEX, CD_CALLOC, NULL, mesh_final->totpoly);
- /* Not worth parallelizing this, gives less than 0.1% overall speedup in best of best cases... */
+ /* Not worth parallelizing this,
+ * gives less than 0.1% overall speedup in best of best cases... */
range_vn_i(
CustomData_get_layer(&mesh_final->vdata, CD_ORIGINDEX), mesh_final->totvert, 0);
range_vn_i(
@@ -1585,11 +1589,13 @@ static void editbmesh_calc_modifier_final_normals(const Mesh *mesh_input,
{
const bool do_loop_normals = ((mesh_input->flag & ME_AUTOSMOOTH) != 0 ||
(dataMask->lmask & CD_MASK_NORMAL) != 0);
- /* Some modifiers may need this info from their target (other) object, simpler to generate it here as well. */
+ /* Some modifiers may need this info from their target (other) object,
+ * simpler to generate it here as well. */
const bool do_poly_normals = ((dataMask->pmask & CD_MASK_NORMAL) != 0);
if (do_loop_normals) {
- /* In case we also need poly normals, add the layer here, then BKE_mesh_calc_normals_split() will fill it. */
+ /* In case we also need poly normals, add the layer here,
+ * then BKE_mesh_calc_normals_split() will fill it. */
if (do_poly_normals) {
if (!CustomData_has_layer(&mesh_final->pdata, CD_NORMAL)) {
CustomData_add_layer(&mesh_final->pdata, CD_NORMAL, CD_CALLOC, NULL, mesh_final->totpoly);
@@ -2020,7 +2026,10 @@ static void mesh_build_data(struct Depsgraph *depsgraph,
* but this avoids waiting on first stroke) */
/* XXX Disabled for now.
* This can create horrible nasty bugs by generating re-entrant call of mesh_get_eval_final! */
- // BKE_sculpt_update_mesh_elements(depsgraph, scene, scene->toolsettings->sculpt, ob, false, false);
+#if 0
+ BKE_sculpt_update_mesh_elements(
+ depsgraph, scene, scene->toolsettings->sculpt, ob, false, false);
+#endif
}
mesh_runtime_check_normals_valid(ob->runtime.mesh_eval);
@@ -2444,7 +2453,8 @@ static void mesh_init_origspace(Mesh *mesh)
}
invert_v2(scale);
- /* Finally, transform all vcos_2d into ((0, 0), (1, 1)) square and assign 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);
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 8e9158b8433..9b321ff4e44 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -115,8 +115,10 @@ void BKE_action_free(bAction *act)
/* .................................. */
/**
- * Only copy internal data of Action ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of Action ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -139,8 +141,11 @@ void BKE_action_copy_data(Main *UNUSED(bmain),
for (fcu_src = act_src->curves.first; fcu_src; fcu_src = fcu_src->next) {
/* duplicate F-Curve */
- fcu_dst = copy_fcurve(
- fcu_src); /* XXX TODO pass subdata flag? But surprisingly does not seem to be doing any ID refcounting... */
+
+ /* XXX TODO pass subdata flag?
+ * But surprisingly does not seem to be doing any ID refcounting... */
+ fcu_dst = copy_fcurve(fcu_src);
+
BLI_addtail(&act_dst->curves, fcu_dst);
/* fix group links (kindof bad list-in-list search, but this is the most reliable way) */
@@ -309,12 +314,13 @@ void action_groups_add_channel(bAction *act, bActionGroup *agrp, FCurve *fcurve)
/* firstly, link this F-Curve to the group */
agrp->channels.first = agrp->channels.last = fcurve;
- /* step through the groups preceding this one, finding the F-Curve there to attach this one after */
+ /* Step through the groups preceding this one,
+ * finding the F-Curve there to attach this one after. */
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
+ /* 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
+ * 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... */
@@ -323,9 +329,9 @@ void action_groups_add_channel(bAction *act, bActionGroup *agrp, FCurve *fcurve)
}
}
- /* if grp is NULL, that means we fell through, and this F-Curve should be added as the new first
- * since group is (effectively) the first group. Thus, the existing first F-Curve becomes the
- * second in the chain, etc. etc.
+ /* If grp is NULL, that means we fell through, and this F-Curve should be added as the new
+ * first since group is (effectively) the first group. Thus, the existing first F-Curve becomes
+ * the second in the chain, etc. etc.
*/
if (grp == NULL) {
BLI_insertlinkbefore(&act->curves, act->curves.first, fcurve);
@@ -606,7 +612,8 @@ void BKE_pose_copy_data_ex(bPose **dst,
&listb, &pchan->constraints, flag, true); // BKE_constraints_copy NULLs listb
pchan->constraints = listb;
- /* XXX: This is needed for motionpath drawing to work. Dunno why it was setting to null before... */
+ /* XXX: This is needed for motionpath drawing to work.
+ * Dunno why it was setting to null before... */
pchan->mpath = animviz_copy_motionpath(pchan->mpath);
}
@@ -1287,7 +1294,8 @@ short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan,
for (fcu = act->curves.first; fcu; fcu = fcu->next) {
const char *bPtr = NULL, *pPtr = NULL;
- /* if enough flags have been found, we can stop checking unless we're also getting the curves */
+ /* If enough flags have been found,
+ * we can stop checking unless we're also getting the curves. */
if ((flags == ACT_TRANS_ALL) && (curves == NULL)) {
break;
}
@@ -1531,14 +1539,12 @@ void what_does_obaction(
}
BLI_strncpy(workob->parsubstr, ob->parsubstr, sizeof(workob->parsubstr));
- BLI_strncpy(
- workob->id.name,
- "OB<ConstrWorkOb>",
- sizeof(
- workob->id
- .name)); /* we don't use real object name, otherwise RNA screws with the real thing */
-
- /* if we're given a group to use, it's likely to be more efficient (though a bit more dangerous) */
+
+ /* we don't use real object name, otherwise RNA screws with the real thing */
+ BLI_strncpy(workob->id.name, "OB<ConstrWorkOb>", sizeof(workob->id.name));
+
+ /* If we're given a group to use, it's likely to be more efficient
+ * (though a bit more dangerous). */
if (agrp) {
/* specifically evaluate this group only */
PointerRNA id_ptr;
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index e74af25a4a1..7a0c6ca97e8 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -202,7 +202,8 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports,
mpath = *dst;
- /* path is "valid" if length is valid, but must also be of the same length as is being requested */
+ /* Path is "valid" if length is valid,
+ * but must also be of the same length as is being requested. */
if ((mpath->start_frame != mpath->end_frame) && (mpath->length > 0)) {
/* outer check ensures that we have some curve data for this path */
if (mpath->length == expected_length) {
@@ -309,7 +310,8 @@ void calc_curvepath(Object *ob, ListBase *nurbs)
tot = cycl ? bl->nr : bl->nr - 1;
path->len = tot + 1;
- /* exception: vector handle paths and polygon paths should be subdivided at least a factor resolu */
+ /* Exception: vector handle paths and polygon paths should be subdivided
+ * at least a factor resolution. */
if (path->len < nu->resolu * SEGMENTSU(nu)) {
path->len = nu->resolu * SEGMENTSU(nu);
}
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index e8bcb664c6e..2beacbcd254 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -179,7 +179,8 @@ AnimData *BKE_animdata_add_id(ID *id)
/* Action Setter --------------------------------------- */
-/* Called when user tries to change the active action of an AnimData block (via RNA, Outliner, etc.) */
+/** Called when user tries to change the active action of an AnimData block
+ * (via RNA, Outliner, etc.) */
bool BKE_animdata_set_action(ReportList *reports, ID *id, bAction *act)
{
AnimData *adt = BKE_animdata_from_id(id);
@@ -283,7 +284,8 @@ void BKE_animdata_free(ID *id, const bool do_id_user)
/**
* Make a copy of the given AnimData - to be used when copying datablocks.
- * \param flag: Control ID pointers management, see LIB_ID_CREATE_.../LIB_ID_COPY_... flags in BKE_library.h
+ * \param flag: Control ID pointers management,
+ * see LIB_ID_CREATE_.../LIB_ID_COPY_... flags in BKE_library.h
* \return The copied animdata.
*/
AnimData *BKE_animdata_copy(Main *bmain, AnimData *adt, const int flag)
@@ -325,7 +327,8 @@ AnimData *BKE_animdata_copy(Main *bmain, AnimData *adt, const int flag)
}
/**
- * \param flag: Control ID pointers management, see LIB_ID_CREATE_.../LIB_ID_COPY_... flags in BKE_library.h
+ * \param flag: Control ID pointers management,
+ * see LIB_ID_CREATE_.../LIB_ID_COPY_... flags in BKE_library.h
* \return true is succesfully copied.
*/
bool BKE_animdata_copy_id(Main *bmain, ID *id_to, ID *id_from, const int flag)
@@ -572,7 +575,8 @@ void BKE_animdata_separate_by_basepath(Main *bmain, ID *srcID, ID *dstID, ListBa
/* active action */
if (srcAdt->action) {
- /* set up an action if necessary, and name it in a similar way so that it can be easily found again */
+ /* Set up an action if necessary,
+ * and name it in a similar way so that it can be easily found again. */
if (dstAdt->action == NULL) {
dstAdt->action = BKE_action_add(bmain, srcAdt->action->id.name + 2);
}
@@ -629,7 +633,8 @@ void BKE_animdata_separate_by_basepath(Main *bmain, ID *srcID, ID *dstID, ListBa
* they will get picked up by the dependency system.
*
* \param C: Context pointer - for getting active data
- * \param[in,out] ptr RNA pointer for property's datablock. May be modified as result of path remapping.
+ * \param[in,out] ptr: RNA pointer for property's datablock.
+ * May be modified as result of path remapping.
* \param prop: RNA definition of property to add for
* \return MEM_alloc'd string representing the path to the property from the given #PointerRNA
*/
@@ -670,7 +675,8 @@ char *BKE_animdata_driver_path_hack(bContext *C,
/* Path Validation -------------------------------------------- */
-/* Check if a given RNA Path is valid, by tracing it from the given ID, and seeing if we can resolve it */
+/* Check if a given RNA Path is valid, by tracing it from the given ID,
+ * and seeing if we can resolve it. */
static bool check_rna_path_is_valid(ID *owner_id, const char *path)
{
PointerRNA id_ptr, ptr;
@@ -766,7 +772,8 @@ static bool fcurves_path_rename_fix(ID *owner_id,
fcu->rna_path = rna_path_rename_fix(
owner_id, prefix, oldKey, newKey, fcu->rna_path, verify_paths);
/* if path changed and the F-Curve is grouped, check if its group also needs renaming
- * (i.e. F-Curve is first of a bone's F-Curves; hence renaming this should also trigger rename) */
+ * (i.e. F-Curve is first of a bone's F-Curves;
+ * hence renaming this should also trigger rename) */
if (fcu->rna_path != old_path) {
bActionGroup *agrp = fcu->grp;
is_changed = true;
@@ -1456,7 +1463,8 @@ KS_Path *BKE_keyingset_find_path(KeyingSet *ks,
/* Defining Tools --------------------------- */
-/* Used to create a new 'custom' KeyingSet for the user, that will be automatically added to the stack */
+/* Used to create a new 'custom' KeyingSet for the user,
+ * that will be automatically added to the stack */
KeyingSet *BKE_keyingset_add(
ListBase *list, const char idname[], const char name[], short flag, short keyingflag)
{
@@ -1471,8 +1479,8 @@ KeyingSet *BKE_keyingset_add(
ks->flag = flag;
ks->keyingflag = keyingflag;
- ks->keyingoverride =
- keyingflag; /* NOTE: assume that if one is set one way, the other should be too, so that it'll work */
+ /* NOTE: assume that if one is set one way, the other should be too, so that it'll work */
+ ks->keyingoverride = keyingflag;
/* add KeyingSet to list */
BLI_addtail(list, ks);
@@ -1847,8 +1855,10 @@ static void animsys_write_orig_anim_rna(PointerRNA *ptr,
}
}
-/* Evaluate all the F-Curves in the given list
- * This performs a set of standard checks. If extra checks are required, separate code should be used
+/**
+ * Evaluate all the F-Curves in the given list
+ * This performs a set of standard checks. If extra checks are required,
+ * separate code should be used.
*/
static void animsys_evaluate_fcurves(Depsgraph *depsgraph,
PointerRNA *ptr,
@@ -1898,9 +1908,8 @@ static void animsys_evaluate_drivers(PointerRNA *ptr, AnimData *adt, float ctime
/* XXX driver recalc flag is not set yet by depsgraph! */
if ((driver) && !(driver->flag & DRIVER_FLAG_INVALID)) {
/* evaluate this using values set already in other places
- * NOTE: for 'layering' option later on, we should check if we should remove old value before adding
- * new to only be done when drivers only changed */
-
+ * NOTE: for 'layering' option later on, we should check if we should remove old value
+ * before adding new to only be done when drivers only changed. */
PathResolvedRNA anim_rna;
if (animsys_store_rna_setting(ptr, fcu->rna_path, fcu->array_index, &anim_rna)) {
const float curval = calculate_fcurve(&anim_rna, fcu, ctime);
@@ -1937,7 +1946,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)
+ /* 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 (?)
*/
@@ -2067,9 +2077,9 @@ static void nlastrip_evaluate_controls(Depsgraph *depsgraph, NlaStrip *strip, fl
strip->strip_time = nlastrip_get_frame(strip, ctime, NLATIME_CONVERT_EVAL);
}
- /* if user can control the evaluation time (using F-Curves), consider the option which allows this time to be clamped
- * to lie within extents of the action-clip, so that a steady changing rate of progress through several cycles of the clip
- * can be achieved easily
+ /* if user can control the evaluation time (using F-Curves), consider the option which allows
+ * this time to be clamped to lie within extents of the action-clip, so that a steady changing
+ * rate of progress through several cycles of the clip can be achieved easily.
*/
/* NOTE: if we add any more of these special cases, we better group them up nicely... */
if ((strip->flag & NLASTRIP_FLAG_USR_TIME) && (strip->flag & NLASTRIP_FLAG_USR_TIME_CYCLIC)) {
@@ -2160,7 +2170,8 @@ NlaEvalStrip *nlastrips_ctime_get_strip(
* - 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... */
+ /* TODO: this sounds a bit hacky having a few isolated F-Curves
+ * stuck on some data it operates on... */
nlastrip_evaluate_controls(depsgraph, estrip, ctime);
if (estrip->influence <= 0.0f) {
return NULL;
@@ -2331,7 +2342,8 @@ static NlaEvalChannelSnapshot *nlaeval_snapshot_find_channel(NlaEvalSnapshot *sn
return &nec->base_snapshot;
}
-/* Retrieve or create the channel value snapshot, copying from the other snapshot (or default values) */
+/* Retrieve or create the channel value snapshot, copying from the other snapshot
+ * (or default values) */
static NlaEvalChannelSnapshot *nlaeval_snapshot_ensure_channel(NlaEvalSnapshot *snapshot,
NlaEvalChannel *nec)
{
@@ -2959,7 +2971,8 @@ static void nlaeval_snapshot_mix_and_free(NlaEvalData *nlaeval,
}
/* ---------------------- */
-/* F-Modifier stack joining/separation utilities - should we generalise these for BLI_listbase.h interface? */
+/* F-Modifier stack joining/separation utilities -
+ * should we generalize these for BLI_listbase.h interface? */
/* Temporarily join two lists of modifiers together, storing the result in a third list */
static void nlaeval_fmodifiers_join_stacks(ListBase *result, ListBase *list1, ListBase *list2)
@@ -2979,8 +2992,9 @@ static void nlaeval_fmodifiers_join_stacks(ListBase *result, ListBase *list1, Li
result->last = list1->last;
}
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
+ /* 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.
*/
result->first = list1->first;
result->last = list2->last;
@@ -3058,7 +3072,8 @@ static void nlastrip_evaluate_actionclip(PointerRNA *ptr,
.influence = strip->influence,
};
- /* evaluate all the F-Curves in the action, saving the relevant pointers to data that will need to be used */
+ /* Evaluate all the F-Curves in the action,
+ * saving the relevant pointers to data that will need to be used. */
for (fcu = strip->act->curves.first; fcu; fcu = fcu->next) {
float value = 0.0f;
@@ -3071,18 +3086,20 @@ static void nlastrip_evaluate_actionclip(PointerRNA *ptr,
}
/* evaluate the F-Curve's value for the time given in the strip
- * NOTE: we use the modified time here, since strip's F-Curve Modifiers are applied on top of this
+ * NOTE: we use the modified time here, since strip's F-Curve Modifiers
+ * are applied on top of this.
*/
value = evaluate_fcurve(fcu, evaltime);
/* apply strip's F-Curve Modifiers on this value
- * NOTE: we apply the strip's original evaluation time not the modified one (as per standard F-Curve eval)
+ * NOTE: we apply the strip's original evaluation time not the modified one
+ * (as per standard F-Curve eval)
*/
evaluate_value_fmodifiers(&storage, &tmp_modifiers, fcu, &value, strip->strip_time);
- /* get an NLA evaluation channel to work with, and accumulate the evaluated value with the value(s)
- * stored in this channel if it has been used already
- */
+ /* Get an NLA evaluation channel to work with,
+ * and accumulate the evaluated value with the value(s)
+ * stored in this channel if it has been used already. */
NlaEvalChannel *nec = nlaevalchan_verify(ptr, channels, fcu->rna_path);
nlaeval_blend_value(&blend, nec, fcu->array_index, value);
@@ -3208,10 +3225,13 @@ void nlastrip_evaluate(Depsgraph *depsgraph,
{
NlaStrip *strip = nes->strip;
- /* to prevent potential infinite recursion problems (i.e. transition strip, beside meta strip containing a transition
- * several levels deep inside it), we tag the current strip as being evaluated, and clear this when we leave
+ /* To prevent potential infinite recursion problems
+ * (i.e. transition strip, beside meta strip containing a transition
+ * several levels deep inside it),
+ * we tag the current strip as being evaluated, and clear this when we leave.
*/
- /* TODO: be careful with this flag, since some edit tools may be running and have set this while animplayback was running */
+ /* TODO: be careful with this flag, since some edit tools may be running and have
+ * set this while animplayback was running */
if (strip->flag & NLASTRIP_FLAG_EDIT_TOUCHED) {
return;
}
@@ -3365,9 +3385,10 @@ static void animsys_evaluate_nla_domain(PointerRNA *ptr, NlaEvalData *channels,
/**
* NLA Evaluation function - values are calculated and stored in temporary "NlaEvalChannels"
*
- * \param[out] echannels Evaluation channels with calculated values
- * \param[out] r_context If not NULL, data about the currently edited strip is stored here and excluded from value calculation.
- * \return false if NLA evaluation isn't actually applicable
+ * \param[out] echannels: Evaluation channels with calculated values
+ * \param[out] r_context: If not NULL,
+ * data about the currently edited strip is stored here and excluded from value calculation.
+ * \return false if NLA evaluation isn't actually applicable.
*/
static bool animsys_evaluate_nla(Depsgraph *depsgraph,
NlaEvalData *echannels,
@@ -3391,7 +3412,8 @@ static bool animsys_evaluate_nla(Depsgraph *depsgraph,
/* 1. get the stack of strips to evaluate at current time (influence calculated here) */
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next, track_index++) {
- /* stop here if tweaking is on and this strip is the tweaking track (it will be the first one that's 'disabled')... */
+ /* stop here if tweaking is on and this strip is the tweaking track
+ * (it will be the first one that's 'disabled')... */
if ((adt->flag & ADT_NLA_EDIT_ON) && (nlt->flag & NLATRACK_DISABLED)) {
break;
}
@@ -3452,7 +3474,8 @@ static bool animsys_evaluate_nla(Depsgraph *depsgraph,
/* set settings of dummy NLA strip from AnimData settings */
dummy_strip->act = adt->action;
- /* action range is calculated taking F-Modifiers into account (which making new strips doesn't do due to the troublesome nature of that) */
+ /* action range is calculated taking F-Modifiers into account
+ * (which making new strips doesn't do due to the troublesome nature of that) */
calc_action_range(dummy_strip->act, &dummy_strip->actstart, &dummy_strip->actend, 1);
dummy_strip->start = dummy_strip->actstart;
dummy_strip->end = (IS_EQF(dummy_strip->actstart, dummy_strip->actend)) ?
@@ -3469,14 +3492,16 @@ static bool animsys_evaluate_nla(Depsgraph *depsgraph,
dummy_strip->extendmode = adt->act_extendmode;
}
- /* Unless extendmode is Nothing (might be useful for flattening NLA evaluation), disable range. */
+ /* Unless extendmode is Nothing (might be useful for flattening NLA evaluation),
+ * disable range. */
if (dummy_strip->extendmode != NLASTRIP_EXTEND_NOTHING) {
dummy_strip->flag |= NLASTRIP_FLAG_NO_TIME_MAP;
}
dummy_strip->influence = adt->act_influence;
- /* NOTE: must set this, or else the default setting overrides, and this setting doesn't work */
+ /* NOTE: must set this, or else the default setting overrides,
+ * and this setting doesn't work. */
dummy_strip->flag |= NLASTRIP_FLAG_USR_INFLUENCE;
}
@@ -3486,7 +3511,8 @@ static bool animsys_evaluate_nla(Depsgraph *depsgraph,
}
/* If computing the context for keyframing, store data there instead of the list. */
else {
- /* The extend mode here effectively controls whether it is possible to keyframe beyond the ends. */
+ /* The extend mode here effectively controls
+ * whether it is possible to key-frame beyond the ends. */
dummy_strip->extendmode = is_inplace_tweak ? NLASTRIP_EXTEND_NOTHING :
NLASTRIP_EXTEND_HOLD;
@@ -3513,7 +3539,8 @@ static bool animsys_evaluate_nla(Depsgraph *depsgraph,
return true;
}
- /* 2. for each strip, evaluate then accumulate on top of existing channels, but don't set values yet */
+ /* 2. for each strip, evaluate then accumulate on top of existing channels,
+ * but don't set values yet. */
for (nes = estrips.first; nes; nes = nes->next) {
nlastrip_evaluate(depsgraph, ptr, echannels, NULL, nes, &echannels->eval_snapshot);
}
@@ -3564,9 +3591,10 @@ static void animsys_calculate_nla(Depsgraph *depsgraph,
* Prepare data necessary to compute correct keyframe values for NLA strips
* with non-Replace mode or influence different from 1.
*
- * @param cache List used to cache contexts for reuse when keying multiple channels in one operation.
- * @param ptr RNA pointer to the Object with the animation.
- * @return Keyframing context, or NULL if not necessary.
+ * \param cache List used to cache contexts for reuse when keying
+ * multiple channels in one operation.
+ * \param ptr RNA pointer to the Object with the animation.
+ * \return Keyframing context, or NULL if not necessary.
*/
NlaKeyframingContext *BKE_animsys_get_nla_keyframing_context(struct ListBase *cache,
struct Depsgraph *depsgraph,
@@ -3607,13 +3635,14 @@ NlaKeyframingContext *BKE_animsys_get_nla_keyframing_context(struct ListBase *ca
/**
* Apply correction from the NLA context to the values about to be keyframed.
*
- * @param context Context to use (may be NULL).
- * @param prop_ptr Property about to be keyframed.
- * @param[in,out] values Array of property values to adjust.
- * @param count Number of values in the array.
- * @param index Index of the element about to be updated, or -1.
- * @param[out] r_force_all Set to true if all channels must be inserted. May be NULL.
- * @return False if correction fails due to a division by zero, or null r_force_all when all channels are required.
+ * \param context Context to use (may be NULL).
+ * \param prop_ptr Property about to be keyframed.
+ * \param[in,out] values Array of property values to adjust.
+ * \param count Number of values in the array.
+ * \param index Index of the element about to be updated, or -1.
+ * \param[out] r_force_all Set to true if all channels must be inserted. May be NULL.
+ * \return False if correction fails due to a division by zero,
+ * or null r_force_all when all channels are required.
*/
bool BKE_animsys_nla_remap_keyframe_values(struct NlaKeyframingContext *context,
struct PointerRNA *prop_ptr,
@@ -3757,17 +3786,21 @@ static void animsys_evaluate_overrides(PointerRNA *ptr, AnimData *adt)
* 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...
+ * 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.
@@ -4044,8 +4077,8 @@ void BKE_animsys_eval_driver(Depsgraph *depsgraph,
/* XXX driver recalc flag is not set yet by depsgraph! */
if ((driver_orig) && !(driver_orig->flag & DRIVER_FLAG_INVALID)) {
/* evaluate this using values set already in other places
- * NOTE: for 'layering' option later on, we should check if we should remove old value before adding
- * new to only be done when drivers only changed */
+ * NOTE: for 'layering' option later on, we should check if we should remove old value before
+ * adding new to only be done when drivers only changed */
//printf("\told val = %f\n", fcu->curval);
PathResolvedRNA anim_rna;
diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c
index 0986596f97c..2546937d949 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -55,8 +55,9 @@
# ifdef WITH_BINRELOC
# include "binreloc.h"
# endif
-# include <unistd.h> /* mkdtemp on OSX (and probably all *BSD?), not worth making specific check for this OS. */
-#endif /* WIN32 */
+/* mkdtemp on OSX (and probably all *BSD?), not worth making specific check for this OS. */
+# include <unistd.h>
+#endif /* WIN32 */
/* local */
static CLG_LogRef LOG = {"bke.appdir"};
@@ -222,9 +223,11 @@ static bool get_path_local(char *targetpath,
relfolder[0] = '\0';
}
- /* try EXECUTABLE_DIR/2.5x/folder_name - new default directory for local blender installed files */
+ /* Try EXECUTABLE_DIR/2.5x/folder_name -
+ * new default directory for local blender installed files. */
#ifdef __APPLE__
- /* due new codesign situation in OSX > 10.9.5 we must move the blender_version dir with contents to Resources */
+ /* Due new codesign situation in OSX > 10.9.5
+ * we must move the blender_version dir with contents to Resources. */
char osx_resourses[FILE_MAX];
BLI_snprintf(osx_resourses, sizeof(osx_resourses), "%s../Resources", bprogdir);
/* Remove the '/../' added above. */
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 531c1795497..97238020f29 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -170,8 +170,10 @@ static void copy_bonechildren(Bone *bone_dst,
}
/**
- * Only copy internal data of Armature ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of Armature ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -463,7 +465,8 @@ static void equalize_cubic_bezier(const float control[4][3],
r_t_points[final_segments] = 1.0f;
}
-/* Evaluate bezier position and tangent at a specific parameter value using the De Casteljau algorithm. */
+/* Evaluate bezier position and tangent at a specific parameter value
+ * using the De Casteljau algorithm. */
static void evaluate_cubic_bezier(const float control[4][3],
float t,
float r_pos[3],
@@ -809,9 +812,10 @@ void BKE_pchan_bbone_handles_compute(const BBoneSplineParameters *param,
*r_roll2 += param->roll2;
/* Extra curve x / y */
- /* NOTE: Scale correction factors here are to compensate for some random floating-point glitches
- * when scaling up the bone or it's parent by a factor of approximately 8.15/6, which results
- * in the bone length getting scaled up too (from 1 to 8), causing the curve to flatten out.
+ /* NOTE:
+ * Scale correction factors here are to compensate for some random floating-point glitches
+ * when scaling up the bone or it's parent by a factor of approximately 8.15/6, which results
+ * in the bone length getting scaled up too (from 1 to 8), causing the curve to flatten out.
*/
const float xscale_correction = (param->do_scale) ? param->scale[0] : 1.0f;
const float yscale_correction = (param->do_scale) ? param->scale[2] : 1.0f;
@@ -1059,7 +1063,8 @@ void BKE_pchan_bbone_segments_cache_copy(bPoseChannel *pchan, bPoseChannel *pcha
}
}
-/** Calculate index and blend factor for the two B-Bone segment nodes affecting the point at 0 <= pos <= 1. */
+/** Calculate index and blend factor for the two B-Bone segment nodes
+ * affecting the point at 0 <= pos <= 1. */
void BKE_pchan_bbone_deform_segment_index(const bPoseChannel *pchan,
float pos,
int *r_index,
@@ -1588,13 +1593,14 @@ void BKE_bone_offset_matrix_get(const Bone *bone, float offs_bone[4][4])
offs_bone[3][1] += bone->parent->length;
}
-/* Construct the matrices (rot/scale and loc) to apply the PoseChannels into the armature (object) space.
+/* Construct the matrices (rot/scale and loc)
+ * to apply the PoseChannels into the armature (object) space.
* I.e. (roughly) the "pose_mat(b-1) * yoffs(b-1) * d_root(b) * bone_mat(b)" in the
* pose_mat(b)= pose_mat(b-1) * yoffs(b-1) * d_root(b) * bone_mat(b) * chan_mat(b)
* ...function.
*
- * This allows to get the transformations of a bone in its object space, *before* constraints (and IK)
- * get applied (used by pose evaluation code).
+ * This allows to get the transformations of a bone in its object space,
+ * *before* constraints (and IK) get applied (used by pose evaluation code).
* And reverse: to find pchan transformations needed to place a bone at a given loc/rot/scale
* in object space (used by interactive transform, and snapping code).
*
@@ -1695,7 +1701,8 @@ void BKE_bone_parent_transform_calc_from_matrices(int bone_flag,
else if (bone_flag & (BONE_HINGE | BONE_NO_SCALE)) {
mul_m4_m4m4(r_bpt->loc_mat, parent_pose_mat, offs_bone);
}
- /* Else (i.e. default, usual case), just use the same matrix for rotation/scaling, and location. */
+ /* Else (i.e. default, usual case),
+ * just use the same matrix for rotation/scaling, and location. */
else {
copy_m4_m4(r_bpt->loc_mat, r_bpt->rotscale_mat);
}
@@ -1902,7 +1909,8 @@ void BKE_rotMode_change_values(
quat_to_axis_angle(axis, angle, quat);
}
- /* when converting to axis-angle, we need a special exception for the case when there is no axis */
+ /* When converting to axis-angle,
+ * we need a special exception for the case when there is no axis. */
if (IS_EQF(axis[0], axis[1]) && IS_EQF(axis[1], axis[2])) {
/* for now, rotate around y-axis then (so that it simply becomes the roll) */
axis[1] = 1.0f;
@@ -1957,50 +1965,72 @@ void mat3_vec_to_roll(const float mat[3][3], const float vec[3], float *r_roll)
}
/* Calculates the rest matrix of a bone based on its vector and a roll around that vector. */
-/* Given v = (v.x, v.y, v.z) our (normalized) bone vector, we want the rotation matrix M
- * from the Y axis (so that M * (0, 1, 0) = v).
- * -> The rotation axis a lays on XZ plane, and it is orthonormal to v, hence to the projection of v onto XZ plane.
- * -> a = (v.z, 0, -v.x)
+/**
+ * Given `v = (v.x, v.y, v.z)` our (normalized) bone vector, we want the rotation matrix M
+ * from the Y axis (so that `M * (0, 1, 0) = v`).
+ * - The rotation axis a lays on XZ plane, and it is orthonormal to v,
+ * hence to the projection of v onto XZ plane.
+ * - `a = (v.z, 0, -v.x)`
+ *
* We know a is eigenvector of M (so M * a = a).
- * Finally, we have w, such that M * w = (0, 1, 0) (i.e. the vector that will be aligned with Y axis once transformed).
+ * Finally, we have w, such that M * w = (0, 1, 0)
+ * (i.e. the vector that will be aligned with Y axis once transformed).
* We know w is symmetric to v by the Y axis.
- * -> w = (-v.x, v.y, -v.z)
+ * - `w = (-v.x, v.y, -v.z)`
*
* Solving this, we get (x, y and z being the components of v):
+ * <pre>
* ┌ (x^2 * y + z^2) / (x^2 + z^2), x, x * z * (y - 1) / (x^2 + z^2) ┐
* M = │ x * (y^2 - 1) / (x^2 + z^2), y, z * (y^2 - 1) / (x^2 + z^2) │
* └ x * z * (y - 1) / (x^2 + z^2), z, (x^2 + z^2 * y) / (x^2 + z^2) ┘
+ * </pre>
+ *
+ * This is stable as long as v (the bone) is not too much aligned with +/-Y
+ * (i.e. x and z components are not too close to 0).
*
- * This is stable as long as v (the bone) is not too much aligned with +/-Y (i.e. x and z components
- * are not too close to 0).
+ * Since v is normalized, we have `x^2 + y^2 + z^2 = 1`,
+ * hence `x^2 + z^2 = 1 - y^2 = (1 - y)(1 + y)`.
*
- * Since v is normalized, we have x^2 + y^2 + z^2 = 1, hence x^2 + z^2 = 1 - y^2 = (1 - y)(1 + y).
* This allows to simplifies M like this:
+ * <pre>
* ┌ 1 - x^2 / (1 + y), x, -x * z / (1 + y) ┐
* M = │ -x, y, -z │
* └ -x * z / (1 + y), z, 1 - z^2 / (1 + y) ┘
+ * </pre>
*
- * Written this way, we see the case v = +Y is no more a singularity. The only one remaining is the bone being
- * aligned with -Y.
+ * Written this way, we see the case v = +Y is no more a singularity.
+ * The only one
+ * remaining is the bone being aligned with -Y.
*
- * Let's handle the asymptotic behavior when bone vector is reaching the limit of y = -1. Each of the four corner
- * elements can vary from -1 to 1, depending on the axis a chosen for doing the rotation. And the "rotation" here
- * is in fact established by mirroring XZ plane by that given axis, then inversing the Y-axis.
- * For sufficiently small x and z, and with y approaching -1, all elements but the four corner ones of M
- * will degenerate. So let's now focus on these corner elements.
+ * Let's handle
+ * the asymptotic behavior when bone vector is reaching the limit of y = -1.
+ * Each of the four corner elements can vary from -1 to 1,
+ * depending on the axis a chosen for doing the rotation.
+ * And the "rotation" here is in fact established by mirroring XZ plane by that given axis,
+ * then inversing the Y-axis.
+ * For sufficiently small x and z, and with y approaching -1,
+ * all elements but the four corner ones of M will degenerate.
+ * So let's now focus on these corner elements.
*
- * We rewrite M so that it only contains its four corner elements, and combine the 1 / (1 + y) factor:
+ * We rewrite M so that it only contains its four corner elements,
+ * and combine the `1 / (1 + y)` factor:
+ * <pre>
* ┌ 1 + y - x^2, -x * z ┐
* M* = 1 / (1 + y) * │ │
* └ -x * z, 1 + y - z^2 ┘
+ * </pre>
+ *
+ * When y is close to -1, computing 1 / (1 + y) will cause severe numerical instability,
+ * so we ignore it and normalize M instead.
+ * We know `y^2 = 1 - (x^2 + z^2)`, and `y < 0`, hence `y = -sqrt(1 - (x^2 + z^2))`.
*
- * When y is close to -1, computing 1 / (1 + y) will cause severe numerical instability, so we ignore it and
- * normalize M instead. We know y^2 = 1 - (x^2 + z^2), and y < 0, hence y = -sqrt(1 - (x^2 + z^2)).
* Since x and z are both close to 0, we apply the binomial expansion to the first order:
- * y = -sqrt(1 - (x^2 + z^2)) = -1 + (x^2 + z^2) / 2. Which gives:
+ * `y = -sqrt(1 - (x^2 + z^2)) = -1 + (x^2 + z^2) / 2`. Which gives:
+ * <pre>
* ┌ z^2 - x^2, -2 * x * z ┐
* M* = 1 / (x^2 + z^2) * │ │
* └ -2 * x * z, x^2 - z^2 ┘
+ * </pre>
*/
void vec_roll_to_mat3_normalized(const float nor[3], const float roll, float mat[3][3])
{
@@ -2200,13 +2230,14 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected
}
}
- /* constraints - proxy constraints are flushed... local ones are added after
- * 1. extract constraints not from proxy (CONSTRAINT_PROXY_LOCAL) from pchan's constraints
- * 2. copy proxy-pchan's constraints on-to new
- * 3. add extracted local constraints back on top
+ /* Constraints - proxy constraints are flushed... local ones are added after
+ * 1: extract constraints not from proxy (CONSTRAINT_PROXY_LOCAL) from pchan's constraints.
+ * 2: copy proxy-pchan's constraints on-to new.
+ * 3: add extracted local constraints back on top.
*
- * Note for BKE_constraints_copy: when copying constraints, disable 'do_extern' otherwise
- * we get the libs direct linked in this blend.
+ * Note for BKE_constraints_copy:
+ * When copying constraints, disable 'do_extern' otherwise
+ * we get the libs direct linked in this blend.
*/
BKE_constraints_proxylocal_extract(&proxylocal_constraints, &pchan->constraints);
BKE_constraints_copy(&pchanw.constraints, &pchanp->constraints, false);
@@ -2295,7 +2326,8 @@ static int rebuild_pose_bone(bPose *pose, Bone *bone, bPoseChannel *parchan, int
}
/**
- * Clear pointers of object's pose (needed in remap case, since we cannot always wait for a complete pose rebuild).
+ * Clear pointers of object's pose
+ * (needed in remap case, since we cannot always wait for a complete pose rebuild).
*/
void BKE_pose_clear_pointers(bPose *pose)
{
@@ -2381,7 +2413,8 @@ void BKE_pose_rebuild(Main *bmain, Object *ob, bArmature *arm, const bool do_id_
/* synchronize protected layers with proxy */
/* HACK! To preserve 2.7x behavior that you always can pose even locked bones,
* do not do any restoration if this is a COW temp copy! */
- /* Switched back to just NO_MAIN tag, for some reasons (c) using COW tag was working this morning, but not anymore... */
+ /* Switched back to just NO_MAIN tag, for some reasons (c)
+ * using COW tag was working this morning, but not anymore... */
if (ob->proxy != NULL && (ob->id.tag & LIB_TAG_NO_MAIN) == 0) {
BKE_object_copy_proxy_drivers(ob, ob->proxy);
pose_proxy_synchronize(ob, ob->proxy, arm->layer_protected);
@@ -2392,7 +2425,8 @@ void BKE_pose_rebuild(Main *bmain, Object *ob, bArmature *arm, const bool do_id_
pose->flag &= ~POSE_RECALC;
pose->flag |= POSE_WAS_REBUILT;
- /* Rebuilding poses forces us to also rebuild the dependency graph, since there is one node per pose/bone... */
+ /* Rebuilding poses forces us to also rebuild the dependency graph,
+ * since there is one node per pose/bone. */
if (bmain != NULL) {
DEG_relations_tag_update(bmain);
}
@@ -2412,7 +2446,8 @@ void BKE_pchan_to_mat4(bPoseChannel *pchan, float chan_mat[4][4])
/* rotations may either be quats, eulers (with various rotation orders), or axis-angle */
if (pchan->rotmode > 0) {
- /* euler rotations (will cause gimble lock, but this can be alleviated a bit with rotation orders) */
+ /* euler rotations (will cause gimble lock,
+ * but this can be alleviated a bit with rotation orders) */
eulO_to_mat3(rmat, pchan->eul, pchan->rotmode);
}
else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
@@ -2423,10 +2458,9 @@ void BKE_pchan_to_mat4(bPoseChannel *pchan, float chan_mat[4][4])
/* quats are normalized before use to eliminate scaling issues */
float quat[4];
- /* NOTE: we now don't normalize the stored values anymore, since this was kindof evil in some cases
- * but if this proves to be too problematic, switch back to the old system of operating directly on
- * the stored copy
- */
+ /* NOTE: we now don't normalize the stored values anymore,
+ * since this was kindof evil in some cases but if this proves to be too problematic,
+ * switch back to the old system of operating directly on the stored copy. */
normalize_qt_qt(quat, pchan->quat);
quat_to_mat3(rmat, quat);
}
@@ -2548,7 +2582,8 @@ void BKE_pose_where_is(struct Depsgraph *depsgraph, Scene *scene, Object *ob)
return;
}
if ((ob->pose == NULL) || (ob->pose->flag & POSE_RECALC)) {
- /* WARNING! passing NULL bmain here means we won't tag depsgraph's as dirty - hopefully this is OK. */
+ /* WARNING! passing NULL bmain here means we won't tag depsgraph's as dirty -
+ * hopefully this is OK. */
BKE_pose_rebuild(NULL, ob, arm, true);
}
@@ -2615,7 +2650,8 @@ static int minmax_armature(Object *ob, float r_min[3], float r_max[3])
{
bPoseChannel *pchan;
- /* For now, we assume BKE_pose_where_is has already been called (hence we have valid data in pachan). */
+ /* For now, we assume BKE_pose_where_is has already been called
+ * (hence we have valid data in pachan). */
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
minmax_v3v3_v3(r_min, r_max, pchan->pose_head);
minmax_v3v3_v3(r_min, r_max, pchan->pose_tail);
diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c
index 5af818b9a91..c71c2dc86cf 100644
--- a/source/blender/blenkernel/intern/armature_update.c
+++ b/source/blender/blenkernel/intern/armature_update.c
@@ -165,7 +165,8 @@ static void splineik_init_tree_from_pchan(Scene *UNUSED(scene),
CLAMP_MIN(ikData->points[segcount], 0.0f);
/* make a new Spline-IK chain, and store it in the IK chains */
- /* TODO: we should check if there is already an IK chain on this, since that would take precedence... */
+ /* TODO: we should check if there is already an IK chain on this,
+ * since that would take precedence... */
{
/* make new tree */
tSplineIK_Tree *tree = MEM_callocN(sizeof(tSplineIK_Tree), "SplineIK Tree");
@@ -199,7 +200,8 @@ static void splineik_init_tree(Scene *scene, Object *ob, float UNUSED(ctime))
{
bPoseChannel *pchan;
- /* find the tips of Spline IK chains, which are simply the bones which have been tagged as such */
+ /* find the tips of Spline IK chains,
+ * which are simply the bones which have been tagged as such */
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
if (pchan->constflag & PCHAN_HAS_SPLINEIK) {
splineik_init_tree_from_pchan(scene, ob, pchan);
@@ -330,9 +332,9 @@ static void splineik_evaluate_bone(
}
}
- /* step 2: determine the implied transform from these endpoints
- * - splineVec: the vector direction that the spline applies on the bone
- * - scaleFac: the factor that the bone length is scaled by to get the desired amount
+ /* Step 2: determine the implied transform from these endpoints.
+ * - splineVec: the vector direction that the spline applies on the bone.
+ * - scaleFac: the factor that the bone length is scaled by to get the desired amount.
*/
sub_v3_v3v3(splineVec, poseTail, poseHead);
scaleFac = len_v3(splineVec) / pchan->bone->length;
@@ -340,8 +342,10 @@ static void splineik_evaluate_bone(
/* Adjust the scale factor towards the neutral state when rolling off the curve end. */
scaleFac = interpf(scaleFac, baseScale, tailBlendFac);
- /* step 3: compute the shortest rotation needed to map from the bone rotation to the current axis
- * - this uses the same method as is used for the Damped Track Constraint (see the code there for details)
+ /* Step 3: compute the shortest rotation needed
+ * to map from the bone rotation to the current axis.
+ * - this uses the same method as is used for the Damped Track Constraint
+ * (see the code there for details).
*/
{
float dmat[3][3], rmat[3][3];
@@ -353,7 +357,8 @@ static void splineik_evaluate_bone(
mul_m3_m4m4(basePoseMat, state->locrot_offset, pchan->pose_mat);
normalize_m3_m3(rmat, basePoseMat);
- /* also, normalize the orientation imposed by the bone, now that we've extracted the scale factor */
+ /* Also, normalize the orientation imposed by the bone,
+ * now that we've extracted the scale factor. */
normalize_v3(splineVec);
/* calculate smallest axis-angle rotation necessary for getting from the
@@ -375,12 +380,12 @@ static void splineik_evaluate_bone(
*/
axis_angle_to_mat3(dmat, raxis, rangle);
- /* combine these rotations so that the y-axis of the bone is now aligned as the spline dictates,
- * while still maintaining roll control from the existing bone animation
- */
+ /* Combine these rotations so that the y-axis of the bone is now aligned as the
+ * spline dictates, while still maintaining roll control from the existing bone animation. */
mul_m3_m3m3(poseMat, dmat, rmat);
- normalize_m3(
- poseMat); /* attempt to reduce shearing, though I doubt this'll really help too much now... */
+
+ /* attempt to reduce shearing, though I doubt this'll really help too much now... */
+ normalize_m3(poseMat);
mul_m3_m3m3(basePoseMat, dmat, basePoseMat);
@@ -539,7 +544,8 @@ static void splineik_execute_tree(
while ((tree = pchan_root->siktree.first) != NULL) {
int i;
- /* Firstly, calculate the bone matrix the standard way, since this is needed for roll control. */
+ /* Firstly, calculate the bone matrix the standard way,
+ * since this is needed for roll control. */
for (i = tree->chainlen - 1; i >= 0; i--) {
BKE_pose_where_is_bone(depsgraph, scene, ob, tree->chain[i], ctime, 1);
}
@@ -549,8 +555,8 @@ static void splineik_execute_tree(
if (splineik_evaluate_init(tree, &state)) {
/* Walk over each bone in the chain, calculating the effects of spline IK
- * - the chain is traversed in the opposite order to storage order (i.e. parent to children)
- * so that dependencies are correct
+ * - the chain is traversed in the opposite order to storage order (i.e. parent to children)
+ * so that dependencies are correct
*/
for (i = tree->chainlen - 1; i >= 0; i--) {
bPoseChannel *pchan = tree->chain[i];
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 789d7a6a05d..d6599498a65 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -75,7 +75,9 @@ void BKE_blender_free(void)
{
/* samples are in a global list..., also sets G_MAIN->sound->sample NULL */
- BKE_studiolight_free(); /* needs to run before main free as wm is still referenced for icons preview jobs */
+ /* Needs to run before main free as wm is still referenced for icons preview jobs. */
+ BKE_studiolight_free();
+
BKE_main_free(G_MAIN);
G_MAIN = NULL;
diff --git a/source/blender/blenkernel/intern/blender_copybuffer.c b/source/blender/blenkernel/intern/blender_copybuffer.c
index c801c1780c8..32c6f74dc2d 100644
--- a/source/blender/blenkernel/intern/blender_copybuffer.c
+++ b/source/blender/blenkernel/intern/blender_copybuffer.c
@@ -110,7 +110,8 @@ bool BKE_copybuffer_read(Main *bmain_dst,
}
/**
- * \return Number of IDs directly pasted from the buffer (does not includes indirectly pulled out ones).
+ * \return Number of IDs directly pasted from the buffer
+ * (does not includes indirectly pulled out ones).
*/
int BKE_copybuffer_paste(bContext *C,
const char *libname,
diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c
index 383d8e6bf61..d1a3045a829 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -152,7 +152,8 @@ static void setup_app_data(bContext *C,
/* no load screens? */
if (mode != LOAD_UI) {
/* Logic for 'track_undo_scene' is to keep using the scene which the active screen has,
- * as long as the scene associated with the undo operation is visible in one of the open windows.
+ * as long as the scene associated with the undo operation is visible
+ * in one of the open windows.
*
* - 'curscreen->scene' - scene the user is currently looking at.
* - 'bfd->curscene' - scene undo-step was created in.
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index dcca6e2bf84..e28f1fc566f 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -148,7 +148,8 @@ void BKE_brush_init(Brush *brush)
}
/**
- * \note Resulting brush will have two users: one as a fake user, another is assumed to be used by the caller.
+ * \note Resulting brush will have two users: one as a fake user,
+ * another is assumed to be used by the caller.
*/
Brush *BKE_brush_add(Main *bmain, const char *name, const eObjectMode ob_mode)
{
@@ -584,8 +585,10 @@ struct Brush *BKE_brush_first_search(struct Main *bmain, const eObjectMode ob_mo
}
/**
- * Only copy internal data of Brush ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of Brush ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c
index ab7baf6ce7a..8600d60c5c6 100644
--- a/source/blender/blenkernel/intern/bvhutils.c
+++ b/source/blender/blenkernel/intern/bvhutils.c
@@ -568,7 +568,8 @@ BVHTree *bvhtree_from_editmesh_verts(BVHTreeFromEditMesh *data,
* Builds a bvh tree where nodes are the given vertices (note: does not copy given mverts!).
* \param vert_allocated: if true, vert freeing will be done when freeing data.
* \param verts_mask: if not null, true elements give which vert to add to BVH tree.
- * \param verts_num_active: if >= 0, number of active verts to add to BVH tree (else will be computed from mask).
+ * \param verts_num_active: if >= 0, number of active verts to add to BVH tree
+ * (else will be computed from mask).
*/
BVHTree *bvhtree_from_mesh_verts_ex(BVHTreeFromMesh *data,
const MVert *vert,
@@ -758,7 +759,8 @@ BVHTree *bvhtree_from_editmesh_edges(BVHTreeFromEditMesh *data,
* \param vert, vert_allocated: if true, elem freeing will be done when freeing data.
* \param edge, edge_allocated: if true, elem freeing will be done when freeing data.
* \param edges_mask: if not null, true elements give which vert to add to BVH tree.
- * \param edges_num_active: if >= 0, number of active edges to add to BVH tree (else will be computed from mask).
+ * \param edges_num_active: if >= 0, number of active edges to add to BVH tree
+ * (else will be computed from mask).
*/
BVHTree *bvhtree_from_mesh_edges_ex(BVHTreeFromMesh *data,
const MVert *vert,
@@ -860,11 +862,13 @@ static void bvhtree_from_mesh_faces_setup_data(BVHTreeFromMesh *data,
}
/**
- * Builds a bvh tree where nodes are the given tessellated faces (note: does not copy given mfaces!).
+ * Builds a bvh tree where nodes are the given tessellated faces
+ * (note: does not copy given mfaces!).
* \param vert_allocated: if true, vert freeing will be done when freeing data.
* \param face_allocated: if true, face freeing will be done when freeing data.
* \param faces_mask: if not null, true elements give which faces to add to BVH tree.
- * \param faces_num_active: if >= 0, number of active faces to add to BVH tree (else will be computed from mask).
+ * \param faces_num_active: if >= 0, number of active faces to add to BVH tree
+ * (else will be computed from mask).
*/
BVHTree *bvhtree_from_mesh_faces_ex(BVHTreeFromMesh *data,
const MVert *vert,
diff --git a/source/blender/blenkernel/intern/cachefile.c b/source/blender/blenkernel/intern/cachefile.c
index 4fe8cabde65..e4fc4706e66 100644
--- a/source/blender/blenkernel/intern/cachefile.c
+++ b/source/blender/blenkernel/intern/cachefile.c
@@ -103,8 +103,10 @@ void BKE_cachefile_free(CacheFile *cache_file)
}
/**
- * Only copy internal data of CacheFile ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of CacheFile ID from source to already
+ * allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index 59811cfe373..25399d342e1 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -88,8 +88,10 @@ void *BKE_camera_add(Main *bmain, const char *name)
}
/**
- * Only copy internal data of Camera ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of Camera ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index ea3834be68a..667219e0eec 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -385,7 +385,8 @@ static void cdDM_foreachMappedLoop(DerivedMesh *dm,
void *userData,
DMForeachFlag flag)
{
- /* We can't use dm->getLoopDataLayout(dm) here, we want to always access dm->loopData, EditDerivedBMesh would
+ /* We can't use dm->getLoopDataLayout(dm) here,
+ * we want to always access dm->loopData, EditDerivedBMesh would
* return loop data from bmesh itself. */
const float(*lnors)[3] = (flag & DM_FOREACH_USE_NORMAL) ? DM_get_loop_data_layer(dm, CD_NORMAL) :
NULL;
@@ -633,7 +634,8 @@ DerivedMesh *CDDM_from_mesh_ex(Mesh *mesh,
if (mesh->runtime.cd_dirty_vert & CD_MASK_NORMAL) {
dm->dirty |= DM_DIRTY_NORMALS;
}
- /* TODO DM_DIRTY_TESS_CDLAYERS ? Maybe not though, since we probably want to switch to looptris ? */
+ /* TODO DM_DIRTY_TESS_CDLAYERS ? Maybe not though,
+ * since we probably want to switch to looptris? */
CustomData_merge(&mesh->vdata, &dm->vertData, cddata_masks.vmask, alloctype, mesh->totvert);
CustomData_merge(&mesh->edata, &dm->edgeData, cddata_masks.emask, alloctype, mesh->totedge);
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 6db5745dd42..fcc0e1856af 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -432,9 +432,9 @@ void clothModifier_do(ClothModifierData *clmd,
else if (cache_result == PTCACHE_READ_OLD) {
BKE_cloth_solver_set_positions(clmd);
}
- else if (/*ob->id.lib ||*/ (
- cache->flag &
- PTCACHE_BAKED)) { /* 2.4x disabled lib, but this can be used in some cases, testing further - campbell */
+ else if (
+ /* 2.4x disabled lib, but this can be used in some cases, testing further - campbell */
+ /*ob->id.lib ||*/ (cache->flag & PTCACHE_BAKED)) {
/* if baked and nothing in cache, do nothing */
BKE_ptcache_invalidate(cache);
return;
@@ -722,7 +722,8 @@ static void cloth_apply_vgroup(ClothModifierData *clmd, Mesh *mesh)
}
if (clmd->sim_parms->vgroup_shrink > 0) {
if (dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_shrink - 1)) {
- /* Used for linear interpolation between min and max shrink factor based on weight. */
+ /* Used for linear interpolation between min and max
+ * shrink factor based on weight. */
verts->shrink_factor = dvert->dw[j].weight;
}
}
@@ -1148,7 +1149,8 @@ static void cloth_update_springs(ClothModifierData *clmd)
spring->lin_stiffness = (v1->bend_stiff + v2->bend_stiff) / 2.0f;
}
else if (spring->type == CLOTH_SPRING_TYPE_GOAL) {
- /* Warning: Appending NEW goal springs does not work because implicit solver would need reset! */
+ /* Warning: Appending NEW goal springs does not work
+ * because implicit solver would need reset! */
/* Activate / Deactivate existing springs */
if ((!(cloth->verts[spring->ij].flags & CLOTH_VERT_FLAG_PINNED)) &&
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index 16b330d9e7f..d33d4e344b5 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -188,8 +188,10 @@ bool BKE_collection_delete(Main *bmain, Collection *collection, bool hierarchy)
/***************************** Collection Copy *******************************/
/**
- * Only copy internal data of Collection ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of Collection ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -248,7 +250,8 @@ static Collection *collection_duplicate_recursive(Main *bmain,
collection_new = (Collection *)collection_old->id.newid;
}
- /* Optionally add to parent (we always want to do that, even if collection_old had already been duplicated). */
+ /* Optionally add to parent (we always want to do that,
+ * even if collection_old had already been duplicated). */
if (parent != NULL) {
if (collection_child_add(parent, collection_new, 0, true)) {
/* Put collection right after existing one. */
@@ -263,14 +266,15 @@ static Collection *collection_duplicate_recursive(Main *bmain,
}
/* If we are not doing any kind of deep-copy, we can return immediately.
- * False do_full_process means collection_old had already been duplicated, no need to redo some deep-copy on it. */
+ * False do_full_process means collection_old had already been duplicated,
+ * no need to redo some deep-copy on it. */
if (!do_hierarchy || !do_full_process) {
return collection_new;
}
if (do_objects) {
- /* We can loop on collection_old's objects, that list is currently identical the collection_new' objects,
- * and won't be changed here. */
+ /* We can loop on collection_old's objects, that list is currently identical the collection_new
+ * objects, and won't be changed here. */
for (CollectionObject *cob = collection_old->gobject.first; cob; cob = cob->next) {
Object *ob_old = cob->ob;
Object *ob_new = (Object *)ob_old->id.newid;
@@ -285,8 +289,8 @@ static Collection *collection_duplicate_recursive(Main *bmain,
}
}
- /* We can loop on collection_old's children, that list is currently identical the collection_new' children,
- * and won't be changed here. */
+ /* We can loop on collection_old's children,
+ * that list is currently identical the collection_new' children, and won't be changed here. */
for (CollectionChild *child = collection_old->children.first; child; child = child->next) {
Collection *child_collection_old = child->collection;
@@ -314,13 +318,15 @@ Collection *BKE_collection_copy(Main *bmain, Collection *parent, Collection *col
*
* If \a do_hierarchy and \a do_deep_copy are false, this is a regular (shallow) ID copy.
*
- * \warning If any 'deep copy' behavior is enabled, this functions will clear all \a bmain id.idnew pointers.
+ * \warning If any 'deep copy' behavior is enabled,
+ * this functions will clear all \a bmain id.idnew pointers.
*
* \param do_hierarchy If true, it will recursively make shallow copies of children collections.
* \param do_objects If true, it will also make duplicates of objects.
* This one does nothing if \a do_hierarchy is not set.
- * \param do_obdata If true, it will also make deep duplicates of objects, using behavior defined in user settings
- * (U.dupflag). This one does nothing if \a do_hierarchy and \a do_objects are not set.
+ * \param do_obdata If true, it will also make deep duplicates of objects,
+ * using behavior defined in user settings (U.dupflag).
+ * This one does nothing if \a do_hierarchy and \a do_objects are not set.
*/
Collection *BKE_collection_duplicate(Main *bmain,
Collection *parent,
@@ -835,7 +841,8 @@ static void collection_missing_parents_remove(Collection *collection)
*
* \note caller must ensure #BKE_main_collection_sync_remap() is called afterwards!
*
- * \param collection: may be \a NULL, in which case whole \a bmain database of collections is checked.
+ * \param collection: may be \a NULL,
+ * in which case whole \a bmain database of collections is checked.
*/
void BKE_collections_child_remove_nulls(Main *bmain, Collection *collection)
{
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index a8ca6d40b51..ff6258ac339 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -539,7 +539,8 @@ static int cloth_collision_response_static(ClothModifierData *clmd,
sub_v3_v3v3(relativeVelocity, v2, v1);
- /* Calculate the normal component of the relative velocity (actually only the magnitude - the direction is stored in 'normal'). */
+ /* Calculate the normal component of the relative velocity
+ * (actually only the magnitude - the direction is stored in 'normal'). */
magrelVel = dot_v3v3(relativeVelocity, collpair->normal);
/* If magrelVel < 0 the edges are approaching each other. */
@@ -557,7 +558,8 @@ static int cloth_collision_response_static(ClothModifierData *clmd,
sub_v3_v3v3(vrel_t_pre, relativeVelocity, temp);
/* Decrease in magnitude of relative tangential velocity due to coulomb friction
- * in original formula "magrelVel" should be the "change of relative velocity in normal direction". */
+ * in original formula "magrelVel" should be the
+ * "change of relative velocity in normal direction". */
magtangent = min_ff(collob->pd->pdef_cfrict * 0.01f * magrelVel, len_v3(vrel_t_pre));
/* Apply friction impulse. */
@@ -720,7 +722,8 @@ static int cloth_selfcollision_response_static(ClothModifierData *clmd,
sub_v3_v3v3(relativeVelocity, v2, v1);
- /* Calculate the normal component of the relative velocity (actually only the magnitude - the direction is stored in 'normal'). */
+ /* Calculate the normal component of the relative velocity
+ * (actually only the magnitude - the direction is stored in 'normal'). */
magrelVel = dot_v3v3(relativeVelocity, collpair->normal);
/* TODO: Impulses should be weighed by mass as this is self col,
@@ -740,7 +743,8 @@ static int cloth_selfcollision_response_static(ClothModifierData *clmd,
sub_v3_v3v3(vrel_t_pre, relativeVelocity, temp);
/* Decrease in magnitude of relative tangential velocity due to coulomb friction
- * in original formula "magrelVel" should be the "change of relative velocity in normal direction". */
+ * in original formula "magrelVel" should be the
+ * "change of relative velocity in normal direction". */
magtangent = min_ff(clmd->coll_parms->self_friction * 0.01f * magrelVel, len_v3(vrel_t_pre));
/* Apply friction impulse. */
@@ -1548,7 +1552,8 @@ static CollPair *cloth_point_collpair(float p1[3],
return collpair;
}
-//Determines collisions on overlap, collisions are written to collpair[i] and collision+number_collision_found is returned
+/* Determines collisions on overlap,
+ * collisions are written to collpair[i] and collision+number_collision_found is returned. */
static CollPair *cloth_point_collision(ModifierData *md1,
ModifierData *md2,
BVHTreeOverlap *overlap,
@@ -1696,8 +1701,11 @@ void cloth_find_point_contacts(Depsgraph *depsgraph,
clmd, collmd, &ct->collisions, &collisions_index, result, overlap, epsilon, dt);
ct->totcollisions = (int)(collisions_index - ct->collisions);
- // resolve nearby collisions
- // ret += cloth_points_objcollisions_resolve(clmd, collmd, collob->pd, collisions[i], collisions_index[i], dt);
+ /* Resolve nearby collisions. */
+#if 0
+ ret += cloth_points_objcollisions_resolve(
+ clmd, collmd, collob->pd, collisions[i], collisions_index[i], dt);
+#endif
}
if (overlap) {
diff --git a/source/blender/blenkernel/intern/colorband.c b/source/blender/blenkernel/intern/colorband.c
index 3d13c16d595..8701f06d9dd 100644
--- a/source/blender/blenkernel/intern/colorband.c
+++ b/source/blender/blenkernel/intern/colorband.c
@@ -420,8 +420,9 @@ bool BKE_colorband_evaluate(const ColorBand *coba, float in, float out[4])
cbd1 = coba->data;
- /* Note: when ipotype >= COLBAND_INTERP_B_SPLINE, we cannot do early-out with a constant color before
- * first color stop and after last one, because interpolation starts before and ends after those... */
+ /* Note: when ipotype >= COLBAND_INTERP_B_SPLINE,
+ * we cannot do early-out with a constant color before first color stop and after last one,
+ * because interpolation starts before and ends after those... */
ipotype = (coba->color_mode == COLBAND_BLEND_RGB) ? coba->ipotype : COLBAND_INTERP_LINEAR;
if (coba->tot == 1) {
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index d6b68121c94..a475a16dd57 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -120,7 +120,8 @@ void BKE_constraint_unique_name(bConstraint *con, ListBase *list)
/* ----------------- Evaluation Loop Preparation --------------- */
/* package an object/bone for use in constraint evaluation */
-/* This function MEM_calloc's a bConstraintOb struct, that will need to be freed after evaluation */
+/* This function MEM_calloc's a bConstraintOb struct,
+ * that will need to be freed after evaluation */
bConstraintOb *BKE_constraints_make_evalob(
Depsgraph *depsgraph, Scene *scene, Object *ob, void *subdata, short datatype)
{
@@ -210,10 +211,10 @@ void BKE_constraints_clear_evalob(bConstraintOb *cob)
/* calculate delta of constraints evaluation */
invert_m4_m4(imat, cob->startmat);
- /* XXX This would seem to be in wrong order. However, it does not work in 'right' order - would be nice to
- * understand why premul is needed here instead of usual postmul?
- * In any case, we **do not get a delta** here (e.g. startmat & matrix having same location, still gives
- * a 'delta' with non-null translation component :/ ).*/
+ /* XXX This would seem to be in wrong order. However, it does not work in 'right' order -
+ * would be nice to understand why premul is needed here instead of usual postmul?
+ * In any case, we **do not get a delta** here (e.g. startmat & matrix having same location,
+ * still gives a 'delta' with non-null translation component :/ ).*/
mul_m4_m4m4(delta, cob->matrix, imat);
/* copy matrices back to source */
@@ -352,8 +353,9 @@ void BKE_constraint_mat_convertspace(
*/
/* XXX This is actually an ugly hack, local space of a parent-less object *is* the same as
* global space!
- * Think what we want actually here is some kind of 'Final Space', i.e. once transformations
- * are applied - users are often confused about this too, this is not consistent with bones
+ * Think what we want actually here is some kind of 'Final Space', i.e
+ * . once transformations are applied - users are often confused about this too,
+ * this is not consistent with bones
* local space either... Meh :|
* --mont29
*/
@@ -1139,7 +1141,8 @@ static void trackto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
float size[3], vec[3];
float totmat[3][3];
- /* Get size property, since ob->scale is only the object's own relative size, not its global one */
+ /* Get size property, since ob->scale is only the object's own relative size,
+ * not its global one. */
mat4_to_size(size, cob->matrix);
/* Clear the object's rotation */
@@ -1357,12 +1360,11 @@ static void followpath_get_tarmat(struct Depsgraph *UNUSED(depsgraph),
Nurb *nu = cu->nurb.first;
curvetime = cu->ctime - data->offset;
- /* ctime is now a proper var setting of Curve which gets set by Animato like any other var that's animated,
- * but this will only work if it actually is animated...
+ /* ctime is now a proper var setting of Curve which gets set by Animato like any other var
+ * that's animated, but this will only work if it actually is animated...
*
- * we divide the curvetime calculated in the previous step by the length of the path, to get a time
- * factor, which then gets clamped to lie within 0.0 - 1.0 range
- */
+ * we divide the curvetime calculated in the previous step by the length of the path,
+ * to get a time factor, which then gets clamped to lie within 0.0 - 1.0 range. */
curvetime /= cu->pathlen;
if (nu && nu->flagu & CU_NURB_CYCLIC) {
@@ -1806,9 +1808,10 @@ static void rotlike_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
copy_v3_v3(loc, cob->matrix[3]);
mat4_to_size(size, cob->matrix);
- /* to allow compatible rotations, must get both rotations in the order of the owner... */
+ /* To allow compatible rotations, must get both rotations in the order of the owner... */
mat4_to_eulO(obeul, cob->rotOrder, cob->matrix);
- /* we must get compatible eulers from the beginning because some of them can be modified below (see bug #21875) */
+ /* We must get compatible eulers from the beginning because
+ * some of them can be modified below (see bug T21875). */
mat4_to_compatible_eulO(eul, obeul, cob->rotOrder, ct->matrix);
if ((data->flag & ROTLIKE_X) == 0) {
@@ -1850,7 +1853,8 @@ static void rotlike_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
}
}
- /* good to make eulers compatible again, since we don't know how much they were changed above */
+ /* Good to make eulers compatible again,
+ * since we don't know how much they were changed above. */
compatible_eul(eul, obeul);
loc_eulO_size_to_mat4(cob->matrix, loc, eul, size, cob->rotOrder);
}
@@ -2575,9 +2579,9 @@ static void actcon_get_tarmat(struct Depsgraph *UNUSED(depsgraph),
bPose pose = {{0}};
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
- */
+ /* 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. */
pchan = cob->pchan;
tchan = BKE_pose_channel_verify(&pose, pchan->name);
@@ -3559,7 +3563,8 @@ static void clampto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
offset = curveMin[clamp_axis] -
ceilf((curveMin[clamp_axis] - ownLoc[clamp_axis]) / len) * len;
- /* now, we calculate as per normal, except using offset instead of curveMin[clamp_axis] */
+ /* Now, we calculate as per normal,
+ * except using offset instead of curveMin[clamp_axis]. */
curvetime = (ownLoc[clamp_axis] - offset) / (len);
}
else if (ownLoc[clamp_axis] > curveMax[clamp_axis]) {
@@ -3567,7 +3572,8 @@ static void clampto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
offset = curveMax[clamp_axis] +
(int)((ownLoc[clamp_axis] - curveMax[clamp_axis]) / len) * len;
- /* now, we calculate as per normal, except using offset instead of curveMax[clamp_axis] */
+ /* Now, we calculate as per normal,
+ * except using offset instead of curveMax[clamp_axis]. */
curvetime = (ownLoc[clamp_axis] - offset) / (len);
}
else {
@@ -3689,11 +3695,10 @@ static void transform_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
mat4_to_size(dvec, ct->matrix);
if (is_negative_m4(ct->matrix)) {
- /* Bugfix [#27886]
- * We can't be sure which axis/axes are negative, though we know that something is negative.
- * Assume we don't care about negativity of separate axes. <--- This is a limitation that
- * riggers will have to live with for now.
- */
+ /* Bugfix T27886: (this is a limitation that riggers will have to live with for now).
+ * We can't be sure which axis/axes are negative,
+ * though we know that something is negative.
+ * Assume we don't care about negativity of separate axes. */
negate_v3(dvec);
}
from_min = data->from_min_scale;
@@ -3932,9 +3937,10 @@ static void shrinkwrap_get_tarmat(struct Depsgraph *UNUSED(depsgraph),
break;
}
- /* transform normal into requested space */
- /* Note that in this specific case, we need to keep scaling in non-parented 'local2world' object
- * case, because SpaceTransform also takes it into account when handling normals. See T42447. */
+ /* Transform normal into requested space */
+ /* Note that in this specific case, we need to keep scaling in non-parented 'local2world'
+ * object case, because SpaceTransform also takes it into account when handling normals.
+ * See T42447. */
unit_m4(mat);
BKE_constraint_mat_convertspace(
cob->ob, cob->pchan, mat, CONSTRAINT_SPACE_LOCAL, scon->projAxisSpace, true);
@@ -5225,7 +5231,8 @@ static void con_extern_cb(bConstraint *UNUSED(con),
}
}
-/* helper for BKE_constraints_copy(), to be used for making sure that usercounts of copied ID's are fixed up */
+/* helper for BKE_constraints_copy(),
+ * to be used for making sure that usercounts of copied ID's are fixed up */
static void con_fix_copied_refs_cb(bConstraint *UNUSED(con),
ID **idpoin,
bool is_reference,
@@ -5460,7 +5467,8 @@ static bConstraint *constraint_find_original_for_update(bConstraintOb *cob, bCon
/* -------- Constraints and Proxies ------- */
-/* Rescue all constraints tagged as being CONSTRAINT_PROXY_LOCAL (i.e. added to bone that's proxy-synced in this file) */
+/* Rescue all constraints tagged as being CONSTRAINT_PROXY_LOCAL
+ * (i.e. added to bone that's proxy-synced in this file) */
void BKE_constraints_proxylocal_extract(ListBase *dst, ListBase *src)
{
bConstraint *con, *next;
@@ -5502,8 +5510,8 @@ bool BKE_constraints_proxylocked_owner(Object *ob, bPoseChannel *pchan)
/* -------- Target-Matrix Stuff ------- */
/* This function is a relic from the prior implementations of the constraints system, when all
- * constraints either had one or no targets. It used to be called during the main constraint solving
- * loop, but is now only used for the remaining cases for a few constraints.
+ * constraints either had one or no targets. It used to be called during the main constraint
+ * solving loop, but is now only used for the remaining cases for a few constraints.
*
* None of the actual calculations of the matrices should be done here! Also, this function is
* not to be used by any new constraints, particularly any that have multiple targets.
@@ -5694,9 +5702,9 @@ void BKE_constraints_solve(struct Depsgraph *depsgraph,
}
/* 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
+ * (T26014 and T25725), 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/curve.c b/source/blender/blenkernel/intern/curve.c
index 293d2c34b07..4f695606217 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -196,8 +196,10 @@ Curve *BKE_curve_add(Main *bmain, const char *name, int type)
}
/**
- * Only copy internal data of Curve ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of Curve ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -337,7 +339,8 @@ void BKE_curve_boundbox_calc(Curve *cu, float r_loc[3], float r_size[3])
BoundBox *BKE_curve_boundbox_get(Object *ob)
{
- /* This is Object-level data access, DO NOT touch to Mesh's bb, would be totally thread-unsafe. */
+ /* This is Object-level data access,
+ * DO NOT touch to Mesh's bb, would be totally thread-unsafe. */
if (ob->runtime.bb == NULL || ob->runtime.bb->flag & BOUNDBOX_DIRTY) {
Curve *cu = ob->data;
float min[3], max[3];
@@ -2962,8 +2965,11 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
bev = &ob->runtime.curve_cache->bev;
+#if 0
/* do we need to calculate the radius for each point? */
- /* do_radius = (cu->bevobj || cu->taperobj || (cu->flag & CU_FRONT) || (cu->flag & CU_BACK)) ? 0 : 1; */
+ do_radius = (cu->bevobj || cu->taperobj || (cu->flag & CU_FRONT) || (cu->flag & CU_BACK)) ? 0 :
+ 1;
+#endif
/* STEP 1: MAKE POLYS */
@@ -2974,7 +2980,6 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
}
for (; nu; nu = nu->next) {
-
if (nu->hide && is_editmode) {
continue;
}
@@ -3896,7 +3901,8 @@ static bool tridiagonal_solve_with_limits(
all = true;
} while (overshoot && !locked);
- /* if no handles overshot and were locked, see if it may be a good idea to unlock some handles */
+ /* If no handles overshot and were locked,
+ * see if it may be a good idea to unlock some handles. */
if (!locked) {
for (int i = 0; i < solve_count; i++) {
// to definitely avoid infinite loops limit this to 2 times
@@ -3949,29 +3955,29 @@ static bool tridiagonal_solve_with_limits(
* |-------t1---------t2--------- ~ --------tN-------------------> time (co 0)
* Mathematical basis:
*
- * 1. Handle lengths on either side of each point are connected by a factor
- * ensuring continuity of the first derivative:
+ * 1. Handle lengths on either side of each point are connected by a factor
+ * ensuring continuity of the first derivative:
*
- * l[i] = t[i+1]/t[i]
+ * l[i] = t[i+1]/t[i]
*
- * 2. The tridiagonal system is formed by the following equation, which is derived
- * by differentiating the bezier curve and specifies second derivative continuity
- * at every point:
+ * 2. The tridiagonal system is formed by the following equation, which is derived
+ * by differentiating the bezier curve and specifies second derivative continuity
+ * at every point:
*
- * l[i]^2 * h[i-1] + (2*l[i]+2) * h[i] + 1/l[i+1] * h[i+1] = (y[i]-y[i-1])*l[i]^2 + y[i+1]-y[i]
+ * l[i]^2 * h[i-1] + (2*l[i]+2) * h[i] + 1/l[i+1] * h[i+1] = (y[i]-y[i-1])*l[i]^2 + y[i+1]-y[i]
*
- * 3. If this point is adjacent to a manually set handle with X size not equal to 1/3
- * of the horizontal interval, this equation becomes slightly more complex:
+ * 3. If this point is adjacent to a manually set handle with X size not equal to 1/3
+ * of the horizontal interval, this equation becomes slightly more complex:
*
- * l[i]^2 * h[i-1] + (3*(1-R[i-1])*l[i] + 3*(1-L[i+1])) * h[i] + 1/l[i+1] * h[i+1] = (y[i]-y[i-1])*l[i]^2 + y[i+1]-y[i]
+ * l[i]^2 * h[i-1] + (3*(1-R[i-1])*l[i] + 3*(1-L[i+1])) * h[i] + 1/l[i+1] * h[i+1] = (y[i]-y[i-1])*l[i]^2 + y[i+1]-y[i]
*
- * The difference between equations amounts to this, and it's obvious that when R[i-1]
- * and L[i+1] are both 1/3, it becomes zero:
+ * The difference between equations amounts to this, and it's obvious that when R[i-1]
+ * and L[i+1] are both 1/3, it becomes zero:
*
- * ( (1-3*R[i-1])*l[i] + (1-3*L[i+1]) ) * h[i]
+ * ( (1-3*R[i-1])*l[i] + (1-3*L[i+1]) ) * h[i]
*
- * 4. The equations for zero acceleration border conditions are basically the above
- * equation with parts omitted, so the handle size correction also applies.
+ * 4. The equations for zero acceleration border conditions are basically the above
+ * equation with parts omitted, so the handle size correction also applies.
*/
static void bezier_eq_continuous(
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index c2ef575d086..11af695c690 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -159,7 +159,8 @@ typedef struct LayerTypeInfo {
/** a function to determine file size */
size_t (*filesize)(CDataFile *cdf, const void *data, int count);
- /** a function to determine max allowed number of layers, should be NULL or return -1 if no limit */
+ /** a function to determine max allowed number of layers,
+ * should be NULL or return -1 if no limit */
int (*layers_max)(void);
} LayerTypeInfo;
@@ -324,7 +325,8 @@ static void layerInterp_normal(const void **sources,
void *dest)
{
/* Note: This is linear interpolation, which is not optimal for vectors.
- * Unfortunately, spherical interpolation of more than two values is hairy, so for now it will do... */
+ * Unfortunately, spherical interpolation of more than two values is hairy,
+ * so for now it will do... */
float no[3] = {0.0f};
while (count--) {
@@ -923,7 +925,8 @@ static void layerCopyValue_mloopuv(const void *source,
const MLoopUV *luv1 = source;
MLoopUV *luv2 = dest;
- /* We only support a limited subset of advanced mixing here - namely the mixfactor interpolation. */
+ /* We only support a limited subset of advanced mixing here -
+ * namely the mixfactor interpolation. */
if (mixmode == CDT_MIX_NOMIX) {
copy_v2_v2(luv2->uv, luv1->uv);
@@ -1429,7 +1432,8 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
/* 14: CD_ORCO */
{sizeof(float) * 3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
/* 15: CD_MTEXPOLY */ /* DEPRECATED */
- /* note, when we expose the UV Map / TexFace split to the user, change this back to face Texture */
+ /* note, when we expose the UV Map / TexFace split to the user,
+ * change this back to face Texture. */
{sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
/* 16: CD_MLOOPUV */
{sizeof(MLoopUV),
@@ -2197,7 +2201,8 @@ void CustomData_set_layer_stencil(CustomData *data, int type, int n)
}
}
-/* for using with an index from CustomData_get_active_layer_index and CustomData_get_render_layer_index */
+/* For using with an index from CustomData_get_active_layer_index and
+ * CustomData_get_render_layer_index. */
void CustomData_set_layer_active_index(CustomData *data, int type, int n)
{
int i;
@@ -2877,8 +2882,8 @@ void CustomData_interp(const CustomData *source,
/**
* Swap data inside each item, for all layers.
- * This only applies to item types that may store several sub-item data (e.g. corner data [UVs, VCol, ...] of
- * tessellated faces).
+ * This only applies to item types that may store several sub-item data
+ * (e.g. corner data [UVs, VCol, ...] of tessellated faces).
*
* \param corner_indices: A mapping 'new_index -> old_index' of sub-item data.
*/
@@ -3502,7 +3507,9 @@ void CustomData_bmesh_copy_data(const CustomData *source,
}
}
-/*Bmesh Custom Data Functions. Should replace editmesh ones with these as well, due to more efficient memory alloc*/
+/* BMesh Custom Data Functions.
+ * Should replace edit-mesh 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;
@@ -3965,15 +3972,20 @@ void CustomData_file_write_info(int type, const char **r_struct_name, int *r_str
* Prepare given custom data for file writing.
*
* \param data: the customdata to tweak for .blend file writing (modified in place).
- * \param r_write_layers: contains a reduced set of layers to be written to file, use it with writestruct_at_address()
- * (caller must free it if != \a write_layers_buff).
+ * \param r_write_layers: contains a reduced set of layers to be written to file,
+ * use it with writestruct_at_address()
+ * (caller must free it if != \a write_layers_buff).
+ *
* \param write_layers_buff: an optional buffer for r_write_layers (to avoid allocating it).
* \param write_layers_size: the size of pre-allocated \a write_layer_buff.
*
- * \warning After this func has ran, given custom data is no more valid from Blender PoV (its totlayer is invalid).
- * This func shall always be called with localized data (as it is in write_meshes()).
- * \note data->typemap is not updated here, since it is always rebuilt on file read anyway. This means written
- * typemap does not match written layers (as returned by \a r_write_layers). Trivial to fix is ever needed.
+ * \warning After this func has ran, given custom data is no more valid from Blender PoV
+ * (its totlayer is invalid). This func shall always be called with localized data
+ * (as it is in write_meshes()).
+ *
+ * \note data->typemap is not updated here, since it is always rebuilt on file read anyway.
+ * This means written typemap does not match written layers (as returned by \a r_write_layers).
+ * Trivial to fix is ever needed.
*/
void CustomData_file_write_prepare(CustomData *data,
CustomDataLayer **r_write_layers,
@@ -4164,9 +4176,11 @@ bool CustomData_verify_versions(struct CustomData *data, int index)
if (!typeInfo->defaultname && (index > 0) && data->layers[index - 1].type == layer->type) {
keeplayer = false; /* multiple layers of which we only support one */
}
- /* This is a pre-emptive fix for cases that should not happen (layers that should not be written
- * in .blend files), but can happen due to bugs (see e.g. T62318).
- * Also for forward compatibility, in future, we may put into .blend file some currently un-written data types,
+ /* This is a pre-emptive fix for cases that should not happen
+ * (layers that should not be written in .blend files),
+ * but can happen due to bugs (see e.g. T62318).
+ * Also for forward compatibility, in future,
+ * we may put into `.blend` file some currently un-written data types,
* this should cover that case as well.
* Better to be safe here, and fix issue on the fly rather than crash... */
/* 0 structnum is used in writing code to tag layer types that should not be written. */
@@ -4189,7 +4203,8 @@ bool CustomData_verify_versions(struct CustomData *data, int index)
}
/**
- * Validate and fix data of \a layer, if possible (needs relevant callback in layer's type to be defined).
+ * Validate and fix data of \a layer,
+ * if possible (needs relevant callback in layer's type to be defined).
*
* \return True if some errors were found.
*/
@@ -4543,9 +4558,9 @@ static void customdata_data_transfer_interp_generic(const CustomDataTransferLaye
const float mix_factor)
{
/* Fake interpolation, we actually copy highest weighted source to dest.
- * Note we also handle bitflags here, in which case we rather choose to transfer value of elements totaling
+ * Note we also handle bitflags here,
+ * in which case we rather choose to transfer value of elements totaling
* more than 0.5 of weight. */
-
int best_src_idx = 0;
const int data_type = laymap->data_type;
@@ -4581,7 +4596,8 @@ static void customdata_data_transfer_interp_generic(const CustomDataTransferLaye
int i;
if (data_flag) {
- /* Boolean case, we can 'interpolate' in two groups, and choose value from highest weighted group. */
+ /* Boolean case, we can 'interpolate' in two groups,
+ * and choose value from highest weighted group. */
float tot_weight_true = 0.0f;
int item_true_idx = -1, item_false_idx = -1;
@@ -4626,7 +4642,8 @@ static void customdata_data_transfer_interp_generic(const CustomDataTransferLaye
}
if (data_flag) {
- /* Bool flags, only copy if dest data is set (resp. unset) - only 'advanced' modes we can support here! */
+ /* Bool flags, only copy if dest data is set (resp. unset) -
+ * only 'advanced' modes we can support here! */
if (mix_factor >= 0.5f && ((mix_mode == CDT_MIX_TRANSFER) ||
(mix_mode == CDT_MIX_REPLACE_ABOVE_THRESHOLD &&
check_bit_flag(data_dst, data_size, data_flag)) ||
diff --git a/source/blender/blenkernel/intern/data_transfer.c b/source/blender/blenkernel/intern/data_transfer.c
index 09b71db5ce9..5d9ba1bcdc7 100644
--- a/source/blender/blenkernel/intern/data_transfer.c
+++ b/source/blender/blenkernel/intern/data_transfer.c
@@ -90,7 +90,8 @@ void BKE_object_data_transfer_dttypes_to_cdmask(const int dtdata_types,
}
}
-/* Check what can do each layer type (if it is actually handled by transferdata, if it supports advanced mixing... */
+/* Check what can do each layer type
+ * (if it is actually handled by transferdata, if it supports advanced mixing... */
bool BKE_object_data_transfer_get_dttypes_capacity(const int dtdata_types,
bool *r_advanced_mixing,
bool *r_threshold)
@@ -458,7 +459,8 @@ static void data_transfer_interp_char(const CustomDataTransferLayerMap *laymap,
*data_dst = (char)(val_src * 255.0f);
}
-/* Helpers to match sources and destinations data layers (also handles 'conversions' in CD_FAKE cases). */
+/* Helpers to match sources and destinations data layers
+ * (also handles 'conversions' in CD_FAKE cases). */
void data_transfer_layersmapping_add_item(ListBase *r_map,
const int cddata_type,
@@ -537,12 +539,13 @@ static void data_transfer_layersmapping_add_item_cd(ListBase *r_map,
interp_data);
}
-/* Note: All those layer mapping handlers return false *only* if they were given invalid parameters.
- * This means that even if they do nothing, they will return true if all given parameters were OK.
- * Also, r_map may be NULL, in which case they will 'only' create/delete destination layers according
- * to given parameters.
+/**
+ * \note
+ * All those layer mapping handlers return false *only* if they were given invalid parameters.
+ * This means that even if they do nothing, they will return true if all given parameters were OK.
+ * Also, r_map may be NULL, in which case they will 'only' create/delete destination layers
+ * according to given parameters.
*/
-
static bool data_transfer_layersmapping_cdlayers_multisrc_to_dst(ListBase *r_map,
const int cddata_type,
const int mix_mode,
@@ -609,7 +612,8 @@ static bool data_transfer_layersmapping_cdlayers_multisrc_to_dst(ListBase *r_map
continue;
}
data_src = CustomData_get_layer_n(cd_src, cddata_type, idx_src);
- /* If dest is a evaluated mesh (fro; ;odifier), we do not want to overwrite cdlayers of orig mesh! */
+ /* If dest is a evaluated mesh (from modifier),
+ * we do not want to overwrite cdlayers of orig mesh! */
if (use_dupref_dst) {
data_dst = CustomData_duplicate_referenced_layer_n(
cd_dst, cddata_type, idx_src, num_elem_dst);
@@ -654,7 +658,8 @@ static bool data_transfer_layersmapping_cdlayers_multisrc_to_dst(ListBase *r_map
idx_dst = CustomData_get_named_layer(cd_dst, cddata_type, name);
}
else {
- /* If we are not allowed to create missing dst data layers, just skip matching src one. */
+ /* If we are not allowed to create missing dst data layers,
+ * just skip matching src one. */
continue;
}
}
@@ -662,7 +667,8 @@ static bool data_transfer_layersmapping_cdlayers_multisrc_to_dst(ListBase *r_map
data_dst_to_delete[idx_dst] = false;
}
if (r_map) {
- /* If dest is a evaluated mesh (from modifier), we do not want to overwrite cdlayers of orig mesh! */
+ /* If dest is a evaluated mesh (from modifier),
+ * we do not want to overwrite cdlayers of orig mesh! */
if (use_dupref_dst) {
data_dst = CustomData_duplicate_referenced_layer_n(
cd_dst, cddata_type, idx_dst, num_elem_dst);
@@ -683,9 +689,10 @@ static bool data_transfer_layersmapping_cdlayers_multisrc_to_dst(ListBase *r_map
}
if (data_dst_to_delete) {
- /* Note: This won't affect newly created layers, if any, since tot_dst has not been updated!
- * Also, looping backward ensures us we do not suffer from index shifting when deleting a layer.
- */
+ /* Note:
+ * This won't affect newly created layers, if any, since tot_dst has not been updated!
+ * Also, looping backward ensures us we do not suffer
+ * from index shifting when deleting a layer. */
for (idx_dst = tot_dst; idx_dst--;) {
if (data_dst_to_delete[idx_dst]) {
CustomData_free_layer(cd_dst, cddata_type, num_elem_dst, idx_dst);
@@ -737,7 +744,8 @@ static bool data_transfer_layersmapping_cdlayers(ListBase *r_map,
data_dst = CustomData_add_layer(cd_dst, cddata_type, CD_CALLOC, NULL, num_elem_dst);
}
else if (use_dupref_dst && r_map) {
- /* If dest is a evaluated mesh (from modifier), we do not want to overwrite cdlayers of orig mesh! */
+ /* If dest is a evaluated mesh (from modifier),
+ * we do not want to overwrite cdlayers of orig mesh! */
data_dst = CustomData_duplicate_referenced_layer(cd_dst, cddata_type, num_elem_dst);
}
@@ -771,7 +779,8 @@ static bool data_transfer_layersmapping_cdlayers(ListBase *r_map,
if (tolayers >= 0) { /* Real-layer index */
idx_dst = tolayers;
- /* If dest is a evaluated mesh (from modifier), we do not want to overwrite cdlayers of orig mesh! */
+ /* If dest is a evaluated mesh (from modifier),
+ * we do not want to overwrite cdlayers of orig mesh! */
if (use_dupref_dst && r_map) {
data_dst = CustomData_duplicate_referenced_layer_n(
cd_dst, cddata_type, idx_dst, num_elem_dst);
@@ -788,7 +797,8 @@ static bool data_transfer_layersmapping_cdlayers(ListBase *r_map,
data_dst = CustomData_add_layer(cd_dst, cddata_type, CD_CALLOC, NULL, num_elem_dst);
}
else {
- /* If dest is a evaluated mesh (from modifier), we do not want to overwrite cdlayers of orig mesh! */
+ /* If dest is a evaluated mesh (from modifier),
+ * we do not want to overwrite cdlayers of orig mesh! */
if (use_dupref_dst && r_map) {
data_dst = CustomData_duplicate_referenced_layer_n(
cd_dst, cddata_type, idx_dst, num_elem_dst);
@@ -810,7 +820,8 @@ static bool data_transfer_layersmapping_cdlayers(ListBase *r_map,
CustomData_add_layer(cd_dst, cddata_type, CD_CALLOC, NULL, num_elem_dst);
}
}
- /* If dest is a evaluated mesh (from modifier), we do not want to overwrite cdlayers of orig mesh! */
+ /* If dest is a evaluated mesh (from modifier),
+ * we do not want to overwrite cdlayers of orig mesh! */
if (use_dupref_dst && r_map) {
data_dst = CustomData_duplicate_referenced_layer_n(
cd_dst, cddata_type, idx_dst, num_elem_dst);
@@ -828,7 +839,8 @@ static bool data_transfer_layersmapping_cdlayers(ListBase *r_map,
CustomData_add_layer_named(cd_dst, cddata_type, CD_CALLOC, NULL, num_elem_dst, name);
idx_dst = CustomData_get_named_layer(cd_dst, cddata_type, name);
}
- /* If dest is a evaluated mesh (from modifier), we do not want to overwrite cdlayers of orig mesh! */
+ /* If dest is a evaluated mesh (from modifier),
+ * we do not want to overwrite cdlayers of orig mesh! */
if (use_dupref_dst && r_map) {
data_dst = CustomData_duplicate_referenced_layer_n(
cd_dst, cddata_type, idx_dst, num_elem_dst);
@@ -1002,7 +1014,8 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
return ret;
}
else if (cddata_type == CD_FAKE_SHAPEKEY) {
- /* TODO: leaving shapekeys aside 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;
}
}
@@ -1127,7 +1140,8 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
cddata_type = CD_MLOOPUV;
}
else if (cddata_type == CD_FAKE_LNOR) {
- /* Preprocess should have generated it, Postprocess will convert it back to CD_CUSTOMLOOPNORMAL. */
+ /* Pre-process should have generated it,
+ * Post-process will convert it back to CD_CUSTOMLOOPNORMAL. */
cddata_type = CD_NORMAL;
interp_data = space_transform;
interp = customdata_data_transfer_interp_normal_normals;
@@ -1224,8 +1238,8 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
/**
* Transfer data *layout* of selected types from source to destination object.
* By default, it only creates new data layers if needed on \a ob_dst.
- * If \a use_delete is true, it will also delete data layers on \a ob_dst that do not match those from \a ob_src,
- * to get (as much as possible) exact copy of source data layout.
+ * If \a use_delete is true, it will also delete data layers on \a ob_dst that do not match those
+ * from \a ob_src, to get (as much as possible) exact copy of source data layout.
*/
void BKE_object_data_transfer_layout(struct Depsgraph *depsgraph,
Scene *scene,
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 57ab0a9c94e..e83e9560b02 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -646,11 +646,11 @@ float defvert_array_find_weight_safe(const struct MDeformVert *dvert,
const int index,
const int defgroup)
{
- /* Invalid defgroup index means the vgroup selected is invalid, does not exist, in that case it is OK to return 1.0
+ /* Invalid defgroup index means the vgroup selected is invalid,
+ * does not exist, in that case it is OK to return 1.0
* (i.e. maximum weight, as if no vgroup was selected).
* But in case of valid defgroup and NULL dvert data pointer, it means that vgroup **is** valid,
- * and just totally empty, so we shall return '0.0' value then!
- */
+ * and just totally empty, so we shall return '0.0' value then! */
if (defgroup == -1) {
return 1.0f;
}
@@ -1258,12 +1258,13 @@ bool data_transfer_layersmapping_vgroups(ListBase *r_map,
const size_t elem_size = sizeof(*((MDeformVert *)NULL));
- /* Note: VGroups are a bit hairy, since their layout is defined on object level (ob->defbase), while their actual
- * data is a (mesh) CD layer.
- * This implies we may have to handle data layout itself while having NULL data itself,
- * and even have to support NULL data_src in transfer data code (we always create a data_dst, though).
+ /* Note:
+ * VGroups are a bit hairy, since their layout is defined on object level (ob->defbase),
+ * while their actual data is a (mesh) CD layer.
+ * This implies we may have to handle data layout itself while having NULL data itself,
+ * and even have to support NULL data_src in transfer data code
+ * (we always create a data_dst, though).
*/
-
if (BLI_listbase_is_empty(&ob_src->defbase)) {
if (use_delete) {
BKE_object_defgroup_remove_all(ob_dst);
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 47043064b90..a6a87b302ab 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -153,12 +153,17 @@ typedef struct Bounds3D {
typedef struct VolumeGrid {
int dim[3];
- Bounds3D grid_bounds; /* whole grid bounds */
-
- Bounds3D *bounds; /* (x*y*z) precalculated grid cell bounds */
- int *s_pos; /* (x*y*z) t_index begin id */
- int *s_num; /* (x*y*z) number of t_index points */
- int *t_index; /* actual surface point index, access: (s_pos + s_num) */
+ /** whole grid bounds */
+ Bounds3D grid_bounds;
+
+ /** (x*y*z) precalculated grid cell bounds */
+ Bounds3D *bounds;
+ /** (x*y*z) t_index begin id */
+ int *s_pos;
+ /** (x*y*z) number of t_index points */
+ int *s_num;
+ /** actual surface point index, access: (s_pos + s_num) */
+ int *t_index;
int *temp_t_index;
} VolumeGrid;
@@ -168,51 +173,67 @@ typedef struct Vec3f {
} Vec3f;
typedef struct BakeAdjPoint {
- float dir[3]; /* vector pointing towards this neighbor */
- float dist; /* distance to */
+ /** vector pointing towards this neighbor */
+ float dir[3];
+ /** distance to */
+ float dist;
} 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 */
+ /** current pixel world-space inverted normal */
+ float invNorm[3];
+ /** normal directional scale for displace mapping */
+ float normal_scale;
} PaintBakeNormal;
-/* Temp surface data used to process a frame */
+/** Temp surface data used to process a frame */
typedef struct PaintBakeData {
/* point space data */
PaintBakeNormal *bNormal;
- int *s_pos; /* index to start reading point sample realCoord */
- int *s_num; /* num of realCoord samples */
- Vec3f *
- realCoord; /* current pixel center world-space coordinates for each sample ordered as (s_pos + s_num) */
+ /** index to start reading point sample realCoord */
+ int *s_pos;
+ /** num of realCoord samples */
+ int *s_num;
+ /** current pixel center world-space coordinates for each sample ordered as (s_pos + s_num) */
+ Vec3f *realCoord;
Bounds3D mesh_bounds;
float dim[3];
/* adjacency info */
- BakeAdjPoint *bNeighs; /* current global neighbor distances and directions, if required */
+ /** current global neighbor distances and directions, if required */
+ BakeAdjPoint *bNeighs;
double average_dist;
/* space partitioning */
- VolumeGrid *grid; /* space partitioning grid to optimize brush checks */
+ /** space partitioning grid to optimize brush checks */
+ VolumeGrid *grid;
/* velocity and movement */
- Vec3f *velocity; /* speed vector in global space movement per frame, if required */
+ /** speed vector in global space movement per frame, if required */
+ Vec3f *velocity;
Vec3f *prev_velocity;
- float *brush_velocity; /* special temp data for post-p velocity based brushes like smudge
- * 3 float dir vec + 1 float str */
- MVert *prev_verts; /* copy of previous frame vertices. used to observe surface movement */
- float prev_obmat[4][4]; /* previous frame object matrix */
- int clear; /* flag to check if surface was cleared/reset -> have to redo velocity etc. */
+ /** special temp data for post-p velocity based brushes like smudge
+ * 3 float dir vec + 1 float str */
+ float *brush_velocity;
+ /** copy of previous frame vertices. used to observe surface movement. */
+ MVert *prev_verts;
+ /** Previous frame object matrix. */
+ float prev_obmat[4][4];
+ /** flag to check if surface was cleared/reset -> have to redo velocity etc. */
+ int clear;
} 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 */
- unsigned int v1, v2, v3; /* vertex indexes */
-
- unsigned int
- neighbour_pixel; /* If this pixel isn't uv mapped to any face, but it's neighboring pixel is */
+ /** tri index on domain derived mesh */
+ unsigned int tri_index;
+ unsigned int pixel_index;
+ /* vertex indexes */
+ unsigned int v1, v2, v3;
+
+ /** If this pixel isn't uv mapped to any face, but it's neighboring pixel is. */
+ unsigned int neighbour_pixel;
} PaintUVPoint;
typedef struct ImgSeqFormatData {
@@ -225,14 +246,20 @@ typedef struct ImgSeqFormatData {
#define ADJ_BORDER_PIXEL (1 << 1)
typedef struct PaintAdjData {
- int *
- n_target; /* array of neighboring point indexes, for single sample use (n_index + neigh_num) */
- int *n_index; /* index to start reading n_target for each point */
- int *n_num; /* num of neighs for each point */
- int *flags; /* vertex adjacency flags */
- int total_targets; /* size of n_target */
- int *border; /* indices of border pixels (only for texture paint) */
- int total_border; /* size of border */
+ /** Array of neighboring point indexes, for single sample use (n_index + neigh_num). */
+ int *n_target;
+ /** Index to start reading n_target for each point. */
+ int *n_index;
+ /** Num of neighs for each point. */
+ int *n_num;
+ /** Vertex adjacency flags. */
+ int *flags;
+ /** Size of n_target. */
+ int total_targets;
+ /** Indices of border pixels (only for texture paint). */
+ int *border;
+ /** Size of border. */
+ int total_border;
} PaintAdjData;
/************************* Runtime evaluation store ***************************/
@@ -2191,11 +2218,11 @@ Mesh *dynamicPaint_Modifier_do(DynamicPaintModifierData *pmd,
}
}
-/***************************** Image Sequence / UV Image Surface Calls ******************************/
+/* -------------------------------------------------------------------- */
+/** \name 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, -0.2f, -0.4f, 0.2f, 0.4f, 0.4f, -0.2f, -0.4f, 0.3f, \
@@ -2473,7 +2500,8 @@ static int dynamic_paint_find_neighbour_pixel(const DynamicPaintCreateUVSurfaceD
const PaintUVPoint *tPoint = &tempPoints[x + w * y]; /* UV neighbor */
const PaintUVPoint *cPoint = &tempPoints[px + w * py]; /* Origin point */
- /* Check if shifted point is on same face -> it's a correct neighbor (and if it isn't marked as an "edge pixel") */
+ /* Check if shifted point is on same face -> it's a correct neighbor
+ * (and if it isn't marked as an "edge pixel") */
if ((tPoint->tri_index == cPoint->tri_index) && (tPoint->neighbour_pixel == -1)) {
return (x + w * y);
}
@@ -2568,7 +2596,8 @@ static void dynamic_paint_find_island_border(const DynamicPaintCreateUVSurfaceDa
const int vert0 = mloop[loop_idx[(edge_idx + 0)]].v;
const int vert1 = mloop[loop_idx[(edge_idx + 1) % 3]].v;
- /* Use a pre-computed vert-to-looptri mapping, speeds up things a lot compared to looping over all loopti. */
+ /* Use a pre-computed vert-to-looptri mapping,
+ * speeds up things a lot compared to looping over all loopti. */
const MeshElemMap *map = &bdata->vert_to_looptri_map[vert0];
bool found_other = false;
@@ -2710,7 +2739,8 @@ static bool dynamicPaint_pointHasNeighbor(PaintAdjData *ed, int index, int neigh
return false;
}
-/* Makes the adjacency data symmetric, except for border pixels. I.e. if A is neighbor of B, B is neighbor of A. */
+/* Makes the adjacency data symmetric, except for border pixels.
+ * I.e. if A is neighbor of B, B is neighbor of A. */
static bool dynamicPaint_symmetrizeAdjData(PaintAdjData *ed, int active_points)
{
int *new_n_index = MEM_callocN(sizeof(int) * active_points, "Surface Adj Index");
@@ -3000,7 +3030,8 @@ int dynamicPaint_createUVSurface(Scene *scene,
}
for (int i = 0; i < 8; i++) {
- /* Try to find a neighboring pixel in defined direction. If not found, -1 is returned */
+ /* Try to find a neighboring pixel in defined direction.
+ * If not found, -1 is returned */
const int n_target = dynamic_paint_find_neighbour_pixel(
&data, vert_to_looptri_map, w, h, tx, ty, i);
@@ -3410,10 +3441,13 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface,
IMB_freeImBuf(ibuf);
}
+/** \} */
+
/***************************** Ray / Nearest Point Utils ******************************/
-/* 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.
+/* 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.
*/
@@ -3443,7 +3477,8 @@ static void mesh_tris_spherecast_dp(void *userdata,
}
}
-/* A modified callback to bvh tree nearest point. The tree must have been built using bvhtree_from_mesh_looptri.
+/* A modified callback to bvh tree nearest point.
+ * 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 normal.
@@ -4848,7 +4883,8 @@ static void dynamicPaint_prepareAdjacencyData(DynamicPaintSurface *surface, cons
0, sData->total_points, sData, dynamic_paint_prepare_adjacency_cb, &settings);
/* calculate average values (single thread).
- * Note: tried to put this in threaded callback (using _finalize feature), but gave ~30% slower result! */
+ * Note: tried to put this in threaded callback (using _finalize feature),
+ * but gave ~30% slower result! */
bData->average_dist = 0.0;
for (index = 0; index < sData->total_points; index++) {
int numOfNeighs = adj_data->n_num[index];
@@ -4860,7 +4896,8 @@ static void dynamicPaint_prepareAdjacencyData(DynamicPaintSurface *surface, cons
bData->average_dist /= adj_data->total_targets;
}
-/* find two adjacency points (closest_id) and influence (closest_d) to move paint towards when affected by a force */
+/* Find two adjacency points (closest_id) and influence (closest_d)
+ * to move paint towards when affected by a force. */
static void surface_determineForceTargetPoints(const PaintSurfaceData *sData,
const int index,
const float force[3],
@@ -5350,8 +5387,8 @@ static void dynamic_paint_effect_drip_cb(void *__restrict userdata,
const unsigned int n_trgt = (unsigned int)n_target[n_idx];
/* Sort of spinlock, but only for given ePoint.
- * Since the odds a same ePoint is modified at the same time by several threads is very low, this is
- * much more efficient than a global spin lock. */
+ * Since the odds a same ePoint is modified at the same time by several threads is very low,
+ * this is much more efficient than a global spin lock. */
const unsigned int epointlock_idx = n_trgt / 8;
const uint8_t epointlock_bitmask = 1 << (n_trgt & 7); /* 7 == 0b111 */
while (atomic_fetch_and_or_uint8(&point_locks[epointlock_idx], epointlock_bitmask) &
@@ -5382,8 +5419,8 @@ static void dynamic_paint_effect_drip_cb(void *__restrict userdata,
CLAMP_MAX(ePoint->e_color[3], pPoint_prev->e_color[3]);
}
- /* Decrease paint wetness on current point
- * (just store diff here, that way we can only lock current point once at the end to apply it). */
+ /* Decrease paint wetness on current point (just store diff here,
+ * that way we can only lock current point once at the end to apply it). */
ppoint_wetness_diff += (ePoint->wetness - e_wet);
#ifndef NDEBUG
@@ -5811,10 +5848,10 @@ static void dynamic_paint_surface_pre_step_cb(void *__restrict userdata,
/* reduce wet layer alpha by dry factor */
pPoint->e_color[3] *= dry_ratio;
- /* now calculate new alpha for dry layer that keeps final blended color unchanged */
+ /* 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 doesn't change)*/
+ /* For each rgb component, calculate a new dry layer color that keeps the final blend
+ * color 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] -
diff --git a/source/blender/blenkernel/intern/editmesh.c b/source/blender/blenkernel/intern/editmesh.c
index 12f70eed2c6..130f4ae88f1 100644
--- a/source/blender/blenkernel/intern/editmesh.c
+++ b/source/blender/blenkernel/intern/editmesh.c
@@ -233,11 +233,11 @@ void BKE_editmesh_lnorspace_update(BMEditMesh *em)
BMesh *bm = em->bm;
/* We need to create clnors data if none exist yet, otherwise there is no way to edit them.
- * Similar code to MESH_OT_customdata_custom_splitnormals_add operator, we want to keep same shading
- * in case we were using autosmooth so far...
- * Note: there is a problem here, which is that if someone starts a normal editing operation on previously
- * autosmooth-ed mesh, and cancel that operation, generated clnors data remain, with related sharp edges
- * (and hence autosmooth is 'lost').
+ * Similar code to MESH_OT_customdata_custom_splitnormals_add operator,
+ * we want to keep same shading in case we were using autosmooth so far.
+ * Note: there is a problem here, which is that if someone starts a normal editing operation on
+ * previously autosmooth-ed mesh, and cancel that operation, generated clnors data remain,
+ * with related sharp edges (and hence autosmooth is 'lost').
* Not sure how critical this is, and how to fix that issue? */
if (!CustomData_has_layer(&bm->ldata, CD_CUSTOMLOOPNORMAL)) {
Mesh *me = em->ob->data;
diff --git a/source/blender/blenkernel/intern/editmesh_tangent.c b/source/blender/blenkernel/intern/editmesh_tangent.c
index 6a644b2ed4b..2b26d814b70 100644
--- a/source/blender/blenkernel/intern/editmesh_tangent.c
+++ b/source/blender/blenkernel/intern/editmesh_tangent.c
@@ -276,7 +276,8 @@ static void emDM_calc_loop_tangents_thread(TaskPool *__restrict UNUSED(pool),
/**
* \see #BKE_mesh_calc_loop_tangent, same logic but used arrays instead of #BMesh data.
*
- * \note This function is not so normal, its using `bm->ldata` as input, but output's to `dm->loopData`.
+ * \note This function is not so normal, its using `bm->ldata` as input,
+ * but output's to `dm->loopData`.
* This is done because #CD_TANGENT is cache data used only for drawing.
*/
void BKE_editmesh_loop_tangent_calc(BMEditMesh *em,
@@ -382,9 +383,8 @@ void BKE_editmesh_loop_tangent_calc(BMEditMesh *em,
mesh2tangent->num_face_as_quad_map = num_face_as_quad_map;
#endif
mesh2tangent->precomputedFaceNormals = poly_normals;
- /* Note, we assume we do have tessellated loop normals at this point (in case it is object-enabled),
- * have to check this is valid...
- */
+ /* Note, we assume we do have tessellated loop normals at this point
+ * (in case it is object-enabled), have to check this is valid. */
mesh2tangent->precomputedLoopNormals = loop_normals;
mesh2tangent->cd_loop_uv_offset = CustomData_get_n_offset(&bm->ldata, CD_MLOOPUV, n);
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 1105d210e13..1c023c59d50 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -646,8 +646,8 @@ int get_effector_data(EffectorCache *eff,
float cfra = DEG_get_ctime(eff->depsgraph);
int ret = 0;
- /* In case surface object is in Edit mode when loading the .blend, surface modifier is never executed
- * and bvhtree never built, see T48415. */
+ /* 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) {
/* closest point in the object surface is an effector */
float vec[3];
@@ -750,7 +750,8 @@ int get_effector_data(EffectorCache *eff,
sub_v3_v3v3(efd->vec_to_point, point->loc, efd->loc);
efd->distance = len_v3(efd->vec_to_point);
- /* rest length for harmonic effector, will have to see later if this could be extended to other effectors */
+ /* 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);
}
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 4d94faa6595..8c95e4c7ff3 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -230,7 +230,8 @@ FCurve *id_data_find_fcurve(
return fcu;
}
-/* Find the F-Curve affecting the given RNA-access path + index, in the list of F-Curves provided */
+/* Find the F-Curve affecting the given RNA-access path + index,
+ * in the list of F-Curves provided. */
FCurve *list_find_fcurve(ListBase *list, const char rna_path[], const int array_index)
{
FCurve *fcu;
@@ -277,7 +278,10 @@ FCurve *iter_step_fcurve(FCurve *fcu_iter, const char rna_path[])
return NULL;
}
-/* Get list of LinkData's containing pointers to the F-Curves which control the types of data indicated
+/**
+ * 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.
@@ -380,9 +384,9 @@ FCurve *rna_get_fcurve_context_ui(bContext *C,
/* there must be some RNA-pointer + property combon */
if (prop && tptr.id.data && RNA_property_animateable(&tptr, prop)) {
AnimData *adt = BKE_animdata_from_id(tptr.id.data);
- int step =
- C ? 2 :
- 1; /* Always 1 in case we have no context (can't check in 'ancestors' of given RNA ptr). */
+ int step = (
+ /* Always 1 in case we have no context (can't check in 'ancestors' of given RNA ptr). */
+ C ? 2 : 1);
char *path = NULL;
if (!adt && C) {
@@ -451,7 +455,8 @@ FCurve *rna_get_fcurve_context_ui(bContext *C,
/* ----------------- Finding Keyframes/Extents -------------------------- */
-/* Binary search algorithm for finding where to insert BezTriple, with optional argument for precision required.
+/* Binary search algorithm for finding where to insert BezTriple,
+ * with optional argument for precision required.
* Returns the index to insert at (data already at that index will be offset if replace is 0)
*/
static int binarysearch_bezt_index_ex(
@@ -648,8 +653,8 @@ bool calc_fcurve_bounds(FCurve *fcu,
if (include_handles) {
/* left handle - only if applicable
- * NOTE: for the very first keyframe, the left handle actually has no bearings on anything
- */
+ * NOTE: for the very first keyframe,
+ * the left handle actually has no bearings on anything. */
if (prevbezt && (prevbezt->ipo == BEZT_IPO_BEZ)) {
yminv = min_ff(yminv, bezt->vec[0][1]);
ymaxv = max_ff(ymaxv, bezt->vec[0][1]);
@@ -999,13 +1004,15 @@ eFCU_Cycle_Type BKE_fcurve_get_cycle_type(FCurve *fcu)
return FCU_CYCLE_NONE;
}
-/* Checks if the F-Curve has a Cycles modifier with simple settings that warrant transition smoothing */
+/* Checks if the F-Curve has a Cycles modifier with simple settings
+ * that warrant transition smoothing. */
bool BKE_fcurve_is_cyclic(FCurve *fcu)
{
return BKE_fcurve_get_cycle_type(fcu) != FCU_CYCLE_NONE;
}
-/* Shifts 'in' by the difference in coordinates between 'to' and 'from', using 'out' as the output buffer.
+/* Shifts 'in' by the difference in coordinates between 'to' and 'from',
+ * using 'out' as the output buffer.
* When 'to' and 'from' are end points of the loop, this moves the 'in' point one loop cycle.
*/
static BezTriple *cycle_offset_triple(
@@ -1240,7 +1247,10 @@ static ID *dtar_id_ensure_proxy_from(ID *id)
return id;
}
-/* Helper function to obtain a value using RNA from the specified source (for evaluating drivers) */
+/**
+ * Helper function to obtain a value using RNA from the specified source
+ * (for evaluating drivers).
+ */
static float dtar_get_prop_val(ChannelDriver *driver, DriverTarget *dtar)
{
PointerRNA id_ptr, ptr;
@@ -1879,12 +1889,14 @@ void driver_variable_name_validate(DriverVar *dvar)
}
/* 1) Must start with a letter */
- /* XXX: We assume that valid unicode letters in other languages are ok too, hence the blacklisting */
+ /* XXX: We assume that valid unicode letters in other languages are ok too,
+ * hence the blacklisting. */
if (IN_RANGE_INCL(dvar->name[0], '0', '9')) {
dvar->flag |= DVAR_FLAG_INVALID_START_NUM;
}
else if (dvar->name[0] == '_') {
- /* NOTE: We don't allow names to start with underscores (i.e. it helps when ruling out security risks) */
+ /* NOTE: We don't allow names to start with underscores
+ * (i.e. it helps when ruling out security risks) */
dvar->flag |= DVAR_FLAG_INVALID_START_CHAR;
}
@@ -1984,7 +1996,8 @@ void fcurve_free_driver(FCurve *fcu)
BLI_expr_pylike_free(driver->expr_simple);
- /* free driver itself, then set F-Curve's point to this to NULL (as the curve may still be used) */
+ /* Free driver itself, then set F-Curve's point to this to NULL
+ * (as the curve may still be used). */
MEM_freeN(driver);
fcu->driver = NULL;
}
@@ -2005,9 +2018,9 @@ ChannelDriver *fcurve_copy_driver(const ChannelDriver *driver)
ndriver->expr_simple = NULL;
/* copy variables */
- BLI_listbase_clear(
- &ndriver
- ->variables); /* to get rid of refs to non-copied data (that's still used on original) */
+
+ /* to get rid of refs to non-copied data (that's still used on original) */
+ BLI_listbase_clear(&ndriver->variables);
driver_variables_copy(&ndriver->variables, &driver->variables);
/* return the new driver */
@@ -2603,9 +2616,12 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
/* Use binary search to find appropriate keyframes...
*
* The threshold here has the following constraints:
- * - 0.001 is too coarse -> We get artifacts with 2cm driver movements at 1BU = 1m (see T40332)
- * - 0.00001 is too fine -> Weird errors, like selecting the wrong keyframe range (see T39207), occur.
- * This lower bound was established in b888a32eee8147b028464336ad2404d8155c64dd
+ * - 0.001 is too coarse:
+ * We get artifacts with 2cm driver movements at 1BU = 1m (see T40332)
+ *
+ * - 0.00001 is too fine:
+ * Weird errors, like selecting the wrong keyframe range (see T39207), occur.
+ * This lower bound was established in b888a32eee8147b028464336ad2404d8155c64dd.
*/
a = binarysearch_bezt_index_ex(bezts, evaltime, fcu->totvert, 0.0001, &exact);
@@ -2624,7 +2640,8 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
prevbezt = (a > 0) ? (bezt - 1) : bezt;
}
- /* use if the key is directly on the frame, rare cases this is needed else we get 0.0 instead. */
+ /* use if the key is directly on the frame,
+ * rare cases this is needed else we get 0.0 instead. */
/* XXX: consult T39207 for examples of files where failure of these checks can cause issues */
if (exact) {
cvalue = prevbezt->vec[1][1];
@@ -3009,9 +3026,9 @@ float evaluate_fcurve_driver(PathResolvedRNA *anim_rna,
BLI_assert(fcu->driver != NULL);
float cvalue = 0.0f;
- /* if there is a driver (only if this F-Curve is acting as 'driver'), evaluate it to find value to use as "evaltime"
- * since drivers essentially act as alternative input (i.e. in place of 'time') for F-Curves
- */
+ /* If there is a driver (only if this F-Curve is acting as 'driver'),
+ * evaluate it to find value to use as "evaltime" since drivers essentially act as alternative
+ * input (i.e. in place of 'time') for F-Curves. */
if (fcu->driver) {
/* evaltime now serves as input for the curve */
evaltime = evaluate_driver(anim_rna, fcu->driver, driver_orig, evaltime);
@@ -3028,12 +3045,12 @@ float evaluate_fcurve_driver(PathResolvedRNA *anim_rna,
/* if there are range-restrictions, we must definitely block [#36950] */
if ((fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) == 0 ||
((fcm->sfra <= evaltime) && (fcm->efra >= evaltime))) {
- /* within range: here it probably doesn't matter, though we'd want to check on additive... */
+ /* Within range: here it probably doesn't matter,
+ * though we'd want to check on additive. */
}
else {
- /* outside range: modifier shouldn't contribute to the curve here, though it does in other areas,
- * so neither should the driver!
- */
+ /* Outside range: modifier shouldn't contribute to the curve here,
+ * though it does in other areas, so neither should the driver! */
do_linear = false;
}
}
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index 79808d20193..234fa607604 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -95,8 +95,10 @@ static FModifierTypeInfo FMI_MODNAME = {
/* Generators available:
* 1) simple polynomial generator:
- * - Expanded form - (y = C[0]*(x^(n)) + C[1]*(x^(n-1)) + ... + C[n])
- * - Factorized form - (y = (C[0][0]*x + C[0][1]) * (C[1][0]*x + C[1][1]) * ... * (C[n][0]*x + C[n][1]))
+ * - Expanded form:
+ * (y = C[0]*(x^(n)) + C[1]*(x^(n-1)) + ... + C[n])
+ * - Factorized form:
+ * (y = (C[0][0]*x + C[0][1]) * (C[1][0]*x + C[1][1]) * ... * (C[n][0]*x + C[n][1]))
*/
static void fcm_generator_free(FModifier *fcm)
@@ -217,9 +219,9 @@ static void fcm_generator_evaluate(
float value = 1.0f, *cp = NULL;
unsigned int i;
- /* for each coefficient pair, solve for that bracket before accumulating in value by multiplying */
- for (cp = data->coefficients, i = 0; (cp) && (i < (unsigned int)data->poly_order);
- cp += 2, i++) {
+ /* For each coefficient pair,
+ * solve for that bracket before accumulating in value by multiplying. */
+ for (cp = data->coefficients, i = 0; (cp) && (i < (uint)data->poly_order); cp += 2, i++) {
value *= (cp[0] * evaltime + cp[1]);
}
@@ -594,14 +596,14 @@ int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[],
/* This modifier changes evaltime to something that exists within the curve's frame-range,
* then re-evaluates modifier stack up to this point using the new time. This re-entrant behavior
- * is very likely to be more time-consuming than the original approach... (which was tightly integrated into
- * the calculation code...).
+ * is very likely to be more time-consuming than the original approach...
+ * (which was tightly integrated into the calculation code...).
*
- * NOTE: this needs to be at the start of the stack to be of use, as it needs to know the extents of the
- * keyframes/sample-data.
+ * NOTE: this needs to be at the start of the stack to be of use,
+ * as it needs to know the extents of the keyframes/sample-data.
*
- * Possible TODO - store length of cycle information that can be initialized from the extents of the
- * keyframes/sample-data, and adjusted as appropriate.
+ * Possible TODO - store length of cycle information that can be initialized from the extents of
+ * the keyframes/sample-data, and adjusted as appropriate.
*/
/* temp data used during evaluation */
@@ -740,9 +742,10 @@ static float fcm_cycles_time(
}
/* 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
+ /* 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)
+ * then end of the curve get referenced
+ * (result of fmod will be negative, and with different phase).
*/
if (side < 0) {
evaltime = prevkey[0] - cyct;
@@ -1455,9 +1458,9 @@ float evaluate_time_fmodifiers(FModifiersStackStorage *storage,
continue;
}
- /* if modifier cannot be applied on this frame (whatever scale it is on, it won't affect the results)
- * hence we shouldn't bother seeing what it would do given the chance
- */
+ /* If modifier cannot be applied on this frame
+ * (whatever scale it is on, it won't affect the results)
+ * hence we shouldn't bother seeing what it would do given the chance. */
if ((fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) == 0 ||
((fcm->sfra <= evaltime) && (fcm->efra >= evaltime))) {
/* only evaluate if there's a callback for this */
@@ -1508,7 +1511,8 @@ void evaluate_value_fmodifiers(FModifiersStackStorage *storage,
continue;
}
- /* only evaluate if there's a callback for this, and if F-Modifier can be evaluated on this frame */
+ /* Only evaluate if there's a callback for this,
+ * and if F-Modifier can be evaluated on this frame. */
if ((fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) == 0 ||
((fcm->sfra <= evaltime) && (fcm->efra >= evaltime))) {
if (fmi->evaluate_modifier) {
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 9ee8ecd1b64..70a8f4f124c 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -674,7 +674,8 @@ enum {
* Descent: the recommended distance below the baseline to fit most characters.
*
* We obtain ascent and descent from the font itself (FT_Face->ascender / face->height).
- * And in some cases it is even the same value as FT_Face->bbox.yMax/yMin (font top and bottom respectively).
+ * And in some cases it is even the same value as FT_Face->bbox.yMax/yMin
+ * (font top and bottom respectively).
*
* The em_height here is relative to FT_Face->bbox.
*/
@@ -1405,7 +1406,8 @@ static bool vfont_to_curve(Object *ob,
}
if (ob == NULL || info->mat_nr > (ob->totcol)) {
- /* CLOG_ERROR(&LOG, "Illegal material index (%d) in text object, setting to 0", info->mat_nr); */
+ // CLOG_ERROR(
+ // &LOG, "Illegal material index (%d) in text object, setting to 0", info->mat_nr);
info->mat_nr = 0;
}
/* We do not want to see any character for \n or \r */
@@ -1625,7 +1627,8 @@ bool BKE_vfont_to_curve_nubase(Object *ob, int mode, ListBase *r_nubase)
return BKE_vfont_to_curve_ex(ob, ob->data, mode, r_nubase, NULL, NULL, NULL, NULL);
}
-/** Warning: expects to have access to evaluated data (i.e. passed object should be evaluated one...). */
+/** Warning: expects to have access to evaluated data
+ * (i.e. passed object should be evaluated one...). */
bool BKE_vfont_to_curve(Object *ob, int mode)
{
Curve *cu = ob->data;
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index e45a4f4d649..c82b2c377fa 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -622,8 +622,10 @@ bGPDlayer *BKE_gpencil_layer_duplicate(const bGPDlayer *gpl_src)
}
/**
- * Only copy internal data of GreasePencil ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of GreasePencil ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -1159,7 +1161,10 @@ Material *BKE_gpencil_object_material_ensure_from_active_input_brush(Main *bmain
return BKE_gpencil_object_material_ensure_from_active_input_material(bmain, ob);
}
-/* Guaranteed to return a material assigned to object. Returns never NULL. Only use this for materials unrelated to user input */
+/**
+ * Guaranteed to return a material assigned to object. Returns never NULL.
+ * Only use this for materials unrelated to user input.
+ */
Material *BKE_gpencil_object_material_ensure_from_active_input_material(Main *bmain, Object *ob)
{
Material *ma = give_current_material(ob, ob->actcol);
@@ -1416,9 +1421,11 @@ bool BKE_gpencil_smooth_stroke(bGPDstroke *gps, int i, float inf)
}
/* Compute smoothed coordinate by taking the ones nearby */
- /* XXX: This is potentially slow, and suffers from accumulation error as earlier points are handled before later ones */
+ /* XXX: This is potentially slow,
+ * and suffers from accumulation error as earlier points are handled before later ones. */
{
- // XXX: this is hardcoded to look at 2 points on either side of the current one (i.e. 5 items total)
+ /* XXX: this is hardcoded to look at 2 points on either side of the current one
+ * (i.e. 5 items total). */
const int steps = 2;
const float average_fac = 1.0f / (float)(steps * 2 + 1);
int step;
@@ -1427,8 +1434,9 @@ bool BKE_gpencil_smooth_stroke(bGPDstroke *gps, int i, float inf)
madd_v3_v3fl(sco, &pt->x, average_fac);
/* n-steps before/after current point */
- // XXX: review how the endpoints are treated by this algorithm
- // XXX: falloff measures should also introduce some weighting variations, so that further-out points get less weight
+ /* XXX: review how the endpoints are treated by this algorithm. */
+ /* XXX: falloff measures should also introduce some weighting variations,
+ * so that further-out points get less weight. */
for (step = 1; step <= steps; step++) {
bGPDspoint *pt1, *pt2;
int before = i - step;
diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c
index 08162276a64..8a5a36481cf 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -300,7 +300,10 @@ PreviewImage *BKE_previewimg_copy(const PreviewImage *prv)
return prv_img;
}
-/** Duplicate preview image from \a id and clear icon_id, to be used by datablock copy functions. */
+/**
+ * Duplicate preview image from \a id and clear icon_id,
+ * to be used by datablock copy functions.
+ */
void BKE_previewimg_id_copy(ID *new_id, const ID *old_id)
{
PreviewImage **old_prv_p = BKE_previewimg_id_get_p(old_id);
@@ -534,8 +537,9 @@ void BKE_icon_changed(const int icon_id)
BLI_assert(icon->id_type != 0);
BLI_assert(icon->obj_type == ICON_DATA_ID);
- /* Do not enforce creation of previews for valid ID types using BKE_previewimg_id_ensure() here ,
- * we only want to ensure *existing* preview images are properly tagged as changed/invalid, that's all. */
+ /* Do not enforce creation of previews for valid ID types using BKE_previewimg_id_ensure()
+ * here, we only want to ensure *existing* preview images are properly tagged as
+ * changed/invalid, that's all. */
PreviewImage **p_prv = BKE_previewimg_id_get_p((ID *)icon->obj);
/* If we have previews, they all are now invalid changed. */
@@ -676,7 +680,8 @@ int BKE_icon_preview_ensure(ID *id, PreviewImage *preview)
return 0;
}
- /* Ensure we synchronize ID icon_id with its previewimage if available, and generate suitable 'ID' icon. */
+ /* Ensure we synchronize ID icon_id with its previewimage if available,
+ * and generate suitable 'ID' icon. */
if (id) {
id->icon_id = preview->icon_id;
return icon_id_ensure_create_icon(id);
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index aebed7e0e91..39e72d7e3a8 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -665,13 +665,14 @@ void IDP_MergeGroup(IDProperty *dest, const IDProperty *src, const bool do_overw
*
* The sanity check just means the property is not added to the group if another property
* exists with the same name; the client code using ID properties then needs to detect this
- * (the function that adds new properties to groups, IDP_AddToGroup, returns false if a property can't
- * be added to the group, and true if it can) and free the property.
+ * (the function that adds new properties to groups, #IDP_AddToGroup,
+ * returns false if a property can't be added to the group, and true if it can)
+ * and free the property.
*
* Currently the code to free ID properties is designed to leave the actual struct
* you pass it un-freed, this is needed for how the system works. This means
- * to free an ID property, you first call IDP_FreeProperty then MEM_freeN the
- * struct. In the future this will just be IDP_FreeProperty and the code will
+ * to free an ID property, you first call #IDP_FreeProperty then #MEM_freeN the struct.
+ * In the future this will just be #IDP_FreeProperty and the code will
* be reorganized to work properly.
*/
bool IDP_AddToGroup(IDProperty *group, IDProperty *prop)
@@ -787,7 +788,8 @@ IDProperty *IDP_CopyProperty(const IDProperty *prop)
}
/* Updates ID pointers after an object has been copied */
-/* TODO Nuke this once its only user has been correctly converted to use generic ID management from BKE_library! */
+/* TODO Nuke this once its only user has been correctly converted
+ * to use generic ID management from BKE_library! */
void IDP_RelinkProperty(struct IDProperty *prop)
{
if (!prop) {
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index eaf90bd4ebb..f23c58befdf 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -383,8 +383,10 @@ static void copy_image_packedfiles(ListBase *lb_dst, const ListBase *lb_src)
}
/**
- * Only copy internal data of Image ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of Image ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -5311,9 +5313,11 @@ bool BKE_image_remove_renderslot(Image *ima, ImageUser *iuser, int index)
next_slot = current_slot;
}
- /* If the slot to be removed is the slot with the last render, make another slot the last render slot. */
+ /* If the slot to be removed is the slot with the last render,
+ * make another slot the last render slot. */
if (remove_slot == current_last_slot) {
- /* Choose the currently selected slot unless that one is being removed, in that case take the next one. */
+ /* Choose the currently selected slot unless that one is being removed,
+ * in that case take the next one. */
RenderSlot *next_last_slot;
if (current_slot == remove_slot) {
next_last_slot = next_slot;
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index d641229d5e0..a05fbe5d77b 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -337,7 +337,8 @@ static const char *constraint_adrcodes_to_paths(int adrcode, int *array_index)
switch (adrcode) {
case CO_ENFORCE:
return "influence";
- case CO_HEADTAIL: // XXX this needs to be wrapped in RNA.. probably then this path will be invalid
+ case CO_HEADTAIL:
+ /* XXX this needs to be wrapped in RNA.. probably then this path will be invalid. */
return "data.head_tail";
}
@@ -685,12 +686,13 @@ static const char *camera_adrcodes_to_paths(int adrcode, int *array_index)
/* result depends on adrcode */
switch (adrcode) {
case CAM_LENS:
-#if 0 // XXX this cannot be resolved easily... perhaps we assume camera is perspective (works for most cases...
+#if 0 /* XXX this cannot be resolved easily...
+ * perhaps we assume camera is perspective (works for most cases... */
if (ca->type == CAM_ORTHO)
return "ortho_scale";
else
return "lens";
-#else // XXX lazy hack for now...
+#else // XXX lazy hack for now...
return "lens";
#endif // XXX this cannot be resolved easily
@@ -775,7 +777,8 @@ static const char *sound_adrcodes_to_paths(int adrcode, int *array_index)
return "volume";
case SND_PITCH:
return "pitch";
- /* XXX Joshua -- I had wrapped panning in rna, but someone commented out, calling it "unused" */
+ /* XXX Joshua -- I had wrapped panning in rna,
+ * but someone commented out, calling it "unused" */
#if 0
case SND_PANNING:
return "panning";
@@ -912,14 +915,17 @@ 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
+/* 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
+ * - 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...
+ * - array_index - index in property's array (if applicable) to use
+ * - return - the allocated path...
*/
static char *get_rna_access(ID *id,
int blocktype,
@@ -1022,7 +1028,8 @@ static char *get_rna_access(ID *id,
}
/* 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 */
@@ -1053,7 +1060,8 @@ static char *get_rna_access(ID *id,
buf[0] = '\0'; /* empty string */
}
else if ((blocktype == ID_KE) && STREQ(actname, "Shape")) {
- /* Actionified "Shape" IPO's - these are forced onto object level via the action container there... */
+ /* Actionified "Shape" IPO's -
+ * these are forced onto object level via the action container there... */
strcpy(buf, "data.shape_keys");
}
else {
@@ -1257,7 +1265,8 @@ static void fcurve_add_to_list(
}
/* add F-Curve to group */
- /* WARNING: this func should only need to look at the stuff we initialized, if not, things may crash */
+ /* WARNING: this func should only need to look at the stuff we initialized,
+ * if not, things may crash. */
action_groups_add_channel(&tmp_act, agrp, fcu);
if (agrp->flag & AGRP_MUTED) { /* flush down */
@@ -1276,11 +1285,14 @@ static void fcurve_add_to_list(
}
}
-/* Convert IPO-Curve to F-Curve (including Driver data), and free any of the old data that
+/**
+ * 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
- * seq: sequencer-strip (if applicable) that IPO-Curve's IPO-block belonged to
+ *
+ * \param actname: name of Action-Channel (if applicable) that IPO-Curve's IPO-block belonged to.
+ * \param constname: name of Constraint-Channel (if applicable)
+ * that IPO-Curve's IPO-block belonged to \a seq.
+ * \param seq: sequencer-strip (if applicable) that IPO-Curve's IPO-block belonged to.
*/
static void icu_to_fcurves(ID *id,
ListBase *groups,
@@ -1385,9 +1397,11 @@ static void icu_to_fcurves(ID *id,
fcurve->rna_path = BLI_strdup(abp->path);
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)
+ /* 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).
*/
fcurve->totvert = icu->totvert;
@@ -1428,7 +1442,8 @@ static void icu_to_fcurves(ID *id,
}
}
else if (icu->bp) {
- /* TODO: need to convert from BPoint type to the more compact FPoint type... but not priority, since no data used this */
+ /* TODO: need to convert from BPoint type to the more compact FPoint type...
+ * but not priority, since no data used this. */
//BPoint *bp;
//FPoint *fpt;
}
@@ -1449,9 +1464,10 @@ static void icu_to_fcurves(ID *id,
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)
+ /* 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).
*/
fcu->totvert = icu->totvert;
@@ -1548,7 +1564,8 @@ static void icu_to_fcurves(ID *id,
}
}
else if (icu->bp) {
- /* TODO: need to convert from BPoint type to the more compact FPoint type... but not priority, since no data used this */
+ /* TODO: need to convert from BPoint type to the more compact FPoint type...
+ * but not priority, since no data used this */
//BPoint *bp;
//FPoint *fpt;
}
@@ -1602,10 +1619,11 @@ static void ipo_to_animato(ID *id,
/* loop over IPO-Curves, freeing as we progress */
for (icu = ipo->curve.first; icu; icu = icu->next) {
/* Since an IPO-Curve may end up being made into many F-Curves (i.e. bitflag curves),
- * we figure out the best place to put the channel, then tell the curve-converter to just dump there
- */
+ * we figure out the best place to put the channel,
+ * then tell the curve-converter to just dump there. */
if (icu->driver) {
- /* Blender 2.4x allowed empty drivers, but we don't now, since they cause more trouble than they're worth */
+ /* Blender 2.4x allowed empty drivers,
+ * but we don't now, since they cause more trouble than they're worth. */
if ((icu->driver->ob) || (icu->driver->type == IPO_DRIVER_TYPE_PYTHON)) {
icu_to_fcurves(id, NULL, drivers, icu, actname, constname, seq, ipo->muteipo);
}
@@ -1734,9 +1752,9 @@ static void ipo_to_animdata(
BLI_listbase_count(&ipo->curve));
}
- /* Convert curves to animato system (separated into separate lists of F-Curves for animation and drivers),
- * and the try to put these lists in the right places, but do not free the lists here
- */
+ /* Convert curves to animato system
+ * (separated into separate lists of F-Curves for animation and drivers),
+ * and the try to put these lists in the right places, but do not free the lists here. */
// XXX there shouldn't be any need for the groups, so don't supply pointer for that now...
ipo_to_animato(id, ipo, actname, constname, seq, NULL, &anim, &drivers);
@@ -1819,7 +1837,8 @@ static void nlastrips_to_animdata(ID *id, ListBase *strips)
/* convert Action data (if not yet converted), storing the results in the same Action */
action_to_animato(id, as->act, &as->act->groups, &as->act->curves, &adt->drivers);
- /* create a new-style NLA-strip which references this Action, then copy over relevant settings */
+ /* 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
@@ -2295,12 +2314,12 @@ void do_versions_ipos_to_animato(Main *bmain)
/* --------- Unconverted Animation Data ------------------ */
/* For Animation data which may not be directly connected (i.e. not linked) to any other
* data, we need to perform a separate pass to make sure that they are converted to standalone
- * Actions which may then be able to be reused. This does mean that we will be going over data that's
- * already been converted, but there are no problems with that.
+ * Actions which may then be able to be reused. This does mean that we will be going over data
+ * that's already been converted, but there are no problems with that.
*
* The most common case for this will be Action Constraints, or IPO's with Fake-Users.
- * We collect all drivers that were found into a temporary collection, and free them in one go, as they're
- * impossible to resolve.
+ * We collect all drivers that were found into a temporary collection, and free them in one go,
+ * as they're impossible to resolve.
*/
/* actions */
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index e0246f874f3..61de6a8c06a 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -151,8 +151,10 @@ Key *BKE_key_add(Main *bmain, ID *id) /* common function */
}
/**
- * Only copy internal data of ShapeKey ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of ShapeKey ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -2254,8 +2256,9 @@ void BKE_keyblock_update_from_offset(Object *ob, KeyBlock *kb, float (*ofs)[3])
/* ==========================================================*/
-/** Move shape key from org_index to new_index. Safe, clamps index to valid range, updates reference keys,
- * the object's active shape index, the 'frame' value in case of absolute keys, etc.
+/** Move shape key from org_index to new_index. Safe, clamps index to valid range,
+ * updates reference keys, the object's active shape index,
+ * the 'frame' value in case of absolute keys, etc.
* Note indices are expected in real values (not 'fake' shapenr +1 ones).
*
* \param org_index: if < 0, current object's active shape will be used as skey to move.
@@ -2283,8 +2286,8 @@ bool BKE_keyblock_move(Object *ob, int org_index, int new_index)
rev = ((new_index - org_index) < 0) ? true : false;
- /* We swap 'org' element with its previous/next neighbor (depending on direction of the move) repeatedly,
- * until we reach final position.
+ /* We swap 'org' element with its previous/next neighbor (depending on direction of the move)
+ * repeatedly, until we reach final position.
* This allows us to only loop on the list once! */
for (kb = (rev ? key->block.last : key->block.first), i = (rev ? totkey - 1 : 0); kb;
kb = (rev ? kb->prev : kb->next), rev ? i-- : i++) {
@@ -2321,7 +2324,8 @@ bool BKE_keyblock_move(Object *ob, int org_index, int new_index)
}
}
- /* Need to update active shape number if it's affected, same principle as for relative indices above. */
+ /* Need to update active shape number if it's affected,
+ * same principle as for relative indices above. */
if (org_index == act_index) {
ob->shapenr = new_index + 1;
}
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 5570d39f43f..c9a0cf50e65 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -268,8 +268,10 @@ Lattice *BKE_lattice_add(Main *bmain, const char *name)
}
/**
- * Only copy internal data of Lattice ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of Lattice ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -681,8 +683,8 @@ static bool calc_curve_deform(
if (cd->no_rot_axis) { /* set by caller */
- /* this is not exactly the same as 2.4x, since the axis is having rotation removed rather than
- * changing the axis before calculating the tilt but serves much the same purpose */
+ /* This is not exactly the same as 2.4x, since the axis is having rotation removed rather
+ * than changing the axis before calculating the tilt but serves much the same purpose. */
float dir_flat[3] = {0, 0, 0}, q[4];
copy_v3_v3(dir_flat, dir);
dir_flat[cd->no_rot_axis - 1] = 0.0f;
@@ -699,8 +701,10 @@ static bool calc_curve_deform(
*
* The way 'co' is copied to 'cent' may seem to have no meaning, but it does.
*
- * Use a curve modifier to stretch a cube out, color each side RGB, positive side light, negative dark.
- * view with X up (default), from the angle that you can see 3 faces RGB colors (light), anti-clockwise
+ * Use a curve modifier to stretch a cube out, color each side RGB,
+ * positive side light, negative dark.
+ * view with X up (default), from the angle that you can see 3 faces RGB colors (light),
+ * anti-clockwise
* Notice X,Y,Z Up all have light colors and each ordered CCW.
*
* Now for Neg Up XYZ, the colors are all dark, and ordered clockwise - Campbell
@@ -1061,7 +1065,8 @@ void BKE_lattice_vertexcos_apply(struct Object *ob, float (*vertexCos)[3])
void BKE_lattice_modifiers_calc(struct Depsgraph *depsgraph, Scene *scene, Object *ob)
{
Lattice *lt = ob->data;
- /* Get vertex coordinates from the original copy; otherwise we get already-modified coordinates. */
+ /* Get vertex coordinates from the original copy;
+ * otherwise we get already-modified coordinates. */
Object *ob_orig = DEG_get_original_object(ob);
VirtualModifierData virtualModifierData;
ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData);
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index f0c2c1e5477..6f43a57584d 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -1100,7 +1100,8 @@ static void layer_collection_bases_hide_recursive(ViewLayer *view_layer, LayerCo
/**
* Hide/show all the elements of a collection.
- * Don't change the collection children enable/disable state, but it may change it for the collection itself.
+ * Don't change the collection children enable/disable state,
+ * but it may change it for the collection itself.
*
* Return true if depsgraph needs update.
*/
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index ca73415b962..ad0c405ab28 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -170,11 +170,14 @@ void id_lib_extern(ID *id)
}
}
-/* ensure we have a real user */
-/* Note: Now that we have flags, we could get rid of the 'fake_user' special case, flags are enough to ensure
- * we always have a real user.
- * However, ID_REAL_USERS is used in several places outside of core library.c, so think we can wait later
- * to make this change... */
+/**
+ * Ensure we have a real user
+ *
+ * \note Now that we have flags, we could get rid of the 'fake_user' special case,
+ * flags are enough to ensure we always have a real user.
+ * However, #ID_REAL_USERS is used in several places outside of core library.c,
+ * so think we can wait later to make this change.
+ */
void id_us_ensure_real(ID *id)
{
if (id) {
@@ -254,7 +257,8 @@ void id_us_min(ID *id)
}
if ((id->us == limit) && (id->tag & LIB_TAG_EXTRAUSER)) {
- /* We need an extra user here, but never actually incremented user count for it so far, do it now. */
+ /* We need an extra user here, but never actually incremented user count for it so far,
+ * do it now. */
id_us_ensure_real(id);
}
}
@@ -293,7 +297,8 @@ static int id_expand_local_callback(void *UNUSED(user_data),
return IDWALK_RET_NOP;
}
- /* Can happen that we get unlinkable ID here, e.g. with shapekey referring to itself (through drivers)...
+ /* Can happen that we get un-linkable ID here, e.g. with shape-key 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))) {
@@ -304,7 +309,8 @@ static int id_expand_local_callback(void *UNUSED(user_data),
}
/**
- * Expand ID usages of given id as 'extern' (and no more indirect) linked data. Used by ID copy/make_local functions.
+ * Expand ID usages of given id as 'extern' (and no more indirect) linked data.
+ * Used by ID copy/make_local functions.
*/
void BKE_id_expand_local(Main *bmain, ID *id)
{
@@ -335,7 +341,8 @@ void BKE_id_make_local_generic(Main *bmain,
/* - only lib users: do nothing (unless force_local is set)
* - only local users: set flag
* - mixed: make copy
- * In case we make a whole lib's content local, we always want to localize, and we skip remapping (done later).
+ * In case we make a whole lib's content local,
+ * we always want to localize, and we skip remapping (done later).
*/
if (!ID_IS_LINKED(id)) {
@@ -352,7 +359,8 @@ void BKE_id_make_local_generic(Main *bmain,
else {
ID *id_new;
- /* Should not fail in expected usecases, but a few ID types cannot be copied (LIB, WM, SCR...). */
+ /* Should not fail in expected use cases,
+ * but a few ID types cannot be copied (LIB, WM, SCR...). */
if (BKE_id_copy(bmain, id, &id_new)) {
id_new->us = 0;
@@ -380,13 +388,15 @@ void BKE_id_make_local_generic(Main *bmain,
*
* \note Always set ID->newid pointer in case it gets duplicated...
*
- * \param lib_local: Special flag used when making a whole library's content local, it needs specific handling.
+ * \param lib_local: Special flag used when making a whole library's content local,
+ * it needs specific handling.
*
* \return true if the block can be made local.
*/
bool id_make_local(Main *bmain, ID *id, const bool test, const bool lib_local)
{
- /* We don't care whether ID is directly or indirectly linked in case we are making a whole lib local... */
+ /* We don't care whether ID is directly or indirectly linked
+ * in case we are making a whole lib local... */
if (!lib_local && (id->tag & LIB_TAG_INDIRECT)) {
return false;
}
@@ -601,15 +611,18 @@ bool BKE_id_copy_is_allowed(const ID *id)
/**
* Generic entry point for copying a datablock (new API).
*
- * \note Copy is only affecting given data-block (no ID used by copied one will be affected, besides usercount).
- * There is only one exception, if LIB_ID_COPY_ACTIONS is defined, actions used by animdata will be duplicated.
+ * \note Copy is only affecting given data-block
+ * (no ID used by copied one will be affected, besides usercount).
+ * There is only one exception, if #LIB_ID_COPY_ACTIONS is defined,
+ * actions used by animdata will be duplicated.
*
* \note Usercount of new copy is always set to 1.
*
* \param bmain: Main database, may be NULL only if LIB_ID_CREATE_NO_MAIN is specified.
* \param id: Source datablock.
* \param r_newid: Pointer to new (copied) ID pointer.
- * \param flag: Set of copy options, see DNA_ID.h enum for details (leave to zero for default, full copy).
+ * \param flag: Set of copy options, see DNA_ID.h enum for details
+ * (leave to zero for default, full copy).
* \return False when copying that ID type is not supported, true otherwise.
*/
bool BKE_id_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int flag)
@@ -848,7 +861,8 @@ bool id_single_user(bContext *C, ID *id, PointerRNA *ptr, PropertyRNA *prop)
PointerRNA idptr;
if (id) {
- /* if property isn't editable, we're going to have an extra block hanging around until we save */
+ /* If property isn't editable,
+ * we're going to have an extra block hanging around until we save. */
if (RNA_property_editable(ptr, prop)) {
Main *bmain = CTX_data_main(C);
/* copy animation actions too */
@@ -1372,7 +1386,9 @@ void *BKE_id_new(Main *bmain, const short type, const char *name)
return id;
}
-/** Generic helper to create a new temporary empty datablock of given type, *outside* of any Main database.
+/**
+ * Generic helper to create a new temporary empty datablock of given type,
+ * *outside* of any Main database.
*
* \param name: can be NULL, in which case we get default name for this ID type. */
void *BKE_id_new_nomain(const short type, const char *name)
@@ -1743,7 +1759,8 @@ void id_clear_lib_data_ex(Main *bmain, ID *id, const bool id_in_mainlist)
}
}
- /* Internal bNodeTree blocks inside datablocks also stores id->lib, make sure this stays in sync. */
+ /* Internal bNodeTree blocks inside datablocks also stores id->lib,
+ * make sure this stays in sync. */
if ((ntree = ntreeFromID(id))) {
id_clear_lib_data_ex(bmain, &ntree->id, false); /* Datablocks' nodetree is never in Main. */
}
@@ -1788,14 +1805,15 @@ static void library_make_local_copying_check(ID *id,
/* Our oh-so-beloved 'from' pointers... */
if (entry->usage_flag & IDWALK_CB_LOOPBACK) {
- /* We totally disregard Object->proxy_from 'usage' here, this one would only generate fake positives. */
+ /* We totally disregard Object->proxy_from 'usage' here,
+ * this one would only generate fake positives. */
if (GS(par_id->name) == ID_OB) {
BLI_assert(((Object *)par_id)->proxy_from == (Object *)id);
continue;
}
- /* Shapekeys are considered 'private' to their owner ID here, and never tagged (since they cannot be linked),
- * so we have to switch effective parent to their owner. */
+ /* Shapekeys are considered 'private' to their owner ID here, and never tagged
+ * (since they cannot be linked), * so we have to switch effective parent to their owner. */
if (GS(par_id->name) == ID_KE) {
par_id = ((Key *)par_id)->from;
}
@@ -1809,8 +1827,9 @@ static void library_make_local_copying_check(ID *id,
if (BLI_gset_haskey(loop_tags, par_id)) {
/* We are in a 'dependency loop' of IDs, this does not say us anything, skip it.
* Note that this is the situation that can lead to archipelagoes of linked data-blocks
- * (since all of them have non-local users, they would all be duplicated, leading to a loop of unused
- * linked data-blocks that cannot be freed since they all use each other...). */
+ * (since all of them have non-local users, they would all be duplicated,
+ * leading to a loop of unused linked data-blocks that cannot be freed since they all use
+ * each other...). */
continue;
}
/* Else, recursively check that user ID. */
@@ -1818,10 +1837,12 @@ static void library_make_local_copying_check(ID *id,
}
if (par_id->tag & LIB_TAG_DOIT) {
- /* This user will be fully local in future, so far so good, nothing to do here but check next user. */
+ /* This user will be fully local in future, so far so good,
+ * nothing to do here but check next user. */
}
else {
- /* This user won't be fully local in future, so current ID won't be either. And we are done checking it. */
+ /* This user won't be fully local in future, so current ID won't be either.
+ * And we are done checking it. */
id->tag &= ~LIB_TAG_DOIT;
break;
}
@@ -1835,15 +1856,16 @@ static void library_make_local_copying_check(ID *id,
* \param bmain: Almost certainly global main.
* \param lib: If not NULL, only make local datablocks from this library.
* \param untagged_only: If true, only make local datablocks not tagged with LIB_TAG_PRE_EXISTING.
- * \param set_fake: If true, set fake user on all localized datablocks (except group and objects ones).
+ * \param set_fake: If true, set fake user on all localized data-blocks
+ * (except group and objects ones).
*/
-/* Note: Old (2.77) version was simply making (tagging) datablocks as local, without actually making any check whether
- * they were also indirectly used or not...
+/* Note: Old (2.77) version was simply making (tagging) data-blocks as local,
+ * without actually making any check whether * they were also indirectly used or not...
*
- * Current version uses regular id_make_local callback, with advanced pre-processing step to detect all cases of
- * IDs currently indirectly used, but which will be used by local data only once this function is finished.
- * This allows to avoid any unneeded duplication of IDs, and hence all time lost afterwards to remove
- * orphaned linked data-blocks...
+ * Current version uses regular id_make_local callback, with advanced pre-processing step to detect
+ * all cases of IDs currently indirectly used, but which will be used by local data only once this
+ * function is finished. This allows to avoid any unneeded duplication of IDs, and hence all time
+ * lost afterwards to remove orphaned linked data-blocks...
*/
void BKE_library_make_local(Main *bmain,
const Library *lib,
@@ -1874,8 +1896,8 @@ void BKE_library_make_local(Main *bmain,
for (int a = set_listbasepointers(bmain, lbarray); a--;) {
ID *id = lbarray[a]->first;
- /* Do not explicitly make local non-linkable IDs (shapekeys, in fact), they are assumed to be handled
- * by real datablocks responsible of them. */
+ /* Do not explicitly make local non-linkable IDs (shapekeys, in fact),
+ * they are assumed to be handled by real datablocks responsible of them. */
const bool do_skip = (id && !BKE_idcode_is_linkable(GS(id->name)));
for (; id; id = id->next) {
@@ -1889,14 +1911,17 @@ void BKE_library_make_local(Main *bmain,
if (id->lib == NULL) {
id->tag &= ~(LIB_TAG_EXTERN | LIB_TAG_INDIRECT | LIB_TAG_NEW);
}
- /* The check on the fourth line (LIB_TAG_PRE_EXISTING) is done so its possible to tag data you don't want to
- * be made local, used for appending data, so any libdata already linked wont become local (very nasty
+ /* The check on the fourth line (LIB_TAG_PRE_EXISTING) is done so it's possible to tag data
+ * you don't want to be made local, used for appending data,
+ * so any libdata already linked wont become local (very nasty
* to discover all your links are lost after appending).
* Also, never ever make proxified objects local, would not make any sense. */
/* Some more notes:
* - Shapekeys are never tagged here (since they are not linkable).
- * - Nodetrees used in materials etc. have to be tagged manually, since they do not exist in Main (!).
- * This is ok-ish on 'make local' side of things (since those are handled by their 'owner' IDs),
+ * - Nodetrees used in materials etc. have to be tagged manually,
+ * since they do not exist in Main (!).
+ * This is ok-ish on 'make local' side of things
+ * (since those are handled by their 'owner' IDs),
* but complicates slightly the pre-processing of relations between IDs at step 2... */
else if (!do_skip && id->tag & (LIB_TAG_EXTERN | LIB_TAG_INDIRECT | LIB_TAG_NEW) &&
ELEM(lib, NULL, id->lib) &&
@@ -1905,8 +1930,9 @@ void BKE_library_make_local(Main *bmain,
BLI_linklist_prepend_arena(&todo_ids, id, linklist_mem);
id->tag |= LIB_TAG_DOIT;
- /* Tag those nasty non-ID nodetrees, but do not add them to todo list, making them local is handled
- * by 'owner' ID. This is needed for library_make_local_copying_check() to work OK at step 2. */
+ /* Tag those nasty non-ID nodetrees,
+ * but do not add them to todo list, making them local is handled by 'owner' ID.
+ * This is needed for library_make_local_copying_check() to work OK at step 2. */
if (ntree != NULL) {
ntree->tag |= LIB_TAG_DOIT;
}
@@ -1923,8 +1949,9 @@ void BKE_library_make_local(Main *bmain,
TIMEIT_VALUE_PRINT(make_local);
#endif
- /* Step 2: Check which datablocks we can directly make local (because they are only used by already, or future,
- * local data), others will need to be duplicated. */
+ /* Step 2: Check which datablocks we can directly make local
+ * (because they are only used by already, or future, local data),
+ * others will need to be duplicated. */
GSet *loop_tags = BLI_gset_ptr_new(__func__);
for (LinkNode *it = todo_ids; it; it = it->next) {
library_make_local_copying_check(it->link, loop_tags, bmain->relations, done_ids);
@@ -1942,15 +1969,17 @@ void BKE_library_make_local(Main *bmain,
#endif
/* Step 3: Make IDs local, either directly (quick and simple), or using generic process,
- * which involves more complex checks and might instead create a local copy of original linked ID. */
+ * which involves more complex checks and might instead
+ * create a local copy of original linked ID. */
for (LinkNode *it = todo_ids, *it_next; it; it = it_next) {
it_next = it->next;
ID *id = it->link;
if (id->tag & LIB_TAG_DOIT) {
- /* We know all users of this object are local or will be made fully local, even if currently there are
- * some indirect usages. So instead of making a copy that we'll likely get rid of later, directly make
- * that data block local. Saves a tremendous amount of time with complex scenes... */
+ /* We know all users of this object are local or will be made fully local, even if currently
+ * there are some indirect usages. So instead of making a copy that we'll likely get rid of
+ * later, directly make that data block local.
+ * Saves a tremendous amount of time with complex scenes... */
id_clear_lib_data_ex(bmain, id, true);
BKE_id_expand_local(bmain, id);
id->tag &= ~LIB_TAG_DOIT;
@@ -1986,16 +2015,19 @@ void BKE_library_make_local(Main *bmain,
TIMEIT_VALUE_PRINT(make_local);
#endif
- /* At this point, we are done with directly made local IDs. Now we have to handle duplicated ones, since their
+ /* At this point, we are done with directly made local IDs.
+ * Now we have to handle duplicated ones, since their
* remaining linked original counterpart may not be needed anymore... */
todo_ids = NULL;
- /* Step 4: We have to remap local usages of old (linked) ID to new (local) ID in a separated loop,
+ /* Step 4: We have to remap local usages of old (linked) ID to new (local)
+ * ID in a separated loop,
* as lbarray ordering is not enough to ensure us we did catch all dependencies
* (e.g. if making local a parent object before its child...). See T48907. */
- /* TODO This is now the biggest step by far (in term of processing time). We may be able to gain here by
- * using again main->relations mapping, but... this implies BKE_libblock_remap & co to be able to update
- * main->relations on the fly. Have to think about it a bit more, and see whether new code is OK first, anyway. */
+ /* TODO This is now the biggest step by far (in term of processing time).
+ * We may be able to gain here by using again main->relations mapping, but...
+ * this implies BKE_libblock_remap & co to be able to update main->relations on the fly.
+ * Have to think about it a bit more, and see whether new code is OK first, anyway. */
for (LinkNode *it = copied_ids; it; it = it->next) {
ID *id = it->link;
@@ -2076,10 +2108,11 @@ void BKE_library_make_local(Main *bmain,
#endif
/* This is probably more of a hack than something we should do here, but...
- * Issue is, the whole copying + remapping done in complex cases above may leave pose channels of armatures
- * in complete invalid state (more precisely, the bone pointers of the pchans - very crappy cross-datablocks
- * relationship), se we tag it to be fully recomputed, but this does not seems to be enough in some cases,
- * and evaluation code ends up trying to evaluate a not-yet-updated armature object's deformations.
+ * Issue is, the whole copying + remapping done in complex cases above may leave pose-channels of
+ * armatures in complete invalid state (more precisely, the bone pointers of the pose-channels -
+ * very crappy cross-data-blocks relationship), se we tag it to be fully recomputed,
+ * but this does not seems to be enough in some cases, and evaluation code ends up trying to
+ * evaluate a not-yet-updated armature object's deformations.
* Try "make all local" in 04_01_H.lighting.blend from Agent327 without this, e.g. */
for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->data != NULL && ob->type == OB_ARMATURE && ob->pose != NULL &&
@@ -2160,7 +2193,8 @@ void BKE_libblock_rename(Main *bmain, ID *id, const char *name)
*
* \note Result is unique to a given ID type in a given Main database.
*
- * \param name: An allocated string of minimal length MAX_ID_FULL_NAME, will be filled with generated string.
+ * \param name: An allocated string of minimal length #MAX_ID_FULL_NAME,
+ * will be filled with generated string.
*/
void BKE_id_full_name_get(char name[MAX_ID_FULL_NAME], const ID *id)
{
@@ -2179,12 +2213,14 @@ void BKE_id_full_name_get(char name[MAX_ID_FULL_NAME], const ID *id)
}
/**
- * Generate full name of the data-block (without ID code, but with library if any), with a 3-character prefix prepended
- * indicating whether it comes from a library, is overriding, has a fake or no user, etc.
+ * Generate full name of the data-block (without ID code, but with library if any),
+ * with a 3-character prefix prepended indicating whether it comes from a library,
+ * is overriding, has a fake or no user, etc.
*
* \note Result is unique to a given ID type in a given Main database.
*
- * \param name: An allocated string of minimal length MAX_ID_FULL_NAME_UI, will be filled with generated string.
+ * \param name: An allocated string of minimal length #MAX_ID_FULL_NAME_UI,
+ * will be filled with generated string.
*/
void BKE_id_full_name_ui_prefix_get(char name[MAX_ID_FULL_NAME_UI], const ID *id)
{
@@ -2232,8 +2268,8 @@ void BKE_library_filepath_set(Main *bmain, Library *lib, const char *filepath)
* outliner, and its not really supported but allow from here for now
* since making local could cause this to be directly linked - campbell
*/
- /* Never make paths relative to parent lib - reading code (blenloader) always set *all* lib->name relative to
- * current main, not to their parent for indirectly linked ones. */
+ /* Never make paths relative to parent lib - reading code (blenloader) always set *all*
+ * lib->name relative to current main, not to their parent for indirectly linked ones. */
const char *basepath = BKE_main_blendfile_path(bmain);
BLI_path_abs(lib->filepath, basepath);
}
diff --git a/source/blender/blenkernel/intern/library_idmap.c b/source/blender/blenkernel/intern/library_idmap.c
index d520df31a75..cc7e2e31d07 100644
--- a/source/blender/blenkernel/intern/library_idmap.c
+++ b/source/blender/blenkernel/intern/library_idmap.c
@@ -182,7 +182,8 @@ ID *BKE_main_idmap_lookup(struct IDNameLib_Map *id_map,
ID *BKE_main_idmap_lookup_id(struct IDNameLib_Map *id_map, const ID *id)
{
/* When used during undo/redo, this function cannot assume that given id points to valid memory
- * (i.e. has not been freed), so it has to check that it does exist in 'old' (aka current) Main database.
+ * (i.e. has not been freed),
+ * so it has to check that it does exist in 'old' (aka current) Main database.
* Otherwise, we cannot provide new ID pointer that way (would crash accessing freed memory
* when trying to get ID name).
*/
diff --git a/source/blender/blenkernel/intern/library_override.c b/source/blender/blenkernel/intern/library_override.c
index 30307eb1266..5ed6577e90a 100644
--- a/source/blender/blenkernel/intern/library_override.c
+++ b/source/blender/blenkernel/intern/library_override.c
@@ -55,7 +55,8 @@ static void bke_override_property_operation_copy(IDOverrideStaticPropertyOperati
static void bke_override_property_clear(IDOverrideStaticProperty *op);
static void bke_override_property_operation_clear(IDOverrideStaticPropertyOperation *opop);
-/* Temp, for until static override is ready and tested enough to go 'public', we hide it by default in UI and such. */
+/* Temp, for until static override is ready and tested enough to go 'public',
+ * we hide it by default in UI and such. */
static bool _override_static_enabled = false;
void BKE_override_static_enable(const bool do_enable)
@@ -189,7 +190,8 @@ ID *BKE_override_static_create_from_id(Main *bmain, ID *reference_id)
ID *local_id = override_static_create_from(bmain, reference_id);
- /* Remapping, we obviously only want to affect local data (and not our own reference pointer to overridden ID). */
+ /* Remapping, we obviously only want to affect local data
+ * (and not our own reference pointer to overridden ID). */
BKE_libblock_remap(
bmain, reference_id, local_id, ID_REMAP_SKIP_INDIRECT_USAGE | ID_REMAP_SKIP_STATIC_OVERRIDE);
@@ -198,8 +200,8 @@ ID *BKE_override_static_create_from_id(Main *bmain, ID *reference_id)
/** Create overridden local copies of all tagged data-blocks in given Main.
*
- * \note Set id->newid of overridden libs with newly created overrides, caller is responsible to clean those pointers
- * before/after usage as needed.
+ * \note Set id->newid of overridden libs with newly created overrides,
+ * caller is responsible to clean those pointers before/after usage as needed.
*
* \return \a true on success, \a false otherwise.
*/
@@ -474,11 +476,11 @@ void BKE_override_static_property_operation_delete(
/**
* Check that status of local data-block is still valid against current reference one.
*
- * It means that all overridable, but not overridden, properties' local values must be equal to reference ones.
- * Clears LIB_TAG_OVERRIDE_OK if they do not.
+ * It means that all overridable, but not overridden, properties' local values must be equal to
+ * reference ones. Clears #LIB_TAG_OVERRIDE_OK if they do not.
*
- * This is typically used to detect whether some property has been changed in local and a new IDOverrideProperty
- * (of IDOverridePropertyOperation) has to be added.
+ * This is typically used to detect whether some property has been changed in local and a new
+ * #IDOverrideProperty (of #IDOverridePropertyOperation) has to be added.
*
* \return true if status is OK, false otherwise. */
bool BKE_override_static_status_check_local(Main *bmain, ID *local)
@@ -521,7 +523,8 @@ bool BKE_override_static_status_check_local(Main *bmain, ID *local)
* It means that all non-overridden properties' local values must be equal to reference ones.
* Clears LIB_TAG_OVERRIDE_OK if they do not.
*
- * This is typically used to detect whether some reference has changed and local needs to be updated against it.
+ * This is typically used to detect whether some reference has changed and local
+ * needs to be updated against it.
*
* \return true if status is OK, false otherwise. */
bool BKE_override_static_status_check_reference(Main *bmain, ID *local)
@@ -569,12 +572,13 @@ bool BKE_override_static_status_check_reference(Main *bmain, ID *local)
* Compares local and reference data-blocks and create new override operations as needed,
* or reset to reference values if overriding is not allowed.
*
- * \note Defining override operations is only mandatory before saving a .blend file on disk (not for undo!).
+ * \note Defining override operations is only mandatory before saving a `.blend` file on disk
+ * (not for undo!).
* Knowing that info at runtime is only useful for UI/UX feedback.
*
- * \note This is by far the biggest operation (the more time-consuming) of the three so far, since it has to go over
- * all properties in depth (all overridable ones at least). Generating diff values and applying overrides
- * are much cheaper.
+ * \note This is by far the biggest operation (the more time-consuming) of the three so far,
+ * since it has to go over all properties in depth (all overridable ones at least).
+ * Generating diff values and applying overrides are much cheaper.
*
* \return true if new overriding op was created, or some local data was reset. */
bool BKE_override_static_operations_create(Main *bmain, ID *local, const bool force_auto)
@@ -642,19 +646,20 @@ void BKE_override_static_update(Main *bmain, ID *local)
BKE_override_static_update(bmain, local->override_static->reference);
}
- /* We want to avoid having to remap here, however creating up-to-date override is much simpler if based
- * on reference than on current override.
+ /* We want to avoid having to remap here, however creating up-to-date override is much simpler
+ * if based on reference than on current override.
* So we work on temp copy of reference, and 'swap' its content with local. */
/* XXX We need a way to get off-Main copies of IDs (similar to localized mats/texts/ etc.)!
- * However, this is whole bunch of code work in itself, so for now plain stupid ID copy will do,
- * as innefficient as it is. :/
- * Actually, maybe not! Since we are swapping with original ID's local content, we want to keep
- * usercount in correct state when freeing tmp_id (and that usercounts of IDs used by 'new' local data
- * also remain correct). */
- /* This would imply change in handling of usercout all over RNA (and possibly all over Blender code).
- * Not impossible to do, but would rather see first if extra useless usual user handling is actually
- * a (performances) issue here. */
+ * However, this is whole bunch of code work in itself, so for now plain stupid ID copy will
+ * do, as inn-efficient as it is. :/
+ * Actually, maybe not! Since we are swapping with original ID's local content, we want to
+ * keep user-count in correct state when freeing tmp_id
+ * (and that user-counts of IDs used by 'new' local data also remain correct). */
+ /* This would imply change in handling of usercout all over RNA
+ * (and possibly all over Blender code).
+ * Not impossible to do, but would rather see first if extra useless usual user handling
+ * is actually a (performances) issue here. */
ID *tmp_id;
BKE_id_copy(bmain, local->override_static->reference, &tmp_id);
@@ -674,11 +679,12 @@ void BKE_override_static_update(Main *bmain, ID *local)
RNA_struct_override_apply(
bmain, &rnaptr_dst, &rnaptr_src, rnaptr_storage, local->override_static);
- /* This also transfers all pointers (memory) owned by local to tmp_id, and vice-versa. So when we'll free tmp_id,
- * we'll actually free old, outdated data from local. */
+ /* This also transfers all pointers (memory) owned by local to tmp_id, and vice-versa.
+ * So when we'll free tmp_id, we'll actually free old, outdated data from local. */
BKE_id_swap(bmain, local, tmp_id);
- /* Again, horribly innefficient in our case, we need something off-Main (aka moar generic nolib copy/free stuff)! */
+ /* Again, horribly inn-efficient in our case, we need something off-Main
+ * (aka more generic nolib copy/free stuff)! */
/* XXX And crashing in complex cases (e.g. because depsgraph uses same data...). */
BKE_id_free_ex(bmain, tmp_id, LIB_ID_FREE_NO_UI_USER, true);
@@ -711,18 +717,21 @@ void BKE_main_override_static_update(Main *bmain)
FOREACH_MAIN_ID_END;
}
-/***********************************************************************************************************************
- * Storage (how to wtore overriding data into .blend files).
+/**
+ * Storage (how to store overriding data into `.blend` files).
*
* Basically:
- * I) Only 'differential' storage needs special handling here. All others (replacing values or
- * inserting/removing items from a collection) can be handled with simply storing current content of local data-block.
- * II) We store the differential value into a second 'ghost' data-block, which is an empty ID of same type as local one,
- * where we only define values that need differential data.
+ * 1) Only 'differential' storage needs special handling here. All others (replacing values or
+ * inserting/removing items from a collection) can be handled with simply storing current
+ * content of local data-block.
+ * 2) We store the differential value into a second 'ghost' data-block,
+ * which is an empty ID of same type as local one,
+ * where we only define values that need differential data.
*
- * This avoids us having to modify 'real' data-block at write time (and restoring it afterwards), which is inneficient,
- * and potentially dangerous (in case of concurrent access...), while not using much extra memory in typical cases.
- * It also ensures stored data-block always contains exact same data as "desired" ones (kind of "baked" data-blocks).
+ * This avoids us having to modify 'real' data-block at write time (and restoring it afterwards),
+ * which is inneficient, and potentially dangerous (in case of concurrent access...), while not
+ * using much extra memory in typical cases. It also ensures stored data-block always contains
+ * exact same data as "desired" ones (kind of "baked" data-blocks).
*/
/** Initialize an override storage. */
@@ -734,7 +743,8 @@ OverrideStaticStorage *BKE_override_static_operations_store_initialize(void)
/**
* Generate suitable 'write' data (this only affects differential override operations).
*
- * Note that \a local ID is no more modified by this call, all extra data are stored in its temp \a storage_id copy. */
+ * Note that \a local ID is no more modified by this call,
+ * all extra data are stored in its temp \a storage_id copy. */
ID *BKE_override_static_operations_store_start(Main *bmain,
OverrideStaticStorage *override_storage,
ID *local)
@@ -756,11 +766,13 @@ ID *BKE_override_static_operations_store_start(Main *bmain,
TIMEIT_START_AVERAGED(BKE_override_operations_store_start);
#endif
- /* XXX TODO We may also want a specialized handling of things here too, to avoid copying heavy never-overridable
- * data (like Mesh geometry etc.)? And also maybe avoid lib refcounting completely (shallow copy...). */
- /* This would imply change in handling of usercout all over RNA (and possibly all over Blender code).
- * Not impossible to do, but would rather see first is extra useless usual user handling is actually
- * a (performances) issue here, before doing it. */
+ /* XXX TODO We may also want a specialized handling of things here too, to avoid copying heavy
+ * never-overridable data (like Mesh geometry etc.)? And also maybe avoid lib reference-counting
+ * completely (shallow copy...). */
+ /* This would imply change in handling of user-count all over RNA
+ * (and possibly all over Blender code).
+ * Not impossible to do, but would rather see first is extra useless usual user handling is
+ * actually a (performances) issue here, before doing it. */
BKE_id_copy((Main *)override_storage, local, &storage_id);
if (storage_id != NULL) {
@@ -790,15 +802,15 @@ void BKE_override_static_operations_store_end(OverrideStaticStorage *UNUSED(over
{
BLI_assert(local->override_static != NULL);
- /* Nothing else to do here really, we need to keep all temp override storage data-blocks in memory until
- * whole file is written anyway (otherwise we'd get mem pointers overlap...). */
+ /* Nothing else to do here really, we need to keep all temp override storage data-blocks in
+ * memory until whole file is written anyway (otherwise we'd get mem pointers overlap...). */
local->override_static->storage = NULL;
}
void BKE_override_static_operations_store_finalize(OverrideStaticStorage *override_storage)
{
- /* We cannot just call BKE_main_free(override_storage), not until we have option to make 'ghost' copies of IDs
- * without increasing usercount of used data-blocks... */
+ /* We cannot just call BKE_main_free(override_storage), not until we have option to make 'ghost'
+ * copies of IDs without increasing usercount of used data-blocks. */
ID *id;
FOREACH_MAIN_ID_BEGIN (override_storage, id) {
diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c
index 92ed6ea4e04..d0515d8783d 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -352,8 +352,8 @@ static void library_foreach_ID_as_subdata_link(ID **id_pp,
BLI_assert(id == *id_pp);
if (flag & IDWALK_RECURSE) {
- /* Defer handling into main loop, recursively calling BKE_library_foreach_ID_link in IDWALK_RECURSE case is
- * troublesome, see T49553. */
+ /* Defer handling into main loop, recursively calling BKE_library_foreach_ID_link in
+ * IDWALK_RECURSE case is troublesome, see T49553. */
if (BLI_gset_add(data->ids_handled, id)) {
BLI_LINKSTACK_PUSH(data->ids_todo, id);
}
@@ -402,8 +402,8 @@ static void library_foreach_ID_link(Main *bmain,
/* inherit_data is non-NULL when this function is called for some sub-data ID
* (like root nodetree of a material).
- * In that case, we do not want to generate those 'generic flags' from our current sub-data ID (the node tree),
- * but re-use those generated for the 'owner' ID (the material)... */
+ * In that case, we do not want to generate those 'generic flags' from our current sub-data ID
+ * (the node tree), but re-use those generated for the 'owner' ID (the material). */
if (inherit_data == NULL) {
data.cb_flag = ID_IS_LINKED(id) ? IDWALK_CB_INDIRECT_USAGE : 0;
/* When an ID is not in Main database, it should never refcount IDs it is using.
@@ -416,10 +416,11 @@ static void library_foreach_ID_link(Main *bmain,
}
if (bmain != NULL && bmain->relations != NULL && (flag & IDWALK_READONLY)) {
- /* Note that this is minor optimization, even in worst cases (like id being an object with lots of
- * drivers and constraints and modifiers, or material etc. with huge node tree),
- * but we might as well use it (Main->relations is always assumed valid, it's responsibility of code
- * creating it to free it, especially if/when it starts modifying Main database). */
+ /* Note that this is minor optimization, even in worst cases (like id being an object with
+ * lots of drivers and constraints and modifiers, or material etc. with huge node tree),
+ * but we might as well use it (Main->relations is always assumed valid,
+ * it's responsibility of code creating it to free it,
+ * especially if/when it starts modifying Main database). */
MainIDRelationsEntry *entry = BLI_ghash_lookup(bmain->relations->id_user_to_used, id);
for (; entry != NULL; entry = entry->next) {
FOREACH_CALLBACK_INVOKE_ID_PP(&data, entry->id_pointer, entry->usage_flag);
@@ -594,8 +595,8 @@ static void library_foreach_ID_link(Main *bmain,
CALLBACK_INVOKE(object->proxy_group, IDWALK_CB_NOP);
/* Special case!
- * Since this field is set/owned by 'user' of this ID (and not ID itself), it is only indirect usage
- * if proxy object is linked... Twisted. */
+ * Since this field is set/owned by 'user' of this ID (and not ID itself),
+ * it is only indirect usage if proxy object is linked... Twisted. */
if (object->proxy_from) {
data.cb_flag = ID_IS_LINKED(object->proxy_from) ? IDWALK_CB_INDIRECT_USAGE : 0;
}
@@ -1018,7 +1019,8 @@ static void library_foreach_ID_link(Main *bmain,
bScreen *screen = BKE_workspace_layout_screen_get(layout);
/* CALLBACK_INVOKE expects an actual pointer, not a variable holding the pointer.
- * However we can't access layout->screen here since we are outside the workspace project. */
+ * However we can't access layout->screen here
+ * since we are outside the workspace project. */
CALLBACK_INVOKE(screen, IDWALK_CB_USER);
/* allow callback to set a different screen */
BKE_workspace_layout_screen_set(layout, screen);
@@ -1096,11 +1098,12 @@ void BKE_library_update_ID_link_user(ID *id_dst, ID *id_src, const int cb_flag)
/**
* Say whether given \a id_type_owner can use (in any way) a datablock of \a id_type_used.
*
- * This is a 'simplified' abstract version of #BKE_library_foreach_ID_link() above, quite useful to reduce
- * useless iterations in some cases.
+ * This is a 'simplified' abstract version of #BKE_library_foreach_ID_link() above,
+ * quite useful to reduce* useless iterations in some cases.
*/
-/* XXX This has to be fully rethink, basing check on ID type is not really working anymore (and even worth once
- * IDProps will support ID pointers), we'll have to do some quick checks on IDs themselves... */
+/* XXX This has to be fully rethink, basing check on ID type is not really working anymore
+ * (and even worth once IDProps will support ID pointers),
+ * we'll have to do some quick checks on IDs themselves... */
bool BKE_library_id_can_use_idtype(ID *id_owner, const short id_type_used)
{
/* any type of ID can be used in custom props. */
@@ -1120,7 +1123,8 @@ bool BKE_library_id_can_use_idtype(ID *id_owner, const short id_type_used)
}
if (BKE_animdata_from_id(id_owner)) {
- return true; /* AnimationData can use virtually any kind of datablocks, through drivers especially. */
+ /* AnimationData can use virtually any kind of datablocks, through drivers especially. */
+ return true;
}
switch ((ID_Type)id_type_owner) {
@@ -1267,8 +1271,8 @@ static int foreach_libblock_id_users_callback(void *user_data,
/**
* Return the number of times given \a id_user uses/references \a id_used.
*
- * \note This only checks for pointer references of an ID, shallow usages (like e.g. by RNA paths, as done
- * for FCurves) are not detected at all.
+ * \note This only checks for pointer references of an ID, shallow usages
+ * (like e.g. by RNA paths, as done for FCurves) are not detected at all.
*
* \param id_user: the ID which is supposed to use (reference) \a id_used.
* \param id_used: the ID which is supposed to be used (referenced) by \a id_user.
@@ -1339,7 +1343,8 @@ bool BKE_library_ID_is_indirectly_used(Main *bmain, void *idv)
}
/**
- * Combine #BKE_library_ID_is_locally_used() and #BKE_library_ID_is_indirectly_used() in a single call.
+ * Combine #BKE_library_ID_is_locally_used() and #BKE_library_ID_is_indirectly_used()
+ * in a single call.
*/
void BKE_library_ID_test_usages(Main *bmain, void *idv, bool *is_used_local, bool *is_used_linked)
{
@@ -1390,7 +1395,8 @@ static int foreach_libblock_used_linked_data_tag_clear_cb(void *user_data,
return IDWALK_RET_NOP;
}
- /* If checked id is used by an assumed used ID, then it is also used and not part of any linked archipelago. */
+ /* If checked id is used by an assumed used ID,
+ * then it is also used and not part of any linked archipelago. */
if (!(self_id->tag & LIB_TAG_DOIT) && ((*id_p)->tag & LIB_TAG_DOIT)) {
(*id_p)->tag &= ~LIB_TAG_DOIT;
*is_changed = true;
@@ -1401,12 +1407,13 @@ static int foreach_libblock_used_linked_data_tag_clear_cb(void *user_data,
}
/**
- * Detect orphaned linked data blocks (i.e. linked data not used (directly or indirectly) in any way by any local data),
- * including complex cases like 'linked archipelagoes', i.e. linked datablocks that use each other in loops,
- * which prevents their deletion by 'basic' usage checks...
+ * Detect orphaned linked data blocks (i.e. linked data not used (directly or indirectly)
+ * in any way by any local data), including complex cases like 'linked archipelagoes', i.e.
+ * linked datablocks that use each other in loops,
+ * which prevents their deletion by 'basic' usage checks.
*
- * \param do_init_tag: if \a true, all linked data are checked, if \a false, only linked datablocks already tagged with
- * LIB_TAG_DOIT are checked.
+ * \param do_init_tag: if \a true, all linked data are checked, if \a false,
+ * only linked datablocks already tagged with #LIB_TAG_DOIT are checked.
*/
void BKE_library_unused_linked_data_set_tag(Main *bmain, const bool do_init_tag)
{
@@ -1439,9 +1446,11 @@ void BKE_library_unused_linked_data_set_tag(Main *bmain, const bool do_init_tag)
/**
* Untag linked data blocks used by other untagged linked datablocks.
- * Used to detect datablocks that we can forcefully make local (instead of copying them to later get rid of original):
- * All datablocks we want to make local are tagged by caller, after this function has ran caller knows datablocks still
- * tagged can directly be made local, since they are only used by other datablocks that will also be made fully local.
+ * Used to detect datablocks that we can forcefully make local
+ * (instead of copying them to later get rid of original):
+ * All datablocks we want to make local are tagged by caller,
+ * after this function has ran caller knows datablocks still tagged can directly be made local,
+ * since they are only used by other datablocks that will also be made fully local.
*/
void BKE_library_indirectly_used_data_tag_clear(Main *bmain)
{
diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c
index 4ed3c4f9501..3b6f11935d1 100644
--- a/source/blender/blenkernel/intern/library_remap.c
+++ b/source/blender/blenkernel/intern/library_remap.c
@@ -185,7 +185,8 @@ static int foreach_libblock_remap_callback(void *user_data, ID *id_self, ID **id
}
if (*id_p && (*id_p == old_id)) {
- /* Better remap to NULL than not remapping at all, then we can handle it as a regular remap-to-NULL case... */
+ /* Better remap to NULL than not remapping at all,
+ * then we can handle it as a regular remap-to-NULL case. */
if ((cb_flag & IDWALK_CB_NEVER_SELF) && (new_id == id_self)) {
new_id = NULL;
}
@@ -194,8 +195,8 @@ static int foreach_libblock_remap_callback(void *user_data, ID *id_self, ID **id
const bool is_indirect = (cb_flag & IDWALK_CB_INDIRECT_USAGE) != 0;
const bool skip_indirect = (id_remap_data->flag & ID_REMAP_SKIP_INDIRECT_USAGE) != 0;
/* Note: proxy usage implies LIB_TAG_EXTERN, so on this aspect it is direct,
- * on the other hand since they get reset to lib data on file open/reload it is indirect too...
- * Edit Mode is also a 'skip direct' case. */
+ * on the other hand since they get reset to lib data on file open/reload it is indirect too.
+ * Edit Mode is also a 'skip direct' case. */
const bool is_obj = (GS(id->name) == ID_OB);
const bool is_obj_proxy = (is_obj && (((Object *)id)->proxy || ((Object *)id)->proxy_group));
const bool is_obj_editmode = (is_obj && BKE_object_is_in_editmode((Object *)id));
@@ -280,8 +281,8 @@ static int foreach_libblock_remap_callback(void *user_data, ID *id_self, ID **id
}
else if (cb_flag & IDWALK_CB_USER_ONE) {
id_us_ensure_real(new_id);
- /* We cannot affect old_id->us directly, LIB_TAG_EXTRAUSER(_SET) are assumed to be set as needed,
- * that extra user is processed in final handling... */
+ /* We cannot affect old_id->us directly, LIB_TAG_EXTRAUSER(_SET)
+ * are assumed to be set as needed, that extra user is processed in final handling. */
}
if (!is_indirect || is_obj_proxy) {
id_remap_data->status |= ID_REMAP_IS_LINKED_DIRECT;
@@ -300,15 +301,16 @@ static void libblock_remap_data_preprocess(IDRemap *r_id_remap_data)
if (!old_id || GS(old_id->name) == ID_AR) {
Object *ob = (Object *)r_id_remap_data->id;
/* Object's pose holds reference to armature bones... sic */
- /* Note that in theory, we should have to bother about linked/non-linked/never-null/etc. flags/states.
- * Fortunately, this is just a tag, so we can accept to 'over-tag' a bit for pose recalc, and avoid
- * another complex and risky condition nightmare like the one we have in
+ /* Note that in theory, we should have to bother about
+ * linked/non-linked/never-null/etc. flags/states.
+ * Fortunately, this is just a tag, so we can accept to 'over-tag' a bit for pose recalc,
+ * and avoid another complex and risky condition nightmare like the one we have in
* foreach_libblock_remap_callback()... */
if (ob->pose && (!old_id || ob->data == old_id)) {
BLI_assert(ob->type == OB_ARMATURE);
ob->pose->flag |= POSE_RECALC;
- /* We need to clear pose bone pointers immediately, things like undo writefile may be called
- * before pose is actually recomputed, can lead to segfault... */
+ /* We need to clear pose bone pointers immediately, things like undo writefile may be
+ * called before pose is actually recomputed, can lead to segfault... */
BKE_pose_clear_pointers(ob->pose);
}
}
@@ -319,7 +321,10 @@ static void libblock_remap_data_preprocess(IDRemap *r_id_remap_data)
}
}
-/* Can be called with both old_ob and new_ob being NULL, this means we have to check whole Main database then. */
+/**
+ * Can be called with both old_ob and new_ob being NULL,
+ * this means we have to check whole Main database then.
+ */
static void libblock_remap_data_postprocess_object_update(Main *bmain,
Object *old_ob,
Object *new_ob)
@@ -358,8 +363,8 @@ static void libblock_remap_data_postprocess_collection_update(Main *bmain,
{
if (new_collection == NULL) {
/* XXX Complex cases can lead to NULL pointers in other collections than old_collection,
- * and BKE_main_collection_sync_remap() does not tolerate any of those, so for now always check whole
- * existing collections for NULL pointers.
+ * and BKE_main_collection_sync_remap() does not tolerate any of those, so for now always check
+ * whole existing collections for NULL pointers.
* I'd consider optimizing that whole collection remapping process a TODO for later. */
BKE_collections_child_remove_nulls(bmain, NULL /*old_collection*/);
}
@@ -396,18 +401,22 @@ static void libblock_remap_data_postprocess_nodetree_update(Main *bmain, ID *new
*
* Behavior differs depending on whether given \a id is NULL or not:
* - \a id NULL: \a old_id must be non-NULL, \a new_id may be NULL (unlinking \a old_id) or not
- * (remapping \a old_id to \a new_id). The whole \a bmain database is checked, and all pointers to \a old_id
+ * (remapping \a old_id to \a new_id).
+ * The whole \a bmain database is checked, and all pointers to \a old_id
* are remapped to \a new_id.
* - \a id is non-NULL:
- * + If \a old_id is NULL, \a new_id must also be NULL, and all ID pointers from \a id are cleared (i.e. \a id
- * does not references any other datablock anymore).
+ * + If \a old_id is NULL, \a new_id must also be NULL,
+ * and all ID pointers from \a id are cleared
+ * (i.e. \a id does not references any other datablock anymore).
* + If \a old_id is non-NULL, behavior is as with a NULL \a id, but only within given \a id.
*
* \param bmain: the Main data storage to operate on (must never be NULL).
- * \param id: the datablock to operate on (can be NULL, in which case we operate over all IDs from given bmain).
+ * \param id: the datablock to operate on
+ * (can be NULL, in which case we operate over all IDs from given bmain).
* \param old_id: the datablock to dereference (may be NULL if \a id is non-NULL).
* \param new_id: the new datablock to replace \a old_id references with (may be NULL).
- * \param r_id_remap_data: if non-NULL, the IDRemap struct to use (uselful to retrieve info about remapping process).
+ * \param r_id_remap_data: if non-NULL, the IDRemap struct to use
+ * (uselful to retrieve info about remapping process).
*/
ATTR_NONNULL(1)
static void libblock_remap_data(
@@ -441,14 +450,15 @@ static void libblock_remap_data(
NULL, id, foreach_libblock_remap_callback, (void *)r_id_remap_data, foreach_id_flags);
}
else {
- /* Note that this is a very 'brute force' approach, maybe we could use some depsgraph to only process
- * objects actually using given old_id... sounds rather unlikely currently, though, so this will do for now. */
+ /* Note that this is a very 'brute force' approach,
+ * maybe we could use some depsgraph to only process objects actually using given old_id...
+ * sounds rather unlikely currently, though, so this will do for now. */
ID *id_curr;
FOREACH_MAIN_ID_BEGIN (bmain, id_curr) {
if (BKE_library_id_can_use_idtype(id_curr, GS(old_id->name))) {
- /* Note that we cannot skip indirect usages of old_id here (if requested), we still need to check it for
- * the user count handling...
+ /* Note that we cannot skip indirect usages of old_id here (if requested),
+ * we still need to check it for the user count handling...
* XXX No more true (except for debug usage of those skipping counters). */
r_id_remap_data->id = id_curr;
libblock_remap_data_preprocess(r_id_remap_data);
@@ -462,8 +472,9 @@ static void libblock_remap_data(
FOREACH_MAIN_ID_END;
}
- /* XXX We may not want to always 'transfer' fakeuser from old to new id... Think for now it's desired behavior
- * though, we can always add an option (flag) to control this later if needed. */
+ /* XXX We may not want to always 'transfer' fakeuser from old to new id...
+ * Think for now it's desired behavior though,
+ * we can always add an option (flag) to control this later if needed. */
if (old_id && (old_id->flag & LIB_FAKEUSER)) {
id_fake_user_clear(old_id);
id_fake_user_set(new_id);
@@ -508,7 +519,8 @@ void BKE_libblock_remap_locked(Main *bmain, void *old_idv, void *new_idv, const
}
/* We assume editors do not hold references to their IDs... This is false in some cases
- * (Image is especially tricky here), editors' code is to handle refcount (id->us) itself then. */
+ * (Image is especially tricky here),
+ * editors' code is to handle refcount (id->us) itself then. */
if (remap_editor_id_reference_cb) {
remap_editor_id_reference_cb(old_id, new_id);
}
@@ -516,9 +528,9 @@ void BKE_libblock_remap_locked(Main *bmain, void *old_idv, void *new_idv, const
skipped_direct = id_remap_data.skipped_direct;
skipped_refcounted = id_remap_data.skipped_refcounted;
- /* If old_id was used by some ugly 'user_one' stuff (like Image or Clip editors...), and user count has actually
- * been incremented for that, we have to decrease once more its user count... unless we had to skip
- * some 'user_one' cases. */
+ /* If old_id was used by some ugly 'user_one' stuff (like Image or Clip editors...), and user
+ * count has actually been incremented for that, we have to decrease once more its user count...
+ * unless we had to skip some 'user_one' cases. */
if ((old_id->tag & LIB_TAG_EXTRAUSER_SET) &&
!(id_remap_data.status & ID_REMAP_IS_USER_ONE_SKIPPED)) {
id_us_clear_real(old_id);
@@ -545,8 +557,8 @@ void BKE_libblock_remap_locked(Main *bmain, void *old_idv, void *new_idv, const
}
/* Some after-process updates.
- * This is a bit ugly, but cannot see a way to avoid it. Maybe we should do a per-ID callback for this instead?
- */
+ * This is a bit ugly, but cannot see a way to avoid it.
+ * Maybe we should do a per-ID callback for this instead? */
switch (GS(old_id->name)) {
case ID_OB:
libblock_remap_data_postprocess_object_update(bmain, (Object *)old_id, (Object *)new_id);
@@ -590,10 +602,11 @@ void BKE_libblock_remap(Main *bmain, void *old_idv, void *new_idv, const short r
}
/**
- * Unlink given \a id from given \a bmain (does not touch to indirect, i.e. library, usages of the ID).
+ * Unlink given \a id from given \a bmain
+ * (does not touch to indirect, i.e. library, usages of the ID).
*
- * \param do_flag_never_null: If true, all IDs using \a idv in a 'non-NULL' way are flagged by \a LIB_TAG_DOIT flag
- * (quite obviously, 'non-NULL' usages can never be unlinked by this function...).
+ * \param do_flag_never_null: If true, all IDs using \a idv in a 'non-NULL' way are flagged by
+ * #LIB_TAG_DOIT flag (quite obviously, 'non-NULL' usages can never be unlinked by this function).
*/
void BKE_libblock_unlink(Main *bmain,
void *idv,
@@ -648,7 +661,8 @@ void BKE_libblock_relink_ex(
libblock_remap_data(bmain, id, old_id, new_id, remap_flags, NULL);
/* Some after-process updates.
- * This is a bit ugly, but cannot see a way to avoid it. Maybe we should do a per-ID callback for this instead?
+ * This is a bit ugly, but cannot see a way to avoid it.
+ * Maybe we should do a per-ID callback for this instead?
*/
switch (GS(id->name)) {
case ID_SCE: {
@@ -707,9 +721,12 @@ static int id_relink_to_newid_looper(void *UNUSED(user_data),
return IDWALK_RET_NOP;
}
-/** Similar to libblock_relink_ex, but is remapping IDs to their newid value if non-NULL, in given \a id.
+/**
+ * Similar to #libblock_relink_ex,
+ * but is remapping IDs to their newid value if non-NULL, in given \a id.
*
- * Very specific usage, not sure we'll keep it on the long run, currently only used in Object/Collection duplication code...
+ * Very specific usage, not sure we'll keep it on the long run,
+ * currently only used in Object/Collection duplication code...
*/
void BKE_libblock_relink_to_newid(ID *id)
{
@@ -731,7 +748,8 @@ void BKE_libblock_free_data(ID *id, const bool do_id_user)
BKE_override_static_free(&id->override_static);
}
- /* XXX TODO remove animdata handling from each type's freeing func, and do it here, like for copy! */
+ /* XXX TODO remove animdata handling from each type's freeing func,
+ * and do it here, like for copy! */
}
void BKE_libblock_free_datablock(ID *id, const int UNUSED(flag))
@@ -858,13 +876,14 @@ void BKE_libblock_free_datablock(ID *id, const int UNUSED(flag))
* At that point, given id is assumed to not be used by any other data-block already
* (might not be actually true, in case e.g. several inter-related IDs get freed together...).
* However, they might still be using (referencing) other IDs, this code takes care of it if
- * \a LIB_TAG_NO_USER_REFCOUNT is not defined.
+ * #LIB_TAG_NO_USER_REFCOUNT is not defined.
*
- * \param bmain: Main database containing the freed ID, can be NULL in case it's a temp ID outside of any Main.
+ * \param bmain: #Main database containing the freed #ID,
+ * can be NULL in case it's a temp ID outside of any #Main.
* \param idv: Pointer to ID to be freed.
* \param flag: Set of \a LIB_ID_FREE_... flags controlling/overriding usual freeing process,
* 0 to get default safe behavior.
- * \param use_flag_from_idtag: Still use freeing info flags from given ID datablock,
+ * \param use_flag_from_idtag: Still use freeing info flags from given #ID datablock,
* even if some overriding ones are passed in \a flag parameter.
*/
void BKE_id_free_ex(Main *bmain, void *idv, int flag, const bool use_flag_from_idtag)
@@ -955,7 +974,8 @@ void BKE_id_free_ex(Main *bmain, void *idv, int flag, const bool use_flag_from_i
*
* See #BKE_id_free_ex description for full details.
*
- * \param bmain: Main database containing the freed ID, can be NULL in case it's a temp ID outside of any Main.
+ * \param bmain: Main database containing the freed ID,
+ * can be NULL in case it's a temp ID outside of any Main.
* \param idv: Pointer to ID to be freed.
*/
void BKE_id_free(Main *bmain, void *idv)
@@ -964,7 +984,8 @@ void BKE_id_free(Main *bmain, void *idv)
}
/**
- * Not really a freeing function by itself, it decrements usercount of given id, and only frees it if it reaches 0.
+ * Not really a freeing function by itself,
+ * it decrements usercount of given id, and only frees it if it reaches 0.
*/
void BKE_id_free_us(Main *bmain, void *idv) /* test users */
{
@@ -972,12 +993,13 @@ void BKE_id_free_us(Main *bmain, void *idv) /* test users */
id_us_min(id);
- /* XXX This is a temp (2.77) hack so that we keep same behavior as in 2.76 regarding collections when deleting an object.
- * Since only 'user_one' usage of objects is collections, and only 'real user' usage of objects is scenes,
- * removing that 'user_one' tag when there is no more real (scene) users of an object ensures it gets
- * fully unlinked.
+ /* XXX This is a temp (2.77) hack so that we keep same behavior as in 2.76 regarding collections
+ * when deleting an object. Since only 'user_one' usage of objects is collections,
+ * and only 'real user' usage of objects is scenes, removing that 'user_one' tag when there
+ * is no more real (scene) users of an object ensures it gets fully unlinked.
* But only for local objects, not linked ones!
- * Otherwise, there is no real way to get rid of an object anymore - better handling of this is TODO.
+ * Otherwise, there is no real way to get rid of an object anymore -
+ * better handling of this is TODO.
*/
if ((GS(id->name) == ID_OB) && (id->us == 1) && (id->lib == NULL)) {
id_us_clear_real(id);
@@ -1034,8 +1056,9 @@ static void id_delete(Main *bmain, const bool do_tagged_deletion)
if ((id->tag & tag) || (id->lib != NULL && (id->lib->id.tag & tag))) {
BLI_remlink(lb, id);
BLI_addtail(&tagged_deleted_ids, id);
- /* Do not tag as no_main now, we want to unlink it first (lower-level ID management code
- * has some specific handling of 'nom main' IDs that would be a problem in that case). */
+ /* Do not tag as no_main now, we want to unlink it first (lower-level ID management
+ * code has some specific handling of 'nom main'
+ * IDs that would be a problem in that case). */
id->tag |= tag;
keep_looping = true;
}
@@ -1047,24 +1070,28 @@ static void id_delete(Main *bmain, const bool do_tagged_deletion)
}
for (id = last_remapped_id->next; id; id = id->next) {
/* Will tag 'never NULL' users of this ID too.
- * Note that we cannot use BKE_libblock_unlink() here, since it would ignore indirect (and proxy!)
+ * Note that we cannot use BKE_libblock_unlink() here,
+ * since it would ignore indirect (and proxy!)
* links, this can lead to nasty crashing here in second, actual deleting loop.
* Also, this will also flag users of deleted data that cannot be unlinked
* (object using deleted obdata, etc.), so that they also get deleted. */
BKE_libblock_remap_locked(
bmain, id, NULL, ID_REMAP_FLAG_NEVER_NULL_USAGE | ID_REMAP_FORCE_NEVER_NULL_USAGE);
- /* Since we removed ID from Main, we also need to unlink its own other IDs usages ourself. */
+ /* Since we removed ID from Main,
+ * we also need to unlink its own other IDs usages ourself. */
BKE_libblock_relink_ex(bmain, id, NULL, NULL, true);
/* Now we can safely mark that ID as not being in Main database anymore. */
id->tag |= LIB_TAG_NO_MAIN;
- /* This is needed because we may not have remapped usages of that ID by other deleted ones. */
- // id->us = 0; /* Is it actually? */
+ /* This is needed because we may not have remapped usages
+ * of that ID by other deleted ones. */
+ // id->us = 0; /* Is it actually? */
}
}
}
else {
/* First tag all datablocks directly from target lib.
- * Note that we go forward here, since we want to check dependencies before users (e.g. meshes before objects).
+ * Note that we go forward here, since we want to check dependencies before users
+ * (e.g. meshes before objects).
* Avoids to have to loop twice. */
for (i = 0; i < base_count; i++) {
ListBase *lb = lbarray[i];
@@ -1077,8 +1104,9 @@ static void id_delete(Main *bmain, const bool do_tagged_deletion)
id->tag |= tag;
/* Will tag 'never NULL' users of this ID too.
- * Note that we cannot use BKE_libblock_unlink() here, since it would ignore indirect (and proxy!)
- * links, this can lead to nasty crashing here in second, actual deleting loop.
+ * Note that we cannot use BKE_libblock_unlink() here, since it would ignore indirect
+ * (and proxy!) links, this can lead to nasty crashing here in second,
+ * actual deleting loop.
* Also, this will also flag users of deleted data that cannot be unlinked
* (object using deleted obdata, etc.), so that they also get deleted. */
BKE_libblock_remap_locked(
@@ -1089,8 +1117,9 @@ static void id_delete(Main *bmain, const bool do_tagged_deletion)
}
BKE_main_unlock(bmain);
- /* In usual reversed order, such that all usage of a given ID, even 'never NULL' ones, have been already cleared
- * when we reach it (e.g. Objects being processed before meshes, they'll have already released their 'reference'
+ /* In usual reversed order, such that all usage of a given ID, even 'never NULL' ones,
+ * have been already cleared when we reach it
+ * (e.g. Objects being processed before meshes, they'll have already released their 'reference'
* over meshes when we come to freeing obdata). */
for (i = do_tagged_deletion ? 1 : base_count; i--;) {
ListBase *lb = lbarray[i];
diff --git a/source/blender/blenkernel/intern/light.c b/source/blender/blenkernel/intern/light.c
index 0a7cb2a30a0..05b2eb82daf 100644
--- a/source/blender/blenkernel/intern/light.c
+++ b/source/blender/blenkernel/intern/light.c
@@ -96,8 +96,10 @@ Light *BKE_light_add(Main *bmain, const char *name)
}
/**
- * Only copy internal data of Light ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of Light ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
diff --git a/source/blender/blenkernel/intern/lightprobe.c b/source/blender/blenkernel/intern/lightprobe.c
index 6b1951498cc..5e6d298adbf 100644
--- a/source/blender/blenkernel/intern/lightprobe.c
+++ b/source/blender/blenkernel/intern/lightprobe.c
@@ -60,8 +60,10 @@ void *BKE_lightprobe_add(Main *bmain, const char *name)
}
/**
- * Only copy internal data of LightProbe ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of LightProbe ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c
index 4d159adbb57..31e6d2e89e5 100644
--- a/source/blender/blenkernel/intern/linestyle.c
+++ b/source/blender/blenkernel/intern/linestyle.c
@@ -151,8 +151,10 @@ void BKE_linestyle_free(FreestyleLineStyle *linestyle)
}
/**
- * Only copy internal data of Linestyle ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of Linestyle ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
diff --git a/source/blender/blenkernel/intern/main.c b/source/blender/blenkernel/intern/main.c
index 8ae5ed7fbdd..e50e37c5428 100644
--- a/source/blender/blenkernel/intern/main.c
+++ b/source/blender/blenkernel/intern/main.c
@@ -56,7 +56,8 @@ void BKE_main_free(Main *mainvar)
ListBase *lbarray[MAX_LIBARRAY];
int a;
- /* Since we are removing whole main, no need to bother 'properly' (and slowly) removing each ID from it. */
+ /* Since we are removing whole main, no need to bother 'properly'
+ * (and slowly) removing each ID from it. */
const int free_flag = (LIB_ID_FREE_NO_MAIN | LIB_ID_FREE_NO_UI_USER |
LIB_ID_FREE_NO_USER_REFCOUNT | LIB_ID_FREE_NO_DEG_TAG);
@@ -285,7 +286,8 @@ void BKE_main_relations_free(Main *bmain)
/**
* Create a GSet storing all IDs present in given \a bmain, by their pointers.
*
- * \param gset: If not NULL, given GSet will be extended with IDs from given \a bmain, instead of creating a new one.
+ * \param gset: If not NULL, given GSet will be extended with IDs from given \a bmain,
+ * instead of creating a new one.
*/
GSet *BKE_main_gset_create(Main *bmain, GSet *gset)
{
@@ -348,8 +350,8 @@ ImBuf *BKE_main_thumbnail_to_imbuf(Main *bmain, BlendThumbnail *data)
}
if (data) {
- /* Note: we cannot use IMB_allocFromBuffer(), since it tries to dupalloc passed buffer, which will fail
- * here (we do not want to pass the first two ints!). */
+ /* Note: we cannot use IMB_allocFromBuffer(), since it tries to dupalloc passed buffer,
+ * which will fail here (we do not want to pass the first two ints!). */
img = IMB_allocImBuf(
(unsigned int)data->width, (unsigned int)data->height, 32, IB_rect | IB_metadata);
memcpy(img->rect, data->rect, BLEN_THUMB_MEMSIZE(data->width, data->height) - sizeof(*data));
@@ -381,7 +383,8 @@ const char *BKE_main_blendfile_path(const Main *bmain)
/**
* Return filepath of global main #G_MAIN.
*
- * \warning Usage is not recommended, you should always try to get a valid Main pointer from context...
+ * \warning Usage is not recommended,
+ * you should always try to get a valid Main pointer from context...
*/
const char *BKE_main_blendfile_path_from_global(void)
{
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index c925ebe26cf..3a7bc76344a 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -273,7 +273,10 @@ MaskSpline *BKE_mask_spline_add(MaskLayer *masklay)
spline->tot_point = 1;
/* cyclic shapes are more usually used */
- // spline->flag |= MASK_SPLINE_CYCLIC; // disable because its not so nice for drawing. could be done differently
+ /* Disable because its not so nice for drawing. could be done differently. */
+#if 0
+ spline->flag |= MASK_SPLINE_CYCLIC;
+#endif
spline->weight_interp = MASK_SPLINE_INTERP_EASE;
@@ -863,8 +866,10 @@ Mask *BKE_mask_copy_nolib(Mask *mask)
}
/**
- * Only copy internal data of Mask ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of Mask ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -1802,7 +1807,8 @@ void BKE_mask_layer_shape_changed_add(MaskLayer *masklay,
if (BKE_mask_layer_shape_spline_from_index(masklay, index, &spline, &spline_point_index)) {
/* sanity check */
- /* the point has already been removed in this array so subtract one when comparing with the shapes */
+ /* The point has already been removed in this array
+ * so subtract one when comparing with the shapes. */
int tot = BKE_mask_layer_shape_totvert(masklay) - 1;
/* for interpolation */
diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c
index 31cb0e54785..bd7a9c10ffa 100644
--- a/source/blender/blenkernel/intern/mask_rasterize.c
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -20,14 +20,16 @@
/** \file
* \ingroup bke
*
- * This module exposes a rasterizer that works as a black box - implementation details are confined to this file,
+ * This module exposes a rasterizer that works as a black box - implementation details
+ * are confined to this file.
*
* The basic method to access is:
* - create & initialize a handle from a #Mask datablock.
* - execute pixel lookups.
* - free the handle.
*
- * This file is admittedly a bit confusticated, in quite few areas speed was chosen over readability,
+ * 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 what's going on.
* Implementation:
*
@@ -35,12 +37,16 @@
*
* Initially 'kdopbvh' was used but this ended up being too slow.
*
- * To gain some extra speed we take advantage of a few shortcuts that can be made rasterizing masks specifically.
- * - all triangles are known to be completely white - so no depth check is done on triangle intersection.
- * - all quads are known to be feather outlines - the 1 and 0 depths are known by the vertex order in the quad,
- * - there is no color - just a value for each mask pixel.
- * - the mask spacial structure always maps to space 0-1 on X and Y axis.
- * - bucketing is used to speed up lookups for geometry.
+ * To gain some extra speed we take advantage of a few shortcuts
+ * that can be made rasterizing masks specifically.
+ *
+ * - All triangles are known to be completely white -
+ * so no depth check is done on triangle intersection.
+ * - All quads are known to be feather outlines -
+ * the 1 and 0 depths are known by the vertex order in the quad,
+ * - There is no color - just a value for each mask pixel.
+ * - The mask spacial structure always maps to space 0-1 on X and Y axis.
+ * - Bucketing is used to speed up lookups for geometry.
*
* Other Details:
* - used unsigned values all over for some extra speed on some arch's.
@@ -48,7 +54,8 @@
* - initializing the spacial structure doesn't need to be as optimized as pixel lookups are.
* - mask lookups need not be pixel aligned so any sub-pixel values from x/y (0 - 1), can be found.
* (perhaps masks can be used as a vector texture in 3D later on)
- * Currently, to build the spacial structure we have to calculate the total number of faces ahead of time.
+ * Currently, to build the spacial structure we have to calculate
+ * the total number of faces ahead of time.
*
* This is getting a bit complicated with the addition of unfilled splines and end capping -
* If large changes are needed here we would be better off using an iterable
@@ -504,16 +511,18 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size)
for (yi = yi_min; yi <= yi_max; yi++) {
unsigned int bucket_index = (layer->buckets_x * yi) + xi_min;
for (xi = xi_min; xi <= xi_max; xi++, bucket_index++) {
- // unsigned int bucket_index = (layer->buckets_x * yi) + xi; /* correct but do in outer loop */
+ /* correct but do in outer loop */
+ // unsigned int bucket_index = (layer->buckets_x * yi) + xi;
BLI_assert(xi < layer->buckets_x);
BLI_assert(yi < layer->buckets_y);
BLI_assert(bucket_index < bucket_tot);
- /* check if the bucket intersects with the face */
- /* note: there is a trade off here since checking box/tri intersections isn't
- * as optimal as it could be, but checking pixels against faces they will never intersect
- * with is likely the greater slowdown here - so check if the cell intersects the face */
+ /* Check if the bucket intersects with the face. */
+ /* Note: there is a trade off here since checking box/tri intersections isn't as
+ * optimal as it could be, but checking pixels against faces they will never
+ * intersect with is likely the greater slowdown here -
+ * so check if the cell intersects the face. */
if (layer_bucket_isect_test(layer,
face_index,
xi,
@@ -1160,7 +1169,15 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
MEM_freeN(open_spline_ranges);
- // fprintf(stderr, "%u %u (%u %u), %u\n", face_index, sf_tri_tot + tot_feather_quads, sf_tri_tot, tot_feather_quads, tot_boundary_used - tot_boundary_found);
+#if 0
+ fprintf(stderr,
+ "%u %u (%u %u), %u\n",
+ face_index,
+ sf_tri_tot + tot_feather_quads,
+ sf_tri_tot,
+ tot_feather_quads,
+ tot_boundary_used - tot_boundary_found);
+#endif
#ifdef USE_SCANFILL_EDGE_WORKAROUND
BLI_assert(face_index + (tot_boundary_used - tot_boundary_found) ==
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 599dc1e15d5..75b9e355df9 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -169,8 +169,10 @@ Material *BKE_material_add_gpencil(Main *bmain, const char *name)
}
/**
- * Only copy internal data of Material ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of Material ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index 0980089a1f7..d6fa071009e 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -99,8 +99,10 @@ MetaBall *BKE_mball_add(Main *bmain, const char *name)
}
/**
- * Only copy internal data of MetaBall ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of MetaBall ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -238,7 +240,8 @@ BoundBox *BKE_mball_boundbox_get(Object *ob)
return ob->runtime.bb;
}
- /* This should always only be called with evaluated objects, but currently RNA is a problem here... */
+ /* This should always only be called with evaluated objects,
+ * but currently RNA is a problem here... */
if (ob->runtime.curve_cache != NULL) {
BKE_mball_texspace_calc(ob);
}
@@ -283,12 +286,15 @@ float *BKE_mball_make_orco(Object *ob, ListBase *dispbase)
/* Note on mball basis stuff 2.5x (this is a can of worms)
* This really needs a rewrite/refactor its totally broken in anything other then basic cases
- * Multiple Scenes + Set Scenes & mixing mball basis SHOULD work but fails to update the depsgraph on rename
- * and linking into scenes or removal of basis mball. so take care when changing this code.
+ * Multiple Scenes + Set Scenes & mixing mball basis SHOULD work but fails to update the depsgraph
+ * on rename and linking into scenes or removal of basis mball.
+ * So take care when changing this code.
*
- * Main idiot thing here is that the system returns find_basis_mball() objects which fail a is_basis_mball() test.
+ * Main idiot thing here is that the system returns find_basis_mball()
+ * objects which fail a is_basis_mball() test.
*
- * Not only that but the depsgraph and their areas depend on this behavior!, so making small fixes here isn't worth it.
+ * Not only that but the depsgraph and their areas depend on this behavior!,
+ * so making small fixes here isn't worth it.
* - Campbell
*/
@@ -360,8 +366,8 @@ bool BKE_mball_is_any_unselected(const MetaBall *mb)
/* \brief copy some properties from object to other metaball object with same base name
*
- * When some properties (wiresize, threshold, update flags) of metaball are changed, then this properties
- * are copied to all metaballs in same "group" (metaballs with same base name: MBall,
+ * When some properties (wiresize, threshold, update flags) of metaball are changed, then this
+ * properties are copied to all metaballs in same "group" (metaballs with same base name: MBall,
* MBall.001, MBall.002, etc). The most important is to copy properties to the base metaball,
* because this metaball influence polygonisation of metaballs. */
void BKE_mball_properties_copy(Scene *scene, Object *active_object)
@@ -427,7 +433,8 @@ Object *BKE_mball_basis_find(Scene *scene, Object *basis)
if (ob != bob) {
BLI_split_name_num(obname, &obnr, ob->id.name + 2, '.');
- /* object ob has to be in same "group" ... it means, that it has to have same base of its name */
+ /* Object ob has to be in same "group" ... it means,
+ * that it has to have same base of its name. */
if (STREQ(obname, basisname)) {
if (obnr < basisnr) {
basis = ob;
diff --git a/source/blender/blenkernel/intern/mball_tessellate.c b/source/blender/blenkernel/intern/mball_tessellate.c
index b008eca2258..60813e927bb 100644
--- a/source/blender/blenkernel/intern/mball_tessellate.c
+++ b/source/blender/blenkernel/intern/mball_tessellate.c
@@ -1324,7 +1324,8 @@ static void init_meta(Depsgraph *depsgraph, PROCESS *process, Scene *scene, Obje
}
/* untransformed Bounding Box of MetaElem */
- /* TODO, its possible the elem type has been changed and the exp* values can use a fallback */
+ /* TODO, its possible the elem type has been changed and the exp*
+ * values can use a fallback. */
copy_v3_fl3(new_ml->bb->vec[0], -expx, -expy, -expz); /* 0 */
copy_v3_fl3(new_ml->bb->vec[1], +expx, -expy, -expz); /* 1 */
copy_v3_fl3(new_ml->bb->vec[2], +expx, +expy, -expz); /* 2 */
@@ -1424,8 +1425,9 @@ void BKE_mball_polygonize(Depsgraph *depsgraph, Scene *scene, Object *ob, ListBa
if (process.totelem > 0) {
build_bvh_spatial(&process, &process.metaball_bvh, 0, process.totelem, &process.allbb);
- /* don't polygonize metaballs with too high resolution (base mball to small)
- * note: Eps was 0.0001f but this was giving problems for blood animation for durian, using 0.00001f */
+ /* Don't polygonize metaballs with too high resolution (base mball to small)
+ * note: Eps was 0.0001f but this was giving problems for blood animation for durian,
+ * using 0.00001f. */
if (ob->scale[0] > 0.00001f * (process.allbb.max[0] - process.allbb.min[0]) ||
ob->scale[1] > 0.00001f * (process.allbb.max[1] - process.allbb.min[1]) ||
ob->scale[2] > 0.00001f * (process.allbb.max[2] - process.allbb.min[2])) {
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 117567621c9..56832c1724a 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -536,8 +536,10 @@ Mesh *BKE_mesh_add(Main *bmain, const char *name)
}
/**
- * Only copy internal data of Mesh ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of Mesh ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -926,7 +928,8 @@ void BKE_mesh_texspace_calc(Mesh *me)
BoundBox *BKE_mesh_boundbox_get(Object *ob)
{
- /* This is Object-level data access, DO NOT touch to Mesh's bb, would be totally thread-unsafe. */
+ /* This is Object-level data access,
+ * DO NOT touch to Mesh's bb, would be totally thread-unsafe. */
if (ob->runtime.bb == NULL || ob->runtime.bb->flag & BOUNDBOX_DIRTY) {
Mesh *me = ob->data;
float min[3], max[3];
@@ -1064,7 +1067,8 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr)
nr--;
}
- /* check corrupt cases, bow-tie geometry, cant handle these because edge data wont exist so just return 0 */
+ /* Check corrupt cases, bow-tie geometry,
+ * cant handle these because edge data wont exist so just return 0. */
if (nr == 3) {
if (
/* real edges */
@@ -1363,7 +1367,8 @@ void BKE_mesh_transform(Mesh *me, float mat[4][4], bool do_keys)
}
/* don't update normals, caller can do this explicitly.
- * We do update loop normals though, those may not be auto-generated (see e.g. STL import script)! */
+ * We do update loop normals though, those may not be auto-generated
+ * (see e.g. STL import script)! */
if (lnors) {
float m3[3][3];
@@ -1640,8 +1645,9 @@ void BKE_mesh_apply_vert_normals(Mesh *mesh, short (*vertNormals)[3])
/**
* Compute 'split' (aka loop, or per face corner's) normals.
*
- * \param r_lnors_spacearr: Allows to get computed loop normal space array. That data, among other things,
- * contains 'smooth fan' info, useful e.g. to split geometry along sharp edges...
+ * \param r_lnors_spacearr: Allows to get computed loop normal space array.
+ * That data, among other things, contains 'smooth fan' info, useful e.g.
+ * to split geometry along sharp edges...
*/
void BKE_mesh_calc_normals_split_ex(Mesh *mesh, MLoopNorSpaceArray *r_lnors_spacearr)
{
@@ -1651,7 +1657,8 @@ void BKE_mesh_calc_normals_split_ex(Mesh *mesh, MLoopNorSpaceArray *r_lnors_spac
bool free_polynors = false;
/* Note that we enforce computing clnors when the clnor space array is requested by caller here.
- * However, we obviously only use the autosmooth angle threshold only in case autosmooth is enabled. */
+ * However, we obviously only use the autosmooth angle threshold
+ * only in case autosmooth is enabled. */
const bool use_split_normals = (r_lnors_spacearr != NULL) || ((mesh->flag & ME_AUTOSMOOTH) != 0);
const float split_angle = (mesh->flag & ME_AUTOSMOOTH) != 0 ? mesh->smoothresh : (float)M_PI;
@@ -1668,7 +1675,8 @@ void BKE_mesh_calc_normals_split_ex(Mesh *mesh, MLoopNorSpaceArray *r_lnors_spac
clnors = CustomData_get_layer(&mesh->ldata, CD_CUSTOMLOOPNORMAL);
if (CustomData_has_layer(&mesh->pdata, CD_NORMAL)) {
- /* This assume that layer is always up to date, not sure this is the case (esp. in Edit mode?)... */
+ /* This assume that layer is always up to date, not sure this is the case
+ * (esp. in Edit mode?)... */
polynors = CustomData_get_layer(&mesh->pdata, CD_NORMAL);
free_polynors = false;
}
@@ -1738,8 +1746,9 @@ static int split_faces_prepare_new_verts(const Mesh *mesh,
SplitFaceNewVert **new_verts,
MemArena *memarena)
{
- /* This is now mandatory, trying to do the job in simple way without that data is doomed to fail, even when only
- * dealing with smooth/flat faces one can find cases that no simple algorithm can handle properly. */
+ /* This is now mandatory, trying to do the job in simple way without that data is doomed to fail,
+ * even when only dealing with smooth/flat faces one can find cases that no simple algorithm
+ * can handle properly. */
BLI_assert(lnors_spacearr != NULL);
const int loops_len = mesh->totloop;
@@ -1785,8 +1794,9 @@ static int split_faces_prepare_new_verts(const Mesh *mesh,
if (!vert_used) {
BLI_BITMAP_ENABLE(verts_used, vert_idx);
/* We need to update that vertex's normal here, we won't go over it again. */
- /* This is important! *DO NOT* set vnor to final computed lnor, vnor should always be defined to
- * 'automatic normal' value computed from its polys, not some custom normal.
+ /* This is important! *DO NOT* set vnor to final computed lnor,
+ * vnor should always be defined to 'automatic normal' value computed from its polys,
+ * not some custom normal.
* Fortunately, that's the loop normal space's 'lnor' reference vector. ;) */
normal_float_to_short_v3(mvert[vert_idx].no, (*lnor_space)->vec_lnor);
}
@@ -1938,8 +1948,9 @@ void BKE_mesh_split_faces(Mesh *mesh, bool free_loop_normals)
mesh, &lnors_spacearr, &new_verts, memarena);
if (num_new_verts > 0) {
- /* Reminder: beyond this point, there is no way out, mesh is in invalid state (due to early-reassignment of
- * loops' vertex and edge indices to new, to-be-created split ones). */
+ /* Reminder: beyond this point, there is no way out, mesh is in invalid state
+ * (due to early-reassignment of loops' vertex and edge indices to new,
+ * to-be-created split ones). */
const int num_new_edges = split_faces_prepare_new_edges(mesh, &new_edges, memarena);
/* We can have to split a vertex without having to add a single new edge... */
diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c
index 93017e77d36..0ef09b3fe74 100644
--- a/source/blender/blenkernel/intern/mesh_convert.c
+++ b/source/blender/blenkernel/intern/mesh_convert.c
@@ -656,7 +656,8 @@ void BKE_mesh_from_nurbs_displist(Main *bmain,
cu->mat = NULL;
cu->totcol = 0;
- /* Do not decrement ob->data usercount here, it's done at end of func with BKE_id_free_us() call. */
+ /* Do not decrement ob->data usercount here,
+ * it's done at end of func with BKE_id_free_us() call. */
ob->data = me;
ob->type = OB_MESH;
@@ -1036,9 +1037,10 @@ Mesh *BKE_mesh_new_from_object(Depsgraph *depsgraph,
BKE_id_free(NULL, tmpobj);
- /* XXX The curve to mesh conversion is convoluted... But essentially, BKE_mesh_from_nurbs_displist()
- * already transfers the ownership of materials from the temp copy of the Curve ID to the new
- * Mesh ID, so we do not want to increase materials' usercount later. */
+ /* XXX The curve to mesh conversion is convoluted...
+ * But essentially, BKE_mesh_from_nurbs_displist()
+ * already transfers the ownership of materials from the temp copy of the Curve ID to the
+ * new Mesh ID, so we do not want to increase materials' usercount later. */
do_mat_id_data_us = false;
break;
@@ -1361,7 +1363,8 @@ void BKE_mesh_nomain_to_mesh(Mesh *mesh_src,
bool take_ownership)
{
/* mesh_src might depend on mesh_dst, so we need to do everything with a local copy */
- /* TODO(Sybren): the above claim came from DM_to_mesh(); check whether it is still true with Mesh */
+ /* TODO(Sybren): the above claim came from DM_to_mesh();
+ * check whether it is still true with Mesh */
Mesh tmp = *mesh_dst;
int totvert, totedge /*, totface */ /* UNUSED */, totloop, totpoly;
int did_shapekeys = 0;
@@ -1429,8 +1432,8 @@ void BKE_mesh_nomain_to_mesh(Mesh *mesh_src,
/* not all DerivedMeshes store their verts/edges/faces in CustomData, so
* we set them here in case they are missing */
- /* TODO(Sybren): we could probably replace CD_ASSIGN with alloctype and always directly pass mesh_src->mxxx,
- * instead of using a ternary operator. */
+ /* TODO(Sybren): we could probably replace CD_ASSIGN with alloctype and
+ * always directly pass mesh_src->mxxx, instead of using a ternary operator. */
if (!CustomData_has_layer(&tmp.vdata, CD_MVERT)) {
CustomData_add_layer(&tmp.vdata,
CD_MVERT,
diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c
index 800d61a6a66..903803d83c3 100644
--- a/source/blender/blenkernel/intern/mesh_evaluate.c
+++ b/source/blender/blenkernel/intern/mesh_evaluate.c
@@ -168,7 +168,8 @@ void BKE_mesh_calc_normals_mapping_ex(MVert *mverts,
if (!pnors) {
pnors = MEM_calloc_arrayN((size_t)numPolys, sizeof(float[3]), __func__);
}
- /* if (!fnors) fnors = MEM_calloc_arrayN(numFaces, sizeof(float[3]), "face nors mesh.c"); */ /* NO NEED TO ALLOC YET */
+ /* NO NEED TO ALLOC YET */
+ /* if (!fnors) fnors = MEM_calloc_arrayN(numFaces, sizeof(float[3]), "face nors mesh.c"); */
if (only_face_normals == false) {
/* vertex normals are optional, they require some extra calculations,
@@ -366,7 +367,8 @@ void BKE_mesh_calc_normals_poly(MVert *mverts,
BLI_task_parallel_range(0, numPolys, &data, mesh_calc_normals_poly_prepare_cb, &settings);
/* Actually accumulate weighted loop normals into vertex ones. */
- /* Unfortunately, not possible to thread that (not in a reasonable, totally lock- and barrier-free fashion),
+ /* Unfortunately, not possible to thread that
+ * (not in a reasonable, totally lock- and barrier-free fashion),
* since several loops will point to the same vertex... */
for (int lidx = 0; lidx < numLoops; lidx++) {
add_v3_v3(vnors[mloop[lidx].v], data.lnors_weighted[lidx]);
@@ -424,7 +426,8 @@ void BKE_mesh_ensure_normals_for_display(Mesh *mesh)
}
}
-/* Note that this does not update the CD_NORMAL layer, but does update the normals in the CD_MVERT layer. */
+/* Note that this does not update the CD_NORMAL layer,
+ * but does update the normals in the CD_MVERT layer. */
void BKE_mesh_calc_normals(Mesh *mesh)
{
#ifdef DEBUG_TIME
@@ -609,7 +612,8 @@ MLoopNorSpace *BKE_lnor_space_create(MLoopNorSpaceArray *lnors_spacearr)
/* Should only be called once.
* Beware, this modifies ref_vec and other_vec in place!
- * In case no valid space can be generated, ref_alpha and ref_beta are set to zero (which means 'use auto lnors').
+ * In case no valid space can be generated, ref_alpha and ref_beta are set to zero
+ * (which means 'use auto lnors').
*/
void BKE_lnor_space_define(MLoopNorSpace *lnor_space,
const float lnor[3],
@@ -646,8 +650,10 @@ void BKE_lnor_space_define(MLoopNorSpace *lnor_space,
BLI_stack_discard(edge_vectors);
nbr++;
}
- /* Note: In theory, this could be 'nbr > 2', but there is one case where we only have two edges for
- * two loops: a smooth vertex with only two edges and two faces (our Monkey's nose has that, e.g.). */
+ /* Note: In theory, this could be 'nbr > 2',
+ * but there is one case where we only have two edges for two loops:
+ * a smooth vertex with only two edges and two faces (our Monkey's nose has that, e.g.).
+ */
BLI_assert(nbr >= 2); /* This piece of code shall only be called for more than one loop... */
lnor_space->ref_alpha = alpha / (float)nbr;
}
@@ -683,10 +689,11 @@ void BKE_lnor_space_define(MLoopNorSpace *lnor_space,
/**
* Add a new given loop to given lnor_space.
- * Depending on \a lnor_space->data_type, we expect \a bm_loop to be a pointer to BMLoop struct (in case of BMLOOP_PTR),
- * or NULL (in case of LOOP_INDEX), loop index is then stored in pointer.
- * If \a is_single is set, the BMLoop or loop index is directly stored in \a lnor_space->loops pointer (since there
- * is only one loop in this fan), else it is added to the linked list of loops in the fan.
+ * Depending on \a lnor_space->data_type, we expect \a bm_loop to be a pointer to BMLoop struct
+ * (in case of BMLOOP_PTR), or NULL (in case of LOOP_INDEX), loop index is then stored in pointer.
+ * If \a is_single is set, the BMLoop or loop index is directly stored in \a lnor_space->loops
+ * pointer (since there is only one loop in this fan),
+ * else it is added to the linked list of loops in the fan.
*/
void BKE_lnor_space_add_loop(MLoopNorSpaceArray *lnors_spacearr,
MLoopNorSpace *lnor_space,
@@ -775,7 +782,8 @@ void BKE_lnor_space_custom_normal_to_data(MLoopNorSpace *lnor_space,
alpha = saacosf(cos_alpha);
if (alpha > lnor_space->ref_alpha) {
- /* Note we could stick to [0, pi] range here, but makes decoding more complex, not worth it. */
+ /* Note we could stick to [0, pi] range here,
+ * but makes decoding more complex, not worth it. */
r_clnor_data[0] = unit_float_to_short(-(pi2 - alpha) / (pi2 - lnor_space->ref_alpha));
}
else {
@@ -812,17 +820,20 @@ void BKE_lnor_space_custom_normal_to_data(MLoopNorSpace *lnor_space,
typedef struct LoopSplitTaskData {
/* Specific to each instance (each task). */
- MLoopNorSpace *
- lnor_space; /* We have to create those outside of tasks, since afaik memarena is not threadsafe. */
+
+ /** We have to create those outside of tasks, since afaik memarena is not threadsafe. */
+ MLoopNorSpace *lnor_space;
float (*lnor)[3];
const MLoop *ml_curr;
const MLoop *ml_prev;
int ml_curr_index;
int ml_prev_index;
- const int *e2l_prev; /* Also used a flag to switch between single or fan process! */
+ /** Also used a flag to switch between single or fan process! */
+ const int *e2l_prev;
int mp_index;
- /* This one is special, it's owned and managed by worker tasks, avoid to have to create it for each fan! */
+ /** This one is special, it's owned and managed by worker tasks,
+ * avoid to have to create it for each fan! */
BLI_Stack *edge_vectors;
char pad_c;
@@ -830,8 +841,8 @@ typedef struct LoopSplitTaskData {
typedef struct LoopSplitTaskDataCommon {
/* Read/write.
- * Note we do not need to protect it, though, since two different tasks will *always* affect different
- * elements in the arrays. */
+ * Note we do not need to protect it, though, since two different tasks will *always* affect
+ * different elements in the arrays. */
MLoopNorSpaceArray *lnors_spacearr;
float (*loopnors)[3];
short (*clnors_data)[2];
@@ -895,8 +906,8 @@ static void mesh_edges_sharp_tag(LoopSplitTaskDataCommon *data,
loop_to_poly[ml_curr_index] = mp_index;
- /* Pre-populate all loop normals as if their verts were all-smooth, this way we don't have to compute
- * those later!
+ /* Pre-populate all loop normals as if their verts were all-smooth,
+ * this way we don't have to compute those later!
*/
if (loopnors) {
normal_short_to_float_v3(loopnors[ml_curr_index], mverts[ml_curr->v].no);
@@ -916,8 +927,8 @@ static void mesh_edges_sharp_tag(LoopSplitTaskDataCommon *data,
/* Second loop using this edge, time to test its sharpness.
* An edge is sharp if it is tagged as such, or its face is not smooth,
- * or both poly have opposed (flipped) normals, i.e. both loops on the same edge share the same vertex,
- * or angle between both its polys' normals is above split_angle value.
+ * or both poly have opposed (flipped) normals, i.e. both loops on the same edge share the
+ * same vertex, or angle between both its polys' normals is above split_angle value.
*/
if (!(mp->flag & ME_SMOOTH) || (medges[ml_curr->e].flag & ME_SHARP) ||
ml_curr->v == mloops[e2l[0]].v || is_angle_sharp) {
@@ -964,7 +975,8 @@ static void mesh_edges_sharp_tag(LoopSplitTaskDataCommon *data,
/** Define sharp edges as needed to mimic 'autosmooth' from angle threshold.
*
- * Used when defining an empty custom loop normals data layer, to keep same shading as with autosmooth!
+ * Used when defining an empty custom loop normals data layer,
+ * to keep same shading as with autosmooth!
*/
void BKE_edges_sharp_from_angle_set(const struct MVert *mverts,
const int UNUSED(numVerts),
@@ -1079,7 +1091,13 @@ static void split_loop_nor_single_do(LoopSplitTaskDataCommon *common_data, LoopS
*/
copy_v3_v3(*lnor, polynors[mp_index]);
- // printf("BASIC: handling loop %d / edge %d / vert %d / poly %d\n", ml_curr_index, ml_curr->e, ml_curr->v, mp_index);
+#if 0
+ printf("BASIC: handling loop %d / edge %d / vert %d / poly %d\n",
+ ml_curr_index,
+ ml_curr->e,
+ ml_curr->v,
+ mp_index);
+#endif
/* If needed, generate this (simple!) lnor space. */
if (lnors_spacearr) {
@@ -1100,7 +1118,8 @@ static void split_loop_nor_single_do(LoopSplitTaskDataCommon *common_data, LoopS
normalize_v3(vec_prev);
BKE_lnor_space_define(lnor_space, *lnor, vec_curr, vec_prev, NULL);
- /* We know there is only one loop in this space, no need to create a linklist in this case... */
+ /* We know there is only one loop in this space,
+ * no need to create a linklist in this case... */
BKE_lnor_space_add_loop(lnors_spacearr, lnor_space, ml_curr_index, NULL, true);
if (clnors_data) {
@@ -1138,10 +1157,10 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data, LoopSpli
/* Gah... We have to fan around current vertex, until we find the other non-smooth edge,
* and accumulate face normals into the vertex!
- * Note in case this vertex has only one sharp edges, this is a waste because the normal is the same as
- * the vertex normal, but I do not see any easy way to detect that (would need to count number
- * of sharp edges per vertex, I doubt the additional memory usage would be worth it, especially as
- * it should not be a common case in real-life meshes anyway).
+ * Note in case this vertex has only one sharp edges, this is a waste because the normal is the
+ * same as the vertex normal, but I do not see any easy way to detect that (would need to count
+ * number of sharp edges per vertex, I doubt the additional memory usage would be worth it,
+ * especially as it should not be a common case in real-life meshes anyway).
*/
const unsigned int mv_pivot_index = ml_curr->v; /* The vertex we are "fanning" around! */
const MVert *mv_pivot = &mverts[mv_pivot_index];
@@ -1193,8 +1212,8 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data, LoopSpli
while (true) {
const MEdge *me_curr = &medges[mlfan_curr->e];
/* Compute edge vectors.
- * NOTE: We could pre-compute those into an array, in the first iteration, instead of computing them
- * twice (or more) here. However, time gained is not worth memory and time lost,
+ * NOTE: We could pre-compute those into an array, in the first iteration, instead of computing
+ * them twice (or more) here. However, time gained is not worth memory and time lost,
* given the fact that this code should not be called that much in real-life meshes...
*/
{
@@ -1299,7 +1318,8 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data, LoopSpli
}
//print_v2("new clnors", clnors_avg);
}
- /* Extra bonus: since smallstack is local to this func, no more need to empty it at all cost! */
+ /* Extra bonus: since smallstack is local to this func,
+ * no more need to empty it at all cost! */
BKE_lnor_space_custom_data_to_normal(lnor_space, *clnor_ref, lnor);
}
@@ -1314,7 +1334,8 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data, LoopSpli
copy_v3_v3(nor, lnor);
}
}
- /* Extra bonus: since smallstack is local to this func, no more need to empty it at all cost! */
+ /* Extra bonus: since smallstack is local to this func,
+ * no more need to empty it at all cost! */
}
}
@@ -1367,7 +1388,8 @@ static void loop_split_worker(TaskPool *__restrict pool, void *taskdata, int UNU
}
/* Check whether gievn loop is part of an unknown-so-far cyclic smooth fan, or not.
- * Needed because cyclic smooth fans have no obvious 'entry point', and yet we need to walk them once, and only once. */
+ * Needed because cyclic smooth fans have no obvious 'entry point',
+ * and yet we need to walk them once, and only once. */
static bool loop_split_generator_check_cyclic_smooth_fan(const MLoop *mloops,
const MPoly *mpolys,
const int (*edge_to_loops)[2],
@@ -1425,8 +1447,8 @@ static bool loop_split_generator_check_cyclic_smooth_fan(const MLoop *mloops,
/* Smooth loop/edge... */
else if (BLI_BITMAP_TEST(skip_loops, mlfan_vert_index)) {
if (mlfan_vert_index == ml_curr_index) {
- /* We walked around a whole cyclic smooth fan without finding any already-processed loop, means we can
- * use initial ml_curr/ml_prev edge as start for this smooth fan. */
+ /* We walked around a whole cyclic smooth fan without finding any already-processed loop,
+ * means we can use initial ml_curr/ml_prev edge as start for this smooth fan. */
return true;
}
/* ... already checked in some previous looping, we can abort. */
@@ -1464,7 +1486,8 @@ static void loop_split_generator(TaskPool *pool, LoopSplitTaskDataCommon *common
LoopSplitTaskData *data_buff = NULL;
int data_idx = 0;
- /* Temp edge vectors stack, only used when computing lnor spacearr (and we are not multi-threading). */
+ /* Temp edge vectors stack, only used when computing lnor spacearr
+ * (and we are not multi-threading). */
BLI_Stack *edge_vectors = NULL;
#ifdef DEBUG_TIME
@@ -1477,8 +1500,8 @@ static void loop_split_generator(TaskPool *pool, LoopSplitTaskDataCommon *common
}
}
- /* We now know edges that can be smoothed (with their vector, and their two loops), and edges that will be hard!
- * Now, time to generate the normals.
+ /* We now know edges that can be smoothed (with their vector, and their two loops),
+ * and edges that will be hard! Now, time to generate the normals.
*/
for (mp = mpolys, mp_index = 0; mp_index < numPolys; mp++, mp_index++) {
float(*lnors)[3];
@@ -1494,17 +1517,25 @@ static void loop_split_generator(TaskPool *pool, LoopSplitTaskDataCommon *common
const int *e2l_curr = edge_to_loops[ml_curr->e];
const int *e2l_prev = edge_to_loops[ml_prev->e];
- // printf("Checking loop %d / edge %u / vert %u (sharp edge: %d, skiploop: %d)...",
- // ml_curr_index, ml_curr->e, ml_curr->v, IS_EDGE_SHARP(e2l_curr), BLI_BITMAP_TEST_BOOL(skip_loops, ml_curr_index));
+#if 0
+ printf("Checking loop %d / edge %u / vert %u (sharp edge: %d, skiploop: %d)...",
+ ml_curr_index,
+ ml_curr->e,
+ ml_curr->v,
+ IS_EDGE_SHARP(e2l_curr),
+ BLI_BITMAP_TEST_BOOL(skip_loops, ml_curr_index));
+#endif
/* A smooth edge, we have to check for cyclic smooth fan case.
- * If we find a new, never-processed cyclic smooth fan, we can do it now using that loop/edge as
- * 'entry point', otherwise we can skip it. */
+ * If we find a new, never-processed cyclic smooth fan, we can do it now using that loop/edge
+ * as 'entry point', otherwise we can skip it. */
+
/* Note: In theory, we could make loop_split_generator_check_cyclic_smooth_fan() store
- * mlfan_vert_index'es and edge indexes in two stacks, to avoid having to fan again around the vert during
- * actual computation of clnor & clnorspace. However, this would complicate the code, add more memory usage,
- * and despite its logical complexity, loop_manifold_fan_around_vert_next() is quite cheap in term of
- * CPU cycles, so really think it's not worth it. */
+ * mlfan_vert_index'es and edge indexes in two stacks, to avoid having to fan again around
+ * the vert during actual computation of clnor & clnorspace. However, this would complicate
+ * the code, add more memory usage, and despite its logical complexity,
+ * loop_manifold_fan_around_vert_next() is quite cheap in term of CPU cycles,
+ * so really think it's not worth it. */
if (!IS_EDGE_SHARP(e2l_curr) && (BLI_BITMAP_TEST(skip_loops, ml_curr_index) ||
!loop_split_generator_check_cyclic_smooth_fan(mloops,
mpolys,
@@ -1551,10 +1582,11 @@ static void loop_split_generator(TaskPool *pool, LoopSplitTaskDataCommon *common
}
}
/* We *do not need* to check/tag loops as already computed!
- * Due to the fact a loop only links to one of its two edges, a same fan *will never be walked
- * more than once!*
- * Since we consider edges having neighbor polys with inverted (flipped) normals as sharp, we are sure
- * that no fan will be skipped, even only considering the case (sharp curr_edge, smooth prev_edge),
+ * Due to the fact a loop only links to one of its two edges,
+ * a same fan *will never be walked more than once!*
+ * Since we consider edges having neighbor polys with inverted
+ * (flipped) normals as sharp, we are sure that no fan will be skipped,
+ * even only considering the case (sharp curr_edge, smooth prev_edge),
* and not the alternative (smooth curr_edge, sharp prev_edge).
* All this due/thanks to link between normals and loop ordering (i.e. winding).
*/
@@ -1590,7 +1622,8 @@ static void loop_split_generator(TaskPool *pool, LoopSplitTaskDataCommon *common
}
}
- /* Last block of data... Since it is calloc'ed and we use first NULL item as stopper, everything is fine. */
+ /* Last block of data... Since it is calloc'ed and we use first NULL item as stopper,
+ * everything is fine. */
if (pool && data_idx) {
BLI_task_pool_push(pool, loop_split_worker, data_buff, true, TASK_PRIORITY_LOW);
}
@@ -1607,7 +1640,8 @@ static void loop_split_generator(TaskPool *pool, LoopSplitTaskDataCommon *common
/**
* Compute split normals, i.e. vertex normals associated with each poly (hence 'loop normals').
- * Useful to materialize sharp edges (or non-smooth faces) without actually modifying the geometry (splitting edges).
+ * Useful to materialize sharp edges (or non-smooth faces) without actually modifying the geometry
+ * (splitting edges).
*/
void BKE_mesh_normals_loop_split(const MVert *mverts,
const int UNUSED(numVerts),
@@ -1625,14 +1659,17 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
short (*clnors_data)[2],
int *r_loop_to_poly)
{
- /* For now this is not supported. If we do not use split normals, we do not generate anything fancy! */
+ /* For now this is not supported.
+ * If we do not use split normals, we do not generate anything fancy! */
BLI_assert(use_split_normals || !(r_lnors_spacearr));
if (!use_split_normals) {
/* In this case, we simply fill lnors with vnors (or fnors for flat faces), quite simple!
* Note this is done here to keep some logic and consistency in this quite complex code,
- * since we may want to use lnors even when mesh's 'autosmooth' is disabled (see e.g. mesh mapping code).
- * As usual, we could handle that on case-by-case basis, but simpler to keep it well confined here.
+ * since we may want to use lnors even when mesh's 'autosmooth' is disabled
+ * (see e.g. mesh mapping code).
+ * As usual, we could handle that on case-by-case basis,
+ * but simpler to keep it well confined here.
*/
int mp_index;
@@ -1657,15 +1694,20 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
return;
}
- /* Mapping edge -> loops.
- * If that edge is used by more than two loops (polys), it is always sharp (and tagged as such, see below).
- * We also use the second loop index as a kind of flag: smooth edge: > 0,
- * sharp edge: < 0 (INDEX_INVALID || INDEX_UNSET),
- * unset: INDEX_UNSET
- * Note that currently we only have two values for second loop of sharp edges. However, if needed, we can
- * store the negated value of loop index instead of INDEX_INVALID to retrieve the real value later in code).
- * Note also that lose edges always have both values set to 0!
- */
+ /**
+ * Mapping edge -> loops.
+ * If that edge is used by more than two loops (polys),
+ * it is always sharp (and tagged as such, see below).
+ * We also use the second loop index as a kind of flag:
+ *
+ * - smooth edge: > 0.
+ * - sharp edge: < 0 (INDEX_INVALID || INDEX_UNSET).
+ * - unset: INDEX_UNSET.
+ *
+ * Note that currently we only have two values for second loop of sharp edges.
+ * However, if needed, we can store the negated value of loop index instead of INDEX_INVALID
+ * to retrieve the real value later in code).
+ * Note also that lose edges always have both values set to 0! */
int(*edge_to_loops)[2] = MEM_calloc_arrayN((size_t)numEdges, sizeof(*edge_to_loops), __func__);
/* Simple mapping from a loop to its polygon index. */
@@ -1750,12 +1792,12 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
/**
* Compute internal representation of given custom normals (as an array of float[2]).
- * It also makes sure the mesh matches those custom normals, by setting sharp edges flag as needed to get a
- * same custom lnor for all loops sharing a same smooth fan.
+ * It also makes sure the mesh matches those custom normals, by setting sharp edges flag as needed
+ * to get a same custom lnor for all loops sharing a same smooth fan.
* If use_vertices if true, r_custom_loopnors is assumed to be per-vertex, not per-loop
* (this allows to set whole vert's normals at once, useful in some cases).
- * r_custom_loopnors is expected to have normalized normals, or zero ones, in which case they will be replaced
- * by default loop/vertex normal.
+ * r_custom_loopnors is expected to have normalized normals, or zero ones,
+ * in which case they will be replaced by default loop/vertex normal.
*/
static void mesh_normals_loop_custom_set(const MVert *mverts,
const int numVerts,
@@ -1770,17 +1812,19 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
short (*r_clnors_data)[2],
const bool use_vertices)
{
- /* We *may* make that poor BKE_mesh_normals_loop_split() even more complex by making it handling that
- * feature too, would probably be more efficient in absolute.
+ /* We *may* make that poor BKE_mesh_normals_loop_split() even more complex by making it handling
+ * that feature too, would probably be more efficient in absolute.
* However, this function *is not* performance-critical, since it is mostly expected to be called
- * by io addons when importing custom normals, and modifier (and perhaps from some editing tools later?).
+ * by io addons when importing custom normals, and modifier
+ * (and perhaps from some editing tools later?).
* So better to keep some simplicity here, and just call BKE_mesh_normals_loop_split() twice!
*/
MLoopNorSpaceArray lnors_spacearr = {NULL};
BLI_bitmap *done_loops = BLI_BITMAP_NEW((size_t)numLoops, __func__);
float(*lnors)[3] = MEM_calloc_arrayN((size_t)numLoops, sizeof(*lnors), __func__);
int *loop_to_poly = MEM_malloc_arrayN((size_t)numLoops, sizeof(int), __func__);
- /* In this case we always consider split nors as ON, and do not want to use angle to define smooth fans! */
+ /* In this case we always consider split nors as ON,
+ * and do not want to use angle to define smooth fans! */
const bool use_split_normals = true;
const float split_angle = (float)M_PI;
int i;
@@ -1822,12 +1866,12 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
BLI_assert(lnors_spacearr.data_type == MLNOR_SPACEARR_LOOP_INDEX);
- /* Now, check each current smooth fan (one lnor space per smooth fan!), and if all its matching custom lnors
- * are not (enough) equal, add sharp edges as needed.
- * This way, next time we run BKE_mesh_normals_loop_split(), we'll get lnor spacearr/smooth fans matching
- * given custom lnors.
- * Note this code *will never* unsharp edges!
- * And quite obviously, when we set custom normals per vertices, running this is absolutely useless.
+ /* Now, check each current smooth fan (one lnor space per smooth fan!),
+ * and if all its matching custom lnors are not (enough) equal, add sharp edges as needed.
+ * This way, next time we run BKE_mesh_normals_loop_split(), we'll get lnor spacearr/smooth fans
+ * matching given custom lnors.
+ * Note this code *will never* unsharp edges! And quite obviously,
+ * when we set custom normals per vertices, running this is absolutely useless.
*/
if (!use_vertices) {
for (i = 0; i < numLoops; i++) {
@@ -1845,13 +1889,13 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
if (!BLI_BITMAP_TEST(done_loops, i)) {
/* Notes:
- * * In case of mono-loop smooth fan, we have nothing to do.
- * * Loops in this linklist are ordered (in reversed order compared to how they were discovered by
- * BKE_mesh_normals_loop_split(), but this is not a problem). Which means if we find a
- * mismatching clnor, we know all remaining loops will have to be in a new, different smooth fan/
- * lnor space.
- * * In smooth fan case, we compare each clnor against a ref one, to avoid small differences adding
- * up into a real big one in the end!
+ * * In case of mono-loop smooth fan, we have nothing to do.
+ * * Loops in this linklist are ordered (in reversed order compared to how they were
+ * discovered by BKE_mesh_normals_loop_split(), but this is not a problem).
+ * Which means if we find a mismatching clnor,
+ * we know all remaining loops will have to be in a new, different smooth fan/lnor space.
+ * * In smooth fan case, we compare each clnor against a ref one,
+ * to avoid small differences adding up into a real big one in the end!
*/
if (lnors_spacearr.lspacearr[i]->flags & MLNOR_SPACE_IS_SINGLE) {
BLI_BITMAP_ENABLE(done_loops, i);
@@ -1874,8 +1918,8 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
else if (dot_v3v3(org_nor, nor) < LNOR_SPACE_TRIGO_THRESHOLD) {
/* Current normal differs too much from org one, we have to tag the edge between
* previous loop's face and current's one as sharp.
- * We know those two loops do not point to the same edge, since we do not allow reversed winding
- * in a same smooth fan.
+ * We know those two loops do not point to the same edge,
+ * since we do not allow reversed winding in a same smooth fan.
*/
const MPoly *mp = &mpolys[loop_to_poly[lidx]];
const MLoop *mlp =
@@ -1890,7 +1934,8 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
BLI_BITMAP_ENABLE(done_loops, lidx);
}
- /* We also have to check between last and first loops, otherwise we may miss some sharp edges here!
+ /* We also have to check between last and first loops,
+ * otherwise we may miss some sharp edges here!
* This is just a simplified version of above while loop.
* See T45984. */
loops = lnors_spacearr.lspacearr[i]->loops;
@@ -1932,7 +1977,8 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
BLI_bitmap_set_all(done_loops, true, (size_t)numLoops);
}
- /* And we just have to convert plain object-space custom normals to our lnor space-encoded ones. */
+ /* And we just have to convert plain object-space custom normals to our
+ * lnor space-encoded ones. */
for (i = 0; i < numLoops; i++) {
if (!lnors_spacearr.lspacearr[i]) {
BLI_BITMAP_DISABLE(done_loops, i);
@@ -1943,9 +1989,9 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
}
if (BLI_BITMAP_TEST_BOOL(done_loops, i)) {
- /* Note we accumulate and average all custom normals in current smooth fan, to avoid getting different
- * clnors data (tiny differences in plain custom normals can give rather huge differences in
- * computed 2D factors).
+ /* Note we accumulate and average all custom normals in current smooth fan,
+ * to avoid getting different clnors data (tiny differences in plain custom normals can
+ * give rather huge differences in computed 2D factors).
*/
LinkNode *loops = lnors_spacearr.lspacearr[i]->loops;
if (lnors_spacearr.lspacearr[i]->flags & MLNOR_SPACE_IS_SINGLE) {
@@ -2092,7 +2138,8 @@ static void mesh_set_custom_normals(Mesh *mesh, float (*r_custom_nors)[3], const
}
/**
- * Higher level functions hiding most of the code needed around call to #BKE_mesh_normals_loop_custom_set().
+ * Higher level functions hiding most of the code needed around call to
+ * #BKE_mesh_normals_loop_custom_set().
*
* \param r_custom_loopnors is not const, since code will replace zero_v3 normals there
* with automatically computed vectors.
@@ -2103,7 +2150,8 @@ void BKE_mesh_set_custom_normals(Mesh *mesh, float (*r_custom_loopnors)[3])
}
/**
- * Higher level functions hiding most of the code needed around call to #BKE_mesh_normals_loop_custom_from_vertices_set().
+ * Higher level functions hiding most of the code needed around call to
+ * #BKE_mesh_normals_loop_custom_from_vertices_set().
*
* \param r_custom_loopnors is not const, since code will replace zero_v3 normals there
* with automatically computed vectors.
@@ -2327,7 +2375,8 @@ float BKE_mesh_calc_poly_area(const MPoly *mpoly, const MLoop *loopstart, const
}
/**
- * Calculate the volume and volume-weighted centroid of the volume formed by the polygon and the origin.
+ * Calculate the volume and volume-weighted centroid of the volume
+ * formed by the polygon and the origin.
* Results will be negative if the origin is "outside" the polygon
* (+ve normal side), but the polygon may be non-planar with no effect.
*
@@ -2339,8 +2388,8 @@ float BKE_mesh_calc_poly_area(const MPoly *mpoly, const MLoop *loopstart, const
* - Volume is 6x actual volume, and centroid is 4x actual volume-weighted centroid
* (so division can be done once at the end).
* - Results will have bias if polygon is non-planar.
- * - The resulting volume will only be correct if the mesh is manifold and has consistent face winding
- * (non-contiguous face normals or holes in the mesh surface).
+ * - The resulting volume will only be correct if the mesh is manifold and has consistent
+ * face winding (non-contiguous face normals or holes in the mesh surface).
*/
static float mesh_calc_poly_volume_centroid(const MPoly *mpoly,
const MLoop *loopstart,
@@ -2369,7 +2418,8 @@ static float mesh_calc_poly_volume_centroid(const MPoly *mpoly,
* of the triangle and the origin as the fourth vertex.
* The centroid is simply the average of the 4 vertices.
*
- * Note that the vector is 4x the actual centroid so the division can be done once at the end. */
+ * Note that the vector is 4x the actual centroid
+ * so the division can be done once at the end. */
for (uint j = 0; j < 3; j++) {
r_cent[j] += tetra_volume * (v_pivot[j] + v_step1[j] + v_step2[j]);
}
@@ -2541,7 +2591,8 @@ bool BKE_mesh_center_of_surface(const Mesh *me, float r_cent[3])
}
/**
- * \note Mesh must be manifold with consistent face-winding, see #mesh_calc_poly_volume_centroid for details.
+ * \note Mesh must be manifold with consistent face-winding,
+ * see #mesh_calc_poly_volume_centroid for details.
*/
bool BKE_mesh_center_of_volume(const Mesh *me, float r_cent[3])
{
@@ -2565,7 +2616,8 @@ 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) {
/* 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 */
+ /* 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);
}
@@ -2774,9 +2826,11 @@ void BKE_mesh_loops_to_mface_corners(
/**
* Convert all CD layers from loop/poly to tessface data.
*
- * \param loopindices: is an array of an int[4] per tessface, mapping tessface's verts to loops indices.
+ * \param loopindices: is an array of an int[4] per tessface,
+ * mapping tessface's verts to loops indices.
*
- * \note when mface is not NULL, mface[face_index].v4 is used to test quads, else, loopindices[face_index][3] is used.
+ * \note when mface is not NULL, mface[face_index].v4
+ * is used to test quads, else, loopindices[face_index][3] is used.
*/
void BKE_mesh_loops_to_tessdata(CustomData *fdata,
CustomData *ldata,
@@ -2785,9 +2839,10 @@ void BKE_mesh_loops_to_tessdata(CustomData *fdata,
unsigned int (*loopindices)[4],
const int num_faces)
{
- /* Note: performances are sub-optimal when we get a NULL mface, we could be ~25% quicker with dedicated code...
- * Issue is, unless having two different functions with nearly the same code, there's not much ways to solve
- * this. Better imho to live with it for now. :/ --mont29
+ /* Note: performances are sub-optimal when we get a NULL mface,
+ * we could be ~25% quicker with dedicated code...
+ * Issue is, unless having two different functions with nearly the same code,
+ * there's not much ways to solve this. Better imho to live with it for now. :/ --mont29
*/
const int numUV = CustomData_number_of_layers(ldata, CD_MLOOPUV);
const int numCol = CustomData_number_of_layers(ldata, CD_MLOOPCOL);
@@ -2878,9 +2933,10 @@ void BKE_mesh_tangent_loops_to_tessdata(CustomData *fdata,
const int num_faces,
const char *layer_name)
{
- /* Note: performances are sub-optimal when we get a NULL mface, we could be ~25% quicker with dedicated code...
- * Issue is, unless having two different functions with nearly the same code, there's not much ways to solve
- * this. Better imho to live with it for now. :/ --mont29
+ /* Note: performances are sub-optimal when we get a NULL mface,
+ * we could be ~25% quicker with dedicated code...
+ * Issue is, unless having two different functions with nearly the same code,
+ * there's not much ways to solve this. Better imho to live with it for now. :/ --mont29
*/
float(*ftangents)[4] = NULL;
@@ -2920,7 +2976,8 @@ void BKE_mesh_tangent_loops_to_tessdata(CustomData *fdata,
/**
* Recreate tessellation.
*
- * \param do_face_nor_copy: Controls whether the normals from the poly are copied to the tessellated faces.
+ * \param do_face_nor_copy: Controls whether the normals from the poly
+ * are copied to the tessellated faces.
*
* \return number of tessellation faces.
*/
@@ -3150,9 +3207,11 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata,
/* NOTE: quad detection issue - fourth vertidx vs fourth loopidx:
* Polygons take care of their loops ordering, hence not of their vertices ordering.
- * Currently, our tfaces' fourth vertex index might be 0 even for a quad. However, we know our fourth loop index is
- * never 0 for quads (because they are sorted for polygons, and our quads are still mere copies of their polygons).
- * So we pass NULL as MFace pointer, and BKE_mesh_loops_to_tessdata will use the fourth loop index as quad test.
+ * Currently, our tfaces' fourth vertex index might be 0 even for a quad. However,
+ * we know our fourth loop index is never 0 for quads (because they are sorted for polygons,
+ * and our quads are still mere copies of their polygons).
+ * So we pass NULL as MFace pointer, and BKE_mesh_loops_to_tessdata
+ * will use the fourth loop index as quad test.
* ...
*/
BKE_mesh_loops_to_tessdata(fdata, ldata, NULL, mface_to_poly_map, lindices, totface);
@@ -3451,15 +3510,17 @@ void BKE_mesh_convert_mfaces_to_mpolys(Mesh *mesh)
BKE_mesh_update_customdata_pointers(mesh, true);
}
-/* the same as BKE_mesh_convert_mfaces_to_mpolys but oriented to be used in do_versions from readfile.c
+/**
+ * The same as #BKE_mesh_convert_mfaces_to_mpolys
+ * but oriented to be used in #do_versions from readfile.c
* the difference is how active/render/clone/stencil indices are handled here
*
* normally thay're being set from pdata which totally makes sense for meshes which are already
* converted to bmesh structures, but when loading older files indices shall be updated in other
* way around, so newly added pdata and ldata would have this indices set based on fdata layer
*
- * this is normally only needed when reading older files, in all other cases BKE_mesh_convert_mfaces_to_mpolys
- * shall be always used
+ * this is normally only needed when reading older files,
+ * in all other cases #BKE_mesh_convert_mfaces_to_mpolys shall be always used
*/
void BKE_mesh_do_versions_convert_mfaces_to_mpolys(Mesh *mesh)
{
@@ -3544,7 +3605,8 @@ void BKE_mesh_convert_mfaces_to_mpolys_ex(ID *id,
for (i = 0; i < totedge_i; i++, me++) {
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 */
+ /* unrelated but avoid having the FGON flag enabled,
+ * so we can reuse it later for something else */
me->flag &= ~ME_FGON;
}
@@ -3673,7 +3735,8 @@ void BKE_mesh_polygon_flip_ex(MPoly *mpoly,
/* Note that we keep same start vertex for flipped face. */
/* We also have to update loops edge
- * (they will get their original 'other edge', that is, the original edge of their original previous loop)... */
+ * (they will get their original 'other edge', that is,
+ * the original edge of their original previous loop)... */
unsigned int prev_edge_index = mloop[loopstart].e;
mloop[loopstart].e = mloop[loopend].e;
diff --git a/source/blender/blenkernel/intern/mesh_iterators.c b/source/blender/blenkernel/intern/mesh_iterators.c
index 1f8436408fb..df6517066b8 100644
--- a/source/blender/blenkernel/intern/mesh_iterators.c
+++ b/source/blender/blenkernel/intern/mesh_iterators.c
@@ -99,7 +99,8 @@ void BKE_mesh_foreach_mapped_loop(Mesh *mesh,
void *userData,
MeshForeachFlag flag)
{
- /* We can't use dm->getLoopDataLayout(dm) here, we want to always access dm->loopData, EditDerivedBMesh would
+ /* We can't use dm->getLoopDataLayout(dm) here,
+ * we want to always access dm->loopData, EditDerivedBMesh would
* return loop data from bmesh itself. */
const float(*lnors)[3] = (flag & MESH_FOREACH_USE_NORMAL) ?
CustomData_get_layer(&mesh->ldata, CD_NORMAL) :
diff --git a/source/blender/blenkernel/intern/mesh_mapping.c b/source/blender/blenkernel/intern/mesh_mapping.c
index 69ed804a75c..40e300e6e2d 100644
--- a/source/blender/blenkernel/intern/mesh_mapping.c
+++ b/source/blender/blenkernel/intern/mesh_mapping.c
@@ -42,8 +42,8 @@
* \{ */
/* ngon version wip, based on BM_uv_vert_map_create */
-/* this replaces the non bmesh function (in trunk) which takes MTFace's, if we ever need it back we could
- * but for now this replaces it because its unused. */
+/* this replaces the non bmesh function (in trunk) which takes MTFace's,
+ * if we ever need it back we could but for now this replaces it because its unused. */
UvVertMap *BKE_mesh_uv_vert_map_create(const MPoly *mpoly,
const MLoop *mloop,
@@ -251,7 +251,8 @@ static void mesh_vert_poly_or_loop_map_create(MeshElemMap **r_map,
}
/**
- * Generates a map where the key is the vertex and the value is a list of polys that use that vertex as a corner.
+ * Generates a map where the key is the vertex and the value
+ * is a list of polys that use that vertex as a corner.
* The lists are allocated from one memory pool.
*/
void BKE_mesh_vert_poly_map_create(MeshElemMap **r_map,
@@ -266,7 +267,8 @@ void BKE_mesh_vert_poly_map_create(MeshElemMap **r_map,
}
/**
- * Generates a map where the key is the vertex and the value is a list of loops that use that vertex as a corner.
+ * Generates a map where the key is the vertex and the value
+ * is a list of loops that use that vertex as a corner.
* The lists are allocated from one memory pool.
*/
void BKE_mesh_vert_loop_map_create(MeshElemMap **r_map,
@@ -281,7 +283,8 @@ void BKE_mesh_vert_loop_map_create(MeshElemMap **r_map,
}
/**
- * Generates a map where the key is the edge and the value is a list of looptris that use that edge.
+ * Generates a map where the key is the edge and the value
+ * is a list of looptris that use that edge.
* The lists are allocated from one memory pool.
*/
void BKE_mesh_vert_looptri_map_create(MeshElemMap **r_map,
@@ -329,7 +332,8 @@ void BKE_mesh_vert_looptri_map_create(MeshElemMap **r_map,
}
/**
- * Generates a map where the key is the vertex and the value is a list of edges that use that vertex as an endpoint.
+ * Generates a map where the key is the vertex and the value
+ * is a list of edges that use that vertex as an endpoint.
* The lists are allocated from one memory pool.
*/
void BKE_mesh_vert_edge_map_create(
@@ -372,7 +376,8 @@ void BKE_mesh_vert_edge_map_create(
}
/**
- * A version of #BKE_mesh_vert_edge_map_create that references connected vertices directly (not their edges).
+ * A version of #BKE_mesh_vert_edge_map_create that references connected vertices directly
+ * (not their edges).
*/
void BKE_mesh_vert_edge_vert_map_create(
MeshElemMap **r_map, int **r_mem, const MEdge *medge, int totvert, int totedge)
@@ -472,7 +477,8 @@ void BKE_mesh_edge_loop_map_create(MeshElemMap **r_map,
}
/**
- * Generates a map where the key is the edge and the value is a list of polygons that use that edge.
+ * Generates a map where the key is the edge and the value
+ * is a list of polygons that use that edge.
* The lists are allocated from one memory pool.
*/
void BKE_mesh_edge_poly_map_create(MeshElemMap **r_map,
@@ -739,7 +745,8 @@ static void poly_edge_loop_islands_calc(const MEdge *medge,
num_edgeborders++;
}
if (use_bitflags) {
- /* Find contiguous smooth groups already assigned, these are the values we can't reuse! */
+ /* Find contiguous smooth groups already assigned,
+ * these are the values we can't reuse! */
for (; i--; p++) {
int bit = poly_groups[*p];
if (!ELEM(bit, 0, poly_group_id, poly_group_id_overflowed) &&
@@ -751,8 +758,9 @@ static void poly_edge_loop_islands_calc(const MEdge *medge,
}
}
}
- /* And now, we have all our poly from current group in poly_stack (from 0 to (ps_end_idx - 1)), as well as
- * all smoothgroups bits we can't use in bit_poly_group_mask.
+ /* And now, we have all our poly from current group in poly_stack
+ * (from 0 to (ps_end_idx - 1)),
+ * as well as all smoothgroups bits we can't use in bit_poly_group_mask.
*/
if (use_bitflags) {
int i, *p, gid_bit = 0;
@@ -764,8 +772,9 @@ static void poly_edge_loop_islands_calc(const MEdge *medge,
}
if (UNLIKELY(gid_bit > 31)) {
/* All bits used in contiguous smooth groups, we can't do much!
- * Note: this is *very* unlikely - theoretically, four groups are enough, I don't think we can reach
- * this goal with such a simple algo, but I don't think either we'll never need all 32 groups!
+ * Note: this is *very* unlikely - theoretically, four groups are enough,
+ * I don't think we can reach this goal with such a simple algo,
+ * but I don't think either we'll never need all 32 groups!
*/
printf(
"Warning, could not find an available id for current smooth group, faces will me "
@@ -821,7 +830,8 @@ static bool poly_is_island_boundary_smooth_cb(const MPoly *mp,
const int nbr_egde_users,
void *UNUSED(user_data))
{
- /* Edge is sharp if its poly is sharp, or edge itself is sharp, or edge is not used by exactly two polygons. */
+ /* Edge is sharp if its poly is sharp, or edge itself is sharp,
+ * or edge is not used by exactly two polygons. */
return (!(mp->flag & ME_SMOOTH) || (me->flag & ME_SHARP) || (nbr_egde_users != 2));
}
@@ -829,9 +839,9 @@ static bool poly_is_island_boundary_smooth_cb(const MPoly *mp,
* Calculate smooth groups from sharp edges.
*
* \param r_totgroup: The total number of groups, 1 or more.
- * \return Polygon aligned array of group index values (bitflags if use_bitflags is true), starting at 1
- * (0 being used as 'invalid' flag).
- * Note it's callers's responsibility to MEM_freeN returned array.
+ * \return Polygon aligned array of group index values (bitflags if use_bitflags is true),
+ * starting at 1 (0 being used as 'invalid' flag).
+ * Note it's callers's responsibility to MEM_freeN returned array.
*/
int *BKE_mesh_calc_smoothgroups(const MEdge *medge,
const int totedge,
@@ -972,10 +982,11 @@ void BKE_mesh_loop_islands_add(MeshIslandStore *island_store,
sizeof(*innrcut->indices) * (size_t)num_innercut_items);
}
-/* TODO: I'm not sure edge seam flag is enough to define UV islands? Maybe we should also consider UVmaps values
+/* TODO: I'm not sure edge seam flag is enough to define UV islands?
+ * Maybe we should also consider UVmaps values
* themselves (i.e. different UV-edges for a same mesh-edge => boundary edge too?).
- * Would make things much more complex though, and each UVMap would then need its own mesh mapping,
- * not sure we want that at all!
+ * Would make things much more complex though,
+ * and each UVMap would then need its own mesh mapping, not sure we want that at all!
*/
typedef struct MeshCheckIslandBoundaryUv {
const MLoop *loops;
@@ -1052,8 +1063,9 @@ static bool mesh_calc_islands_loop_poly_uv(MVert *UNUSED(verts),
int *loop_indices;
int num_pidx, num_lidx;
- /* Those are used to detect 'inner cuts', i.e. edges that are borders, and yet have two or more polys of
- * a same group using them (typical case: seam used to unwrap properly a cylinder). */
+ /* Those are used to detect 'inner cuts', i.e. edges that are borders,
+ * and yet have two or more polys of a same group using them
+ * (typical case: seam used to unwrap properly a cylinder). */
BLI_bitmap *edge_borders = NULL;
int num_edge_borders = 0;
char *edge_border_count = NULL;
@@ -1175,7 +1187,8 @@ static bool mesh_calc_islands_loop_poly_uv(MVert *UNUSED(verts),
}
/**
- * Calculate 'generic' UV islands, i.e. based only on actual geometry data (edge seams), not some UV layers coordinates.
+ * Calculate 'generic' UV islands, i.e. based only on actual geometry data (edge seams),
+ * not some UV layers coordinates.
*/
bool BKE_mesh_calc_islands_loop_poly_edgeseam(MVert *verts,
const int totvert,
@@ -1195,12 +1208,14 @@ bool BKE_mesh_calc_islands_loop_poly_edgeseam(MVert *verts,
* Calculate UV islands.
*
* \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 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.
+ * This has the advantages of simplicity, and being valid/common to all UV maps.
+ * 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...
- * Not sure it would be worth the more complex code, though, those loops are supposed to be really quick to do...
+ * Not sure it would be worth the more complex code, though,
+ * those loops are supposed to be really quick to do...
*/
bool BKE_mesh_calc_islands_loop_poly_uvmap(MVert *verts,
const int totvert,
diff --git a/source/blender/blenkernel/intern/mesh_merge.c b/source/blender/blenkernel/intern/mesh_merge.c
index 31988c7b566..71cc20c78b7 100644
--- a/source/blender/blenkernel/intern/mesh_merge.c
+++ b/source/blender/blenkernel/intern/mesh_merge.c
@@ -41,8 +41,8 @@
* Poly compare with vtargetmap
* Function used by #BKE_mesh_merge_verts.
* The function compares poly_source after applying vtargetmap, with poly_target.
- * The two polys are identical if they share the same vertices in the same order, or in reverse order,
- * but starting position loopstart may be different.
+ * The two polys are identical if they share the same vertices in the same order,
+ * or in reverse order, but starting position loopstart may be different.
* The function is called with direct_reverse=1 for same order (i.e. same normal),
* and may be called again with direct_reverse=-1 for reverse order.
* \return 1 if polys are identical, 0 if polys are different.
@@ -159,7 +159,8 @@ static int cddm_poly_compare(MLoop *mloop_array,
break;
}
- /* Adjust i_loop_target for cycling around and for direct/reverse order defined by delta = +1 or -1 */
+ /* Adjust i_loop_target for cycling around and for direct/reverse order
+ * defined by delta = +1 or -1 */
i_loop_target_adjusted = (i_loop_target_start + direct_reverse * i_loop_target_offset) %
mpoly_target->totloop;
if (i_loop_target_adjusted < 0) {
@@ -213,8 +214,8 @@ static bool poly_gset_compare_fn(const void *k1, const void *k2)
* \param vtargetmap: The table that maps vertices to target vertices. a value of -1
* indicates a vertex is a target, and is to be kept.
* This array is aligned with 'mesh->totvert'
- * \warning \a vtargetmap must **not** contain any chained mapping (v1 -> v2 -> v3 etc.), this is not supported
- * and will likely generate corrupted geometry.
+ * \warning \a vtargetmap must **not** contain any chained mapping (v1 -> v2 -> v3 etc.),
+ * this is not supported and will likely generate corrupted geometry.
*
* \param tot_vtargetmap: The number of non '-1' values in vtargetmap. (not the size)
*
@@ -230,10 +231,12 @@ static bool poly_gset_compare_fn(const void *k1, const void *k2)
* Indeed it could be that all of a poly's vertices are merged,
* but merged to vertices that do not make up a single poly,
* in which case the original poly should not be dumped.
- * Actually this later behavior could apply to the Mirror Modifier as well, but the additional checks are
- * costly and not necessary in the case of mirror, because each vertex is only merged to its own mirror.
+ * Actually this later behavior could apply to the Mirror Modifier as well,
+ * but the additional checks are costly and not necessary in the case of mirror,
+ * because each vertex is only merged to its own mirror.
*
- * \note #BKE_mesh_recalc_tessellation has to run on the returned DM if you want to access tessfaces.
+ * \note #BKE_mesh_recalc_tessellation has to run on the returned DM
+ * if you want to access tessfaces.
*/
Mesh *BKE_mesh_merge_verts(Mesh *mesh,
const int *vtargetmap,
@@ -258,9 +261,9 @@ Mesh *BKE_mesh_merge_verts(Mesh *mesh,
STACK_DECLARE(mvert);
STACK_DECLARE(oldv);
- /* Note: create (totedge + totloop) elements because partially invalid polys due to merge may require
- * generating new edges, and while in 99% cases we'll still end with less final edges than totedge,
- * cases can be forged that would end requiring more... */
+ /* Note: create (totedge + totloop) elements because partially invalid polys due to merge may
+ * require generating new edges, and while in 99% cases we'll still end with less final edges
+ * than totedge, cases can be forged that would end requiring more. */
MEdge *med, *medge = MEM_malloc_arrayN((totedge + totloop), sizeof(*medge), __func__);
int *olde = MEM_malloc_arrayN((totedge + totloop), sizeof(*olde), __func__);
int *newe = MEM_malloc_arrayN((totedge + totloop), sizeof(*newe), __func__);
@@ -354,7 +357,8 @@ Mesh *BKE_mesh_merge_verts(Mesh *mesh,
if (merge_mode == MESH_MERGE_VERTS_DUMP_IF_EQUAL) {
/* In this mode, we need to determine, whenever a poly' vertices are all mapped */
/* if the targets already make up a poly, in which case the new poly is dropped */
- /* This poly equality check is rather complex. We use a BLI_ghash to speed it up with a first level check */
+ /* This poly equality check is rather complex.
+ * We use a BLI_ghash to speed it up with a first level check */
PolyKey *mpgh;
poly_keys = MEM_malloc_arrayN(totpoly, sizeof(PolyKey), __func__);
poly_gset = BLI_gset_new_ex(poly_gset_hash_fn, poly_gset_compare_fn, __func__, totpoly);
@@ -484,7 +488,8 @@ Mesh *BKE_mesh_merge_verts(Mesh *mesh,
BLI_assert((mlv == v1 && next_mlv == v2) || (mlv == v2 && next_mlv == v1));
}
#endif
- /* A loop is only valid if its matching edge is, and it's not reusing a vertex already used by this poly. */
+ /* A loop is only valid if its matching edge is,
+ * and it's not reusing a vertex already used by this poly. */
if (LIKELY((newe[ml->e] != -1) && ((mv[mlv].flag & ME_VERT_TMP_TAG) == 0))) {
mv[mlv].flag |= ME_VERT_TMP_TAG;
@@ -505,7 +510,8 @@ Mesh *BKE_mesh_merge_verts(Mesh *mesh,
STACK_PUSH(medge, mesh->medge[last_valid_ml->e]);
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. */
+ /* DO NOT change newe mapping,
+ * could break actual values due to some deleted original edges. */
*val_p = POINTER_FROM_INT(new_eidx);
created_edges++;
@@ -525,8 +531,8 @@ Mesh *BKE_mesh_merge_verts(Mesh *mesh,
}
c++;
- /* We absolutely HAVE to handle edge index remapping here, otherwise potential newly created edges
- * in that part of code make remapping later totally unreliable. */
+ /* We absolutely HAVE to handle edge index remapping here, otherwise potential newly
+ * created edges in that part of code make remapping later totally unreliable. */
BLI_assert(newe[ml->e] != -1);
last_valid_ml->e = newe[ml->e];
}
@@ -558,7 +564,8 @@ Mesh *BKE_mesh_merge_verts(Mesh *mesh,
STACK_PUSH(medge, mesh->medge[last_valid_ml->e]);
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. */
+ /* DO NOT change newe mapping,
+ * could break actual values due to some deleted original edges. */
*val_p = POINTER_FROM_INT(new_eidx);
created_edges++;
diff --git a/source/blender/blenkernel/intern/mesh_remap.c b/source/blender/blenkernel/intern/mesh_remap.c
index 9a79951152f..db158ca8fb2 100644
--- a/source/blender/blenkernel/intern/mesh_remap.c
+++ b/source/blender/blenkernel/intern/mesh_remap.c
@@ -124,9 +124,11 @@ static bool mesh_remap_bvhtree_query_raycast(BVHTreeFromMesh *treedata,
* Compute a value of the difference between both given meshes.
* The smaller the result, the better the match.
*
- * We return the inverse of the average of the inversed shortest distance from each dst vertex to src ones.
- * In other words, beyond a certain (relatively small) distance, all differences have more or less the same weight
- * in final result, which allows to reduce influence of a few high differences, in favor of a global good matching.
+ * We return the inverse of the average of the inversed
+ * shortest distance from each dst vertex to src ones.
+ * In other words, beyond a certain (relatively small) distance, all differences have more or less
+ * the same weight in final result, which allows to reduce influence of a few high differences,
+ * in favor of a global good matching.
*/
float BKE_mesh_remap_calc_difference_from_mesh(const SpaceTransform *space_transform,
const MVert *verts_dst,
@@ -164,20 +166,24 @@ float BKE_mesh_remap_calc_difference_from_mesh(const SpaceTransform *space_trans
result = ((float)numverts_dst / result) - 1.0f;
- // printf("%s: Computed difference between meshes (the lower the better): %f\n", __func__, result);
+#if 0
+ printf("%s: Computed difference between meshes (the lower the better): %f\n", __func__, result);
+#endif
return result;
}
-/* This helper computes the eigen values & vectors for covariance matrix of all given vertices coordinates.
+/* This helper computes the eigen values & vectors for
+ * covariance matrix of all given vertices coordinates.
*
* Those vectors define the 'average ellipsoid' of the mesh (i.e. the 'best fitting' ellipsoid
* containing 50% of the vertices).
*
- * Note that it will not perform fantastic in case two or more eigen values are equal (e.g. a cylinder or
- * parallelepiped with a square section give two identical eigenvalues, a sphere or tetrahedron give
- * three identical ones, etc.), since you cannot really define all axes in those cases. We default to dummy
- * generated orthogonal vectors in this case, instead of using eigen vectors.
+ * Note that it will not perform fantastic in case two or more eigen values are equal
+ * (e.g. a cylinder or parallelepiped with a square section give two identical eigenvalues,
+ * a sphere or tetrahedron give three identical ones, etc.), since you cannot really define all
+ * axes in those cases. We default to dummy generated orthogonal vectors in this case,
+ * instead of using eigen vectors.
*/
static void mesh_calc_eigen_matrix(const MVert *verts,
const float (*vcos)[3],
@@ -207,8 +213,8 @@ static void mesh_calc_eigen_matrix(const MVert *verts,
}
unit_m4(r_mat);
- /* Note: here we apply sample correction to covariance matrix, since we consider the vertices as a sample
- * of the whole 'surface' population of our mesh... */
+ /* Note: here we apply sample correction to covariance matrix, since we consider the vertices
+ * as a sample of the whole 'surface' population of our mesh. */
BLI_covariance_m3_v3n(vcos, numverts, true, covmat, center);
if (cos) {
@@ -247,8 +253,9 @@ static void mesh_calc_eigen_matrix(const MVert *verts,
float evi = eigen_val[i];
/* Protect against 1D/2D degenerated cases! */
- /* Note: not sure why we need square root of eigen values here (which are equivalent to singular values,
- * as far as I have understood), but it seems to heavily reduce (if not completely nullify)
+ /* Note: not sure why we need square root of eigen values here
+ * (which are equivalent to singular values, as far as I have understood),
+ * but it seems to heavily reduce (if not completely nullify)
* the error due to non-uniform scalings... */
evi = (evi < 1e-6f && evi > -1e-6f) ? ((evi < 0.0f) ? -1e-3f : 1e-3f) : sqrtf_signed(evi);
mul_v3_fl(eigen_vec[i], evi);
@@ -266,7 +273,8 @@ void BKE_mesh_remap_find_best_match_from_mesh(const MVert *verts_dst,
Mesh *me_src,
SpaceTransform *r_space_transform)
{
- /* Note that those are done so that we successively get actual mirror matrix (by multiplication of columns)... */
+ /* Note that those are done so that we successively get actual mirror matrix
+ * (by multiplication of columns). */
const float mirrors[][3] = {
{-1.0f, 1.0f, 1.0f}, /* -> -1, 1, 1 */
{1.0f, -1.0f, 1.0f}, /* -> -1, -1, 1 */
@@ -457,16 +465,20 @@ typedef struct IslandResult {
float hit_point[3];
} IslandResult;
-/* Note about all bvh/raycasting stuff below:
- * * We must use our ray radius as BVH epsilon too, else rays not hitting anything but 'passing near' an item
- * would be missed (since BVH handling would not detect them, 'refining' callbacks won't be executed,
- * even though they would return a valid hit).
- * * However, in 'islands' case where each hit gets a weight, 'precise' hits should have a better weight than
- * 'approximate' hits. To address that, we simplify things with:
- * ** A first raycast with default, given rayradius;
- * ** If first one fails, we do more raycasting with bigger radius, but if hit is found
- * it will get smaller weight.
- * This only concerns loops, currently (because of islands), and 'sampled' edges/polys norproj.
+/**
+ * \note About all bvh/raycasting stuff below:
+ *
+ * * We must use our ray radius as BVH epsilon too, else rays not hitting anything but
+ * 'passing near' an item would be missed (since BVH handling would not detect them,
+ * 'refining' callbacks won't be executed, even though they would return a valid hit).
+ * * However, in 'islands' case where each hit gets a weight, 'precise' hits should have a better
+ * weight than 'approximate' hits.
+ * To address that, we simplify things with:
+ * * A first raycast with default, given rayradius;
+ * * If first one fails, we do more raycasting with bigger radius, but if hit is found
+ * it will get smaller weight.
+ *
+ * This only concerns loops, currently (because of islands), and 'sampled' edges/polys norproj.
*/
/* At most n raycasts per 'real' ray. */
@@ -794,8 +806,8 @@ void BKE_mesh_remap_calc_edges_from_mesh(const int mode,
}
}
- /* Now, check all source edges of closest sources vertices, and select the one giving the smallest
- * total verts-to-verts distance. */
+ /* Now, check all source edges of closest sources vertices,
+ * and select the one giving the smallest total verts-to-verts distance. */
for (j = 2; j--;) {
const unsigned int vidx_dst = j ? e_dst->v1 : e_dst->v2;
const float first_dist = v_dst_to_src_map[vidx_dst].hit_dist;
@@ -1012,8 +1024,8 @@ void BKE_mesh_remap_calc_edges_from_mesh(const int mode,
w /= MREMAP_RAYCAST_APPROXIMATE_FAC;
}
}
- /* A sampling is valid (as in, its result can be considered as valid sources) only if at least
- * half of the rays found a source! */
+ /* A sampling is valid (as in, its result can be considered as valid sources)
+ * only if at least half of the rays found a source! */
if (totweights > ((float)grid_size / 2.0f)) {
for (j = 0; j < (int)numedges_src; j++) {
if (!weights[j]) {
@@ -1204,7 +1216,8 @@ static void mesh_island_to_astar_graph(MeshIslandStore *islands,
#undef POLY_COMPLETE
/* Our 'f_cost' callback func, to find shortest poly-path between two remapped-loops.
- * Note we do not want to make innercuts 'walls' here, just detect when the shortest path goes by those. */
+ * Note we do not want to make innercuts 'walls' here,
+ * just detect when the shortest path goes by those. */
static float mesh_remap_calc_loops_astar_f_cost(BLI_AStarGraph *as_graph,
BLI_AStarSolution *as_solution,
BLI_AStarGNLink *link,
@@ -1224,8 +1237,8 @@ static float mesh_remap_calc_loops_astar_f_cost(BLI_AStarGraph *as_graph,
}
/* Our heuristic part of current f_cost is distance from next node to destination one.
- * It is guaranteed to be less than (or equal to) actual shortest poly-path between next node and destination one.
- */
+ * It is guaranteed to be less than (or equal to)
+ * actual shortest poly-path between next node and destination one. */
co_next = (float *)as_graph->nodes[node_idx_next].custom_data;
co_dest = (float *)as_graph->nodes[node_idx_dst].custom_data;
return (link ? (as_solution->g_costs[node_idx_curr] + link->cost) : 0.0f) +
@@ -1601,8 +1614,8 @@ void BKE_mesh_remap_calc_loops_from_mesh(const int mode,
for (pidx_dst = 0, mp_dst = polys_dst; pidx_dst < numpolys_dst; pidx_dst++, mp_dst++) {
float pnor_dst[3];
- /* Only in use_from_vert case, we may need polys' centers as fallback in case we cannot decide which
- * corner to use from normals only. */
+ /* Only in use_from_vert case, we may need polys' centers as fallback
+ * in case we cannot decide which corner to use from normals only. */
float pcent_dst[3];
bool pcent_dst_valid = false;
@@ -1763,8 +1776,8 @@ void BKE_mesh_remap_calc_loops_from_mesh(const int mode,
/* Fallback to 'nearest' hit here, loops usually comes in 'face group', not good to
* have only part of one dest face's loops to map to source.
* Note that since we give this a null weight, if whole weight for a given face
- * is null, it means none of its loop mapped to this source island, hence we can skip it
- * later.
+ * is null, it means none of its loop mapped to this source island,
+ * hence we can skip it later.
*/
copy_v3_v3(tmp_co, verts_dst[ml_dst->v].co);
nearest.index = -1;
@@ -1821,12 +1834,14 @@ void BKE_mesh_remap_calc_loops_from_mesh(const int mode,
/* We have to first select the 'best source island' for given dst poly and its loops.
* Then, we have to check that poly does not 'spread' across some island's limits
* (like inner seams for UVs, etc.).
- * Note we only still partially support that kind of situation here, i.e. polys spreading over actual cracks
- * (like a narrow space without faces on src, splitting a 'tube-like' geometry). That kind of situation
- * should be relatively rare, though.
+ * Note we only still partially support that kind of situation here, i.e.
+ * Polys spreading over actual cracks
+ * (like a narrow space without faces on src, splitting a 'tube-like' geometry).
+ * That kind of situation should be relatively rare, though.
*/
- /* XXX This block in itself is big and complex enough to be a separate function but... it uses a bunch
- * of locale vars. Not worth sending all that through parameters (for now at least). */
+ /* XXX This block in itself is big and complex enough to be a separate function but...
+ * it uses a bunch of locale vars.
+ * Not worth sending all that through parameters (for now at least). */
{
BLI_AStarGraph *as_graph = NULL;
int *poly_island_index_map = NULL;
@@ -1896,7 +1911,7 @@ void BKE_mesh_remap_calc_loops_from_mesh(const int mode,
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,
+ * Note we could try to be much smarter, g.g. Storing a whole poly's indices,
* and making decision (on which side of cutting edge(s!) to be) on the end,
* but this is one more level of complexity, better to first see if
* simple solution works!
@@ -1922,7 +1937,8 @@ void BKE_mesh_remap_calc_loops_from_mesh(const int mode,
ml_dst = &loops_dst[lidx_dst];
copy_v3_v3(tmp_co, verts_dst[ml_dst->v].co);
- /* We do our transform here, since we may do several raycast/nearest queries. */
+ /* We do our transform here,
+ * since we may do several raycast/nearest queries. */
if (space_transform) {
BLI_space_transform_apply(space_transform, tmp_co);
}
@@ -1952,7 +1968,8 @@ void BKE_mesh_remap_calc_loops_from_mesh(const int mode,
}
else {
/* No source for this loop in this island. */
- /* TODO: would probably be better to get a source at all cost in best island anyway? */
+ /* TODO: would probably be better to get a source
+ * at all cost in best island anyway? */
mesh_remap_item_define(r_map, lidx_dst, FLT_MAX, best_island_index, 0, NULL, NULL);
}
}
@@ -1985,8 +2002,8 @@ void BKE_mesh_remap_calc_loops_from_mesh(const int mode,
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,
- * and making decision (one which side of cutting edge(s!) to be on the end,
+ * Note we could try to be much smarter: e.g. Storing a whole poly's indices,
+ * and making decision (one which side of cutting edge(s)!) to be on the end,
* but this is one more level of complexity, better to first see if
* simple solution works!
*/
@@ -2012,7 +2029,8 @@ void BKE_mesh_remap_calc_loops_from_mesh(const int mode,
ml_dst = &loops_dst[lidx_dst];
copy_v3_v3(tmp_co, verts_dst[ml_dst->v].co);
- /* We do our transform here, since we may do several raycast/nearest queries. */
+ /* We do our transform here,
+ * since we may do several raycast/nearest queries. */
if (space_transform) {
BLI_space_transform_apply(space_transform, tmp_co);
}
@@ -2100,7 +2118,8 @@ void BKE_mesh_remap_calc_loops_from_mesh(const int mode,
}
else {
/* No source for this loop in this island. */
- /* TODO: would probably be better to get a source at all cost in best island anyway? */
+ /* TODO: would probably be better to get a source
+ * at all cost in best island anyway? */
mesh_remap_item_define(r_map, lidx_dst, FLT_MAX, best_island_index, 0, NULL, NULL);
}
}
@@ -2283,7 +2302,8 @@ void BKE_mesh_remap_calc_polys_from_mesh(const int mode,
}
}
else if (mode == MREMAP_MODE_POLY_POLYINTERP_PNORPROJ) {
- /* We cast our rays randomly, with a pseudo-even distribution (since we spread across tessellated tris,
+ /* We cast our rays randomly, with a pseudo-even distribution
+ * (since we spread across tessellated tris,
* with additional weighting based on each tri's relative area).
*/
RNG *rng = BLI_rng_new(0);
@@ -2399,8 +2419,8 @@ void BKE_mesh_remap_calc_polys_from_mesh(const int mode,
float *v3 = poly_vcos_2d[tri_vidx_2d[j][2]];
int rays_num;
- /* All this allows us to get 'absolute' number of rays for each tri, avoiding accumulating
- * errors over iterations, and helping better even distribution. */
+ /* All this allows us to get 'absolute' number of rays for each tri,
+ * avoiding accumulating errors over iterations, and helping better even distribution. */
done_area += area_tri_v2(v1, v2, v3);
rays_num = max_ii(
(int)((float)tot_rays * done_area * poly_area_2d_inv + 0.5f) - done_rays, 0);
diff --git a/source/blender/blenkernel/intern/mesh_runtime.c b/source/blender/blenkernel/intern/mesh_runtime.c
index c82126c39d0..06abd80b86f 100644
--- a/source/blender/blenkernel/intern/mesh_runtime.c
+++ b/source/blender/blenkernel/intern/mesh_runtime.c
@@ -78,7 +78,8 @@ void BKE_mesh_runtime_clear_cache(Mesh *mesh)
/**
* Ensure the array is large enough
*
- * \note This function must always be thread-protected by caller. It should only be used by internal code.
+ * \note This function must always be thread-protected by caller.
+ * It should only be used by internal code.
*/
static void mesh_ensure_looptri_data(Mesh *mesh)
{
@@ -149,8 +150,8 @@ const MLoopTri *BKE_mesh_runtime_looptri_ensure(Mesh *mesh)
}
else {
BLI_rw_mutex_lock(&loops_cache_lock, THREAD_LOCK_WRITE);
- /* We need to ensure array is still NULL inside mutex-protected code, some other thread might have already
- * recomputed those looptris. */
+ /* We need to ensure array is still NULL inside mutex-protected code,
+ * some other thread might have already recomputed those looptris. */
if (mesh->runtime.looptris.array == NULL) {
BKE_mesh_runtime_looptri_recalc(mesh);
}
diff --git a/source/blender/blenkernel/intern/mesh_tangent.c b/source/blender/blenkernel/intern/mesh_tangent.c
index d6d39ca0f1d..8ed7f313e3d 100644
--- a/source/blender/blenkernel/intern/mesh_tangent.c
+++ b/source/blender/blenkernel/intern/mesh_tangent.c
@@ -116,7 +116,8 @@ static void set_tspace(const SMikkTSpaceContext *pContext,
}
/**
- * Compute simplified tangent space normals, i.e. tangent vector + sign of bi-tangent one, which combined with
+ * Compute simplified tangent space normals, i.e.
+ * tangent vector + sign of bi-tangent one, which combined with
* split normals can be used to recreate the full tangent space.
* Note: * The mesh should be made of only tris and quads!
*/
@@ -487,7 +488,8 @@ void BKE_mesh_add_loop_tangent_named_layer_for_uv(CustomData *uv_data,
}
/**
- * Here we get some useful information such as active uv layer name and search if it is already in tangent_names.
+ * Here we get some useful information such as active uv layer name and
+ * search if it is already in tangent_names.
* Also, we calculate tangent_mask that works as a descriptor of tangents state.
* If tangent_mask has changed, then recalculate tangents.
*/
@@ -677,9 +679,8 @@ void BKE_mesh_calc_loop_tangent_ex(const MVert *mvert,
mesh2tangent->mpoly = mpoly;
mesh2tangent->mloop = mloop;
mesh2tangent->looptri = looptri;
- /* Note, we assume we do have tessellated loop normals at this point (in case it is object-enabled),
- * have to check this is valid...
- */
+ /* Note, we assume we do have tessellated loop normals at this point
+ * (in case it is object-enabled), have to check this is valid. */
mesh2tangent->precomputedLoopNormals = loop_normals;
mesh2tangent->precomputedFaceNormals = poly_normals;
diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c
index e2515665728..dac12233539 100644
--- a/source/blender/blenkernel/intern/mesh_validate.c
+++ b/source/blender/blenkernel/intern/mesh_validate.c
@@ -573,8 +573,9 @@ bool BKE_mesh_validate_arrays(Mesh *mesh,
sp->numverts = mp->totloop;
sp->loopstart = mp->loopstart;
- /* Ideally we would only have to do that once on all vertices before we start checking each poly, but
- * several polys can use same vert, so we have to ensure here all verts of current poly are cleared. */
+ /* Ideally we would only have to do that once on all vertices
+ * before we start checking each poly, but several polys can use same vert,
+ * so we have to ensure here all verts of current poly are cleared. */
for (j = 0, ml = &mloops[sp->loopstart]; j < mp->totloop; j++, ml++) {
if (ml->v < totvert) {
mverts[ml->v].flag &= ~ME_VERT_TMP_TAG;
@@ -638,7 +639,8 @@ bool BKE_mesh_validate_arrays(Mesh *mesh,
if (IS_REMOVED_EDGE(me) ||
!((me->v1 == v1 && me->v2 == v2) || (me->v1 == v2 && me->v2 == v1))) {
/* The pointed edge is invalid (tagged as removed, or vert idx mismatch),
- * and we already know from previous test that a valid one exists, use it (if allowed)! */
+ * 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 = POINTER_AS_INT(BLI_edgehash_lookup(edge_hash, v1, v2));
@@ -676,7 +678,8 @@ bool BKE_mesh_validate_arrays(Mesh *mesh,
const int *p1_v = sp->verts, *p2_v = prev_sp->verts;
if (sp->invalid) {
- /* break, because all known invalid polys have been put at the end by qsort with search_poly_cmp. */
+ /* Break, because all known invalid polys have been put at the end
+ * by qsort with search_poly_cmp. */
break;
}
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index b244a69ec09..0767e2a7148 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -501,7 +501,8 @@ bool modifiers_isParticleEnabled(Object *ob)
/**
* Check whether is enabled.
*
- * \param scene: Current scene, may be NULL, in which case isDisabled callback of the modifier is never called.
+ * \param scene: Current scene, may be NULL,
+ * in which case isDisabled callback of the modifier is never called.
*/
bool modifier_isEnabled(const struct Scene *scene, ModifierData *md, int required_mode)
{
@@ -929,7 +930,8 @@ void modwrap_deformVertsEM(ModifierData *md,
/**
* Get evaluated mesh for other evaluated object, which is used as an operand for the modifier,
* e.g. second operand for boolean modifier.
- * Note that modifiers in stack always get fully evaluated COW ID pointers, never original ones. Makes things simpler.
+ * Note that modifiers in stack always get fully evaluated COW ID pointers,
+ * never original ones. Makes things simpler.
*
* \param get_cage_mesh Return evaluated mesh with only deforming modifiers applied
* (i.e. mesh topology remains the same as original one, a.k.a. 'cage' mesh).
@@ -942,8 +944,8 @@ Mesh *BKE_modifier_get_evaluated_mesh_from_evaluated_object(Object *ob_eval,
if ((ob_eval->type == OB_MESH) && (ob_eval->mode & OB_MODE_EDIT)) {
/* In EditMode, evaluated mesh is stored in BMEditMesh, not the object... */
BMEditMesh *em = BKE_editmesh_from_object(ob_eval);
- if (em !=
- NULL) { /* em might not exist yet in some cases, just after loading a .blend file, see T57878. */
+ /* 'em' might not exist yet in some cases, just after loading a .blend file, see T57878. */
+ if (em != NULL) {
me = (get_cage_mesh && em->mesh_eval_cage != NULL) ? em->mesh_eval_cage :
em->mesh_eval_final;
}
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 1a61fa2c537..8d149af6a1f 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -1619,8 +1619,10 @@ void BKE_movieclip_free(MovieClip *clip)
}
/**
- * Only copy internal data of MovieClip ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of MovieClip ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index 6af92422b30..e3953af7cbf 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -1712,7 +1712,8 @@ void multires_free(Multires *mr)
lvl = lvl->next;
}
- /* mr->verts may be NULL when loading old files, see direct_link_mesh() in readfile.c, and T43560. */
+ /* mr->verts may be NULL when loading old files,
+ * see direct_link_mesh() in readfile.c, and T43560. */
MEM_SAFE_FREE(mr->verts);
BLI_freelistN(&mr->levels);
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 6953339f287..121ec1d4391 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -163,7 +163,8 @@ void BKE_nla_tracks_free(ListBase *tracks, bool do_id_user)
* Copy NLA strip
*
* \param use_same_action: When true, the existing action is used (instead of being duplicated)
- * \param flag: Control ID pointers management, see LIB_ID_CREATE_.../LIB_ID_COPY_... flags in BKE_library.h
+ * \param flag: Control ID pointers management, see LIB_ID_CREATE_.../LIB_ID_COPY_...
+ * flags in BKE_library.h
*/
NlaStrip *BKE_nlastrip_copy(Main *bmain,
NlaStrip *strip,
@@ -216,7 +217,8 @@ NlaStrip *BKE_nlastrip_copy(Main *bmain,
/**
* Copy a single NLA Track.
- * \param flag: Control ID pointers management, see LIB_ID_CREATE_.../LIB_ID_COPY_... flags in BKE_library.h
+ * \param flag: Control ID pointers management, see LIB_ID_CREATE_.../LIB_ID_COPY_...
+ * flags in BKE_library.h
*/
NlaTrack *BKE_nlatrack_copy(Main *bmain,
NlaTrack *nlt,
@@ -249,7 +251,8 @@ NlaTrack *BKE_nlatrack_copy(Main *bmain,
/**
* Copy all NLA data.
- * \param flag: Control ID pointers management, see LIB_ID_CREATE_.../LIB_ID_COPY_... flags in BKE_library.h
+ * \param flag: Control ID pointers management, see LIB_ID_CREATE_.../LIB_ID_COPY_...
+ * flags in BKE_library.h
*/
void BKE_nla_tracks_copy(Main *bmain, ListBase *dst, ListBase *src, const int flag)
{
@@ -354,7 +357,8 @@ NlaStrip *BKE_nlastrip_new(bAction *act)
return strip;
}
-/* Add new NLA-strip to the top of the NLA stack - i.e. into the last track if space, or a new one otherwise */
+/* Add new NLA-strip to the top of the NLA stack - i.e.
+ * into the last track if space, or a new one otherwise. */
NlaStrip *BKE_nlastack_add_strip(AnimData *adt, bAction *act)
{
NlaStrip *strip;
@@ -467,10 +471,9 @@ static float nlastrip_get_frame_actionclip(NlaStrip *strip, float cframe, short
}
else { /* if (mode == NLATIME_CONVERT_EVAL) */
if (IS_EQF((float)cframe, strip->end) && IS_EQF(strip->repeat, floorf(strip->repeat))) {
- /* this case prevents the motion snapping back to the first frame at the end of the strip
- * by catching the case where repeats is a whole number, which means that the end of the strip
- * could also be interpreted as the end of the start of a repeat
- */
+ /* This case prevents the motion snapping back to the first frame at the end of the strip
+ * by catching the case where repeats is a whole number, which means that the end of the
+ * strip could also be interpreted as the end of the start of a repeat. */
return strip->actstart;
}
else {
@@ -490,10 +493,9 @@ static float nlastrip_get_frame_actionclip(NlaStrip *strip, float cframe, short
}
else { /* if (mode == NLATIME_CONVERT_EVAL) */
if (IS_EQF(cframe, strip->end) && IS_EQF(strip->repeat, floorf(strip->repeat))) {
- /* this case prevents the motion snapping back to the first frame at the end of the strip
- * by catching the case where repeats is a whole number, which means that the end of the strip
- * could also be interpreted as the end of the start of a repeat
- */
+ /* This case prevents the motion snapping back to the first frame at the end of the strip
+ * by catching the case where repeats is a whole number, which means that the end of the
+ * strip could also be interpreted as the end of the start of a repeat. */
return strip->actend;
}
else {
@@ -544,7 +546,8 @@ static float nlastrip_get_frame_transition(NlaStrip *strip, float cframe, short
float nlastrip_get_frame(NlaStrip *strip, float cframe, short mode)
{
switch (strip->type) {
- case NLASTRIP_TYPE_META: /* meta - for now, does the same as transition (is really just an empty container) */
+ case NLASTRIP_TYPE_META: /* Meta - for now, does the same as transition
+ * (is really just an empty container). */
case NLASTRIP_TYPE_TRANSITION: /* transition */
return nlastrip_get_frame_transition(strip, cframe, mode);
@@ -589,10 +592,10 @@ 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...
+ /* 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.
*/
if ((strip == NULL) || (strip->flag & NLASTRIP_FLAG_USR_TIME)) {
return cframe;
@@ -943,7 +946,8 @@ void BKE_nlameta_flush_transforms(NlaStrip *mstrip)
p1 = (strip->start - oStart) / oLen;
p2 = (strip->end - oStart) / oLen;
- /* apply new strip endpoints using the proportions, then wait for second pass to flush scale properly */
+ /* Apply new strip endpoints using the proportions,
+ * then wait for second pass to flush scale properly. */
strip->start = (p1 * nLen) + mstrip->start;
strip->end = (p2 * nLen) + mstrip->start;
}
@@ -1252,7 +1256,8 @@ bool BKE_nlastrip_within_bounds(NlaStrip *strip, float min, float max)
return true;
}
-/* Ensure that strip doesn't overlap those around it after resizing by offsetting those which follow */
+/* Ensure that strip doesn't overlap those around it after resizing
+ * by offsetting those which follow. */
static void nlastrip_fix_resize_overlaps(NlaStrip *strip)
{
/* next strips - do this first, since we're often just getting longer */
@@ -1613,13 +1618,15 @@ void BKE_nlastrip_validate_name(AnimData *adt, NlaStrip *strip)
continue;
}
- /* use the name of the strip as the key, and the strip as the value, since we're mostly interested in the keys */
+ /* Use the name of the strip as the key, and the strip as the value,
+ * since we're mostly interested in the keys. */
BLI_ghash_insert(gh, tstrip->name, tstrip);
}
}
- /* 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 :)
+ /* 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 :).
*/
BLI_uniquename_cb(nla_editbone_name_check,
(void *)gh,
@@ -1651,7 +1658,8 @@ static void nlastrip_get_endpoint_overlaps(NlaStrip *strip,
*/
/* TODO: this scheme could get quite slow for doing this on many strips... */
for (nls = track->strips.first; nls; nls = nls->next) {
- /* check if strip overlaps (extends over or exactly on) the entire range of the strip we're validating */
+ /* Check if strip overlaps (extends over or exactly on)
+ * the entire range of the strip we're validating. */
if ((nls->start <= strip->start) && (nls->end >= strip->end)) {
*start = NULL;
*end = NULL;
@@ -1750,7 +1758,8 @@ void BKE_nla_validate_state(AnimData *adt)
return;
}
- /* adjust blending values for auto-blending, and also do an initial pass to find the earliest strip */
+ /* Adjust blending values for auto-blending,
+ * and also do an initial pass to find the earliest strip. */
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
for (strip = nlt->strips.first; strip; strip = strip->next) {
/* auto-blending first */
@@ -1849,7 +1858,8 @@ bool BKE_nla_action_stash(AnimData *adt)
nlt = BKE_nlatrack_add(adt, prev_track);
BLI_assert(nlt != NULL);
- /* we need to ensure that if there wasn't any previous instance, it must go to tbe bottom of the stack */
+ /* We need to ensure that if there wasn't any previous instance,
+ * it must go to tbe bottom of the stack. */
if (prev_track == NULL) {
BLI_remlink(&adt->nla_tracks, nlt);
BLI_addhead(&adt->nla_tracks, nlt);
@@ -1955,9 +1965,9 @@ void BKE_nla_action_pushdown(AnimData *adt)
* mode accordingly
*/
if (nlastrip_is_first(adt, strip) == 0) {
- /* not first, so extend mode can only be NLASTRIP_EXTEND_HOLD_FORWARD not NLASTRIP_EXTEND_HOLD,
- * so that it doesn't override strips in previous tracks
- */
+ /* Not first, so extend mode can only be:
+ * NLASTRIP_EXTEND_HOLD_FORWARD not NLASTRIP_EXTEND_HOLD,
+ * so that it doesn't override strips in previous tracks. */
/* FIXME: this needs to be more automated, since user can rearrange strips */
if (strip->extendmode == NLASTRIP_EXTEND_HOLD) {
strip->extendmode = NLASTRIP_EXTEND_HOLD_FORWARD;
@@ -2004,9 +2014,10 @@ bool BKE_nla_tweakmode_enter(AnimData *adt)
}
}
- /* There are situations where we may have multiple strips selected and we want to enter tweakmode on all
- * of those at once. Usually in those cases, it will usually just be a single strip per AnimData.
- * In such cases, compromise and take the last selected track and/or last selected strip [#28468]
+ /* There are situations where we may have multiple strips selected and we want to enter tweakmode
+ * on all of those at once. Usually in those cases,
+ * it will usually just be a single strip per AnimData.
+ * In such cases, compromise and take the last selected track and/or last selected strip, T28468.
*/
if (activeTrack == NULL) {
/* try last selected track for active strip */
@@ -2022,7 +2033,8 @@ bool BKE_nla_tweakmode_enter(AnimData *adt)
}
}
if ((activeTrack) && (activeStrip == NULL)) {
- /* no active strip in active or last selected track; compromise for first selected (assuming only single)... */
+ /* No active strip in active or last selected track;
+ * compromise for first selected (assuming only single). */
for (strip = activeTrack->strips.first; strip; strip = strip->next) {
if (strip->flag & (NLASTRIP_FLAG_SELECT | NLASTRIP_FLAG_ACTIVE)) {
activeStrip = strip;
@@ -2071,10 +2083,12 @@ bool BKE_nla_tweakmode_enter(AnimData *adt)
}
/* 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;
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 3b46727c33f..b35e88f5036 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -126,8 +126,9 @@ static void node_init(const struct bContext *C, bNodeTree *ntree, bNode *node)
/* initialize the node name with the node label.
* note: do this after the initfunc so nodes get their data set which may be used in naming
* (node groups for example) */
- /* XXX Do not use nodeLabel() here, it returns translated content for UI, which should *only* be used
- * in UI, *never* in data... Data have their own translation option!
+ /* XXX Do not use nodeLabel() here, it returns translated content for UI,
+ * which should *only* be used in UI, *never* in data...
+ * Data have their own translation option!
* This solution may be a bit rougher than nodeLabel()'s returned string, but it's simpler
* than adding "do_translate" flags to this func (and labelfunc() as well). */
BLI_strncpy(node->name, DATA_(ntype->ui_name), NODE_MAXSTR);
@@ -284,7 +285,8 @@ static void update_typeinfo(Main *bmain,
}
/* Try to initialize all typeinfo in a node tree.
- * NB: In general undefined typeinfo is a perfectly valid case, the type may just be registered later.
+ * NB: In general undefined typeinfo is a perfectly valid case,
+ * the type may just be registered later.
* In that case the update_typeinfo function will set typeinfo on registration
* and do necessary updates.
*/
@@ -339,8 +341,8 @@ void ntreeTypeAdd(bNodeTreeType *nt)
{
BLI_ghash_insert(nodetreetypes_hash, nt->idname, nt);
/* XXX pass Main to register function? */
- /* Probably not. It is pretty much expected we want to update G_MAIN her I think - or we'd want to update *all*
- * active Mains, which we cannot do anyway currently. */
+ /* Probably not. It is pretty much expected we want to update G_MAIN here I think -
+ * or we'd want to update *all* active Mains, which we cannot do anyway currently. */
update_typeinfo(G_MAIN, NULL, nt, NULL, NULL, false);
}
@@ -349,8 +351,8 @@ static void ntree_free_type(void *treetype_v)
{
bNodeTreeType *treetype = treetype_v;
/* XXX pass Main to unregister function? */
- /* Probably not. It is pretty much expected we want to update G_MAIN her I think - or we'd want to update *all*
- * active Mains, which we cannot do anyway currently. */
+ /* Probably not. It is pretty much expected we want to update G_MAIN here I think -
+ * or we'd want to update *all* active Mains, which we cannot do anyway currently. */
update_typeinfo(G_MAIN, NULL, treetype, NULL, NULL, true);
MEM_freeN(treetype);
}
@@ -401,8 +403,8 @@ static void node_free_type(void *nodetype_v)
{
bNodeType *nodetype = nodetype_v;
/* XXX pass Main to unregister function? */
- /* Probably not. It is pretty much expected we want to update G_MAIN her I think - or we'd want to update *all*
- * active Mains, which we cannot do anyway currently. */
+ /* Probably not. It is pretty much expected we want to update G_MAIN here I think -
+ * or we'd want to update *all* active Mains, which we cannot do anyway currently. */
update_typeinfo(G_MAIN, NULL, NULL, nodetype, NULL, true);
/* XXX deprecated */
@@ -423,8 +425,8 @@ void nodeRegisterType(bNodeType *nt)
BLI_ghash_insert(nodetypes_hash, nt->idname, nt);
/* XXX pass Main to register function? */
- /* Probably not. It is pretty much expected we want to update G_MAIN her I think - or we'd want to update *all*
- * active Mains, which we cannot do anyway currently. */
+ /* Probably not. It is pretty much expected we want to update G_MAIN here I think -
+ * or we'd want to update *all* active Mains, which we cannot do anyway currently. */
update_typeinfo(G_MAIN, NULL, NULL, nt, NULL, false);
}
@@ -462,8 +464,8 @@ static void node_free_socket_type(void *socktype_v)
{
bNodeSocketType *socktype = socktype_v;
/* XXX pass Main to unregister function? */
- /* Probably not. It is pretty much expected we want to update G_MAIN her I think - or we'd want to update *all*
- * active Mains, which we cannot do anyway currently. */
+ /* Probably not. It is pretty much expected we want to update G_MAIN here I think -
+ * or we'd want to update *all* active Mains, which we cannot do anyway currently. */
update_typeinfo(G_MAIN, NULL, NULL, NULL, socktype, true);
MEM_freeN(socktype);
@@ -473,8 +475,8 @@ void nodeRegisterSocketType(bNodeSocketType *st)
{
BLI_ghash_insert(nodesockettypes_hash, (void *)st->idname, st);
/* XXX pass Main to register function? */
- /* Probably not. It is pretty much expected we want to update G_MAIN her I think - or we'd want to update *all*
- * active Mains, which we cannot do anyway currently. */
+ /* Probably not. It is pretty much expected we want to update G_MAIN here I think -
+ * or we'd want to update *all* active Mains, which we cannot do anyway currently. */
update_typeinfo(G_MAIN, NULL, NULL, NULL, st, false);
}
@@ -931,7 +933,8 @@ void nodeChainIter(const bNodeTree *ntree,
continue;
}
if (link->tonode && link->fromnode) {
- /* is the link part of the chain meaning node_start == fromnode (or tonode for reversed case)? */
+ /* Is the link part of the chain meaning node_start == fromnode
+ * (or tonode for reversed case)? */
if ((reversed && (link->tonode == node_start)) ||
(!reversed && link->fromnode == node_start)) {
if (!callback(link->fromnode, link->tonode, userdata, reversed)) {
@@ -945,7 +948,8 @@ void nodeChainIter(const bNodeTree *ntree,
}
/**
- * Iterate over all parents of \a node, executing \a callback for each parent (which can return false to end iterator)
+ * Iterate over all parents of \a node, executing \a callback for each parent
+ * (which can return false to end iterator)
*
* \note Recursive
*/
@@ -1370,8 +1374,10 @@ bNodeTree *ntreeAddTree(Main *bmain, const char *name, const char *idname)
}
/**
- * Only copy internal data of NodeTree ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of NodeTree ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -1716,7 +1722,8 @@ void BKE_node_preview_merge_tree(bNodeTree *to_ntree, bNodeTree *from_ntree, boo
BKE_node_instance_hash_insert(to_ntree->previews, key, preview);
}
- /* Note: NULL free function here, because pointers have already been moved over to to_ntree->previews! */
+ /* Note: NULL free function here,
+ * because pointers have already been moved over to to_ntree->previews! */
BKE_node_instance_hash_free(from_ntree->previews, NULL);
from_ntree->previews = NULL;
}
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index a623baf7b71..51d1e65fe17 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -223,7 +223,8 @@ void BKE_object_modifier_hook_reset(Object *ob, HookModifierData *hmd)
if (hmd->subtarget[0] && pchan) {
float imat[4][4], mat[4][4];
- /* calculate the world-space matrix for the pose-channel target first, then carry on as usual */
+ /* Calculate the world-space matrix for the pose-channel target first,
+ * then carry on as usual. */
mul_m4_m4m4(mat, hmd->object->obmat, pchan->pose_mat);
invert_m4_m4(imat, mat);
@@ -247,7 +248,8 @@ void BKE_object_modifier_gpencil_hook_reset(Object *ob, HookGpencilModifierData
if (hmd->subtarget[0] && pchan) {
float imat[4][4], mat[4][4];
- /* calculate the world-space matrix for the pose-channel target first, then carry on as usual */
+ /* Calculate the world-space matrix for the pose-channel target first,
+ * then carry on as usual. */
mul_m4_m4m4(mat, hmd->object->obmat, pchan->pose_mat);
invert_m4_m4(imat, mat);
@@ -1159,7 +1161,8 @@ static void copy_object_pose(Object *obn, const Object *ob, const int flag)
chan->flag &= ~(POSE_LOC | POSE_ROT | POSE_SIZE);
- /* XXX Remapping object pointing onto itself should be handled by generic BKE_library_remap stuff, but...
+ /* XXX Remapping object pointing onto itself should be handled by generic
+ * BKE_library_remap stuff, but...
* the flush_constraint_targets callback am not sure about, so will delay that for now. */
for (con = chan->constraints.first; con; con = con->next) {
const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
@@ -1334,8 +1337,10 @@ void BKE_object_transform_copy(Object *ob_tar, const Object *ob_src)
}
/**
- * Only copy internal data of Object ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of Object ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -1438,7 +1443,8 @@ void BKE_object_copy_data(Main *bmain, Object *ob_dst, const Object *ob_src, con
copy_object_lod(ob_dst, ob_src, flag_subdata);
- /* Do not copy object's preview (mostly due to the fact renderers create temp copy of objects). */
+ /* Do not copy object's preview
+ * (mostly due to the fact renderers create temp copy of objects). */
if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0 && false) { /* XXX TODO temp hack */
BKE_previewimg_id_copy(&ob_dst->id, &ob_src->id);
}
@@ -1461,11 +1467,13 @@ Object *BKE_object_copy(Main *bmain, const Object *ob)
/** Perform deep-copy of object and its 'children' data-blocks (obdata, materials, actions, etc.).
*
- * \param dupflag Controls which sub-data are also duplicated (see #eDupli_ID_Flags in DNA_userdef_types.h).
+ * \param dupflag Controls which sub-data are also duplicated
+ * (see #eDupli_ID_Flags in DNA_userdef_types.h).
*
- * \note This function does not do any remapping to new IDs, caller must do it (\a #BKE_libblock_relink_to_newid()).
- * \note Caller MUST free \a newid pointers itself (#BKE_main_id_clear_newpoins()) and call updates of DEG too
- * (#DAG_relations_tag_update()).
+ * \note This function does not do any remapping to new IDs, caller must do it
+ * (\a #BKE_libblock_relink_to_newid()).
+ * \note Caller MUST free \a newid pointers itself (#BKE_main_id_clear_newpoins()) and call updates
+ * of DEG too (#DAG_relations_tag_update()).
*/
Object *BKE_object_duplicate(Main *bmain, const Object *ob, const int dupflag)
{
@@ -1731,7 +1739,8 @@ void BKE_object_make_local_ex(Main *bmain,
/* - only lib users: do nothing (unless force_local is set)
* - only local users: set flag
* - mixed: make copy
- * In case we make a whole lib's content local, we always want to localize, and we skip remapping (done later).
+ * In case we make a whole lib's content local,
+ * we always want to localize, and we skip remapping (done later).
*/
if (!ID_IS_LINKED(ob)) {
@@ -1844,10 +1853,12 @@ void BKE_object_copy_proxy_drivers(Object *ob, Object *target)
}
}
-/* proxy rule: lib_object->proxy_from == the one we borrow from, set temporally while object_update */
-/* local_object->proxy == pointer to library object, saved in files and read */
-/* local_object->proxy_group == pointer to collection dupli-object, saved in files and read */
-
+/**
+ * Proxy rule:
+ * - lib_object->proxy_from == the one we borrow from, set temporally while object_update.
+ * - local_object->proxy == pointer to library object, saved in files and read.
+ * - local_object->proxy_group == pointer to collection dupli-object, saved in files and read.
+ */
void BKE_object_make_proxy(Main *bmain, Object *ob, Object *target, Object *cob)
{
/* paranoia checks */
@@ -2015,7 +2026,8 @@ void BKE_object_rot_to_mat3(Object *ob, float mat[3][3], bool use_drot)
/* rotations may either be quats, eulers (with various rotation orders), or axis-angle */
if (ob->rotmode > 0) {
- /* euler rotations (will cause gimble lock, but this can be alleviated a bit with rotation orders) */
+ /* Euler rotations
+ * (will cause gimble lock, but this can be alleviated a bit with rotation orders). */
eulO_to_mat3(rmat, ob->rot, ob->rotmode);
eulO_to_mat3(dmat, ob->drot, ob->rotmode);
}
@@ -2242,11 +2254,11 @@ static bool ob_parcurve(Object *ob, Object *par, float mat[4][4])
return false;
}
- /* ctime is now a proper var setting of Curve which gets set by Animato like any other var that's animated,
- * but this will only work if it actually is animated...
+ /* ctime is now a proper var setting of Curve which gets set by Animato like any other var
+ * that's animated, but this will only work if it actually is animated.
*
- * we divide the curvetime calculated in the previous step by the length of the path, to get a time
- * factor, which then gets clamped to lie within 0.0 - 1.0 range
+ * We divide the curvetime calculated in the previous step by the length of the path,
+ * to get a time factor, which then gets clamped to lie within 0.0 - 1.0 range.
*/
if (cu->pathlen) {
ctime = cu->ctime / cu->pathlen;
@@ -2491,7 +2503,8 @@ void BKE_object_get_parent_matrix(Object *ob, Object *par, float parentmat[4][4]
}
/**
- * \param r_originmat: Optional matrix that stores the space the object is in (without its own matrix applied)
+ * \param r_originmat: Optional matrix that stores the space the object is in
+ * (without its own matrix applied)
*/
static void solve_parenting(
Object *ob, Object *par, float obmat[4][4], float r_originmat[3][3], const bool set_origin)
@@ -2614,7 +2627,8 @@ void BKE_object_workob_calc_parent(Depsgraph *depsgraph, Scene *scene, Object *o
unit_m4(workob->parentinv);
unit_m4(workob->constinv);
- /* Since this is used while calculating parenting, at this moment ob_eval->parent is still NULL. */
+ /* Since this is used while calculating parenting,
+ * at this moment ob_eval->parent is still NULL. */
workob->parent = DEG_get_evaluated_object(depsgraph, ob->parent);
workob->trackflag = ob->trackflag;
@@ -2636,8 +2650,10 @@ void BKE_object_workob_calc_parent(Depsgraph *depsgraph, Scene *scene, Object *o
* Applies the global transformation \a mat to the \a ob using a relative parent space if supplied.
*
* \param mat: the global transformation mat that the object should be set object to.
- * \param parent: the parent space in which this object will be set relative to (should probably always be parent_eval).
- * \param use_compat: true to ensure that rotations are set using the min difference between the old and new orientation.
+ * \param parent: the parent space in which this object will be set relative to
+ * (should probably always be parent_eval).
+ * \param use_compat: true to ensure that rotations are set using the
+ * min difference between the old and new orientation.
*/
void BKE_object_apply_mat4_ex(
Object *ob, float mat[4][4], Object *parent, float parentinv[4][4], const bool use_compat)
@@ -3177,14 +3193,19 @@ static void object_handle_update_proxy(Depsgraph *depsgraph,
}
}
-/* proxy rule: lib_object->proxy_from == the one we borrow from, only set temporal and cleared here */
-/* local_object->proxy == pointer to library object, saved in files and read */
-
-/* function below is polluted with proxy exceptions, cleanup will follow! */
-
-/* the main object update call, for object matrix, constraints, keys and displist (modifiers) */
-/* requires flags to be set! */
-/* Ideally we shouldn't have to pass the rigid body world, but need bigger restructuring to avoid id */
+/**
+ * Proxy rule:
+ * - lib_object->proxy_from == the one we borrow from, only set temporal and cleared here.
+ * - local_object->proxy == pointer to library object, saved in files and read.
+ *
+ * Function below is polluted with proxy exceptions, cleanup will follow!
+ *
+ * The main object update call, for object matrix, constraints, keys and displist (modifiers)
+ * requires flags to be set!
+ *
+ * Ideally we shouldn't have to pass the rigid body world,
+ * but need bigger restructuring to avoid id.
+ */
void BKE_object_handle_update_ex(Depsgraph *depsgraph,
Scene *scene,
Object *ob,
diff --git a/source/blender/blenkernel/intern/object_deform.c b/source/blender/blenkernel/intern/object_deform.c
index 751110affaf..704e6886f27 100644
--- a/source/blender/blenkernel/intern/object_deform.c
+++ b/source/blender/blenkernel/intern/object_deform.c
@@ -347,7 +347,8 @@ static void object_defgroup_remove_edit_mode(Object *ob, bDeformGroup *dg)
BLI_assert(def_nr != -1);
- /* Make sure that no verts are using this group - if none were removed, we can skip next per-vert update. */
+ /* Make sure that no verts are using this group - if none were removed,
+ * we can skip next per-vert update. */
if (!BKE_object_defgroup_clear(ob, dg, false)) {
/* Nothing to do. */
}
@@ -692,7 +693,9 @@ bool *BKE_object_defgroup_selected_get(Object *ob, int defbase_tot, int *r_dg_fl
return dg_selection;
}
-/* Marks mirror vgroups in output and counts them. Output and counter assumed to be already initialized.
+/**
+ * Marks mirror vgroups in output and counts them.
+ * Output and counter assumed to be already initialized.
* Designed to be usable after BKE_object_defgroup_selected_get to extend selection to mirror.
*/
void BKE_object_defgroup_mirror_selection(struct Object *ob,
diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c
index 00ef5d9c469..8080834a53a 100644
--- a/source/blender/blenkernel/intern/object_dupli.c
+++ b/source/blender/blenkernel/intern/object_dupli.c
@@ -122,7 +122,8 @@ static void copy_dupli_context(
{
*r_ctx = *ctx;
- /* XXX annoying, previously was done by passing an ID* argument, this at least is more explicit */
+ /* XXX annoying, previously was done by passing an ID* argument,
+ * this at least is more explicit. */
if (ctx->gen->type == OB_DUPLICOLLECTION) {
r_ctx->collection = ctx->object->instance_collection;
}
@@ -525,7 +526,8 @@ static void make_duplis_font(const DupliContext *ctx)
for (a = 0; a < text_len; a++, ct++) {
/* XXX That G.main is *really* ugly, but not sure what to do here...
- * Definitively don't think it would be safe to put back Main *bmain pointer in DupliContext as done in 2.7x? */
+ * Definitively don't think it would be safe to put back Main *bmain pointer
+ * in DupliContext as done in 2.7x? */
ob = find_family_object(G.main, cu->family, family_len, (unsigned int)text[a], family_gh);
if (ob) {
vec[0] = fsize * (ct->xof - xof);
@@ -988,7 +990,8 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
copy_v3_v3(vec, obmat[3]);
zero_v3(obmat[3]);
- /* particle rotation uses x-axis as the aligned axis, so pre-rotate the object accordingly */
+ /* Particle rotation uses x-axis as the aligned axis,
+ * so pre-rotate the object accordingly. */
if ((part->draw & PART_DRAW_ROTATE_OB) == 0) {
float xvec[3], q[4], size_mat[4][4], original_size[3];
diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c
index 606df3a7a96..02fec32b207 100644
--- a/source/blender/blenkernel/intern/ocean.c
+++ b/source/blender/blenkernel/intern/ocean.c
@@ -116,7 +116,8 @@ typedef struct Ocean {
/* two dimensional arrays of float */
double *_disp_y; /* init w sim w via plan? */
double *_N_x; /* init w sim w via plan? */
- /* all member of this array has same values, so convert this array to a float to reduce memory usage (MEM01)*/
+ /* all member of this array has same values,
+ * so convert this array to a float to reduce memory usage (MEM01). */
/*float * _N_y; */
double _N_y; /* sim w ********* can be rearranged? */
double *_N_z; /* init w sim w via plan? */
@@ -148,9 +149,9 @@ static float nextfr(RNG *rng, float min, float max)
static float gaussRand(RNG *rng)
{
- /* Note: to avoid numerical problems with very small numbers, we make these variables singe-precision floats,
- * but later we call the double-precision log() and sqrt() functions instead of logf() and sqrtf().
- */
+ /* Note: to avoid numerical problems with very small numbers, we make these variables
+ * singe-precision floats, but later we call the double-precision log() and sqrt() functions
+ * instead of logf() and sqrtf(). */
float x;
float y;
float length2;
@@ -464,9 +465,8 @@ void BKE_ocean_eval_xz_catrom(struct Ocean *oc, struct OceanResult *ocr, float x
BKE_ocean_eval_uv_catrom(oc, ocr, x / oc->_Lx, z / oc->_Lz);
}
-/* note that this doesn't wrap properly for i, j < 0, but its not really meant for that being just a way to get
- * the raw data out to save in some image format.
- */
+/* note that this doesn't wrap properly for i, j < 0, but its not really meant for that being
+ * just a way to get the raw data out to save in some image format. */
void BKE_ocean_eval_ij(struct Ocean *oc, struct OceanResult *ocr, int i, int j)
{
BLI_rw_mutex_lock(&oc->oceanmutex, THREAD_LOCK_READ);
@@ -519,7 +519,8 @@ static void ocean_compute_htilda(void *__restrict userdata,
int j;
- /* note the <= _N/2 here, see the fftw doco about the mechanics of the complex->real fft storage */
+ /* note the <= _N/2 here, see the fftw doco
+ * about the mechanics of the complex->real fft storage. */
for (j = 0; j <= o->_N / 2; ++j) {
fftw_complex exp_param1;
fftw_complex exp_param2;
@@ -770,11 +771,12 @@ void BKE_ocean_simulate(struct Ocean *o, float t, float scale, float chop_amount
BLI_rw_mutex_lock(&o->oceanmutex, THREAD_LOCK_WRITE);
- /* Note about multi-threading here: we have to run a first set of computations (htilda one) before we can run
- * all others, since they all depend on it.
- * So we make a first parallelized forloop run for htilda, and then pack all other computations into
- * a set of parallel tasks.
- * This is not optimal in all cases, but remains reasonably simple and should be OK most of the time. */
+ /* Note about multi-threading here: we have to run a first set of computations (htilda one)
+ * before we can run all others, since they all depend on it.
+ * So we make a first parallelized forloop run for htilda,
+ * and then pack all other computations into a set of parallel tasks.
+ * This is not optimal in all cases,
+ * but remains reasonably simple and should be OK most of the time. */
/* compute a new htilda */
ParallelRangeSettings settings;
@@ -1342,7 +1344,8 @@ void BKE_ocean_simulate_cache(struct OceanCache *och, int frame)
return;
}
- /* use default color spaces since we know for sure cache files were saved with default settings too */
+ /* Use default color spaces since we know for sure cache
+ * files were saved with default settings too. */
cache_filename(string, och->bakepath, och->relbase, frame, CACHE_TYPE_DISPLACE);
och->ibufs_disp[f] = IMB_loadiffname(string, 0, NULL);
@@ -1429,9 +1432,9 @@ void BKE_ocean_bake(struct Ocean *o,
/* pr = pr * och->foam_fade; */ /* overall fade */
- /* remember ocean coord sys is Y up!
- * break up the foam where height (Y) is low (wave valley), and X and Z displacement is greatest
- */
+ /* Remember ocean coord sys is Y up!
+ * break up the foam where height (Y) is low (wave valley),
+ * and X and Z displacement is greatest. */
neg_disp = ocr.disp[1] < 0.0f ? 1.0f + ocr.disp[1] : 1.0f;
neg_disp = neg_disp < 0.0f ? 0.0f : neg_disp;
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index 29e9295df1d..ab2ce2ec8ba 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -407,7 +407,8 @@ int checkPackedFile(const char *ref_file_name, const char *filename, PackedFile
* It returns a char *to the existing file name / new file name or NULL when
* there was an error or when the user decides to cancel the operation.
*
- * \warning 'abs_name' may be relative still! (use a "//" prefix) be sure to run #BLI_path_abs on it first.
+ * \warning 'abs_name' may be relative still! (use a "//" prefix)
+ * be sure to run #BLI_path_abs on it first.
*/
char *unpackFile(ReportList *reports,
const char *ref_file_name,
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 7e8e724cfcc..7a36ff4e380 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -447,8 +447,10 @@ PaintCurve *BKE_paint_curve_add(Main *bmain, const char *name)
}
/**
- * Only copy internal data of PaintCurve ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of PaintCurve ID from source to
+ * already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -534,8 +536,10 @@ Palette *BKE_palette_add(Main *bmain, const char *name)
}
/**
- * Only copy internal data of Palette ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of Palette ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -938,7 +942,8 @@ void BKE_sculptsession_bm_to_me(Object *ob, bool reorder)
if (ob && ob->sculpt) {
sculptsession_bm_to_me_update_data_only(ob, reorder);
- /* ensure the objects evaluated mesh doesn't hold onto arrays now realloc'd in the mesh [#34473] */
+ /* Ensure the objects evaluated mesh doesn't hold onto arrays
+ * now realloc'd in the mesh T34473. */
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
}
}
@@ -1134,7 +1139,10 @@ void BKE_sculpt_update_mesh_elements(
if (!CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK)) {
#if 1
BKE_sculpt_mask_layers_ensure(ob, mmd);
-#else /* if we wanted to support adding mask data while multi-res painting, we would need to do this */
+#else
+ /* If we wanted to support adding mask data while multi-res painting,
+ * we would need to do this. */
+
if ((ED_sculpt_mask_layers_ensure(ob, mmd) & ED_SCULPT_MASK_LAYER_CALC_LOOP)) {
/* remake the derived mesh */
ob->recalc |= ID_RECALC_GEOMETRY;
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 986e47894ca..63ff11e8eea 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -477,7 +477,9 @@ static void fluid_free_settings(SPHFluidSettings *fluid)
}
}
-/** Free (or release) any data used by this particle settings (does not free the partsett itself). */
+/**
+ * Free (or release) any data used by this particle settings (does not free the partsett itself).
+ */
void BKE_particlesettings_free(ParticleSettings *part)
{
int a;
@@ -603,7 +605,8 @@ void psys_free_particles(ParticleSystem *psys)
PARTICLE_P;
if (psys->particles) {
- /* Even though psys->part should never be NULL, this can happen as an exception during deletion.
+ /* Even though psys->part should never be NULL,
+ * this can happen as an exception during deletion.
* See ID_REMAP_SKIP/FORCE/FLAG_NEVER_NULL_USAGE in BKE_library_remap. */
if (psys->part && psys->part->type == PART_HAIR) {
LOOP_PARTICLES
@@ -846,8 +849,12 @@ typedef struct ParticleInterpolationData {
float birthtime, dietime;
int bspline;
} ParticleInterpolationData;
-/* Assumes pointcache->mem_cache exists, so for disk cached particles call psys_make_temp_pointcache() before use */
-/* It uses ParticleInterpolationData->pm to store the current memory cache frame so it's thread safe. */
+/**
+ * Assumes pointcache->mem_cache exists, so for disk cached particles
+ * call #psys_make_temp_pointcache() before use.
+ * It uses #ParticleInterpolationData.pm to store the current memory cache frame
+ * so it's thread safe.
+ */
static void get_pointcache_keys_for_time(Object *UNUSED(ob),
PointCache *cache,
PTCacheMem **cur,
@@ -1194,7 +1201,8 @@ static void do_particle_interpolation(ParticleSystem *psys,
interp_qt_qtqt(result->rot, keys[1].rot, keys[2].rot, keytime);
}
- /* now we should have in chronologiacl order k1<=k2<=t<=k3<=k4 with keytime between [0, 1]->[k2, k3] (k1 & k4 used for cardinal & bspline interpolation)*/
+ /* Now we should have in chronologiacl order k1<=k2<=t<=k3<=k4 with keytime between
+ * [0, 1]->[k2, k3] (k1 & k4 used for cardinal & bspline interpolation). */
psys_interpolate_particle((pind->keyed || pind->cache || point_vel) ?
-1 /* signal for cubic interpolation */
:
@@ -1574,7 +1582,8 @@ int psys_particle_dm_face_lookup(Mesh *mesh_final,
}
else { /* if we have no node, try every face */
for (int findex_dst = 0; findex_dst < totface_final; findex_dst++) {
- /* If current tessface from 'final' DM and orig tessface (given by index) map to the same orig poly... */
+ /* If current tessface from 'final' DM and orig tessface (given by index)
+ * map to the same orig poly. */
if (BKE_mesh_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, findex_dst) ==
pindex_orig) {
faceuv = osface_final[findex_dst].uv;
@@ -2245,7 +2254,8 @@ void psys_find_parents(ParticleSimulationData *sim, const bool use_render_params
psys_particle_on_emitter(
sim->psmd, from, cpa->num, DMCACHE_ISCHILD, cpa->fuv, cpa->foffset, co, 0, 0, 0, orco);
- /* Check if particle doesn't exist because of texture influence. Insert only existing particles into kdtree. */
+ /* Check if particle doesn't exist because of texture influence.
+ * Insert only existing particles into kdtree. */
get_cpa_texture(sim->psmd->mesh_final,
psys,
part,
@@ -2463,7 +2473,8 @@ static void psys_thread_create_path(ParticleTask *task,
const ParticleCacheKey *key_w_last = pcache_key_segment_endpoint_safe(key[w]);
float d;
if (part->flag & PART_CHILD_LONG_HAIR) {
- /* For long hair use tip distance/root distance as parting factor instead of root to tip angle. */
+ /* For long hair use tip distance/root distance as parting
+ * factor instead of root to tip angle. */
float d1 = len_v3v3(key[0]->co, key[w]->co);
float d2 = len_v3v3(key_0_last->co, key_w_last->co);
@@ -2676,7 +2687,8 @@ static void psys_thread_create_path(ParticleTask *task,
pa = &psys->particles[cpa->parent];
par = pcache[cpa->parent];
- /* If particle is unexisting, try to pick a viable parent from particles used for interpolation. */
+ /* If particle is unexisting, try to pick a viable parent from particles
+ * used for interpolation. */
for (k = 0; k < 4 && pa && (pa->flag & PARS_UNEXIST); k++) {
if (cpa->pa[k] >= 0) {
pa = &psys->particles[cpa->pa[k]];
@@ -3741,8 +3753,10 @@ void BKE_particlesettings_twist_curve_init(ParticleSettings *part)
}
/**
- * Only copy internal data of ParticleSettings ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of ParticleSettings ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -4368,7 +4382,8 @@ void psys_get_particle_on_path(ParticleSimulationData *sim,
psys_particle_on_emitter(
psmd, cpa_from, cpa_num, DMCACHE_ISCHILD, cpa->fuv, foffset, co, 0, 0, 0, orco);
- /* we need to save the actual root position of the child for positioning it accurately to the surface of the emitter */
+ /* We need to save the actual root position of the child for
+ * positioning it accurately to the surface of the emitter. */
//copy_v3_v3(cpa_1st, co);
//mul_m4_v3(ob->obmat, cpa_1st);
@@ -4614,7 +4629,8 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
/* let's interpolate to try to be as accurate as possible */
if (pa->state.time + 2.f >= state->time && pa->prev_state.time - 2.f <= state->time) {
if (pa->prev_state.time >= pa->state.time || pa->prev_state.time < 0.f) {
- /* prev_state is wrong so let's not use it, this can happen at frames 1, 0 or particle birth */
+ /* prev_state is wrong so let's not use it,
+ * this can happen at frames 1, 0 or particle birth. */
dfra = state->time - pa->state.time;
copy_particle_key(state, &pa->state, 1);
@@ -4655,7 +4671,8 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
madd_v3_v3v3fl(state->co, state->co, state->vel, dfra / frs_sec);
}
else {
- /* extrapolating over big ranges is not accurate so let's just give something close to reasonable back */
+ /* Extrapolating over big ranges is not accurate
+ * so let's just give something close to reasonable back. */
copy_particle_key(state, &pa->state, 0);
}
}
diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c
index 45aa55a401b..8125024585c 100644
--- a/source/blender/blenkernel/intern/particle_distribute.c
+++ b/source/blender/blenkernel/intern/particle_distribute.c
@@ -909,14 +909,14 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx,
!CustomData_get_layer(&final_mesh->fdata, CD_ORIGINDEX)) {
printf(
"Can't create particles with the current modifier stack, disable destructive modifiers\n");
- // XXX error("Can't paint with the current modifier stack, disable destructive modifiers");
+ // XXX error("Can't paint with the current modifier stack, disable destructive modifiers");
return 0;
}
- /* XXX This distribution code is totally broken in case from == PART_FROM_CHILD, it's always using finaldm
- * even if use_modifier_stack is unset... But making things consistent here break all existing edited
- * hair systems, so better wait for complete rewrite.
- */
+ /* XXX This distribution code is totally broken in case from == PART_FROM_CHILD,
+ * it's always using finaldm even if use_modifier_stack is unset...
+ * But making things consistent here break all existing edited
+ * hair systems, so better wait for complete rewrite. */
psys_thread_context_init(ctx, sim);
@@ -1204,9 +1204,10 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx,
double step, pos;
step = (totpart < 2) ? 0.5 : 1.0 / (double)totpart;
- /* This is to address tricky issues with vertex-emitting when user tries (and expects) exact 1-1 vert/part
- * distribution (see T47983 and its two example files). It allows us to consider pos as
- * 'midpoint between v and v+1' (or 'p and p+1', depending whether we have more vertices than particles or not),
+ /* This is to address tricky issues with vertex-emitting when user tries
+ * (and expects) exact 1-1 vert/part distribution (see T47983 and its two example files).
+ * It allows us to consider pos as 'midpoint between v and v+1'
+ * (or 'p and p+1', depending whether we have more vertices than particles or not),
* and avoid stumbling over float impression in element_sum.
* Note: moved face and volume distribution to this as well (instead of starting at zero),
* for the same reasons, see T52682. */
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 38183f97b72..fb7cbde62b1 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -791,8 +791,15 @@ void psys_get_birth_coords(
/* -tangent */
if (use_tangents) {
- //float phase=vg_rot?2.0f*(psys_particle_value_from_verts(sim->psmd->dm,part->from,pa,vg_rot)-0.5f):0.0f;
+#if 0
+ float phase = vg_rot ?
+ 2.0f *
+ (psys_particle_value_from_verts(sim->psmd->dm, part->from, pa, vg_rot) -
+ 0.5f) :
+ 0.0f;
+#else
float phase = 0.0f;
+#endif
mul_v3_fl(vtan, -cosf((float)M_PI * (part->tanphase + phase)));
fac = -sinf((float)M_PI * (part->tanphase + phase));
madd_v3_v3fl(vtan, utan, fac);
@@ -1554,12 +1561,13 @@ static void integrate_particle(
}
}
-/*********************************************************************************************************
- * SPH fluid physics
+/* -------------------------------------------------------------------- */
+/** \name SPH fluid physics
*
* In theory, there could be unlimited implementation of SPH simulators
*
- * This code uses in some parts adapted algorithms from the pseudo code as outlined in the Research paper:
+ * This code uses in some parts adapted algorithms
+ * from the pseudo code as outlined in the Research paper:
*
* Titled: Particle-based Viscoelastic Fluid Simulation.
* Authors: Simon Clavet, Philippe Beaudoin and Pierre Poulin
@@ -1567,7 +1575,8 @@ static void integrate_particle(
*
* Presented at Siggraph, (2005)
*
- * ********************************************************************************************************/
+ * \{ */
+
#define PSYS_FLUID_SPRINGS_INITIAL_SIZE 256
static ParticleSpring *sph_spring_add(ParticleSystem *psys, ParticleSpring *spring)
{
@@ -2210,6 +2219,8 @@ static void sph_integrate(ParticleSimulationData *sim,
integrate_particle(part, pa, dtime, effector_acceleration, sphdata->force_cb, sphdata);
}
+/** \} */
+
/************************************************/
/* Basic physics */
/************************************************/
@@ -2435,7 +2446,8 @@ static void collision_interpolate_element(ParticleCollisionElement *pce,
{
/* t is the current time for newton rhapson */
/* fac is the starting factor for current collision iteration */
- /* the col->fac's are factors for the particle subframe step start and end during collision modifier step */
+ /* The col->fac's are factors for the particle subframe step start
+ * and end during collision modifier step. */
float f = fac + t * (1.f - fac);
float mul = col->fac1 + f * (col->fac2 - col->fac1);
if (pce->tot > 0) {
@@ -2928,7 +2940,8 @@ static int collision_response(ParticleSimulationData *sim,
/* get exact velocity right before collision */
madd_v3_v3v3fl(v0, col->ve1, col->acc, dt1);
- /* convert collider velocity from 1/framestep to 1/s TODO: here we assume 1 frame step for collision modifier */
+ /* Convert collider velocity from 1/framestep to 1/s TODO:
+ * here we assume 1 frame step for collision modifier. */
mul_v3_fl(pce->vel, col->inv_timestep);
/* calculate tangential particle velocity */
@@ -2983,8 +2996,10 @@ static int collision_response(ParticleSimulationData *sim,
}
}
- /* stickiness was possibly added before, so cancel that before calculating new normal velocity */
- /* otherwise particles go flying out of the surface because of high reversed sticky velocity */
+ /* Stickiness was possibly added before,
+ * so cancel that before calculating new normal velocity.
+ * Otherwise particles go flying out of the surface
+ * because of high reversed sticky velocity. */
if (v0_dot < 0.0f) {
v0_dot += pd->pdef_stickness;
if (v0_dot > 0.0f) {
@@ -3578,7 +3593,8 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra))
pa->totkey++;
- /* root is always in the origin of hair space so we set it to be so after the last key is saved*/
+ /* Root is always in the origin of hair space
+ * so we set it to be so after the last key is saved. */
if (pa->totkey == psys->part->hair_step + 1) {
zero_v3(root->co);
}
@@ -4200,7 +4216,18 @@ static void particles_fluid_step(ParticleSimulationData *sim,
pa->dietime = sim->scene->r.efra + 1;
pa->lifetime = sim->scene->r.efra;
pa->alive = PARS_ALIVE;
- //if (a < 25) fprintf(stderr,"FSPARTICLE debug set %s, a%d = %f,%f,%f, life=%f\n", filename, a, pa->co[0],pa->co[1],pa->co[2], pa->lifetime );
+# if 0
+ if (a < 25) {
+ fprintf(stderr,
+ "FSPARTICLE debug set %s, a%d = %f,%f,%f, life=%f\n",
+ filename,
+ a,
+ pa->co[0],
+ pa->co[1],
+ pa->co[2],
+ pa->lifetime);
+ }
+# endif
}
else {
// skip...
@@ -4759,7 +4786,8 @@ void particle_system_update(struct Depsgraph *depsgraph,
}
}
- /* save matrix for duplicators, at rendertime the actual dupliobject's matrix is used so don't update! */
+ /* Save matrix for duplicators,
+ * at rendertime the actual dupliobject's matrix is used so don't update! */
invert_m4_m4(psys->imat, ob->obmat);
BKE_particle_batch_cache_dirty_tag(psys, BKE_PARTICLE_BATCH_DIRTY_ALL);
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index 0a82d086862..1ba3ccbc1a3 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -1038,9 +1038,10 @@ static void pbvh_update_normals_accum_task_cb(void *__restrict userdata,
const int v = vtri[j];
if (bvh->verts[v].flag & ME_VERT_PBVH_UPDATE) {
- /* Note: This avoids `lock, add_v3_v3, unlock` and is five to ten times quicker than a spinlock.
- * Not exact equivalent though, since atomicity is only ensured for one component
- * of the vector at a time, but here it shall not make any sensible difference. */
+ /* Note: This avoids `lock, add_v3_v3, unlock`
+ * and is five to ten times quicker than a spinlock.
+ * Not exact equivalent though, since atomicity is only ensured for one component
+ * of the vector at a time, but here it shall not make any sensible difference. */
for (int k = 3; k--;) {
atomic_add_and_fetch_fl(&vnors[v][k], fn[k]);
}
@@ -1924,8 +1925,8 @@ void BKE_pbvh_raycast_project_ray_root(
BKE_pbvh_node_get_BB(bvh->nodes, bb_min_root, bb_max_root);
}
- /* slightly offset min and max in case we have a zero width node (due to a plane mesh for instance),
- * or faces very close to the bounding box boundary. */
+ /* Slightly offset min and max in case we have a zero width node
+ * (due to a plane mesh for instance), or faces very close to the bounding box boundary. */
mid_v3_v3v3(bb_center, bb_max_root, bb_min_root);
/* diff should be same for both min/max since it's calculated from center */
sub_v3_v3v3(bb_diff, bb_max_root, bb_center);
@@ -2341,7 +2342,8 @@ void BKE_pbvh_apply_vertCos(PBVH *pbvh, float (*vertCos)[3], const int totvert)
/* unneeded deformation -- duplicate verts/faces to avoid this */
pbvh->verts = MEM_dupallocN(pbvh->verts);
- /* No need to dupalloc pbvh->looptri, this one is 'totally owned' by pbvh, it's never some mesh data. */
+ /* No need to dupalloc pbvh->looptri, this one is 'totally owned' by pbvh,
+ * it's never some mesh data. */
pbvh->deformed = true;
}
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c
index bc84b3737aa..25f9948a835 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -1916,7 +1916,8 @@ void BKE_pbvh_build_bmesh(PBVH *bvh,
/* start recursion, assign faces to nodes accordingly */
pbvh_bmesh_node_limit_ensure_fast(bvh, nodeinfo, bbc_array, &rootnode, arena);
- /* we now have all faces assigned to a node, next we need to assign those to the gsets of the nodes */
+ /* We now have all faces assigned to a node,
+ * next we need to assign those to the gsets of the nodes. */
/* Start with all faces in the root node */
bvh->nodes = MEM_callocN(sizeof(PBVHNode), "PBVHNode");
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index c07ae89e250..b56a024fb77 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -293,7 +293,8 @@ static int ptcache_particle_write(int index, void *psys_v, void **data, int cfra
PTCACHE_DATA_FROM(data, BPHYS_DATA_BOIDS, &boid->data);
}
- /* return flag 1+1=2 for newly born particles to copy exact birth location to previously cached frame */
+ /* Return flag 1+1=2 for newly born particles
+ * to copy exact birth location to previously cached frame. */
return 1 + (pa->state.time >= pa->time && pa->prev_state.time <= pa->time);
}
static void ptcache_particle_read(
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index b5960962e17..632e9cb53b8 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -114,7 +114,8 @@ void BKE_rigidbody_free_world(Scene *scene)
}
if (is_orig && rbw->shared->physics_world) {
- /* free physics references, we assume that all physics objects in will have been added to the world */
+ /* Free physics references,
+ * we assume that all physics objects in will have been added to the world. */
if (rbw->constraints) {
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (rbw->constraints, object) {
if (object->rigidbody_constraint) {
@@ -685,7 +686,8 @@ static void rigidbody_validate_sim_object(RigidBodyWorld *rbw, Object *ob, bool
}
/* make sure collision shape exists */
- /* FIXME we shouldn't always have to rebuild collision shapes when rebuilding objects, but it's needed for constraints to update correctly */
+ /* FIXME we shouldn't always have to rebuild collision shapes when rebuilding objects,
+ * but it's needed for constraints to update correctly. */
if (rbo->shared->physics_shape == NULL || rebuild) {
rigidbody_validate_sim_shape(ob, true);
}
@@ -990,8 +992,12 @@ static void rigidbody_validate_sim_constraint(RigidBodyWorld *rbw, Object *ob, b
/* --------------------- */
-/* Create physics sim world given RigidBody world settings */
-// NOTE: this does NOT update object references that the scene uses, in case those aren't ready yet!
+/**
+ * Create physics sim world given RigidBody world settings
+ *
+ * \note this does NOT update object references that the scene uses,
+ * in case those aren't ready yet!
+ */
void BKE_rigidbody_validate_sim_world(Scene *scene, RigidBodyWorld *rbw, bool rebuild)
{
/* sanity checks */
@@ -1437,7 +1443,8 @@ static void rigidbody_update_sim_ob(
RBO_GET_MARGIN(rbo) * MIN3(scale[0], scale[1], scale[2]));
}
- /* make transformed objects temporarily kinmatic so that they can be moved by the user during simulation */
+ /* Make transformed objects temporarily kinmatic
+ * so that they can be moved by the user during simulation. */
if (ob->flag & SELECT && G.moving & G_TRANSFORM_OBJ) {
RB_body_set_kinematic_state(rbo->shared->physics_object, true);
RB_body_set_mass(rbo->shared->physics_object, 0.0f);
@@ -1463,15 +1470,16 @@ static void rigidbody_update_sim_ob(
float eff_loc[3], eff_vel[3];
/* create dummy 'point' which represents last known position of object as result of sim */
- // XXX: this can create some inaccuracies with sim position, but is probably better than using unsimulated vals?
+ /* XXX: this can create some inaccuracies with sim position,
+ * but is probably better than using unsimulated vals? */
RB_body_get_position(rbo->shared->physics_object, eff_loc);
RB_body_get_linear_velocity(rbo->shared->physics_object, eff_vel);
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...
- */
+ /* 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... */
BKE_effectors_apply(effectors, NULL, effector_weights, &epoint, eff_force, NULL);
if (G.f & G_DEBUG) {
printf("\tapplying force (%f,%f,%f) to '%s'\n",
@@ -1541,13 +1549,15 @@ static void rigidbody_update_simulation(Depsgraph *depsgraph,
if (ob->type == OB_MESH) {
/* validate that we've got valid object set up here... */
RigidBodyOb *rbo = ob->rigidbody_object;
- /* update transformation matrix of the object so we don't get a frame of lag for simple animations */
+ /* Update transformation matrix of the object
+ * so we don't get a frame of lag for simple animations. */
BKE_object_where_is_calc_time(depsgraph, scene, ob, ctime);
/* TODO remove this whole block once we are sure we never get NULL rbo here anymore. */
/* This cannot be done in CoW evaluation context anymore... */
if (rbo == NULL) {
- BLI_assert(!"CoW object part of RBW object collection without RB object data, should not happen.\n");
+ BLI_assert(!"CoW object part of RBW object collection without RB object data, "
+ "should not happen.\n");
/* 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...
@@ -1563,7 +1573,8 @@ static void rigidbody_update_simulation(Depsgraph *depsgraph,
if (rebuild) {
/* World has been rebuilt so rebuild object */
/* TODO(Sybren): rigidbody_validate_sim_object() can call rigidbody_validate_sim_shape(),
- * but neither resets the RBO_FLAG_NEEDS_RESHAPE flag nor calls RB_body_set_collision_shape().
+ * but neither resets the RBO_FLAG_NEEDS_RESHAPE flag nor
+ * calls RB_body_set_collision_shape().
* This results in the collision shape being created twice, which is unnecessary. */
rigidbody_validate_sim_object(rbw, ob, true);
}
@@ -1575,7 +1586,8 @@ static void rigidbody_update_simulation(Depsgraph *depsgraph,
/* mesh/shape data changed, so force shape refresh */
rigidbody_validate_sim_shape(ob, true);
/* now tell RB sim about it */
- // XXX: we assume that this can only get applied for active/passive shapes that will be included as rigidbodies
+ /* XXX: we assume that this can only get applied for active/passive shapes
+ * that will be included as rigidbodies. */
RB_body_set_collision_shape(rbo->shared->physics_object, rbo->shared->physics_shape);
}
}
@@ -1595,13 +1607,15 @@ static void rigidbody_update_simulation(Depsgraph *depsgraph,
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (rbw->constraints, ob) {
/* validate that we've got valid object set up here... */
RigidBodyCon *rbc = ob->rigidbody_constraint;
- /* update transformation matrix of the object so we don't get a frame of lag for simple animations */
+ /* Update transformation matrix of the object
+ * so we don't get a frame of lag for simple animations. */
BKE_object_where_is_calc_time(depsgraph, scene, ob, ctime);
/* TODO remove this whole block once we are sure we never get NULL rbo here anymore. */
/* This cannot be done in CoW evaluation context anymore... */
if (rbc == NULL) {
- BLI_assert(!"CoW object part of RBW constraints collection without RB constraint data, should not happen.\n");
+ BLI_assert(!"CoW object part of RBW constraints collection without RB constraint data, "
+ "should not happen.\n");
/* Since this object is included in the group but doesn't have
* constraint settings (perhaps it was added manually), add!
*/
@@ -1748,7 +1762,8 @@ void BKE_rigidbody_aftertrans_update(
}
RB_body_set_loc_rot(rbo->shared->physics_object, rbo->pos, rbo->orn);
}
- // RB_TODO update rigid body physics object's loc/rot for dynamic objects here as well (needs to be done outside bullet's update loop)
+ /* RB_TODO update rigid body physics object's loc/rot for dynamic objects here as well
+ * (needs to be done outside bullet's update loop). */
}
void BKE_rigidbody_cache_reset(RigidBodyWorld *rbw)
@@ -1773,7 +1788,8 @@ void BKE_rigidbody_rebuild_world(Depsgraph *depsgraph, Scene *scene, float ctime
BKE_ptcache_id_time(&pid, scene, ctime, &startframe, &endframe, NULL);
cache = rbw->shared->pointcache;
- /* flag cache as outdated if we don't have a world or number of objects in the simulation has changed */
+ /* Flag cache as outdated if we don't have a world or number of objects
+ * in the simulation has changed. */
int n = 0;
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (rbw->group, object) {
(void)object;
@@ -1854,7 +1870,8 @@ void BKE_rigidbody_do_simulation(Depsgraph *depsgraph, Scene *scene, float ctime
/* calculate how much time elapsed since last step in seconds */
timestep = 1.0f / (float)FPS * (ctime - rbw->ltime) * rbw->time_scale;
- /* step simulation by the requested timestep, steps per second are adjusted to take time scale into account */
+ /* Step simulation by the requested timestep,
+ * steps per second are adjusted to take time scale into account. */
RB_dworld_step_simulation(rbw->shared->physics_world,
timestep,
INT_MAX,
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 81b1375f0f6..d3c878918e3 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -225,8 +225,10 @@ void BKE_toolsettings_free(ToolSettings *toolsettings)
}
/**
- * Only copy internal data of Scene ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of Scene ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -412,7 +414,7 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
id_us_min(&sce_copy->id);
id_us_ensure_real(&sce_copy->id);
- /* Extra actions, most notably SCE_FULL_COPY also duplicates several 'children' datablocks... */
+ /* Extra actions, most notably SCE_FULL_COPY also duplicates several 'children' datablocks. */
if (type == SCE_COPY_FULL) {
/* Copy Freestyle LineStyle datablocks. */
@@ -767,7 +769,8 @@ void BKE_scene_init(Scene *sce)
BLI_rctf_init(&sce->r.safety, 0.1f, 0.9f, 0.1f, 0.9f);
sce->r.osa = 8;
- /* note; in header_info.c the scene copy happens..., if you add more to renderdata it has to be checked there */
+ /* Note; in header_info.c the scene copy happens...,
+ * if you add more to renderdata it has to be checked there. */
/* multiview - stereo */
BKE_scene_add_render_view(sce, STEREO_LEFT_NAME);
@@ -1006,7 +1009,8 @@ Object *BKE_scene_object_find_by_name(Scene *scene, const char *name)
}
/**
- * Sets the active scene, mainly used when running in background mode (``--scene`` command line argument).
+ * Sets the active scene, mainly used when running in background mode
+ * (``--scene`` command line argument).
* This is also called to set the scene directly, bypassing windowing code.
* Otherwise #WM_window_set_active_scene is used when changing scenes by the user.
*/
@@ -1031,7 +1035,8 @@ void BKE_scene_set_background(Main *bmain, Scene *scene)
BKE_scene_object_base_flag_sync_from_base(base);
}
}
- /* no full animation update, this to enable render code to work (render code calls own animation updates) */
+ /* No full animation update, this to enable render code to work
+ * (render code calls own animation updates). */
}
/* called from creator_args.c */
@@ -1048,7 +1053,8 @@ Scene *BKE_scene_set_name(Main *bmain, const char *name)
return NULL;
}
-/* Used by metaballs, return *all* objects (including duplis) existing in the scene (including scene's sets) */
+/* Used by metaballs, return *all* objects (including duplis)
+ * existing in the scene (including scene's sets). */
int BKE_scene_base_iter_next(
Depsgraph *depsgraph, SceneBaseIter *iter, Scene **scene, int val, Base **base, Object **ob)
{
@@ -1334,8 +1340,10 @@ bool BKE_scene_validate_setscene(Main *bmain, Scene *sce)
return true;
}
-/* This function is needed to cope with fractional frames - including two Blender rendering features
- * mblur (motion blur that renders 'subframes' and blurs them together), and fields rendering.
+/**
+ * This function is needed to cope with fractional frames - including two Blender rendering
+ * features mblur (motion blur that renders 'subframes' and blurs them together),
+ * and fields rendering.
*/
float BKE_scene_frame_get(const Scene *scene)
{
@@ -1585,8 +1593,8 @@ void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph, Main *bmain)
/** Ensures given scene/view_layer pair has a valid, up-to-date depsgraph.
*
- * \warning Sets matching depsgraph as active, so should only be called from the active editing context
- * (usually, from operators).
+ * \warning Sets matching depsgraph as active,
+ * so should only be called from the active editing context (usually, from operators).
*/
void BKE_scene_view_layer_graph_evaluated_ensure(Main *bmain, Scene *scene, ViewLayer *view_layer)
{
@@ -1836,8 +1844,9 @@ int BKE_render_preview_pixel_size(const RenderData *r)
return r->preview_pixel_size;
}
-/* Apply the needed correction factor to value, based on unit_type (only length-related are affected currently)
- * and unit->scale_length.
+/**
+ * Apply the needed correction factor to value, based on unit_type
+ * (only length-related are affected currently) and unit->scale_length.
*/
double BKE_scene_unit_scale(const UnitSettings *unit, const int unit_type, double value)
{
@@ -2298,7 +2307,8 @@ TransformOrientation *BKE_scene_transform_orientation_find(const Scene *scene, c
}
/**
- * \return the index that \a orientation has within \a scene's transform-orientation list or -1 if not found.
+ * \return the index that \a orientation has within \a scene's transform-orientation list
+ * or -1 if not found.
*/
int BKE_scene_transform_orientation_get_index(const Scene *scene,
const TransformOrientation *orientation)
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index a3ec3364436..9799f7c2943 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -308,7 +308,8 @@ void BKE_spacedata_draw_locks(int set)
}
/**
- * Version of #BKE_area_find_region_type that also works if \a slink is not the active space of \a sa.
+ * Version of #BKE_area_find_region_type that also works if \a slink
+ * is not the active space of \a sa.
*/
ARegion *BKE_spacedata_find_region_type(const SpaceLink *slink, const ScrArea *sa, int region_type)
{
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index aeb53ebf25e..68c2869b5d2 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -273,7 +273,8 @@ static void BKE_sequence_free_ex(Scene *scene,
* also invalidate cache for all dependent sequences
*
* be _very_ careful here, invalidating cache loops over the scene sequences and
- * assumes the listbase is valid for all strips, this may not be the case if lists are being freed.
+ * assumes the listbase is valid for all strips,
+ * this may not be the case if lists are being freed.
* this is optional BKE_sequence_invalidate_cache
*/
if (do_cache) {
@@ -3515,7 +3516,9 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context,
scene = seq->scene;
frame = (double)scene->r.sfra + (double)nr + (double)seq->anim_startofs;
- // have_seq = (scene->r.scemode & R_DOSEQ) && scene->ed && scene->ed->seqbase.first); /* UNUSED */
+#if 0 /* UNUSED */
+ have_seq = (scene->r.scemode & R_DOSEQ) && scene->ed && scene->ed->seqbase.first);
+#endif
have_comp = (scene->r.scemode & R_DOCOMP) && scene->use_nodes && scene->nodetree;
/* Get view layer for the strip. */
@@ -4723,8 +4726,8 @@ bool BKE_sequence_tx_test(Sequence *seq)
/**
* Return \a true if given \a seq needs a complete cleanup of its cache when it is transformed.
*
- * Some (effect) strip types need a complete recache of themselves when they are transformed, because
- * they do not 'contain' anything and do not have any explicit relations to other strips.
+ * Some (effect) strip types need a complete recache of themselves when they are transformed,
+ * because they do not 'contain' anything and do not have any explicit relations to other strips.
*/
bool BKE_sequence_tx_fullupdate_test(Sequence *seq)
{
@@ -5588,7 +5591,8 @@ Sequence *BKE_sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoad
/* basic defaults */
seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
- /* We add a very small negative offset here, because ceil(132.0) == 133.0, not nice with videos, see T47135. */
+ /* We add a very small negative offset here, because
+ * ceil(132.0) == 133.0, not nice with videos, see T47135. */
seq->len = (int)ceil((double)info.length * FPS - 1e-4);
strip->us = 1;
@@ -5846,9 +5850,9 @@ static Sequence *seq_dupli(const Scene *scene_src,
/* When using SEQ_DUPE_UNIQUE_NAME, it is mandatory to add new sequences in relevant container
* (scene or meta's one), *before* checking for unique names. Otherwise the meta's list is empty
* and hence we miss all seqs in that meta that have already been duplicated (see T55668).
- * Note that unique name check itslef could be done at a later step in calling code, once all seqs
- * have bee duplicated (that was first, simpler solution), but then handling of animation data will
- * be broken (see T60194). */
+ * Note that unique name check itslef could be done at a later step in calling code, once all
+ * seqs have bee duplicated (that was first, simpler solution), but then handling of animation
+ * data will be broken (see T60194). */
if (new_seq_list != NULL) {
BLI_addtail(new_seq_list, seqn);
}
@@ -6000,7 +6004,8 @@ int BKE_sequencer_find_next_prev_edit(Scene *scene,
int dist, best_dist, best_frame = cfra;
int seq_frames[2], seq_frames_tot;
- /* in case where both is passed, frame just finds the nearest end while frame_left the nearest start */
+ /* In case where both is passed,
+ * frame just finds the nearest end while frame_left the nearest start. */
best_dist = MAXFRAME * 2;
diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c
index 3cd2131c22b..8f31d581eef 100644
--- a/source/blender/blenkernel/intern/shrinkwrap.c
+++ b/source/blender/blenkernel/intern/shrinkwrap.c
@@ -375,8 +375,8 @@ static void shrinkwrap_calc_nearest_vertex_cb_ex(void *__restrict userdata,
/* Use local proximity heuristics (to reduce the nearest search)
*
- * If we already had an hit before.. we assume this vertex is going to have a close hit to that other vertex
- * so we can initiate the "nearest.dist" with the expected value to that last hit.
+ * If we already had an hit before.. we assume this vertex is going to have a close hit to that
+ * other vertex so we can initiate the "nearest.dist" with the expected value to that last hit.
* This will lead in pruning of the search tree. */
if (nearest->index != -1) {
nearest->dist_sq = len_squared_v3v3(tmp_co, nearest->co);
@@ -538,8 +538,9 @@ static void shrinkwrap_calc_normal_projection_cb_ex(void *__restrict userdata,
if (calc->vert != NULL && calc->smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL) {
/* calc->vert contains verts from evaluated mesh. */
- /* These coordinates are deformed by vertexCos only for normal projection (to get correct normals) */
- /* for other cases calc->verts contains undeformed coordinates and vertexCos should be used */
+ /* These coordinates are deformed by vertexCos only for normal projection
+ * (to get correct normals) for other cases calc->verts contains undeformed coordinates and
+ * vertexCos should be used */
copy_v3_v3(tmp_co, calc->vert[i].co);
normal_short_to_float_v3(tmp_no, calc->vert[i].no);
}
@@ -549,8 +550,9 @@ static void shrinkwrap_calc_normal_projection_cb_ex(void *__restrict userdata,
}
hit->index = -1;
- hit->dist =
- BVH_RAYCAST_DIST_MAX; /* TODO: we should use FLT_MAX here, but sweepsphere code isn't prepared for that */
+
+ /* TODO: we should use FLT_MAX here, but sweepsphere code isn't prepared for that */
+ hit->dist = BVH_RAYCAST_DIST_MAX;
bool is_aux = false;
@@ -938,7 +940,8 @@ static bool update_hit(BVHTreeNearest *nearest,
return false;
}
-/* Target projection on a non-manifold boundary edge - treats it like an infinitely thin cylinder. */
+/* Target projection on a non-manifold boundary edge -
+ * treats it like an infinitely thin cylinder. */
static void target_project_edge(const ShrinkwrapTreeData *tree,
int index,
const float co[3],
@@ -1142,8 +1145,8 @@ static void shrinkwrap_calc_nearest_surface_point_cb_ex(void *__restrict userdat
/* Use local proximity heuristics (to reduce the nearest search)
*
- * If we already had an hit before.. we assume this vertex is going to have a close hit to that other vertex
- * so we can initiate the "nearest.dist" with the expected value to that last hit.
+ * If we already had an hit before.. we assume this vertex is going to have a close hit to that
+ * other vertex so we can initiate the "nearest.dist" with the expected value to that last hit.
* This will lead in pruning of the search tree. */
if (nearest->index != -1) {
if (calc->smd->shrinkType == MOD_SHRINKWRAP_TARGET_PROJECT) {
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index a815aaefb29..4e728936e2b 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -119,7 +119,7 @@ struct WTURBULENCE *smoke_turbulence_init(int *UNUSED(res),
{
return NULL;
}
-//struct FLUID_3D *smoke_init(int *UNUSED(res), float *UNUSED(dx), float *UNUSED(dtdef), int UNUSED(use_heat), int UNUSED(use_fire), int UNUSED(use_colors)) { return NULL; }
+
void smoke_free(struct FLUID_3D *UNUSED(fluid))
{
}
@@ -914,7 +914,8 @@ static void obstacles_from_mesh(Object *coll_ob,
// DG TODO
// if (scs->type > SM_COLL_STATIC)
- // if line above is used, the code is in trouble if the object moves but is declared as "does not move"
+ // if line above is used, the code is in trouble if the object moves
+ // but is declared as "does not move".
{
vert_vel = MEM_callocN(sizeof(float) * numverts * 3, "smoke_obs_velocity");
@@ -1680,7 +1681,8 @@ static void sample_mesh(SmokeFlowSettings *sfs,
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 doesn't 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;
@@ -2734,7 +2736,8 @@ static void update_flowsfluids(
/* loop through high res blocks if high res enabled */
if (bigdensity) {
- // neighbor cell emission densities (for high resolution smoke smooth interpolation)
+ /* Neighbor cell emission densities
+ * (for high resolution smoke smooth interpolation). */
float c000, c001, c010, c011, c100, c101, c110, c111;
smoke_turbulence_get_res(sds->wt, bigres);
@@ -3034,12 +3037,9 @@ static void step(Depsgraph *depsgraph,
update_obstacles(depsgraph, ob, sds, dtSubdiv, substep, totalSubsteps);
if (sds->total_cells > 1) {
- update_effectors(
- depsgraph,
- scene,
- ob,
- sds,
- dtSubdiv); // DG TODO? problem --> uses forces instead of velocity, need to check how they need to be changed with variable dt
+ // DG TODO? problem --> uses forces instead of velocity,
+ // need to check how they need to be changed with variable dt.
+ update_effectors(depsgraph, scene, ob, sds, dtSubdiv);
smoke_step(sds->fluid, gravity, dtSubdiv);
}
}
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 6903021e0cf..a327c3b6074 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -190,8 +190,8 @@ static float sb_time_scale(Object *ob)
/* hrms .. this could be IPO as well :)
* estimated range [0.001 sluggish slug - 100.0 very fast (i hope ODE solver can handle that)]
* 1 approx = a unit 1 pendulum at g = 9.8 [earth conditions] has period 65 frames
- * theory would give a 50 frames period .. so there must be something inaccurate .. looking for that (BM)
- */
+ * theory would give a 50 frames period .. so there must be something inaccurate ..
+ * looking for that (BM). */
}
return (1.0f);
/*
@@ -1528,8 +1528,10 @@ static void sb_sfesf_threads_run(struct Depsgraph *depsgraph,
ListBase threads;
SB_thread_context *sb_threads;
int i, totthread, left, dec;
- int lowsprings =
- 100; /* wild guess .. may increase with better thread management 'above' or even be UI option sb->spawn_cf_threads_nopts */
+
+ /* wild guess .. may increase with better thread management 'above'
+ * or even be UI option sb->spawn_cf_threads_nopts */
+ int lowsprings = 100;
ListBase *effectors = BKE_effectors_create(depsgraph, ob, NULL, ob->soft->effector_weights);
@@ -1823,7 +1825,10 @@ static int sb_deflect_face(Object *ob,
copy_v3_v3(s_actpos, actpos);
deflected = sb_detect_vertex_collisionCached(
s_actpos, facenormal, cf, force, ob, time, vel, intrusion);
- //deflected= sb_detect_vertex_collisionCachedEx(s_actpos, facenormal, cf, force, ob, time, vel, intrusion);
+#if 0
+ deflected = sb_detect_vertex_collisionCachedEx(
+ s_actpos, facenormal, cf, force, ob, time, vel, intrusion);
+#endif
return (deflected);
}
@@ -2006,7 +2011,8 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene,
float compare;
float bstune = sb->ballstiff;
- /* running in a slice we must not assume anything done with obp neither alter the data of obp */
+ /* Running in a slice we must not assume anything done with obp
+ * neither alter the data of obp. */
for (c = sb->totpoint, obp = sb->bpoint; c > 0; c--, obp++) {
compare = (obp->colball + bp->colball);
sub_v3_v3v3(def, bp->pos, obp->pos);
@@ -2196,8 +2202,10 @@ static void sb_cf_threads_run(Scene *scene,
ListBase threads;
SB_thread_context *sb_threads;
int i, totthread, left, dec;
- int lowpoints =
- 100; /* wild guess .. may increase with better thread management 'above' or even be UI option sb->spawn_cf_threads_nopts */
+
+ /* wild guess .. may increase with better thread management 'above'
+ * or even be UI option sb->spawn_cf_threads_nopts. */
+ int lowpoints = 100;
/* figure the number of threads while preventing pretty pointless threading overhead */
totthread = BKE_scene_num_threads(scene);
@@ -2266,7 +2274,9 @@ static void softbody_calc_forces(
/* check conditions for various options */
do_deflector = query_external_colliders(depsgraph, sb->collision_group);
- /* do_selfcollision=((ob->softflag & OB_SB_EDGES) && (sb->bspring)&& (ob->softflag & OB_SB_SELF)); */ /* UNUSED */
+#if 0
+ do_selfcollision=((ob->softflag & OB_SB_EDGES) && (sb->bspring)&& (ob->softflag & OB_SB_SELF));
+#endif
do_springcollision = do_deflector && (ob->softflag & OB_SB_EDGES) &&
(ob->softflag & OB_SB_EDGECOLL);
do_aero = ((sb->aeroedge) && (ob->softflag & OB_SB_EDGES));
@@ -2333,7 +2343,7 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
#endif
for (a = sb->totpoint, bp = sb->bpoint; a > 0; a--, bp++) {
- /* now we have individual masses */
+ /* Now we have individual masses. */
/* claim a minimum mass for vertex */
if (_final_mass(ob, bp) > 0.009999f) {
timeovermass = forcetime / _final_mass(ob, bp);
@@ -2348,10 +2358,20 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
copy_v3_v3(dx, bp->vec);
}
- /* so here is (v)' = a(cceleration) = sum(F_springs)/m + gravitation + some friction forces + more forces*/
- /* the ( ... )' operator denotes derivate respective time */
- /* the euler step for velocity then becomes */
- /* v(t + dt) = v(t) + a(t) * dt */
+ /**
+ * So here is:
+ * <pre>
+ * (v)' = a(cceleration) =
+ * sum(F_springs)/m + gravitation + some friction forces + more forces.
+ * </pre>
+ *
+ * The ( ... )' operator denotes derivate respective time.
+ *
+ * The euler step for velocity then becomes:
+ * <pre>
+ * v(t + dt) = v(t) + a(t) * dt
+ * </pre>
+ */
mul_v3_fl(bp->force, timeovermass); /* individual mass of node here */
/* some nasty if's to have heun in here too */
copy_v3_v3(dv, bp->force);
@@ -2970,10 +2990,15 @@ static void curve_surf_to_softbody(Scene *scene, Object *ob)
for (nu = cu->nurb.first; nu; nu = nu->next) {
if (nu->bezt) {
- /* bezier case ; this is nicly said naive; who ever wrote this part, it was not me (JOW) :) */
- /* a: never ever make tangent handles (sub) and or (ob)ject to collision */
- /* b: rather calculate them using some C2 (C2= continuous in second derivate -> no jump in bending ) condition */
- /* not too hard to do, but needs some more code to care for; some one may want look at it JOW 2010/06/12*/
+ /* Bezier case; this is nicly said naive; who ever wrote this part,
+ * it was not me (JOW) :).
+ *
+ * a: never ever make tangent handles (sub) and or (ob)ject to collision.
+ * b: rather calculate them using some C2
+ * (C2= continuous in second derivate -> no jump in bending ) condition.
+ *
+ * Not too hard to do, but needs some more code to care for;
+ * some one may want look at it JOW 2010/06/12. */
for (bezt = nu->bezt, a = 0; a < nu->pntsu; a++, bezt++, bp += 3, curindex += 3) {
if (setgoal) {
bp->goal *= bezt->weight;
@@ -3213,10 +3238,9 @@ static void softbody_update_positions(Object *ob,
* 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 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.
+ * 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.
* should be pretty useful for pythoneers :)
* not! velocity .. 2nd order stuff
* vcloud_estimate_transform_v3 see
@@ -3407,7 +3431,8 @@ static void softbody_step(
float newtime = forcetime * 1.1f; /* hope for 1.1 times better conditions in next step */
if (sb->scratch->flag & SBF_DOFUZZY) {
- //if (err > SoftHeunTol/(2.0f*sb->fuzzyness)) { /* stay with this stepsize unless err really small */
+ ///* stay with this stepsize unless err really small */
+ //if (err > SoftHeunTol/(2.0f*sb->fuzzyness)) {
newtime = forcetime;
//}
}
@@ -3591,9 +3616,9 @@ void sbObjectStep(struct Depsgraph *depsgraph,
else if (cache_result == PTCACHE_READ_OLD) {
/* pass */
}
- else if (/*ob->id.lib || */ (
- cache->flag &
- PTCACHE_BAKED)) { /* "library linking & pointcaches" has to be solved properly at some point */
+ else if (/*ob->id.lib || */
+ /* "library linking & pointcaches" has to be solved properly at some point */
+ (cache->flag & PTCACHE_BAKED)) {
/* if baked and nothing in cache, do nothing */
if (can_write_cache) {
BKE_ptcache_invalidate(cache);
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 857d59d9e5c..afeaffde92b 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -148,8 +148,10 @@ void BKE_sound_free(bSound *sound)
}
/**
- * Only copy internal data of Sound ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of Sound ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c
index 8565fde4565..c7a0d65a2a9 100644
--- a/source/blender/blenkernel/intern/speaker.c
+++ b/source/blender/blenkernel/intern/speaker.c
@@ -60,8 +60,10 @@ void *BKE_speaker_add(Main *bmain, const char *name)
}
/**
- * Only copy internal data of Speaker ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of Speaker ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c
index 315bd0cabc9..9888c5d165e 100644
--- a/source/blender/blenkernel/intern/studiolight.c
+++ b/source/blender/blenkernel/intern/studiolight.c
@@ -1283,7 +1283,8 @@ void BKE_studiolight_init(void)
BLI_addtail(&studiolights, sl);
/* go over the preset folder and add a studiolight for every image with its path */
- /* for portable installs (where USER and SYSTEM paths are the same), only go over LOCAL datafiles once */
+ /* for portable installs (where USER and SYSTEM paths are the same),
+ * only go over LOCAL datafiles once */
/* Also reserve icon space for it. */
if (!BKE_appdir_app_is_portable_install()) {
studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES,
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index a58d1eaff3e..ceb501c5a99 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -305,8 +305,8 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm,
limit[0] = limit[1] = STD_UV_CONNECT_LIMIT;
/* previous behavior here is without accounting for winding, however this causes stretching in
- * UV map in really simple cases with mirror + subsurf, see second part of T44530. Also, initially
- * intention is to treat merged vertices from mirror modifier as seams.
+ * UV map in really simple cases with mirror + subsurf, see second part of T44530.
+ * Also, initially intention is to treat merged vertices from mirror modifier as seams.
* This fixes a very old regression (2.49 was correct here) */
vmap = BKE_mesh_uv_vert_map_create(mpoly, mloop, mloopuv, totface, totvert, limit, false, true);
if (!vmap) {
@@ -1729,8 +1729,8 @@ static void ccgDM_foreachMappedLoop(DerivedMesh *dm,
void *userData,
DMForeachFlag flag)
{
- /* We can't use dm->getLoopDataLayout(dm) here, we want to always access dm->loopData, EditDerivedBMesh would
- * return loop data from bmesh itself. */
+ /* We can't use dm->getLoopDataLayout(dm) here, we want to always access dm->loopData,
+ * EditDerivedBMesh would return loop data from bmesh itself. */
const float(*lnors)[3] = (flag & DM_FOREACH_USE_NORMAL) ? DM_get_loop_data_layer(dm, CD_NORMAL) :
NULL;
@@ -1978,10 +1978,9 @@ static void *ccgDM_get_tessface_data_layer(DerivedMesh *dm, int type)
if (type == CD_TESSLOOPNORMAL) {
/* Create tessloopnormal on demand to save memory. */
- /* Note that since tessellated face corners are the same a loops in CCGDM, and since all faces have four
- * loops/corners, we can simplify the code here by converting tessloopnormals from 'short (*)[4][3]'
- * to 'short (*)[3]'.
- */
+ /* Note that since tessellated face corners are the same a loops in CCGDM,
+ * and since all faces have four loops/corners, we can simplify the code
+ * here by converting tessloopnormals from 'short (*)[4][3]' to 'short (*)[3]'. */
short(*tlnors)[3];
/* Avoid re-creation if the layer exists already */
@@ -2000,7 +1999,8 @@ static void *ccgDM_get_tessface_data_layer(DerivedMesh *dm, int type)
DM_add_tessface_layer(dm, CD_TESSLOOPNORMAL, CD_CALLOC, NULL);
tlnors = tlnors_it = (short(*)[3])DM_get_tessface_data_layer(dm, CD_TESSLOOPNORMAL);
- /* With ccgdm, we have a simple one to one mapping between loops and tessellated face corners. */
+ /* With ccgdm, we have a simple one to one mapping between loops
+ * and tessellated face corners. */
for (i = 0; i < numLoops; ++i, ++tlnors_it, ++lnors) {
normal_float_to_short_v3(*tlnors_it, *lnors);
}
@@ -2255,8 +2255,8 @@ static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm)
bool grid_pbvh = ccgDM_use_grid_pbvh(ccgdm);
if ((ob->mode & OB_MODE_SCULPT) == 0) {
/* In vwpaint, we may use a grid_pbvh for multires/subsurf, under certain conditions.
- * More complex cases break 'history' trail back to original vertices, in that case we fall back to
- * deformed cage only (i.e. original deformed mesh). */
+ * More complex cases break 'history' trail back to original vertices,
+ * in that case we fall back to deformed cage only (i.e. original deformed mesh). */
VirtualModifierData virtualModifierData;
ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData);
@@ -2294,8 +2294,8 @@ static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm)
}
if (ob->sculpt->pbvh) {
- /* Note that we have to clean up exisitng pbvh instead of updating it in case it does not match current
- * grid_pbvh status. */
+ /* Note that we have to clean up exisitng pbvh instead of updating it in case it does not
+ * match current grid_pbvh status. */
const PBVHType pbvh_type = BKE_pbvh_type(ob->sculpt->pbvh);
if (grid_pbvh) {
if (pbvh_type == PBVH_GRIDS) {
@@ -2438,7 +2438,8 @@ static void set_default_ccgdm_callbacks(CCGDerivedMesh *ccgdm)
ccgdm->dm.getNumVerts = ccgDM_getNumVerts;
ccgdm->dm.getNumEdges = ccgDM_getNumEdges;
ccgdm->dm.getNumLoops = ccgDM_getNumLoops;
- /* reuse of ccgDM_getNumTessFaces is intentional here: subsurf polys are just created from tessfaces */
+ /* reuse of ccgDM_getNumTessFaces is intentional here:
+ * subsurf polys are just created from tessfaces */
ccgdm->dm.getNumPolys = ccgDM_getNumPolys;
ccgdm->dm.getNumTessFaces = ccgDM_getNumTessFaces;
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 9047aa51dea..fef8c81980b 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -464,8 +464,10 @@ Text *BKE_text_load(Main *bmain, const char *file, const char *relpath)
}
/**
- * Only copy internal data of Text ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of Text ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
@@ -2004,7 +2006,7 @@ static void txt_undo_add_unprefix_op(Text *text,
BLI_assert(BLI_listbase_count(line_index_mask) == line_index_mask_len);
- /* OP byte + UInt32 count + counted UInt32 line numbers + UInt32 count + 12-bytes selection + OP byte */
+ /* OP byte + u32 count + counted u32 line numbers + u32 count + 12-bytes selection + OP byte. */
if (!max_undo_test(utxt, 2 + 4 + (line_index_mask_len * 4) + 4 + 12 + 1)) {
return;
}
@@ -3331,7 +3333,8 @@ int text_check_bracket(const char ch)
return 0;
}
-/* TODO, have a function for operators - http://docs.python.org/py3k/reference/lexical_analysis.html#operators */
+/* TODO, have a function for operators -
+ * http://docs.python.org/py3k/reference/lexical_analysis.html#operators */
bool text_check_delim(const char ch)
{
int a;
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index dd307880eb6..9baa8bd20e1 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -214,7 +214,8 @@ void BKE_texture_free(Tex *tex)
void BKE_texture_default(Tex *tex)
{
- /* BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(tex, id)); */ /* Not here, can be called with some pointers set. :/ */
+ /* Not here, can be called with some pointers set. :/ */
+ /* BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(tex, id)); */
tex->type = TEX_IMAGE;
tex->ima = NULL;
@@ -411,8 +412,10 @@ MTex *BKE_texture_mtex_add_id(ID *id, int slot)
/* ------------------------------------------------------------------------- */
/**
- * Only copy internal data of Texture ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of Texture ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 73f50be612e..a5445be7ce5 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -209,7 +209,8 @@ static void tracking_tracks_copy(ListBase *tracks_dst,
}
}
-/* copy the whole list of plane tracks (need whole MovieTracking structures due to embedded pointers to tracks).
+/* Copy the whole list of plane tracks
+ * (need whole MovieTracking structures due to embedded pointers to tracks).
* WARNING: implies tracking_[dst/src] and their tracks have already been copied. */
static void tracking_plane_tracks_copy(ListBase *plane_tracks_list_dst,
const ListBase *plane_tracks_list_src,
@@ -321,7 +322,8 @@ void BKE_tracking_copy(MovieTracking *tracking_dst,
/* Warning! Will override tracks_mapping. */
tracking_objects_copy(&tracking_dst->objects, &tracking_src->objects, tracks_mapping, flag);
- /* Those remaining are runtime data, they will be reconstructed as needed, do not bother copying them. */
+ /* Those remaining are runtime data, they will be reconstructed as needed,
+ * do not bother copying them. */
tracking_dst->dopesheet.ok = false;
BLI_listbase_clear(&tracking_dst->dopesheet.channels);
BLI_listbase_clear(&tracking_dst->dopesheet.coverage_segments);
@@ -2093,7 +2095,8 @@ static void reconstructed_camera_scale_set(MovieTrackingObject *object, float ma
void BKE_tracking_camera_shift_get(
MovieTracking *tracking, int winx, int winy, float *shiftx, float *shifty)
{
- /* indeed in both of cases it should be winx -- it's just how camera shift works for blender's camera */
+ /* Indeed in both of cases it should be winx -
+ * it's just how camera shift works for blender's camera. */
*shiftx = (0.5f * winx - tracking->camera.principal[0]) / winx;
*shifty = (0.5f * winy - tracking->camera.principal[1]) / winx;
}
diff --git a/source/blender/blenkernel/intern/tracking_region_tracker.c b/source/blender/blenkernel/intern/tracking_region_tracker.c
index 0d2113aebe8..1d6bb88c3f4 100644
--- a/source/blender/blenkernel/intern/tracking_region_tracker.c
+++ b/source/blender/blenkernel/intern/tracking_region_tracker.c
@@ -252,7 +252,8 @@ static bool configure_and_run_tracker(ImBuf *destination_ibuf,
/* configure the tracker */
tracking_configure_tracker(track, mask, &options);
- /* convert the marker corners and center into pixel coordinates in the search/destination images. */
+ /* Convert the marker corners and center into pixel coordinates in the
+ * search/destination images. */
tracking_get_marker_coords_for_tracking(
frame_width, frame_height, reference_marker, src_pixel_x, src_pixel_y);
tracking_get_marker_coords_for_tracking(
diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c
index d32bc7c6054..d3e0ff56977 100644
--- a/source/blender/blenkernel/intern/undo_system.c
+++ b/source/blender/blenkernel/intern/undo_system.c
@@ -135,7 +135,8 @@ static void undosys_id_ref_store(void *UNUSED(user_data), UndoRefID *id_ref)
static void undosys_id_ref_resolve(void *user_data, UndoRefID *id_ref)
{
- /* Note: we could optimize this, for now it's not too bad since it only runs when we access undo! */
+ /* Note: we could optimize this,
+ * for now it's not too bad since it only runs when we access undo! */
Main *bmain = user_data;
ListBase *lb = which_libbase(bmain, GS(id_ref->name));
for (ID *id = lb->first; id; id = id->next) {
@@ -154,7 +155,8 @@ static bool undosys_step_encode(bContext *C, Main *bmain, UndoStack *ustack, Und
UNDO_NESTED_CHECK_END;
if (ok) {
if (us->type->step_foreach_ID_ref != NULL) {
- /* Don't use from context yet because sometimes context is fake and not all members are filled in. */
+ /* Don't use from context yet because sometimes context is fake and
+ * not all members are filled in. */
us->type->step_foreach_ID_ref(us, undosys_id_ref_store, bmain);
}
#ifdef WITH_GLOBAL_UNDO_CORRECT_ORDER
@@ -193,7 +195,8 @@ static void undosys_step_decode(bContext *C, Main *bmain, UndoStack *ustack, Und
}
}
#endif
- /* Don't use from context yet because sometimes context is fake and not all members are filled in. */
+ /* Don't use from context yet because sometimes context is fake and
+ * not all members are filled in. */
us->type->step_foreach_ID_ref(us, undosys_id_ref_resolve, bmain);
}
@@ -429,7 +432,8 @@ void BKE_undosys_stack_limit_steps_and_memory(UndoStack *ustack, int steps, size
}
}
#endif
- /* Free from first to last, free functions may update de-duplication info (see #MemFileUndoStep). */
+ /* Free from first to last, free functions may update de-duplication info
+ * (see #MemFileUndoStep). */
undosys_stack_clear_all_first(ustack, us->prev);
#ifdef WITH_GLOBAL_UNDO_KEEP_ONE
diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c
index 2e9591a99c7..f9584adc6e0 100644
--- a/source/blender/blenkernel/intern/workspace.c
+++ b/source/blender/blenkernel/intern/workspace.c
@@ -113,8 +113,9 @@ static void *workspace_relation_get_data_matching_parent(const ListBase *relatio
}
/**
- * Checks if \a screen is already used within any workspace. A screen should never be assigned to multiple
- * WorkSpaceLayouts, but that should be ensured outside of the BKE_workspace module and without such checks.
+ * Checks if \a screen is already used within any workspace. A screen should never be assigned to
+ * multiple WorkSpaceLayouts, but that should be ensured outside of the BKE_workspace module
+ * and without such checks.
* Hence, this should only be used as assert check before assigining a screen to a workspace.
*/
#ifndef NDEBUG
@@ -143,8 +144,9 @@ WorkSpace *BKE_workspace_add(Main *bmain, const char *name)
}
/**
- * The function that actually frees the workspace data (not workspace itself). It shouldn't be called
- * directly, instead #BKE_workspace_remove should be, which calls this through #BKE_id_free then.
+ * The function that actually frees the workspace data (not workspace itself).
+ * It shouldn't be called directly, instead #BKE_workspace_remove should be,
+ * which calls this through #BKE_id_free then.
*
* Should something like a bke_internal.h be added, this should go there!
*/
@@ -275,7 +277,8 @@ WorkSpaceLayout *BKE_workspace_layout_find(const WorkSpace *workspace, const bSc
* Find the layout for \a screen without knowing which workspace to look in.
* Can also be used to find the workspace that contains \a screen.
*
- * \param r_workspace: Optionally return the workspace that contains the looked up layout (if found).
+ * \param r_workspace: Optionally return the workspace that contains the
+ * looked up layout (if found).
*/
WorkSpaceLayout *BKE_workspace_layout_find_global(const Main *bmain,
const bScreen *screen,
@@ -303,7 +306,8 @@ WorkSpaceLayout *BKE_workspace_layout_find_global(const Main *bmain,
/**
* Circular workspace layout iterator.
*
- * \param callback: Custom function which gets executed for each layout. Can return false to stop iterating.
+ * \param callback: Custom function which gets executed for each layout.
+ * Can return false to stop iterating.
* \param arg: Custom data passed to each \a callback call.
*
* \return the layout at which \a callback returned false.
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index 741d67296df..109d615ae83 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -95,8 +95,10 @@ World *BKE_world_add(Main *bmain, const char *name)
}
/**
- * Only copy internal data of World ID from source to already allocated/initialized destination.
- * You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
+ * Only copy internal data of World ID from source
+ * to already allocated/initialized destination.
+ * You probably never want to use that directly,
+ * use #BKE_id_copy or #BKE_id_copy_ex for typical needs.
*
* WARNING! This function will not handle ID user count!
*
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 8456a2cddfc..0f9dcc2efe2 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -792,10 +792,11 @@ static AVStream *alloc_audio_stream(FFMpegContext *context,
}
if (codec->sample_fmts) {
- /* check if the preferred sample format for this codec is supported.
- * this is because, depending on the version of libav, and with the whole ffmpeg/libav fork situation,
- * you have various implementations around. float samples in particular are not always supported.
- */
+ /* Check if the preferred sample format for this codec is supported.
+ * this is because, depending on the version of libav,
+ * and with the whole ffmpeg/libav fork situation,
+ * you have various implementations around.
+ * Float samples in particular are not always supported. */
const enum AVSampleFormat *p = codec->sample_fmts;
for (; *p != -1; p++) {
if (*p == st->codec->sample_fmt) {
@@ -1636,7 +1637,9 @@ static void ffmpeg_set_expert_options(RenderData *rd)
* The other options were taken from the libx264-default.preset
* included in the ffmpeg distribution.
*/
- // ffmpeg_property_add_string(rd, "video", "flags:loop"); // this breaks compatibility for QT
+
+ /* This breaks compatibility for QT. */
+ // BKE_ffmpeg_property_add_string(rd, "video", "flags:loop");
BKE_ffmpeg_property_add_string(rd, "video", "cmp:chroma");
BKE_ffmpeg_property_add_string(rd, "video", "partitions:parti4x4"); // Deprecated.
BKE_ffmpeg_property_add_string(rd, "video", "partitions:partp8x8"); // Deprecated.
diff --git a/source/blender/blenkernel/nla_private.h b/source/blender/blenkernel/nla_private.h
index 59c9b4e7d33..dc086987e21 100644
--- a/source/blender/blenkernel/nla_private.h
+++ b/source/blender/blenkernel/nla_private.h
@@ -163,7 +163,8 @@ typedef struct NlaKeyframingContext {
float nlastrip_get_frame(NlaStrip *strip, float cframe, short mode);
/* --------------- NLA Evaluation (very-private stuff) ----------------------- */
-/* these functions are only defined here to avoid problems with the order in which they get defined... */
+/* these functions are only defined here to avoid problems with the order
+ * in which they get defined. */
NlaEvalStrip *nlastrips_ctime_get_strip(
struct Depsgraph *depsgraph, ListBase *list, ListBase *strips, short index, float ctime);