Blender V4.3
BKE_key.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4#pragma once
5
6#include <optional>
7#include <string>
8
9#include "BLI_array.hh"
10
14struct Curve;
15struct ID;
16struct Key;
17struct KeyBlock;
18struct Lattice;
19struct ListBase;
20struct Main;
21struct Mesh;
22struct Object;
23
27void BKE_key_free_data(Key *key);
28void BKE_key_free_nolib(Key *key);
29Key *BKE_key_add(Main *bmain, ID *id);
35void BKE_key_sort(Key *key);
36
37void key_curve_position_weights(float t, float data[4], int type);
41void key_curve_tangent_weights(float t, float data[4], int type);
45void key_curve_normal_weights(float t, float data[4], int type);
46
53 Object *ob, int *r_totelem, float *arr, size_t arr_size, ID *obdata);
54float *BKE_key_evaluate_object(Object *ob, int *r_totelem);
55
59int BKE_keyblock_element_count_from_shape(const Key *key, int shape_index);
60int BKE_keyblock_element_count(const Key *key);
61
65size_t BKE_keyblock_element_calc_size_from_shape(const Key *key, int shape_index);
66size_t BKE_keyblock_element_calc_size(const Key *key);
67
68bool BKE_key_idtype_support(short id_type);
69
79
80KeyBlock *BKE_keyblock_add(Key *key, const char *name);
89KeyBlock *BKE_keyblock_add_ctime(Key *key, const char *name, bool do_force);
97KeyBlock *BKE_keyblock_find_name(Key *key, const char name[]);
98
99KeyBlock *BKE_keyblock_find_uid(Key *key, int uid);
100
104void BKE_keyblock_copy_settings(KeyBlock *kb_dst, const KeyBlock *kb_src);
109std::optional<std::string> BKE_keyblock_curval_rnapath_get(const Key *key, const KeyBlock *kb);
110
111/* conversion functions */
112/* NOTE: 'update_from' versions do not (re)allocate mem in kb, while 'convert_from' do. */
113
117
120 const float mat[4][4],
121 const void *src,
122 void *dst);
123void BKE_keyblock_update_from_curve(const Curve *cu, KeyBlock *kb, const ListBase *nurb);
124void BKE_keyblock_convert_from_curve(const Curve *cu, KeyBlock *kb, const ListBase *nurb);
126
127void BKE_keyblock_update_from_mesh(const Mesh *mesh, KeyBlock *kb);
128void BKE_keyblock_convert_from_mesh(const Mesh *mesh, const Key *key, KeyBlock *kb);
129void BKE_keyblock_convert_to_mesh(const KeyBlock *kb, float (*vert_positions)[3], int totvert);
130
141 Mesh *mesh,
142 float (*r_vert_normals)[3],
143 float (*r_face_normals)[3],
144 float (*r_loop_normals)[3]);
145
146void BKE_keyblock_update_from_vertcos(const Object *ob, KeyBlock *kb, const float (*vertCos)[3]);
147void BKE_keyblock_convert_from_vertcos(const Object *ob, KeyBlock *kb, const float (*vertCos)[3]);
148float (*BKE_keyblock_convert_to_vertcos(const Object *ob, const KeyBlock *kb))[3];
149
151void BKE_keyblock_update_from_offset(const Object *ob, KeyBlock *kb, const float (*ofs)[3]);
152
153/* other management */
154
164bool BKE_keyblock_move(Object *ob, int org_index, int new_index);
165
169bool BKE_keyblock_is_basis(const Key *key, int index);
170
175std::optional<blender::Array<bool>> BKE_keyblock_get_dependent_keys(const Key *key, int index);
176
177/* -------------------------------------------------------------------- */
184void BKE_keyblock_data_get_from_shape(const Key *key, float (*arr)[3], int shape_index);
185void BKE_keyblock_data_get(const Key *key, float (*arr)[3]);
186
191 int shape_index,
192 const float (*coords)[3],
193 const float mat[4][4]);
199 Key *key, const ListBase *nurb, int shape_index, const void *data, const float mat[4][4]);
203void BKE_keyblock_data_set(Key *key, int shape_index, const void *data);
204
void key_curve_normal_weights(float t, float data[4], int type)
Definition key.cc:418
void BKE_keyblock_mesh_calc_normals(const KeyBlock *kb, Mesh *mesh, float(*r_vert_normals)[3], float(*r_face_normals)[3], float(*r_loop_normals)[3])
Definition key.cc:2210
KeyBlock * BKE_keyblock_from_object(Object *ob)
Definition key.cc:1905
void BKE_keyblock_convert_to_lattice(const KeyBlock *kb, Lattice *lt)
Definition key.cc:2018
Key ** BKE_key_from_id_p(ID *id)
Definition key.cc:1775
std::optional< std::string > BKE_keyblock_curval_rnapath_get(const Key *key, const KeyBlock *kb)
Definition key.cc:1958
void BKE_key_free_nolib(Key *key)
Definition key.cc:246
bool BKE_keyblock_is_basis(const Key *key, int index)
Definition key.cc:2562
Key * BKE_key_add(Main *bmain, ID *id)
Definition key.cc:256
void BKE_keyblock_curve_data_transform(const ListBase *nurb, const float mat[4][4], const void *src, void *dst)
Definition key.cc:2086
KeyBlock * BKE_keyblock_add(Key *key, const char *name)
Definition key.cc:1831
KeyBlock * BKE_keyblock_from_object_reference(Object *ob)
Definition key.cc:1912
bool BKE_keyblock_move(Object *ob, int org_index, int new_index)
Definition key.cc:2481
void BKE_keyblock_update_from_mesh(const Mesh *mesh, KeyBlock *kb)
Definition key.cc:2173
void BKE_keyblock_update_from_curve(const Curve *cu, KeyBlock *kb, const ListBase *nurb)
Definition key.cc:2048
void BKE_keyblock_data_set(Key *key, int shape_index, const void *data)
Definition key.cc:1748
void BKE_key_free_data(Key *key)
Definition key.cc:241
void BKE_keyblock_update_from_offset(const Object *ob, KeyBlock *kb, const float(*ofs)[3])
Definition key.cc:2447
void BKE_keyblock_data_set_with_mat4(Key *key, int shape_index, const float(*coords)[3], const float mat[4][4])
Definition key.cc:1706
void BKE_keyblock_convert_to_mesh(const KeyBlock *kb, float(*vert_positions)[3], int totvert)
Definition key.cc:2202
int BKE_keyblock_curve_element_count(const ListBase *nurb)
Definition key.cc:2029
void BKE_keyblock_data_get(const Key *key, float(*arr)[3])
Definition key.cc:1701
void BKE_keyblock_convert_from_mesh(const Mesh *mesh, const Key *key, KeyBlock *kb)
Definition key.cc:2186
size_t BKE_keyblock_element_calc_size(const Key *key)
Definition key.cc:1674
float * BKE_key_evaluate_object_ex(Object *ob, int *r_totelem, float *arr, size_t arr_size, ID *obdata)
Definition key.cc:1522
KeyBlock * BKE_keyblock_find_by_index(Key *key, int index)
Definition key.cc:1923
void BKE_keyblock_copy_settings(KeyBlock *kb_dst, const KeyBlock *kb_src)
copy shape-key attributes, but not key data or name/UID.
Definition key.cc:1947
void BKE_keyblock_convert_from_curve(const Curve *cu, KeyBlock *kb, const ListBase *nurb)
Definition key.cc:2117
void key_curve_tangent_weights(float t, float data[4], int type)
Definition key.cc:380
KeyBlock * BKE_keyblock_find_name(Key *key, const char name[])
Definition key.cc:1932
KeyBlock * BKE_keyblock_add_ctime(Key *key, const char *name, bool do_force)
Definition key.cc:1878
void BKE_keyblock_convert_from_lattice(const Lattice *lt, KeyBlock *kb)
Definition key.cc:1992
float * BKE_key_evaluate_object(Object *ob, int *r_totelem)
Definition key.cc:1645
void BKE_keyblock_update_from_lattice(const Lattice *lt, KeyBlock *kb)
Definition key.cc:1972
void BKE_keyblock_convert_to_curve(KeyBlock *kb, Curve *cu, ListBase *nurb)
Definition key.cc:2163
int BKE_keyblock_element_count(const Key *key)
Definition key.cc:1664
void BKE_keyblock_curve_data_set_with_mat4(Key *key, const ListBase *nurb, int shape_index, const void *data, const float mat[4][4])
Definition key.cc:1733
Key ** BKE_key_from_object_p(Object *ob)
Definition key.cc:1811
void BKE_keyblock_convert_from_vertcos(const Object *ob, KeyBlock *kb, const float(*vertCos)[3])
Definition key.cc:2356
std::optional< blender::Array< bool > > BKE_keyblock_get_dependent_keys(const Key *key, int index)
Definition key.cc:2578
Key * BKE_key_from_id(ID *id)
Definition key.cc:1800
void BKE_keyblock_data_get_from_shape(const Key *key, float(*arr)[3], int shape_index)
Definition key.cc:1686
void BKE_key_sort(Key *key)
Definition key.cc:308
void BKE_keyblock_update_from_vertcos(const Object *ob, KeyBlock *kb, const float(*vertCos)[3])
Definition key.cc:2297
Key * BKE_key_from_object(Object *ob)
Definition key.cc:1820
float(* BKE_keyblock_convert_to_vertcos(const Object *ob, const KeyBlock *kb))[3]
Definition key.cc:2389
size_t BKE_keyblock_element_calc_size_from_shape(const Key *key, int shape_index)
Definition key.cc:1669
int BKE_keyblock_element_count_from_shape(const Key *key, int shape_index)
Definition key.cc:1650
void key_curve_position_weights(float t, float data[4], int type)
Definition key.cc:339
bool BKE_key_idtype_support(short id_type)
Definition key.cc:1763
KeyBlock * BKE_keyblock_find_uid(Key *key, int uid)
Definition key.cc:1937
draw_view in_light_buf[] float
Definition DNA_ID.h:413
struct Material ** mat