Blender  V2.93
Functions
BKE_key.h File Reference

Go to the source code of this file.

Functions

void BKE_key_free (struct Key *key)
 
void BKE_key_free_nolib (struct Key *key)
 
struct Key * BKE_key_add (struct Main *bmain, struct ID *id)
 
void BKE_key_sort (struct Key *key)
 
void key_curve_position_weights (float t, float data[4], int type)
 
void key_curve_tangent_weights (float t, float data[4], int type)
 
void key_curve_normal_weights (float t, float data[4], int type)
 
float * BKE_key_evaluate_object_ex (struct Object *ob, int *r_totelem, float *arr, size_t arr_size)
 
float * BKE_key_evaluate_object (struct Object *ob, int *r_totelem)
 
int BKE_keyblock_element_count_from_shape (const struct Key *key, const int shape_index)
 
int BKE_keyblock_element_count (const struct Key *key)
 
size_t BKE_keyblock_element_calc_size_from_shape (const struct Key *key, const int shape_index)
 
size_t BKE_keyblock_element_calc_size (const struct Key *key)
 
bool BKE_key_idtype_support (const short id_type)
 
struct Key ** BKE_key_from_id_p (struct ID *id)
 
struct Key * BKE_key_from_id (struct ID *id)
 
struct Key ** BKE_key_from_object_p (const struct Object *ob)
 
struct Key * BKE_key_from_object (const struct Object *ob)
 
struct KeyBlock * BKE_keyblock_from_object (struct Object *ob)
 
struct KeyBlock * BKE_keyblock_from_object_reference (struct Object *ob)
 
struct KeyBlock * BKE_keyblock_add (struct Key *key, const char *name)
 
struct KeyBlock * BKE_keyblock_add_ctime (struct Key *key, const char *name, const bool do_force)
 
struct KeyBlock * BKE_keyblock_from_key (struct Key *key, int index)
 
struct KeyBlock * BKE_keyblock_find_name (struct Key *key, const char name[])
 
void BKE_keyblock_copy_settings (struct KeyBlock *kb_dst, const struct KeyBlock *kb_src)
 
char * BKE_keyblock_curval_rnapath_get (struct Key *key, struct KeyBlock *kb)
 
void BKE_keyblock_update_from_lattice (struct Lattice *lt, struct KeyBlock *kb)
 
void BKE_keyblock_convert_from_lattice (struct Lattice *lt, struct KeyBlock *kb)
 
void BKE_keyblock_convert_to_lattice (struct KeyBlock *kb, struct Lattice *lt)
 
int BKE_keyblock_curve_element_count (struct ListBase *nurb)
 
void BKE_keyblock_curve_data_transform (const struct ListBase *nurb, const float mat[4][4], const void *src, void *dst)
 
void BKE_keyblock_update_from_curve (struct Curve *cu, struct KeyBlock *kb, struct ListBase *nurb)
 
void BKE_keyblock_convert_from_curve (struct Curve *cu, struct KeyBlock *kb, struct ListBase *nurb)
 
void BKE_keyblock_convert_to_curve (struct KeyBlock *kb, struct Curve *cu, struct ListBase *nurb)
 
void BKE_keyblock_update_from_mesh (struct Mesh *me, struct KeyBlock *kb)
 
void BKE_keyblock_convert_from_mesh (struct Mesh *me, struct Key *key, struct KeyBlock *kb)
 
void BKE_keyblock_convert_to_mesh (struct KeyBlock *kb, struct Mesh *me)
 
void BKE_keyblock_mesh_calc_normals (struct KeyBlock *kb, struct Mesh *mesh, float(*r_vertnors)[3], float(*r_polynors)[3], float(*r_loopnors)[3])
 
void BKE_keyblock_update_from_vertcos (struct Object *ob, struct KeyBlock *kb, const float(*vertCos)[3])
 
void BKE_keyblock_convert_from_vertcos (struct Object *ob, struct KeyBlock *kb, const float(*vertCos)[3])
 
float(* BKE_keyblock_convert_to_vertcos (struct Object *ob, struct KeyBlock *kb))[3]
 
void BKE_keyblock_update_from_offset (struct Object *ob, struct KeyBlock *kb, const float(*ofs)[3])
 
