From 37b7702d74ff0a452cbf6ce60a9359436e1050e9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 14 Apr 2023 13:51:38 +1000 Subject: [PATCH] Cleanup: comment blocks, #if 0 commented code --- intern/cycles/scene/light_tree.h | 10 +++-- intern/cycles/scene/osl.cpp | 7 ++- intern/ffmpeg/ffmpeg_compat.h | 4 +- source/blender/blenkernel/intern/nla.c | 6 ++- .../shaders/infos/workbench_composite_info.hh | 4 +- .../editors/transform/transform_convert_nla.c | 43 ++++++++----------- source/blender/geometry/intern/uv_pack.cc | 8 ++-- source/blender/gpu/vulkan/vk_framebuffer.cc | 5 ++- source/blender/makesdna/DNA_anim_types.h | 26 +++++++---- 9 files changed, 62 insertions(+), 51 deletions(-) diff --git a/intern/cycles/scene/light_tree.h b/intern/cycles/scene/light_tree.h index 0e208cff1de..f7f96a3066f 100644 --- a/intern/cycles/scene/light_tree.h +++ b/intern/cycles/scene/light_tree.h @@ -152,10 +152,12 @@ LightTreeBucket operator+(const LightTreeBucket &a, const LightTreeBucket &b); struct LightTreeNode { LightTreeMeasure measure; uint bit_trail; - int num_emitters = -1; /* The number of emitters a leaf node stores. A negative number indicates - it is an inner node. */ - int first_emitter_index; /* Leaf nodes contain an index to first emitter. */ - unique_ptr children[2]; /* Inner node has two children. */ + /* The number of emitters a leaf node stores. A negative number indicates it is an inner node. */ + int num_emitters = -1; + /* Leaf nodes contain an index to first emitter. */ + int first_emitter_index; + /* Inner node has two children. */ + unique_ptr children[2]; LightTreeNode() = default; diff --git a/intern/cycles/scene/osl.cpp b/intern/cycles/scene/osl.cpp index 1ee7dfadd96..7637e57dbb7 100644 --- a/intern/cycles/scene/osl.cpp +++ b/intern/cycles/scene/osl.cpp @@ -703,8 +703,11 @@ string OSLCompiler::id(ShaderNode *node) { /* assign layer unique name based on pointer address + bump mode */ stringstream stream; - stream.imbue(std::locale("C")); /* Ensure that no grouping characters (e.g. commas with en_US - locale) are added to the pointer string */ + + /* Ensure that no grouping characters (e.g. commas with en_US locale) + * are added to the pointer string. */ + stream.imbue(std::locale("C")); + stream << "node_" << node->type->name << "_" << node; return stream.str(); diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h index a8254a99032..5a81abb928f 100644 --- a/intern/ffmpeg/ffmpeg_compat.h +++ b/intern/ffmpeg/ffmpeg_compat.h @@ -214,8 +214,8 @@ void deinterlace_line_inplace( } /* deinterlacing : 2 temporal taps, 3 spatial taps linear filter. The - top field is copied as is, but the bottom field is deinterlaced - against the top field. */ + * top field is copied as is, but the bottom field is deinterlaced + * against the top field. */ FFMPEG_INLINE void deinterlace_bottom_field( uint8_t *dst, int dst_wrap, const uint8_t *src1, int src_wrap, int width, int height) diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 8d3b87379cd..0178e7c379d 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -1952,9 +1952,11 @@ static void BKE_nlastrip_validate_autoblends(NlaTrack *nlt, NlaStrip *nls) } } -/* Ensure every transition's start/end properly set. +/** + * Ensure every transition's start/end properly set. * Strip will be removed / freed if it doesn't fit (invalid). - * Return value indicates if passed strip is valid/fixed or invalid/removed. */ + * Return value indicates if passed strip is valid/fixed or invalid/removed. + */ static bool nlastrip_validate_transition_start_end(NlaStrip *strip) { diff --git a/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh b/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh index 7880b9bcabd..ffb1e6dd8f1 100644 --- a/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh +++ b/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh @@ -77,8 +77,8 @@ GPU_SHADER_CREATE_INFO(workbench_next_resolve_curvature) GPU_SHADER_CREATE_INFO(workbench_next_resolve_cavity) .define("WORKBENCH_CAVITY") - /* TODO(@pragma37): GPU_SAMPLER_EXTEND_MODE_REPEAT is set in CavityEffect, it doesn't work - here? */ + /* TODO(@pragma37): GPU_SAMPLER_EXTEND_MODE_REPEAT is set in CavityEffect, + * it doesn't work here? */ .sampler(8, ImageType::FLOAT_2D, "jitter_tx") .uniform_buf(5, "vec4", "cavity_samples[512]"); diff --git a/source/blender/editors/transform/transform_convert_nla.c b/source/blender/editors/transform/transform_convert_nla.c index aefcf26c49f..532e1edc825 100644 --- a/source/blender/editors/transform/transform_convert_nla.c +++ b/source/blender/editors/transform/transform_convert_nla.c @@ -194,7 +194,8 @@ static void nlastrip_flag_overlaps(NlaStrip *strip) } } -/** Check the Transformation data for the given Strip, and fix any overlap. Then +/** + * Check the Transformation data for the given Strip, and fix any overlap. Then * apply the Transformation. */ static void nlastrip_fix_overlapping(TransInfo *t, TransDataNla *tdn, NlaStrip *strip) @@ -202,8 +203,7 @@ static void nlastrip_fix_overlapping(TransInfo *t, TransDataNla *tdn, NlaStrip * /* firstly, check if the proposed transform locations would overlap with any neighboring * strips (barring transitions) which are absolute barriers since they are not being moved * - * this is done as a iterative procedure (done 5 times max for now) - */ + * this is done as a iterative procedure (done 5 times max for now). */ short iter_max = 4; NlaStrip *prev = BKE_nlastrip_prev_in_track(strip, true); NlaStrip *next = BKE_nlastrip_next_in_track(strip, true); @@ -215,9 +215,8 @@ static void nlastrip_fix_overlapping(TransInfo *t, TransDataNla *tdn, NlaStrip * const bool n_exceeded = (next != NULL) && (tdn->h2[0] > next->start); if ((p_exceeded && n_exceeded) || (iter == iter_max)) { - /* both endpoints exceeded (or iteration ping-pong'd meaning that we need a - * compromise) - * - Simply crop strip to fit within the bounds of the strips bounding it + /* Both endpoints exceeded (or iteration ping-pong'd meaning that we need a compromise). + * - Simply crop strip to fit within the bounds of the strips bounding it. * - If there were no neighbors, clear the transforms * (make it default to the strip's current values). */ @@ -250,16 +249,14 @@ static void nlastrip_fix_overlapping(TransInfo *t, TransDataNla *tdn, NlaStrip * } /* Use RNA to write the values to ensure that constraints on these are obeyed - * (e.g. for transition strips, the values are taken from the neighbors) - */ + * (e.g. for transition strips, the values are taken from the neighbors). */ RNA_pointer_create(NULL, &RNA_NlaStrip, strip, &strip_ptr); switch (t->mode) { case TFM_TIME_EXTEND: case TFM_TIME_SCALE: { /* The final scale is the product of the original strip scale (from before the - * transform operation started) and the current scale value of this transform - * operation. */ + * transform operation started) and the current scale value of this transform operation. */ const float originalStripScale = tdn->h1[2]; const float newStripScale = originalStripScale * t->values_final[0]; applyTransformNLA_timeScale(&strip_ptr, newStripScale); @@ -380,18 +377,18 @@ static void createTransNlaData(bContext *C, TransInfo *t) /* transition strips can't get directly transformed */ if (strip->type != NLASTRIP_TYPE_TRANSITION) { if (strip->flag & NLASTRIP_FLAG_SELECT) { - /* our transform data is constructed as follows: - * - only the handles on the right side of the current-frame get included - * - td structs are transform-elements operated on by the transform system - * and represent a single handle. The storage/pointer used (val or loc) depends - * on whether we're scaling or transforming. Ultimately though, the handles the td - * writes to will simply be a dummy in tdn - * - for each strip being transformed, a single tdn struct is used, so in some - * cases, there will need to be 1 of these tdn elements in the array skipped... + /* Our transform data is constructed as follows: + * - Only the handles on the right side of the current-frame get included. + * - `td` structs are transform-elements operated on by the transform system and + * represent a single handle. The storage/pointer used (`val` or `loc`) depends + * on whether we're scaling or transforming. Ultimately though, the handles the `td` + * writes to will simply be a dummy in `tdn`. + * - For each strip being transformed, a single `tdn` struct is used, so in some + * cases, there will need to be 1 of these `tdn` elements in the array skipped. */ float center[3], yval; - /* firstly, init tdn settings */ + /* Firstly, initialize `tdn` settings. */ tdn->id = ale->id; tdn->oldTrack = tdn->nlt = nlt; tdn->strip = strip; @@ -648,14 +645,12 @@ typedef struct IDGroupedTransData { /** horizontally translate (shuffle) the transformed strip to a non-overlapping state. */ static void nlastrip_shuffle_transformed(TransDataContainer *tc, TransDataNla *first_trans_data) { - /* Element: (IDGroupedTransData*) */ + /* Element: #IDGroupedTransData. */ ListBase grouped_trans_datas = {NULL, NULL}; - /* Flag all non-library-override transformed strips so we can distinguish them when - * shuffling. + /* Flag all non-library-override transformed strips so we can distinguish them when shuffling. * - * Group trans_datas by ID so shuffling is unique per ID. - */ + * Group trans_datas by ID so shuffling is unique per ID. */ { TransDataNla *tdn = first_trans_data; for (int i = 0; i < tc->data_len; i++, tdn++) { diff --git a/source/blender/geometry/intern/uv_pack.cc b/source/blender/geometry/intern/uv_pack.cc index aad6dfea685..4a684972053 100644 --- a/source/blender/geometry/intern/uv_pack.cc +++ b/source/blender/geometry/intern/uv_pack.cc @@ -1185,12 +1185,12 @@ void PackIsland::build_transformation(const float scale, r_matrix[0][1] = -sin_angle * scale * aspect_y; r_matrix[1][0] = sin_angle * scale / aspect_y; r_matrix[1][1] = cos_angle * scale; - /* +#if 0 if (reflect) { r_matrix[0][0] *= -1.0f; r_matrix[0][1] *= -1.0f; } - */ +#endif } void PackIsland::build_inverse_transformation(const float scale, @@ -1204,12 +1204,12 @@ void PackIsland::build_inverse_transformation(const float scale, r_matrix[0][1] = sin_angle / scale * aspect_y; r_matrix[1][0] = -sin_angle / scale / aspect_y; r_matrix[1][1] = cos_angle / scale; - /* +#if 0 if (reflect) { r_matrix[0][0] *= -1.0f; r_matrix[1][0] *= -1.0f; } - */ +#endif } } // namespace blender::geometry diff --git a/source/blender/gpu/vulkan/vk_framebuffer.cc b/source/blender/gpu/vulkan/vk_framebuffer.cc index 20ab1b67e7b..5fe258b67ac 100644 --- a/source/blender/gpu/vulkan/vk_framebuffer.cc +++ b/source/blender/gpu/vulkan/vk_framebuffer.cc @@ -247,9 +247,10 @@ void VKFrameBuffer::render_pass_create() std::array attachment_descriptions; std::array image_views; std::array attachment_references; - /*Vector color_attachments; +#if 0 + Vector color_attachments; VkAttachmentReference depth_attachment = {}; - */ +#endif bool has_depth_attachment = false; bool found_attachment = false; int depth_location = -1; diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h index 80932511d83..77d30e5758c 100644 --- a/source/blender/makesdna/DNA_anim_types.h +++ b/source/blender/makesdna/DNA_anim_types.h @@ -808,8 +808,10 @@ typedef enum eNlaStrip_Flag { // NLASTRIP_FLAG_SELECT_L = (1 << 2), /* left handle selected. */ // NLASTRIP_FLAG_SELECT_R = (1 << 3), /* right handle selected. */ - /** NLA strip uses the same action that the action being tweaked uses - * (not set for the tweaking one though). */ + /** + * NLA strip uses the same action that the action being tweaked uses + * (not set for the tweaking one though). + */ NLASTRIP_FLAG_TWEAKUSER = (1 << 4), /* controls driven by local F-Curves */ @@ -833,9 +835,11 @@ typedef enum eNlaStrip_Flag { /* temporary editing flags */ - /** When transforming strips, this flag is set when the strip is placed in an invalid location + /** + * When transforming strips, this flag is set when the strip is placed in an invalid location * such as overlapping another strip or moved to a locked track. In such cases, the strip's - * location must be corrected after the transform operator is done. */ + * location must be corrected after the transform operator is done. + */ NLASTRIP_FLAG_INVALID_LOCATION = (1 << 28), /** NLA strip should ignore frame range and hold settings, and evaluate at global time. */ NLASTRIP_FLAG_NO_TIME_MAP = (1 << 29), @@ -1031,9 +1035,11 @@ typedef enum eInsertKeyFlags { INSERTKEY_XYZ2RGB = (1 << 5), /** ignore user-prefs (needed for predictable API use) */ INSERTKEY_NO_USERPREF = (1 << 6), - /** Allow to make a full copy of new key into existing one, if any, + /** + * Allow to make a full copy of new key into existing one, if any, * instead of 'reusing' existing handles. - * Used by copy/paste code. */ + * Used by copy/paste code. + */ INSERTKEY_OVERWRITE_FULL = (1 << 7), /** for driver FCurves, use driver's "input" value - for easier corrective driver setup */ INSERTKEY_DRIVER = (1 << 8), @@ -1089,11 +1095,13 @@ typedef struct AnimOverride { typedef struct AnimData { /** * Active action - acts as the 'tweaking track' for the NLA. - * Either use BKE_animdata_set_action() to set this, or call BKE_animdata_action_ensure_idroot() - * after setting. */ + * Either use BKE_animdata_set_action() to set this, or call + * #BKE_animdata_action_ensure_idroot() after setting. + */ bAction *action; - /** temp-storage for the 'real' active action (i.e. the one used before the tweaking-action + /** + * Temp-storage for the 'real' active action (i.e. the one used before the tweaking-action * took over to be edited in the Animation Editors) */ bAction *tmpact;