Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c
| Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | |||||
| #include "DEG_depsgraph_build.h" | #include "DEG_depsgraph_build.h" | ||||
| #include "DEG_depsgraph_query.h" | #include "DEG_depsgraph_query.h" | ||||
| static void initData(GpencilModifierData *md) | static void initData(GpencilModifierData *md) | ||||
| { | { | ||||
| MirrorGpencilModifierData *gpmd = (MirrorGpencilModifierData *)md; | MirrorGpencilModifierData *gpmd = (MirrorGpencilModifierData *)md; | ||||
| gpmd->pass_index = 0; | gpmd->pass_index = 0; | ||||
| gpmd->layername[0] = '\0'; | gpmd->layername[0] = '\0'; | ||||
| gpmd->materialname[0] = '\0'; | |||||
| gpmd->object = NULL; | gpmd->object = NULL; | ||||
| gpmd->flag |= GP_MIRROR_AXIS_X; | gpmd->flag |= GP_MIRROR_AXIS_X; | ||||
| } | } | ||||
| static void copyData(const GpencilModifierData *md, GpencilModifierData *target) | static void copyData(const GpencilModifierData *md, GpencilModifierData *target) | ||||
| { | { | ||||
| BKE_gpencil_modifier_copyData_generic(md, target); | BKE_gpencil_modifier_copyData_generic(md, target); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | for (int xi = 0; xi < 3; ++xi) { | ||||
| if (mmd->flag & (GP_MIRROR_AXIS_X << xi)) { | if (mmd->flag & (GP_MIRROR_AXIS_X << xi)) { | ||||
| /* count strokes to avoid infinite loop after adding new strokes to tail of listbase */ | /* count strokes to avoid infinite loop after adding new strokes to tail of listbase */ | ||||
| tot_strokes = BLI_listbase_count(&gpf->strokes); | tot_strokes = BLI_listbase_count(&gpf->strokes); | ||||
| for (i = 0, gps = gpf->strokes.first; i < tot_strokes; i++, gps = gps->next) { | for (i = 0, gps = gpf->strokes.first; i < tot_strokes; i++, gps = gps->next) { | ||||
| if (is_stroke_affected_by_modifier(ob, | if (is_stroke_affected_by_modifier(ob, | ||||
| mmd->layername, | mmd->layername, | ||||
| mmd->materialname, | |||||
| mmd->pass_index, | mmd->pass_index, | ||||
| mmd->layer_pass, | mmd->layer_pass, | ||||
| 1, | 1, | ||||
| gpl, | gpl, | ||||
| gps, | gps, | ||||
| mmd->flag & GP_MIRROR_INVERT_LAYER, | mmd->flag & GP_MIRROR_INVERT_LAYER, | ||||
| mmd->flag & GP_MIRROR_INVERT_PASS, | mmd->flag & GP_MIRROR_INVERT_PASS, | ||||
| mmd->flag & GP_MIRROR_INVERT_LAYERPASS)) { | mmd->flag & GP_MIRROR_INVERT_LAYERPASS, | ||||
| mmd->flag & GP_MIRROR_INVERT_MATERIAL)) { | |||||
| gps_new = BKE_gpencil_stroke_duplicate(gps); | gps_new = BKE_gpencil_stroke_duplicate(gps); | ||||
| update_position(ob, mmd, gps_new, xi); | update_position(ob, mmd, gps_new, xi); | ||||
| BLI_addtail(&gpf->strokes, gps_new); | BLI_addtail(&gpf->strokes, gps_new); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 89 Lines • Show Last 20 Lines | |||||