Blender V5.0
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"
12#include "BLI_span.hh"
13
14#include "DNA_key_types.h"
15
19struct Curve;
20struct ID;
21struct Key;
22struct KeyBlock;
23struct Lattice;
24struct ListBase;
25struct Main;
26struct Mesh;
27struct Object;
28
29void BKE_key_free_nolib(Key *key);
30Key *BKE_key_add(Main *bmain, ID *id);
36void BKE_key_sort(Key *key);
37
47
54 Object *ob, int *r_totelem, float *arr, size_t arr_size, ID *obdata);
55float *BKE_key_evaluate_object(Object *ob, int *r_totelem);
56
60int BKE_keyblock_element_count_from_shape(const Key *key, int shape_index);
61int BKE_keyblock_element_count(const Key *key);
62
66size_t BKE_keyblock_element_calc_size_from_shape(const Key *key, int shape_index);
67size_t BKE_keyblock_element_calc_size(const Key *key);
68
69bool BKE_key_idtype_support(short id_type);
70
80
81KeyBlock *BKE_keyblock_add(Key *key, const char *name);
82
85
94KeyBlock *BKE_keyblock_add_ctime(Key *key, const char *name, bool do_force);
102KeyBlock *BKE_keyblock_find_name(Key *key, const char name[]);
103
104KeyBlock *BKE_keyblock_find_uid(Key *key, int uid);
105
109void BKE_keyblock_copy_settings(KeyBlock *kb_dst, const KeyBlock *kb_src);
114std::optional<std::string> BKE_keyblock_curval_rnapath_get(const Key *key, const KeyBlock *kb);
115
116/* conversion functions */
117/* NOTE: 'update_from' versions do not (re)allocate mem in kb, while 'convert_from' do. */
118
122
125 const float mat[4][4],
126 const void *src,
127 void *dst);
128void BKE_keyblock_update_from_curve(const Curve *cu, KeyBlock *kb, const ListBase *nurb);
129void BKE_keyblock_convert_from_curve(const Curve *cu, KeyBlock *kb, const ListBase *nurb);
131
132void BKE_keyblock_update_from_mesh(const Mesh *mesh, KeyBlock *kb);
133void BKE_keyblock_convert_from_mesh(const Mesh *mesh, const Key *key, KeyBlock *kb);
136
147 Mesh *mesh,
148 float (*r_vert_normals)[3],
149 float (*r_face_normals)[3],
150 float (*r_loop_normals)[3]);
151
152/* other management */
153
163bool BKE_keyblock_move(Object *ob, int org_index, int new_index);
164
168bool BKE_keyblock_is_basis(const Key *key, int index);
169
174std::optional<blender::Array<bool>> BKE_keyblock_get_dependent_keys(const Key *key, int index);
175
176/* -------------------------------------------------------------------- */
179
185 int shape_index);
187
192 int shape_index,
200 const ListBase *nurb,
201 int shape_index,
202 const void *data,
207void BKE_keyblock_data_set(Key *key, int shape_index, const void *data);
208
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:2193
KeyBlock * BKE_keyblock_from_object(Object *ob)
Definition key.cc:1889
void BKE_keyblock_convert_to_lattice(const KeyBlock *kb, Lattice *lt)
Definition key.cc:2002
Key ** BKE_key_from_id_p(ID *id)
Definition key.cc:1746
std::optional< std::string > BKE_keyblock_curval_rnapath_get(const Key *key, const KeyBlock *kb)
Definition key.cc:1942
void BKE_keyblock_data_set_with_mat4(Key *key, int shape_index, blender::Span< blender::float3 > coords, const blender::float4x4 &transform)
void BKE_key_free_nolib(Key *key)
Definition key.cc:215
bool BKE_keyblock_is_basis(const Key *key, int index)
Definition key.cc:2355
Key * BKE_key_add(Main *bmain, ID *id)
Definition key.cc:225
void BKE_keyblock_data_get(const Key *key, blender::MutableSpan< blender::float3 > arr)
void BKE_keyblock_curve_data_transform(const ListBase *nurb, const float mat[4][4], const void *src, void *dst)
Definition key.cc:2070
void BKE_keyblock_data_get_from_shape(const Key *key, blender::MutableSpan< blender::float3 > arr, int shape_index)
KeyBlock * BKE_keyblock_add(Key *key, const char *name)
Definition key.cc:1802
KeyBlock * BKE_keyblock_from_object_reference(Object *ob)
Definition key.cc:1896
void BKE_keyblock_convert_to_mesh(const KeyBlock *kb, blender::MutableSpan< blender::float3 > vert_positions)
Definition key.cc:2186
KeyBlock * BKE_keyblock_duplicate(Key *key, KeyBlock *kb_src)
Definition key.cc:1849
bool BKE_keyblock_move(Object *ob, int org_index, int new_index)
Definition key.cc:2274
void BKE_keyblock_update_from_mesh(const Mesh *mesh, KeyBlock *kb)
Definition key.cc:2157
void BKE_keyblock_update_from_curve(const Curve *cu, KeyBlock *kb, const ListBase *nurb)
Definition key.cc:2032
void BKE_keyblock_curve_data_set_with_mat4(Key *key, const ListBase *nurb, int shape_index, const void *data, const blender::float4x4 &transform)
Definition key.cc:1701
void BKE_keyblock_data_set(Key *key, int shape_index, const void *data)
Definition key.cc:1719
int BKE_keyblock_curve_element_count(const ListBase *nurb)
Definition key.cc:2013
void BKE_keyblock_convert_from_mesh(const Mesh *mesh, const Key *key, KeyBlock *kb)
Definition key.cc:2170
size_t BKE_keyblock_element_calc_size(const Key *key)
Definition key.cc:1640
float * BKE_key_evaluate_object_ex(Object *ob, int *r_totelem, float *arr, size_t arr_size, ID *obdata)
Definition key.cc:1488
KeyBlock * BKE_keyblock_find_by_index(Key *key, int index)
Definition key.cc:1907
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:1931
void BKE_keyblock_convert_from_curve(const Curve *cu, KeyBlock *kb, const ListBase *nurb)
Definition key.cc:2101
KeyBlock * BKE_keyblock_find_name(Key *key, const char name[])
Definition key.cc:1916
KeyBlock * BKE_keyblock_add_ctime(Key *key, const char *name, bool do_force)
Definition key.cc:1862
void BKE_keyblock_convert_from_lattice(const Lattice *lt, KeyBlock *kb)
Definition key.cc:1976
float * BKE_key_evaluate_object(Object *ob, int *r_totelem)
Definition key.cc:1611
void BKE_keyblock_update_from_lattice(const Lattice *lt, KeyBlock *kb)
Definition key.cc:1956
void BKE_keyblock_convert_to_curve(KeyBlock *kb, Curve *cu, ListBase *nurb)
Definition key.cc:2147
int BKE_keyblock_element_count(const Key *key)
Definition key.cc:1630
Key ** BKE_key_from_object_p(Object *ob)
Definition key.cc:1782
void key_curve_position_weights(float t, float data[4], KeyInterpolationType type)
Definition key.cc:308
std::optional< blender::Array< bool > > BKE_keyblock_get_dependent_keys(const Key *key, int index)
Definition key.cc:2371
Key * BKE_key_from_id(ID *id)
Definition key.cc:1771
void key_curve_tangent_weights(float t, float data[4], KeyInterpolationType type)
Definition key.cc:351
void BKE_key_sort(Key *key)
Definition key.cc:277
Key * BKE_key_from_object(Object *ob)
Definition key.cc:1791
size_t BKE_keyblock_element_calc_size_from_shape(const Key *key, int shape_index)
Definition key.cc:1635
int BKE_keyblock_element_count_from_shape(const Key *key, int shape_index)
Definition key.cc:1616
bool BKE_key_idtype_support(short id_type)
Definition key.cc:1734
KeyBlock * BKE_keyblock_find_uid(Key *key, int uid)
Definition key.cc:1921
void key_curve_normal_weights(float t, float data[4], KeyInterpolationType type)
Definition key.cc:391
KeyInterpolationType
BMesh const char void * data
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
MatBase< float, 4, 4 > float4x4
const char * name
Definition DNA_ID.h:414
struct Material ** mat