[Bf-blender-cvs] [84e504dd3b8] lanpr-under-gp: LineArt: Obsolete operators cleaned up.

YimingWu noreply at git.blender.org
Tue Jul 7 14:04:45 CEST 2020


Commit: 84e504dd3b8ab28a027398473f965864352a9dad
Author: YimingWu
Date:   Tue Jul 7 20:04:39 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rB84e504dd3b8ab28a027398473f965864352a9dad

LineArt: Obsolete operators cleaned up.

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

M	release/scripts/startup/bl_ui/properties_render.py
M	source/blender/editors/include/ED_lineart.h
M	source/blender/editors/lineart/lineart_cpu.c
M	source/blender/editors/lineart/lineart_ops.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c

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

diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py
index a93bbd577e0..7609bfe285c 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -700,11 +700,6 @@ class RENDER_PT_simplify_greasepencil(RenderButtonsPanel, Panel, GreasePencilSim
     bl_options = {'DEFAULT_CLOSED'}
 
 
-class LRT_UL_linesets(UIList):
-    def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
-        layout.prop(item, "name", text="", emboss=False)
-
-
 class RENDER_PT_lineart(RenderButtonsPanel, Panel):
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
     bl_label = "Line Art"
@@ -730,7 +725,6 @@ class RENDER_PT_lineart(RenderButtonsPanel, Panel):
         col.prop(lineart, "master_strength", slider=True)
 
         col.prop(lineart, 'auto_update', text='Auto Update')
-        layout.prop(lineart, "gpencil_overwrite", text='Overwrite')
 
         if not scene.camera:
             has_camera = False
@@ -761,6 +755,24 @@ class RENDER_PT_lineart_options(RenderButtonsPanel, Panel):
         layout.prop(lineart, "chaining_geometry_threshold")
 
 
+class RENDER_PT_lineart_baking(RenderButtonsPanel, Panel):
+    bl_label = "Settings"
+    bl_parent_id = "RENDER_PT_lineart"
+    bl_options = {'DEFAULT_CLOSED'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
+
+    def draw(self, context):
+        scene = context.scene
+        lineart = scene.lineart
+
+        layout = self.layout
+        layout.use_property_split = True
+        layout.use_property_decorate = False
+
+        layout.prop(lineart, "gpencil_overwrite", text='Overwrite')
+        layout.operator('scene.lineart_bake_strokes')
+
+
 classes = (
     RENDER_PT_context,
     RENDER_PT_eevee_sampling,
@@ -794,7 +806,7 @@ classes = (
     RENDER_PT_simplify_greasepencil,
     RENDER_PT_lineart,
     RENDER_PT_lineart_options,
-    LRT_UL_linesets,
+    RENDER_PT_lineart_baking,
 )
 
 if __name__ == "__main__":  # only for live edit.
diff --git a/source/blender/editors/include/ED_lineart.h b/source/blender/editors/include/ED_lineart.h
index 68d8a60989f..4826e30ae98 100644
--- a/source/blender/editors/include/ED_lineart.h
+++ b/source/blender/editors/include/ED_lineart.h
@@ -525,6 +525,7 @@ LineartBoundingArea *ED_lineart_get_point_bounding_area_deep(LineartRenderBuffer
 
 struct bGPDlayer;
 struct bGPDframe;
+struct GpencilModifierData;
 
 void ED_lineart_generate_gpencil_from_chain(struct Depsgraph *depsgraph,
                                             struct Object *ob,
@@ -535,6 +536,17 @@ void ED_lineart_generate_gpencil_from_chain(struct Depsgraph *depsgraph,
                                             int material_nr,
                                             struct Collection *col,
                                             int types);
+void ED_generate_strokes_direct(struct Depsgraph *depsgraph,
+                                struct Object *ob,
+                                struct bGPDlayer *gpl,
+                                struct bGPDframe *gpf,
+                                char source_type,
+                                void *source_reference,
+                                int level_start,
+                                int level_end,
+                                int mat_nr,
+                                short line_types);
+
 struct bContext;
 
 void ED_lineart_post_frame_update_external(struct bContext *C,
@@ -553,17 +565,8 @@ float ED_lineart_compute_chain_length(LineartRenderLineChain *rlc);
 struct wmOperatorType;
 
 /* Operator types */
-void SCENE_OT_lineart_calculate_feature_lines(struct wmOperatorType *ot);
-void SCENE_OT_lineart_add_line_layer(struct wmOperatorType *ot);
-void SCENE_OT_lineart_delete_line_layer(struct wmOperatorType *ot);
-void SCENE_OT_lineart_auto_create_line_layer(struct wmOperatorType *ot);
-void SCENE_OT_lineart_move_line_layer(struct wmOperatorType *ot);
-void SCENE_OT_lineart_enable_all_line_types(struct wmOperatorType *ot);
-void SCENE_OT_lineart_update_gp_strokes(struct wmOperatorType *ot);
-void SCENE_OT_lineart_bake_gp_strokes(struct wmOperatorType *ot);
-
-void OBJECT_OT_lineart_update_gp_target(struct wmOperatorType *ot);
-void OBJECT_OT_lineart_update_gp_source(struct wmOperatorType *ot);
+void SCENE_OT_lineart_update_strokes(struct wmOperatorType *ot);
+void SCENE_OT_lineart_bake_strokes(struct wmOperatorType *ot);
 
 void ED_operatortypes_lineart(void);
 
diff --git a/source/blender/editors/lineart/lineart_cpu.c b/source/blender/editors/lineart/lineart_cpu.c
index f284aa0998f..da16ee57b49 100644
--- a/source/blender/editors/lineart/lineart_cpu.c
+++ b/source/blender/editors/lineart/lineart_cpu.c
@@ -291,62 +291,6 @@ static int lineart_auto_create_line_layer_exec(bContext *C, wmOperator *op)
   return OPERATOR_FINISHED;
 }
 
-void SCENE_OT_lineart_add_line_layer(wmOperatorType *ot)
-{
-
-  ot->name = "Add Line Layer";
-  ot->description = "Add a new line layer";
-  ot->idname = "SCENE_OT_lineart_add_line_layer";
-
-  ot->exec = lineart_add_line_layer_exec;
-}
-void SCENE_OT_lineart_delete_line_layer(wmOperatorType *ot)
-{
-
-  ot->name = "Delete Line Layer";
-  ot->description = "Delete selected line layer";
-  ot->idname = "SCENE_OT_lineart_delete_line_layer";
-
-  ot->exec = lineart_delete_line_layer_exec;
-}
-void SCENE_OT_lineart_auto_create_line_layer(wmOperatorType *ot)
-{
-
-  ot->name = "Auto Create Line Layer";
-  ot->description = "Automatically create defalt line layer config";
-  ot->idname = "SCENE_OT_lineart_auto_create_line_layer";
-
-  ot->exec = lineart_auto_create_line_layer_exec;
-}
-void SCENE_OT_lineart_move_line_layer(wmOperatorType *ot)
-{
-  static const EnumPropertyItem line_layer_move[] = {
-      {1, "UP", 0, "Up", ""}, {-1, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL}};
-
-  ot->name = "Move Line Layer";
-  ot->description = "Move LRT line layer up and down";
-  ot->idname = "SCENE_OT_lineart_move_line_layer";
-
-  /*  this need property to assign up/down direction */
-
-  ot->exec = lineart_move_line_layer_exec;
-
-  RNA_def_enum(ot->srna,
-               "direction",
-               line_layer_move,
-               0,
-               "Direction",
-               "Direction to move the active line layer towards");
-}
-void SCENE_OT_lineart_enable_all_line_types(wmOperatorType *ot)
-{
-  ot->name = "Enable All Line Types";
-  ot->description = "Enable All Line Types In This Line Layer";
-  ot->idname = "SCENE_OT_lineart_enable_all_line_types";
-
-  ot->exec = lineart_enable_all_line_types_exec;
-}
-
 /* Geometry */
 
 int use_smooth_contour_modifier_contour = 0; /*  debug purpose */
@@ -3805,7 +3749,7 @@ typedef struct LRT_FeatureLineWorker {
   int intersection_only;
 } LRT_FeatureLineWorker;
 
-static void lineart_update_gp_strokes_actual(Scene *scene, Depsgraph *dg);
+static void lineart_update_gpencil_strokes_actual(Scene *scene, Depsgraph *dg);
 static void lineart_notify_gpencil_targets(Depsgraph *dg);
 
 static void lineart_compute_feature_lines_worker(TaskPool *__restrict UNUSED(pool),
@@ -3861,53 +3805,6 @@ static bool lineart_camera_exists(bContext *c)
   Scene *scene = CTX_data_scene(c);
   return scene->camera ? true : false;
 }
-static int lineart_compute_feature_lines_exec(bContext *C, wmOperator *op)
-{
-  Scene *scene = CTX_data_scene(C);
-  SceneLineart *lineart = &scene->lineart;
-
-  if ((lineart->flags & LRT_ENABLED) == 0) {
-    return OPERATOR_CANCELLED;
-  }
-
-  if (scene->camera == NULL) {
-    BKE_report(op->reports, RPT_ERROR, "There is no active camera in this scene!");
-    printf("LRT Warning: There is no active camera in this scene!\n");
-    return OPERATOR_FINISHED;
-  }
-
-  // int intersections_only = (lineart->master_mode != LRT_MASTER_MODE_SOFTWARE);
-
-  /** Lock caller thread before calling feature line computation.
-   * This worker is not a background task, so we don't need to try another lock
-   * to wait for the worker to finish. The lock will be released in the compute function.
-   */
-  BLI_spin_lock(&lineart_share.lock_loader);
-
-  ED_lineart_compute_feature_lines_background(CTX_data_depsgraph_pointer(C),
-                                              0);  // intersections_only);
-
-  WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, NULL);
-
-  return OPERATOR_FINISHED;
-}
-static void lineart_compute_feature_lines_cancel(bContext *UNUSED(C), wmOperator *UNUSED(op))
-{
-  return;
-}
-
-void SCENE_OT_lineart_calculate_feature_lines(wmOperatorType *ot)
-{
-
-  /* identifiers */
-  ot->name = "Calculate Feature Lines";
-  ot->description = "LRT calculates feature line in current scene";
-  ot->idname = "SCENE_OT_lineart_calculate";
-
-  ot->poll = lineart_camera_exists;
-  ot->cancel = lineart_compute_feature_lines_cancel;
-  ot->exec = lineart_compute_feature_lines_exec;
-}
 
 /* Grease Pencil bindings */
 
@@ -4045,7 +3942,7 @@ void ED_lineart_generate_gpencil_from_chain(Depsgraph *depsgraph,
   /* release render lock so cache is free to be manipulated. */
   BLI_spin_unlock(&lineart_share.lock_render_status);
 }
-static void lineart_clear_gp_flags(Depsgraph *dg, int frame)
+static void lineart_clear_gpencil_flags(Depsgraph *dg, int frame)
 {
   DEG_OBJECT_ITER_BEGIN (dg,
                          ob,
@@ -4065,161 +3962,59 @@ static void lineart_clear_gp_flags(Depsgraph *dg, int frame)
   }
   DEG_OBJECT_ITER_END;
 }
-static void lineart_update_gp_strokes_single(Depsgraph *dg,
-                                             Object *gpobj,
-                                             Object *ob,
-                                             int frame,
-                                             int level_start,
-                                             int level_end,
-                                             char *target_layer,
-                                             char *target_material,
-                                             Collection *col,
-                                             int type)
+
+void ED_generate_strokes_direct(Depsgraph *depsgraph,
+                                Object *ob,
+   

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list