diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-02-11 23:25:36 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-02-11 23:29:31 +0300 |
commit | 23214ecad03bfef75c78b6a812970959da363344 (patch) | |
tree | 6d7f84634658b88a1b2557d7c3803c3d7aa379f5 /source/blender/blenkernel | |
parent | 27b2ab8cf4ae9140ff53d812c142e7d65cbeee11 (diff) |
Outliner: ContextMenus for constraints/modifiers
Context menu to toggle render, visibility & delete
D996 by @lichtwerk
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_constraint.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 19 |
2 files changed, 19 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h index 82ae4930526..ca03dd00521 100644 --- a/source/blender/blenkernel/BKE_constraint.h +++ b/source/blender/blenkernel/BKE_constraint.h @@ -131,6 +131,7 @@ struct bConstraint *BKE_constraints_find_name(struct ListBase *list, const char struct bConstraint *BKE_constraint_add_for_object(struct Object *ob, const char *name, short type); struct bConstraint *BKE_constraint_add_for_pose(struct Object *ob, struct bPoseChannel *pchan, const char *name, short type); +bool BKE_constraint_remove_ex(ListBase *list, struct Object *ob, struct bConstraint *con, bool clear_dep); bool BKE_constraint_remove(ListBase *list, struct bConstraint *con); /* Constraints + Proxies function prototypes */ diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 668b78a08d4..71b2e7df4b2 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -79,6 +79,8 @@ #include "BKE_tracking.h" #include "BKE_movieclip.h" +#include "BIK_api.h" + #ifdef WITH_PYTHON # include "BPY_extern.h" #endif @@ -4410,8 +4412,23 @@ bool BKE_constraint_remove(ListBase *list, bConstraint *con) BLI_freelinkN(list, con); return true; } - else + else { return false; + } +} + +bool BKE_constraint_remove_ex(ListBase *list, Object *ob, bConstraint *con, bool clear_dep) +{ + if (BKE_constraint_remove(list, con)) { + /* ITASC needs to be rebuilt once a constraint is removed [#26920] */ + if (clear_dep && ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK)) { + BIK_clear_data(ob->pose); + } + return true; + } + else { + return false; + } } /* ......... */ |