63 switch (obedit->
type) {
159 if (key ==
nullptr) {
172 bContext *
C,
Object *ob,
int *r_totmirr,
int *r_totfail,
bool use_topology)
176 int totmirr = 0, totfail = 0;
178 *r_totmirr = *r_totfail = 0;
181 if (key ==
nullptr) {
198 for (i1 = 0; i1 <
mesh->verts_num; i1++) {
201 fp1 = ((
float *)kb->
data) + i1 * 3;
207 if (tag_elem[i1] == 0 && tag_elem[i2] == 0) {
208 fp1 = ((
float *)kb->
data) + i1 * 3;
209 fp2 = ((
float *)kb->
data) + i2 * 3;
220 tag_elem[i1] = tag_elem[i2] = 1;
235 const int pntsu_half = (lt->
pntsu / 2) + (lt->
pntsu % 2);
246 for (u = 0; u < pntsu_half; u++) {
247 int u_inv = (lt->
pntsu - 1) - u;
251 fp1 = ((
float *)kb->
data) + i1 * 3;
259 fp1 = ((
float *)kb->
data) + i1 * 3;
260 fp2 = ((
float *)kb->
data) + i2 * 3;
277 *r_totmirr = totmirr;
278 *r_totfail = totfail;
295 ID *
data =
static_cast<ID *
>((ob) ? ob->
data :
nullptr);
357 ot->name =
"Add Shape Key";
358 ot->idname =
"OBJECT_OT_shape_key_add";
359 ot->description =
"Add shape key to the object";
373 "Create the new shape key from the existing mix of keys");
397 ot->name =
"Duplicate Shape Key";
398 ot->idname =
"OBJECT_OT_shape_key_copy";
399 ot->description =
"Duplicate the active shape key";
417 bool changed =
false;
426 ob,
nullptr,
nullptr, 0,
static_cast<ID *
>(ob->
data));
457 if (
STREQ(prop_id,
"apply_mix") && !do_all) {
469 return TIP_(
"Apply current visible shape to the object data, and delete all shape keys");
478 ot->name =
"Remove Shape Key";
479 ot->idname =
"OBJECT_OT_shape_key_remove";
480 ot->description =
"Remove shape key from the object";
497 "Apply current mix of shape keys to the geometry before removing them");
516 kb->curval =
clamp_f(0.0f, kb->slidermin, kb->slidermax);
528 ot->name =
"Clear Shape Keys";
530 "Reset the weights of all shape keys to 0 or to the closest value respecting the limits";
531 ot->idname =
"OBJECT_OT_shape_key_clear";
566 ot->name =
"Re-Time Shape Keys";
567 ot->description =
"Resets the timing for absolute shape keys";
568 ot->idname =
"OBJECT_OT_shape_key_retime";
587 int totmirr = 0, totfail = 0;
606 ot->name =
"Mirror Shape Key";
607 ot->idname =
"OBJECT_OT_shape_key_mirror";
608 ot->description =
"Mirror the current shape key along the local X axis";
623 "Use topology based mirroring (for when both sides of mesh have matching, unique topology)");
645 const int totkey = key->
totkey;
646 const int act_index = ob->
shapenr - 1;
655 new_index = totkey - 1;
660 new_index = (totkey + act_index + type) % totkey;
681 {0,
nullptr, 0,
nullptr,
nullptr}};
684 ot->name =
"Move Shape Key";
685 ot->idname =
"OBJECT_OT_shape_key_move";
686 ot->description =
"Move the active shape key up/down in the list";
745 return TIP_(
"Lock all shape keys of the active object");
748 return TIP_(
"Unlock all shape keys of the active object");
760 {0,
nullptr, 0,
nullptr,
nullptr},
764 ot->name =
"Change the Lock On Shape Keys";
765 ot->idname =
"OBJECT_OT_shape_key_lock";
766 ot->description =
"Change the lock state of all shape keys of active object";
778 shape_key_lock_actions,
781 "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)
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
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)
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)
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.
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)
#define ID_IS_EDITABLE(_id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
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 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)
static bool object_shapekey_remove(Main *bmain, Object *ob)
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)
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 wmOperatorStatus shape_key_lock_exec(bContext *C, wmOperator *op)
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 wmOperatorStatus shape_key_move_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 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)