[Bf-blender-cvs] [c122d1b818f] temp-lanpr-staging: LANPR: Use flags for SceneLANPR. Make format.

YimingWu noreply at git.blender.org
Wed Sep 4 05:22:34 CEST 2019


Commit: c122d1b818fecacf962325d3a4dbabd6afdc720e
Author: YimingWu
Date:   Wed Sep 4 11:21:58 2019 +0800
Branches: temp-lanpr-staging
https://developer.blender.org/rBc122d1b818fecacf962325d3a4dbabd6afdc720e

LANPR: Use flags for SceneLANPR. Make format.

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

M	intern/ghost/intern/GHOST_ContextCGL.mm
M	intern/ghost/intern/GHOST_SystemCocoa.mm
M	source/blender/blenlib/BLI_array.h
M	source/blender/draw/engines/lanpr/lanpr_cpu.c
M	source/blender/draw/engines/lanpr/lanpr_engine.c
M	source/blender/draw/engines/lanpr/lanpr_snake.c
M	source/blender/editors/include/ED_lanpr.h
M	source/blender/editors/lanpr/lanpr_cpu.c
M	source/blender/editors/space_buttons/buttons_context.c
M	source/blender/makesdna/DNA_lanpr_types.h
M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesrna/intern/rna_scene.c

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

