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,623 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 10 Lines | if (IS_AUTOKEY_FLAG(scene, ONLYKEYINGSET) && (active_ks)) { | ||||
| ANIM_apply_keyingset(C, &dsources, NULL, active_ks, MODIFYKEY_MODE_INSERT, cfra); | ANIM_apply_keyingset(C, &dsources, NULL, active_ks, MODIFYKEY_MODE_INSERT, cfra); | ||||
| } | } | ||||
| else if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL)) { | else if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL)) { | ||||
| AnimData *adt = ob->adt; | AnimData *adt = ob->adt; | ||||
| /* 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}; | ||||
| Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | |||||
| 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, | depsgraph, | ||||
| reports, | reports, | ||||
| id, | id, | ||||
| adt->action, | adt->action, | ||||
| (fcu->grp ? fcu->grp->name : NULL), | (fcu->grp ? fcu->grp->name : NULL), | ||||
| ▲ Show 20 Lines • Show All 102 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 21 Lines | for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { | ||||
| /* only insert into active keyingset? */ | /* only insert into active keyingset? */ | ||||
| if (IS_AUTOKEY_FLAG(scene, ONLYKEYINGSET) && (active_ks)) { | if (IS_AUTOKEY_FLAG(scene, ONLYKEYINGSET) && (active_ks)) { | ||||
| /* run the active Keying Set on the current datasource */ | /* run the active Keying Set on the current datasource */ | ||||
| ANIM_apply_keyingset(C, &dsources, NULL, active_ks, MODIFYKEY_MODE_INSERT, cfra); | ANIM_apply_keyingset(C, &dsources, NULL, active_ks, MODIFYKEY_MODE_INSERT, cfra); | ||||
| } | } | ||||
| /* only insert into available channels? */ | /* only insert into available channels? */ | ||||
| else if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL)) { | else if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL)) { | ||||
| if (act) { | if (act) { | ||||
| Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | |||||
brecht: I don't think this should be done inside a loop over bones, otherwise might get evaluated for… | |||||
sergeyAuthorUnsubmitted Done Inline ActionsIS no longer needed anyway (insert_keyframe does no longer need depsgraph), sergey: IS no longer needed anyway (`insert_keyframe` does no longer need `depsgraph`), | |||||
| for (fcu = act->curves.first; fcu; fcu = fcu->next) { | for (fcu = act->curves.first; fcu; fcu = fcu->next) { | ||||
| /* only insert keyframes for this F-Curve if it affects the current bone */ | /* only insert keyframes for this F-Curve if it affects the current bone */ | ||||
| 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? | ||||
| */ | */ | ||||
| ▲ Show 20 Lines • Show All 2,189 Lines • ▼ Show 20 Lines | static void createTransGPencil_center_get(bGPDstroke *gps, float r_center[3]) | ||||
| if (tot_sel > 0) { | if (tot_sel > 0) { | ||||
| mul_v3_fl(r_center, 1.0f / tot_sel); | mul_v3_fl(r_center, 1.0f / tot_sel); | ||||
| } | } | ||||
| } | } | ||||
| static void createTransGPencil(bContext *C, TransInfo *t) | static void createTransGPencil(bContext *C, TransInfo *t) | ||||
| { | { | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| bGPdata *gpd = ED_gpencil_data_get_active(C); | bGPdata *gpd = ED_gpencil_data_get_active(C); | ||||
| ToolSettings *ts = CTX_data_tool_settings(C); | ToolSettings *ts = CTX_data_tool_settings(C); | ||||
| bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd); | bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd); | ||||
| bool use_multiframe_falloff = (ts->gp_sculpt.flag & GP_SCULPT_SETT_FLAG_FRAME_FALLOFF) != 0; | bool use_multiframe_falloff = (ts->gp_sculpt.flag & GP_SCULPT_SETT_FLAG_FRAME_FALLOFF) != 0; | ||||
| Object *obact = CTX_data_active_object(C); | Object *obact = CTX_data_active_object(C); | ||||
| bGPDlayer *gpl; | bGPDlayer *gpl; | ||||
| ▲ Show 20 Lines • Show All 675 Lines • Show Last 20 Lines | |||||
I don't think this should be done inside a loop over bones, otherwise might get evaluated for every bone?