Blender V5.0
pose_slide.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2009 Blender Authors, Joshua Leung.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
30
31#include "MEM_guardedalloc.h"
32
33#include "BLI_array.hh"
34#include "BLI_listbase.h"
35#include "BLI_math_rotation.h"
36#include "BLI_string.h"
37
38#include "BLT_translation.hh"
39
40#include "DNA_anim_types.h"
41#include "DNA_object_types.h"
42#include "DNA_scene_types.h"
43
44#include "BKE_fcurve.hh"
45#include "BKE_nla.hh"
46
47#include "BKE_context.hh"
48#include "BKE_layer.hh"
49#include "BKE_report.hh"
50#include "BKE_scene.hh"
51#include "BKE_unit.hh"
52
53#include "RNA_access.hh"
54#include "RNA_define.hh"
55#include "RNA_prototypes.hh"
56
57#include "WM_api.hh"
58#include "WM_types.hh"
59
60#include "UI_interface.hh"
61
62#include "ED_keyframes_edit.hh"
64#include "ED_markers.hh"
65#include "ED_numinput.hh"
66#include "ED_screen.hh"
67#include "ED_util.hh"
68
69#include "ANIM_fcurve.hh"
70
71#include "armature_intern.hh"
72
73using blender::Vector;
74
75/* **************************************************** */
76/* A) Push & Relax, Breakdowner */
77
80 PS_LOCK_X = (1 << 0),
81 PS_LOCK_Y = (1 << 1),
82 PS_LOCK_Z = (1 << 2),
83};
84
96
99 PS_TFM_ALL = 0, /* All transforms and properties */
100
101 PS_TFM_LOC, /* Loc/Rot/Scale */
104
105 PS_TFM_BBONE_SHAPE, /* Bendy Bones */
106
107 PS_TFM_PROPS, /* Custom Properties */
108};
109
119
129
134
137
142
146 // short flag;
147
148 /* Store overlay settings when invoking the operator. Bones will be temporarily hidden. */
150
155
157
160
162};
163
166 {PS_TFM_ALL,
167 "ALL",
168 0,
169 "All Properties",
170 "All properties, including transforms, bendy bone shape, and custom properties"},
171 {PS_TFM_LOC, "LOC", 0, "Location", "Location only"},
172 {PS_TFM_ROT, "ROT", 0, "Rotation", "Rotation only"},
173 /* NOTE: `SIZE` identifier is only used for compatibility, should be `SCALE`. */
174 {PS_TFM_SCALE, "SIZE", 0, "Scale", "Scale only"},
175 {PS_TFM_BBONE_SHAPE, "BBONE", 0, "Bendy Bone", "Bendy Bone shape properties"},
176 {PS_TFM_PROPS, "CUSTOM", 0, "Custom Properties", "Custom properties"},
177 {0, nullptr, 0, nullptr, nullptr},
178};
179
180/* Property enum for ePoseSlide_AxisLock */
182 {0, "FREE", 0, "Free", "All axes are affected"},
183 {PS_LOCK_X, "X", 0, "X", "Only X-axis transforms are affected"},
184 {PS_LOCK_Y, "Y", 0, "Y", "Only Y-axis transforms are affected"},
185 {PS_LOCK_Z, "Z", 0, "Z", "Only Z-axis transforms are affected"}, /* TODO: Combinations? */
186 {0, nullptr, 0, nullptr, nullptr},
187};
188
189/* ------------------------------------ */
190
193{
194 tPoseSlideOp *pso = MEM_new<tPoseSlideOp>(__func__);
195 op->customdata = pso;
196
197 /* Get info from context. */
198 pso->scene = CTX_data_scene(C);
199 pso->area = CTX_wm_area(C); /* Only really needed when doing modal(). */
200 pso->region = CTX_wm_region(C); /* Only really needed when doing modal(). */
201
202 pso->current_frame = pso->scene->r.cfra;
203 pso->mode = mode;
204
205 /* Set range info from property values - these may get overridden for the invoke(). */
206 pso->prev_frame = RNA_int_get(op->ptr, "prev_frame");
207 pso->next_frame = RNA_int_get(op->ptr, "next_frame");
208
209 /* Get the set of properties/axes that can be operated on. */
210 pso->channels = ePoseSlide_Channels(RNA_enum_get(op->ptr, "channels"));
211 pso->axislock = ePoseSlide_AxisLock(RNA_enum_get(op->ptr, "axis_lock"));
212
213 pso->slider = ED_slider_create(C);
214 ED_slider_factor_set(pso->slider, RNA_float_get(op->ptr, "factor"));
215
216 /* For each Pose-Channel which gets affected, get the F-Curves for that channel
217 * and set the relevant transform flags. */
219
222 pso->ob_data_array.reinitialize(objects.size());
223
224 for (const int ob_index : objects.index_range()) {
225 tPoseSlideObject *ob_data = &pso->ob_data_array[ob_index];
226 Object *ob_iter = poseAnim_object_get(objects[ob_index]);
227
228 /* Ensure validity of the settings from the context. */
229 if (ob_iter == nullptr) {
230 continue;
231 }
232
233 ob_data->ob = ob_iter;
234 ob_data->valid = true;
235
236 /* Apply NLA mapping corrections so the frame look-ups work. */
238 ob_data->ob->adt, pso->prev_frame, NLATIME_CONVERT_UNMAP);
240 ob_data->ob->adt, pso->next_frame, NLATIME_CONVERT_UNMAP);
241
242 /* Set depsgraph flags. */
243 /* Make sure the lock is set OK, unlock can be accidentally saved? */
244 ob_data->ob->pose->flag |= POSE_LOCKED;
245 ob_data->ob->pose->flag &= ~POSE_DO_UNLOCK;
246 }
247
248 /* Do basic initialize of RB-BST used for finding keyframes, but leave the filling of it up
249 * to the caller of this (usually only invoke() will do it, to make things more efficient). */
250 pso->keylist = ED_keylist_create();
251
252 /* Initialize numeric input. */
253 initNumInput(&pso->num);
254 pso->num.idx_max = 0; /* One axis. */
255 pso->num.unit_type[0] = B_UNIT_NONE; /* Percentages don't have any units. */
256
257 if (pso->area && (pso->area->spacetype == SPACE_VIEW3D)) {
258 /* Save current bone visibility. */
259 View3D *v3d = static_cast<View3D *>(pso->area->spacedata.first);
260 pso->overlay_flag = v3d->overlay.flag;
261 }
262
263 /* Return status is whether we've got all the data we were requested to get. */
264 return 1;
265}
266
271{
272 tPoseSlideOp *pso = static_cast<tPoseSlideOp *>(op->customdata);
273
275
276 /* Hide Bone Overlay. */
277 if (pso->area && (pso->area->spacetype == SPACE_VIEW3D)) {
278 View3D *v3d = static_cast<View3D *>(pso->area->spacedata.first);
279 v3d->overlay.flag = pso->overlay_flag;
280 }
281
282 /* Free the temp pchan links and their data. */
284
285 /* Free RB-BST for keyframes (if it contained data). */
287
288 /* Free data itself. */
289 MEM_delete(pso);
290
291 /* Cleanup. */
292 op->customdata = nullptr;
293}
294
295/* ------------------------------------ */
296
301{
302 /* Wrapper around the generic version, allowing us to add some custom stuff later still. */
303 for (tPoseSlideObject &ob_data : pso->ob_data_array) {
304 if (ob_data.valid) {
305 poseAnim_mapping_refresh(C, pso->scene, ob_data.ob);
306 }
307 }
308}
309
315 Object *ob,
316 float *prev_frame,
317 float *next_frame)
318{
319 for (tPoseSlideObject &ob_data : pso->ob_data_array) {
320 Object *ob_iter = ob_data.ob;
321
322 if (ob_iter == ob) {
323 *prev_frame = ob_data.prev_frame;
324 *next_frame = ob_data.next_frame;
325 return true;
326 }
327 }
328 *prev_frame = *next_frame = 0.0f;
329 return false;
330}
331
335static void pose_slide_apply_val(tPoseSlideOp *pso, const FCurve *fcu, Object *ob, float *val)
336{
337 float prev_frame, next_frame;
338 float prev_weight, next_weight;
339 pose_frame_range_from_object_get(pso, ob, &prev_frame, &next_frame);
340
341 const float factor = ED_slider_factor_get(pso->slider);
342 const float current_frame = float(pso->current_frame);
343
344 /* Calculate the relative weights of the endpoints. */
345 if (pso->mode == POSESLIDE_BREAKDOWN) {
346 /* Get weights from the factor control. */
347 next_weight = factor;
348 prev_weight = 1.0f - next_weight;
349 }
350 else {
351 /* - these weights are derived from the relative distance of these
352 * poses from the current frame
353 * - they then get normalized so that they only sum up to 1
354 */
355
356 next_weight = current_frame - float(pso->prev_frame);
357 prev_weight = float(pso->next_frame) - current_frame;
358
359 const float total_weight = next_weight + prev_weight;
360 next_weight = (next_weight / total_weight);
361 prev_weight = (prev_weight / total_weight);
362 }
363
364 /* Get keyframe values for endpoint poses to blend with. */
365 /* Previous/start. */
366 const float prev_frame_y = evaluate_fcurve(fcu, prev_frame);
367 const float next_frame_y = evaluate_fcurve(fcu, next_frame);
368
369 /* Depending on the mode, calculate the new value. */
370 switch (pso->mode) {
371 case POSESLIDE_PUSH: /* Make the current pose more pronounced. */
372 {
373 /* Slide the pose away from the breakdown pose in the timeline */
374 (*val) -= ((prev_frame_y * prev_weight) + (next_frame_y * next_weight) - (*val)) * factor;
375 break;
376 }
377 case POSESLIDE_RELAX: /* Make the current pose more like its surrounding ones. */
378 {
379 /* Slide the pose towards the breakdown pose in the timeline */
380 (*val) += ((prev_frame_y * prev_weight) + (next_frame_y * next_weight) - (*val)) * factor;
381 break;
382 }
383 case POSESLIDE_BREAKDOWN: /* Make the current pose slide around between the endpoints. */
384 {
385 /* Perform simple linear interpolation. */
386 (*val) = interpf(next_frame_y, prev_frame_y, factor);
387 break;
388 }
389 case POSESLIDE_BLEND: /* Blend the current pose with the previous (<50%) or next key (>50%). */
390 {
391 const float current_frame_y = evaluate_fcurve(fcu, current_frame);
392 /* Convert factor to absolute 0-1 range which is needed for `interpf`. */
393 const float blend_factor = fabs((factor - 0.5f) * 2);
394
395 if (factor < 0.5) {
396 /* Blend to previous key. */
397 (*val) = interpf(prev_frame_y, current_frame_y, blend_factor);
398 }
399 else {
400 /* Blend to next key. */
401 (*val) = interpf(next_frame_y, current_frame_y, blend_factor);
402 }
403
404 break;
405 }
406 /* Those are handled in pose_slide_rest_pose_apply. */
408 break;
409 }
410 }
411}
412
417 tPChanFCurveLink *pfl,
418 float vec[3],
419 const char propName[])
420{
421 LinkData *ld = nullptr;
422 char *path = nullptr;
423
424 /* Get the path to use. */
425 path = BLI_sprintfN("%s.%s", pfl->pchan_path, propName);
426
427 /* Using this path, find each matching F-Curve for the variables we're interested in. */
428 while ((ld = poseAnim_mapping_getNextFCurve(&pfl->fcurves, ld, path))) {
429 FCurve *fcu = static_cast<FCurve *>(ld->data);
430 const int idx = fcu->array_index;
431 const int lock = pso->axislock;
432
433 /* Check if this F-Curve is ok given the current axis locks. */
434 BLI_assert(fcu->array_index < 3);
435
436 if ((lock == 0) || ((lock & PS_LOCK_X) && (idx == 0)) || ((lock & PS_LOCK_Y) && (idx == 1)) ||
437 ((lock & PS_LOCK_Z) && (idx == 2)))
438 {
439 /* Just work on these channels one by one... there's no interaction between values. */
440 pose_slide_apply_val(pso, fcu, pfl->ob, &vec[fcu->array_index]);
441 }
442 }
443
444 /* Free the temp path we got. */
445 MEM_freeN(path);
446}
447
452 tPChanFCurveLink *pfl,
453 const char prop_prefix[])
454{
455 int len = strlen(pfl->pchan_path);
456
457 /* Setup pointer RNA for resolving paths. */
458 PointerRNA ptr = RNA_pointer_create_discrete(nullptr, &RNA_PoseBone, pfl->pchan);
459
460 /* - custom properties are just denoted using ["..."][etc.] after the end of the base path,
461 * so just check for opening pair after the end of the path
462 * - bbone properties are similar, but they always start with a prefix "bbone_*",
463 * so a similar method should work here for those too
464 */
465 LISTBASE_FOREACH (LinkData *, ld, &pfl->fcurves) {
466 FCurve *fcu = static_cast<FCurve *>(ld->data);
467 const char *bPtr, *pPtr;
468
469 if (fcu->rna_path == nullptr) {
470 continue;
471 }
472
473 /* Do we have a match?
474 * - bPtr is the RNA Path with the standard part chopped off.
475 * - pPtr is the chunk of the path which is left over.
476 */
477 bPtr = strstr(fcu->rna_path, pfl->pchan_path) + len;
478 pPtr = strstr(bPtr, prop_prefix);
479
480 if (pPtr) {
481 /* Use RNA to try and get a handle on this property, then, assuming that it is just
482 * numerical, try and grab the value as a float for temp editing before setting back. */
484
485 if (prop) {
486 switch (RNA_property_type(prop)) {
487 /* Continuous values that can be smoothly interpolated. */
488 case PROP_FLOAT: {
489 const bool is_array = RNA_property_array_check(prop);
490 float tval;
491 if (is_array) {
492 if (UNLIKELY(uint(fcu->array_index) >= RNA_property_array_length(&ptr, prop))) {
493 break; /* Out of range, skip. */
494 }
495 tval = RNA_property_float_get_index(&ptr, prop, fcu->array_index);
496 }
497 else {
498 tval = RNA_property_float_get(&ptr, prop);
499 }
500
501 pose_slide_apply_val(pso, fcu, pfl->ob, &tval);
502
503 if (is_array) {
504 RNA_property_float_set_index(&ptr, prop, fcu->array_index, tval);
505 }
506 else {
507 RNA_property_float_set(&ptr, prop, tval);
508 }
509 break;
510 }
511 case PROP_INT: {
512 const bool is_array = RNA_property_array_check(prop);
513 float tval;
514 if (is_array) {
515 if (UNLIKELY(uint(fcu->array_index) >= RNA_property_array_length(&ptr, prop))) {
516 break; /* Out of range, skip. */
517 }
518 tval = RNA_property_int_get_index(&ptr, prop, fcu->array_index);
519 }
520 else {
521 tval = RNA_property_int_get(&ptr, prop);
522 }
523
524 pose_slide_apply_val(pso, fcu, pfl->ob, &tval);
525
526 if (is_array) {
527 RNA_property_int_set_index(&ptr, prop, fcu->array_index, tval);
528 }
529 else {
530 RNA_property_int_set(&ptr, prop, tval);
531 }
532 break;
533 }
534
535 /* Values which can only take discrete values. */
536 case PROP_BOOLEAN: {
537 const bool is_array = RNA_property_array_check(prop);
538 float tval;
539 if (is_array) {
540 if (UNLIKELY(uint(fcu->array_index) >= RNA_property_array_length(&ptr, prop))) {
541 break; /* Out of range, skip. */
542 }
544 }
545 else {
546 tval = float(RNA_property_boolean_get(&ptr, prop));
547 }
548
549 pose_slide_apply_val(pso, fcu, pfl->ob, &tval);
550
551 /* XXX: do we need threshold clamping here? */
552 if (is_array) {
554 }
555 else {
556 RNA_property_boolean_set(&ptr, prop, tval);
557 }
558 break;
559 }
560 case PROP_ENUM: {
561 /* Don't handle this case - these don't usually represent interchangeable
562 * set of values which should be interpolated between. */
563 break;
564 }
565
566 default:
567 /* Cannot handle. */
568 // printf("Cannot Pose Slide non-numerical property\n");
569 break;
570 }
571 }
572 }
573 }
574}
575
580{
581 const FCurve *fcu_w = nullptr, *fcu_x = nullptr, *fcu_y = nullptr, *fcu_z = nullptr;
582 bPoseChannel *pchan = pfl->pchan;
583 LinkData *ld = nullptr;
584 char *path = nullptr;
585 float prev_frame, next_frame;
586
587 if (!pose_frame_range_from_object_get(pso, pfl->ob, &prev_frame, &next_frame)) {
588 BLI_assert_msg(0, "Invalid pfl data");
589 return;
590 }
591
592 /* Get the path to use - this should be quaternion rotations only (needs care). */
593 path = BLI_sprintfN("%s.%s", pfl->pchan_path, "rotation_quaternion");
594
595 /* Get the current frame number. */
596 const float current_frame = float(pso->current_frame);
597 const float factor = ED_slider_factor_get(pso->slider);
598
599 /* Using this path, find each matching F-Curve for the variables we're interested in. */
600 while ((ld = poseAnim_mapping_getNextFCurve(&pfl->fcurves, ld, path))) {
601 FCurve *fcu = static_cast<FCurve *>(ld->data);
602
603 /* Assign this F-Curve to one of the relevant pointers. */
604 switch (fcu->array_index) {
605 case 3: /* z */
606 fcu_z = fcu;
607 break;
608 case 2: /* y */
609 fcu_y = fcu;
610 break;
611 case 1: /* x */
612 fcu_x = fcu;
613 break;
614 case 0: /* w */
615 fcu_w = fcu;
616 break;
617 }
618 }
619
620 /* Only if all channels exist, proceed. */
621 if (fcu_w && fcu_x && fcu_y && fcu_z) {
622 float quat_final[4];
623
624 /* Perform blending. */
626 float quat_prev[4], quat_next[4];
627
628 quat_prev[0] = evaluate_fcurve(fcu_w, prev_frame);
629 quat_prev[1] = evaluate_fcurve(fcu_x, prev_frame);
630 quat_prev[2] = evaluate_fcurve(fcu_y, prev_frame);
631 quat_prev[3] = evaluate_fcurve(fcu_z, prev_frame);
632
633 quat_next[0] = evaluate_fcurve(fcu_w, next_frame);
634 quat_next[1] = evaluate_fcurve(fcu_x, next_frame);
635 quat_next[2] = evaluate_fcurve(fcu_y, next_frame);
636 quat_next[3] = evaluate_fcurve(fcu_z, next_frame);
637
638 normalize_qt(quat_prev);
639 normalize_qt(quat_next);
640
641 if (pso->mode == POSESLIDE_BREAKDOWN) {
642 /* Just perform the interpolation between quat_prev and
643 * quat_next using pso->factor as a guide. */
644 interp_qt_qtqt(quat_final, quat_prev, quat_next, factor);
645 }
646 else {
647 float quat_curr[4], quat_breakdown[4];
648
649 normalize_qt_qt(quat_curr, pchan->quat);
650
651 /* Compute breakdown based on actual frame range. */
652 const float interp_factor = (current_frame - pso->prev_frame) /
653 float(pso->next_frame - pso->prev_frame);
654
655 interp_qt_qtqt(quat_breakdown, quat_prev, quat_next, interp_factor);
656
657 if (pso->mode == POSESLIDE_PUSH) {
658 interp_qt_qtqt(quat_final, quat_breakdown, quat_curr, 1.0f + factor);
659 }
660 else {
662 interp_qt_qtqt(quat_final, quat_curr, quat_breakdown, factor);
663 }
664 }
665 }
666 else if (pso->mode == POSESLIDE_BLEND) {
667 float quat_blend[4];
668 float quat_curr[4];
669
670 copy_qt_qt(quat_curr, pchan->quat);
671
672 if (factor < 0.5) {
673 quat_blend[0] = evaluate_fcurve(fcu_w, prev_frame);
674 quat_blend[1] = evaluate_fcurve(fcu_x, prev_frame);
675 quat_blend[2] = evaluate_fcurve(fcu_y, prev_frame);
676 quat_blend[3] = evaluate_fcurve(fcu_z, prev_frame);
677 }
678 else {
679 quat_blend[0] = evaluate_fcurve(fcu_w, next_frame);
680 quat_blend[1] = evaluate_fcurve(fcu_x, next_frame);
681 quat_blend[2] = evaluate_fcurve(fcu_y, next_frame);
682 quat_blend[3] = evaluate_fcurve(fcu_z, next_frame);
683 }
684
685 normalize_qt(quat_blend);
686 normalize_qt(quat_curr);
687
688 const float blend_factor = fabs((factor - 0.5f) * 2);
689
690 interp_qt_qtqt(quat_final, quat_curr, quat_blend, blend_factor);
691 }
692
693 /* Apply final to the pose bone, keeping compatible for similar keyframe positions. */
694 quat_to_compatible_quat(pchan->quat, quat_final, pchan->quat);
695 }
696
697 /* Free the path now. */
698 MEM_freeN(path);
699}
700
701static void pose_slide_rest_pose_apply_vec3(tPoseSlideOp *pso, float vec[3], float default_value)
702{
703 /* We only slide to the rest pose. So only use the default rest pose value. */
704 const int lock = pso->axislock;
705 const float factor = ED_slider_factor_get(pso->slider);
706 for (int idx = 0; idx < 3; idx++) {
707 if ((lock == 0) || ((lock & PS_LOCK_X) && (idx == 0)) || ((lock & PS_LOCK_Y) && (idx == 1)) ||
708 ((lock & PS_LOCK_Z) && (idx == 2)))
709 {
710 float diff_val = default_value - vec[idx];
711 vec[idx] += factor * diff_val;
712 }
713 }
714}
715
716static void pose_slide_rest_pose_apply_other_rot(tPoseSlideOp *pso, float vec[4], bool quat)
717{
718 /* We only slide to the rest pose. So only use the default rest pose value. */
719 float default_values[] = {1.0f, 0.0f, 0.0f, 0.0f};
720 if (!quat) {
721 /* Axis Angle */
722 default_values[0] = 0.0f;
723 default_values[2] = 1.0f;
724 }
725 const float factor = ED_slider_factor_get(pso->slider);
726 for (int idx = 0; idx < 4; idx++) {
727 float diff_val = default_values[idx] - vec[idx];
728 vec[idx] += factor * diff_val;
729 }
730}
731
736{
737 /* For each link, handle each set of transforms. */
739 /* Valid transforms for each #bPoseChannel should have been noted already.
740 * - Sliding the pose should be a straightforward exercise for location+rotation,
741 * but rotations get more complicated since we may want to use quaternion blending
742 * for quaternions instead.
743 */
744 bPoseChannel *pchan = pfl->pchan;
745
746 if (ELEM(pso->channels, PS_TFM_ALL, PS_TFM_LOC) && (pchan->flag & POSE_LOC)) {
747 /* Calculate these for the 'location' vector, and use location curves. */
748 pose_slide_rest_pose_apply_vec3(pso, pchan->loc, 0.0f);
749 }
750
751 if (ELEM(pso->channels, PS_TFM_ALL, PS_TFM_SCALE) && (pchan->flag & POSE_SCALE)) {
752 /* Calculate these for the 'scale' vector, and use scale curves. */
753 pose_slide_rest_pose_apply_vec3(pso, pchan->scale, 1.0f);
754 }
755
756 if (ELEM(pso->channels, PS_TFM_ALL, PS_TFM_ROT) && (pchan->flag & POSE_ROT)) {
757 /* Everything depends on the rotation mode. */
758 if (pchan->rotmode > 0) {
759 /* Eulers - so calculate these for the 'eul' vector, and use euler_rotation curves. */
760 pose_slide_rest_pose_apply_vec3(pso, pchan->eul, 0.0f);
761 }
762 else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
763 pose_slide_rest_pose_apply_other_rot(pso, pchan->quat, false);
764 }
765 else {
766 /* Quaternions - use quaternion blending. */
768 }
769 }
770
772 /* Bbone properties - they all start a "bbone_" prefix. */
773 /* TODO: Not implemented. */
774 // pose_slide_apply_props(pso, pfl, "bbone_");
775 }
776
777 if (ELEM(pso->channels, PS_TFM_ALL, PS_TFM_PROPS) && (pfl->oldprops)) {
778 /* Not strictly a transform, but custom properties contribute
779 * to the pose produced in many rigs (e.g. the facial rigs used in Sintel). */
780 /* TODO: Not implemented. */
781 // pose_slide_apply_props(pso, pfl, "[\"");
782 }
783 }
784
785 /* Depsgraph updates + redraws. */
786 pose_slide_refresh(C, pso);
787}
788
793{
794 /* Sanitize the frame ranges. */
795 if (pso->prev_frame == pso->next_frame) {
796 /* Move out one step either side. */
797 pso->prev_frame--;
798 pso->next_frame++;
799
800 for (tPoseSlideObject &ob_data : pso->ob_data_array) {
801 if (!ob_data.valid) {
802 continue;
803 }
804
805 /* Apply NLA mapping corrections so the frame look-ups work. */
807 ob_data.ob->adt, pso->prev_frame, NLATIME_CONVERT_UNMAP);
809 ob_data.ob->adt, pso->next_frame, NLATIME_CONVERT_UNMAP);
810 }
811 }
812
813 /* For each link, handle each set of transforms. */
815 /* Valid transforms for each #bPoseChannel should have been noted already
816 * - sliding the pose should be a straightforward exercise for location+rotation,
817 * but rotations get more complicated since we may want to use quaternion blending
818 * for quaternions instead...
819 */
820 bPoseChannel *pchan = pfl->pchan;
821
822 if (ELEM(pso->channels, PS_TFM_ALL, PS_TFM_LOC) && (pchan->flag & POSE_LOC)) {
823 /* Calculate these for the 'location' vector, and use location curves. */
824 pose_slide_apply_vec3(pso, pfl, pchan->loc, "location");
825 }
826
827 if (ELEM(pso->channels, PS_TFM_ALL, PS_TFM_SCALE) && (pchan->flag & POSE_SCALE)) {
828 /* Calculate these for the 'scale' vector, and use scale curves. */
829 pose_slide_apply_vec3(pso, pfl, pchan->scale, "scale");
830 }
831
832 if (ELEM(pso->channels, PS_TFM_ALL, PS_TFM_ROT) && (pchan->flag & POSE_ROT)) {
833 /* Everything depends on the rotation mode. */
834 if (pchan->rotmode > 0) {
835 /* Eulers - so calculate these for the 'eul' vector, and use euler_rotation curves. */
836 pose_slide_apply_vec3(pso, pfl, pchan->eul, "rotation_euler");
837 }
838 else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
839 /* TODO: need to figure out how to do this! */
840 }
841 else {
842 /* Quaternions - use quaternion blending. */
843 pose_slide_apply_quat(pso, pfl);
844 }
845 }
846
848 /* Bbone properties - they all start a "bbone_" prefix. */
849 pose_slide_apply_props(pso, pfl, "bbone_");
850 }
851
852 if (ELEM(pso->channels, PS_TFM_ALL, PS_TFM_PROPS) && (pfl->oldprops)) {
853 /* Not strictly a transform, but custom properties contribute
854 * to the pose produced in many rigs (e.g. the facial rigs used in Sintel). */
855 pose_slide_apply_props(pso, pfl, "[\"");
856 }
857 }
858
859 /* Depsgraph updates + redraws. */
860 pose_slide_refresh(C, pso);
861}
862
867{
868 /* Wrapper around the generic call. */
869 poseAnim_mapping_autoKeyframe(C, pso->scene, &pso->pfLinks, float(pso->current_frame));
870}
871
876{
877 /* Wrapper around the generic call, so that custom stuff can be added later. */
879}
880
881/* ------------------------------------ */
882
889{
890 const char *mode_st;
891 switch (pso->mode) {
892 case POSESLIDE_PUSH:
893 mode_st = IFACE_("Push Pose");
894 break;
895 case POSESLIDE_RELAX:
896 mode_st = IFACE_("Relax Pose");
897 break;
899 mode_st = IFACE_("Breakdown");
900 break;
901 case POSESLIDE_BLEND:
902 mode_st = IFACE_("Blend to Neighbor");
903 break;
904 default:
905 /* Unknown. */
906 mode_st = IFACE_("Sliding-Tool");
907 break;
908 }
909
911
913
914 status.item(IFACE_("Confirm"), ICON_MOUSE_LMB);
915 status.item(IFACE_("Cancel"), ICON_EVENT_ESC);
916 status.item(IFACE_("Adjust"), ICON_MOUSE_MOVE);
917
918 status.item_bool("", pso->channels == PS_TFM_LOC, ICON_EVENT_G);
919 status.item_bool("", pso->channels == PS_TFM_ROT, ICON_EVENT_R);
920 status.item_bool("", pso->channels == PS_TFM_SCALE, ICON_EVENT_S);
921 status.item_bool("", pso->channels == PS_TFM_BBONE_SHAPE, ICON_EVENT_B);
922 status.item_bool("", pso->channels == PS_TFM_PROPS, ICON_EVENT_C);
923
924 switch (pso->channels) {
925 case PS_TFM_LOC:
926 status.item("Location Only", ICON_NONE);
927 break;
928 case PS_TFM_ROT:
929 status.item("Rotation Only", ICON_NONE);
930 break;
931 case PS_TFM_SCALE:
932 status.item("Scale Only", ICON_NONE);
933 break;
935 status.item("Bendy Bones Only", ICON_NONE);
936 break;
937 case PS_TFM_PROPS:
938 status.item("Custom Properties Only", ICON_NONE);
939 break;
940 default:
941 status.item("Transform limits", ICON_NONE);
942 break;
943 }
944
946 status.item_bool("", pso->axislock & PS_LOCK_X, ICON_EVENT_X);
947 status.item_bool("", pso->axislock & PS_LOCK_Y, ICON_EVENT_Y);
948 status.item_bool("", pso->axislock & PS_LOCK_Z, ICON_EVENT_Z);
949 status.item(pso->axislock == 0 ? IFACE_("Axis Constraint") : IFACE_("Axis Only"), ICON_NONE);
950 }
951
952 if (hasNumInput(&pso->num)) {
953 Scene *scene = pso->scene;
954 char str_offs[NUM_STR_REP_LEN];
955
956 outputNumInput(&pso->num, str_offs, scene->unit);
957
958 status.item(str_offs, ICON_NONE);
959 }
960 else if (pso->area && (pso->area->spacetype == SPACE_VIEW3D)) {
962 View3D *v3d = static_cast<View3D *>(pso->area->spacedata.first);
963 status.item_bool(
964 IFACE_("Bone Visibility"), !(v3d->overlay.flag & V3D_OVERLAY_HIDE_BONES), ICON_EVENT_H);
965 }
966
967 ED_area_status_text(pso->area, "");
968}
969
974{
975 wmWindow *win = CTX_wm_window(C);
976
977 tPoseSlideOp *pso = static_cast<tPoseSlideOp *>(op->customdata);
978
979 ED_slider_init(pso->slider, event);
980
981 /* For each link, add all its keyframes to the search tree. */
983 /* Do this for each F-Curve. */
984 LISTBASE_FOREACH (LinkData *, ld, &pfl->fcurves) {
985 AnimData *adt = pfl->ob->adt;
986 FCurve *fcu = static_cast<FCurve *>(ld->data);
987 fcurve_to_keylist(adt, fcu, pso->keylist, 0, {-FLT_MAX, FLT_MAX}, adt != nullptr);
988 }
989 }
990
991 /* Cancel if no keyframes found. */
993 if (ED_keylist_is_empty(pso->keylist)) {
994 BKE_report(op->reports, RPT_ERROR, "No keyframes to slide between");
995 pose_slide_exit(C, op);
996 return OPERATOR_CANCELLED;
997 }
998
999 float current_frame = float(pso->current_frame);
1000
1001 /* Firstly, check if the current frame is a keyframe. */
1002 const ActKeyColumn *ak = ED_keylist_find_exact(pso->keylist, current_frame);
1003
1004 if (ak == nullptr) {
1005 /* Current frame is not a keyframe, so search. */
1006 const ActKeyColumn *pk = ED_keylist_find_prev(pso->keylist, current_frame);
1007 const ActKeyColumn *nk = ED_keylist_find_next(pso->keylist, current_frame);
1008
1009 /* New set the frames. */
1010 /* Previous frame. */
1011 pso->prev_frame = (pk) ? (pk->cfra) : (pso->current_frame - 1);
1012 RNA_int_set(op->ptr, "prev_frame", pso->prev_frame);
1013 /* Next frame. */
1014 pso->next_frame = (nk) ? (nk->cfra) : (pso->current_frame + 1);
1015 RNA_int_set(op->ptr, "next_frame", pso->next_frame);
1016 }
1017 else {
1018 /* Current frame itself is a keyframe, so just take keyframes on either side. */
1019 /* Previous frame. */
1020 pso->prev_frame = (ak->prev) ? (ak->prev->cfra) : (pso->current_frame - 1);
1021 RNA_int_set(op->ptr, "prev_frame", pso->prev_frame);
1022 /* Next frame. */
1023 pso->next_frame = (ak->next) ? (ak->next->cfra) : (pso->current_frame + 1);
1024 RNA_int_set(op->ptr, "next_frame", pso->next_frame);
1025 }
1026
1027 /* Apply NLA mapping corrections so the frame look-ups work. */
1028 for (tPoseSlideObject &ob_data : pso->ob_data_array) {
1029 if (ob_data.valid) {
1031 ob_data.ob->adt, pso->prev_frame, NLATIME_CONVERT_UNMAP);
1033 ob_data.ob->adt, pso->next_frame, NLATIME_CONVERT_UNMAP);
1034 }
1035 }
1036
1037 /* Initial apply for operator. */
1038 /* TODO: need to calculate factor for initial round too. */
1039 if (!ELEM(pso->mode, POSESLIDE_BLEND_REST)) {
1040 pose_slide_apply(C, pso);
1041 }
1042 else {
1044 }
1045
1046 /* Depsgraph updates + redraws. */
1047 pose_slide_refresh(C, pso);
1048
1049 /* Set cursor to indicate modal. */
1051
1052 /* Header print. */
1054
1055 /* Add a modal handler for this operator. */
1057
1059}
1060
1065 tPoseSlideOp *pso,
1066 ePoseSlide_Channels channel)
1067{
1068 /* Turn channel on or off? */
1069 if (pso->channels == channel) {
1070 /* Already limiting to transform only, so pressing this again turns it off */
1071 pso->channels = PS_TFM_ALL;
1072 }
1073 else {
1074 /* Only this set of channels */
1075 pso->channels = channel;
1076 }
1077 RNA_enum_set(op->ptr, "channels", pso->channels);
1078
1079 /* Reset axis limits too for good measure */
1080 pso->axislock = ePoseSlide_AxisLock(0);
1081 RNA_enum_set(op->ptr, "axis_lock", pso->axislock);
1082}
1083
1088 tPoseSlideOp *pso,
1090{
1091 /* Axis can only be set when a transform is set - it doesn't make sense otherwise */
1093 pso->axislock = ePoseSlide_AxisLock(0);
1094 RNA_enum_set(op->ptr, "axis_lock", pso->axislock);
1095 return false;
1096 }
1097
1098 /* Turn on or off? */
1099 if (pso->axislock == axis) {
1100 /* Already limiting on this axis, so turn off */
1101 pso->axislock = ePoseSlide_AxisLock(0);
1102 }
1103 else {
1104 /* Only this axis */
1105 pso->axislock = axis;
1106 }
1107 RNA_enum_set(op->ptr, "axis_lock", pso->axislock);
1108
1109 /* Setting changed, so pose update is needed */
1110 return true;
1111}
1112
1117{
1118 tPoseSlideOp *pso = static_cast<tPoseSlideOp *>(op->customdata);
1119 wmWindow *win = CTX_wm_window(C);
1120 bool do_pose_update = false;
1121
1122 const bool has_numinput = hasNumInput(&pso->num);
1123
1124 do_pose_update = ED_slider_modal(pso->slider, event);
1125
1126 switch (event->type) {
1127 case LEFTMOUSE: /* Confirm. */
1128 case EVT_RETKEY:
1129 case EVT_PADENTER: {
1130 if (event->val == KM_PRESS) {
1131 /* Return to normal cursor and header status. */
1132 ED_workspace_status_text(C, nullptr);
1133 ED_area_status_text(pso->area, nullptr);
1135
1136 /* Depsgraph updates + redraws. Redraw needed to remove UI. */
1137 pose_slide_refresh(C, pso);
1138
1139 /* Insert keyframes as required. */
1141 pose_slide_exit(C, op);
1142
1143 /* Done! */
1144 return OPERATOR_FINISHED;
1145 }
1146 break;
1147 }
1148
1149 case EVT_ESCKEY: /* Cancel. */
1150 case RIGHTMOUSE: {
1151 if (event->val == KM_PRESS) {
1152 /* Return to normal cursor and header status. */
1153 ED_workspace_status_text(C, nullptr);
1154 ED_area_status_text(pso->area, nullptr);
1156
1157 /* Reset transforms back to original state. */
1158 pose_slide_reset(pso);
1159
1160 /* Depsgraph updates + redraws. */
1161 pose_slide_refresh(C, pso);
1162
1163 /* Clean up temp data. */
1164 pose_slide_exit(C, op);
1165
1166 /* Canceled! */
1167 return OPERATOR_CANCELLED;
1168 }
1169 break;
1170 }
1171
1172 /* Factor Change... */
1173 case MOUSEMOVE: /* Calculate new position. */
1174 {
1175 /* Only handle mouse-move if not doing numinput. */
1176 if (has_numinput == false) {
1177 /* Update pose to reflect the new values (see below). */
1178 do_pose_update = true;
1179 }
1180 break;
1181 }
1182 default: {
1183 if ((event->val == KM_PRESS) && handleNumInput(C, &pso->num, event)) {
1184 float value;
1185
1186 /* Grab percentage from numeric input, and store this new value for redo
1187 * NOTE: users see ints, while internally we use a 0-1 float
1188 */
1189 value = ED_slider_factor_get(pso->slider) * 100.0f;
1190 applyNumInput(&pso->num, &value);
1191
1192 float factor = value / 100;
1193 ED_slider_factor_set(pso->slider, factor);
1194 RNA_float_set(op->ptr, "factor", ED_slider_factor_get(pso->slider));
1195
1196 /* Update pose to reflect the new values (see below) */
1197 do_pose_update = true;
1198 break;
1199 }
1200 if (event->val == KM_PRESS) {
1201 switch (event->type) {
1202 /* Transform Channel Limits. */
1203 /* XXX: Replace these hard-coded hotkeys with a modal-map that can be customized. */
1204 case EVT_GKEY: /* Location */
1205 {
1207 do_pose_update = true;
1208 break;
1209 }
1210 case EVT_RKEY: /* Rotation */
1211 {
1213 do_pose_update = true;
1214 break;
1215 }
1216 case EVT_SKEY: /* Scale */
1217 {
1219 do_pose_update = true;
1220 break;
1221 }
1222 case EVT_BKEY: /* Bendy Bones */
1223 {
1225 do_pose_update = true;
1226 break;
1227 }
1228 case EVT_CKEY: /* Custom Properties */
1229 {
1231 do_pose_update = true;
1232 break;
1233 }
1234
1235 /* Axis Locks */
1236 /* XXX: Hardcoded... */
1237 case EVT_XKEY: {
1239 do_pose_update = true;
1240 }
1241 break;
1242 }
1243 case EVT_YKEY: {
1245 do_pose_update = true;
1246 }
1247 break;
1248 }
1249 case EVT_ZKEY: {
1251 do_pose_update = true;
1252 }
1253 break;
1254 }
1255
1256 /* Toggle Bone visibility. */
1257 case EVT_HKEY: {
1258 if (pso->area && (pso->area->spacetype == SPACE_VIEW3D)) {
1259 View3D *v3d = static_cast<View3D *>(pso->area->spacedata.first);
1262 }
1263 break;
1264 }
1265
1266 default: /* Some other unhandled key... */
1267 break;
1268 }
1269 }
1270 else {
1271 /* Unhandled event - maybe it was some view manipulation? */
1272 /* Allow to pass through. */
1274 }
1275 }
1276 }
1277
1278 /* Perform pose updates - in response to some user action
1279 * (e.g. pressing a key or moving the mouse). */
1280 if (do_pose_update) {
1281 RNA_float_set(op->ptr, "factor", ED_slider_factor_get(pso->slider));
1282
1283 /* Update percentage indicator in header. */
1285
1286 /* Reset transforms (to avoid accumulation errors). */
1287 pose_slide_reset(pso);
1288
1289 /* Apply. */
1290 if (!ELEM(pso->mode, POSESLIDE_BLEND_REST)) {
1291 pose_slide_apply(C, pso);
1292 }
1293 else {
1295 }
1296 }
1297
1298 /* Still running. */
1300}
1301
1306{
1307 /* Cleanup and done. */
1308 pose_slide_exit(C, op);
1309}
1310
1315{
1316 /* Settings should have been set up ok for applying, so just apply! */
1317 if (!ELEM(pso->mode, POSESLIDE_BLEND_REST)) {
1318 pose_slide_apply(C, pso);
1319 }
1320 else {
1322 }
1323
1324 /* Insert keyframes if needed. */
1326
1327 /* Cleanup and done. */
1328 pose_slide_exit(C, op);
1329
1330 return OPERATOR_FINISHED;
1331}
1332
1337{
1338 PropertyRNA *prop;
1339
1340 prop = RNA_def_float_factor(ot->srna,
1341 "factor",
1342 0.5f,
1343 0.0f,
1344 1.0f,
1345 "Factor",
1346 "Weighting factor for which keyframe is favored more",
1347 0.0,
1348 1.0);
1350
1351 prop = RNA_def_int(ot->srna,
1352 "prev_frame",
1353 0,
1354 MINAFRAME,
1355 MAXFRAME,
1356 "Previous Keyframe",
1357 "Frame number of keyframe immediately before the current frame",
1358 0,
1359 50);
1361
1362 prop = RNA_def_int(ot->srna,
1363 "next_frame",
1364 0,
1365 MINAFRAME,
1366 MAXFRAME,
1367 "Next Keyframe",
1368 "Frame number of keyframe immediately after the current frame",
1369 0,
1370 50);
1372
1373 prop = RNA_def_enum(ot->srna,
1374 "channels",
1376 PS_TFM_ALL,
1377 "Channels",
1378 "Set of properties that are affected");
1380 prop = RNA_def_enum(ot->srna,
1381 "axis_lock",
1383 0,
1384 "Axis Lock",
1385 "Transform axis to restrict effects to");
1387}
1388
1389/* ------------------------------------ */
1390
1395{
1396 /* Initialize data. */
1397 if (pose_slide_init(C, op, POSESLIDE_PUSH) == 0) {
1398 pose_slide_exit(C, op);
1399 return OPERATOR_CANCELLED;
1400 }
1401
1402 /* Do common setup work. */
1403 return pose_slide_invoke_common(C, op, event);
1404}
1405
1410{
1411 tPoseSlideOp *pso;
1412
1413 /* Initialize data (from RNA-props). */
1414 if (pose_slide_init(C, op, POSESLIDE_PUSH) == 0) {
1415 pose_slide_exit(C, op);
1416 return OPERATOR_CANCELLED;
1417 }
1418
1419 pso = static_cast<tPoseSlideOp *>(op->customdata);
1420
1421 /* Do common exec work. */
1422 return pose_slide_exec_common(C, op, pso);
1423}
1424
1426{
1427 /* identifiers */
1428 ot->name = "Push Pose from Breakdown";
1429 ot->idname = "POSE_OT_push";
1430 ot->description = "Exaggerate the current pose in regards to the breakdown pose";
1431
1432 /* callbacks */
1433 ot->exec = pose_slide_push_exec;
1434 ot->invoke = pose_slide_push_invoke;
1435 ot->modal = pose_slide_modal;
1436 ot->cancel = pose_slide_cancel;
1437 ot->poll = ED_operator_posemode;
1438
1439 /* flags */
1441
1442 /* Properties */
1444}
1445
1446/* ........................ */
1447
1452{
1453 /* Initialize data. */
1454 if (pose_slide_init(C, op, POSESLIDE_RELAX) == 0) {
1455 pose_slide_exit(C, op);
1456 return OPERATOR_CANCELLED;
1457 }
1458
1459 /* Do common setup work. */
1460 return pose_slide_invoke_common(C, op, event);
1461}
1462
1467{
1468 tPoseSlideOp *pso;
1469
1470 /* Initialize data (from RNA-props). */
1471 if (pose_slide_init(C, op, POSESLIDE_RELAX) == 0) {
1472 pose_slide_exit(C, op);
1473 return OPERATOR_CANCELLED;
1474 }
1475
1476 pso = static_cast<tPoseSlideOp *>(op->customdata);
1477
1478 /* Do common exec work. */
1479 return pose_slide_exec_common(C, op, pso);
1480}
1481
1483{
1484 /* identifiers */
1485 ot->name = "Relax Pose to Breakdown";
1486 ot->idname = "POSE_OT_relax";
1487 ot->description = "Make the current pose more similar to its breakdown pose";
1488
1489 /* callbacks */
1490 ot->exec = pose_slide_relax_exec;
1491 ot->invoke = pose_slide_relax_invoke;
1492 ot->modal = pose_slide_modal;
1493 ot->cancel = pose_slide_cancel;
1494 ot->poll = ED_operator_posemode;
1495
1496 /* flags */
1498
1499 /* Properties */
1501}
1502
1503/* ........................ */
1508 wmOperator *op,
1509 const wmEvent *event)
1510{
1511 /* Initialize data. */
1512 if (pose_slide_init(C, op, POSESLIDE_BLEND_REST) == 0) {
1513 pose_slide_exit(C, op);
1514 return OPERATOR_CANCELLED;
1515 }
1516
1517 tPoseSlideOp *pso = static_cast<tPoseSlideOp *>(op->customdata);
1520
1521 /* do common setup work */
1522 return pose_slide_invoke_common(C, op, event);
1523}
1524
1529{
1530 tPoseSlideOp *pso;
1531
1532 /* Initialize data (from RNA-props). */
1533 if (pose_slide_init(C, op, POSESLIDE_BLEND_REST) == 0) {
1534 pose_slide_exit(C, op);
1535 return OPERATOR_CANCELLED;
1536 }
1537
1538 pso = static_cast<tPoseSlideOp *>(op->customdata);
1539
1540 /* Do common exec work. */
1541 return pose_slide_exec_common(C, op, pso);
1542}
1543
1545{
1546 /* identifiers */
1547 ot->name = "Blend Pose with Rest Pose";
1548 ot->idname = "POSE_OT_blend_with_rest";
1549 ot->description = "Make the current pose more similar to, or further away from, the rest pose";
1550
1551 /* callbacks */
1554 ot->modal = pose_slide_modal;
1555 ot->cancel = pose_slide_cancel;
1556 ot->poll = ED_operator_posemode;
1557
1558 /* flags */
1560
1561 /* Properties */
1563}
1564
1565/* ........................ */
1566
1571 wmOperator *op,
1572 const wmEvent *event)
1573{
1574 /* Initialize data. */
1575 if (pose_slide_init(C, op, POSESLIDE_BREAKDOWN) == 0) {
1576 pose_slide_exit(C, op);
1577 return OPERATOR_CANCELLED;
1578 }
1579
1580 /* Do common setup work. */
1581 return pose_slide_invoke_common(C, op, event);
1582}
1583
1588{
1589 tPoseSlideOp *pso;
1590
1591 /* Initialize data (from RNA-props). */
1592 if (pose_slide_init(C, op, POSESLIDE_BREAKDOWN) == 0) {
1593 pose_slide_exit(C, op);
1594 return OPERATOR_CANCELLED;
1595 }
1596
1597 pso = static_cast<tPoseSlideOp *>(op->customdata);
1598
1599 /* Do common exec work. */
1600 return pose_slide_exec_common(C, op, pso);
1601}
1602
1604{
1605 /* identifiers */
1606 ot->name = "Pose Breakdowner";
1607 ot->idname = "POSE_OT_breakdown";
1608 ot->description = "Create a suitable breakdown pose on the current frame";
1609
1610 /* callbacks */
1613 ot->modal = pose_slide_modal;
1614 ot->cancel = pose_slide_cancel;
1615 ot->poll = ED_operator_posemode;
1616
1617 /* flags */
1619
1620 /* Properties */
1622}
1623
1624/* ........................ */
1626 wmOperator *op,
1627 const wmEvent *event)
1628{
1629 /* Initialize data. */
1630 if (pose_slide_init(C, op, POSESLIDE_BLEND) == 0) {
1631 pose_slide_exit(C, op);
1632 return OPERATOR_CANCELLED;
1633 }
1634
1635 /* Do common setup work. */
1636 return pose_slide_invoke_common(C, op, event);
1637}
1638
1640{
1641 tPoseSlideOp *pso;
1642
1643 /* Initialize data (from RNA-props). */
1644 if (pose_slide_init(C, op, POSESLIDE_BLEND) == 0) {
1645 pose_slide_exit(C, op);
1646 return OPERATOR_CANCELLED;
1647 }
1648
1649 pso = static_cast<tPoseSlideOp *>(op->customdata);
1650
1651 /* Do common exec work. */
1652 return pose_slide_exec_common(C, op, pso);
1653}
1654
1656{
1657 /* Identifiers. */
1658 ot->name = "Blend to Neighbor";
1659 ot->idname = "POSE_OT_blend_to_neighbor";
1660 ot->description = "Blend from current position to previous or next keyframe";
1661
1662 /* Callbacks. */
1665 ot->modal = pose_slide_modal;
1666 ot->cancel = pose_slide_cancel;
1667 ot->poll = ED_operator_posemode;
1668
1669 /* Flags. */
1671
1672 /* Properties. */
1674}
1675
1676/* **************************************************** */
1677/* B) Pose Propagate */
1678
1679/* "termination conditions" - i.e. when we stop */
1695
1696/* --------------------------------- */
1697
1700 float frame;
1701};
1702
1703static void propagate_curve_values(ListBase /*tPChanFCurveLink*/ *pflinks,
1704 const float source_frame,
1705 ListBase /*FrameLink*/ *target_frames)
1706{
1707 using namespace blender::animrig;
1708 const KeyframeSettings settings = get_keyframe_settings(true);
1709 LISTBASE_FOREACH (tPChanFCurveLink *, pfl, pflinks) {
1710 LISTBASE_FOREACH (LinkData *, ld, &pfl->fcurves) {
1711 FCurve *fcu = static_cast<FCurve *>(ld->data);
1712 if (!fcu->bezt) {
1713 continue;
1714 }
1715 const float current_fcu_value = evaluate_fcurve(fcu, source_frame);
1716 LISTBASE_FOREACH (FrameLink *, target_frame, target_frames) {
1718 fcu, {target_frame->frame, current_fcu_value}, settings, INSERTKEY_NOFLAGS);
1719 }
1720 }
1721 }
1722}
1723
1724static float find_next_key(ListBase *pflinks, const float start_frame)
1725{
1726 float target_frame = FLT_MAX;
1727 LISTBASE_FOREACH (tPChanFCurveLink *, pfl, pflinks) {
1728 LISTBASE_FOREACH (LinkData *, ld, &pfl->fcurves) {
1729 FCurve *fcu = static_cast<FCurve *>(ld->data);
1730 if (!fcu->bezt) {
1731 continue;
1732 }
1733 bool replace;
1734 int current_frame_index = BKE_fcurve_bezt_binarysearch_index(
1735 fcu->bezt, start_frame, fcu->totvert, &replace);
1736 if (replace) {
1737 current_frame_index += 1;
1738 }
1739 const int bezt_index = min_ii(current_frame_index, fcu->totvert - 1);
1740 target_frame = min_ff(target_frame, fcu->bezt[bezt_index].vec[1][0]);
1741 }
1742 }
1743
1744 return target_frame;
1745}
1746
1747static float find_last_key(ListBase *pflinks)
1748{
1749 float target_frame = FLT_MIN;
1750 LISTBASE_FOREACH (tPChanFCurveLink *, pfl, pflinks) {
1751 LISTBASE_FOREACH (LinkData *, ld, &pfl->fcurves) {
1752 const FCurve *fcu = static_cast<const FCurve *>(ld->data);
1753 if (!fcu->bezt) {
1754 continue;
1755 }
1756 target_frame = max_ff(target_frame, fcu->bezt[fcu->totvert - 1].vec[1][0]);
1757 }
1758 }
1759
1760 return target_frame;
1761}
1762
1763static void get_selected_marker_positions(Scene *scene, ListBase /*FrameLink*/ *target_frames)
1764{
1765 ListBase selected_markers = {nullptr, nullptr};
1766 ED_markers_make_cfra_list(&scene->markers, &selected_markers, true);
1767 LISTBASE_FOREACH (CfraElem *, marker, &selected_markers) {
1768 FrameLink *link = MEM_callocN<FrameLink>("Marker Key Link");
1769 link->frame = marker->cfra;
1770 BLI_addtail(target_frames, link);
1771 }
1772 BLI_freelistN(&selected_markers);
1773}
1774
1776 const float start_frame,
1777 const float end_frame,
1778 ListBase /*FrameLink*/ *target_frames)
1779{
1780 AnimKeylist *keylist = ED_keylist_create();
1781 LISTBASE_FOREACH (tPChanFCurveLink *, pfl, pflinks) {
1782 LISTBASE_FOREACH (LinkData *, ld, &pfl->fcurves) {
1783 FCurve *fcu = static_cast<FCurve *>(ld->data);
1784 fcurve_to_keylist(nullptr, fcu, keylist, 0, {start_frame, end_frame}, false);
1785 }
1786 }
1787 LISTBASE_FOREACH (ActKeyColumn *, column, ED_keylist_listbase(keylist)) {
1788 if (column->cfra <= start_frame) {
1789 continue;
1790 }
1791 if (column->cfra > end_frame) {
1792 break;
1793 }
1794 FrameLink *link = MEM_callocN<FrameLink>("Marker Key Link");
1795 link->frame = column->cfra;
1796 BLI_addtail(target_frames, link);
1797 }
1798 ED_keylist_free(keylist);
1799}
1800
1801static void get_selected_frames(ListBase *pflinks, ListBase /*FrameLink*/ *target_frames)
1802{
1803 AnimKeylist *keylist = ED_keylist_create();
1804 LISTBASE_FOREACH (tPChanFCurveLink *, pfl, pflinks) {
1805 LISTBASE_FOREACH (LinkData *, ld, &pfl->fcurves) {
1806 FCurve *fcu = static_cast<FCurve *>(ld->data);
1807 fcurve_to_keylist(nullptr, fcu, keylist, 0, {-FLT_MAX, FLT_MAX}, false);
1808 }
1809 }
1810 LISTBASE_FOREACH (ActKeyColumn *, column, ED_keylist_listbase(keylist)) {
1811 if (!column->sel) {
1812 continue;
1813 }
1814 FrameLink *link = MEM_callocN<FrameLink>("Marker Key Link");
1815 link->frame = column->cfra;
1816 BLI_addtail(target_frames, link);
1817 }
1818 ED_keylist_free(keylist);
1819}
1820
1821/* --------------------------------- */
1822
1824{
1825 Scene *scene = CTX_data_scene(C);
1826 ViewLayer *view_layer = CTX_data_view_layer(C);
1827 View3D *v3d = CTX_wm_view3d(C);
1828
1829 ListBase pflinks = {nullptr, nullptr};
1830
1831 const int mode = RNA_enum_get(op->ptr, "mode");
1832
1833 /* Isolate F-Curves related to the selected bones. */
1834 poseAnim_mapping_get(C, &pflinks);
1835
1836 if (BLI_listbase_is_empty(&pflinks)) {
1837 /* There is a change the reason the list is empty is
1838 * that there is no valid object to propagate poses for.
1839 * This is very unlikely though, so we focus on the most likely issue. */
1840 BKE_report(op->reports, RPT_ERROR, "No keyframed poses to propagate to");
1841 return OPERATOR_CANCELLED;
1842 }
1843
1844 const float end_frame = RNA_float_get(op->ptr, "end_frame");
1845 const float current_frame = BKE_scene_frame_get(scene);
1846
1847 ListBase target_frames = {nullptr, nullptr};
1848
1849 switch (mode) {
1851 float target_frame = find_next_key(&pflinks, current_frame);
1852 FrameLink *link = MEM_callocN<FrameLink>("Next Key Link");
1853 link->frame = target_frame;
1854 BLI_addtail(&target_frames, link);
1855 propagate_curve_values(&pflinks, current_frame, &target_frames);
1856 break;
1857 }
1858
1860 float target_frame = find_last_key(&pflinks);
1861 FrameLink *link = MEM_callocN<FrameLink>("Last Key Link");
1862 link->frame = target_frame;
1863 BLI_addtail(&target_frames, link);
1864 propagate_curve_values(&pflinks, current_frame, &target_frames);
1865 break;
1866 }
1867
1869 get_selected_marker_positions(scene, &target_frames);
1870 propagate_curve_values(&pflinks, current_frame, &target_frames);
1871 break;
1872 }
1873
1875 get_keyed_frames_in_range(&pflinks, current_frame, FLT_MAX, &target_frames);
1876 propagate_curve_values(&pflinks, current_frame, &target_frames);
1877 break;
1878 }
1880 get_keyed_frames_in_range(&pflinks, current_frame, end_frame, &target_frames);
1881 propagate_curve_values(&pflinks, current_frame, &target_frames);
1882 break;
1883 }
1885 get_selected_frames(&pflinks, &target_frames);
1886 propagate_curve_values(&pflinks, current_frame, &target_frames);
1887 break;
1888 }
1889 }
1890
1891 BLI_freelistN(&target_frames);
1892
1893 /* Free temp data. */
1894 poseAnim_mapping_free(&pflinks);
1895
1896 /* Updates + notifiers. */
1897 FOREACH_OBJECT_IN_MODE_BEGIN (scene, view_layer, v3d, OB_ARMATURE, OB_MODE_POSE, ob) {
1898 poseAnim_mapping_refresh(C, scene, ob);
1899 }
1901
1902 return OPERATOR_FINISHED;
1903}
1904
1905/* --------------------------------- */
1906
1908{
1909 static const EnumPropertyItem terminate_items[] = {
1911 "NEXT_KEY",
1912 0,
1913 "To Next Keyframe",
1914 "Propagate pose to first keyframe following the current frame only"},
1916 "LAST_KEY",
1917 0,
1918 "To Last Keyframe",
1919 "Propagate pose to the last keyframe only (i.e. making action cyclic)"},
1921 "BEFORE_FRAME",
1922 0,
1923 "Before Frame",
1924 "Propagate pose to all keyframes between current frame and 'Frame' property"},
1926 "BEFORE_END",
1927 0,
1928 "Before Last Keyframe",
1929 "Propagate pose to all keyframes from current frame until no more are found"},
1931 "SELECTED_KEYS",
1932 0,
1933 "On Selected Keyframes",
1934 "Propagate pose to all selected keyframes"},
1936 "SELECTED_MARKERS",
1937 0,
1938 "On Selected Markers",
1939 "Propagate pose to all keyframes occurring on frames with Scene Markers after the current "
1940 "frame"},
1941 {0, nullptr, 0, nullptr, nullptr},
1942 };
1943
1944 /* identifiers */
1945 ot->name = "Propagate Pose";
1946 ot->idname = "POSE_OT_propagate";
1947 ot->description =
1948 "Copy selected aspects of the current pose to subsequent poses already keyframed";
1949
1950 /* callbacks */
1951 ot->exec = pose_propagate_exec;
1952 ot->poll = ED_operator_posemode; /* XXX: needs selected bones! */
1953
1954 /* flag */
1955 ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
1956
1957 /* properties */
1958 /* TODO: add "fade out" control for tapering off amount of propagation as time goes by? */
1959 ot->prop = RNA_def_enum(ot->srna,
1960 "mode",
1961 terminate_items,
1963 "Terminate Mode",
1964 "Method used to determine when to stop propagating pose to keyframes");
1965 RNA_def_float(ot->srna,
1966 "end_frame",
1967 250.0,
1968 FLT_MIN,
1969 FLT_MAX,
1970 "End Frame",
1971 "Frame to stop propagating frames to (for 'Before Frame' mode)",
1972 1.0,
1973 250.0);
1974}
1975
1976/* **************************************************** */
Functions to modify FCurves.
ScrArea * CTX_wm_area(const bContext *C)
wmWindow * CTX_wm_window(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
int BKE_fcurve_bezt_binarysearch_index(const BezTriple array[], float frame, int arraylen, bool *r_replace)
float evaluate_fcurve(const FCurve *fcu, float evaltime)
#define FOREACH_OBJECT_IN_MODE_END
Definition BKE_layer.hh:382
blender::Vector< Object * > BKE_view_layer_array_from_objects_in_mode_unique_data(const Scene *scene, ViewLayer *view_layer, const View3D *v3d, eObjectMode mode)
#define FOREACH_OBJECT_IN_MODE_BEGIN(_scene, _view_layer, _v3d, _object_type, _object_mode, _instance)
Definition BKE_layer.hh:377
@ NLATIME_CONVERT_UNMAP
Definition BKE_nla.hh:549
float BKE_nla_tweakedit_remap(AnimData *adt, float cframe, eNlaTime_ConvertModes mode)
@ RPT_ERROR
Definition BKE_report.hh:39
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:153
float BKE_scene_frame_get(const Scene *scene)
Definition scene.cc:2384
@ B_UNIT_NONE
Definition BKE_unit.hh:136
#define BLI_assert(a)
Definition BLI_assert.h:46
#define BLI_assert_msg(a, msg)
Definition BLI_assert.h:53
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
void void BLI_freelistN(ListBase *listbase) ATTR_NONNULL(1)
Definition listbase.cc:497
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:111
MINLINE float max_ff(float a, float b)
MINLINE int min_ii(int a, int b)
MINLINE float min_ff(float a, float b)
MINLINE float interpf(float target, float origin, float t)
void interp_qt_qtqt(float q[4], const float a[4], const float b[4], float t)
float normalize_qt(float q[4])
float normalize_qt_qt(float r[4], const float q[4])
void copy_qt_qt(float q[4], const float a[4])
void quat_to_compatible_quat(float q[4], const float a[4], const float old[4])
char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
unsigned int uint
#define UNLIKELY(x)
#define ELEM(...)
#define IFACE_(msgid)
@ ROT_MODE_AXISANGLE
@ POSE_SCALE
@ POSE_BBONE_SHAPE
@ POSE_ROT
@ POSE_LOC
@ POSE_LOCKED
@ POSE_DO_UNLOCK
@ INSERTKEY_NOFLAGS
@ OB_MODE_POSE
Object is a sort of wrapper for general info.
@ OB_ARMATURE
#define MINAFRAME
#define MAXFRAME
@ SPACE_VIEW3D
@ V3D_OVERLAY_HIDE_BONES
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_RUNNING_MODAL
@ OPERATOR_PASS_THROUGH
void initNumInput(NumInput *n)
Definition numinput.cc:70
#define NUM_STR_REP_LEN
bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
Definition numinput.cc:312
bool applyNumInput(NumInput *n, float *vec)
Definition numinput.cc:190
void outputNumInput(NumInput *n, char *str, const UnitSettings &unit_settings)
Definition numinput.cc:88
bool hasNumInput(const NumInput *n)
Definition numinput.cc:171
void ED_area_status_text(ScrArea *area, const char *str)
Definition area.cc:851
bool ED_operator_posemode(bContext *C)
void ED_workspace_status_text(bContext *C, const char *str)
Definition area.cc:1024
void ED_region_tag_redraw(ARegion *region)
Definition area.cc:618
void ED_slider_init(tSlider *slider, const wmEvent *event)
Definition ed_draw.cc:477
void ED_slider_property_label_set(tSlider *slider, const char *property_label)
Definition ed_draw.cc:655
void ED_slider_destroy(bContext *C, tSlider *slider)
Definition ed_draw.cc:579
tSlider * ED_slider_create(bContext *C)
Definition ed_draw.cc:433
bool ED_slider_modal(tSlider *slider, const wmEvent *event)
Definition ed_draw.cc:482
void ED_slider_status_get(const tSlider *slider, WorkspaceStatus &status)
Definition ed_draw.cc:563
void ED_slider_factor_bounds_set(tSlider *slider, float factor_bound_lower, float factor_bound_upper)
Definition ed_draw.cc:632
float ED_slider_factor_get(const tSlider *slider)
Definition ed_draw.cc:592
void ED_slider_factor_set(tSlider *slider, float factor)
Definition ed_draw.cc:597
Read Guarded memory(de)allocation.
@ PROP_FLOAT
Definition RNA_types.hh:164
@ PROP_BOOLEAN
Definition RNA_types.hh:162
@ PROP_ENUM
Definition RNA_types.hh:166
@ PROP_INT
Definition RNA_types.hh:163
@ PROP_SKIP_SAVE
Definition RNA_types.hh:344
#define C
Definition RandGen.cpp:29
@ KM_PRESS
Definition WM_types.hh:311
@ OPTYPE_BLOCKING
Definition WM_types.hh:184
@ OPTYPE_UNDO
Definition WM_types.hh:182
@ OPTYPE_REGISTER
Definition WM_types.hh:180
@ OPTYPE_GRAB_CURSOR_X
Definition WM_types.hh:190
void ED_markers_make_cfra_list(ListBase *markers, ListBase *lb, const bool only_selected)
void poseAnim_mapping_autoKeyframe(bContext *C, Scene *scene, ListBase *pfLinks, float cframe)
void poseAnim_mapping_free(ListBase *pfLinks)
void poseAnim_mapping_reset(ListBase *pfLinks)
void poseAnim_mapping_get(bContext *C, ListBase *pfLinks)
Object * poseAnim_object_get(Object *ob_)
void poseAnim_mapping_refresh(bContext *C, Scene *scene, Object *ob)
LinkData * poseAnim_mapping_getNextFCurve(ListBase *fcuLinks, LinkData *prev, const char *path)
volatile int lock
void reinitialize(const int64_t new_size)
Definition BLI_array.hh:419
int64_t size() const
IndexRange index_range() const
nullptr float
const ActKeyColumn * ED_keylist_find_prev(const AnimKeylist *keylist, const float cfra)
void fcurve_to_keylist(AnimData *adt, FCurve *fcu, AnimKeylist *keylist, const int saction_flag, blender::float2 range, const bool use_nla_remapping)
void ED_keylist_prepare_for_direct_access(AnimKeylist *keylist)
AnimKeylist * ED_keylist_create()
void ED_keylist_free(AnimKeylist *keylist)
const ActKeyColumn * ED_keylist_find_next(const AnimKeylist *keylist, const float cfra)
const ListBase * ED_keylist_listbase(const AnimKeylist *keylist)
bool ED_keylist_is_empty(const AnimKeylist *keylist)
const ActKeyColumn * ED_keylist_find_exact(const AnimKeylist *keylist, const float cfra)
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
ccl_device_inline float2 fabs(const float2 a)
KeyframeSettings get_keyframe_settings(bool from_userprefs)
SingleKeyingResult insert_vert_fcurve(FCurve *fcu, const float2 position, const KeyframeSettings &settings, eInsertKeyFlags flag)
Main Key-framing API call.
ePoseSlide_Modes
Definition pose_slide.cc:86
@ POSESLIDE_BLEND
Definition pose_slide.cc:94
@ POSESLIDE_BREAKDOWN
Definition pose_slide.cc:92
@ POSESLIDE_PUSH
Definition pose_slide.cc:88
@ POSESLIDE_BLEND_REST
Definition pose_slide.cc:93
@ POSESLIDE_RELAX
Definition pose_slide.cc:90
static void pose_slide_toggle_channels_mode(wmOperator *op, tPoseSlideOp *pso, ePoseSlide_Channels channel)
static wmOperatorStatus pose_slide_blend_rest_exec(bContext *C, wmOperator *op)
static void pose_slide_apply(bContext *C, tPoseSlideOp *pso)
void POSE_OT_breakdown(wmOperatorType *ot)
static wmOperatorStatus pose_slide_push_exec(bContext *C, wmOperator *op)
static wmOperatorStatus pose_slide_blend_to_neighbors_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static const EnumPropertyItem prop_channels_types[]
static wmOperatorStatus pose_slide_blend_to_neighbors_exec(bContext *C, wmOperator *op)
static void pose_slide_apply_val(tPoseSlideOp *pso, const FCurve *fcu, Object *ob, float *val)
static void pose_slide_reset(tPoseSlideOp *pso)
static void pose_slide_cancel(bContext *C, wmOperator *op)
static wmOperatorStatus pose_slide_breakdown_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus pose_slide_relax_exec(bContext *C, wmOperator *op)
static void get_keyed_frames_in_range(ListBase *pflinks, const float start_frame, const float end_frame, ListBase *target_frames)
ePoseSlide_AxisLock
Definition pose_slide.cc:79
@ PS_LOCK_Z
Definition pose_slide.cc:82
@ PS_LOCK_Y
Definition pose_slide.cc:81
@ PS_LOCK_X
Definition pose_slide.cc:80
static const EnumPropertyItem prop_axis_lock_types[]
static bool pose_slide_toggle_axis_locks(wmOperator *op, tPoseSlideOp *pso, ePoseSlide_AxisLock axis)
static wmOperatorStatus pose_slide_relax_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void pose_slide_rest_pose_apply_other_rot(tPoseSlideOp *pso, float vec[4], bool quat)
static void pose_slide_opdef_properties(wmOperatorType *ot)
static void pose_slide_refresh(bContext *C, tPoseSlideOp *pso)
static float find_next_key(ListBase *pflinks, const float start_frame)
static void pose_slide_apply_quat(tPoseSlideOp *pso, tPChanFCurveLink *pfl)
void POSE_OT_blend_with_rest(wmOperatorType *ot)
static wmOperatorStatus pose_slide_invoke_common(bContext *C, wmOperator *op, const wmEvent *event)
void POSE_OT_propagate(wmOperatorType *ot)
static void pose_slide_rest_pose_apply(bContext *C, tPoseSlideOp *pso)
static wmOperatorStatus pose_slide_breakdown_exec(bContext *C, wmOperator *op)
static void pose_slide_autoKeyframe(bContext *C, tPoseSlideOp *pso)
static float find_last_key(ListBase *pflinks)
static wmOperatorStatus pose_slide_push_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void propagate_curve_values(ListBase *pflinks, const float source_frame, ListBase *target_frames)
static wmOperatorStatus pose_propagate_exec(bContext *C, wmOperator *op)
static bool pose_frame_range_from_object_get(tPoseSlideOp *pso, Object *ob, float *prev_frame, float *next_frame)
void POSE_OT_relax(wmOperatorType *ot)
static void pose_slide_apply_vec3(tPoseSlideOp *pso, tPChanFCurveLink *pfl, float vec[3], const char propName[])
static wmOperatorStatus pose_slide_blend_rest_invoke(bContext *C, wmOperator *op, const wmEvent *event)
ePoseSlide_Channels
Definition pose_slide.cc:98
@ PS_TFM_LOC
@ PS_TFM_PROPS
@ PS_TFM_ALL
Definition pose_slide.cc:99
@ PS_TFM_SCALE
@ PS_TFM_BBONE_SHAPE
@ PS_TFM_ROT
static wmOperatorStatus pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event)
void POSE_OT_push(wmOperatorType *ot)
static int pose_slide_init(bContext *C, wmOperator *op, ePoseSlide_Modes mode)
static void pose_slide_rest_pose_apply_vec3(tPoseSlideOp *pso, float vec[3], float default_value)
static void get_selected_frames(ListBase *pflinks, ListBase *target_frames)
static void pose_slide_draw_status(bContext *C, tPoseSlideOp *pso)
ePosePropagate_Termination
@ POSE_PROPAGATE_LAST_KEY
@ POSE_PROPAGATE_BEFORE_FRAME
@ POSE_PROPAGATE_SELECTED_MARKERS
@ POSE_PROPAGATE_BEFORE_END
@ POSE_PROPAGATE_NEXT_KEY
@ POSE_PROPAGATE_SELECTED_KEYS
static void get_selected_marker_positions(Scene *scene, ListBase *target_frames)
static void pose_slide_apply_props(tPoseSlideOp *pso, tPChanFCurveLink *pfl, const char prop_prefix[])
static void pose_slide_exit(bContext *C, wmOperator *op)
static wmOperatorStatus pose_slide_exec_common(bContext *C, wmOperator *op, tPoseSlideOp *pso)
void POSE_OT_blend_to_neighbors(wmOperatorType *ot)
const int status
float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, bool value)
void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
bool RNA_property_array_check(PropertyRNA *prop)
int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, float value)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
PropertyType RNA_property_type(PropertyRNA *prop)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int value)
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
int RNA_int_get(PointerRNA *ptr, const char *name)
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
float RNA_float_get(PointerRNA *ptr, const char *name)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
bool RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_float_factor(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
#define FLT_MAX
Definition stdcycles.h:14
ActKeyColumn * prev
ActKeyColumn * next
float vec[3][3]
char * rna_path
BezTriple * bezt
int array_index
unsigned int totvert
void * data
void * first
short idx_max
int unit_type[NUM_MAX_ELEMENTS]
struct bPose * pose
struct AnimData * adt
struct RenderData r
struct UnitSettings unit
ListBase markers
ListBase spacedata
View3DOverlay overlay
ePoseSlide_Channels channels
NumInput num
ePoseSlide_AxisLock axislock
ARegion * region
tSlider * slider
ScrArea * area
AnimKeylist * keylist
ePoseSlide_Modes mode
ListBase pfLinks
Scene * scene
blender::Array< tPoseSlideObject > ob_data_array
wmEventType type
Definition WM_types.hh:757
short val
Definition WM_types.hh:759
struct ReportList * reports
struct PointerRNA * ptr
uint len
void WM_cursor_modal_set(wmWindow *win, int val)
void WM_cursor_modal_restore(wmWindow *win)
@ WM_CURSOR_EW_SCROLL
Definition wm_cursors.hh:54
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
@ RIGHTMOUSE
@ EVT_YKEY
@ EVT_SKEY
@ EVT_XKEY
@ EVT_CKEY
@ EVT_GKEY
@ EVT_PADENTER
@ MOUSEMOVE
@ EVT_HKEY
@ LEFTMOUSE
@ EVT_ZKEY
@ EVT_ESCKEY
@ EVT_RKEY
@ EVT_BKEY
@ EVT_RETKEY
PointerRNA * ptr
Definition wm_files.cc:4238
wmOperatorType * ot
Definition wm_files.cc:4237