[Bf-blender-cvs] [0105f146bb4] master: Cleanup: General comment style clean up of graph_edit.c and fcurve.c
Sebastian Parborg
noreply at git.blender.org
Tue Oct 20 13:04:07 CEST 2020
Commit: 0105f146bb40bd609ccbda3d3f6aeb8e14ad3f9e
Author: Sebastian Parborg
Date: Tue Oct 20 12:34:04 2020 +0200
Branches: master
https://developer.blender.org/rB0105f146bb40bd609ccbda3d3f6aeb8e14ad3f9e
Cleanup: General comment style clean up of graph_edit.c and fcurve.c
No functional changes.
Reviewed By: Sybren A. Stüvel
Differential Revision: http://developer.blender.org/D7850
===================================================================
M source/blender/blenkernel/intern/fcurve.c
M source/blender/editors/space_graph/graph_edit.c
===================================================================
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 2287170c29d..fafcbaec10f 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -82,41 +82,41 @@ void BKE_fcurve_free(FCurve *fcu)
return;
}
- /* free curve data */
+ /* Free curve data. */
MEM_SAFE_FREE(fcu->bezt);
MEM_SAFE_FREE(fcu->fpt);
- /* free RNA-path, as this were allocated when getting the path string */
+ /* Free RNA-path, as this were allocated when getting the path string. */
MEM_SAFE_FREE(fcu->rna_path);
- /* free extra data - i.e. modifiers, and driver */
+ /* Free extra data - i.e. modifiers, and driver. */
fcurve_free_driver(fcu);
free_fmodifiers(&fcu->modifiers);
- /* free f-curve itself */
+ /* Free the f-curve itself. */
MEM_freeN(fcu);
}
-/* Frees a list of F-Curves */
+/* Frees a list of F-Curves. */
void BKE_fcurves_free(ListBase *list)
{
FCurve *fcu, *fcn;
- /* sanity check */
+ /* Sanity check. */
if (list == NULL) {
return;
}
- /* free data - no need to call remlink before freeing each curve,
+ /* Free data - no need to call remlink before freeing each curve,
* as we store reference to next, and freeing only touches the curve
- * it's given
+ * it's given.
*/
for (fcu = list->first; fcu; fcu = fcn) {
fcn = fcu->next;
BKE_fcurve_free(fcu);
}
- /* clear pointers just in case */
+ /* Clear pointers just in case. */
BLI_listbase_clear(list);
}
@@ -126,53 +126,53 @@ void BKE_fcurves_free(ListBase *list)
/** \name F-Curve Data Copy
* \{ */
-/* duplicate an F-Curve */
+/* Duplicate a F-Curve. */
FCurve *BKE_fcurve_copy(const FCurve *fcu)
{
FCurve *fcu_d;
- /* sanity check */
+ /* Sanity check. */
if (fcu == NULL) {
return NULL;
}
- /* make a copy */
+ /* Make a copy. */
fcu_d = MEM_dupallocN(fcu);
fcu_d->next = fcu_d->prev = NULL;
fcu_d->grp = NULL;
- /* copy curve data */
+ /* Copy curve data. */
fcu_d->bezt = MEM_dupallocN(fcu_d->bezt);
fcu_d->fpt = MEM_dupallocN(fcu_d->fpt);
- /* copy rna-path */
+ /* Copy rna-path. */
fcu_d->rna_path = MEM_dupallocN(fcu_d->rna_path);
- /* copy driver */
+ /* Copy driver. */
fcu_d->driver = fcurve_copy_driver(fcu_d->driver);
- /* copy modifiers */
+ /* Copy modifiers. */
copy_fmodifiers(&fcu_d->modifiers, &fcu->modifiers);
- /* return new data */
+ /* Return new data. */
return fcu_d;
}
-/* duplicate a list of F-Curves */
+/* Duplicate a list of F-Curves. */
void BKE_fcurves_copy(ListBase *dst, ListBase *src)
{
FCurve *dfcu, *sfcu;
- /* sanity checks */
+ /* Sanity checks. */
if (ELEM(NULL, dst, src)) {
return;
}
- /* clear destination list first */
+ /* Clear destination list first. */
BLI_listbase_clear(dst);
- /* copy one-by-one */
+ /* Copy one-by-one. */
for (sfcu = src->first; sfcu; sfcu = sfcu->next) {
dfcu = BKE_fcurve_copy(sfcu);
BLI_addtail(dst, dfcu);
@@ -213,15 +213,15 @@ void BKE_fcurve_foreach_id(FCurve *fcu, LibraryForeachIDData *data)
/* ----------------- Finding F-Curves -------------------------- */
-/* high level function to get an fcurve from C without having the rna */
+/* High level function to get an fcurve from C without having the RNA. */
FCurve *id_data_find_fcurve(
ID *id, void *data, StructRNA *type, const char *prop_name, int index, bool *r_driven)
{
- /* anim vars */
+ /* Anim vars */
AnimData *adt = BKE_animdata_from_id(id);
FCurve *fcu = NULL;
- /* rna vars */
+ /* Rna vars */
PointerRNA ptr;
PropertyRNA *prop;
char *path;
@@ -230,7 +230,7 @@ FCurve *id_data_find_fcurve(
*r_driven = false;
}
- /* only use the current action ??? */
+ /* Only use the current action ??? */
if (ELEM(NULL, adt, adt->action)) {
return NULL;
}
@@ -246,12 +246,12 @@ FCurve *id_data_find_fcurve(
return NULL;
}
- /* animation takes priority over drivers */
+ /* Animation takes priority over drivers. */
if (adt->action && adt->action->curves.first) {
fcu = BKE_fcurve_find(&adt->action->curves, path, index);
}
- /* if not animated, check if driven */
+ /* If not animated, check if driven. */
if (fcu == NULL && adt->drivers.first) {
fcu = BKE_fcurve_find(&adt->drivers, path, index);
if (fcu && r_driven) {
@@ -271,45 +271,43 @@ FCurve *BKE_fcurve_find(ListBase *list, const char rna_path[], const int array_i
{
FCurve *fcu;
- /* sanity checks */
+ /* Sanity checks. */
if (ELEM(NULL, list, rna_path) || (array_index < 0)) {
return NULL;
}
- /* check paths of curves, then array indices... */
+ /* Check paths of curves, then array indices... */
for (fcu = list->first; fcu; fcu = fcu->next) {
- /* simple string-compare (this assumes that they have the same root...) */
+ /* Simple string-compare (this assumes that they have the same root...) */
if (fcu->rna_path && STREQ(fcu->rna_path, rna_path)) {
- /* now check indices */
+ /* Now check indices. */
if (fcu->array_index == array_index) {
return fcu;
}
}
}
- /* return */
return NULL;
}
-/* quick way to loop over all fcurves of a given 'path' */
+/* Quick way to loop over all fcurves of a given 'path'. */
FCurve *BKE_fcurve_iter_step(FCurve *fcu_iter, const char rna_path[])
{
FCurve *fcu;
- /* sanity checks */
+ /* Sanity checks. */
if (ELEM(NULL, fcu_iter, rna_path)) {
return NULL;
}
- /* check paths of curves, then array indices... */
+ /* Check paths of curves, then array indices... */
for (fcu = fcu_iter; fcu; fcu = fcu->next) {
- /* simple string-compare (this assumes that they have the same root...) */
+ /* Simple string-compare (this assumes that they have the same root...) */
if (fcu->rna_path && STREQ(fcu->rna_path, rna_path)) {
return fcu;
}
}
- /* return */
return NULL;
}
@@ -330,7 +328,7 @@ int BKE_fcurves_filter(ListBase *dst, ListBase *src, const char *dataPrefix, con
FCurve *fcu;
int matches = 0;
- /* sanity checks */
+ /* Sanity checks. */
if (ELEM(NULL, dst, src, dataPrefix, dataName)) {
return 0;
}
@@ -338,9 +336,9 @@ int BKE_fcurves_filter(ListBase *dst, ListBase *src, const char *dataPrefix, con
return 0;
}
- /* search each F-Curve one by one */
+ /* Search each F-Curve one by one. */
for (fcu = src->first; fcu; fcu = fcu->next) {
- /* check if quoted string matches the path */
+ /* Check if quoted string matches the path. */
if (fcu->rna_path == NULL || !strstr(fcu->rna_path, dataPrefix)) {
continue;
}
@@ -350,7 +348,7 @@ int BKE_fcurves_filter(ListBase *dst, ListBase *src, const char *dataPrefix, con
continue;
}
- /* check if the quoted name matches the required name */
+ /* Check if the quoted name matches the required name. */
if (STREQ(quotedName, dataName)) {
LinkData *ld = MEM_callocN(sizeof(LinkData), __func__);
@@ -360,10 +358,10 @@ int BKE_fcurves_filter(ListBase *dst, ListBase *src, const char *dataPrefix, con
matches++;
}
- /* always free the quoted string, since it needs freeing */
+ /* Always free the quoted string, since it needs freeing. */
MEM_freeN(quotedName);
}
- /* return the number of matches */
+ /* Return the number of matches. */
return matches;
}
@@ -415,7 +413,7 @@ FCurve *BKE_fcurve_find_by_rna_context_ui(bContext *C,
return fcu;
}
- /* there must be some RNA-pointer + property combon */
+ /* There must be some RNA-pointer + property combo. */
if (prop && tptr.owner_id && RNA_property_animateable(&tptr, prop)) {
AnimData *adt = BKE_animdata_from_id(tptr.owner_id);
int step = (
@@ -429,14 +427,14 @@ FCurve *BKE_fcurve_find_by_rna_context_ui(bContext *C,
step--;
}
- /* Standard F-Curve - Animation (Action) or Drivers */
+ /* Standard F-Curve - Animation (Action) or Drivers. */
while (adt && step--) {
if ((adt->action == NULL || adt->action->curves.first == NULL) &&
(adt->drivers.first == NULL)) {
continue;
}
- /* XXX this function call can become a performance bottleneck */
+ /* XXX This function call can become a performance bottleneck. */
if (step) {
path = RNA_path_from_ID_to_property(&tptr, prop);
}
@@ -444,8 +442,8 @@ FCurve *BKE_fcurve_find_by_rna_context_ui(bContext *C,
continue;
}
- /* XXX: the logic here is duplicated with a function up above
- * animation takes priority over drivers. */
+ /* XXX: The logic here is duplicated with a function up above. */
+ /* animation takes priority over drivers. */
if (adt->action && adt->action->curves.first) {
fcu = BKE_fcurve_find(&adt->action->curves, path, rnaindex);
@@ -454,7 +452,7 @@ FCurve *BKE_fcurve_find_by_rna_context_ui(bContext *C,
}
}
- /* if not animated, check if driven */
+ /* If not animated, check if driven. */
if (!fcu && (adt->drivers.first)) {
fcu = BKE_fcurve_find(&adt->drivers, path, rnaindex);
@@ -508,19 +506,19 @@ static int BKE_fcurve_bezt_binarysearch_index_ex(
int start = 0, end = arraylen;
int loopbreaker = 0, maxloop = arraylen * 2;
- /* initialize replace-flag first */
+ /* Initialize replace-flag first. */
*r_replace = false;
- /* sneaky optimizations (don't go through searching process if...):
- * - keyframe to be added is to be added out of current bounds
- * - keyframe to be added would replace one of the existing ones on bounds
+ /* Sneaky optimizations (don't go through searching process if...):
+ * - Keyframe to be added is to be added out of current bounds.
+ * - Keyframe to be added would replace one of the existing ones on bounds.
*/
if ((arraylen <= 0) || (array == NULL)) {
CLOG_WARN(&LOG, "encountered invalid array");
return 0;
}
- /* check whether to add before/after/on */
+ /* Check whether to add before/after/on. */
float framenum;
/* 'First' Keyframe (when only one keyframe, this case is u
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list