bool BKE_keyblock_move (struct Object *ob, int org_index, int new_index)
 
bool BKE_keyblock_is_basis (struct Key *key, const int index)
 
Key-Block Data Access
void BKE_keyblock_data_get_from_shape (const struct Key *key, float(*arr)[3], const int shape_index)
 
void BKE_keyblock_data_get (const struct Key *key, float(*arr)[3])
 
void BKE_keyblock_data_set_with_mat4 (struct Key *key, const int shape_index, const float(*coords)[3], const float mat[4][4])
 
void BKE_keyblock_curve_data_set_with_mat4 (struct Key *key, const struct ListBase *nurb, const int shape_index, const void *data, const float mat[4][4])
 
void BKE_keyblock_data_set (struct Key *key, const int shape_index, const void *data)
 

Function Documentation

◆ BKE_key_add()

struct Key* BKE_key_add ( struct Main *  bmain,
struct ID *  id 
)

◆ BKE_key_evaluate_object()

float* BKE_key_evaluate_object ( struct Object *  ob,
int *  r_totelem 
)

◆ BKE_key_evaluate_object_ex()

float* BKE_key_evaluate_object_ex ( struct Object *  ob,
int *  r_totelem,
float *  arr,
size_t  arr_size 
)

◆ BKE_key_free()

void BKE_key_free ( Key *  key)

Free (or release) any data used by this shapekey (does not free the key itself).

Definition at line 242 of file key.c.

References Key::id, and shapekey_free_data().

Referenced by undomesh_free_data().

◆ BKE_key_free_nolib()

void BKE_key_free_nolib ( struct Key *  key)

Definition at line 247 of file key.c.

References BLI_pophead(), Key::block, KeyBlock::data, and MEM_freeN.

◆ BKE_key_from_id()

struct Key* BKE_key_from_id ( struct ID *  id)

◆ BKE_key_from_id_p()

struct Key** BKE_key_from_id_p ( struct ID *  id)

◆ BKE_key_from_object()

struct Key* BKE_key_from_object ( const struct Object *  ob)

◆ BKE_key_from_object_p()

struct Key** BKE_key_from_object_p ( const struct Object *  ob)

◆ BKE_key_idtype_support()

bool BKE_key_idtype_support ( const short  id_type)

Definition at line 1749 of file key.c.

References ID_CU, ID_LT, and ID_ME.

Referenced by BLO_main_validate_shapekeys().

◆ BKE_key_sort()

void BKE_key_sort ( struct Key *  key)

◆ BKE_keyblock_add()

struct KeyBlock* BKE_keyblock_add ( struct Key *  key,
const char *  name 
)

◆ BKE_keyblock_add_ctime()

struct KeyBlock* BKE_keyblock_add_ctime ( Key *  key,
const char *  name,
const bool  do_force 
)
Note
sorting is a problematic side effect in some cases, better only do this explicitly by having its own function,
Parameters
keyThe key datablock to add to.
nameOptional name for the new keyblock.
do_forcealways use ctime even for relative keys.

Definition at line 1873 of file key.c.

References BKE_key_sort(), BKE_keyblock_add(), Key::block, compare_ff(), Key::ctime, ListBase::first, KEY_RELATIVE, KeyBlock::next, KeyBlock::pos, and Key::type.

Referenced by insert_curvekey(), insert_lattkey(), insert_meshkey(), and ArmatureImporter::make_shape_keys().

◆ BKE_keyblock_convert_from_curve()

void BKE_keyblock_convert_from_curve ( struct Curve *  cu,
struct KeyBlock *  kb,
struct ListBase *  nurb 
)

◆ BKE_keyblock_convert_from_lattice()

void BKE_keyblock_convert_from_lattice ( struct Lattice *  lt,
struct KeyBlock *  kb 
)

◆ BKE_keyblock_convert_from_mesh()

void BKE_keyblock_convert_from_mesh ( struct Mesh *  me,
struct Key *  key,
struct KeyBlock *  kb 
)

◆ BKE_keyblock_convert_from_vertcos()

void BKE_keyblock_convert_from_vertcos ( struct Object *  ob,
struct KeyBlock *  kb,
const float(*)  vertCos[3] 
)

◆ BKE_keyblock_convert_to_curve()

