1 /* 2 * This program is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU General Public License 4 * as published by the Free Software Foundation; either version 2 5 * of the License, or (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software Foundation, 14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15 * 16 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 17 * All rights reserved. 18 */ 19 20 /** \file 21 * \ingroup DNA 22 * 23 * Define actions data-block for the animation system. 24 * A collection of animation curves and drivers to be assigned to data-blocks 25 * or sequenced in the non-linear-editor (NLA). 26 */ 27 28 #pragma once 29 30 #include "DNA_ID.h" 31 #include "DNA_listBase.h" 32 #include "DNA_session_uuid_types.h" 33 #include "DNA_userdef_types.h" /* ThemeWireColor */ 34 #include "DNA_vec_types.h" 35 #include "DNA_view2d_types.h" 36 37 #ifdef __cplusplus 38 extern "C" { 39 #endif 40 41 struct Collection; 42 struct GHash; 43 struct Object; 44 struct SpaceLink; 45 46 /* ************************************************ */ 47 /* Visualization */ 48 49 /* Motion Paths ------------------------------------ */ 50 /* (used for Pose Channels and Objects) */ 51 52 /* Data point for motion path (mpv) */ 53 typedef struct bMotionPathVert { 54 /** Coordinates of point in 3D-space. */ 55 float co[3]; 56 /** Quick settings. */ 57 int flag; 58 } bMotionPathVert; 59 60 /* bMotionPathVert->flag */ 61 typedef enum eMotionPathVert_Flag { 62 /* vert is selected */ 63 MOTIONPATH_VERT_SEL = (1 << 0), 64 MOTIONPATH_VERT_KEY = (1 << 1), 65 } eMotionPathVert_Flag; 66 67 /* ........ */ 68 69 /* Motion Path data cache (mpath) 70 * - for elements providing transforms (i.e. Objects or PoseChannels) 71 */ 72 typedef struct bMotionPath { 73 /** Path samples. */ 74 bMotionPathVert *points; 75 /** The number of cached verts. */ 76 int length; 77 78 /** For drawing paths, the start frame number. */ 79 int start_frame; 80 /** For drawing paths, the end frame number. */ 81 int end_frame; 82 83 /** Optional custom color. */ 84 float color[3]; 85 /** Line thickness. */ 86 int line_thickness; 87 /** Baking settings - eMotionPath_Flag. */ 88 int flag; 89 90 /* Used for drawing. */ 91 struct GPUVertBuf *points_vbo; 92 struct GPUBatch *batch_line; 93 struct GPUBatch *batch_points; 94 void *_pad; 95 } bMotionPath; 96 97 /* bMotionPath->flag */ 98 typedef enum eMotionPath_Flag { 99 /* (for bones) path represents the head of the bone */ 100 MOTIONPATH_FLAG_BHEAD = (1 << 0), 101 /* motion path is being edited */ 102 MOTIONPATH_FLAG_EDIT = (1 << 1), 103 /* Custom colors */ 104 MOTIONPATH_FLAG_CUSTOM = (1 << 2), 105 /* Draw lines or only points */ 106 MOTIONPATH_FLAG_LINES = (1 << 3), 107 } eMotionPath_Flag; 108 109 /* Visualization General --------------------------- */ 110 /* for Objects or Poses (but NOT PoseChannels) */ 111 112 /* Animation Visualization Settings (avs) */ 113 typedef struct bAnimVizSettings { 114 /* General Settings ------------------------ */ 115 /** #eAnimViz_RecalcFlags. */ 116 short recalc; 117 118 /* Motion Path Settings ------------------- */ 119 /** #eMotionPath_Types. */ 120 short path_type; 121 /** Number of frames between points indicated on the paths. */ 122 short path_step; 123 124 /** #eMotionPaths_ViewFlag. */ 125 short path_viewflag; 126 /** #eMotionPaths_BakeFlag. */ 127 short path_bakeflag; 128 char _pad[6]; 129 130 /** Start and end frames of path-calculation range. */ 131 int path_sf, path_ef; 132 /** Number of frames before/after current frame to show. */ 133 int path_bc, path_ac; 134 } bAnimVizSettings; 135 136 /* bAnimVizSettings->recalc */ 137 typedef enum eAnimViz_RecalcFlags { 138 /* motionpaths need recalculating */ 139 ANIMVIZ_RECALC_PATHS = (1 << 0), 140 } eAnimViz_RecalcFlags; 141 142 /* bAnimVizSettings->path_type */ 143 typedef enum eMotionPaths_Types { 144 /* show the paths along their entire ranges */ 145 MOTIONPATH_TYPE_RANGE = 0, 146 /* only show the parts of the paths around the current frame */ 147 MOTIONPATH_TYPE_ACFRA = 1, 148 } eMotionPath_Types; 149 150 /* bAnimVizSettings->path_viewflag */ 151 typedef enum eMotionPaths_ViewFlag { 152 /* show frames on path */ 153 MOTIONPATH_VIEW_FNUMS = (1 << 0), 154 /* show keyframes on path */ 155 MOTIONPATH_VIEW_KFRAS = (1 << 1), 156 /* show keyframe/frame numbers */ 157 MOTIONPATH_VIEW_KFNOS = (1 << 2), 158 /* find keyframes in whole action (instead of just in matching group name) */ 159 MOTIONPATH_VIEW_KFACT = (1 << 3), 160 /* draw lines on path */ 161 /* MOTIONPATH_VIEW_LINES = (1 << 4), */ /* UNUSED */ 162 } eMotionPath_ViewFlag; 163 164 /* bAnimVizSettings->path_bakeflag */ 165 typedef enum eMotionPaths_BakeFlag { 166 /** motion paths directly associated with this block of settings needs updating */ 167 /* MOTIONPATH_BAKE_NEEDS_RECALC = (1 << 0), */ /* UNUSED */ 168 /** for bones - calculate head-points for curves instead of tips */ 169 MOTIONPATH_BAKE_HEADS = (1 << 1), 170 /** motion paths exist for AnimVizSettings instance - set when calc for first time, 171 * and unset when clearing */ 172 MOTIONPATH_BAKE_HAS_PATHS = (1 << 2), 173 } eMotionPath_BakeFlag; 174 175 /* runtime */ 176 # 177 # 178 typedef struct bPoseChannelDrawData { 179 float solid_color[4]; 180 float wire_color[4]; 181 182 int bbone_matrix_len; 183 /* keep last */ 184 float bbone_matrix[0][4][4]; 185 } bPoseChannelDrawData; 186 187 struct DualQuat; 188 struct Mat4; 189 190 typedef struct bPoseChannel_Runtime { 191 SessionUUID session_uuid; 192 193 /* Cached dual quaternion for deformation. */ 194 struct DualQuat deform_dual_quat; 195 196 /* B-Bone shape data: copy of the segment count for validation. */ 197 int bbone_segments; 198 199 /* Rest and posed matrices for segments. */ 200 struct Mat4 *bbone_rest_mats; 201 struct Mat4 *bbone_pose_mats; 202 203 /* Delta from rest to pose in matrix and DualQuat form. */ 204 struct Mat4 *bbone_deform_mats; 205 struct DualQuat *bbone_dual_quats; 206 } bPoseChannel_Runtime; 207 208 /* ************************************************ */ 209 /* Poses */ 210 211 /* PoseChannel ------------------------------------ */ 212 213 /** 214 * PoseChannel 215 * 216 * A #bPoseChannel stores the results of Actions and transform information 217 * with respect to the rest-position of #bArmature bones. 218 */ 219 typedef struct bPoseChannel { 220 struct bPoseChannel *next, *prev; 221 222 /** User-Defined Properties on this PoseChannel. */ 223 IDProperty *prop; 224 225 /** Constraints that act on this PoseChannel. */ 226 ListBase constraints; 227 /** Need to match bone name length: MAXBONENAME. */ 228 char name[64]; 229 230 /** Dynamic, for detecting transform changes. */ 231 short flag; 232 /** Settings for IK bones. */ 233 short ikflag; 234 /** Protect channels from being transformed. */ 235 short protectflag; 236 /** Index of action-group this bone belongs to (0 = default/no group). */ 237 short agrp_index; 238 /** For quick detecting which constraints affect this channel. */ 239 char constflag; 240 /** Copy of bone flag, so you can work with library armatures, not for runtime use. */ 241 char selectflag; 242 char drawflag; 243 char bboneflag DNA_DEPRECATED; 244 char _pad0[4]; 245 246 /** Set on read file or rebuild pose. */ 247 struct Bone *bone; 248 /** Set on read file or rebuild pose. */ 249 struct bPoseChannel *parent; 250 /** Set on read file or rebuild pose, the 'ik' child, for b-bones. */ 251 struct bPoseChannel *child; 252 253 /** "IK trees" - only while evaluating pose. */ 254 struct ListBase iktree; 255 /** Spline-IK "trees" - only while evaluating pose. */ 256 struct ListBase siktree; 257 258 /** Motion path cache for this bone. */ 259 bMotionPath *mpath; 260 /** Draws custom object instead of default bone shape. */ 261 struct Object *custom; 262 /** 263 * Odd feature, display with another bones transform. 264 * needed in rare cases for advanced rigs, 265 * since the alternative is highly complicated - campbell 266 */ 267 struct bPoseChannel *custom_tx; 268 float custom_scale; 269 270 char _pad1[4]; 271 272 /** Transforms - written in by actions or transform. */ 273 float loc[3]; 274 float size[3]; 275 276 /** 277 * Rotations - written in by actions or transform 278 * (but only one representation gets used at any time) 279 */ 280 /** Euler rotation. */ 281 float eul[3]; 282 /** Quaternion rotation. */ 283 float quat[4]; 284 /** Axis-angle rotation. */ 285 float rotAxis[3], rotAngle; 286 /** #eRotationModes - rotation representation to use. */ 287 short rotmode; 288 char _pad[2]; 289 290 /** Matrix result of loc/quat/size, and where we put deform in, see next line */ 291 float chan_mat[4][4]; 292 /** 293 * Constraints accumulate here. in the end, pose_mat = bone->arm_mat * chan_mat 294 * this matrix is object space. 295 */ 296 float pose_mat[4][4]; 297 /** For display, pose_mat with bone length applied. */ 298 float disp_mat[4][4]; 299 /** For display, pose_mat with bone length applied and translated to tai.l*/ 300 float disp_tail_mat[4][4]; 301 /** 302 * Inverse result of constraints. 303 * doesn't include effect of rest-position, parent, and local transform. 304 */ 305 float constinv[4][4]; 306 307 /** Actually pose_mat[3]. */ 308 float pose_head[3]; 309 /** Also used for drawing help lines. */ 310 float pose_tail[3]; 311 312 /** DOF constraint, note! - these are stored in degrees, not radians. */ 313 float limitmin[3], limitmax[3]; 314 /** DOF stiffness. */ 315 float stiffness[3]; 316 float ikstretch; 317 /** Weight of joint rotation constraint. */ 318 float ikrotweight; 319 /** Weight of joint stretch constraint. */ 320 float iklinweight; 321 322 /** 323 * Curved bones settings - these are for animating, 324 * and are applied on top of the copies in pchan->bone 325 */ 326 float roll1, roll2; 327 float curve_in_x, curve_in_y; 328 float curve_out_x, curve_out_y; 329 float ease1, ease2; 330 float scale_in_x, scale_in_y; 331 float scale_out_x, scale_out_y; 332 333 /** B-Bone custom handles; set on read file or rebuild pose based on pchan->bone data. */ 334 struct bPoseChannel *bbone_prev; 335 struct bPoseChannel *bbone_next; 336 337 /** Use for outliner. */ 338 void *temp; 339 /** Runtime data for color and bbone segment matrix. */ 340 bPoseChannelDrawData *draw_data; 341 342 /** Points to an original pose channel. */ 343 struct bPoseChannel *orig_pchan; 344 345 /** Runtime data (keep last). */ 346 struct bPoseChannel_Runtime runtime; 347 } bPoseChannel; 348 349 /* PoseChannel (transform) flags */ 350 typedef enum ePchan_Flag { 351 /* has transforms */ 352 POSE_LOC = (1 << 0), 353 POSE_ROT = (1 << 1), 354 POSE_SIZE = (1 << 2), 355 356 /* old IK/cache stuff 357 * - used to be here from (1 << 3) to (1 << 8) 358 * but has been repurposed since 2.77.2 359 * as they haven't been used in over 10 years 360 */ 361 362 /* has BBone deforms */ 363 POSE_BBONE_SHAPE = (1 << 3), 364 365 /* IK/Pose solving */ 366 POSE_CHAIN = (1 << 9), 367 POSE_DONE = (1 << 10), 368 /* visualization */ 369 POSE_KEY = (1 << 11), 370 /* POSE_STRIDE = (1 << 12), */ /* UNUSED */ 371 /* standard IK solving */ 372 POSE_IKTREE = (1 << 13), 373 #if 0 374 /* has Spline IK */ 375 POSE_HAS_IKS = (1 << 14), 376 #endif 377 /* spline IK solving */ 378 POSE_IKSPLINE = (1 << 15), 379 } ePchan_Flag; 380 381 /* PoseChannel constflag (constraint detection) */ 382 typedef enum ePchan_ConstFlag { 383 PCHAN_HAS_IK = (1 << 0), 384 PCHAN_HAS_CONST = (1 << 1), 385 /* only used for drawing Posemode, not stored in channel */ 386 /* PCHAN_HAS_ACTION = (1 << 2), */ /* UNUSED */ 387 PCHAN_HAS_TARGET = (1 << 3), 388 /* only for drawing Posemode too */ 389 /* PCHAN_HAS_STRIDE = (1 << 4), */ /* UNUSED */ 390 /* spline IK */ 391 PCHAN_HAS_SPLINEIK = (1 << 5), 392 } ePchan_ConstFlag; 393 394 /* PoseChannel->ikflag */ 395 typedef enum ePchan_IkFlag { 396 BONE_IK_NO_XDOF = (1 << 0), 397 BONE_IK_NO_YDOF = (1 << 1), 398 BONE_IK_NO_ZDOF = (1 << 2), 399 400 BONE_IK_XLIMIT = (1 << 3), 401 BONE_IK_YLIMIT = (1 << 4), 402 BONE_IK_ZLIMIT = (1 << 5), 403 404 BONE_IK_ROTCTL = (1 << 6), 405 BONE_IK_LINCTL = (1 << 7), 406 407 BONE_IK_NO_XDOF_TEMP = (1 << 10), 408 BONE_IK_NO_YDOF_TEMP = (1 << 11), 409 BONE_IK_NO_ZDOF_TEMP = (1 << 12), 410 } ePchan_IkFlag; 411 412 /* PoseChannel->drawflag */ 413 typedef enum ePchan_DrawFlag { 414 PCHAN_DRAW_NO_CUSTOM_BONE_SIZE = (1 << 0), 415 } ePchan_DrawFlag; 416 417 #define PCHAN_CUSTOM_DRAW_SIZE(pchan) \ 418 (pchan)->custom_scale *( \ 419 ((pchan)->drawflag & PCHAN_DRAW_NO_CUSTOM_BONE_SIZE) ? 1.0f : (pchan)->bone->length) 420 421 #ifdef DNA_DEPRECATED_ALLOW 422 /* PoseChannel->bboneflag */ 423 typedef enum ePchan_BBoneFlag { 424 /* Use custom reference bones (for roll and handle alignment), instead of immediate neighbors */ 425 PCHAN_BBONE_CUSTOM_HANDLES = (1 << 1), 426 /* Evaluate start handle as being "relative" */ 427 PCHAN_BBONE_CUSTOM_START_REL = (1 << 2), 428 /* Evaluate end handle as being "relative" */ 429 PCHAN_BBONE_CUSTOM_END_REL = (1 << 3), 430 } ePchan_BBoneFlag; 431 #endif 432 433 /* PoseChannel->rotmode and Object->rotmode */ 434 typedef enum eRotationModes { 435 /* quaternion rotations (default, and for older Blender versions) */ 436 ROT_MODE_QUAT = 0, 437 /* euler rotations - keep in sync with enum in BLI_math.h */ 438 /** Blender 'default' (classic) - must be as 1 to sync with BLI_math_rotation.h defines */ 439 ROT_MODE_EUL = 1, 440 ROT_MODE_XYZ = 1, 441 ROT_MODE_XZY = 2, 442 ROT_MODE_YXZ = 3, 443 ROT_MODE_YZX = 4, 444 ROT_MODE_ZXY = 5, 445 ROT_MODE_ZYX = 6, 446 /* NOTE: space is reserved here for 18 other possible 447 * euler rotation orders not implemented 448 */ 449 /* axis angle rotations */ 450 ROT_MODE_AXISANGLE = -1, 451 452 ROT_MODE_MIN = ROT_MODE_AXISANGLE, /* sentinel for Py API */ 453 ROT_MODE_MAX = ROT_MODE_ZYX, 454 } eRotationModes; 455 456 /* Pose ------------------------------------ */ 457 458 /* Pose-Object. 459 * 460 * It is only found under ob->pose. It is not library data, even 461 * though there is a define for it (hack for the outliner). 462 */ 463 typedef struct bPose { 464 /** List of pose channels, PoseBones in RNA. */ 465 ListBase chanbase; 466 /** Ghash for quicker string lookups. */ 467 struct GHash *chanhash; 468 469 /* Flat array of pose channels. It references pointers from 470 * chanbase. Used for quick pose channel lookup from an index. 471 */ 472 bPoseChannel **chan_array; 473 474 short flag; 475 char _pad[2]; 476 /** Proxy layer: copy from armature, gets synced. */ 477 unsigned int proxy_layer; 478 char _pad1[4]; 479 480 /** Local action time of this pose. */ 481 float ctime; 482 /** Applied to object. */ 483 float stride_offset[3]; 484 /** Result of match and cycles, applied in BKE_pose_where_is(). */ 485 float cyclic_offset[3]; 486 487 /** List of bActionGroups. */ 488 ListBase agroups; 489 490 /** Index of active group (starts from 1). */ 491 int active_group; 492 /** Ik solver to use, see ePose_IKSolverType. */ 493 int iksolver; 494 /** Temporary IK data, depends on the IK solver. Not saved in file. */ 495 void *ikdata; 496 /** IK solver parameters, structure depends on iksolver. */ 497 void *ikparam; 498 499 /** Settings for visualization of bone animation. */ 500 bAnimVizSettings avs; 501 /** Proxy active bone name, MAXBONENAME. */ 502 char proxy_act_bone[64]; 503 } bPose; 504 505 /* Pose->flag */ 506 typedef enum ePose_Flags { 507 /* results in BKE_pose_rebuild being called */ 508 POSE_RECALC = (1 << 0), 509 /* prevents any channel from getting overridden by anim from IPO */ 510 POSE_LOCKED = (1 << 1), 511 /* clears the POSE_LOCKED flag for the next time the pose is evaluated */ 512 POSE_DO_UNLOCK = (1 << 2), 513 /* pose has constraints which depend on time (used when depsgraph updates for a new frame) */ 514 POSE_CONSTRAINTS_TIMEDEPEND = (1 << 3), 515 /* recalculate bone paths */ 516 /* POSE_RECALCPATHS = (1 << 4), */ /* UNUSED */ 517 /* set by BKE_pose_rebuild to give a chance to the IK solver to rebuild IK tree */ 518 POSE_WAS_REBUILT = (1 << 5), 519 POSE_FLAG_DEPRECATED = (1 << 6), /* deprecated. */ 520 /* pose constraint flags needs to be updated */ 521 POSE_CONSTRAINTS_NEED_UPDATE_FLAGS = (1 << 7), 522 /* Use auto IK in pose mode */ 523 POSE_AUTO_IK = (1 << 8), 524 /* Use x-axis mirror in pose mode */ 525 POSE_MIRROR_EDIT = (1 << 9), 526 /* Use relative mirroring in mirror mode */ 527 POSE_MIRROR_RELATIVE = (1 << 10), 528 } ePose_Flags; 529 530 /* IK Solvers ------------------------------------ */ 531 532 /* bPose->iksolver and bPose->ikparam->iksolver */ 533 typedef enum ePose_IKSolverType { 534 IKSOLVER_STANDARD = 0, 535 IKSOLVER_ITASC = 1, 536 } ePose_IKSolverType; 537 538 /* header for all bPose->ikparam structures */ 539 typedef struct bIKParam { 540 int iksolver; 541 } bIKParam; 542 543 /* bPose->ikparam when bPose->iksolver=1 */ 544 typedef struct bItasc { 545 int iksolver; 546 float precision; 547 short numiter; 548 short numstep; 549 float minstep; 550 float maxstep; 551 short solver; 552 short flag; 553 float feedback; 554 /** Max velocity to SDLS solver. */ 555 float maxvel; 556 /** Maximum damping for DLS solver. */ 557 float dampmax; 558 /** Threshold of singular value from which the damping start progressively. */ 559 float dampeps; 560 } bItasc; 561 562 /* bItasc->flag */ 563 typedef enum eItasc_Flags { 564 ITASC_AUTO_STEP = (1 << 0), 565 ITASC_INITIAL_REITERATION = (1 << 1), 566 ITASC_REITERATION = (1 << 2), 567 ITASC_SIMULATION = (1 << 3), 568 } eItasc_Flags; 569 570 /* bItasc->solver */ 571 typedef enum eItasc_Solver { 572 ITASC_SOLVER_SDLS = 0, /* selective damped least square, suitable for CopyPose constraint */ 573 ITASC_SOLVER_DLS = 1, /* damped least square with numerical filtering of damping */ 574 } eItasc_Solver; 575 576 /* ************************************************ */ 577 /* Action */ 578 579 /* Groups -------------------------------------- */ 580 581 /* Action-Channel Group (agrp) 582 * 583 * These are stored as a list per-Action, and are only used to 584 * group that Action's channels in an Animation Editor. 585 * 586 * Even though all FCurves live in a big list per Action, each group they are in also 587 * holds references to the achans within that list which belong to it. Care must be taken to 588 * ensure that action-groups never end up being the sole 'owner' of a channel. 589 * 590 * This is also exploited for bone-groups. Bone-Groups are stored per bPose, and are used 591 * primarily to color bones in the 3d-view. There are other benefits too, but those are mostly 592 * related to Action-Groups. 593 * 594 * Note that these two uses each have their own RNA 'ActionGroup' and 'BoneGroup'. 595 */ 596 typedef struct bActionGroup { 597 struct bActionGroup *next, *prev; 598 599 /** 600 * Note: this must not be touched by standard listbase functions 601 * which would clear links to other channels. 602 */ 603 ListBase channels; 604 605 /** Settings for this action-group. */ 606 int flag; 607 /** 608 * Index of custom color set to use when used for bones 609 * (0=default - used for all old files, -1=custom set). 610 */ 611 int customCol; 612 /** Name of the group. */ 613 char name[64]; 614 615 /** Color set to use when customCol == -1. */ 616 ThemeWireColor cs; 617 } bActionGroup; 618 619 /* Action Group flags */ 620 typedef enum eActionGroup_Flag { 621 /* group is selected */ 622 AGRP_SELECTED = (1 << 0), 623 /* group is 'active' / last selected one */ 624 AGRP_ACTIVE = (1 << 1), 625 /* keyframes/channels belonging to it cannot be edited */ 626 AGRP_PROTECTED = (1 << 2), 627 /* for UI (DopeSheet), sub-channels are shown */ 628 AGRP_EXPANDED = (1 << 3), 629 /* sub-channels are not evaluated */ 630 AGRP_MUTED = (1 << 4), 631 /* sub-channels are not visible in Graph Editor */ 632 AGRP_NOTVISIBLE = (1 << 5), 633 /* for UI (Graph Editor), sub-channels are shown */ 634 AGRP_EXPANDED_G = (1 << 6), 635 636 /* sub channel modifiers off */ 637 AGRP_MODIFIERS_OFF = (1 << 7), 638 639 AGRP_TEMP = (1 << 30), 640 AGRP_MOVED = (1u << 31), 641 } eActionGroup_Flag; 642 643 /* Actions -------------------------------------- */ 644 645 /* Action - reusable F-Curve 'bag' (act) 646 * 647 * This contains F-Curves that may affect settings from more than one ID blocktype and/or datablock 648 * (i.e. sub-data linked/used directly to the ID block that the animation data is linked to), 649 * but with the restriction that the other unrelated data (i.e. data that is not directly used or 650 * linked to by the source ID block). 651 * 652 * It serves as a 'unit' of reusable animation information (i.e. keyframes/motion data), 653 * that affects a group of related settings (as defined by the user). 654 */ 655 typedef struct bAction { 656 /** ID-serialisation for relinking. */ 657 ID id; 658 659 /** Function-curves (FCurve). */ 660 ListBase curves; 661 /** Legacy data - Action Channels (bActionChannel) in pre-2.5 animation system. */ 662 ListBase chanbase DNA_DEPRECATED; 663 /** Groups of function-curves (bActionGroup). */ 664 ListBase groups; 665 /** Markers local to the Action (used to provide Pose-Libraries). */ 666 ListBase markers; 667 668 /** Settings for this action. */ 669 int flag; 670 /** Index of the active marker. */ 671 int active_marker; 672 673 /** 674 * Type of ID-blocks that action can be assigned to 675 * (if 0, will be set to whatever ID first evaluates it). 676 */ 677 int idroot; 678 char _pad[4]; 679 } bAction; 680 681 /* Flags for the action */ 682 typedef enum eAction_Flags { 683 /* flags for displaying in UI */ 684 ACT_COLLAPSED = (1 << 0), 685 ACT_SELECTED = (1 << 1), 686 687 /* flags for evaluation/editing */ 688 ACT_MUTED = (1 << 9), 689 /* ACT_PROTECTED = (1 << 10), */ /* UNUSED */ 690 /* ACT_DISABLED = (1 << 11), */ /* UNUSED */ 691 } eAction_Flags; 692 693 /* ************************************************ */ 694 /* Action/Dopesheet Editor */ 695 696 /* Storage for Dopesheet/Grease-Pencil Editor data */ 697 typedef struct bDopeSheet { 698 /** Currently ID_SCE (for Dopesheet), and ID_SC (for Grease Pencil). */ 699 ID *source; 700 /** Cache for channels (only initialized when pinned). */ /* XXX not used! */ 701 ListBase chanbase; 702 703 /** Object group for option to only include objects that belong to this Collection. */ 704 struct Collection *filter_grp; 705 /** String to search for in displayed names of F-Curves, or NlaTracks/GP Layers/etc. */ 706 char searchstr[64]; 707 708 /** Flags to use for filtering data #eAnimFilter_Flags. */ 709 int filterflag; 710 /** #eDopeSheet_FilterFlag2 */ 711 int filterflag2; 712 /** Standard flags. */ 713 int flag; 714 715 /** `index + 1` of channel to rename - only gets set by renaming operator. */ 716 int renameIndex; 717 } bDopeSheet; 718 719 /* DopeSheet filter-flag */ 720 typedef enum eDopeSheet_FilterFlag { 721 /* general filtering */ 722 /** only include channels relating to selected data */ 723 ADS_FILTER_ONLYSEL = (1 << 0), 724 725 /* temporary filters */ 726 /** for 'Drivers' editor - only include Driver data from AnimData */ 727 ADS_FILTER_ONLYDRIVERS = (1 << 1), 728 /** for 'NLA' editor - only include NLA data from AnimData */ 729 ADS_FILTER_ONLYNLA = (1 << 2), 730 /** for Graph Editor - used to indicate whether to include a filtering flag or not */ 731 ADS_FILTER_SELEDIT = (1 << 3), 732 733 /* general filtering */ 734 /** for 'DopeSheet' Editors - include 'summary' line */ 735 ADS_FILTER_SUMMARY = (1 << 4), 736 737 /* datatype-based filtering */ 738 ADS_FILTER_NOSHAPEKEYS = (1 << 6), 739 ADS_FILTER_NOMESH = (1 << 7), 740 /** for animdata on object level, if we only want to concentrate on materials/etc. */ 741 ADS_FILTER_NOOBJ = (1 << 8), 742 ADS_FILTER_NOLAT = (1 << 9), 743 ADS_FILTER_NOCAM = (1 << 10), 744 ADS_FILTER_NOMAT = (1 << 11), 745 ADS_FILTER_NOLAM = (1 << 12), 746 ADS_FILTER_NOCUR = (1 << 13), 747 ADS_FILTER_NOWOR = (1 << 14), 748 ADS_FILTER_NOSCE = (1 << 15), 749 ADS_FILTER_NOPART = (1 << 16), 750 ADS_FILTER_NOMBA = (1 << 17), 751 ADS_FILTER_NOARM = (1 << 18), 752 ADS_FILTER_NONTREE = (1 << 19), 753 ADS_FILTER_NOTEX = (1 << 20), 754 ADS_FILTER_NOSPK = (1 << 21), 755 ADS_FILTER_NOLINESTYLE = (1 << 22), 756 ADS_FILTER_NOMODIFIERS = (1 << 23), 757 ADS_FILTER_NOGPENCIL = (1 << 24), 758 /* NOTE: all new datablock filters will have to go in filterflag2 (see below) */ 759 760 /* NLA-specific filters */ 761 /** if the AnimData block has no NLA data, don't include to just show Action-line */ 762 ADS_FILTER_NLA_NOACT = (1 << 25), 763 764 /* general filtering 3 */ 765 /** include 'hidden' channels too (i.e. those from hidden Objects/Bones) */ 766 ADS_FILTER_INCL_HIDDEN = (1 << 26), 767 /** show only F-Curves which are disabled/have errors - for debugging drivers */ 768 ADS_FILTER_ONLY_ERRORS = (1 << 28), 769 770 #if 0 771 /** combination filters (some only used at runtime) */ 772 ADS_FILTER_NOOBDATA = (ADS_FILTER_NOCAM | ADS_FILTER_NOMAT | ADS_FILTER_NOLAM | 773 ADS_FILTER_NOCUR | ADS_FILTER_NOPART | ADS_FILTER_NOARM | 774 ADS_FILTER_NOSPK | ADS_FILTER_NOMODIFIERS), 775 #endif 776 } eDopeSheet_FilterFlag; 777 778 /* DopeSheet filter-flags - Overflow (filterflag2) */ 779 typedef enum eDopeSheet_FilterFlag2 { 780 ADS_FILTER_NOCACHEFILES = (1 << 1), 781 ADS_FILTER_NOMOVIECLIPS = (1 << 2), 782 ADS_FILTER_NOHAIR = (1 << 3), 783 ADS_FILTER_NOPOINTCLOUD = (1 << 4), 784 ADS_FILTER_NOVOLUME = (1 << 5), 785 } eDopeSheet_FilterFlag2; 786 787 /* DopeSheet general flags */ 788 typedef enum eDopeSheet_Flag { 789 /** when summary is shown, it is collapsed, so all other channels get hidden */ 790 ADS_FLAG_SUMMARY_COLLAPSED = (1 << 0), 791 /** show filters for datablocks */ 792 ADS_FLAG_SHOW_DBFILTERS = (1 << 1), 793 794 /** use fuzzy/partial string matches when ADS_FILTER_BY_FCU_NAME is enabled 795 * (WARNING: expensive operation) */ 796 ADS_FLAG_FUZZY_NAMES = (1 << 2), 797 /** do not sort datablocks (mostly objects) by name (NOTE: potentially expensive operation) */ 798 ADS_FLAG_NO_DB_SORT = (1 << 3), 799 /** Invert the search filter */ 800 ADS_FLAG_INVERT_FILTER = (1 << 4), 801 } eDopeSheet_Flag; 802 803 typedef struct SpaceAction_Runtime { 804 char flag; 805 char _pad0[7]; 806 } SpaceAction_Runtime; 807 808 /* Action Editor Space. This is defined here instead of in DNA_space_types.h */ 809 typedef struct SpaceAction { 810 struct SpaceLink *next, *prev; 811 /** Storage of regions for inactive spaces. */ 812 ListBase regionbase; 813 char spacetype; 814 char link_flag; 815 char _pad0[6]; 816 /* End 'SpaceLink' header. */ 817 818 /** Copied to region. */ 819 View2D v2d DNA_DEPRECATED; 820 821 /** The currently active action. */ 822 bAction *action; 823 /** The currently active context (when not showing action). */ 824 bDopeSheet ads; 825 826 /** For Time-Slide transform mode drawing - current frame?. */ 827 float timeslide; 828 829 short flag; 830 /* Editing context */ 831 char mode; 832 /* Storage for sub-space types. */ 833 char mode_prev; 834 /** Automatic keyframe snapping mode . */ 835 char autosnap; 836 /** (eTimeline_Cache_Flag). */ 837 char cache_display; 838 char _pad1[6]; 839 840 SpaceAction_Runtime runtime; 841 } SpaceAction; 842 843 /* SpaceAction flag */ 844 typedef enum eSAction_Flag { 845 /* during transform (only set for TimeSlide) */ 846 SACTION_MOVING = (1 << 0), 847 /* show sliders */ 848 SACTION_SLIDERS = (1 << 1), 849 /* draw time in seconds instead of time in frames */ 850 SACTION_DRAWTIME = (1 << 2), 851 /* don't filter action channels according to visibility */ 852 // SACTION_NOHIDE = (1 << 3), /* XXX deprecated... old animation systems. */ 853 /* don't kill overlapping keyframes after transform */ 854 SACTION_NOTRANSKEYCULL = (1 << 4), 855 /* don't include keyframes that are out of view */ 856 // SACTION_HORIZOPTIMISEON = (1 << 5), // XXX deprecated... old irrelevant trick 857 /* show pose-markers (local to action) in Action Editor mode */ 858 SACTION_POSEMARKERS_SHOW = (1 << 6), 859 /* don't draw action channels using group colors (where applicable) */ 860 SACTION_NODRAWGCOLORS = (1 << 7), 861 /* SACTION_NODRAWCFRANUM = (1 << 8), DEPRECATED */ 862 /* don't perform realtime updates */ 863 SACTION_NOREALTIMEUPDATES = (1 << 10), 864 /* move markers as well as keyframes */ 865 SACTION_MARKERS_MOVE = (1 << 11), 866 /* show interpolation type */ 867 SACTION_SHOW_INTERPOLATION = (1 << 12), 868 /* show extremes */ 869 SACTION_SHOW_EXTREMES = (1 << 13), 870 /* show markers region */ 871 SACTION_SHOW_MARKERS = (1 << 14), 872 } eSAction_Flag; 873 874 /* SpaceAction_Runtime.flag */ 875 typedef enum eSAction_Runtime_Flag { 876 /** Temporary flag to force channel selections to be synced with main */ 877 SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC = (1 << 0), 878 } eSAction_Runtime_Flag; 879 880 /* SpaceAction Mode Settings */ 881 typedef enum eAnimEdit_Context { 882 /* action on the active object */ 883 SACTCONT_ACTION = 0, 884 /* list of all shapekeys on the active object, linked with their F-Curves */ 885 SACTCONT_SHAPEKEY = 1, 886 /* editing of gpencil data */ 887 SACTCONT_GPENCIL = 2, 888 /* dopesheet (default) */ 889 SACTCONT_DOPESHEET = 3, 890 /* mask */ 891 SACTCONT_MASK = 4, 892 /* cache file */ 893 SACTCONT_CACHEFILE = 5, 894 /* timeline - replacement for the standalone "timeline editor" */ 895 SACTCONT_TIMELINE = 6, 896 } eAnimEdit_Context; 897 898 /* SpaceAction AutoSnap Settings (also used by other Animation Editors) */ 899 typedef enum eAnimEdit_AutoSnap { 900 /* no auto-snap */ 901 SACTSNAP_OFF = 0, 902 /* snap to 1.0 frame/second intervals */ 903 SACTSNAP_STEP = 1, 904 /* snap to actual frames/seconds (nla-action time) */ 905 SACTSNAP_FRAME = 2, 906 /* snap to nearest marker */ 907 SACTSNAP_MARKER = 3, 908 /* snap to actual seconds (nla-action time) */ 909 SACTSNAP_SECOND = 4, 910 /* snap to 1.0 second increments */ 911 SACTSNAP_TSTEP = 5, 912 } eAnimEdit_AutoSnap; 913 914 /* SAction->cache_display */ 915 typedef enum eTimeline_Cache_Flag { 916 TIME_CACHE_DISPLAY = (1 << 0), 917 TIME_CACHE_SOFTBODY = (1 << 1), 918 TIME_CACHE_PARTICLES = (1 << 2), 919 TIME_CACHE_CLOTH = (1 << 3), 920 TIME_CACHE_SMOKE = (1 << 4), 921 TIME_CACHE_DYNAMICPAINT = (1 << 5), 922 TIME_CACHE_RIGIDBODY = (1 << 6), 923 } eTimeline_Cache_Flag; 924 925 /* ************************************************ */ 926 /* Legacy Data */ 927 928 /* WARNING: Action Channels are now deprecated... they were part of the old animation system! 929 * (ONLY USED FOR DO_VERSIONS...) 930 * 931 * Action Channels belong to Actions. They are linked with an IPO block, and can also own 932 * Constraint Channels in certain situations. 933 * 934 * Action-Channels can only belong to one group at a time, but they still live the Action's 935 * list of achans (to preserve backwards compatibility, and also minimize the code 936 * that would need to be recoded). Grouped achans are stored at the start of the list, according 937 * to the position of the group in the list, and their position within the group. 938 */ 939 typedef struct bActionChannel { 940 struct bActionChannel *next, *prev; 941 /** Action Group this Action Channel belongs to. */ 942 bActionGroup *grp; 943 944 /** IPO block this action channel references. */ 945 struct Ipo *ipo; 946 /** Constraint Channels (when Action Channel represents an Object or Bone). */ 947 ListBase constraintChannels; 948 949 /** Settings accessed via bitmapping. */ 950 int flag; 951 /** Channel name, MAX_NAME. */ 952 char name[64]; 953 /** Temporary setting - may be used to indicate group that channel belongs to during syncing. */ 954 int temp; 955 } bActionChannel; 956 957 #ifdef __cplusplus 958 } 959 #endif 960