Blender  V3.3
Functions
BKE_key.h File Reference

Go to the source code of this file.

Functions

void BKE_key_free_data (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, struct ID *obdata)
 
float * BKE_key_evaluate_object (struct Object *ob, int *r_totelem)
 
int BKE_keyblock_element_count_from_shape (const struct Key *key, 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, int shape_index)
 
size_t BKE_keyblock_element_calc_size (const struct Key *key)
 
bool BKE_key_idtype_support (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 (struct Object *ob)
 
struct Key * BKE_key_from_object (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, 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)
 copy shape-key attributes, but not key data or name/UID. More...
 
char * BKE_keyblock_curval_rnapath_get (const struct Key *key, const struct KeyBlock *kb)
 
void BKE_keyblock_update_from_lattice (const struct Lattice *lt, struct KeyBlock *kb)
 
void BKE_keyblock_convert_from_lattice (const struct Lattice *lt, struct KeyBlock *kb)
 
void BKE_keyblock_convert_to_lattice (const struct KeyBlock *kb, struct Lattice *lt)
 
int BKE_keyblock_curve_element_count (const 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 (const struct Curve *cu, struct KeyBlock *kb, const struct ListBase *nurb)
 
void BKE_keyblock_convert_from_curve (const struct Curve *cu, struct KeyBlock *kb, const struct ListBase *nurb)
 
void BKE_keyblock_convert_to_curve (struct KeyBlock *kb, struct Curve *cu, struct ListBase *nurb)
 
void BKE_keyblock_update_from_mesh (const struct Mesh *me, struct KeyBlock *kb)
 
void BKE_keyblock_convert_from_mesh (const struct Mesh *me, const struct Key *key, struct KeyBlock *kb)
 
void BKE_keyblock_convert_to_mesh (const struct KeyBlock *kb, struct MVert *mvert, int totvert)
 
void BKE_keyblock_mesh_calc_normals (const struct KeyBlock *kb, const struct Mesh *mesh, float(*r_vertnors)[3], float(*r_polynors)[3], float(*r_loopnors)[3])
 
void BKE_keyblock_update_from_vertcos (const struct Object *ob, struct KeyBlock *kb, const float(*vertCos)[3])
 
void BKE_keyblock_convert_from_vertcos (const struct Object *ob, struct KeyBlock *kb, const float(*vertCos)[3])
 
float(* BKE_keyblock_convert_to_vertcos (const struct Object *ob, const struct KeyBlock *kb))[3]
 
void BKE_keyblock_update_from_offset (const 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 (const struct Key *key, int index)
 
Key-Block Data Access
void BKE_keyblock_data_get_from_shape (const struct Key *key, float(*arr)[3], 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, 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, int shape_index, const void *data, const float mat[4][4])
 
void BKE_keyblock_data_set (struct Key *key, 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,
struct ID *  obdata 
)

◆ BKE_key_free_data()

void BKE_key_free_data ( struct Key *  key)

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

Definition at line 235 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 240 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 ( struct Object *  ob)

◆ BKE_key_from_object_p()

struct Key** BKE_key_from_object_p ( struct Object *  ob)

Definition at line 1794 of file key.c.

References BKE_key_from_id_p(), Object::data, and NULL.

Referenced by BKE_key_from_object(), and BKE_object_shapekey_free().

◆ BKE_key_idtype_support()

bool BKE_key_idtype_support ( short  id_type)

Definition at line 1746 of file key.c.

References ID_CU_LEGACY, ID_LT, and ID_ME.

Referenced by BLO_main_validate_shapekeys().

◆ BKE_key_sort()

void BKE_key_sort ( struct Key *  key)

Sort shape keys after a change. This assumes that at most one key was moved, which is a valid assumption for the places it's currently being called.

Definition at line 304 of file key.c.

References BLI_insertlinkafter(), BLI_remlink(), Key::block, ListBase::first, KeyBlock::next, KeyBlock::pos, KeyBlock::prev, and Key::refkey.

Referenced by BKE_keyblock_add_ctime(), and ED_mesh_join_objects_exec().

◆ BKE_keyblock_add()

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

◆ BKE_keyblock_add_ctime()

struct KeyBlock* BKE_keyblock_add_ctime ( struct Key *  key,
const char *  name,
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 1862 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 ( const struct Curve *  cu,
struct KeyBlock *  kb,
const struct ListBase *  nurb 
)

Referenced by insert_curvekey().

◆ BKE_keyblock_convert_from_lattice()

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

Referenced by insert_lattkey().

◆ BKE_keyblock_convert_from_mesh()

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

◆ BKE_keyblock_convert_from_vertcos()

void BKE_keyblock_convert_from_vertcos ( const 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 ( const struct KeyBlock *  kb,
struct Lattice *  lt 
)

◆ BKE_keyblock_convert_to_mesh()

void BKE_keyblock_convert_to_mesh ( const struct KeyBlock *  kb,
struct MVert *  mvert,
int  totvert 
)

◆ BKE_keyblock_convert_to_vertcos()

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

◆ BKE_keyblock_copy_settings()

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

copy shape-key attributes, but not key data or name/UID.

Referenced by ED_mesh_join_objects_exec().

◆ BKE_keyblock_curval_rnapath_get()

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

Get RNA-Path for 'value' setting of the given shape-key.

Note
the user needs to free the returned string once they're finished with it.

Referenced by achannel_setting_slider_shapekey_cb(), ANIM_channel_draw_widgets(), and make_new_animlistelem().

◆ BKE_keyblock_curve_data_set_with_mat4()

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

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

Referenced by ED_object_data_xform_by_mat4().

◆ 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 ( const 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],
int  shape_index 
)
Parameters
shape_indexThe index to use or all (when -1).

Referenced by ED_object_data_xform_create_ex().

◆ BKE_keyblock_data_set()

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

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

Definition at line 1731 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 ( struct Key *  key,
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 1689 of file key.c.

References BLI_assert_msg, 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,
int  shape_index 
)
Parameters
shape_indexThe index to use or all (when -1).

Referenced by ED_object_data_xform_create_ex().

◆ 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,
int  shape_index 
)
Parameters
shape_indexThe index to use or all (when -1).

◆ BKE_keyblock_find_name()

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

Get the appropriate KeyBlock given a name to search for.

Definition at line 1930 of file key.c.

References BLI_findstring(), and Key::block.

Referenced by ED_mesh_join_objects_exec(), edbm_blend_from_shape_exec(), join_mesh_single(), and sculpt_undo_restore_coords().

◆ BKE_keyblock_from_key()

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

Get the appropriate KeyBlock given an index.

Definition at line 1913 of file key.c.

References Key::block, ListBase::first, KeyBlock::next, NULL, and Key::totkey.

Referenced by deformVerts(), get_orco_coords(), and shapekey_adrcodes_to_paths().

◆ 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 1902 of file key.c.

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

◆ BKE_keyblock_is_basis()

bool BKE_keyblock_is_basis ( const struct Key *  key,
int  index 
)

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

Referenced by bm_to_mesh_shape(), calc_shapeKeys(), and SCULPT_vertcos_to_key().

◆ BKE_keyblock_mesh_calc_normals()

void BKE_keyblock_mesh_calc_normals ( const struct KeyBlock *  kb,
const 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 key-block 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.

◆ BKE_keyblock_move()

bool BKE_keyblock_move ( struct 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 2492 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 ( const struct Curve *  cu,
struct KeyBlock *  kb,
const struct ListBase *  nurb 
)

◆ BKE_keyblock_update_from_lattice()

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

◆ BKE_keyblock_update_from_mesh()

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

◆ BKE_keyblock_update_from_offset()

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

Referenced by SCULPT_vertcos_to_key().

◆ BKE_keyblock_update_from_vertcos()

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

Referenced by SCULPT_vertcos_to_key().

◆ key_curve_normal_weights()

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

Second derivative.

Definition at line 415 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 
)

First derivative.

Definition at line 377 of file key.c.

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

Referenced by BKE_where_on_path().