[Bf-blender-cvs] [ccef1c234a1] lanpr-under-gp: LineArt: Back-transform strokes to allow gp to sit at other positions.
YimingWu
noreply at git.blender.org
Wed Aug 26 14:58:57 CEST 2020
Commit: ccef1c234a1ef0da0dde632c15664adb99765a46
Author: YimingWu
Date: Wed Aug 26 20:58:09 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rBccef1c234a1ef0da0dde632c15664adb99765a46
LineArt: Back-transform strokes to allow gp to sit at other positions.
===================================================================
M source/blender/editors/include/ED_lineart.h
M source/blender/editors/lineart/lineart_cpu.c
M source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
===================================================================
diff --git a/source/blender/editors/include/ED_lineart.h b/source/blender/editors/include/ED_lineart.h
index b9adf76d325..b4bf153b674 100644
--- a/source/blender/editors/include/ED_lineart.h
+++ b/source/blender/editors/include/ED_lineart.h
@@ -536,13 +536,14 @@ struct bGPDframe;
struct GpencilModifierData;
void ED_lineart_gpencil_generate_from_chain(struct Depsgraph *depsgraph,
- struct Object *ob,
+ float *gp_obmat,
struct bGPDlayer *UNUSED(gpl),
struct bGPDframe *gpf,
int level_start,
int level_end,
int material_nr,
- struct Collection *col,
+ struct Object *source_object,
+ struct Collection *source_collection,
int types,
unsigned char transparency_flags,
unsigned char transparency_mask,
diff --git a/source/blender/editors/lineart/lineart_cpu.c b/source/blender/editors/lineart/lineart_cpu.c
index c30389f9568..f325f63ccc4 100644
--- a/source/blender/editors/lineart/lineart_cpu.c
+++ b/source/blender/editors/lineart/lineart_cpu.c
@@ -3691,13 +3691,14 @@ static void lineart_gpencil_notify_targets(Depsgraph *dg)
}
void ED_lineart_gpencil_generate_from_chain(Depsgraph *UNUSED(depsgraph),
- Object *ob,
+ float *gp_obmat_inverse,
bGPDlayer *UNUSED(gpl),
bGPDframe *gpf,
int level_start,
int level_end,
int material_nr,
- Collection *col,
+ Object *source_object,
+ Collection *source_collection,
int types,
unsigned char transparency_flags,
unsigned char transparency_mask,
@@ -3730,13 +3731,14 @@ void ED_lineart_gpencil_generate_from_chain(Depsgraph *UNUSED(depsgraph),
int color_idx = 0;
Object *orig_ob = NULL;
- if (ob) {
- orig_ob = ob->id.orig_id ? (Object *)ob->id.orig_id : ob;
+ if (source_object) {
+ orig_ob = source_object->id.orig_id ? (Object *)source_object->id.orig_id : source_object;
}
Collection *orig_col = NULL;
- if (col) {
- orig_col = col->id.orig_id ? (Collection *)col->id.orig_id : col;
+ if (source_collection) {
+ orig_col = source_collection->id.orig_id ? (Collection *)source_collection->id.orig_id :
+ source_collection;
}
float mat[4][4];
unit_m4(mat);
@@ -3788,6 +3790,7 @@ void ED_lineart_gpencil_generate_from_chain(Depsgraph *UNUSED(depsgraph),
stroke_data[array_idx] = rlci->gpos[0];
stroke_data[array_idx + 1] = rlci->gpos[1];
stroke_data[array_idx + 2] = rlci->gpos[2];
+ mul_m4_v3(gp_obmat_inverse, &stroke_data[array_idx]);
stroke_data[array_idx + 3] = 1; /* thickness */
stroke_data[array_idx + 4] = opacity; /* hardness? */
array_idx += 5;
@@ -3842,13 +3845,16 @@ void ED_lineart_gpencil_generate_strokes_direct(Depsgraph *depsgraph,
source_collection = (Collection *)source_reference;
use_types = line_types;
}
+ float gp_obmat_inverse[16];
+ invert_m4_m4(gp_obmat_inverse, ob->obmat);
ED_lineart_gpencil_generate_from_chain(depsgraph,
- source_object,
+ gp_obmat_inverse,
gpl,
gpf,
level_start,
level_end,
mat_nr,
+ source_object,
source_collection,
use_types,
transparency_flags,
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index 4cfaf6131a6..c7629616dbb 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -84,7 +84,6 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
static void generate_strokes_actual(
GpencilModifierData *md, Depsgraph *depsgraph, Object *ob, bGPDlayer *gpl, bGPDframe *gpf)
{
- Scene *scene = DEG_get_evaluated_scene(depsgraph);
LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md;
#if 0
int line_types = ((scene->flag & LRT_EVERYTHING_AS_CONTOUR) ?
@@ -259,6 +258,8 @@ static void updateDepsgraph(GpencilModifierData *md,
const ModifierUpdateDepsgraphContext *ctx,
const int mode)
{
+ DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Line Art Modifier");
+
LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md;
if (lmd->source_type == LRT_SOURCE_OBJECT && lmd->source_object) {
DEG_add_object_relation(
More information about the Bf-blender-cvs
mailing list