diff options
Diffstat (limited to 'source/blender/gpencil_modifiers')
-rw-r--r-- | source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c index cddf3b7cfb5..9899d889c56 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c @@ -4217,9 +4217,6 @@ static void lineart_gpencil_generate(LineartCache *cache, /* (!orig_col && !orig_ob) means the whole scene is selected. */ - float mat[4][4]; - unit_m4(mat); - int enabled_types = cache->rb_edge_types; bool invert_input = modifier_flags & LRT_GPENCIL_INVERT_SOURCE_VGROUP; bool match_output = modifier_flags & LRT_GPENCIL_MATCH_OUTPUT_VGROUP; @@ -4271,29 +4268,20 @@ static void lineart_gpencil_generate(LineartCache *cache, /* Preserved: If we ever do asynchronous generation, this picked flag should be set here. */ // ec->picked = 1; - int array_idx = 0; - int count = MOD_lineart_chain_count(ec); + const int count = MOD_lineart_chain_count(ec); bGPDstroke *gps = BKE_gpencil_stroke_add(gpf, color_idx, count, thickness, false); - float *stroke_data = MEM_callocN(sizeof(float) * count * GP_PRIM_DATABUF_SIZE, - "line art add stroke"); - - LISTBASE_FOREACH (LineartEdgeChainItem *, eci, &ec->chain) { - stroke_data[array_idx] = eci->gpos[0]; - stroke_data[array_idx + 1] = eci->gpos[1]; - stroke_data[array_idx + 2] = eci->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; + int i; + LISTBASE_FOREACH_INDEX (LineartEdgeChainItem *, eci, &ec->chain, i) { + bGPDspoint *point = &gps->points[i]; + mul_v3_m4v3(&point->x, gp_obmat_inverse, eci->gpos); + point->pressure = 1.0f; + point->strength = opacity; } - BKE_gpencil_stroke_add_points(gps, stroke_data, count, mat); BKE_gpencil_dvert_ensure(gps); gps->mat_nr = max_ii(material_nr, 0); - MEM_freeN(stroke_data); - if (source_vgname && vgname) { Object *eval_ob = DEG_get_evaluated_object(depsgraph, ec->object_ref); int gpdg = -1; |