static bool object_shapekey_remove(Main *bmain, Object *ob) { KeyBlock *kb; Key *key = BKE_key_from_object(ob); if (key == NULL) { return false; } kb = BLI_findlink(&key->block, ob->shapenr - 1); if (kb) { return BKE_object_shapekey_remove(bmain, ob, kb); } return false; }
static void rna_Object_shape_key_remove( Object *ob, Main *bmain, ReportList *reports, PointerRNA *kb_ptr) { KeyBlock *kb = kb_ptr->data; Key *key = BKE_key_from_object(ob); if ((key == NULL) || BLI_findindex(&key->block, kb) == -1) { BKE_reportf(reports, RPT_ERROR, "ShapeKey not found"); return; } if (!BKE_object_shapekey_remove(bmain, ob, kb)) { BKE_reportf(reports, RPT_ERROR, "Could not remove ShapeKey"); return; } DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob); RNA_POINTER_INVALIDATE(kb_ptr); }