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:
authorJoshua Leung <aligorith@gmail.com>2013-07-01 17:02:53 +0400
committerJoshua Leung <aligorith@gmail.com>2013-07-01 17:02:53 +0400
commit4f3f95751ad264eb6be10d3470425e93afc557f6 (patch)
tree2669cdf1db2637c5bb423f84e1b7d449222ebe76 /source/blender/editors/object/object_vgroup.c
parent61d37cd47c89d57909df4025b85db39685ad220e (diff)
Bugfix [#35936] Can't create new vertex group when using Ctrl G menu
This was caused by r.57812 There were two problems here: 1) vertex_group_vert_select_unlocked_poll() had faulty logic which meant that it always failed when there were no vgroups present yet - the final return always just fell through 2) Since the "Assign to New Groups" option was actually implemented using the same operator as "Assign to Active Group" (just with an extra parameter set), if the active group was locked, it was not possible to "Assign to New Group" (even though a new group would not be locked).
Diffstat (limited to 'source/blender/editors/object/object_vgroup.c')
-rw-r--r--source/blender/editors/object/object_vgroup.c41
1 files changed, 32 insertions, 9 deletions
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index e1a18158c2d..c4fb3188528 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -2993,7 +2993,7 @@ static int vertex_group_vert_select_unlocked_poll(bContext *C)
return !(dg->flag & DG_LOCK_WEIGHT);
}
}
- return 0;
+ return 1;
}
static int vertex_group_vert_select_mesh_poll(bContext *C)
@@ -3080,10 +3080,7 @@ static int vertex_group_assign_exec(bContext *C, wmOperator *op)
{
ToolSettings *ts = CTX_data_tool_settings(C);
Object *ob = ED_object_context(C);
-
- if (RNA_boolean_get(op->ptr, "new"))
- ED_vgroup_add(ob);
-
+
vgroup_assign_verts(ob, ts->vgroup_weight);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
@@ -3094,9 +3091,9 @@ static int vertex_group_assign_exec(bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_assign(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Assign Vertex Group";
+ ot->name = "Assign to Vertex Group";
ot->idname = "OBJECT_OT_vertex_group_assign";
- ot->description = "Assign the selected vertices to the active (or a new) vertex group";
+ ot->description = "Assign the selected vertices to the active vertex group";
/* api callbacks */
ot->poll = vertex_group_vert_select_unlocked_poll;
@@ -3107,9 +3104,35 @@ void OBJECT_OT_vertex_group_assign(wmOperatorType *ot)
* isn't stored in local edit mode stack and toggling "new" property will
* lead to creating plenty of new vertex groups (see [#29527], sergey) */
ot->flag = /*OPTYPE_REGISTER|*/ OPTYPE_UNDO;
+}
- /* properties */
- RNA_def_boolean(ot->srna, "new", 0, "New", "Assign vertex to new vertex group");
+/* NOTE: just a wrapper around vertex_group_assign_exec(), except we add these to a new group */
+static int vertex_group_assign_new_exec(bContext *C, wmOperator *op)
+{
+ /* create new group... */
+ Object *ob = ED_object_context(C);
+ ED_vgroup_add(ob);
+
+ /* assign selection to new group */
+ return vertex_group_assign_exec(C, op);
+}
+
+void OBJECT_OT_vertex_group_assign_new(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Assign to New Group";
+ ot->idname = "OBJECT_OT_vertex_group_assign_new";
+ ot->description = "Assign the selected vertices to a new vertex group";
+
+ /* api callbacks */
+ ot->poll = vertex_group_vert_select_poll;
+ ot->exec = vertex_group_assign_new_exec;
+
+ /* flags */
+ /* redo operator will fail in this case because vertex group assignment
+ * isn't stored in local edit mode stack and toggling "new" property will
+ * lead to creating plenty of new vertex groups (see [#29527], sergey) */
+ ot->flag = /*OPTYPE_REGISTER|*/ OPTYPE_UNDO;
}
static int vertex_group_remove_from_exec(bContext *C, wmOperator *op)