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.
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.
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.
16 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17 * All rights reserved.
24 * This file defines structures for Shape-Keys (not animation keyframes),
25 * attached to Mesh, Curve and Lattice Data. Even though Key's are ID blocks they
26 * aren't intended to be shared between multiple data blocks as with other ID types.
31 #include "DNA_listBase.h"
40 typedef struct KeyBlock {
41 struct KeyBlock *next, *prev;
44 * point in time (Key->type == KEY_NORMAL) only,
45 * for historic reasons this is relative to (Key->ctime / 100),
46 * so this value increments by 0.1f per frame.
49 /** influence (typically [0 - 1] but can be more), (Key->type == KEY_RELATIVE) only.*/
52 /** interpolation type (Key->type == KEY_NORMAL) only. */
56 /** relative == 0 means first key is reference, otherwise the index of Key->blocks */
60 /** total number if items in the keyblock (compare with mesh/curve verts to check we match) */
62 /** for meshes only, match the unique number with the customdata layer */
65 /** array of shape key values, size is (Key->elemsize * KeyBlock->totelem) */
67 /** MAX_NAME (unique name, user assigned) */
69 /** MAX_VGROUP_NAME (optional vertex group), array gets allocated into 'weights' when set */
72 /** ranges, for RNA and UI only to clamp 'curval' */
80 /** Animation data (must be immediately after id for utilities to use it). */
84 * commonly called 'Basis', (Key->type == KEY_RELATIVE) only.
85 * Looks like this is _always_ 'key->block.first',
86 * perhaps later on it could be defined as some other KeyBlock - campbell
91 * This is not a regular string, although it is \0 terminated
92 * this is an array of (element_array_size, element_type) pairs
93 * (each one char) used for calculating shape key-blocks. */
95 /** Size of each element in #KeyBlock.data, use for allocation and stride. */
99 /** list of KeyBlock's */
101 /** old animation system, deprecated for 2.5 */
102 struct Ipo *ipo DNA_DEPRECATED;
106 /** (totkey == BLI_listbase_count(&key->block)) */
109 /** absolute or relative shape key */
113 /** Only used when (Key->type == KEY_NORMAL), this value is used as a time slider,
114 * rather than using the scene's time, this value can be animated to give greater control */
118 * Can never be 0, this is used for detecting old data.
119 * current free UID for key-blocks.
124 /* **************** KEY ********************* */
126 /* Key->type: KeyBlocks are interpreted as... */
128 /* Sequential positions over time (using KeyBlock->pos and Key->ctime) */
131 /* States to blend between (default) */
150 KEYBLOCK_MUTE = (1 << 0),
151 KEYBLOCK_SEL = (1 << 1),
152 KEYBLOCK_LOCKED = (1 << 2),
155 #define KEYELEM_FLOAT_LEN_COORD 3
157 /* Curve key data layout constants */
158 #define KEYELEM_ELEM_SIZE_CURVE 3
160 #define KEYELEM_ELEM_LEN_BPOINT 2
161 #define KEYELEM_FLOAT_LEN_BPOINT (KEYELEM_ELEM_LEN_BPOINT * KEYELEM_ELEM_SIZE_CURVE)
163 #define KEYELEM_ELEM_LEN_BEZTRIPLE 4
164 #define KEYELEM_FLOAT_LEN_BEZTRIPLE (KEYELEM_ELEM_LEN_BEZTRIPLE * KEYELEM_ELEM_SIZE_CURVE)