[Bf-blender-cvs] [043a54d5c83] soc-2019-bevel-profiles: Comments: Updated questions in comments marked with HANS-QUESTION. Deleted solved questions.

Hans Goudey noreply at git.blender.org
Thu Jun 27 19:50:16 CEST 2019


Commit: 043a54d5c8393f4727bac2d00be4a2510969a8ee
Author: Hans Goudey
Date:   Thu Jun 27 13:41:06 2019 -0400
Branches: soc-2019-bevel-profiles
https://developer.blender.org/rB043a54d5c8393f4727bac2d00be4a2510969a8ee

Comments: Updated questions in comments marked with HANS-QUESTION. Deleted solved questions.

===================================================================

M	source/blender/blenkernel/intern/profile_path.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/bmesh/tools/bmesh_bevel.c
M	source/blender/editors/interface/interface_draw.c
M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/interface/interface_templates.c

===================================================================

diff --git a/source/blender/blenkernel/intern/profile_path.c b/source/blender/blenkernel/intern/profile_path.c
index ed01a75cf30..13fc006f2b2 100644
--- a/source/blender/blenkernel/intern/profile_path.c
+++ b/source/blender/blenkernel/intern/profile_path.c
@@ -704,10 +704,10 @@ static void profilepath_make_table(ProfilePath *prpath, const rctf *clipr)
       fp += 2;
     }
     if (fp == allpoints || (curf >= fp[0] && fp == lastpoint)) {
-      /* HANS-TODO: Remove this case. Why did I say this? */
+      /* HANS-TODO: Remove this case... Why did I say this? */
     }
     else {
-      /* HANS-QUESTION: Why this factor stuff? */
+      /* HANS-QUESTION: What's the idea behind this factor stuff? */
       float fac1 = fp[0] - fp[-2];
       float fac2 = fp[0] - curf;
       if (fac1 > FLT_EPSILON) {
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 57b4ddde648..68943382938 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -958,8 +958,9 @@ static void write_curvemapping(WriteData *wd, CurveMapping *cumap)
 
 static void write_profilewidget(WriteData *wd, ProfileWidget *prwdgt)
 {
-  /* HANS-QUESTION: Why do I have to write the ProfilePath struct when the curvemapping write
-   * function doesn't have to do the analagous write? */
+  /* HANS-QUESTION: I seem to have to write the ProfilePath struct when the curvemapping write
+   * function doesn't have to do the analagous write. Anyway, the loading after a save crashes, so
+   * this can't be right. */
   writestruct(wd, DATA, ProfileWidget, 1, prwdgt);
   writestruct(wd, DATA, ProfilePath, 1, prwdgt->profile);
   writestruct(wd, DATA, ProfilePoint, prwdgt->profile->totpoint, prwdgt->profile->path);
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c
index 31d4e50c676..bb1f4c31845 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -101,8 +101,7 @@ typedef struct EdgeHalf {
   bool is_seam;                 /* is e a seam for custom loopdata (e.g., UVs)? */
   /** Used during the custom profile orientation pass */
   bool visited_custom;
-  //  int _pad;
-  char _pad[5];  // HANS-TODO: Delete these pads
+  char _pad[5];
 } EdgeHalf;
 
 /* Profile specification.
@@ -156,9 +155,11 @@ typedef struct BoundVert {
   EdgeHalf *efirst;
   EdgeHalf *elast;
   /** The "edge between" that this is on, in offset_on_edge_between case. */
-  EdgeHalf *eon; /* HANS-QUESTION: What is the "eon edge?" */
+  EdgeHalf *eon;
+  /* HANS-QUESTION: What is the "eon edge?" I haven't been able to visualize where this is. */
   /** Beveled edge whose left side is attached here, if any. */
-  EdgeHalf *ebev; /* HANS-QUESTION: Why just store the left edge? */
+  EdgeHalf *ebev;
+  /* HANS-QUESTION: Why just store the left edge? For travelling counterclockwise? */
   /** Used for vmesh indexing. */
   int index;
   /** When eon set, ratio of sines of angles to eon edge. */
@@ -190,8 +191,9 @@ typedef struct VMesh {
   NewVert *mesh;         /* allocated array - size and structure depends on kind */
   BoundVert *boundstart; /* start of boundary double-linked list */
   int count;             /* number of vertices in the boundary */
-  /* HANS-QUESTION: Does that mean the number of points in the profile so far? */
   int seg;               /* common # of segments for segmented edges */
+  /* HANS-QUESTION: How is this seg different than the global bp->seg? Is it the number of segments
+   * built so far? */
   enum {
     M_NONE,    /* no polygon mesh needed */
     M_POLY,    /* a simple polygon */
@@ -1268,7 +1270,8 @@ static void project_to_edge(BMEdge *e, const float co_a[3], const float co_b[3],
 /* If there is a bndv->ebev edge, find the mid control point if necessary.
  * It is the closest point on the beveled edge to the line segment between
  * bndv and bndv->next.  */
-/* HANS-QUESTION: Will I need to change this? */
+/* HANS-QUESTION: I'm not sure if I'll need to change this. I don't think the custom situation
+ * uses the mid control point yet.*/
 static void set_profile_params(BevelParams *bp, BevVert *bv, BoundVert *bndv)
 {
   EdgeHalf *e;
@@ -1735,7 +1738,9 @@ static void calculate_profile_custom(BevelParams *bp, BoundVert *bndv, bool reve
           }
           p[2] = 0.0f;
           mul_v3_m4v3(co, m, p);
-          /* HANS-QUESTION: What's the reason to have this and the final projection? */
+          /* HANS-QUESTION: I guess this projection takes it from the profile spacing
+           * two dimentions to the global three dimensions and the next projection (onto profile
+           * plane) fixes it / rotates it? I don't fully understand why both are necessary. */
         }
         else {
           interp_v3_v3v3(co, pro->coa, pro->cob, (float)k / (float)ns);
@@ -1832,7 +1837,6 @@ static void calculate_profile(BevelParams *bp, BoundVert *bndv)
           p[1] = (float)yvals[k];
           p[2] = 0.0f;
           mul_v3_m4v3(co, m, p);
-          /* HANS-QUESTION: What's the reason to have this and the final projection? */
         }
         else {
           interp_v3_v3v3(co, pro->coa, pro->cob, (float)k / (float)ns);
@@ -3874,7 +3878,7 @@ static void fill_vmesh_fracs(VMesh *vm, float *frac, int i)
 }
 
 /* Like fill_vmesh_fracs but want fractions for profile points of bndv, with ns segments */
-/* HANS-QUESTION: What exactly are these functions doing? */
+/* HANS-QUESTION: I haven't yet figured out what these fill_*_fracs functions are doing. */
 static void fill_profile_fracs(BevelParams *bp, BoundVert *bndv, float *frac, int ns)
 {
 #if DEBUG_CUSTOM_PROFILE_ADJ
@@ -3936,7 +3940,8 @@ static int interp_range(const float *frac, int n, const float f, float *r_rest)
 
 /* Interpolate given vmesh to make one with target nseg border vertices on the profiles */
 /* HANS-TODO: Needs custom analog. */
-/* HANS-QUESTION: General idea of how this works */
+/* HANS-QUESTION: What's the general idea of how this works? Maybe I could find that in the notes
+ * documents? */
 static VMesh *interp_vmesh(BevelParams *bp, VMesh *vm0, int nseg)
 {
 #if DEBUG_CUSTOM_PROFILE_ADJ
@@ -4018,22 +4023,22 @@ static VMesh *cubic_subdiv(BevelParams *bp, VMesh *vm0)
 #if DEBUG_CUSTOM_PROFILE_ADJ
   printf("CUBIC SUBDIV\n");
 #endif
-  int n, ns0, ns20, ns1;
+  int n_boundary, ns0, ns20, ns1;
   int i, j, k, inext;
   float co[3], co1[3], co2[3], acc[3];
   float beta, gamma;
   VMesh *vm1;
   BoundVert *bndv;
 
-  n = vm0->count; /* HANS-QUESTION: The difference between all of these seg numbers */
+  n_boundary = vm0->count;
   ns0 = vm0->seg;
   ns20 = ns0 / 2;
   BLI_assert(ns0 % 2 == 0);
   ns1 = 2 * ns0;
-  vm1 = new_adj_vmesh(bp->mem_arena, n, ns1, vm0->boundstart);
+  vm1 = new_adj_vmesh(bp->mem_arena, n_boundary, ns1, vm0->boundstart);
 
   /* First we adjust the boundary vertices of the input mesh, storing in output mesh */
-  for (i = 0; i < n; i++) {
+  for (i = 0; i < n_boundary; i++) {
     copy_v3_v3(mesh_vert(vm1, i, 0, 0)->co, mesh_vert(vm0, i, 0, 0)->co);
     for (k = 1; k < ns0; k++) {
       /* smooth boundary rule */
@@ -4050,7 +4055,7 @@ static VMesh *cubic_subdiv(BevelParams *bp, VMesh *vm0)
   }
   /* now do odd ones in output mesh, based on even ones */
   bndv = vm1->boundstart;
-  for (i = 0; i < n; i++) {
+  for (i = 0; i < n_boundary; i++) {
     for (k = 1; k < ns1; k += 2) {
       if (bp->use_custom_profile && !bndv->is_profile_start) {
         get_profile_point(bp, &bndv->profile, ns1 - k, ns1, co);
@@ -4072,7 +4077,7 @@ static VMesh *cubic_subdiv(BevelParams *bp, VMesh *vm0)
   vmesh_copy_equiv_verts(vm1);
 
   /* Copy adjusted verts back into vm0 */
-  for (i = 0; i < n; i++) {
+  for (i = 0; i < n_boundary; i++) {
     for (k = 0; k < ns0; k++) {
       copy_v3_v3(mesh_vert(vm0, i, 0, k)->co, mesh_vert(vm1, i, 0, 2 * k)->co);
     }
@@ -4084,7 +4089,7 @@ static VMesh *cubic_subdiv(BevelParams *bp, VMesh *vm0)
    * and assuming all boundary vertices have valence 4 */
 
   /* The new face vertices */
-  for (i = 0; i < n; i++) {
+  for (i = 0; i < n_boundary; i++) {
     for (j = 0; j < ns20; j++) {
       for (k = 0; k < ns20; k++) {
         /* face up and right from (j, k) */
@@ -4099,7 +4104,7 @@ static VMesh *cubic_subdiv(BevelParams *bp, VMesh *vm0)
   }
 
   /* The new vertical edge vertices  */
-  for (i = 0; i < n; i++) {
+  for (i = 0; i < n_boundary; i++) {
     for (j = 0; j < ns20; j++) {
       for (k = 1; k <= ns20; k++) {
         /* vertical edge between (j, k) and (j+1, k) */
@@ -4114,7 +4119,7 @@ static VMesh *cubic_subdiv(BevelParams *bp, VMesh *vm0)
   }
 
   /* The new horizontal edge vertices  */
-  for (i = 0; i < n; i++) {
+  for (i = 0; i < n_boundary; i++) {
     for (j = 1; j < ns20; j++) {
       for (k = 0; k < ns20; k++) {
         /* horizontal edge between (j, k) and (j, k+1) */
@@ -4131,7 +4136,7 @@ static VMesh *cubic_subdiv(BevelParams *bp, VMesh *vm0)
   /* The new vertices, not on border */
   gamma = 0.25f;
   beta = -gamma;
-  for (i = 0; i < n; i++) {
+  for (i = 0; i < n_boundary; i++) {
     for (j = 1; j < ns20; j++) {
       for (k = 1; k <= ns20; k++) {
         /* co1 = centroid of adjacent new edge verts */
@@ -4158,28 +4163,28 @@ static VMesh *cubic_subdiv(BevelParams *bp, VMesh *vm0)
   vmesh_copy_equiv_verts(vm1);
 
   /* The center vertex is special */
-  gamma = sabin_gamma(n);
+  gamma = sabin_gamma(n_boundary);
   beta = -gamma;
   /* accumulate edge verts in co1, face verts in co2 */
   zero_v3(co1);
   zero_v3(co2);
-  for (i = 0; i < n; i++) {
+  for (i = 0; i < n_boundary; i++) {
     add_v3_v3(co1, mesh_vert(vm1, i, ns0, ns0 - 1)->co);
     add_v3_v3(co2, mesh_vert(vm1, i, ns0 - 1, ns0 - 1)->co);
     add_v3_v3(co2, mesh_vert(vm1, i, ns0 - 1, ns0 + 1)->co);
   }
   copy_v3_v3(co, co1);
-  mul_v3_fl(co, 1.0f / (float)n);
-  madd_v3_v3fl(co, co2, beta / (2.0f * (float)n));
+  mul_v3_fl(co, 1.0f / (float)n_boundary);
+  madd_v3_v3fl(co, co2, beta / (2.0f * (float)n_boundary));
   madd_v3_v3fl(co, mesh_vert(vm0, 0, ns20, ns20)->co, gamma);
-  for (i = 0; i < n; i++) {
+  for (i = 0; i < n_boundary; i++) {
     copy_v3_v3(

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list