void ED_object_constraint_dependency_update(Scene *scene, Object *ob) { ED_object_constraint_update(ob); if(ob->pose) ob->pose->flag |= POSE_RECALC; // checks & sorts pose channels DAG_scene_sort(scene); }
static void constraint_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem), void *C_v) { bContext *C = C_v; SpaceOops *soops = CTX_wm_space_outliner(C); bConstraint *constraint = (bConstraint *)te->directdata; Object *ob = (Object *)outliner_search_back(soops, te, ID_OB); if (event == OL_CONSTRAINTOP_ENABLE) { constraint->flag &= ~CONSTRAINT_OFF; ED_object_constraint_update(ob); WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob); } else if (event == OL_CONSTRAINTOP_DISABLE) { constraint->flag = CONSTRAINT_OFF; ED_object_constraint_update(ob); WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob); } else if (event == OL_CONSTRAINTOP_DELETE) { ListBase *lb = NULL; if (TREESTORE(te->parent->parent)->type == TSE_POSE_CHANNEL) { lb = &((bPoseChannel *)te->parent->parent->directdata)->constraints; } else { lb = &ob->constraints; } if (BKE_constraint_remove_ex(lb, ob, constraint, true)) { /* there's no active constraint now, so make sure this is the case */ BKE_constraints_active_set(&ob->constraints, NULL); ED_object_constraint_update(ob); /* needed to set the flags on posebones correctly */ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, ob); te->store_elem->flag &= ~TSE_SELECTED; } } }