[Bf-blender-cvs] [418d99d2c70] lanpr-under-gp: LineArt: code format changes.

YimingWu noreply at git.blender.org
Wed Nov 4 09:26:01 CET 2020


Commit: 418d99d2c70d8297880916fb84f8ec9512e3c561
Author: YimingWu
Date:   Wed Nov 4 15:26:25 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rB418d99d2c70d8297880916fb84f8ec9512e3c561

LineArt: code format changes.

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

M	source/blender/editors/render/render_update.c
M	source/blender/editors/space_buttons/buttons_context.c
M	source/blender/editors/space_buttons/space_buttons.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
M	source/blender/makesdna/DNA_object_types.h
M	source/blender/makesrna/RNA_access.h
M	source/blender/makesrna/intern/rna_object.c

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

diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c
index fed43c08120..bb20eb68bf1 100644
--- a/source/blender/editors/render/render_update.c
+++ b/source/blender/editors/render/render_update.c
@@ -110,7 +110,9 @@ void ED_render_scene_update(const DEGEditorUpdateContext *update_ctx, int update
   wm = bmain->wm.first;
 
 #ifdef WITH_LINEART
-  /* Temporary solution for updating Line Art GPencil targets. */
+  /* TODO: Needs some specific flag in the render pipeline that marks line art for update, that way
+   * we could avoid some unecessary updating.
+   */
   if (updated) {
     ED_lineart_post_frame_update_external(C, scene, update_ctx->depsgraph, false);
   }
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index 2e120169485..7f20e34493a 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -155,13 +155,13 @@ static bool buttons_context_path_world(ButsContextPath *path)
   return false;
 }
 
