Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
| Show First 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | if (!mmd->object) { | ||||
| return; | return; | ||||
| } | } | ||||
| gpencil_deform_verts(mmd, ob, gps); | gpencil_deform_verts(mmd, ob, gps); | ||||
| /* Calc geometry data. */ | /* Calc geometry data. */ | ||||
| BKE_gpencil_stroke_geometry_update(gps); | BKE_gpencil_stroke_geometry_update(gps); | ||||
| } | } | ||||
| static void bakeModifier(Main *bmain, Depsgraph *depsgraph, GpencilModifierData *md, Object *ob) | static void bakeModifier(Main *UNUSED(bmain), | ||||
| Depsgraph *depsgraph, | |||||
| GpencilModifierData *md, | |||||
| Object *ob) | |||||
| { | { | ||||
| Scene *scene = DEG_get_evaluated_scene(depsgraph); | Scene *scene = DEG_get_evaluated_scene(depsgraph); | ||||
| Object *object_eval = DEG_get_evaluated_object(depsgraph, ob); | Object *object_eval = DEG_get_evaluated_object(depsgraph, ob); | ||||
| ArmatureGpencilModifierData *mmd = (ArmatureGpencilModifierData *)md; | ArmatureGpencilModifierData *mmd = (ArmatureGpencilModifierData *)md; | ||||
| GpencilModifierData *md_eval = BKE_gpencil_modifiers_findby_name(object_eval, md->name); | GpencilModifierData *md_eval = BKE_gpencil_modifiers_findby_name(object_eval, md->name); | ||||
| bGPdata *gpd = (bGPdata *)ob->data; | bGPdata *gpd = (bGPdata *)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 armature effects on this frame | /* apply armature effects on this frame | ||||
| * NOTE: this assumes that we don't want armature animation on non-keyframed frames | * NOTE: this assumes that we don't want armature 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 armature effects on this frame */ | /* compute armature effects on this frame */ | ||||
| LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { | LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { | ||||
| deformStroke(md_eval, depsgraph, object_eval, gpl, gpf, gps); | deformStroke(md_eval, depsgraph, object_eval, 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 bool isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams)) | static bool isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams)) | ||||
| { | { | ||||
| ArmatureGpencilModifierData *mmd = (ArmatureGpencilModifierData *)md; | ArmatureGpencilModifierData *mmd = (ArmatureGpencilModifierData *)md; | ||||
| /* The object type check is only needed here in case we have a placeholder | /* The object type check is only needed here in case we have a placeholder | ||||
| * object assigned (because the library containing the armature is missing). | * object assigned (because the library containing the armature is missing). | ||||
| ▲ Show 20 Lines • Show All 81 Lines • Show Last 20 Lines | |||||