Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaia Clary <gaia.clary@machinimatrix.org>2013-06-27 10:33:01 +0400
committerGaia Clary <gaia.clary@machinimatrix.org>2013-06-27 10:33:01 +0400
commit821c02ddb77f411499aa48ee00e8858fbc6ade1a (patch)
tree7bab4b44428d6c362a696d14841ba000894af911 /source/blender/editors
parent35e92f54a1cdf0458c9090821d0966ee21ed0bd7 (diff)
Added checks to Vertex Groups panel to respect locked Vertex Groups
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/object/object_vgroup.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 456e8881d31..9cf8f7e6f6d 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -2972,6 +2972,29 @@ static int vertex_group_vert_select_poll(bContext *C)
vgroup_object_in_wpaint_vert_select(ob));
}
+/* editmode _or_ weight paint vertex sel and active group unlocked */
+static int vertex_group_vert_select_unlocked_poll(bContext *C)
+{
+ Object *ob = ED_object_context(C);
+ ID *data = (ob) ? ob->data : NULL;
+
+ if (!(ob && !ob->id.lib && data && !data->lib))
+ return 0;
+
+ if (!(vgroup_object_in_edit_mode(ob) ||
+ vgroup_object_in_wpaint_vert_select(ob))) {
+ return 0;
+ }
+
+ if (ob->actdef != -1) {
+ bDeformGroup *dg = BLI_findlink(&ob->defbase, ob->actdef - 1);
+ if (dg) {
+ return !(dg->flag & DG_LOCK_WEIGHT);
+ }
+ }
+ return 0;
+}
+
static int vertex_group_vert_select_mesh_poll(bContext *C)
{
Object *ob = ED_object_context(C);
@@ -3075,7 +3098,7 @@ void OBJECT_OT_vertex_group_assign(wmOperatorType *ot)
ot->description = "Assign the selected vertices to the current (or a new) vertex group";
/* api callbacks */
- ot->poll = vertex_group_vert_select_poll;
+ ot->poll = vertex_group_vert_select_unlocked_poll;
ot->exec = vertex_group_assign_exec;
/* flags */
@@ -3123,7 +3146,7 @@ void OBJECT_OT_vertex_group_remove_from(wmOperatorType *ot)
ot->description = "Remove the selected vertices from active or all vertex group(s)";
/* api callbacks */
- ot->poll = vertex_group_vert_select_poll;
+ ot->poll = vertex_group_vert_select_unlocked_poll;
ot->exec = vertex_group_remove_from_exec;
/* flags */