Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_conversions.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 6,625 Lines • ▼ Show 20 Lines | |||||
| void autokeyframe_object(bContext *C, Scene *scene, ViewLayer *view_layer, Object *ob, int tmode) | void autokeyframe_object(bContext *C, Scene *scene, ViewLayer *view_layer, Object *ob, int tmode) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| ID *id = &ob->id; | ID *id = &ob->id; | ||||
| FCurve *fcu; | FCurve *fcu; | ||||
| // TODO: this should probably be done per channel instead... | // TODO: this should probably be done per channel instead... | ||||
| if (autokeyframe_cfra_can_key(scene, id)) { | if (autokeyframe_cfra_can_key(scene, id)) { | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | |||||
| ReportList *reports = CTX_wm_reports(C); | ReportList *reports = CTX_wm_reports(C); | ||||
| ToolSettings *ts = scene->toolsettings; | ToolSettings *ts = scene->toolsettings; | ||||
| KeyingSet *active_ks = ANIM_scene_get_active_keyingset(scene); | KeyingSet *active_ks = ANIM_scene_get_active_keyingset(scene); | ||||
| ListBase dsources = {NULL, NULL}; | ListBase dsources = {NULL, NULL}; | ||||
| float cfra = (float)CFRA; // xxx this will do for now | float cfra = (float)CFRA; // xxx this will do for now | ||||
| short flag = 0; | short flag = 0; | ||||
| /* get flags used for inserting keyframes */ | /* get flags used for inserting keyframes */ | ||||
| Show All 14 Lines | else if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL)) { | ||||
| /* only key on available channels */ | /* only key on available channels */ | ||||
| if (adt && adt->action) { | if (adt && adt->action) { | ||||
| ListBase nla_cache = {NULL, NULL}; | ListBase nla_cache = {NULL, NULL}; | ||||
| for (fcu = adt->action->curves.first; fcu; fcu = fcu->next) { | for (fcu = adt->action->curves.first; fcu; fcu = fcu->next) { | ||||
| fcu->flag &= ~FCURVE_SELECTED; | fcu->flag &= ~FCURVE_SELECTED; | ||||
| insert_keyframe(bmain, | insert_keyframe(bmain, | ||||
| depsgraph, | |||||
| reports, | reports, | ||||
| id, | id, | ||||
| adt->action, | adt->action, | ||||
| (fcu->grp ? fcu->grp->name : NULL), | (fcu->grp ? fcu->grp->name : NULL), | ||||
| fcu->rna_path, | fcu->rna_path, | ||||
| fcu->array_index, | fcu->array_index, | ||||
| cfra, | cfra, | ||||
| ts->keyframe_type, | ts->keyframe_type, | ||||
| ▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | void autokeyframe_pose(bContext *C, Scene *scene, Object *ob, int tmode, short targetless_ik) | ||||
| AnimData *adt = ob->adt; | AnimData *adt = ob->adt; | ||||
| bAction *act = (adt) ? adt->action : NULL; | bAction *act = (adt) ? adt->action : NULL; | ||||
| bPose *pose = ob->pose; | bPose *pose = ob->pose; | ||||
| bPoseChannel *pchan; | bPoseChannel *pchan; | ||||
| FCurve *fcu; | FCurve *fcu; | ||||
| // TODO: this should probably be done per channel instead... | // TODO: this should probably be done per channel instead... | ||||
| if (autokeyframe_cfra_can_key(scene, id)) { | if (autokeyframe_cfra_can_key(scene, id)) { | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | |||||
| ReportList *reports = CTX_wm_reports(C); | ReportList *reports = CTX_wm_reports(C); | ||||
| ToolSettings *ts = scene->toolsettings; | ToolSettings *ts = scene->toolsettings; | ||||
| KeyingSet *active_ks = ANIM_scene_get_active_keyingset(scene); | KeyingSet *active_ks = ANIM_scene_get_active_keyingset(scene); | ||||
| ListBase nla_cache = {NULL, NULL}; | ListBase nla_cache = {NULL, NULL}; | ||||
| float cfra = (float)CFRA; | float cfra = (float)CFRA; | ||||
| short flag = 0; | short flag = 0; | ||||
| /* flag is initialized from UserPref keyframing settings | /* flag is initialized from UserPref keyframing settings | ||||
| Show All 31 Lines | for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { | ||||
| if (strstr(fcu->rna_path, "bones")) { | if (strstr(fcu->rna_path, "bones")) { | ||||
| char *pchanName = BLI_str_quoted_substrN(fcu->rna_path, "bones["); | char *pchanName = BLI_str_quoted_substrN(fcu->rna_path, "bones["); | ||||
| /* only if bone name matches too... | /* only if bone name matches too... | ||||
| * NOTE: this will do constraints too, but those are ok to do here too? | * NOTE: this will do constraints too, but those are ok to do here too? | ||||
| */ | */ | ||||
| if (pchanName && STREQ(pchanName, pchan->name)) { | if (pchanName && STREQ(pchanName, pchan->name)) { | ||||
| insert_keyframe(bmain, | insert_keyframe(bmain, | ||||
| depsgraph, | |||||
| reports, | reports, | ||||
| id, | id, | ||||
| act, | act, | ||||
| ((fcu->grp) ? (fcu->grp->name) : (NULL)), | ((fcu->grp) ? (fcu->grp->name) : (NULL)), | ||||
| fcu->rna_path, | fcu->rna_path, | ||||
| fcu->array_index, | fcu->array_index, | ||||
| cfra, | cfra, | ||||
| ts->keyframe_type, | ts->keyframe_type, | ||||
| ▲ Show 20 Lines • Show All 2,870 Lines • Show Last 20 Lines | |||||