63 switch (obedit->
type) {
164 Object *ob,
KeyBlock *kb,
const bool use_topology,
int &totmirr,
int &totfail)
176 for (i1 = 0; i1 <
mesh->verts_num; i1++) {
179 fp1 = ((
float *)kb->
data) + i1 * 3;
185 if (tag_elem[i1] == 0 && tag_elem[i2] == 0) {
186 fp1 = ((
float *)kb->
data) + i1 * 3;
187 fp2 = ((
float *)kb->
data) + i2 * 3;
198 tag_elem[i1] = tag_elem[i2] = 1;
213 const int pntsu_half = (lt->
pntsu / 2) + (lt->
pntsu % 2);
224 for (u = 0; u < pntsu_half; u++) {
225 int u_inv = (lt->
pntsu - 1) - u;
229 fp1 = ((
float *)kb->
data) + i1 * 3;
237 fp1 = ((
float *)kb->
data) + i1 * 3;
238 fp2 = ((
float *)kb->
data) + i2 * 3;
256 bContext *
C,
Object *ob,
int *r_totmirr,
int *r_totfail,
bool use_topology)
259 int totmirr = 0, totfail = 0;
261 *r_totmirr = *r_totfail = 0;
264 if (key ==
nullptr) {
272 *r_totmirr = totmirr;
273 *r_totfail = totfail;
290 ID *
data =
static_cast<ID *
>((ob) ? ob->
data :
nullptr);
352 ot->name =
"Add Shape Key";
353 ot->idname =
"OBJECT_OT_shape_key_add";
354 ot->description =
"Add shape key to the object";
368 "Create the new shape key from the existing mix of keys");
392 ot->name =
"Duplicate Shape Key";
393 ot->idname =
"OBJECT_OT_shape_key_copy";
394 ot->description =
"Duplicate the active shape key";
412 bool changed =
false;
421 ob,
nullptr,
nullptr, 0,
static_cast<ID *
>(ob->
data));
427 int num_selected_but_locked = 0;
439 num_selected_but_locked++;
450 if (cur_index == 0) {
455 if (num_selected_but_locked) {
458 "Could not delete %d locked shape key(s)",
459 num_selected_but_locked);
468 if (key && key->
totkey > 0) {
491 if (
STREQ(prop_id,
"apply_mix") && !do_all) {
503 return TIP_(
"Apply current visible shape to the object data, and delete all shape keys");
512 ot->name =
"Remove Shape Key";
513 ot->idname =
"OBJECT_OT_shape_key_remove";
514 ot->description =
"Remove shape key from the object";
531 "Apply current mix of shape keys to the geometry before removing them");
550 kb->curval =
clamp_f(0.0f, kb->slidermin, kb->slidermax);
562 ot->name =
"Clear Shape Keys";
564 "Reset the weights of all shape keys to 0 or to the closest value respecting the limits";
565 ot->idname =
"OBJECT_OT_shape_key_clear";
600 ot->name =
"Re-Time Shape Keys";
601 ot->description =
"Resets the timing for absolute shape keys";
602 ot->idname =
"OBJECT_OT_shape_key_retime";
621 int totmirr = 0, totfail = 0;
640 ot->name =
"Mirror Shape Key";
641 ot->idname =
"OBJECT_OT_shape_key_mirror";
642 ot->description =
"Mirror the current shape key along the local X axis";
657 "Use topology based mirroring (for when both sides of mesh have matching, unique topology)");
679 const int totkey = key.
totkey;
681 bool changed =
false;
687 for (
int index = 1; index < totkey; index++) {
694 new_index = top_index;
697 new_index =
max_ii(index - 1, top_index);
712 int bottom_index = totkey - 1;
714 for (
int index = totkey - 1; index >= 1; index--) {
721 new_index = bottom_index;
724 new_index =
min_ii(index + 1, bottom_index);
753 {0,
nullptr, 0,
nullptr,
nullptr}};
756 ot->name =
"Move Shape Key";
757 ot->idname =
"OBJECT_OT_shape_key_move";
758 ot->description =
"Move selected shape keys up/down in the list";
817 return TIP_(
"Lock all shape keys of the active object");
820 return TIP_(
"Unlock all shape keys of the active object");
832 {0,
nullptr, 0,
nullptr,
nullptr},
836 ot->name =
"Change the Lock On Shape Keys";
837 ot->idname =
"OBJECT_OT_shape_key_lock";
838 ot->description =
"Change the lock state of all shape keys of active object";
850 shape_key_lock_actions,
853 "Lock action to execute on vertex groups");
880 const int from_index = -1;
881 const int to_index = 0;
908 ot->name =
"Make Shape Key the Basis Key";
909 ot->idname =
"OBJECT_OT_shape_key_make_basis";
911 "Make this shape key the new basis key, effectively applying it to the mesh. Note that this "
912 "applies the shape key at its 100% value";
Object * CTX_data_active_object(const bContext *C)
Main * CTX_data_main(const bContext *C)
KeyBlock * BKE_keyblock_from_object(Object *ob)
KeyBlock * BKE_keyblock_duplicate(Key *key, KeyBlock *kb_src)
bool BKE_keyblock_move(Object *ob, int org_index, int new_index)
float * BKE_key_evaluate_object_ex(Object *ob, int *r_totelem, float *arr, size_t arr_size, ID *obdata)
Key * BKE_key_from_object(Object *ob)
int BKE_lattice_index_from_uvw(const Lattice *lt, int u, int v, int w)
General operations, lookup, etc. for blender objects.
KeyBlock * BKE_object_shapekey_insert(Main *bmain, Object *ob, const char *name, bool from_mix)
bool BKE_object_shapekey_free(Main *bmain, Object *ob)
bool BKE_object_shapekey_remove(Main *bmain, Object *ob, KeyBlock *kb)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
#define BLI_assert_unreachable()
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
MINLINE int min_ii(int a, int b)
MINLINE float clamp_f(float value, float min, float max)
MINLINE int max_ii(int a, int b)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
#define ID_IS_EDITABLE(_id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
Object is a sort of wrapper for general info.
KeyBlock * ED_lattice_get_edit_shape_key(const Lattice *latt)
void ED_mesh_report_mirror(ReportList &reports, int totmirr, int totfail)
int mesh_get_x_mirror_vert(Object *ob, Mesh *mesh_eval, int index, bool use_topology)
void ED_mesh_mirror_spatial_table_begin(Object *ob, BMEditMesh *em, Mesh *mesh_eval)
void ED_mesh_mirror_spatial_table_end(Object *ob)
KeyBlock * ED_mesh_get_edit_shape_key(const Mesh *me)
Read Guarded memory(de)allocation.
BMesh const char void * data
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
KeyBlock * ED_curve_get_edit_shape_key(const Curve *cu)
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void MEM_freeN(void *vmemh)
void OBJECT_OT_shape_key_clear(wmOperatorType *ot)
static wmOperatorStatus shape_key_clear_exec(bContext *C, wmOperator *)
static bool shape_key_make_basis_poll(bContext *C)
static bool object_shape_key_mirror(bContext *C, Object *ob, int *r_totmirr, int *r_totfail, bool use_topology)
void OBJECT_OT_shape_key_move(wmOperatorType *ot)
static void object_shape_key_add(bContext *C, Object *ob, const bool from_mix)
bool shape_key_report_if_locked(const Object *obedit, ReportList *reports)
static wmOperatorStatus shape_key_retime_exec(bContext *C, wmOperator *)
bool shape_key_report_if_any_locked(Object *ob, ReportList *reports)
static bool shape_key_exists_poll(bContext *C)
Object * context_object(const bContext *C)
static wmOperatorStatus shape_key_copy_exec(bContext *C, wmOperator *)
void OBJECT_OT_shape_key_copy(wmOperatorType *ot)
static bool shape_key_mode_exists_poll(bContext *C)
static bool shape_key_move_poll(bContext *C)
static bool shape_key_mode_poll(bContext *C)
static wmOperatorStatus shape_key_remove_exec(bContext *C, wmOperator *op)
static wmOperatorStatus shape_key_add_exec(bContext *C, wmOperator *op)
void shape_key_mirror(Object *ob, KeyBlock *kb, bool use_topology, int &totmirr, int &totfail)
bool shape_key_report_if_active_locked(Object *ob, ReportList *reports)
static bool object_is_any_shape_key_locked(Object *ob)
static wmOperatorStatus shape_key_make_basis_exec(bContext *C, wmOperator *)
void OBJECT_OT_shape_key_lock(wmOperatorType *ot)
static wmOperatorStatus shape_key_lock_exec(bContext *C, wmOperator *op)
static bool shape_key_poll(bContext *C)
void OBJECT_OT_shape_key_make_basis(wmOperatorType *ot)
void OBJECT_OT_shape_key_retime(wmOperatorType *ot)
void OBJECT_OT_shape_key_add(wmOperatorType *ot)
static bool shape_key_remove_poll_property(const bContext *, wmOperator *op, const PropertyRNA *prop)
static std::string shape_key_remove_get_description(bContext *, wmOperatorType *, PointerRNA *ptr)
void OBJECT_OT_shape_key_remove(wmOperatorType *ot)
static wmOperatorStatus shape_key_move_exec(bContext *C, wmOperator *op)
bool shape_key_is_selected(const Object &object, const KeyBlock &kb, int keyblock_index)
static std::string shape_key_lock_get_description(bContext *, wmOperatorType *, PointerRNA *ptr)
void OBJECT_OT_shape_key_mirror(wmOperatorType *ot)
static wmOperatorStatus shape_key_mirror_exec(bContext *C, wmOperator *op)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
const char * RNA_property_identifier(const PropertyRNA *prop)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
struct EditLatt * editlatt
struct ReportList * reports
void WM_event_add_notifier(const bContext *C, uint type, void *reference)