[Bf-blender-cvs] [d6eeb656eaf] soc-2019-npr: LANPR: all the if() statements now use {} brackets.

YimingWu noreply at git.blender.org
Tue Jun 25 11:44:25 CEST 2019


Commit: d6eeb656eaf9a2db53a460b2c00353058ef3ba57
Author: YimingWu
Date:   Tue Jun 25 17:43:01 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rBd6eeb656eaf9a2db53a460b2c00353058ef3ba57

LANPR: all the if() statements now use {} brackets.

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

M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/draw/engines/lanpr/lanpr_access.c
M	source/blender/draw/engines/lanpr/lanpr_chain.c
M	source/blender/draw/engines/lanpr/lanpr_dpix.c
M	source/blender/draw/engines/lanpr/lanpr_engine.c
M	source/blender/draw/engines/lanpr/lanpr_ops.c
M	source/blender/draw/engines/lanpr/lanpr_snake.c
M	source/blender/draw/engines/lanpr/lanpr_util.c

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

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 8e544703f84..28e16455727 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1457,8 +1457,9 @@ static int stroke_march_next_point(bGPDstroke *gps,
   float point[3];
   bGPDspoint *pt = NULL;
 
-  if (!(next_point_index < gps->totpoints))
+  if (!(next_point_index < gps->totpoints)) {
     return -1;
+  }
 
   copy_v3_v3(step_start, current);
   pt = &gps->points[next_point_index];
@@ -1523,8 +1524,9 @@ bool BKE_gpencil_sample_stroke(bGPDstroke *gps, float dist)
   bGPDspoint *pt2 = NULL;
   int i;
 
-  if (gps->totpoints < 2 || dist < FLT_EPSILON)
+  if (gps->totpoints < 2 || dist < FLT_EPSILON) {
     return false;
+  }
 
   for (i = 0; i < gps->totpoints; i++) {
     pt[i].flag &= ~GP_SPOINT_TAG_FEATURE;  // feature point preservation not implemented yet
@@ -1554,8 +1556,9 @@ bool BKE_gpencil_sample_stroke(bGPDstroke *gps, float dist)
   int next_point_index = 1;
   i = 0;
   float pressure, strength, *weights = NULL;
-  if (new_dv)
+  if (new_dv) {
     weights = MEM_callocN(sizeof(float) * count, "gp_stroke_point_weights_sampled");
+  }
 
   // 1st point is always at the start
   pt1 = &gps->points[0];
@@ -1590,8 +1593,9 @@ bool BKE_gpencil_sample_stroke(bGPDstroke *gps, float dist)
     }
     */
     i++;
-    if (next_point_index == 0)
+    if (next_point_index == 0) {
       break; /* last point finished */
+    }
   }
 
   gps->points = new_pt;