void BKE_keyblock_convert_to_curve ( struct KeyBlock *  kb,
struct Curve *  cu,
struct ListBase *  nurb 
)

◆ BKE_keyblock_convert_to_lattice()

void BKE_keyblock_convert_to_lattice ( struct KeyBlock *  kb,
struct Lattice *  lt 
)

◆ BKE_keyblock_convert_to_mesh()

void BKE_keyblock_convert_to_mesh ( struct KeyBlock *  kb,
struct Mesh *  me 
)

◆ BKE_keyblock_convert_to_vertcos()

float(* BKE_keyblock_convert_to_vertcos ( struct Object *  ob,
struct KeyBlock *  kb 
) )[3]

◆ BKE_keyblock_copy_settings()

void BKE_keyblock_copy_settings ( struct KeyBlock *  kb_dst,
const struct KeyBlock *  kb_src 
)

◆ BKE_keyblock_curval_rnapath_get()

char* BKE_keyblock_curval_rnapath_get ( struct Key *  key,
struct KeyBlock *  kb 
)

◆ BKE_keyblock_curve_data_set_with_mat4()

void BKE_keyblock_curve_data_set_with_mat4 ( struct Key *  key,
const struct ListBase *  nurb,
const int  shape_index,
const void *  data,
const float  mat[4][4] 
)

◆ BKE_keyblock_curve_data_transform()

void BKE_keyblock_curve_data_transform ( const struct ListBase *  nurb,
const float  mat[4][4],
const void *  src,
void *  dst 
)

◆ BKE_keyblock_curve_element_count()

int BKE_keyblock_curve_element_count ( struct ListBase *  nurb)

◆ BKE_keyblock_data_get()

void BKE_keyblock_data_get ( const struct Key *  key,
float(*)  arr[3] 
)

◆ BKE_keyblock_data_get_from_shape()

void BKE_keyblock_data_get_from_shape ( const struct Key *  key,
float(*)  arr[3],
const int  shape_index 
)

◆ BKE_keyblock_data_set()

void BKE_keyblock_data_set ( Key *  key,
const int  shape_index,
const void *  data 
)

Set the data for all key-blocks (or shape_index if != -1).

Definition at line 1734 of file key.c.

References Key::block, data, ELEM, Key::elemsize, and ListBase::first.

Referenced by ED_object_data_xform_restore().

◆ BKE_keyblock_data_set_with_mat4()

void BKE_keyblock_data_set_with_mat4 ( Key *  key,
const int  shape_index,
const float(*)  coords[3],
const float  mat[4][4] 
)

Set the data to all key-blocks (or shape_index if != -1).

Definition at line 1685 of file key.c.

References BLI_assert, Key::block, ELEM, Key::elemsize, ListBase::first, float(), and mul_v3_m4v3().

Referenced by ED_object_data_xform_by_mat4().

◆ BKE_keyblock_element_calc_size()

size_t BKE_keyblock_element_calc_size ( const struct Key *  key)

◆ BKE_keyblock_element_calc_size_from_shape()

size_t BKE_keyblock_element_calc_size_from_shape ( const struct Key *  key,
const int  shape_index 
)

◆ BKE_keyblock_element_count()

int BKE_keyblock_element_count ( const struct Key *  key)

◆ BKE_keyblock_element_count_from_shape()

int BKE_keyblock_element_count_from_shape ( const struct Key *  key,
const int  shape_index 
)

◆ BKE_keyblock_find_name()

struct KeyBlock* BKE_keyblock_find_name ( struct Key *  key,
const char  name[] 
)

◆ BKE_keyblock_from_key()

struct KeyBlock* BKE_keyblock_from_key ( struct Key *  key,
int  index 
)

◆ BKE_keyblock_from_object()

struct KeyBlock* BKE_keyblock_from_object ( struct Object *  ob)

◆ BKE_keyblock_from_object_reference()

struct KeyBlock* BKE_keyblock_from_object_reference ( struct Object *  ob)

Definition at line 1914 of file key.c.

References BKE_key_from_object(), NULL, and Key::refkey.

◆ BKE_keyblock_is_basis()

bool BKE_keyblock_is_basis ( Key *  key,
const int  index 
)

Check if given keyblock (as index) is used as basis by others in given key.

Definition at line 2600 of file key.c.