-static int buttons_context_path_collection(ButsContextPath *path, wmWindow *window)
+static bool buttons_context_path_collection(ButsContextPath *path, wmWindow *window)
 {
   PointerRNA *ptr = &path->ptr[path->len - 1];
 
   /* if we already have a (pinned) collection, we're done */
   if (RNA_struct_is_a(ptr->type, &RNA_Collection)) {
-    return 1;
+    return true;
   }
   /* if we have a view layer, use the view layer's active collection */
   else if (buttons_context_path_view_layer(path, window)) {
@@ -170,12 +170,12 @@ static int buttons_context_path_collection(ButsContextPath *path, wmWindow *wind
     if (c) {
       RNA_id_pointer_create(&c->id, &path->ptr[path->len]);
       path->len++;
-      return 1;
+      return true;
     }
   }
 
   /* no path to a collection possible */
-  return 0;
+  return false;
 }
 
 static bool buttons_context_path_linestyle(ButsContextPath *path, wmWindow *window)
@@ -598,7 +598,7 @@ static bool buttons_context_path(
 #ifdef WITH_LINEART
       found = buttons_context_path_collection(path, window);
 #else
-      BLI_assert(!"'WITH_LINEART' disabled - should not possible to access 'BCONTEXT_COLLECTION'");
+      BLI_assert(!"'WITH_LINEART' is off. See buttons_context.c");
 #endif
       break;
     case BCONTEXT_TOOL:
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index 15440118d57..4f61a09b3ef 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -279,7 +279,7 @@ static const char *buttons_main_region_context_string(const short mainb)
 #ifdef WITH_LINEART
       return "collection";
 #else
-      BLI_assert(!"'WITH_LINEART' disabled - should not possible to access 'BCONTEXT_COLLECTION'");
+      BLI_assert(!"'WITH_LINEART' is off. See buttons_context.c");
 #endif
     case BCONTEXT_OBJECT:
       return "object";
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index abeb5b3fc43..a3e4792adb4 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -87,13 +87,7 @@ static void generate_strokes_actual(
     GpencilModifierData *md, Depsgraph *depsgraph, Object *ob, bGPDlayer *gpl, bGPDframe *gpf)
 {
   LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md;
-#if 0
-  int line_types = ((scene->flag & LRT_EVERYTHING_AS_CONTOUR) ?
-                        LRT_EDGE_FLAG_ALL_TYPE :
-                        ((scene->flag & LRT_INTERSECTION_AS_CONTOUR) ?
-                             (lmd->line_types & LRT_EDGE_FLAG_INTERSECTION) :
-                             lmd->line_types));
-#endif
+
   if (G.debug_value == 4000) {
     printf("LRT: Generating from modifier.\n");
   }
@@ -150,12 +144,12 @@ static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Objec
 
   /* Guard early, don't trigger calculation when no gpencil frame is present. Probably should
    * disable in the isModifierDisabled() function but we need addtional arg for depsgraph and
-   * gpd.*/
+   * gpd. */
   bGPDlayer *gpl = BKE_gpencil_layer_get_by_name(gpd, lmd->target_layer, 1);
   if (gpl == NULL) {
     return;
   }
-  /* Need to call this or we don't get active frame? */
+  /* Need to call this or we don't get active frame (user may haven't selected any one). */
   BKE_gpencil_frame_active_set(depsgraph, gpd);
   bGPDframe *gpf = gpl->actframe;
   if (gpf == NULL) {
@@ -233,11 +227,6 @@ static void bakeModifier(Main *UNUSED(bmain),
   LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md;
   Scene *scene = DEG_get_evaluated_scene(depsgraph);
 
-  /* Check all parameters required are filled. */
-  if (isModifierDisabled(md)) {
-    return;
-  }
-
   bGPDlayer *gpl = BKE_gpencil_layer_get_by_name(gpd, lmd->target_layer, 1);
   if (gpl == NULL) {
     return;
@@ -305,11 +294,6 @@ static void updateDepsgraph(GpencilModifierData *md,
       ctx->node, ctx->scene->camera, DEG_OB_COMP_TRANSFORM, "Line Art Modifier");
 }
 
-static void freeData(GpencilModifierData *UNUSED(md))
-{
-  return;
-}
-
 static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk, void *userData)
 {
   LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md;
@@ -347,24 +331,25 @@ static void panel_draw(const bContext *C, Panel *panel)
     uiItemL(layout, "Line types are fuzzy", ICON_NONE);
   }
   else {
+    uiLayout *column = uiLayoutColumn(layout, true);
     if (scene->lineart.line_types & LRT_EDGE_FLAG_CONTOUR) {
-      uiItemR(layout, ptr, "use_contour", 0, NULL, ICON_NONE);
+      uiItemR(column, ptr, "use_contour", 0, NULL, ICON_NONE);
     }
     if (scene->lineart.line_types & LRT_EDGE_FLAG_CREASE) {
-      uiItemR(layout, ptr, "use_crease", 0, "Crease", ICON_NONE);
+      uiItemR(column, ptr, "use_crease", 0, "Crease", ICON_NONE);
     }
     if (scene->lineart.line_types & LRT_EDGE_FLAG_MATERIAL) {
-      uiItemR(layout, ptr, "use_material", 0, "Material", ICON_NONE);
+      uiItemR(column, ptr, "use_material", 0, "Material", ICON_NONE);
     }
     if (scene->lineart.line_types & LRT_EDGE_FLAG_EDGE_MARK) {
-      uiItemR(layout, ptr, "use_edge_mark", 0, "Edge Marks", ICON_NONE);
+      uiItemR(column, ptr, "use_edge_mark", 0, "Edge Marks", ICON_NONE);
     }
     if (scene->lineart.flags & LRT_INTERSECTION_AS_CONTOUR) {
-      uiItemL(layout, "Intersection is fuzzy", ICON_NONE);
+      uiItemL(column, "Intersection is fuzzy", ICON_NONE);
     }
     else {
       if (scene->lineart.line_types & LRT_EDGE_FLAG_INTERSECTION) {
-        uiItemR(layout, ptr, "use_intersection", 0, "Intersection", ICON_NONE);
+        uiItemR(column, ptr, "use_intersection", 0, "Intersection", ICON_NONE);
       }
     }
   }
@@ -384,11 +369,13 @@ static void style_panel_draw(const bContext *C, Panel *panel)
 
   uiLayoutSetPropSep(layout, true);
 
-  uiItemR(layout, ptr, "thickness", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
+  uiLayout *column = uiLayoutColumn(layout, true);
 
-  uiItemR(layout, ptr, "opacity", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
+  uiItemR(column, ptr, "thickness", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
 
-  uiItemR(layout, ptr, "pre_sample_length", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
+  uiItemR(column, ptr, "opacity", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
+
+  uiItemR(column, ptr, "pre_sample_length", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
 }
 
 static void occlusion_panel_draw(const bContext *C, Panel *panel)
@@ -413,16 +400,16 @@ static void occlusion_panel_draw(const bContext *C, Panel *panel)
     uiItemR(layout, ptr, "level_start", 0, "Level", ICON_NONE);
   }
 
-  uiLayout *row = uiLayoutRow(layout, false);
+  uiItemR(layout, ptr, "use_transparency", 0, "Transparency", ICON_NONE);
 
-  uiItemR(row, ptr, "use_transparency", 0, "Transparency", ICON_NONE);
+  uiLayout *column = uiLayoutRow(layout, true);
 
   if (use_transparency) {
-    uiItemR(row, ptr, "transparency_match", 0, "Match", ICON_NONE);
+    uiItemR(column, ptr, "transparency_match", 0, "Match", ICON_NONE);
   }
 
   if (use_transparency) {
-    row = uiLayoutRow(layout, true);
+    uiLayout *row = uiLayoutRow(column, true);
     uiItemR(row, ptr, "transparency_mask_0", UI_ITEM_R_TOGGLE, "0", ICON_NONE);
     uiItemR(row, ptr, "transparency_mask_1", UI_ITEM_R_TOGGLE, "1", ICON_NONE);
     uiItemR(row, ptr, "transparency_mask_2", UI_ITEM_R_TOGGLE, "2", ICON_NONE);
@@ -443,15 +430,17 @@ static void vgroup_panel_draw(const bContext *C, Panel *panel)
 
   uiLayoutSetPropSep(layout, true);
 
-  row = uiLayoutRow(layout, true);
+  uiLayout *column = uiLayoutColumn(layout, true);
+
+  row = uiLayoutRow(column, true);
   uiItemR(row, ptr, "source_vertex_group", 0, "Filter Source", ICON_GROUP_VERTEX);
   uiItemR(row, ptr, "invert_source_vertex_group", UI_ITEM_R_TOGGLE, "", ICON_ARROW_LEFTRIGHT);
 
-  uiItemR(layout, ptr, "match_output_vertex_group", 0, NULL, ICON_NONE);
+  uiItemR(column, ptr, "match_output_vertex_group", 0, NULL, ICON_NONE);
 
   bool match_output = RNA_boolean_get(ptr, "match_output_vertex_group");
   if (!match_output) {
-    uiItemPointerR(layout, ptr, "vertex_group", &ob_ptr, "vertex_groups", "Target", ICON_NONE);
+    uiItemPointerR(column, ptr, "vertex_group", &ob_ptr, "vertex_groups", "Target", ICON_NONE);
   }
 
   uiItemR(layout, ptr, "soft_selection", 0, NULL, ICON_NONE);
@@ -485,7 +474,7 @@ GpencilModifierTypeInfo modifierType_Gpencil_Lineart = {
     /* remapTime */ NULL,
 
     /* initData */ initData,
-    /* freeData */ freeData,
+    /* freeData */ NULL,
     /* isDisabled */ isDisabled,
     /* updateDepsgraph */ updateDepsgraph,
     /* dependsOnTime */ NULL,
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 784b6688a48..3c4bf44d0bf 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -186,13 +186,13 @@ typedef struct Object_Runtime {
   short _pad2[3];
 } Object_Runtime;
 
-typedef 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list