Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
| Show First 20 Lines • Show All 50 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) | ||||
| { | { | ||||
| LatticeGpencilModifierData *gpmd = (LatticeGpencilModifierData *)md; | LatticeGpencilModifierData *gpmd = (LatticeGpencilModifierData *)md; | ||||
| gpmd->pass_index = 0; | gpmd->pass_index = 0; | ||||
| gpmd->layername[0] = '\0'; | gpmd->layername[0] = '\0'; | ||||
| gpmd->materialname[0] = '\0'; | gpmd->material = NULL; | ||||
| gpmd->vgname[0] = '\0'; | gpmd->vgname[0] = '\0'; | ||||
| gpmd->object = NULL; | gpmd->object = NULL; | ||||
| gpmd->cache_data = NULL; | gpmd->cache_data = NULL; | ||||
| gpmd->strength = 1.0f; | gpmd->strength = 1.0f; | ||||
| } | } | ||||
| 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); | ||||
| } | } | ||||
| static void deformStroke(GpencilModifierData *md, | static void deformStroke(GpencilModifierData *md, | ||||
| Depsgraph *UNUSED(depsgraph), | Depsgraph *UNUSED(depsgraph), | ||||
| Object *ob, | Object *ob, | ||||
| bGPDlayer *gpl, | bGPDlayer *gpl, | ||||
| bGPDframe *UNUSED(gpf), | bGPDframe *UNUSED(gpf), | ||||
| bGPDstroke *gps) | bGPDstroke *gps) | ||||
| { | { | ||||
| LatticeGpencilModifierData *mmd = (LatticeGpencilModifierData *)md; | LatticeGpencilModifierData *mmd = (LatticeGpencilModifierData *)md; | ||||
| const int def_nr = BKE_object_defgroup_name_index(ob, mmd->vgname); | const int def_nr = BKE_object_defgroup_name_index(ob, mmd->vgname); | ||||
| if (!is_stroke_affected_by_modifier(ob, | if (!is_stroke_affected_by_modifier(ob, | ||||
| mmd->layername, | mmd->layername, | ||||
| mmd->materialname, | mmd->material, | ||||
| mmd->pass_index, | mmd->pass_index, | ||||
| mmd->layer_pass, | mmd->layer_pass, | ||||
| 1, | 1, | ||||
| gpl, | gpl, | ||||
| gps, | gps, | ||||
| mmd->flag & GP_LATTICE_INVERT_LAYER, | mmd->flag & GP_LATTICE_INVERT_LAYER, | ||||
| mmd->flag & GP_LATTICE_INVERT_PASS, | mmd->flag & GP_LATTICE_INVERT_PASS, | ||||
| mmd->flag & GP_LATTICE_INVERT_LAYERPASS, | mmd->flag & GP_LATTICE_INVERT_LAYERPASS, | ||||
| ▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | static void foreachObjectLink(GpencilModifierData *md, | ||||
| ObjectWalkFunc walk, | ObjectWalkFunc walk, | ||||
| void *userData) | void *userData) | ||||
| { | { | ||||
| LatticeGpencilModifierData *mmd = (LatticeGpencilModifierData *)md; | LatticeGpencilModifierData *mmd = (LatticeGpencilModifierData *)md; | ||||
| walk(userData, ob, &mmd->object, IDWALK_CB_NOP); | walk(userData, ob, &mmd->object, IDWALK_CB_NOP); | ||||
| } | } | ||||
| static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk, void *userData) | |||||
| { | |||||
| LatticeGpencilModifierData *mmd = (LatticeGpencilModifierData *)md; | |||||
| walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_NOP); | |||||
| foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData); | |||||
| } | |||||
| GpencilModifierTypeInfo modifierType_Gpencil_Lattice = { | GpencilModifierTypeInfo modifierType_Gpencil_Lattice = { | ||||
| /* name */ "Lattice", | /* name */ "Lattice", | ||||
| /* structName */ "LatticeGpencilModifierData", | /* structName */ "LatticeGpencilModifierData", | ||||
| /* structSize */ sizeof(LatticeGpencilModifierData), | /* structSize */ sizeof(LatticeGpencilModifierData), | ||||
| /* type */ eGpencilModifierTypeType_Gpencil, | /* type */ eGpencilModifierTypeType_Gpencil, | ||||
| /* flags */ eGpencilModifierTypeFlag_Single | eGpencilModifierTypeFlag_SupportsEditmode, | /* flags */ eGpencilModifierTypeFlag_Single | eGpencilModifierTypeFlag_SupportsEditmode, | ||||
| /* copyData */ copyData, | /* copyData */ copyData, | ||||
| /* deformStroke */ deformStroke, | /* deformStroke */ deformStroke, | ||||
| /* generateStrokes */ NULL, | /* generateStrokes */ NULL, | ||||
| /* bakeModifier */ bakeModifier, | /* bakeModifier */ bakeModifier, | ||||
| /* remapTime */ NULL, | /* remapTime */ NULL, | ||||
| /* initData */ initData, | /* initData */ initData, | ||||
| /* freeData */ freeData, | /* freeData */ freeData, | ||||
| /* isDisabled */ isDisabled, | /* isDisabled */ isDisabled, | ||||
| /* updateDepsgraph */ updateDepsgraph, | /* updateDepsgraph */ updateDepsgraph, | ||||
| /* dependsOnTime */ NULL, | /* dependsOnTime */ NULL, | ||||
| /* foreachObjectLink */ foreachObjectLink, | /* foreachObjectLink */ foreachObjectLink, | ||||
| /* foreachIDLink */ NULL, | /* foreachIDLink */ foreachIDLink, | ||||
| /* foreachTexLink */ NULL, | /* foreachTexLink */ NULL, | ||||
| }; | }; | ||||