Commit: a5e02263c96be0231123c1005d87d7bab92ed058 Author: Cian Jinks Date: Wed Jun 23 14:00:07 2021 +0100 Branches: soc-2021-knife-tools https://developer.blender.org/rBa5e02263c96be0231123c1005d87d7bab92ed058
Cleanup: Update comments to follow coding style https://wiki.blender.org/wiki/Style_Guide/C_Cpp#Comments =================================================================== M source/blender/editors/mesh/editmesh_knife.c =================================================================== diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 8b049ddf039..cbef3e28cad 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -75,15 +75,15 @@ #include "DEG_depsgraph.h" #include "DEG_depsgraph_query.h" -#include "mesh_intern.h" /* own include */ +#include "mesh_intern.h" /* Own include. */ -/* detect isolated holes and fill them */ +/* Detect isolated holes and fill them. */ #define USE_NET_ISLAND_CONNECT -#define KMAXDIST (10 * U.dpi_fac) /* max mouse distance from edge before not detecting it */ +#define KMAXDIST (10 * U.dpi_fac) /* Max mouse distance from edge before not detecting it. */ -/* WARNING: knife float precision is fragile: - * be careful before making changes here see: (T43229, T42864, T42459, T41164). +/* WARNING: Knife float precision is fragile: + * Be careful before making changes here see: (T43229, T42864, T42459, T41164). */ #define KNIFE_FLT_EPS 0.00001f #define KNIFE_FLT_EPS_SQUARED (KNIFE_FLT_EPS * KNIFE_FLT_EPS) @@ -106,15 +106,15 @@ typedef struct KnifeColors { uchar point_a[4]; } KnifeColors; -/* knifetool operator */ +/* Knifetool Operator. */ typedef struct KnifeVert { - BMVert *v; /* non-NULL if this is an original vert */ + BMVert *v; /* Non-NULL if this is an original vert. */ ListBase edges; ListBase faces; float co[3], cageco[3]; bool is_face, in_space; - bool is_cut; /* along a cut created by user input (will draw too) */ + bool is_cut; /* Along a cut created by user input (will draw too). */ } KnifeVert; typedef struct Ref { @@ -124,19 +124,19 @@ typedef struct Ref { typedef struct KnifeEdge { KnifeVert *v1, *v2; - BMFace *basef; /* face to restrict face fill to */ + BMFace *basef; /* Face to restrict face fill to. */ ListBase faces; - BMEdge *e /* , *e_old */; /* non-NULL if this is an original edge */ - bool is_cut; /* along a cut created by user input (will draw too) */ + BMEdge *e; /* Non-NULL if this is an original edge. */ + bool is_cut; /* Along a cut created by user input (will draw too). */ } KnifeEdge; typedef struct KnifeLineHit { float hit[3], cagehit[3]; - float schit[2]; /* screen coordinates for cagehit */ - float l; /* lambda along cut line */ - float perc; /* lambda along hit line */ - float m; /* depth front-to-back */ + float schit[2]; /* Screen coordinates for cagehit. */ + float l; /* Lambda along cut line. */ + float perc; /* Lambda along hit line. */ + float m; /* Depth front-to-back. */ /* Exactly one of kfe, v, or f should be non-NULL, * saying whether cut line crosses and edge, @@ -157,19 +157,18 @@ typedef struct KnifePosData { KnifeEdge *edge; BMFace *bmface; - /** When true, the cursor isn't over a face. */ + /* When true, the cursor isn't over a face. */ bool is_space; - float mval[2]; /* mouse screen position (may be non-integral if snapped to something) */ + float mval[2]; /* Mouse screen position (may be non-integral if snapped to something). */ } KnifePosData; /* struct for properties used while drawing */ typedef struct KnifeTool_OpData { - ARegion *region; /* region that knifetool was activated in */ - void *draw_handle; /* for drawing preview loop */ - ViewContext vc; /* note: _don't_ use 'mval', instead use the one we define below */ - float mval[2]; /* mouse value with snapping applied */ - // bContext *C; + ARegion *region; /* Region that knifetool was activated in. */ + void *draw_handle; /* For drawing preview loop. */ + ViewContext vc; /* Note: _don't_ use 'mval', instead use the one we define below. */ + float mval[2]; /* Mouse value with snapping applied. */ Scene *scene; Object *ob; @@ -177,9 +176,9 @@ typedef struct KnifeTool_OpData { MemArena *arena; - /* reused for edge-net filling */ + /* Reused for edge-net filling. */ struct { - /* cleared each use */ + /* Cleared each use. */ GSet *edge_visit; #ifdef USE_NET_ISLAND_CONNECT MemArena *arena; @@ -199,18 +198,18 @@ typedef struct KnifeTool_OpData { float vthresh; float ethresh; - /* used for drag-cutting */ + /* Used for drag-cutting. */ KnifeLineHit *linehits; int totlinehit; - /* Data for mouse-position-derived data */ - KnifePosData curr; /* current point under the cursor */ - KnifePosData prev; /* last added cut (a line draws from the cursor to this) */ - KnifePosData init; /* the first point in the cut-list, used for closing the loop */ + /* Data for mouse-position-derived data. */ + KnifePosData curr; /* Current point under the cursor. */ + KnifePosData prev; /* Last added cut (a line draws from the cursor to this). */ + KnifePosData init; /* The first point in the cut-list, used for closing the loop. */ - /** Number of knife edges `kedges`. */ + /* Number of knife edges `kedges`. */ int totkedge; - /** Number of knife vertices, `kverts`. */ + /* Number of knife vertices, `kverts`. */ int totkvert; BLI_mempool *refs; @@ -223,18 +222,18 @@ typedef struct KnifeTool_OpData { float projmat[4][4]; float projmat_inv[4][4]; - /* vector along view z axis (object space, normalized) */ + /* Vector along view z axis (object space, normalized). */ float proj_zaxis[3]; KnifeColors colors; - /* run by the UI or not */ + /* Run by the UI or not. */ bool is_interactive; /* Operator options. */ - bool cut_through; /* preference, can be modified at runtime (that feature may go) */ - bool only_select; /* set on initialization */ - bool select_result; /* set on initialization */ + bool cut_through; /* Preference, can be modified at runtime (that feature may go). */ + bool only_select; /* Set on initialization. */ + bool select_result; /* Set on initialization. */ bool is_ortho; float ortho_extent; @@ -251,9 +250,9 @@ typedef struct KnifeTool_OpData { bool ignore_vert_snapping; NumInput num; - float angle_snapping_increment; /* degrees */ + float angle_snapping_increment; /* Degrees */ - /* use to check if we're currently dragging an angle snapped line */ + /* Use to check if we're currently dragging an angle snapped line. */ bool is_angle_snapping; bool angle_snapping; float angle; @@ -268,12 +267,12 @@ typedef struct KnifeTool_OpData { short dist_angle_mode; bool show_dist_angle; - /* Save the second most recent point for angle drawing calculations */ + /* Save the second most recent point for angle drawing calculations. */ float old_cage[3]; float old_mval[2]; bool old_stored; float corr_prev_cage[3]; /* "knife_start_cut" updates prev.cage breaking angle calculations, - store correct version */ + * store correct version. */ } KnifeTool_OpData; enum { @@ -322,14 +321,14 @@ static void knifetool_raycast_planes(const KnifeTool_OpData *kcd, float r_v1[3], planes_from_projmat(kcd->projmat, planes[2], planes[0], planes[1], planes[3], NULL, NULL); - /* ray-cast all planes */ + /* Ray-cast all planes. */ { float ray_dir[3]; float ray_hit_best[2][3] = {{UNPACK3(kcd->prev.cage)}, {UNPACK3(kcd->curr.cage)}}; float lambda_best[2] = {-FLT_MAX, FLT_MAX}; int i; - /* we (sometimes) need the lines to be at the same depth before projecting */ + /* We (sometimes) need the lines to be at the same depth before projecting. */ #if 0 sub_v3_v3v3(ray_dir, kcd->curr.cage, kcd->prev.cage); #else @@ -448,7 +447,7 @@ static void knifetool_draw_visible_distances(const KnifeTool_OpData *kcd) const int font_size = 14.0f * U.pixelsize; const int distance_precision = 4; - /* calculate distance and convert to string */ + /* Calculate distance and convert to string. */ float prev_cage_world[3]; float curr_cage_world[3]; copy_v3_v3(prev_cage_world, kcd->corr_prev_cage); @@ -476,13 +475,13 @@ static void knifetool_draw_visible_distances(const KnifeTool_OpData *kcd) BLF_rotation(blf_mono_font, 0.0f); BLF_width_and_height(blf_mono_font, numstr, sizeof(numstr), &numstr_size[0], &numstr_size[1]); - /* center text */ + /* Center text. */ mid_v2_v2v2(posit, kcd->prev.mval, kcd->curr.mval); posit[0] -= numstr_size[0] / 2.0f; posit[1] -= numstr_size[1] / 2.0f; - /* draw text background */ - float color_back[4] = {0.0f, 0.0f, 0.0f, 0.5f}; /* TODO: replace with theme color */ + /* Draw text background. */ + float color_back[4] = {0.0f, 0.0f, 0.0f, 0.5f}; /* TODO: Replace with theme color. */ immUniformColor4fv(color_back); GPU_blend(GPU_BLEND_ALPHA); @@ -494,7 +493,7 @@ static void knifetool_draw_visible_distances(const KnifeTool_OpData *kcd) GPU_blend(GPU_BLEND_NONE); immUnbindProgram(); - /* draw text */ + /* Draw text. */ uchar color_text[3]; UI_GetThemeColor3ubv(TH_TEXT, color_text); @@ -524,7 +523,7 @@ static void knifetool_draw_angle(const KnifeTool_OpData *kcd, const int font_size = 14 * U.pixelsize; const int angle_precision = 2; - /* angle arc in 3d space */ + /* Angle arc in 3d space. */ GPU_blend(GPU_BLEND_ALPHA); const uint pos_3d = GPU_vertformat_attr_add( @@ -573,7 +572,7 @@ static void knifetool_draw_angle(const KnifeTool_OpData *kcd, immUnbindProgram(); - /* angle text and background in 2d space */ + /* Angle text and background in 2d space. */ GPU_matrix_push_projection(); GPU_matrix_push(); GPU_matrix_identity_set(); @@ -583,7 +582,7 @@ static void knifetool_draw_angle(const KnifeTool_OpData *kcd, immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - /* angle as string */ + /* Angle as string. */ char numstr[256]; float numstr_size[2]; float posit[2]; @@ -605,8 +604,8 @@ static void knifetool_draw_angle(const KnifeTool_OpData *kcd, posit[0] = mid_ss[0] + (cap_size * 2.0f); posit[1] = mid_ss[1] - (numstr_size[1] / 2.0f); - /* draw text background */ - float color_back[4] = {0.0f, 0.0f, 0.0f, 0.5f}; /* TODO: replace with theme color */ + /* Draw text background. */ + float co @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list [email protected] List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
