Blender V2.61 - r43446
|
#include <math.h>
#include <string.h>
#include <stddef.h>
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_math_vector.h"
#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_key_types.h"
#include "DNA_lattice_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BKE_animsys.h"
#include "BKE_curve.h"
#include "BKE_customdata.h"
#include "BKE_deform.h"
#include "BKE_global.h"
#include "BKE_key.h"
#include "BKE_lattice.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_scene.h"
#include "RNA_access.h"
Go to the source code of this file.
Defines | |
#define | KEY_MODE_DUMMY 0 |
#define | KEY_MODE_BPOINT 1 |
#define | KEY_MODE_BEZTRIPLE 2 |
#define | IPO_FLOAT 4 |
#define | IPO_BEZTRIPLE 100 |
#define | IPO_BPOINT 101 |
#define | GS(a) (*((short *)(a))) |
Functions | |
void | free_key (Key *key) |
Key * | add_key (ID *id) |
Key * | copy_key (Key *key) |
void | make_local_key (Key *key) |
void | sort_keys (Key *key) |
void | key_curve_position_weights (float t, float *data, int type) |
void | key_curve_tangent_weights (float t, float *data, int type) |
void | key_curve_normal_weights (float t, float *data, int type) |
static int | setkeys (float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl) |
static void | flerp (int tot, float *in, float *f0, float *f1, float *f2, float *f3, float *t) |
static void | rel_flerp (int tot, float *in, float *ref, float *out, float fac) |
static char * | key_block_get_data (Key *key, KeyBlock *actkb, KeyBlock *kb, char **freedata) |
static short | key_pointer_size (const Key *key, const int mode, int *poinsize, int *ofs) |
static void | cp_key (const int start, int end, const int tot, char *poin, Key *key, KeyBlock *actkb, KeyBlock *kb, float *weights, const int mode) |
static void | cp_cu_key (Curve *cu, Key *key, KeyBlock *actkb, KeyBlock *kb, const int start, int end, char *out, const int tot) |
void | do_rel_key (const int start, int end, const int tot, char *basispoin, Key *key, KeyBlock *actkb, const int mode) |
static void | do_key (const int start, int end, const int tot, char *poin, Key *key, KeyBlock *actkb, KeyBlock **k, float *t, const int mode) |
static float * | get_weights_array (Object *ob, char *vgroup) |
static void | do_mesh_key (Scene *scene, Object *ob, Key *key, char *out, const int tot) |
static void | do_cu_key (Curve *cu, Key *key, KeyBlock *actkb, KeyBlock **k, float *t, char *out, const int tot) |
static void | do_rel_cu_key (Curve *cu, Key *key, KeyBlock *actkb, float UNUSED(ctime), char *out, const int tot) |
static void | do_curve_key (Scene *scene, Object *ob, Key *key, char *out, const int tot) |
static void | do_latt_key (Scene *scene, Object *ob, Key *key, char *out, const int tot) |
float * | do_ob_key (Scene *scene, Object *ob) |
Key * | ob_get_key (Object *ob) |
KeyBlock * | add_keyblock (Key *key, const char *name) |
KeyBlock * | ob_get_keyblock (Object *ob) |
KeyBlock * | ob_get_reference_keyblock (Object *ob) |
KeyBlock * | key_get_keyblock (Key *key, int index) |
KeyBlock * | key_get_named_keyblock (Key *key, const char name[]) |
char * | key_get_curValue_rnaPath (Key *key, KeyBlock *kb) |
void | latt_to_key (Lattice *lt, KeyBlock *kb) |
void | key_to_latt (KeyBlock *kb, Lattice *lt) |
void | curve_to_key (Curve *cu, KeyBlock *kb, ListBase *nurb) |
void | key_to_curve (KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb) |
void | mesh_to_key (Mesh *me, KeyBlock *kb) |
void | key_to_mesh (KeyBlock *kb, Mesh *me) |
float(* | key_to_vertcos (Object *ob, KeyBlock *kb))[3] |
void | vertcos_to_key (Object *ob, KeyBlock *kb, float(*vertCos)[3]) |
void | offset_to_key (Object *ob, KeyBlock *kb, float(*ofs)[3]) |
Variables | |
int | slurph_opt = 1 |
Definition in file key.c.
#define GS | ( | a | ) | (*((short *)(a))) |
Definition at line 103 of file key.c.
Referenced by add_key(), key_block_get_data(), and key_pointer_size().
#define IPO_BEZTRIPLE 100 |
Definition at line 73 of file key.c.
Referenced by cp_key(), do_key(), do_rel_key(), and switch_endian_keyblock().
#define IPO_BPOINT 101 |
Definition at line 74 of file key.c.
Referenced by add_key(), cp_key(), do_key(), do_rel_key(), and switch_endian_keyblock().
#define IPO_FLOAT 4 |
Definition at line 72 of file key.c.
Referenced by add_key(), cp_key(), do_key(), do_rel_key(), and switch_endian_keyblock().
#define KEY_MODE_BEZTRIPLE 2 |
Definition at line 69 of file key.c.
Referenced by cp_cu_key(), cp_key(), do_cu_key(), do_curve_key(), do_key(), do_rel_cu_key(), and do_rel_key().
#define KEY_MODE_BPOINT 1 |
Definition at line 68 of file key.c.
Referenced by cp_cu_key(), do_cu_key(), do_curve_key(), do_rel_cu_key(), and key_pointer_size().
#define KEY_MODE_DUMMY 0 |
Definition at line 67 of file key.c.
Referenced by do_latt_key(), and do_mesh_key().
Definition at line 108 of file key.c.
References alloc_libblock(), Key::elemsize, Key::elemstr, Key::from, G, GS, ID_CU, ID_KE, ID_LT, ID_ME, IPO_BPOINT, IPO_FLOAT, KEY_NORMAL, ID::name, and Key::type.
Referenced by insert_curvekey(), insert_lattkey(), insert_meshkey(), join_mesh_exec(), join_mesh_shapes_exec(), and modifier_apply_shape().
Definition at line 1429 of file key.c.
References KeyBlock::adrcode, BKE_curframe(), BLI_addtail(), BLI_countlist(), BLI_snprintf(), BLI_strncpy(), BLI_uniquename(), Key::block, KEY_CARDINAL, KEY_RELATIVE, KEY_SPEED, ListBase::last, MEM_callocN(), KeyBlock::name, KeyBlock::pos, Key::refkey, KeyBlock::slidermax, KeyBlock::slidermin, sort_keys(), Key::totkey, Key::type, and KeyBlock::type.
Referenced by insert_curvekey(), insert_lattkey(), insert_meshkey(), join_mesh_shapes_exec(), and modifier_apply_shape().
Definition at line 150 of file key.c.
References BLI_duplicatelist(), Key::block, copy_libblock(), KeyBlock::data, ListBase::first, Key::id, MEM_dupallocN(), KeyBlock::next, NULL, and Key::refkey.
Referenced by BL_ShapeDeformer::BL_ShapeDeformer(), copy_curve(), copy_lattice(), copy_mesh(), id_copy(), and join_mesh_exec().
static void cp_cu_key | ( | Curve * | cu, |
Key * | key, | ||
KeyBlock * | actkb, | ||
KeyBlock * | kb, | ||
const int | start, | ||
int | end, | ||
char * | out, | ||
const int | tot | ||
) | [static] |
Definition at line 667 of file key.c.
References Nurb::bezt, Nurb::bp, cp_key(), ListBase::first, KEY_MODE_BEZTRIPLE, KEY_MODE_BPOINT, MAX2, MIN2, Nurb::next, NULL, Curve::nurb, Nurb::pntsu, Nurb::pntsv, and step().
Referenced by do_curve_key(), and do_ob_key().
static void cp_key | ( | const int | start, |
int | end, | ||
const int | tot, | ||
char * | poin, | ||
Key * | key, | ||
KeyBlock * | actkb, | ||
KeyBlock * | kb, | ||
float * | weights, | ||
const int | mode | ||
) | [static] |
Definition at line 556 of file key.c.
References BLI_assert, Key::elemsize, Key::elemstr, IPO_BEZTRIPLE, IPO_BPOINT, IPO_FLOAT, key_block_get_data(), KEY_MODE_BEZTRIPLE, key_pointer_size(), MEM_freeN(), Key::refkey, rel_flerp(), and KeyBlock::totelem.
Referenced by cp_cu_key(), do_curve_key(), do_latt_key(), do_mesh_key(), do_ob_key(), and do_rel_key().
Definition at line 1594 of file key.c.
References BPoint::alfa, BezTriple::alfa, Nurb::bezt, Nurb::bp, copy_v3_v3(), count_curveverts(), KeyBlock::data, Key::elemsize, ListBase::first, Curve::key, MEM_callocN(), MEM_freeN(), Nurb::next, Nurb::pntsu, Nurb::pntsv, KeyBlock::totelem, BPoint::vec, and BezTriple::vec.
Referenced by insert_curvekey().
static void do_cu_key | ( | Curve * | cu, |
Key * | key, | ||
KeyBlock * | actkb, | ||
KeyBlock ** | k, | ||
float * | t, | ||
char * | out, | ||
const int | tot | ||
) | [static] |
Definition at line 1132 of file key.c.
References Nurb::bezt, Nurb::bp, do_key(), ListBase::first, KEY_MODE_BEZTRIPLE, KEY_MODE_BPOINT, Nurb::next, Curve::nurb, Nurb::pntsu, Nurb::pntsv, and step().
Referenced by do_curve_key().
static void do_curve_key | ( | Scene * | scene, |
Object * | ob, | ||
Key * | key, | ||
char * | out, | ||
const int | tot | ||
) | [static] |
Definition at line 1170 of file key.c.
References Nurb::bezt, BKE_curframe(), Key::block, Nurb::bp, RenderData::cfra, CLAMP(), cp_cu_key(), cp_key(), Object::data, do_cu_key(), do_key(), do_rel_cu_key(), ListBase::first, i, Curve::key, KEY_MODE_BEZTRIPLE, KEY_MODE_BPOINT, KEY_RELATIVE, KEY_SPEED, MIN2, Nurb::next, NULL, Curve::nurb, ob_get_keyblock(), Nurb::pntsu, Nurb::pntsv, Scene::r, setkeys(), Key::slurph, slurph_opt, step(), and Key::type.
Referenced by do_ob_key().
static void do_key | ( | const int | start, |
int | end, | ||
const int | tot, | ||
char * | poin, | ||
Key * | key, | ||
KeyBlock * | actkb, | ||
KeyBlock ** | k, | ||
float * | t, | ||
const int | mode | ||
) | [static] |
Definition at line 799 of file key.c.
References BLI_assert, Key::elemsize, Key::elemstr, flerp(), IPO_BEZTRIPLE, IPO_BPOINT, IPO_FLOAT, key_block_get_data(), KEY_MODE_BEZTRIPLE, key_pointer_size(), MEM_freeN(), KeyBlock::totelem, and totelem.
Referenced by do_cu_key(), do_curve_key(), do_latt_key(), and do_mesh_key().
static void do_latt_key | ( | Scene * | scene, |
Object * | ob, | ||
Key * | key, | ||
char * | out, | ||
const int | tot | ||
) | [static] |
Definition at line 1256 of file key.c.
References BKE_curframe(), Key::block, RenderData::cfra, CLAMP(), cp_key(), Object::data, do_key(), do_rel_key(), ListBase::first, Lattice::flag, get_weights_array(), KEY_MODE_DUMMY, KEY_RELATIVE, KEY_SPEED, LT_OUTSIDE, MEM_freeN(), KeyBlock::next, NULL, ob_get_keyblock(), outside_lattice(), Scene::r, setkeys(), Key::slurph, Key::type, KeyBlock::vgroup, and KeyBlock::weights.
Referenced by do_ob_key().
static void do_mesh_key | ( | Scene * | scene, |
Object * | ob, | ||
Key * | key, | ||
char * | out, | ||
const int | tot | ||
) | [static] |
Definition at line 1055 of file key.c.
References BKE_curframe(), Key::block, RenderData::cfra, CLAMP(), cp_key(), do_key(), do_rel_key(), ListBase::first, get_weights_array(), KEY_MODE_DUMMY, KEY_RELATIVE, KEY_SPEED, MEM_freeN(), KeyBlock::next, NULL, ob_get_keyblock(), Scene::r, setkeys(), Key::slurph, slurph_opt, step(), Key::type, KeyBlock::vgroup, and KeyBlock::weights.
Referenced by do_ob_key().
Definition at line 1324 of file key.c.
References Key::adt, ADT_RECALC_DRIVERS, Nurb::bezt, BKE_animsys_evaluate_animdata(), BLI_findlink(), Key::block, Nurb::bp, RenderData::cfra, cp_cu_key(), cp_key(), Object::data, do_curve_key(), do_latt_key(), do_mesh_key(), ELEM, ListBase::first, KeyBlock::flag, Key::from, get_weights_array(), Key::id, KEYBLOCK_MUTE, MEM_callocN(), MEM_freeN(), Nurb::next, NULL, Curve::nurb, OB_CURVE, ob_get_key(), ob_get_keyblock(), OB_LATTICE, OB_MESH, OB_SHAPE_LOCK, OB_SURF, OB_TYPE_SUPPORT_VGROUP, Nurb::pntsu, Lattice::pntsu, Nurb::pntsv, Lattice::pntsv, Lattice::pntsw, Scene::r, Key::refkey, Object::shapeflag, Object::shapenr, size(), Mesh::totvert, Object::type, and KeyBlock::vgroup.
Referenced by curve_calc_modifiers_pre(), deformVerts(), insert_curvekey(), insert_lattkey(), and insert_meshkey().
static void do_rel_cu_key | ( | Curve * | cu, |
Key * | key, | ||
KeyBlock * | actkb, | ||
float | UNUSEDctime, | ||
char * | out, | ||
const int | tot | ||
) | [static] |
Definition at line 1151 of file key.c.
References Nurb::bezt, Nurb::bp, do_rel_key(), ListBase::first, KEY_MODE_BEZTRIPLE, KEY_MODE_BPOINT, Nurb::next, Curve::nurb, Nurb::pntsu, Nurb::pntsv, and step().
Referenced by do_curve_key().
void do_rel_key | ( | const int | start, |
int | end, | ||
const int | tot, | ||
char * | basispoin, | ||
Key * | key, | ||
KeyBlock * | actkb, | ||
const int | mode | ||
) |
Definition at line 695 of file key.c.
References BLI_assert, BLI_findlink(), Key::block, cp_key(), KeyBlock::curval, Key::elemsize, Key::elemstr, ListBase::first, KeyBlock::flag, IPO_BEZTRIPLE, IPO_BPOINT, IPO_FLOAT, key_block_get_data(), KEY_MODE_BEZTRIPLE, key_pointer_size(), KEYBLOCK_MUTE, MEM_freeN(), KeyBlock::next, NULL, Key::refkey, rel_flerp(), KeyBlock::relative, KeyBlock::totelem, and KeyBlock::weights.
Referenced by do_latt_key(), do_mesh_key(), do_rel_cu_key(), and BL_ShapeDeformer::Update().
static void flerp | ( | int | tot, |
float * | in, | ||
float * | f0, | ||
float * | f1, | ||
float * | f2, | ||
float * | f3, | ||
float * | t | ||
) | [static] |
void free_key | ( | Key * | key | ) |
Definition at line 79 of file key.c.
References BKE_free_animdata(), BLI_remlink(), KeyBlock::data, and MEM_freeN().
Referenced by free_libblock(), join_mesh_exec(), and BL_ShapeDeformer::~BL_ShapeDeformer().
static float* get_weights_array | ( | Object * | ob, |
char * | vgroup | ||
) | [static] |
Definition at line 1000 of file key.c.
References CD_MDEFORMVERT, CustomData_em_get(), Object::data, EditVert::data, defgroup_name_index(), defvert_find_weight(), Lattice::dvert, Mesh::dvert, Mesh::edit_mesh, ListBase::first, i, MEM_callocN(), EditVert::next, NULL, OB_LATTICE, OB_MESH, Lattice::pntsu, Lattice::pntsv, Lattice::pntsw, EditMesh::totvert, Mesh::totvert, Object::type, EditMesh::vdata, and EditMesh::verts.
Referenced by do_latt_key(), do_mesh_key(), and do_ob_key().
static char* key_block_get_data | ( | Key * | key, |
KeyBlock * | actkb, | ||
KeyBlock * | kb, | ||
char ** | freedata | ||
) | [static] |
Definition at line 491 of file key.c.
References co, EditVert::co, copy_v3_v3(), KeyBlock::data, Mesh::edit_mesh, ListBase::first, Key::from, GS, ID_ME, MEM_callocN(), ID::name, EditVert::next, NULL, KeyBlock::totelem, EditMesh::totvert, and EditMesh::verts.
Referenced by cp_key(), do_key(), and do_rel_key().
void key_curve_normal_weights | ( | float | t, |
float * | data, | ||
int | type | ||
) |
Definition at line 324 of file key.c.
References KEY_BSPLINE, KEY_CARDINAL, and KEY_LINEAR.
void key_curve_position_weights | ( | float | t, |
float * | data, | ||
int | type | ||
) |
Definition at line 262 of file key.c.
References KEY_BSPLINE, KEY_CARDINAL, and KEY_LINEAR.
Referenced by alfa_bezpart(), calc_latt_deform(), do_colorband(), psys_interpolate_particle(), setkeys(), strand_eval_point(), and where_on_path().
void key_curve_tangent_weights | ( | float | t, |
float * | data, | ||
int | type | ||
) |
Definition at line 294 of file key.c.
References KEY_BSPLINE, KEY_CARDINAL, and KEY_LINEAR.
Referenced by strand_eval_point(), and where_on_path().
Definition at line 1533 of file key.c.
References ELEM, Key::id, NULL, RNA_path_from_ID_to_property(), RNA_pointer_create(), RNA_ShapeKey, and RNA_struct_find_property().
Referenced by achannel_setting_slider_shapekey_cb(), ANIM_channel_draw_widgets(), and make_new_animlistelem().
Definition at line 1502 of file key.c.
References Key::block, ListBase::first, i, KeyBlock::next, NULL, and Key::totkey.
Referenced by get_orco_coords_dm().
Definition at line 1522 of file key.c.
References BLI_findstring(), Key::block, and NULL.
Referenced by join_mesh_exec(), and sculpt_undo_restore().
static short key_pointer_size | ( | const Key * | key, |
const int | mode, | ||
int * | poinsize, | ||
int * | ofs | ||
) | [static] |
Definition at line 1645 of file key.c.
References BPoint::alfa, BezTriple::alfa, Nurb::bezt, Nurb::bp, copy_v3_v3(), count_curveverts(), KeyBlock::data, ListBase::first, MIN2, Nurb::next, Nurb::pntsu, Nurb::pntsv, KeyBlock::totelem, BPoint::vec, and BezTriple::vec.
Definition at line 1576 of file key.c.
References copy_v3_v3(), KeyBlock::data, Lattice::def, MIN2, Lattice::pntsu, Lattice::pntsv, Lattice::pntsw, KeyBlock::totelem, and BPoint::vec.
Referenced by ED_object_shape_key_remove(), and make_editLatt().
Definition at line 1717 of file key.c.
References MVert::co, copy_v3_v3(), KeyBlock::data, MIN2, Mesh::mvert, KeyBlock::totelem, and Mesh::totvert.
Referenced by ED_object_shape_key_remove().
Definition at line 1734 of file key.c.
References co, copy_v3_v3(), count_curveverts(), KeyBlock::data, ELEM, ListBase::first, i, MEM_callocN(), NULL, Curve::nurb, OB_CURVE, OB_LATTICE, OB_MESH, OB_SURF, Lattice::pntsu, Lattice::pntsv, Lattice::pntsw, and Mesh::totvert.
Referenced by sculpt_undo_restore(), sculpt_update_mesh_elements(), and sculpt_vertcos_to_key().
Definition at line 1555 of file key.c.
References copy_v3_v3(), KeyBlock::data, Lattice::def, Key::elemsize, Lattice::key, MEM_callocN(), MEM_freeN(), Lattice::pntsu, Lattice::pntsv, Lattice::pntsw, KeyBlock::totelem, and BPoint::vec.
Referenced by insert_lattkey().
void make_local_key | ( | Key * | key | ) |
Definition at line 1696 of file key.c.
References MVert::co, copy_v3_v3(), KeyBlock::data, Key::elemsize, Mesh::key, MEM_callocN(), MEM_freeN(), Mesh::mvert, KeyBlock::totelem, and Mesh::totvert.
Referenced by insert_meshkey(), join_mesh_shapes_exec(), and modifier_apply_shape().
Definition at line 1410 of file key.c.
References Object::data, ELEM, Lattice::key, Curve::key, Mesh::key, NULL, OB_CURVE, OB_LATTICE, OB_MESH, OB_SURF, and Object::type.
Referenced by actedit_get_shapekeys(), animdata_filter_dopesheet_ob(), build_dag_object(), dag_id_flush_update(), deformMatrices(), deformMatricesEM(), deformVertsEM(), do_ob_key(), draw_mesh_object(), draw_selected_name(), ED_object_shape_key_add(), ED_object_shape_key_remove(), get_orco_coords_dm(), modifiers_getVirtualModifierList(), ob_get_keyblock(), ob_get_reference_keyblock(), object_add_duplicate_internal(), object_frame_has_keyframe(), object_is_modified(), object_shape_key_mirror(), sculpt_undo_restore(), shape_key_clear_exec(), shape_key_move_exec(), and special_aftertrans_update().
Definition at line 1479 of file key.c.
References BLI_findlink(), Key::block, NULL, ob_get_key(), and Object::shapenr.
Referenced by deformMatrices(), deformMatricesEM(), deformVerts(), do_curve_key(), do_latt_key(), do_mesh_key(), do_ob_key(), make_editLatt(), make_editMesh(), make_editNurb(), sculpt_update_mesh_elements(), shape_key_clear_exec(), and stats_string().
Definition at line 1491 of file key.c.
References NULL, ob_get_key(), and Key::refkey.
Definition at line 1884 of file key.c.
References add_v3_v3(), co, Object::data, KeyBlock::data, ELEM, ListBase::first, i, Curve::nurb, OB_CURVE, OB_LATTICE, OB_MESH, OB_SURF, KeyBlock::totelem, and Object::type.
Referenced by sculpt_vertcos_to_key().
static void rel_flerp | ( | int | tot, |
float * | in, | ||
float * | ref, | ||
float * | out, | ||
float | fac | ||
) | [static] |
Definition at line 482 of file key.c.
Referenced by cp_key(), and do_rel_key().
Definition at line 350 of file key.c.
References simple_enum_gen::d, ListBase::first, KEY_BSPLINE, key_curve_position_weights(), ListBase::last, KeyBlock::next, NULL, and KeyBlock::pos.
Referenced by do_curve_key(), do_latt_key(), and do_mesh_key().
void sort_keys | ( | Key * | key | ) |
Definition at line 193 of file key.c.
References IpoCurve::adrcode, KeyBlock::adrcode, BLI_insertlink(), BLI_remlink(), Key::block, ListBase::first, i, KeyBlock::next, IpoCurve::next, KeyBlock::pos, KeyBlock::prev, IpoCurve::prev, and Key::refkey.
Referenced by add_keyblock().
Definition at line 1807 of file key.c.
References co, copy_v3_v3(), count_curveverts(), Object::data, KeyBlock::data, ELEM, Key::elemsize, ListBase::first, i, Curve::key, Lattice::key, Mesh::key, MEM_callocN(), MEM_freeN(), NULL, Curve::nurb, OB_CURVE, OB_LATTICE, OB_MESH, OB_SURF, Lattice::pntsu, Lattice::pntsv, Lattice::pntsw, Mesh::totvert, and Object::type.
Referenced by sculpt_vertcos_to_key().
int slurph_opt = 1 |
Definition at line 76 of file key.c.
Referenced by database_fromscene_vectors(), do_curve_key(), do_mesh_key(), and RE_Database_FromScene().