Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
| Show First 20 Lines • Show All 274 Lines • ▼ Show 20 Lines | static void deformStroke(GpencilModifierData *md, | ||||
| } | } | ||||
| /* Calc geometry data. */ | /* Calc geometry data. */ | ||||
| BKE_gpencil_stroke_geometry_update(gps); | BKE_gpencil_stroke_geometry_update(gps); | ||||
| } | } | ||||
| /* FIXME: Ideally we be doing this on a copy of the main depsgraph | /* FIXME: Ideally we be doing this on a copy of the main depsgraph | ||||
| * (i.e. one where we don't have to worry about restoring state) | * (i.e. one where we don't have to worry about restoring state) | ||||
| */ | */ | ||||
| static void bakeModifier(Main *bmain, Depsgraph *depsgraph, GpencilModifierData *md, Object *ob) | static void bakeModifier(Main *UNUSED(bmain), | ||||
| Depsgraph *depsgraph, | |||||
| GpencilModifierData *md, | |||||
| Object *ob) | |||||
| { | { | ||||
| HookGpencilModifierData *mmd = (HookGpencilModifierData *)md; | HookGpencilModifierData *mmd = (HookGpencilModifierData *)md; | ||||
| Scene *scene = DEG_get_evaluated_scene(depsgraph); | Scene *scene = DEG_get_evaluated_scene(depsgraph); | ||||
| bGPdata *gpd = ob->data; | bGPdata *gpd = ob->data; | ||||
| int oldframe = (int)DEG_get_ctime(depsgraph); | int oldframe = (int)DEG_get_ctime(depsgraph); | ||||
| if (mmd->object == NULL) { | if (mmd->object == NULL) { | ||||
| return; | return; | ||||
| } | } | ||||
| LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { | LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { | ||||
| LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) { | LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) { | ||||
| /* apply hook effects on this frame | /* apply hook effects on this frame | ||||
| * NOTE: this assumes that we don't want hook animation on non-keyframed frames | * NOTE: this assumes that we don't want hook animation on non-keyframed frames | ||||
| */ | */ | ||||
| CFRA = gpf->framenum; | CFRA = gpf->framenum; | ||||
| BKE_scene_graph_update_for_newframe(depsgraph, bmain); | BKE_scene_graph_update_for_newframe(depsgraph); | ||||
| /* compute hook effects on this frame */ | /* compute hook effects on this frame */ | ||||
| LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { | LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { | ||||
| deformStroke(md, depsgraph, ob, gpl, gpf, gps); | deformStroke(md, depsgraph, ob, gpl, gpf, gps); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* return frame state and DB to original state */ | /* return frame state and DB to original state */ | ||||
| CFRA = oldframe; | CFRA = oldframe; | ||||
| BKE_scene_graph_update_for_newframe(depsgraph, bmain); | BKE_scene_graph_update_for_newframe(depsgraph); | ||||
| } | } | ||||
| static void freeData(GpencilModifierData *md) | static void freeData(GpencilModifierData *md) | ||||
| { | { | ||||
| HookGpencilModifierData *mmd = (HookGpencilModifierData *)md; | HookGpencilModifierData *mmd = (HookGpencilModifierData *)md; | ||||
| if (mmd->curfalloff) { | if (mmd->curfalloff) { | ||||
| BKE_curvemapping_free(mmd->curfalloff); | BKE_curvemapping_free(mmd->curfalloff); | ||||
| ▲ Show 20 Lines • Show All 138 Lines • Show Last 20 Lines | |||||