Cleanup: anim_motion_paths.cc

No functional changes.

This patch just changes the comments to start with a capital letter
and end with a dot.

Pull Request: https://projects.blender.org/blender/blender/pulls/133209
This commit is contained in:
Christoph Lendenfeld
2025-01-17 16:27:28 +01:00
committed by Christoph Lendenfeld
parent 14e788e42e
commit d9536fe878

View File

@@ -40,26 +40,26 @@
static CLG_LogRef LOG = {"ed.anim.motion_paths"};
/* Motion path needing to be baked (mpt) */
/* Motion path needing to be baked (mpt). */
struct MPathTarget {
MPathTarget *next, *prev;
bMotionPath *mpath; /* motion path in question */
bMotionPath *mpath; /* Motion path in question. */
AnimKeylist *keylist; /* temp, to know where the keyframes are */
AnimKeylist *keylist; /* Temp, to know where the keyframes are. */
/* Original (Source Objects) */
Object *ob; /* source object */
bPoseChannel *pchan; /* source pose-channel (if applicable) */
Object *ob; /* Source Object */
bPoseChannel *pchan; /* Source pose-channel (if applicable). */
/* "Evaluated" Copies (these come from the background evaluated copy
* that provide all the coordinates we want to save off). */
Object *ob_eval; /* evaluated object */
Object *ob_eval; /* Evaluated Object. */
};
/* ........ */
/* update scene for current frame */
/* Update scene for current frame. */
static void motionpaths_calc_update_scene(Depsgraph *depsgraph)
{
BKE_scene_graph_update_for_newframe(depsgraph);
@@ -97,9 +97,9 @@ void animviz_get_object_motionpaths(Object *ob, ListBase *targets)
MPathTarget *mpt;
/* object itself first */
/* Object itself first. */
if ((ob->avs.recalc & ANIMVIZ_RECALC_PATHS) && (ob->mpath)) {
/* new target for object */
/* New target for object. */
mpt = static_cast<MPathTarget *>(MEM_callocN(sizeof(MPathTarget), "MPathTarget Ob"));
BLI_addtail(targets, mpt);
@@ -107,12 +107,12 @@ void animviz_get_object_motionpaths(Object *ob, ListBase *targets)
mpt->ob = ob;
}
/* bones */
/* Bones. */
if ((ob->pose) && (ob->pose->avs.recalc & ANIMVIZ_RECALC_PATHS)) {
bArmature *arm = static_cast<bArmature *>(ob->data);
LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
if ((pchan->bone) && ANIM_bonecoll_is_visible_pchan(arm, pchan) && (pchan->mpath)) {
/* new target for bone */
/* New target for bone. */
mpt = static_cast<MPathTarget *>(MEM_callocN(sizeof(MPathTarget), "MPathTarget PoseBone"));
BLI_addtail(targets, mpt);
@@ -126,25 +126,25 @@ void animviz_get_object_motionpaths(Object *ob, ListBase *targets)
/* ........ */
/* perform baking for the targets on the current frame */
/* Perform baking for the targets on the current frame. */
static void motionpaths_calc_bake_targets(ListBase *targets,
int cframe,
Depsgraph *depsgraph,
Object *camera)
{
using namespace blender;
/* for each target, check if it can be baked on the current frame */
/* For each target, check if it can be baked on the current frame. */
LISTBASE_FOREACH (MPathTarget *, mpt, targets) {
bMotionPath *mpath = mpt->mpath;
/* current frame must be within the range the cache works for
* - is inclusive of the first frame, but not the last otherwise we get buffer overruns
/* Current frame must be within the range the cache works for.
* - is inclusive of the first frame, but not the last otherwise we get buffer overruns.
*/
if ((cframe < mpath->start_frame) || (cframe >= mpath->end_frame)) {
continue;
}
/* get the relevant cache vert to write to */
/* Get the relevant cache vert to write to. */
bMotionPathVert *mpv = mpath->points + (cframe - mpath->start_frame);
Object *ob_eval = mpt->ob_eval;
@@ -156,9 +156,9 @@ static void motionpaths_calc_bake_targets(ListBase *targets,
pchan_eval = BKE_pose_channel_find_name(ob_eval->pose, mpt->pchan->name);
}
/* pose-channel or object path baking? */
/* Pose-channel or object path baking? */
if (pchan_eval) {
/* heads or tails */
/* Heads or tails. */
if (mpath->flag & MOTIONPATH_FLAG_BHEAD) {
copy_v3_v3(mpv->co, pchan_eval->pose_head);
}
@@ -183,7 +183,7 @@ static void motionpaths_calc_bake_targets(ListBase *targets,
float mframe = float(cframe);
/* Tag if it's a keyframe */
/* Tag if it's a keyframe. */
if (ED_keylist_find_exact(mpt->keylist, mframe)) {
mpv->flag |= MOTIONPATH_VERT_KEY;
}
@@ -433,8 +433,8 @@ void animviz_calc_motionpaths(Depsgraph *depsgraph,
break;
}
/* get copies of objects/bones to get the calculated results from
* (for copy-on-evaluation), so that we actually get some results
/* Get copies of objects/bones to get the calculated results from
* (for copy-on-evaluation), so that we actually get some results.
*/
/* TODO: Create a copy of background depsgraph that only contain these entities,
@@ -455,16 +455,16 @@ void animviz_calc_motionpaths(Depsgraph *depsgraph,
AnimData *adt = BKE_animdata_from_id(&mpt->ob_eval->id);
/* build list of all keyframes in active action for object or pchan */
/* Build list of all keyframes in active action for object or pchan. */
mpt->keylist = ED_keylist_create();
ListBase *fcurve_list = nullptr;
if (adt) {
/* get pointer to animviz settings for each target */
/* Get pointer to animviz settings for each target. */
bAnimVizSettings *avs = animviz_target_settings_get(mpt);
/* it is assumed that keyframes for bones are all grouped in a single group
* unless an option is set to always use the whole action
/* It is assumed that keyframes for bones are all grouped in a single group
* unless an option is set to always use the whole action.
*/
if ((mpt->pchan) && (avs->path_viewflag & MOTIONPATH_VIEW_KFACT) == 0) {
bActionGroup *agrp = BKE_action_group_find_name(adt->action, mpt->pchan->name);
@@ -496,7 +496,7 @@ void animviz_calc_motionpaths(Depsgraph *depsgraph,
return;
}
/* calculate path over requested range */
/* Calculate path over requested range. */
CLOG_INFO(&LOG,
1,
"Calculating MotionPaths between frames %d - %d (%d frames)",
@@ -513,11 +513,11 @@ void animviz_calc_motionpaths(Depsgraph *depsgraph,
motionpaths_calc_update_scene(depsgraph);
}
/* perform baking for targets */
/* Perform baking for targets. */
motionpaths_calc_bake_targets(targets, scene->r.cfra, depsgraph, scene->camera);
}
/* reset original environment */
/* Reset original environment. */
/* NOTE: We don't always need to reevaluate the main scene, as the depsgraph
* may be a temporary one that works on a subset of the data.
* We always have to restore the current frame though. */
@@ -530,17 +530,17 @@ void animviz_calc_motionpaths(Depsgraph *depsgraph,
DEG_make_active(depsgraph);
}
/* clear recalc flags from targets */
/* Clear recalc flags from targets. */
LISTBASE_FOREACH (MPathTarget *, mpt, targets) {
bMotionPath *mpath = mpt->mpath;
/* get pointer to animviz settings for each target */
/* Get pointer to animviz settings for each target. */
bAnimVizSettings *avs = animviz_target_settings_get(mpt);
/* clear the flag requesting recalculation of targets */
/* Clear the flag requesting recalculation of targets. */
avs->recalc &= ~ANIMVIZ_RECALC_PATHS;
/* Clean temp data */
/* Clean temp data. */
ED_keylist_free(mpt->keylist);
/* Free previous batches to force update. */