Blender  V3.3
pose_lib_2.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2021 Blender Foundation. */
3 
8 #include <math.h>
9 #include <string.h>
10 
11 #include "MEM_guardedalloc.h"
12 
13 #include "BLI_math.h"
14 #include "BLI_string.h"
15 
16 #include "BLT_translation.h"
17 
18 #include "DNA_armature_types.h"
19 
20 #include "BKE_action.h"
21 #include "BKE_anim_data.h"
22 #include "BKE_animsys.h"
23 #include "BKE_armature.h"
24 #include "BKE_context.h"
25 #include "BKE_lib_id.h"
26 #include "BKE_object.h"
27 #include "BKE_report.h"
28 
29 #include "DEG_depsgraph.h"
30 
31 #include "RNA_access.h"
32 #include "RNA_define.h"
33 #include "RNA_prototypes.h"
34 
35 #include "WM_api.h"
36 #include "WM_types.h"
37 
38 #include "UI_interface.h"
39 
40 #include "ED_armature.h"
41 #include "ED_asset.h"
42 #include "ED_keyframing.h"
43 #include "ED_screen.h"
44 
45 #include "armature_intern.h"
46 
47 typedef enum ePoseBlendState {
54 
55 typedef struct PoseBlendData {
58 
59  struct {
61  int drag_start_xy[2];
63 
66 
67  /* For temp-loading the Action from the pose library. */
69 
70  /* Blend factor, interval [0, 1] for interpolating between current and given pose. */
71  float blend_factor;
73 
74  Object *ob; /* Object to work on. */
75  bAction *act; /* Pose to blend into the current pose. */
77 
78  Scene *scene; /* For auto-keying. */
79  ScrArea *area; /* For drawing status text. */
80 
84 
85 /* Makes a copy of the current pose for restoration purposes - doesn't do constraints currently */
87 {
89 
90  if (pbd->state == POSE_BLEND_INIT) {
91  /* Ready for blending now. */
93  }
94 }
95 
96 /* ---------------------------- */
97 
98 /* Auto-key/tag bones affected by the pose Action. */
100 {
101  if (!autokeyframe_cfra_can_key(scene, &pbd->ob->id)) {
102  return;
103  }
104 
105  AnimData *adt = BKE_animdata_from_id(&pbd->ob->id);
106  if (adt != NULL && adt->action != NULL &&
108  /* Changes to linked-in Actions are not allowed. */
109  return;
110  }
111 
112  bPose *pose = pbd->ob->pose;
113  bAction *act = pbd->act;
114 
116  ListBase dsources = {NULL, NULL};
117 
118  /* start tagging/keying */
119  const bArmature *armature = pbd->ob->data;
120  LISTBASE_FOREACH (bActionGroup *, agrp, &act->groups) {
121  /* Only for selected bones unless there aren't any selected, in which case all are included. */
122  bPoseChannel *pchan = BKE_pose_channel_find_name(pose, agrp->name);
123  if (pchan == NULL) {
124  continue;
125  }
126 
128  !PBONE_SELECTED(armature, pchan->bone)) {
129  continue;
130  }
131 
132  /* Add data-source override for the PoseChannel, to be used later. */
133  ANIM_relative_keyingset_add_source(&dsources, &pbd->ob->id, &RNA_PoseBone, pchan);
134  }
135 
136  /* Perform actual auto-keying. */
137  ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)scene->r.cfra);
138  BLI_freelistN(&dsources);
139 
140  /* send notifiers for this */
142 }
143 
144 /* Apply the relevant changes to the pose */
146 {
147  PoseBlendData *pbd = (PoseBlendData *)op->customdata;
148 
149  if (pbd->state == POSE_BLEND_BLENDING) {
150  BLI_snprintf(pbd->headerstr,
151  sizeof(pbd->headerstr),
152  TIP_("PoseLib blending: \"%s\" at %3.0f%%"),
153  pbd->act->id.name + 2,
154  pbd->blend_factor * 100);
155  ED_area_status_text(pbd->area, pbd->headerstr);
156 
158  C, TIP_("Tab: show original pose; Horizontal mouse movement: change blend percentage"));
159  }
160  else {
161  ED_area_status_text(pbd->area, TIP_("PoseLib showing original pose"));
162  ED_workspace_status_text(C, TIP_("Tab: show blended pose"));
163  }
164 
165  if (!pbd->needs_redraw) {
166  return;
167  }
168  pbd->needs_redraw = false;
169 
171 
172  /* The pose needs updating, whether it's for restoring the original pose or for showing the
173  * result of the blend. */
176 
177  if (pbd->state != POSE_BLEND_BLENDING) {
178  return;
179  }
180 
181  /* Perform the actual blending. */
184  BKE_pose_apply_action_blend(pbd->ob, pbd->act, &anim_eval_context, pbd->blend_factor);
185 }
186 
187 /* ---------------------------- */
188 
189 static void poselib_blend_set_factor(PoseBlendData *pbd, const float new_factor)
190 {
191  pbd->blend_factor = CLAMPIS(new_factor, 0.0f, 1.0f);
192  pbd->needs_redraw = true;
193 }
194 
196 {
198  /* Release confirm calculates factor based on where the dragging was started from. */
199  const float range = 300 * U.pixelsize;
200  const float new_factor = (event->xy[0] - pbd->release_confirm_info.drag_start_xy[0]) / range;
201  poselib_blend_set_factor(pbd, new_factor);
202  }
203  else {
204  const float new_factor = (event->xy[0] - pbd->area->v1->vec.x) / ((float)pbd->area->winx);
205  poselib_blend_set_factor(pbd, new_factor);
206  }
207 }
208 
209 /* Return operator return value. */
211 {
212  PoseBlendData *pbd = op->customdata;
213 
214  if (event->type == MOUSEMOVE) {
216  return OPERATOR_RUNNING_MODAL;
217  }
218 
219  /* Handle the release confirm event directly, it has priority over others. */
221  (event->type == pbd->release_confirm_info.init_event_type) && (event->val == KM_RELEASE)) {
222  pbd->state = POSE_BLEND_CONFIRM;
223  return OPERATOR_RUNNING_MODAL;
224  }
225 
226  /* only accept 'press' event, and ignore 'release', so that we don't get double actions */
227  if (ELEM(event->val, KM_PRESS, KM_NOTHING) == 0) {
228  return OPERATOR_RUNNING_MODAL;
229  }
230 
231  /* NORMAL EVENT HANDLING... */
232  /* searching takes priority over normal activity */
233  switch (event->type) {
234  /* Exit - cancel. */
235  case EVT_ESCKEY:
236  case RIGHTMOUSE:
237  pbd->state = POSE_BLEND_CANCEL;
238  break;
239 
240  /* Exit - confirm. */
241  case LEFTMOUSE:
242  case EVT_RETKEY:
243  case EVT_PADENTER:
244  case EVT_SPACEKEY:
245  pbd->state = POSE_BLEND_CONFIRM;
246  break;
247 
248  /* TODO(Sybren): toggle between original pose and poselib pose. */
249  case EVT_TABKEY:
251  pbd->needs_redraw = true;
252  break;
253 
254  /* TODO(Sybren): use better UI for slider. */
255  }
256 
257  return OPERATOR_RUNNING_MODAL;
258 }
259 
261 {
262  PoseBlendData *pbd = op->customdata;
263 
264  /* Ensure cursor-grab (continuous grabbing) is enabled when using release-confirm. */
269  }
270 }
271 
272 /* ---------------------------- */
273 
275 {
276  if (C == NULL) {
277  return NULL;
278  }
280 }
281 
283 {
285 }
286 
288 {
289  bool asset_handle_valid;
290  const AssetLibraryReference *asset_library_ref = CTX_wm_asset_library_ref(C);
291  const AssetHandle asset_handle = CTX_wm_asset_handle(C, &asset_handle_valid);
292  /* Poll callback should check. */
293  BLI_assert((asset_library_ref != NULL) && asset_handle_valid);
294 
295  PoseBlendData *pbd = op->customdata;
296 
299  pbd->temp_id_consumer, C, asset_library_ref, ID_AC, CTX_data_main(C), op->reports);
300 }
301 
302 static bAction *flip_pose(bContext *C, Object *ob, bAction *action)
303 {
304  bAction *action_copy = (bAction *)BKE_id_copy_ex(NULL, &action->id, NULL, LIB_ID_COPY_LOCALIZE);
305 
306  /* Lock the window manager while flipping the pose. Flipping requires temporarily modifying the
307  * pose, which can cause unwanted visual glitches. */
309  const bool interface_was_locked = CTX_wm_interface_locked(C);
310  WM_set_locked_interface(wm, true);
311 
312  BKE_action_flip_with_pose(action_copy, ob);
313 
314  WM_set_locked_interface(wm, interface_was_locked);
315  return action_copy;
316 }
317 
318 /* Return true on success, false if the context isn't suitable. */
319 static bool poselib_blend_init_data(bContext *C, wmOperator *op, const wmEvent *event)
320 {
321  op->customdata = NULL;
322 
323  /* check if valid poselib */
324  Object *ob = get_poselib_object(C);
325  if (ELEM(NULL, ob, ob->pose, ob->data)) {
326  BKE_report(op->reports, RPT_ERROR, TIP_("Pose lib is only for armatures in pose mode"));
327  return false;
328  }
329 
330  /* Set up blend state info. */
331  PoseBlendData *pbd;
332  op->customdata = pbd = MEM_callocN(sizeof(PoseBlendData), "PoseLib Preview Data");
333 
334  bAction *action = poselib_blend_init_get_action(C, op);
335  if (action == NULL) {
336  return false;
337  }
338 
339  /* Maybe flip the Action. */
340  const bool apply_flipped = RNA_boolean_get(op->ptr, "flipped");
341  if (apply_flipped) {
342  action = flip_pose(C, ob, action);
343  pbd->free_action = true;
344  }
345  pbd->act = action;
346 
347  /* Get the basic data. */
348  pbd->ob = ob;
349  pbd->ob->pose = ob->pose;
350 
351  pbd->scene = CTX_data_scene(C);
352  pbd->area = CTX_wm_area(C);
353 
354  pbd->state = POSE_BLEND_INIT;
355  pbd->needs_redraw = true;
356  pbd->blend_factor = RNA_float_get(op->ptr, "blend_factor");
357  /* Just to avoid a clang-analyzer warning (false positive), it's set properly below. */
359 
360  /* Release confirm data. Only available if there's an event to work with. */
361  if (event != NULL) {
362  PropertyRNA *release_confirm_prop = RNA_struct_find_property(op->ptr, "release_confirm");
363  pbd->release_confirm_info.use_release_confirm = (release_confirm_prop != NULL) &&
365  release_confirm_prop);
366  }
367 
369  BLI_assert(event != NULL);
372  event->type);
373  }
374 
375  /* Make backups for blending and restoring the pose. */
377 
378  /* Set pose flags to ensure the depsgraph evaluation doesn't overwrite it. */
379  pbd->ob->pose->flag &= ~POSE_DO_UNLOCK;
380  pbd->ob->pose->flag |= POSE_LOCKED;
381 
382  return true;
383 }
384 
386 {
387  PoseBlendData *pbd = op->customdata;
388  wmWindow *win = CTX_wm_window(C);
389 
390  /* Redraw the header so that it doesn't show any of our stuff anymore. */
393 
394  /* This signals the depsgraph to unlock and reevaluate the pose on the next evaluation. */
395  bPose *pose = pbd->ob->pose;
396  pose->flag |= POSE_DO_UNLOCK;
397 
398  switch (pbd->state) {
399  case POSE_BLEND_CONFIRM: {
400  Scene *scene = pbd->scene;
401  poselib_keytag_pose(C, scene, pbd);
402 
403  /* Ensure the redo panel has the actually-used value, instead of the initial value. */
404  RNA_float_set(op->ptr, "blend_factor", pbd->blend_factor);
405  break;
406  }
407 
408  case POSE_BLEND_INIT:
409  case POSE_BLEND_BLENDING:
410  case POSE_BLEND_ORIGINAL:
411  /* Cleanup should not be called directly from these states. */
412  BLI_assert_msg(0, "poselib_blend_cleanup: unexpected pose blend state");
413  BKE_report(op->reports, RPT_ERROR, "Internal pose library error, canceling operator");
415  case POSE_BLEND_CANCEL:
417  break;
418  }
419 
423  }
424 
427  /* Update mouse-hover highlights. */
429 }
430 
432 {
433  PoseBlendData *pbd = op->customdata;
434  if (pbd == NULL) {
435  return;
436  }
437 
438  if (pbd->free_action) {
439  /* Run before #poselib_tempload_exit to avoid any problems from indirectly
440  * referenced ID pointers. */
441  BKE_id_free(NULL, pbd->act);
442  }
444 
445  /* Must have been dealt with before! */
447 
448  /* Free temp data for operator */
450  pbd->pose_backup = NULL;
451 
453 }
454 
456 {
457  PoseBlendData *pbd = op->customdata;
458  const ePoseBlendState exit_state = pbd->state;
459 
461  poselib_blend_free(op);
462 
463  if (exit_state == POSE_BLEND_CANCEL) {
464  return OPERATOR_CANCELLED;
465  }
466  return OPERATOR_FINISHED;
467 }
468 
469 /* Cancel previewing operation (called when exiting Blender) */
471 {
472  PoseBlendData *pbd = op->customdata;
473  pbd->state = POSE_BLEND_CANCEL;
474  poselib_blend_exit(C, op);
475 }
476 
477 /* Main modal status check. */
478 static int poselib_blend_modal(bContext *C, wmOperator *op, const wmEvent *event)
479 {
480  const int operator_result = poselib_blend_handle_event(C, op, event);
481 
483 
484  const PoseBlendData *pbd = op->customdata;
486  return poselib_blend_exit(C, op);
487  }
488 
489  if (pbd->needs_redraw) {
490  poselib_blend_apply(C, op);
491  }
492 
493  return operator_result;
494 }
495 
496 /* Modal Operator init. */
497 static int poselib_blend_invoke(bContext *C, wmOperator *op, const wmEvent *event)
498 {
499  if (!poselib_blend_init_data(C, op, event)) {
500  poselib_blend_free(op);
501  return OPERATOR_CANCELLED;
502  }
503 
504  /* Do initial apply to have something to look at. */
505  poselib_blend_apply(C, op);
506 
508  return OPERATOR_RUNNING_MODAL;
509 }
510 
511 /* Single-shot apply. */
513 {
514  if (!poselib_blend_init_data(C, op, NULL)) {
515  poselib_blend_free(op);
516  return OPERATOR_CANCELLED;
517  }
518 
519  poselib_blend_apply(C, op);
520 
521  PoseBlendData *pbd = op->customdata;
522  pbd->state = POSE_BLEND_CONFIRM;
523  return poselib_blend_exit(C, op);
524 }
525 
527 {
528  bool asset_handle_valid;
529  /* Check whether the context provides the asset data needed to add a pose. */
530  const AssetLibraryReference *asset_library_ref = CTX_wm_asset_library_ref(C);
531  AssetHandle asset_handle = CTX_wm_asset_handle(C, &asset_handle_valid);
532 
533  return (asset_library_ref != NULL) && asset_handle_valid &&
534  (ED_asset_handle_get_id_type(&asset_handle) == ID_AC);
535 }
536 
537 /* Poll callback for operators that require existing PoseLib data (with poses) to work. */
539 {
540  Object *ob = get_poselib_object(C);
541  if (ELEM(NULL, ob, ob->pose, ob->data)) {
542  /* Pose lib is only for armatures in pose mode. */
543  return false;
544  }
545 
546  return poselib_asset_in_context(C);
547 }
548 
550 {
551  /* Identifiers: */
552  ot->name = "Apply Pose Asset";
553  ot->idname = "POSELIB_OT_apply_pose_asset";
554  ot->description = "Apply the given Pose Action to the rig";
555 
556  /* Callbacks: */
559 
560  /* Flags: */
562 
563  /* Properties: */
565  "blend_factor",
566  1.0f,
567  0.0f,
568  1.0f,
569  "Blend Factor",
570  "Amount that the pose is applied on top of the existing poses",
571  0.0f,
572  1.0f);
574  "flipped",
575  false,
576  "Apply Flipped",
577  "When enabled, applies the pose flipped over the X-axis");
578 }
579 
581 {
582  PropertyRNA *prop;
583 
584  /* Identifiers: */
585  ot->name = "Blend Pose Asset";
586  ot->idname = "POSELIB_OT_blend_pose_asset";
587  ot->description = "Blend the given Pose Action to the rig";
588 
589  /* Callbacks: */
595 
596  /* Flags: */
598 
599  /* Properties: */
600  prop = RNA_def_float_factor(ot->srna,
601  "blend_factor",
602  0.0f,
603  0.0f,
604  1.0f,
605  "Blend Factor",
606  "Amount that the pose is applied on top of the existing poses",
607  0.0f,
608  1.0f);
609  /* Blending should always start at 0%, and not at whatever percentage was last used. This RNA
610  * property just exists for symmetry with the Apply operator (and thus simplicity of the rest of
611  * the code, which can assume this property exists). */
613 
615  "flipped",
616  false,
617  "Apply Flipped",
618  "When enabled, applies the pose flipped over the X-axis");
619  prop = RNA_def_boolean(ot->srna,
620  "release_confirm",
621  false,
622  "Confirm on Release",
623  "Always confirm operation when releasing button");
625 }
Blender kernel action and pose functionality.
struct bPoseChannel * BKE_pose_channel_find_name(const struct bPose *pose, const char *name)
void BKE_action_flip_with_pose(struct bAction *act, struct Object *ob_arm)
struct AnimData * BKE_animdata_from_id(const struct ID *id)
AnimationEvalContext BKE_animsys_eval_context_construct(struct Depsgraph *depsgraph, float eval_time)
Definition: anim_sys.c:761
#define PBONE_SELECTED(arm, bone)
Definition: BKE_armature.h:557
void BKE_pose_apply_action_blend(struct Object *ob, struct bAction *action, struct AnimationEvalContext *anim_eval_context, float blend_factor)
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:738
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
bool CTX_wm_interface_locked(const bContext *C)
Definition: context.c:718
const struct AssetLibraryReference * CTX_wm_asset_library_ref(const bContext *C)
Definition: context.c:1475
struct wmWindowManager * CTX_wm_manager(const bContext *C)
Definition: context.c:713
struct Object * CTX_data_active_object(const bContext *C)
Definition: context.c:1353
struct AssetHandle CTX_wm_asset_handle(const bContext *C, bool *r_is_valid)
Definition: context.c:1480
struct Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
Definition: context.c:1505
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:723
@ LIB_ID_COPY_LOCALIZE
Definition: BKE_lib_id.h:187
struct ID * BKE_id_copy_ex(struct Main *bmain, const struct ID *id, struct ID **r_newid, int flag)
bool BKE_id_is_editable(const struct Main *bmain, const struct ID *id)
void BKE_id_free(struct Main *bmain, void *idv)
General operations, lookup, etc. for blender objects.
struct Object * BKE_object_pose_armature_get(struct Object *ob)
Definition: object.cc:2511
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition: report.c:83
#define BLI_assert(a)
Definition: BLI_assert.h:46
#define BLI_assert_msg(a, msg)
Definition: BLI_assert.h:53
#define ATTR_FALLTHROUGH
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:466
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
#define CLAMPIS(a, b, c)
#define UNUSED(x)
#define ELEM(...)
#define TIP_(msgid)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
void DEG_id_tag_update(struct ID *id, int flag)
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:791
@ ID_AC
Definition: DNA_ID_enums.h:67
@ POSE_LOCKED
@ POSE_DO_UNLOCK
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_RUNNING_MODAL
ID_Type ED_asset_handle_get_id_type(const struct AssetHandle *asset)
void ED_asset_temp_id_consumer_free(AssetTempIDConsumer **consumer)
AssetTempIDConsumer * ED_asset_temp_id_consumer_create(const struct AssetHandle *handle)
struct AssetTempIDConsumer AssetTempIDConsumer
struct ID * ED_asset_temp_id_consumer_ensure_local_id(AssetTempIDConsumer *consumer, const struct bContext *C, const struct AssetLibraryReference *asset_library_ref, ID_Type id_type, struct Main *bmain, struct ReportList *reports)
@ MODIFYKEY_MODE_INSERT
#define ANIM_KS_WHOLE_CHARACTER_ID
void ED_area_status_text(ScrArea *area, const char *str)
Definition: area.c:792
void ED_workspace_status_text(struct bContext *C, const char *str)
Definition: area.c:816
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
@ PROP_SKIP_SAVE
Definition: RNA_types.h:218
@ PROP_HIDDEN
Definition: RNA_types.h:216
#define C
Definition: RandGen.cpp:25
#define UI_MAX_DRAW_STR
Definition: UI_interface.h:91
@ KM_NOTHING
Definition: WM_types.h:266
@ KM_PRESS
Definition: WM_types.h:267
@ KM_RELEASE
Definition: WM_types.h:268
@ OPTYPE_BLOCKING
Definition: WM_types.h:150
@ OPTYPE_UNDO
Definition: WM_types.h:148
@ OPTYPE_REGISTER
Definition: WM_types.h:146
@ WM_CURSOR_WRAP_XY
Definition: WM_types.h:192
#define NC_ANIMATION
Definition: WM_types.h:338
#define ND_POSE
Definition: WM_types.h:407
#define NA_EDITED
Definition: WM_types.h:523
#define ND_KEYFRAME
Definition: WM_types.h:442
#define NC_OBJECT
Definition: WM_types.h:329
unsigned int U
Definition: btGjkEpa3.h:78
Scene scene
const Depsgraph * depsgraph
bool autokeyframe_cfra_can_key(const Scene *scene, ID *id)
Definition: keyframing.c:2850
int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSet *ks, short mode, float cfra)
Definition: keyingsets.c:1038
KeyingSet * ANIM_get_keyingset_for_autokeying(const Scene *scene, const char *transformKSName)
Definition: keyingsets.c:696
void ANIM_relative_keyingset_add_source(ListBase *dsources, ID *id, StructRNA *srna, void *data)
Definition: keyingsets.c:924
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
void ED_pose_backup_free(PoseBackup *pbd)
Definition: pose_backup.cc:120
bool ED_pose_backup_is_selection_relevant(const struct PoseBackup *pose_backup)
Definition: pose_backup.cc:101
PoseBackup * ED_pose_backup_create_selected_bones(const Object *ob, const bAction *action)
Definition: pose_backup.cc:94
void ED_pose_backup_restore(const PoseBackup *pbd)
Definition: pose_backup.cc:106
static bool poselib_asset_in_context(bContext *C)
Definition: pose_lib_2.c:526
static int poselib_blend_exit(bContext *C, wmOperator *op)
Definition: pose_lib_2.c:455
static void poselib_blend_cleanup(bContext *C, wmOperator *op)
Definition: pose_lib_2.c:385
static int poselib_blend_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition: pose_lib_2.c:478
static Object * get_poselib_object(bContext *C)
Definition: pose_lib_2.c:274
static bool poselib_blend_poll(bContext *C)
Definition: pose_lib_2.c:538
static void poselib_blend_cancel(bContext *C, wmOperator *op)
Definition: pose_lib_2.c:470
static void poselib_blend_apply(bContext *C, wmOperator *op)
Definition: pose_lib_2.c:145
void POSELIB_OT_apply_pose_asset(wmOperatorType *ot)
Definition: pose_lib_2.c:549
static void poselib_blend_cursor_update(bContext *C, wmOperator *op)
Definition: pose_lib_2.c:260
static void poselib_slide_mouse_update_blendfactor(PoseBlendData *pbd, const wmEvent *event)
Definition: pose_lib_2.c:195
static void poselib_tempload_exit(PoseBlendData *pbd)
Definition: pose_lib_2.c:282
static void poselib_backup_posecopy(PoseBlendData *pbd)
Definition: pose_lib_2.c:86
static void poselib_keytag_pose(bContext *C, Scene *scene, PoseBlendData *pbd)
Definition: pose_lib_2.c:99
static bAction * poselib_blend_init_get_action(bContext *C, wmOperator *op)
Definition: pose_lib_2.c:287
struct PoseBlendData PoseBlendData
static void poselib_blend_free(wmOperator *op)
Definition: pose_lib_2.c:431
static bAction * flip_pose(bContext *C, Object *ob, bAction *action)
Definition: pose_lib_2.c:302
void POSELIB_OT_blend_pose_asset(wmOperatorType *ot)
Definition: pose_lib_2.c:580
static void poselib_blend_set_factor(PoseBlendData *pbd, const float new_factor)
Definition: pose_lib_2.c:189
static bool poselib_blend_init_data(bContext *C, wmOperator *op, const wmEvent *event)
Definition: pose_lib_2.c:319
static int poselib_blend_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: pose_lib_2.c:497
static int poselib_blend_exec(bContext *C, wmOperator *op)
Definition: pose_lib_2.c:512
ePoseBlendState
Definition: pose_lib_2.c:47
@ POSE_BLEND_CANCEL
Definition: pose_lib_2.c:52
@ POSE_BLEND_CONFIRM
Definition: pose_lib_2.c:51
@ POSE_BLEND_ORIGINAL
Definition: pose_lib_2.c:50
@ POSE_BLEND_INIT
Definition: pose_lib_2.c:48
@ POSE_BLEND_BLENDING
Definition: pose_lib_2.c:49
static int poselib_blend_handle_event(bContext *UNUSED(C), wmOperator *op, const wmEvent *event)
Definition: pose_lib_2.c:210
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:717
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:2153
float RNA_float_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4957
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
Definition: rna_access.c:4968
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4863
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3493
PropertyRNA * RNA_def_float_factor(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
Definition: rna_define.c:4144
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1490
bAction * action
char name[66]
Definition: DNA_ID.h:378
struct bPose * pose
void * data
AssetTempIDConsumer * temp_id_consumer
Definition: pose_lib_2.c:68
struct PoseBlendData::@329 release_confirm_info
Scene * scene
Definition: pose_lib_2.c:78
char headerstr[UI_MAX_DRAW_STR]
Definition: pose_lib_2.c:82
int drag_start_xy[2]
Definition: pose_lib_2.c:61
ScrArea * area
Definition: pose_lib_2.c:79
Object * ob
Definition: pose_lib_2.c:74
ePoseBlendState state
Definition: pose_lib_2.c:56
bool use_release_confirm
Definition: pose_lib_2.c:60
struct PoseBackup * pose_backup
Definition: pose_lib_2.c:72
bool free_action
Definition: pose_lib_2.c:76
bAction * act
Definition: pose_lib_2.c:75
float blend_factor
Definition: pose_lib_2.c:71
bool needs_redraw
Definition: pose_lib_2.c:57
int init_event_type
Definition: pose_lib_2.c:62
bool cursor_wrap_enabled
Definition: pose_lib_2.c:64
struct RenderData r
ScrVert * v1
ListBase groups
struct Bone * bone
short flag
short x
Definition: DNA_vec_types.h:18
short val
Definition: WM_types.h:680
int xy[2]
Definition: WM_types.h:682
short type
Definition: WM_types.h:678
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:919
const char * name
Definition: WM_types.h:888
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:935
const char * idname
Definition: WM_types.h:890
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:943
void(* cancel)(struct bContext *, struct wmOperator *)
Definition: WM_types.h:927
struct StructRNA * srna
Definition: WM_types.h:969
const char * description
Definition: WM_types.h:893
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:903
struct ReportList * reports
struct PointerRNA * ptr
void WM_cursor_grab_enable(wmWindow *win, int wrap, bool hide, int bounds[4])
Definition: wm_cursors.c:226
void WM_cursor_grab_disable(wmWindow *win, const int mouse_ungrab_xy[2])
Definition: wm_cursors.c:263
int WM_userdef_event_type_from_keymap_type(int kmitype)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void WM_set_locked_interface(wmWindowManager *wm, bool lock)
void WM_event_add_mousemove(wmWindow *win)
@ RIGHTMOUSE
@ EVT_TABKEY
@ EVT_PADENTER
@ EVT_SPACEKEY
@ MOUSEMOVE
@ LEFTMOUSE
@ EVT_ESCKEY
@ EVT_RETKEY
wmOperatorType * ot
Definition: wm_files.c:3479