diff --git a/intern/ghost/intern/GHOST_ContextCGL.mm b/intern/ghost/intern/GHOST_ContextCGL.mm
index 12c340ffe97..0fca41306a6 100644
--- a/intern/ghost/intern/GHOST_ContextCGL.mm
+++ b/intern/ghost/intern/GHOST_ContextCGL.mm
@@ -34,7 +34,8 @@
 
 static void ghost_fatal_error_dialog(const char *msg)
 {
-  @autoreleasepool {
+  @autoreleasepool
+  {
     NSString *message = [NSString stringWithFormat:@"Error opening window:\n%s", msg];
 
     NSAlert *alert = [[NSAlert alloc] init];
@@ -337,7 +338,8 @@ static const OSType METAL_CORE_VIDEO_PIXEL_FORMAT = kCVPixelFormatType_32BGRA;
 
 void GHOST_ContextCGL::metalInit()
 {
-  @autoreleasepool {
+  @autoreleasepool
+  {
     id<MTLDevice> device = m_metalLayer.device;
 
     // Create a command queue for blit/present operation
@@ -532,7 +534,8 @@ void GHOST_ContextCGL::metalUpdateFramebuffer()
 
 void GHOST_ContextCGL::metalSwapBuffers()
 {
-  @autoreleasepool {
+  @autoreleasepool
+  {
     updateDrawingContext();
     glFlush();
 
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 376ebfa2a21..80a521a7ca5 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -1358,7 +1358,8 @@ bool GHOST_SystemCocoa::handleOpenDocumentRequest(void *filepathStr)
 
   // Check open windows if some changes are not saved
   if (m_windowManager->getAnyModifiedState()) {
-    @autoreleasepool {
+    @autoreleasepool
+    {
       NSAlert *alert = [[NSAlert alloc] init];
       NSString *title = [NSString stringWithFormat:@"Opening %@", [filepath lastPathComponent]];
       NSString *text = @"Current document has not been saved.\nDo you really want to proceed?";
diff --git a/source/blender/blenlib/BLI_array.h b/source/blender/blenlib/BLI_array.h
index d687838a896..57e1790fdfd 100644
--- a/source/blender/blenlib/BLI_array.h
+++ b/source/blender/blenlib/BLI_array.h
@@ -83,7 +83,8 @@ void _bli_array_grow_func(void **arr_p,
           ((void *)(_##arr##_static) != \
            NULL) && /* don't add _##arr##_len below because it must be zero */ \
           (_bli_array_totalsize_static(arr) >= \
-           (size_t)(_##arr##_len + (num)))) ? /* we have an empty array and a static var big enough */ \
+           (size_t)(_##arr##_len + \
+                    (num)))) ? /* we have an empty array and a static var big enough */ \
              (void)(arr = (void *)_##arr##_static) : /* use existing static array or allocate */ \
              (LIKELY(_bli_array_totalsize(arr) >= (size_t)(_##arr##_len + (num))) ? \
                   (void)0 /* do nothing */ : \
diff --git a/source/blender/draw/engines/lanpr/lanpr_cpu.c b/source/blender/draw/engines/lanpr/lanpr_cpu.c
index 26bf418f584..9a4ecd6b3d6 100644
--- a/source/blender/draw/engines/lanpr/lanpr_cpu.c
+++ b/source/blender/draw/engines/lanpr/lanpr_cpu.c
@@ -63,8 +63,7 @@ static void lanpr_rebuild_render_draw_command(LANPR_RenderBuffer *rb, LANPR_Line
   } attr_id;
   if (format.attr_len == 0) {
     attr_id.pos = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
-    attr_id.normal = GPU_vertformat_attr_add(
-        &format, "normal", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
+    attr_id.normal = GPU_vertformat_attr_add(&format, "normal", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
   }
 
   GPUVertBuf *vbo = GPU_vertbuf_create_with_format(&format);
@@ -109,8 +108,7 @@ static void lanpr_rebuild_render_draw_command(LANPR_RenderBuffer *rb, LANPR_Line
     tv = lanpr_make_leveled_edge_vertex_array(rb, &rb->edge_marks, tv, tn, &tn, ll, 4.0f);
   }
   if (ll->intersection.enabled) {
-    tv = lanpr_make_leveled_edge_vertex_array(
-        rb, &rb->intersection_lines, tv, tn, &tn, ll, 5.0f);
+    tv = lanpr_make_leveled_edge_vertex_array(rb, &rb->intersection_lines, tv, tn, &tn, ll, 5.0f);
   }
 
   for (i = 0; i < vertCount; i++) {
@@ -121,8 +119,7 @@ static void lanpr_rebuild_render_draw_command(LANPR_RenderBuffer *rb, LANPR_Line
   MEM_freeN(v);
   MEM_freeN(N);
 
-  ll->batch = GPU_batch_create_ex(
-      GPU_PRIM_LINES, vbo, 0, GPU_USAGE_DYNAMIC | GPU_BATCH_OWNS_VBO);
+  ll->batch = GPU_batch_create_ex(GPU_PRIM_LINES, vbo, 0, GPU_USAGE_DYNAMIC | GPU_BATCH_OWNS_VBO);
 }
 void ED_lanpr_rebuild_all_command(SceneLANPR *lanpr)
 {
@@ -264,45 +261,61 @@ void lanpr_software_draw_scene(void *vedata, GPUFrameBuffer *dfb, int is_render)
 
         DRW_shgroup_uniform_vec4(rb->ChainShgrp,
                                  "contour_color",
-                                 (ll->flags & LANPR_LINE_LAYER_USE_SAME_STYLE) ? ll->color : ll->contour.color,
+                                 (ll->flags & LANPR_LINE_LAYER_USE_SAME_STYLE) ? ll->color :
+                                                                                 ll->contour.color,
                                  1);
-        DRW_shgroup_uniform_vec4(
-            rb->ChainShgrp, "crease_color", (ll->flags & LANPR_LINE_LAYER_USE_SAME_STYLE) ? ll->color : ll->crease.color, 1);
         DRW_shgroup_uniform_vec4(rb->ChainShgrp,
-                                 "material_color",
-                                 (ll->flags & LANPR_LINE_LAYER_USE_SAME_STYLE) ? ll->color : ll->material_separate.color,
+                                 "crease_color",
+                                 (ll->flags & LANPR_LINE_LAYER_USE_SAME_STYLE) ? ll->color :
+                                                                                 ll->crease.color,
                                  1);
         DRW_shgroup_uniform_vec4(rb->ChainShgrp,
-                                 "edge_mark_color",
-                                 (ll->flags & LANPR_LINE_LAYER_USE_SAME_STYLE) ? ll->color : ll->edge_mark.color,
-                                 1);
-        DRW_shgroup_uniform_vec4(rb->ChainShgrp,
-                                 "intersection_color",
-                                 (ll->flags & LANPR_LINE_LAYER_USE_SAME_STYLE) ? ll->color : ll->intersection.color,
+                                 "material_color",
+                                 (ll->flags & LANPR_LINE_LAYER_USE_SAME_STYLE) ?
+                                     ll->color :
+                                     ll->material_separate.color,
                                  1);
+        DRW_shgroup_uniform_vec4(
+            rb->ChainShgrp,
+            "edge_mark_color",
+            (ll->flags & LANPR_LINE_LAYER_USE_SAME_STYLE) ? ll->color : ll->edge_mark.color,
+            1);
+        DRW_shgroup_uniform_vec4(
+            rb->ChainShgrp,
+            "intersection_color",
+            (ll->flags & LANPR_LINE_LAYER_USE_SAME_STYLE) ? ll->color : ll->intersection.color,
+            1);
         static float unit_thickness = 1.0f;
         DRW_shgroup_uniform_float(rb->ChainShgrp, "thickness", &ll->thickness, 1);
         DRW_shgroup_uniform_float(rb->ChainShgrp,
                                   "thickness_contour",
-                                  (ll->flags & LANPR_LINE_LAYER_USE_SAME_STYLE) ? &unit_thickness : &ll->contour.thickness,
+                                  (ll->flags & LANPR_LINE_LAYER_USE_SAME_STYLE) ?
+                                      &unit_thickness :
+                                      &ll->contour.thickness,
                                   1);
         DRW_shgroup_uniform_float(rb->ChainShgrp,
                                   "thickness_crease",
-                                  (ll->flags & LANPR_LINE_LAYER_USE_SAME_STYLE) ? &unit_thickness : &ll->crease.thickness,
+                                  (ll->flags & LANPR_LINE_LAYER_USE_SAME_STYLE) ?
+                                      &unit_thickness :
+                                      &ll->crease.thickness,
                                   1);
         DRW_shgroup_uniform_float(rb->ChainShgrp,
                                   "thickness_material",
-                                  (ll->flags & LANPR_LINE_LAYER_USE_SAME_STYLE) ? &unit_thickness :
-                                                       &ll->material_separate.thickness,
+                                  (ll->flags & LANPR_LINE_LAYER_USE_SAME_STYLE) ?
+                                      &unit_thickness :
+                                      &ll->material_separate.thickness,
                                   1);
         DRW_shgroup_uniform_float(rb->ChainShgrp,
                                   "thickness_edge_mark",
-                                  (ll->flags & LANPR_LINE_LAYER_USE_SAME_STYLE) ? &unit_thickness : &ll->edge_mark.thickness,
+                                  (ll->flags & LANPR_LINE_LAYER_USE_SAME_STYLE) ?
+                                      &unit_thickness :
+                                      &ll->edge_mark.thickness,
                                   1);
         DRW_shgroup_uniform_float(rb->ChainShgrp,
                                   "thickness_intersection",
-                                  (ll->flags & LANPR_LINE_LAYER_USE_SAME_STYLE) ? &unit_thickness :
-                                                       &ll->intersection.thickness,
+                                  (ll->flags & LANPR_LINE_LAYER_USE_SAME_STYLE) ?
+                                      &unit_thickness :
+                                      &ll->intersection.thickness,
                                   1);
         DRW_shgroup_uniform_int(rb->ChainShgrp, "enable_contour", &ll->contour.enabled, 1);
         DRW_shgroup_uniform_int(rb->ChainShgrp, "enable_crease", &ll->crease.enabled, 1);
@@ -313,9 +326,12 @@ void lanpr_software_draw_scene(void *vedata, GPUFrameBuffer *dfb, int is_render)
             rb->ChainShgrp, "enable_intersection", &ll->intersection.enabled, 1);
 
         static int normal_effect_inverse;
-        normal_effect_inverse = (ll->flags & LANPR_LINE_LAYER_NORMAL_INVERSE)?1:0;
-        DRW_shgroup_uniform_int(
-            rb->ChainShgrp, "normal_mode", (ll->flags & LANPR_LINE_LAYER_NORMAL_ENABLED) ? &ll->normal_mode : &zero_value, 1);
+        normal_effect_inverse = (ll->flags & LANPR_LINE_LAYER_NORMAL_INVERSE) ? 1 : 0;
+        DRW_shgroup_uniform_int(rb->ChainShgrp,
+                                "normal_mode",
+                                (ll->flags & LANPR_LIN

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list