[Bf-blender-cvs] [0cc39456c47] lineart-bvh: Merge remote-tracking branch 'origin/master' into lineart-bvh

YimingWu noreply at git.blender.org
Tue Jun 22 14:57:45 CEST 2021


Commit: 0cc39456c470054097ff6ae4698a8cb8149fb2dd
Author: YimingWu
Date:   Mon Jun 21 19:57:54 2021 +0800
Branches: lineart-bvh
https://developer.blender.org/rB0cc39456c470054097ff6ae4698a8cb8149fb2dd

Merge remote-tracking branch 'origin/master' into lineart-bvh

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



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

diff --cc source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index ae5f8b99dd7,f0aae7e4498..ba5b1a5cb31
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@@ -488,87 -447,6 +476,87 @@@ static void transparency_panel_draw(con
    uiItemR(col, ptr, "use_transparency_match", 0, IFACE_("Match All Masks"), ICON_NONE);
  }
  
 +static void intersection_panel_draw_header(const bContext *UNUSED(C), Panel *panel)
 +{
 +  uiLayout *layout = panel->layout;
-   PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
++  PointerRNA ob_ptr;
++  PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, &ob_ptr);
 +
 +  const bool is_baked = RNA_boolean_get(ptr, "is_baked");
 +  const bool use_isec = RNA_boolean_get(ptr, "use_intersection");
 +
 +  uiLayoutSetEnabled(layout, !is_baked);
 +  uiLayoutSetActive(layout, use_isec);
 +
 +  uiItemR(layout, ptr, "use_intersection_filter", 0, IFACE_("Filter Intersection"), ICON_NONE);
 +}
 +
 +static void intersection_panel_draw(const bContext *UNUSED(C), Panel *panel)
 +{
 +  uiLayout *layout = panel->layout;
 +  PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
 +
 +  const bool is_baked = RNA_boolean_get(ptr, "is_baked");
 +  const bool use_isec = RNA_boolean_get(ptr, "use_intersection");
 +  const bool use_isec_filter = RNA_boolean_get(ptr, "use_intersection_filter");
 +  uiLayoutSetEnabled(layout, !is_baked);
- 
 +  uiLayoutSetPropSep(layout, true);
 +
 +  uiLayoutSetActive(layout, use_isec && use_isec_filter);
 +
 +  uiLayout *row = uiLayoutRow(layout, true);
 +  uiLayoutSetPropDecorate(row, false);
 +  uiLayout *sub = uiLayoutRowWithHeading(row, true, IFACE_("Masks"));
 +  char text[2] = "0";
 +
 +  PropertyRNA *prop = RNA_struct_find_property(ptr, "use_intersection_mask");
 +  for (int i = 0; i < 8; i++, text[0]++) {
 +    uiItemFullR(sub, ptr, prop, i, 0, UI_ITEM_R_TOGGLE, text, ICON_NONE);
 +  }
 +  uiItemL(row, "", ICON_BLANK1); /* Space for decorator. */
 +
 +  uiLayout *col = uiLayoutColumn(layout, true);
 +  uiItemR(col, ptr, "use_intersection_match", 0, IFACE_("Match All Masks"), ICON_NONE);
 +}
 +
 +static void face_mark_panel_draw_header(const bContext *UNUSED(C), Panel *panel)
 +{
 +  uiLayout *layout = panel->layout;
 +  PointerRNA ob_ptr;
 +  PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, &ob_ptr);
 +
 +  const bool is_baked = RNA_boolean_get(ptr, "is_baked");
 +  const bool use_cache = RNA_boolean_get(ptr, "use_cached_result");
 +
 +  uiLayoutSetEnabled(
 +      layout,
 +      !is_baked && (!use_cache || BKE_gpencil_is_first_lineart_in_stack(ob_ptr.data, ptr->data)));
 +
 +  uiItemR(layout, ptr, "use_face_mark", 0, IFACE_("Filter Face Mark"), ICON_NONE);
 +}
 +
 +static void face_mark_panel_draw(const bContext *UNUSED(C), Panel *panel)
 +{
 +  uiLayout *layout = panel->layout;
 +  PointerRNA ob_ptr;
 +  PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, &ob_ptr);
 +
 +  const bool is_baked = RNA_boolean_get(ptr, "is_baked");
 +  const bool use_mark = RNA_boolean_get(ptr, "use_face_mark");
 +  const bool use_cache = RNA_boolean_get(ptr, "use_cached_result");
 +
 +  uiLayoutSetEnabled(
 +      layout,
 +      !is_baked && (!use_cache || BKE_gpencil_is_first_lineart_in_stack(ob_ptr.data, ptr->data)));
 +
 +  uiLayoutSetPropSep(layout, true);
 +
 +  uiLayoutSetActive(layout, use_mark);
 +
 +  uiItemR(layout, ptr, "use_face_mark_invert", 0, NULL, ICON_NONE);
 +  uiItemR(layout, ptr, "use_face_mark_boundaries", 0, NULL, ICON_NONE);
 +}
 +
  static void chaining_panel_draw(const bContext *UNUSED(C), Panel *panel)
  {
    PointerRNA ob_ptr;
@@@ -577,12 -455,16 +565,16 @@@
    uiLayout *layout = panel->layout;
  
    const bool is_baked = RNA_boolean_get(ptr, "is_baked");
 -  const bool use_cache = RNA_boolean_get(ptr, "use_cache");
 +  const bool use_cache = RNA_boolean_get(ptr, "use_cached_result");
+   const bool is_first = BKE_gpencil_is_first_lineart_in_stack(ob_ptr.data, ptr->data);
  
    uiLayoutSetPropSep(layout, true);
-   uiLayoutSetEnabled(
-       layout,
-       !is_baked && (!use_cache || BKE_gpencil_is_first_lineart_in_stack(ob_ptr.data, ptr->data)));
+   uiLayoutSetEnabled(layout, !is_baked);
+ 
+   if (use_cache && !is_first) {
+     uiItemL(layout, "Cached from the first line art modifier.", ICON_INFO);
+     return;
+   }
  
    uiLayout *col = uiLayoutColumnWithHeading(layout, true, IFACE_("Chain"));
    uiItemR(col, ptr, "use_fuzzy_intersections", 0, NULL, ICON_NONE);
@@@ -604,13 -483,17 +596,19 @@@ static void vgroup_panel_draw(const bCo
    uiLayout *layout = panel->layout;
  
    const bool is_baked = RNA_boolean_get(ptr, "is_baked");
-   const bool use_cache = RNA_boolean_get(ptr, "use_cached_result");
+   const bool use_cache = RNA_boolean_get(ptr, "use_cache");
+   const bool is_first = BKE_gpencil_is_first_lineart_in_stack(ob_ptr.data, ptr->data);
  
    uiLayoutSetPropSep(layout, true);
 -  uiLayoutSetEnabled(layout, !is_baked);
 +  uiLayoutSetEnabled(
 +      layout,
 +      !is_baked && (!use_cache || BKE_gpencil_is_first_lineart_in_stack(ob_ptr.data, ptr->data)));
  
+   if (use_cache && !is_first) {
+     uiItemL(layout, "Cached from the first line art modifier.", ICON_INFO);
+     return;
+   }
+ 
    uiLayout *col = uiLayoutColumn(layout, true);
  
    uiLayout *row = uiLayoutRow(col, true);
diff --cc source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index dbc7cc7781d,3796e374db7..9d4e2769c77
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@@ -503,10 -485,8 +505,10 @@@ static void lineart_main_occlusion_begi
    rb->intersection.last = rb->intersection.first;
    rb->material.last = rb->material.first;
    rb->edge_mark.last = rb->edge_mark.first;
 +  rb->floating.last = rb->floating.first;
 +  rb->light_contour.last = rb->light_contour.first;
  
-   TaskPool *tp = BLI_task_pool_create(NULL, TASK_PRIORITY_HIGH, TASK_ISOLATION_OFF);
+   TaskPool *tp = BLI_task_pool_create(NULL, TASK_PRIORITY_HIGH);
  
    for (i = 0; i < thread_count; i++) {
      rti[i].thread_id = i;
@@@ -3053,13 -2812,13 +3055,13 @@@ static LineartRenderBuffer *lineart_cre
    LineartRenderBuffer *rb = MEM_callocN(sizeof(LineartRenderBuffer), "Line Art render buffer");
  
    lmd->cache = lc;
-   lmd->render_buffer_onetime = rb;
+   lmd->render_buffer_ptr = rb;
 -  lc->rb_edge_types = lmd->edge_types_override;
 +  lc->rb_edge_types = LRT_EDGE_FLAG_ALL_TYPE;
  
 -  if (!scene || !scene->camera || !lc) {
 +  if (!scene || !camera || !lc) {
      return NULL;
    }
 -  Camera *c = scene->camera->data;
 +  Camera *c = camera->data;
    double clipping_offset = 0;
  
    if (lmd->calculation_flags & LRT_ALLOW_CLIPPING_BOUNDARIES) {
diff --cc source/blender/makesdna/DNA_gpencil_modifier_types.h
index 1b266f1ec28,3977ad326da..a871921abd2
--- a/source/blender/makesdna/DNA_gpencil_modifier_types.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h
@@@ -887,12 -885,10 +887,14 @@@ typedef enum eLineartGpencilMaskSwitche
    LRT_GPENCIL_TRANSPARENCY_ENABLE = (1 << 0),
    /** Set to true means using "and" instead of "or" logic on mask bits. */
    LRT_GPENCIL_TRANSPARENCY_MATCH = (1 << 1),
 -} eLineartGpencilTransparencyFlags;
 +  LRT_GPENCIL_INTERSECTION_FILTER = (1 << 2),
 +  LRT_GPENCIL_INTERSECTION_MATCH = (1 << 3),
 +} eLineartGpencilMaskSwitches;
 +
 +struct LineartCache;
  
+ struct LineartCache;
+ 
  typedef struct LineartGpencilModifierData {
    GpencilModifierData modifier;
  
@@@ -947,19 -928,17 +949,20 @@@
    /* CPU mode */
    float chaining_image_threshold;
  
-   /* eLineartMainFlags, for one time calculation. */
+   /* Ported from SceneLineArt flags. */
    int calculation_flags;
  
 -  /* Additional Switches. */
 +  /* eLineArtGPencilModifierFlags, modifier internal state. */
    int flags;
  
 +  /* Move strokes towards camera to avoid clipping while preserve depth for the viewport. */
 +  float stroke_offset;
 +
    /* Runtime data. */
  
-   /* Because we only do calculation once per modifier stack, so we need global override values for
-    * line art to compute as much data as possible. */
+   /* Because we can potentially only compute features lines once per modifier stack (Use Cache), we
+    * need to have these override values to ensure that we have the data we need is computed and
+    * stored in the cache. */
    char level_start_override;
    char level_end_override;
    short edge_types_override;
diff --cc source/blender/makesrna/intern/rna_gpencil_modifier.c
index 68d8a95428d,e2cee2836b1..60b2b6cbd20
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@@ -2866,56 -2821,6 +2866,56 @@@ static void rna_def_modifier_gpencillin
    RNA_def_property_range(prop, 0.0f, 0.3f);
    RNA_def_property_update(prop, NC_SCENE, "rna_GpencilModifier_update");
  
 +  prop = RNA_def_property(srna, "chain_floating_edges", PROP_BOOLEAN, PROP_NONE);
 +  RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_CHAIN_FLOATING_EDGES);
 +  RNA_def_property_ui_text(
 +      prop, "Chain Floating Edges", "Allow floating edges to be chained together");
 +  RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
 +
 +  prop = RNA_def_property(srna, "chain_geometry_space", PROP_BOOLEAN, PROP_NONE);
 +  RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_CHAIN_GEOMETRY_SPACE);
 +  RNA_def_property_ui_text(
-       prop, "Use Geometry Space", "Use geometry distance for chaining instead of image space.");
++      prop, "Use Geometry Space", "Use geometry distance for chaining instead of image space");
 +  RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
 +
 +  prop = RNA_def_property(srna, "use_multiple_edge_types", PROP_BOOLEAN, PROP_NONE);
 +  RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_ALLOW_MULTIPLE_EDGE_TYPES);
 +  RNA_def_property_ui_text(
 +      prop, "Multiple Edge Types", "Allow edges with muliple types be added for every type");
 +  RNA_def_property_update(prop, 0, "r

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list