[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55338] trunk/blender: patch [#34634] Select vertices without a group
Campbell Barton
ideasman42 at gmail.com
Sat Mar 16 17:11:51 CET 2013
Revision: 55338
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55338
Author: campbellbarton
Date: 2013-03-16 16:11:50 +0000 (Sat, 16 Mar 2013)
Log Message:
-----------
patch [#34634] Select vertices without a group
from Kevin Mackay (yakca)
Modified Paths:
--------------
trunk/blender/release/scripts/startup/bl_ui/space_view3d.py
trunk/blender/source/blender/editors/include/ED_mesh.h
trunk/blender/source/blender/editors/mesh/editface.c
trunk/blender/source/blender/editors/mesh/editmesh_select.c
trunk/blender/source/blender/editors/mesh/mesh_intern.h
trunk/blender/source/blender/editors/mesh/mesh_ops.c
trunk/blender/source/blender/editors/object/object_intern.h
trunk/blender/source/blender/editors/object/object_lattice.c
trunk/blender/source/blender/editors/object/object_ops.c
trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h
trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c
trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c
Modified: trunk/blender/release/scripts/startup/bl_ui/space_view3d.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_view3d.py 2013-03-16 16:10:27 UTC (rev 55337)
+++ trunk/blender/release/scripts/startup/bl_ui/space_view3d.py 2013-03-16 16:11:50 UTC (rev 55338)
@@ -580,6 +580,7 @@
layout.separator()
+ layout.operator("mesh.select_ungrouped", text="Ungrouped Verts")
layout.operator("mesh.select_random", text="Random")
layout.operator("mesh.select_nth")
layout.operator("mesh.edges_select_sharp", text="Sharp Edges")
@@ -704,7 +705,11 @@
layout.operator("lattice.select_all").action = 'TOGGLE'
layout.operator("lattice.select_all", text="Inverse").action = 'INVERT'
+ layout.separator()
+ layout.operator("lattice.select_ungrouped", text="Ungrouped Verts")
+
+
class VIEW3D_MT_select_edit_armature(Menu):
bl_label = "Select"
@@ -770,7 +775,11 @@
layout.operator("paint.vert_select_all").action = 'TOGGLE'
layout.operator("paint.vert_select_all", text="Inverse").action = 'INVERT'
+ layout.separator()
+ layout.operator("paint.vert_select_ungrouped", text="Ungrouped Verts")
+
+
# ********** Object menu **********
Modified: trunk/blender/source/blender/editors/include/ED_mesh.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_mesh.h 2013-03-16 16:10:27 UTC (rev 55337)
+++ trunk/blender/source/blender/editors/include/ED_mesh.h 2013-03-16 16:11:50 UTC (rev 55338)
@@ -193,6 +193,7 @@
void paintface_reveal(struct Object *ob);
void paintvert_deselect_all_visible(struct Object *ob, int action, short flush_flags);
+void paintvert_select_ungrouped(struct Object *ob, short extend, short flush_flags);
void paintvert_flush_flags(struct Object *ob);
/* mirrtopo */
Modified: trunk/blender/source/blender/editors/mesh/editface.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editface.c 2013-03-16 16:10:27 UTC (rev 55337)
+++ trunk/blender/source/blender/editors/mesh/editface.c 2013-03-16 16:11:50 UTC (rev 55338)
@@ -712,7 +712,38 @@
}
}
+void paintvert_select_ungrouped(Object *ob, short extend, short flush_flags)
+{
+ Mesh *me = BKE_mesh_from_object(ob);
+ MVert *mv;
+ MDeformVert *dv;
+ int a, tot;
+ if (me == NULL || me->dvert == NULL) {
+ return;
+ }
+
+ if (!extend) {
+ paintvert_deselect_all_visible(ob, SEL_DESELECT, FALSE);
+ }
+
+ dv = me->dvert;
+ tot = me->totvert;
+
+ for (a = 0, mv = me->mvert; a < tot; a++, mv++, dv++) {
+ if ((mv->flag & ME_HIDE) == 0) {
+ if (dv->dw == NULL) {
+ /* if null weight then not grouped */
+ mv->flag |= SELECT;
+ }
+ }
+ }
+
+ if (flush_flags) {
+ paintvert_flush_flags(ob);
+ }
+}
+
/* ********************* MESH VERTEX MIRR TOPO LOOKUP *************** */
/* note, this is not the best place for the function to be but moved
* here to for the purpose of syncing with bmesh */
Modified: trunk/blender/source/blender/editors/mesh/editmesh_select.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_select.c 2013-03-16 16:10:27 UTC (rev 55337)
+++ trunk/blender/source/blender/editors/mesh/editmesh_select.c 2013-03-16 16:11:50 UTC (rev 55338)
@@ -64,6 +64,7 @@
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
#include "mesh_intern.h"
@@ -2956,6 +2957,59 @@
RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend the selection");
}
+static int edbm_select_ungrouped_exec(bContext *C, wmOperator *op)
+{
+ Object *obedit = CTX_data_edit_object(C);
+ BMEditMesh *em = BMEdit_FromObject(obedit);
+ BMVert *eve;
+ BMIter iter;
+
+ if (!em->selectmode == SCE_SELECT_VERTEX) {
+ BKE_report(op->reports, RPT_ERROR, "Does not work out of vertex selection mode");
+ return OPERATOR_CANCELLED;
+ }
+
+ if (obedit->defbase.first == NULL) {
+ BKE_report(op->reports, RPT_ERROR, "No weights/vertex groups on object");
+ return OPERATOR_CANCELLED;
+ }
+
+ if (!RNA_boolean_get(op->ptr, "extend")) {
+ EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+ }
+
+ BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+ if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
+ MDeformVert *dv = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+ /* no dv or dv set with no weight */
+ if (dv == NULL || (dv && dv->dw == NULL)) {
+ BM_vert_select_set(em->bm, eve, true);
+ }
+ }
+ }
+
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+
+ return OPERATOR_FINISHED;
+}
+
+void MESH_OT_select_ungrouped(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Select Ungrouped";
+ ot->idname = "MESH_OT_select_ungrouped";
+ ot->description = "Select vertices without a group";
+
+ /* api callbacks */
+ ot->exec = edbm_select_ungrouped_exec;
+ ot->poll = ED_operator_editmesh;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend the selection");
+}
+
static int edbm_select_next_loop_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit = CTX_data_edit_object(C);
Modified: trunk/blender/source/blender/editors/mesh/mesh_intern.h
===================================================================
--- trunk/blender/source/blender/editors/mesh/mesh_intern.h 2013-03-16 16:10:27 UTC (rev 55337)
+++ trunk/blender/source/blender/editors/mesh/mesh_intern.h 2013-03-16 16:11:50 UTC (rev 55338)
@@ -128,6 +128,7 @@
void MESH_OT_select_similar(struct wmOperatorType *ot);
void MESH_OT_select_mode(struct wmOperatorType *ot);
void MESH_OT_select_random(struct wmOperatorType *ot);
+void MESH_OT_select_ungrouped(struct wmOperatorType *ot);
void MESH_OT_loop_multi_select(struct wmOperatorType *ot);
void MESH_OT_mark_seam(struct wmOperatorType *ot);
void MESH_OT_mark_sharp(struct wmOperatorType *ot);
Modified: trunk/blender/source/blender/editors/mesh/mesh_ops.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/mesh_ops.c 2013-03-16 16:10:27 UTC (rev 55337)
+++ trunk/blender/source/blender/editors/mesh/mesh_ops.c 2013-03-16 16:11:50 UTC (rev 55338)
@@ -59,6 +59,7 @@
WM_operatortype_append(MESH_OT_select_linked);
WM_operatortype_append(MESH_OT_select_linked_pick);
WM_operatortype_append(MESH_OT_select_random);
+ WM_operatortype_append(MESH_OT_select_ungrouped);
WM_operatortype_append(MESH_OT_hide);
WM_operatortype_append(MESH_OT_reveal);
WM_operatortype_append(MESH_OT_select_face_by_sides);
Modified: trunk/blender/source/blender/editors/object/object_intern.h
===================================================================
--- trunk/blender/source/blender/editors/object/object_intern.h 2013-03-16 16:10:27 UTC (rev 55337)
+++ trunk/blender/source/blender/editors/object/object_intern.h 2013-03-16 16:11:50 UTC (rev 55338)
@@ -138,6 +138,7 @@
/* object_lattice.c */
void LATTICE_OT_select_all(struct wmOperatorType *ot);
+void LATTICE_OT_select_ungrouped(struct wmOperatorType *ot);
void LATTICE_OT_make_regular(struct wmOperatorType *ot);
void LATTICE_OT_flip(struct wmOperatorType *ot);
Modified: trunk/blender/source/blender/editors/object/object_lattice.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_lattice.c 2013-03-16 16:10:27 UTC (rev 55337)
+++ trunk/blender/source/blender/editors/object/object_lattice.c 2013-03-16 16:11:50 UTC (rev 55338)
@@ -53,6 +53,7 @@
#include "BKE_key.h"
#include "BKE_lattice.h"
#include "BKE_deform.h"
+#include "BKE_report.h"
#include "ED_lattice.h"
#include "ED_object.h"
@@ -255,6 +256,58 @@
WM_operator_properties_select_all(ot);
}
+/************************** Select Ungrouped Verts Operator *************************/
+
+static int lattice_select_ungrouped_exec(bContext *C, wmOperator *op)
+{
+ Object *obedit = CTX_data_edit_object(C);
+ Lattice *lt = ((Lattice *)obedit->data)->editlatt->latt;
+ MDeformVert *dv;
+ BPoint *bp;
+ int a, tot;
+
+ if (obedit->defbase.first == NULL || lt->dvert == NULL) {
+ BKE_report(op->reports, RPT_ERROR, "No weights/vertex groups on object");
+ return OPERATOR_CANCELLED;
+ }
+
+ if (!RNA_boolean_get(op->ptr, "extend")) {
+ ED_setflagsLatt(obedit, 0);
+ }
+
+ dv = lt->dvert;
+ tot = lt->pntsu * lt->pntsv * lt->pntsw;
+
+ for (a = 0, bp = lt->def; a < tot; a++, bp++, dv++) {
+ if (bp->hide == 0) {
+ if (dv->dw == NULL) {
+ bp->f1 |= SELECT;
+ }
+ }
+ }
+
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+
+ return OPERATOR_FINISHED;
+}
+
+void LATTICE_OT_select_ungrouped(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Select Ungrouped";
+ ot->idname = "LATTICE_OT_select_ungrouped";
+ ot->description = "Select vertices without a group";
+
+ /* api callbacks */
+ ot->exec = lattice_select_ungrouped_exec;
+ ot->poll = ED_operator_editlattice;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend the selection");
+}
+
/************************** Make Regular Operator *************************/
static int make_regular_poll(bContext *C)
Modified: trunk/blender/source/blender/editors/object/object_ops.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_ops.c 2013-03-16 16:10:27 UTC (rev 55337)
+++ trunk/blender/source/blender/editors/object/object_ops.c 2013-03-16 16:11:50 UTC (rev 55338)
@@ -211,6 +211,7 @@
WM_operatortype_append(OBJECT_OT_shape_key_move);
WM_operatortype_append(LATTICE_OT_select_all);
+ WM_operatortype_append(LATTICE_OT_select_ungrouped);
WM_operatortype_append(LATTICE_OT_make_regular);
WM_operatortype_append(LATTICE_OT_flip);
Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h 2013-03-16 16:10:27 UTC (rev 55337)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h 2013-03-16 16:11:50 UTC (rev 55338)
@@ -192,6 +192,7 @@
void PAINT_OT_face_select_reveal(struct wmOperatorType *ot);
void PAINT_OT_vert_select_all(struct wmOperatorType *ot);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list