[Bf-blender-cvs] [d1ca1b13381] lanpr-under-gp: LineArt: metaballs/texts/curves/surfaces support.

YimingWu noreply at git.blender.org
Fri Aug 14 10:18:17 CEST 2020


Commit: d1ca1b133811aade90e8e8cf32d4790267a17c0c
Author: YimingWu
Date:   Fri Aug 14 16:17:33 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rBd1ca1b133811aade90e8e8cf32d4790267a17c0c

LineArt: metaballs/texts/curves/surfaces support.

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

M	source/blender/editors/lineart/lineart_cpu.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c

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

diff --git a/source/blender/editors/lineart/lineart_cpu.c b/source/blender/editors/lineart/lineart_cpu.c
index f9788b93986..8f39fd75bec 100644
--- a/source/blender/editors/lineart/lineart_cpu.c
+++ b/source/blender/editors/lineart/lineart_cpu.c
@@ -33,11 +33,13 @@
 #include "BKE_camera.h"
 #include "BKE_collection.h"
 #include "BKE_context.h"
+#include "BKE_curve.h"
 #include "BKE_customdata.h"
 #include "BKE_global.h"
 #include "BKE_gpencil.h"
 #include "BKE_gpencil_geom.h"
 #include "BKE_gpencil_modifier.h"
+#include "BKE_mesh.h"
 #include "BKE_object.h"
 #include "BKE_report.h"
 #include "BKE_scene.h"
@@ -1362,6 +1364,7 @@ static void lineart_geometry_object_load(Object *ob,
   Object *orig_ob;
   int CanFindFreestyle = 0;
   int i;
+  Mesh *use_mesh;
 
   int usage = override_usage ? override_usage : ob->lineart.usage;
 
@@ -1369,7 +1372,15 @@ static void lineart_geometry_object_load(Object *ob,
     return;
   }
 
-  if (ob->type == OB_MESH) {
+  if (ob->type == OB_MESH || ob->type == OB_MBALL || ob->type == OB_CURVE || ob->type == OB_SURF ||
+      ob->type == OB_FONT) {
+
+    if (ob->type == OB_MESH) {
+      use_mesh = ob->data;
+    }
+    else {
+      use_mesh = BKE_mesh_new_from_object(NULL, ob, false);
+    }
 
     mul_m4db_m4db_m4fl_uniq(new_mvp, mvp_mat, ob->obmat);
     mul_m4db_m4db_m4fl_uniq(new_mv, mv_mat, ob->obmat);
@@ -1378,13 +1389,13 @@ static void lineart_geometry_object_load(Object *ob,
     transpose_m4(imat);
     copy_m4d_m4(normal, imat);
 
-    const BMAllocTemplate allocsize = BMALLOC_TEMPLATE_FROM_ME(((Mesh *)(ob->data)));
+    const BMAllocTemplate allocsize = BMALLOC_TEMPLATE_FROM_ME(((Mesh *)(use_mesh)));
     bm = BM_mesh_create(&allocsize,
                         &((struct BMeshCreateParams){
                             .use_toolflags = true,
                         }));
     BM_mesh_bm_from_me(bm,
-                       ob->data,
+                       use_mesh,
                        &((struct BMeshFromMeshParams){
                            .calc_face_normal = true,
                        }));
@@ -1486,6 +1497,11 @@ static void lineart_geometry_object_load(Object *ob,
     }
 
     BM_mesh_free(bm);
+
+    if (ob->type != OB_MESH) {
+      BKE_mesh_free(use_mesh);
+      MEM_freeN(use_mesh);
+    }
   }
 }
 
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index 92b78b51520..0aaa8c19390 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -264,7 +264,8 @@ static void updateDepsgraph(GpencilModifierData *md,
   }
   else {
     FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN (ctx->scene->master_collection, ob, mode) {
-      if (ob->type == OB_MESH) {
+      if (ob->type == OB_MESH || ob->type == OB_MBALL || ob->type == OB_CURVE ||
+          ob->type == OB_SURF || ob->type == OB_FONT) {
         if (!(ob->lineart.usage & COLLECTION_LRT_EXCLUDE)) {
           DEG_add_object_relation(ctx->node, ob, DEG_OB_COMP_GEOMETRY, "Line Art Modifier");
           DEG_add_object_relation(ctx->node, ob, DEG_OB_COMP_TRANSFORM, "Line Art Modifier");



More information about the Bf-blender-cvs mailing list