References Key::block, ListBase::first, KEY_RELATIVE, KeyBlock::next, KeyBlock::relative, and Key::type.

Referenced by BM_mesh_bm_to_me(), calc_shapeKeys(), SCULPT_vertcos_to_key(), and undomesh_to_editmesh().

◆ BKE_keyblock_mesh_calc_normals()

void BKE_keyblock_mesh_calc_normals ( struct KeyBlock *  kb,
struct Mesh *  mesh,
float(*)  r_vertnors[3],
float(*)  r_polynors[3],
float(*)  r_loopnors[3] 
)

Computes normals (vertices, polygons and/or loops ones) of given mesh for given shape key.

Parameters
kbthe KeyBlock to use to compute normals.
meshthe Mesh to apply keyblock to.
r_vertnorsif non-NULL, an array of vectors, same length as number of vertices.
r_polynorsif non-NULL, an array of vectors, same length as number of polygons.
r_loopnorsif non-NULL, an array of vectors, same length as number of loops.

Definition at line 2249 of file key.c.

References BKE_keyblock_convert_to_mesh(), BKE_mesh_calc_normals_poly(), BKE_mesh_normals_loop_split(), CD_CUSTOMLOOPNORMAL, CustomData_free(), CustomData_get_layer(), CustomData_reset(), Mesh::fdata, Mesh::flag, Mesh::ldata, ME_AUTOSMOOTH, Mesh::medge, MEM_dupallocN, MEM_freeN, MEM_mallocN, mesh, Mesh::mloop, Mesh::mpoly, Mesh::mvert, NULL, Mesh::smoothresh, Mesh::totedge, Mesh::totface, Mesh::totloop, Mesh::totpoly, and Mesh::totvert.

◆ BKE_keyblock_move()

bool BKE_keyblock_move ( Object *  ob,
int  org_index,
int  new_index 
)

Move shape key from org_index to new_index. Safe, clamps index to valid range, updates reference keys, the object's active shape index, the 'frame' value in case of absolute keys, etc. Note indices are expected in real values (not 'fake' shapenr +1 ones).

Parameters
org_indexif < 0, current object's active shape will be used as skey to move.
Returns
true if something was done, else false.

Definition at line 2519 of file key.c.

References BKE_key_from_object(), BLI_listbase_swaplinks(), Key::block, CLAMP, ListBase::first, ListBase::last, KeyBlock::next, KeyBlock::pos, KeyBlock::prev, Key::refkey, KeyBlock::relative, Object::shapenr, SWAP, and Key::totkey.

Referenced by shape_key_move_exec().

◆ BKE_keyblock_update_from_curve()

void BKE_keyblock_update_from_curve ( struct Curve *  cu,
struct KeyBlock *  kb,
struct ListBase *  nurb 
)

◆ BKE_keyblock_update_from_lattice()

void BKE_keyblock_update_from_lattice ( struct Lattice *  lt,
struct KeyBlock *  kb 
)

◆ BKE_keyblock_update_from_mesh()

void BKE_keyblock_update_from_mesh ( struct Mesh *  me,
struct KeyBlock *  kb 
)

◆ BKE_keyblock_update_from_offset()

void BKE_keyblock_update_from_offset ( struct Object *  ob,
struct KeyBlock *  kb,
const float(*)  ofs[3] 
)

◆ BKE_keyblock_update_from_vertcos()

void BKE_keyblock_update_from_vertcos ( struct Object *  ob,
struct KeyBlock *  kb,
const float(*)  vertCos[3] 
)

◆ key_curve_normal_weights()

void key_curve_normal_weights ( float  t,
float  data[4],
int  type 
)

Definition at line 429 of file key.c.

References data, KEY_BSPLINE, KEY_CARDINAL, KEY_CATMULL_ROM, KEY_LINEAR, t, and type.

◆ key_curve_position_weights()

void key_curve_position_weights ( float  t,
float  data[4],
int  type 
)

◆ key_curve_tangent_weights()

void key_curve_tangent_weights ( float  t,
float  data[4],
int  type 
)

Definition at line 390 of file key.c.

References data, KEY_BSPLINE, KEY_CARDINAL, KEY_CATMULL_ROM, KEY_LINEAR, t, and type.

Referenced by BKE_where_on_path().