@@ -1619,8 +1623,9 @@ bool BKE_gpencil_stretch_stroke(bGPDstroke *gps, float dist)
 {
   bGPDspoint *pt = gps->points, *last_pt, *second_last, *next_pt;
 
-  if (gps->totpoints < 2 || dist < FLT_EPSILON)
+  if (gps->totpoints < 2 || dist < FLT_EPSILON) {
     return false;
+  }
 
   last_pt = &pt[gps->totpoints - 1];
   ;
diff --git a/source/blender/draw/engines/lanpr/lanpr_access.c b/source/blender/draw/engines/lanpr/lanpr_access.c
index 28e8270ccf8..a2cd35dec73 100644
--- a/source/blender/draw/engines/lanpr/lanpr_access.c
+++ b/source/blender/draw/engines/lanpr/lanpr_access.c
@@ -54,8 +54,9 @@ void lanpr_generate_gpencil_from_chain(Depsgraph *depsgraph,
     printf("NULL LANPR rb!\n");
     return;
   }
-  if (scene->lanpr.master_mode != LANPR_MASTER_MODE_SOFTWARE)
+  if (scene->lanpr.master_mode != LANPR_MASTER_MODE_SOFTWARE) {
     return;
+  }
 
   int color_idx = 0;
   int tot_points = 0;
@@ -73,14 +74,15 @@ void lanpr_generate_gpencil_from_chain(Depsgraph *depsgraph,
   LANPR_RenderLineChainItem *rlci;
   for (rlc = rb->chains.first; rlc; rlc = (LANPR_RenderLineChain *)rlc->item.next) {
 
-    if (!rlc->object_ref)
+    if (!rlc->object_ref) {
       continue; /*  XXX: intersection lines are lost */
-
-    if (rlc->level > qi_end || rlc->level < qi_begin)
+    }
+    if (rlc->level > qi_end || rlc->level < qi_begin) {
       continue;
-
-    if (ob && &ob->id != rlc->object_ref->id.orig_id)
+    }
+    if (ob && &ob->id != rlc->object_ref->id.orig_id) {
       continue;
+    }
 
     int array_idx = 0;
     int count = lanpr_count_chain(rlc);
@@ -107,8 +109,9 @@ void lanpr_update_data_for_external(Depsgraph *depsgraph)
 {
   Scene *scene = DEG_get_evaluated_scene(depsgraph);
   SceneLANPR *lanpr = &scene->lanpr;
-  if (lanpr->master_mode != LANPR_MASTER_MODE_SOFTWARE)
+  if (lanpr->master_mode != LANPR_MASTER_MODE_SOFTWARE) {
     return;
+  }
   if (!lanpr_share.render_buffer_shared ||
       lanpr_share.render_buffer_shared->cached_for_frame != scene->r.cfra) {
     lanpr_compute_feature_lines_internal(depsgraph);
diff --git a/source/blender/draw/engines/lanpr/lanpr_chain.c b/source/blender/draw/engines/lanpr/lanpr_chain.c
index 9b414794ead..fbe062c7e31 100644
--- a/source/blender/draw/engines/lanpr/lanpr_chain.c
+++ b/source/blender/draw/engines/lanpr/lanpr_chain.c
@@ -47,8 +47,10 @@ LANPR_RenderLine *lanpr_get_connected_render_line(LANPR_BoundingArea *ba,
   for (lip = ba->linked_lines.first; lip; lip = lip->next) {
     nrl = lip->data;
 
-    if ((!(nrl->flags & LANPR_EDGE_FLAG_ALL_TYPE)) || (nrl->flags & LANPR_EDGE_FLAG_CHAIN_PICKED))
+    if ((!(nrl->flags & LANPR_EDGE_FLAG_ALL_TYPE)) ||
+        (nrl->flags & LANPR_EDGE_FLAG_CHAIN_PICKED)) {
       continue;
+    }
 
     /*  always chain connected lines for now. */
     /*  simplification will take care of the sharp points. */
@@ -60,9 +62,11 @@ LANPR_RenderLine *lanpr_get_connected_render_line(LANPR_BoundingArea *ba,
           *new_rv = LANPR_OTHER_RV(nrl, nrl->l);
           return nrl;
         }
-        else if (rv->fbcoord[0] == nrl->r->fbcoord[0] && rv->fbcoord[1] == nrl->r->fbcoord[1]) {
-          *new_rv = LANPR_OTHER_RV(nrl, nrl->r);
-          return nrl;
+        else {
+          if (rv->fbcoord[0] == nrl->r->fbcoord[0] && rv->fbcoord[1] == nrl->r->fbcoord[1]) {
+            *new_rv = LANPR_OTHER_RV(nrl, nrl->r);
+            return nrl;
+          }
         }
       }
       continue;
@@ -165,8 +169,9 @@ void lanpr_reduce_render_line_chain_recursive(LANPR_RenderLineChain *rlc,
     next_rlci = (LANPR_RenderLineChainItem *)rlci->item.next;
 
     if (next_rlci &&
-        (next_rlci->occlusion != rlci->occlusion || next_rlci->line_type != rlci->line_type))
+        (next_rlci->occlusion != rlci->occlusion || next_rlci->line_type != rlci->line_type)) {
       continue;
+    }
 
     float dist = dist_to_line_segment_v2(rlci->pos, from->pos, to->pos);
     if (dist > dist_threshold && dist > max_dist) {
@@ -177,21 +182,25 @@ void lanpr_reduce_render_line_chain_recursive(LANPR_RenderLineChain *rlc,
   }
 
   if (!max_rlci) {
-    if ((LANPR_RenderLineChainItem *)from->item.next == to)
+    if ((LANPR_RenderLineChainItem *)from->item.next == to) {
       return;
+    }
     for (rlci = (LANPR_RenderLineChainItem *)from->item.next; rlci != to; rlci = next_rlci) {
       next_rlci = (LANPR_RenderLineChainItem *)rlci->item.next;
       if (next_rlci &&
-          (next_rlci->occlusion != rlci->occlusion || next_rlci->line_type != rlci->line_type))
+          (next_rlci->occlusion != rlci->occlusion || next_rlci->line_type != rlci->line_type)) {
         continue;
+      }
       BLI_remlink(&rlc->chain, (void *)rlci);
     }
   }
   else {
-    if ((LANPR_RenderLineChainItem *)from->item.next != max_rlci)
+    if ((LANPR_RenderLineChainItem *)from->item.next != max_rlci) {
       lanpr_reduce_render_line_chain_recursive(rlc, from, max_rlci, dist_threshold);
-    if ((LANPR_RenderLineChainItem *)to->item.prev != max_rlci)
+    }
+    if ((LANPR_RenderLineChainItem *)to->item.prev != max_rlci) {
       lanpr_reduce_render_line_chain_recursive(rlc, max_rlci, to, dist_threshold);
+    }
   }
 }
 
@@ -207,8 +216,9 @@ void lanpr_NO_THREAD_chain_feature_lines(LANPR_RenderBuffer *rb)
 
   for (rl = rb->all_render_lines.first; rl; rl = (LANPR_RenderLine *)rl->item.next) {
 
-    if ((!(rl->flags & LANPR_EDGE_FLAG_ALL_TYPE)) || (rl->flags & LANPR_EDGE_FLAG_CHAIN_PICKED))
+    if ((!(rl->flags & LANPR_EDGE_FLAG_ALL_TYPE)) || (rl->flags & LANPR_EDGE_FLAG_CHAIN_PICKED)) {
       continue;
+    }
 
     rl->flags |= LANPR_EDGE_FLAG_CHAIN_PICKED;
 
@@ -285,38 +295,40 @@ void lanpr_NO_THREAD_chain_feature_lines(LANPR_RenderBuffer *rb)
           last_occlusion = rls->occlusion;
         }
       }
-      else if (new_rv == new_rl->r) {
-        rls = new_rl->segments.first;
-        last_occlusion = rls->occlusion;
-        rls = (LANPR_RenderLineSegment *)rls->item.next;
-        for (rls; rls; rls = (LANPR_RenderLineSegment *)rls->item.next) {
-          double gpos[3], lpos[3];
-          lanpr_LinearInterpolate3dv(new_rl->l->fbcoord, new_rl->r->fbcoord, rls->at, lpos);
-          lanpr_LinearInterpolate3dv(new_rl->l->gloc, new_rl->r->gloc, rls->at, gpos);
+      else {
+        if (new_rv == new_rl->r) {
+          rls = new_rl->segments.first;
+          last_occlusion = rls->occlusion;
+          rls = (LANPR_RenderLineSegment *)rls->item.next;
+          for (rls; rls; rls = (LANPR_RenderLineSegment *)rls->item.next) {
+            double gpos[3], lpos[3];
+            lanpr_LinearInterpolate3dv(new_rl->l->fbcoord, new_rl->r->fbcoord, rls->at, lpos);
+            lanpr_LinearInterpolate3dv(new_rl->l->gloc, new_rl->r->gloc, rls->at, gpos);
+            lanpr_push_render_line_chain_point(rb,
+                                               rlc,
+                                               lpos[0],
+                                               lpos[1],
+                                               gpos[0],
+                                               gpos[1],
+                                               gpos[2],
+                                               N,
+                                               new_rl->flags,
+                                               last_occlusion);
+            last_occlusion = rls->occlusion;
+          }
           lanpr_push_render_line_chain_point(rb,
                                              rlc,
-                                             lpos[0],
-                                             lpos[1],
-                                             gpos[0],
-                                             gpos[1],
-                                             gpos[2],
+                                             new_rl->r->fbcoord[0],
+                                             new_rl->r->fbcoord[1],
+                                             new_rl->r->gloc[0],
+                                             new_rl->r->gloc[1],
+                                             new_rl->r->gloc[2],
                                              N,
                                              new_rl->flags,
                                              last_occlusion);
-          last_occlusion = rls->occlusion;
         }
-        lanpr_push_render_line_chain_point(rb,
-                                           rlc,
-                                           new_rl->r->fbcoord[0],
-                                           new_rl->r->fbcoord[1],
-                                           new_rl->r->gloc[0],
-                                           new_rl->r->gloc[1],
-                                      

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list