64 switch (obedit->
type) {
160 if (key ==
nullptr) {
173 bContext *C,
Object *ob,
int *r_totmirr,
int *r_totfail,
bool use_topology)
177 int totmirr = 0, totfail = 0;
179 *r_totmirr = *r_totfail = 0;
182 if (key ==
nullptr) {
189 char *tag_elem =
static_cast<char *
>(
200 for (i1 = 0; i1 < mesh->verts_num; i1++) {
203 fp1 = ((
float *)kb->
data) + i1 * 3;
209 if (tag_elem[i1] == 0 && tag_elem[i2] == 0) {
210 fp1 = ((
float *)kb->
data) + i1 * 3;
211 fp2 = ((
float *)kb->
data) + i2 * 3;
222 tag_elem[i1] = tag_elem[i2] = 1;
237 const int pntsu_half = (lt->
pntsu / 2) + (lt->
pntsu % 2);
248 for (u = 0; u < pntsu_half; u++) {
249 int u_inv = (lt->
pntsu - 1) - u;
253 fp1 = ((
float *)kb->
data) + i1 * 3;
261 fp1 = ((
float *)kb->
data) + i1 * 3;
262 fp2 = ((
float *)kb->
data) + i2 * 3;
279 *r_totmirr = totmirr;
280 *r_totfail = totfail;
297 ID *data =
static_cast<ID *
>((ob) ? ob->
data :
nullptr);
359 ot->
name =
"Add Shape Key";
360 ot->
idname =
"OBJECT_OT_shape_key_add";
375 "Create the new shape key from the existing mix of keys");
388 bool changed =
false;
397 ob,
nullptr,
nullptr, 0,
static_cast<ID *
>(ob->
data));
428 if (
STREQ(prop_id,
"apply_mix") && !do_all) {
440 return TIP_(
"Apply current visible shape to the object data, and delete all shape keys");
449 ot->
name =
"Remove Shape Key";
450 ot->
idname =
"OBJECT_OT_shape_key_remove";
468 "Apply current mix of shape keys to the geometry before removing them");
487 kb->curval =
clamp_f(0.0f, kb->slidermin, kb->slidermax);
499 ot->
name =
"Clear Shape Keys";
501 "Reset the weights of all shape keys to 0 or to the closest value respecting the limits";
502 ot->
idname =
"OBJECT_OT_shape_key_clear";
537 ot->
name =
"Re-Time Shape Keys";
538 ot->
description =
"Resets the timing for absolute shape keys";
539 ot->
idname =
"OBJECT_OT_shape_key_retime";
558 int totmirr = 0, totfail = 0;
577 ot->
name =
"Mirror Shape Key";
578 ot->
idname =
"OBJECT_OT_shape_key_mirror";
579 ot->
description =
"Mirror the current shape key along the local X axis";
594 "Use topology based mirroring (for when both sides of mesh have matching, unique topology)");
616 const int totkey = key->
totkey;
617 const int act_index = ob->
shapenr - 1;
626 new_index = totkey - 1;
631 new_index = (totkey + act_index + type) % totkey;
652 {0,
nullptr, 0,
nullptr,
nullptr}};
655 ot->
name =
"Move Shape Key";
656 ot->
idname =
"OBJECT_OT_shape_key_move";
657 ot->
description =
"Move the active shape key up/down in the list";
696 kb->flag &= ~KEYBLOCK_LOCKED_SHAPE;
716 return TIP_(
"Lock all shape keys of the active object");
719 return TIP_(
"Unlock all shape keys of the active object");
731 {0,
nullptr, 0,
nullptr,
nullptr},
735 ot->
name =
"Change the Lock On Shape Keys";
736 ot->
idname =
"OBJECT_OT_shape_key_lock";
737 ot->
description =
"Change the lock state of all shape keys of active object";
749 shape_key_lock_actions,
752 "Lock action to execute on vertex groups");
Object * CTX_data_active_object(const bContext *C)
Main * CTX_data_main(const bContext *C)
KeyBlock * BKE_keyblock_from_object(Object *ob)
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
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
#define LISTBASE_FOREACH(type, var, list)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE float clamp_f(float value, float min, float max)
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)
int mesh_get_x_mirror_vert(Object *ob, Mesh *mesh_eval, int index, bool use_topology)
void ED_mesh_report_mirror(wmOperator *op, int totmirr, int totfail)
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.
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_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void OBJECT_OT_shape_key_clear(wmOperatorType *ot)
static int shape_key_move_exec(bContext *C, wmOperator *op)
static void ED_object_shape_key_add(bContext *C, Object *ob, const bool from_mix)
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 int shape_key_remove_exec(bContext *C, wmOperator *op)
static bool object_shapekey_remove(Main *bmain, Object *ob)
bool shape_key_report_if_locked(const Object *obedit, ReportList *reports)
static int shape_key_mirror_exec(bContext *C, wmOperator *op)
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 bool shape_key_mode_exists_poll(bContext *C)
static bool shape_key_move_poll(bContext *C)
static bool shape_key_mode_poll(bContext *C)
bool shape_key_report_if_active_locked(Object *ob, ReportList *reports)
static bool object_is_any_shape_key_locked(Object *ob)
void OBJECT_OT_shape_key_lock(wmOperatorType *ot)
static bool shape_key_poll(bContext *C)
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 int shape_key_retime_exec(bContext *C, wmOperator *)
static int shape_key_add_exec(bContext *C, wmOperator *op)
static int shape_key_lock_exec(bContext *C, wmOperator *op)
static std::string shape_key_lock_get_description(bContext *, wmOperatorType *, PointerRNA *ptr)
void OBJECT_OT_shape_key_mirror(wmOperatorType *ot)
static int shape_key_clear_exec(bContext *C, wmOperator *)
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
bool(* poll_property)(const bContext *C, wmOperator *op, const PropertyRNA *prop) ATTR_WARN_UNUSED_RESULT
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
std::string(* get_description)(bContext *C, wmOperatorType *ot, PointerRNA *ptr)
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
void WM_event_add_notifier(const bContext *C, uint type, void *reference)