55 static Key *rna_ShapeKey_find_key(
ID *
id)
59 return ((
Curve *)
id)->key;
65 return ((
Mesh *)
id)->key;
73 static void rna_ShapeKey_name_set(
PointerRNA *
ptr,
const char *value)
76 char oldname[
sizeof(kb->
name)];
102 return kb->
pos * 100.0f;
105 static void rna_ShapeKey_value_set(
PointerRNA *
ptr,
float value)
109 data->curval = value;
112 static void rna_ShapeKey_value_range(
122 # define SHAPEKEY_SLIDER_TOL 0.001f
124 static void rna_ShapeKey_slider_min_range(
130 *
max =
data->slidermax - SHAPEKEY_SLIDER_TOL;
133 static void rna_ShapeKey_slider_min_set(
PointerRNA *
ptr,
float value)
136 float min,
max, softmin, softmax;
138 rna_ShapeKey_slider_min_range(
ptr, &
min, &
max, &softmin, &softmax);
140 data->slidermin = value;
143 static void rna_ShapeKey_slider_max_range(
148 *
min =
data->slidermin + SHAPEKEY_SLIDER_TOL;
152 static void rna_ShapeKey_slider_max_set(
PointerRNA *
ptr,
float value)
155 float min,
max, softmin, softmax;
157 rna_ShapeKey_slider_max_range(
ptr, &
min, &
max, &softmin, &softmax);
159 data->slidermax = value;
162 # undef SHAPEKEY_SLIDER_TOL
193 static int rna_KeyBlock_normals_vert_len(
const PointerRNA *
ptr,
196 const Mesh *me = rna_KeyBlock_normals_get_mesh(
ptr,
NULL);
204 static void rna_KeyBlock_normals_vert_calc(
ID *
id,
209 Mesh *me = rna_KeyBlock_normals_get_mesh(
NULL,
id);
211 *normals_len = (me ? me->
totvert : 0) * 3;
223 static int rna_KeyBlock_normals_poly_len(
const PointerRNA *
ptr,
226 const Mesh *me = rna_KeyBlock_normals_get_mesh(
ptr,
NULL);
234 static void rna_KeyBlock_normals_poly_calc(
ID *
id,
239 Mesh *me = rna_KeyBlock_normals_get_mesh(
NULL,
id);
241 *normals_len = (me ? me->
totpoly : 0) * 3;
253 static int rna_KeyBlock_normals_loop_len(
const PointerRNA *
ptr,
256 const Mesh *me = rna_KeyBlock_normals_get_mesh(
ptr,
NULL);
264 static void rna_KeyBlock_normals_loop_calc(
ID *
id,
269 Mesh *me = rna_KeyBlock_normals_get_mesh(
NULL,
id);
271 *normals_len = (me ? me->
totloop : 0) * 3;
285 Key *key = rna_ShapeKey_find_key(
id);
289 if (key && value < key->totkey) {
300 Key *key = rna_ShapeKey_find_key(
id);
328 static void rna_ShapeKeyPoint_co_get(
PointerRNA *
ptr,
float *values)
330 float *vec = (
float *)
ptr->
data;
337 static void rna_ShapeKeyPoint_co_set(
PointerRNA *
ptr,
const float *values)
339 float *vec = (
float *)
ptr->
data;
346 static float rna_ShapeKeyCurvePoint_tilt_get(
PointerRNA *
ptr)
348 float *vec = (
float *)
ptr->
data;
352 static void rna_ShapeKeyCurvePoint_tilt_set(
PointerRNA *
ptr,
float value)
354 float *vec = (
float *)
ptr->
data;
358 static float rna_ShapeKeyCurvePoint_radius_get(
PointerRNA *
ptr)
360 float *vec = (
float *)
ptr->
data;
364 static void rna_ShapeKeyCurvePoint_radius_set(
PointerRNA *
ptr,
float value)
366 float *vec = (
float *)
ptr->
data;
371 static void rna_ShapeKeyBezierPoint_co_get(
PointerRNA *
ptr,
float *values)
373 float *vec = (
float *)
ptr->
data;
375 values[0] = vec[0 + 3];
376 values[1] = vec[1 + 3];
377 values[2] = vec[2 + 3];
380 static void rna_ShapeKeyBezierPoint_co_set(
PointerRNA *
ptr,
const float *values)
382 float *vec = (
float *)
ptr->
data;
384 vec[0 + 3] = values[0];
385 vec[1 + 3] = values[1];
386 vec[2 + 3] = values[2];
389 static void rna_ShapeKeyBezierPoint_handle_1_co_get(
PointerRNA *
ptr,
float *values)
391 float *vec = (
float *)
ptr->
data;
398 static void rna_ShapeKeyBezierPoint_handle_1_co_set(
PointerRNA *
ptr,
const float *values)
400 float *vec = (
float *)
ptr->
data;
407 static void rna_ShapeKeyBezierPoint_handle_2_co_get(
PointerRNA *
ptr,
float *values)
409 float *vec = (
float *)
ptr->
data;
411 values[0] = vec[6 + 0];
412 values[1] = vec[6 + 1];
413 values[2] = vec[6 + 2];
416 static void rna_ShapeKeyBezierPoint_handle_2_co_set(
PointerRNA *
ptr,
const float *values)
418 float *vec = (
float *)
ptr->
data;
420 vec[6 + 0] = values[0];
421 vec[6 + 1] = values[1];
422 vec[6 + 2] = values[2];
425 static float rna_ShapeKeyBezierPoint_tilt_get(
PointerRNA *
ptr)
427 float *vec = (
float *)
ptr->
data;
431 static void rna_ShapeKeyBezierPoint_tilt_set(
PointerRNA *
ptr,
float value)
433 float *vec = (
float *)
ptr->
data;
437 static float rna_ShapeKeyBezierPoint_radius_get(
PointerRNA *
ptr)
439 float *vec = (
float *)
ptr->
data;
443 static void rna_ShapeKeyBezierPoint_radius_set(
PointerRNA *
ptr,
float value)
445 float *vec = (
float *)
ptr->
data;
451 typedef struct NurbInfo {
453 int nurb_size, nurb_elem_step;
459 int item_index, elem_index;
465 return &RNA_ShapeKeyBezierPoint;
468 return &RNA_ShapeKeyCurvePoint;
472 static void rna_ShapeKey_NurbInfo_init(NurbInfo *r_info,
Nurb *nu)
477 r_info->nurb_size = nu->
pntsu;
486 static void rna_ShapeKey_NurbInfo_step(NurbInfo *r_info,
491 rna_ShapeKey_NurbInfo_init(r_info, nu);
494 r_info->nurb_index =
MIN2(r_info->nurb_size, *p_raw_index / r_info->nurb_elem_step);
495 *p_raw_index -= r_info->nurb_size * r_info->nurb_elem_step;
498 r_info->nurb_index =
MIN2(r_info->nurb_size, *p_raw_index);
499 *p_raw_index -= r_info->nurb_size;
502 r_info->item_index += r_info->nurb_index;
503 r_info->elem_index += r_info->nurb_index * r_info->nurb_elem_step;
506 static void rna_ShapeKey_NurbInfo_find_index(
Key *key,
513 memset(r_info, 0,
sizeof(*r_info));
516 rna_ShapeKey_NurbInfo_step(r_info, nu, &raw_index, input_elem);
520 static int rna_ShapeKey_curve_find_index(
Key *key,
int elem_index)
523 rna_ShapeKey_NurbInfo_find_index(key, elem_index,
true, &info);
524 return info.item_index;
527 typedef struct ShapeKeyCurvePoint {
530 } ShapeKeyCurvePoint;
538 int point_count = rna_ShapeKey_curve_find_index(key, kb->
totelem);
541 point_count,
sizeof(ShapeKeyCurvePoint), __func__);
543 char *databuf = kb->
data;
544 int items_left = point_count;
545 NurbInfo info = {
NULL};
548 ShapeKeyCurvePoint *nurb_points = points + info.item_index;
549 char *nurb_data = databuf + info.elem_index * key->
elemsize;
551 rna_ShapeKey_NurbInfo_step(&info, nu, &items_left,
false);
555 for (
int i = 0; i < info.nurb_index; i++) {
556 nurb_points[i].type =
type;
557 nurb_points[i].data = nurb_data + i * info.nurb_elem_step * key->
elemsize;
578 type = rna_ShapeKey_curve_point_type(nu);
579 rna_ShapeKey_NurbInfo_init(&info, nu);
581 else if (
type != rna_ShapeKey_curve_point_type(nu)) {
589 rna_ShapeKey_data_begin_mixed(iter, key, kb, cu);
593 tot /= info.nurb_elem_step;
594 size *= info.nurb_elem_step;
608 tot = rna_ShapeKey_curve_find_index(key, tot);
641 char *databuf = kb->
data;
643 memset(r_ptr, 0,
sizeof(*r_ptr));
651 rna_ShapeKey_NurbInfo_find_index(key, index,
false, &info);
653 if (info.nu && info.nurb_index < info.nurb_size) {
661 if (index < kb->totelem) {
674 char name_esc[
sizeof(kb->
name) * 2];
679 return BLI_sprintfN(
"shape_keys.key_blocks[\"%s\"]", name_esc);
706 rna_Key_update_data(bmain,
scene,
ptr);
722 float *start = (
float *)kb->
data;
730 else if (start ==
point) {
752 static int rna_ShapeKeyPoint_get_index(
Key *key,
KeyBlock *kb,
float *
point)
758 char *start = (
char *)kb->
data;
759 char *pt = (
char *)
point;
761 return (
int)(pt - start) / key->
elemsize;
772 kb = rna_ShapeKeyData_find_keyblock(key,
point);
775 char name_esc_kb[
sizeof(kb->
name) * 2];
778 index = rna_ShapeKeyPoint_get_index(key, kb,
point);
780 if (
ELEM(
ptr->
type, &RNA_ShapeKeyBezierPoint, &RNA_ShapeKeyCurvePoint)) {
781 index = rna_ShapeKey_curve_find_index(key, index);
787 return BLI_sprintfN(
"key_blocks[\"%s\"].data[%d]", name_esc_kb, index);
790 return BLI_sprintfN(
"shape_keys.key_blocks[\"%s\"].data[%d]", name_esc_kb, index);
830 prop,
"rna_ShapeKeyCurvePoint_tilt_get",
"rna_ShapeKeyCurvePoint_tilt_set",
NULL);
838 prop,
"rna_ShapeKeyCurvePoint_radius_get",
"rna_ShapeKeyCurvePoint_radius_set",
NULL);
851 prop,
"rna_ShapeKeyBezierPoint_co_get",
"rna_ShapeKeyBezierPoint_co_set",
NULL);
858 "rna_ShapeKeyBezierPoint_handle_1_co_get",
859 "rna_ShapeKeyBezierPoint_handle_1_co_set",
867 "rna_ShapeKeyBezierPoint_handle_2_co_get",
868 "rna_ShapeKeyBezierPoint_handle_2_co_set",
875 prop,
"rna_ShapeKeyBezierPoint_tilt_get",
"rna_ShapeKeyBezierPoint_tilt_set",
NULL);
883 prop,
"rna_ShapeKeyBezierPoint_radius_get",
"rna_ShapeKeyBezierPoint_radius_set",
NULL);
940 prop,
"rna_ShapeKey_relative_key_get",
"rna_ShapeKey_relative_key_set",
NULL,
NULL);
955 prop,
NULL,
"rna_ShapeKey_slider_min_set",
"rna_ShapeKey_slider_min_range");
964 prop,
NULL,
"rna_ShapeKey_slider_max_set",
"rna_ShapeKey_slider_max_range");
974 "rna_ShapeKey_data_begin",
977 "rna_ShapeKey_data_get",
978 "rna_ShapeKey_data_length",
979 "rna_ShapeKey_data_lookup_int",
986 func =
RNA_def_function(srna,
"normals_vertex_get",
"rna_KeyBlock_normals_vert_calc");
988 "Compute local space vertices' normals for this shape key");
996 func =
RNA_def_function(srna,
"normals_polygon_get",
"rna_KeyBlock_normals_poly_calc");
1005 func =
RNA_def_function(srna,
"normals_split_get",
"rna_KeyBlock_normals_loop_calc");
1007 "Compute local space face corners' normals for this shape key");
1023 srna,
"Key",
"Shape keys data-block containing different shapes of geometric data-blocks");
1051 "Make shape keys relative, "
1052 "otherwise play through shapes as a sequence using the evaluation time");
void BKE_animdata_fix_paths_rename_all(struct ID *ref_id, const char *prefix, const char *oldName, const char *newName)
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])
struct Key * BKE_key_from_object(struct Object *ob)
#define LISTBASE_FOREACH(type, var, list)
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
size_t size_t char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
size_t size_t char size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL()
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL(1
bool BLI_uniquename(struct ListBase *list, void *vlink, const char *defname, char delim, int name_offset, size_t name_len)
#define IN_RANGE_INCL(a, b, c)
#define BLT_I18NCONTEXT_ID_SHAPEKEY
#define CTX_DATA_(context, msgid)
void DEG_id_tag_update(struct ID *id, int flag)
ID and Library types, which are fundamental for sdna.
#define KEYELEM_ELEM_LEN_BPOINT
#define KEYELEM_ELEM_LEN_BEZTRIPLE
Object is a sort of wrapper for general info.
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
#define RNA_MAX_ARRAY_DIMENSION
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
@ PROPOVERRIDE_NO_COMPARISON
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
T length(const vec_base< T, Size > &a)
MutableSpan< float3 > normals
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
void rna_iterator_array_begin(CollectionPropertyIterator *iter, void *ptr, int itemsize, int length, bool free_ptr, IteratorSkipFunc skip)
void * rna_iterator_array_get(CollectionPropertyIterator *iter)
PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *data)
void rna_def_animdata_common(StructRNA *srna)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
void RNA_def_property_float_default(PropertyRNA *prop, float value)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_dynamic_array_funcs(PropertyRNA *prop, const char *getlength)
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
void RNA_def_property_array(PropertyRNA *prop, int length)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop)
void RNA_def_function_flag(FunctionRNA *func, int flag)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
int rna_object_shapekey_index_set(struct ID *id, PointerRNA value, int current)
PointerRNA rna_object_shapekey_index_get(struct ID *id, int value)
static void rna_def_keyblock(BlenderRNA *brna)
static void rna_def_keydata(BlenderRNA *brna)
static void rna_def_key(BlenderRNA *brna)
static const float tilt_limit
const EnumPropertyItem rna_enum_keyblock_type_items[]
void RNA_def_key(BlenderRNA *brna)
union CollectionPropertyIterator::@1147 internal
void WM_main_add_notifier(unsigned int type, void *reference)