Page MenuHome

vgroupui14.txt

vgroupui14.txt

Index: source/blender/makesdna/DNA_view3d_types.h
===================================================================
--- source/blender/makesdna/DNA_view3d_types.h (revision 11461)
+++ source/blender/makesdna/DNA_view3d_types.h (working copy)
@@ -166,8 +166,9 @@
/* View3d->flag2 (short) */
#define V3D_OPP_DIRECTION_NAME 1
-#define V3D_FLYMODE 2
-#define V3D_TRANSFORM_SNAP 4
+#define V3D_FLYMODE 2
+#define V3D_TRANSFORM_SNAP 4
+#define V3D_VGROUP_EDIT 8
/* View3d->snap_target */
#define V3D_SNAP_TARGET_CLOSEST 0
Index: source/blender/include/blendef.h
===================================================================
--- source/blender/include/blendef.h (revision 11461)
+++ source/blender/include/blendef.h (working copy)
@@ -229,6 +229,7 @@
#define B_MAN_TRANS 161
#define B_MAN_ROT 162
#define B_MAN_SCALE 163
+#define B_VGROUP 164
/* IPO: 200 */
#define B_IPOHOME 201
Index: source/blender/src/space.c
===================================================================
--- source/blender/src/space.c (revision 11461)
+++ source/blender/src/space.c (working copy)
@@ -333,6 +333,12 @@
vd->flag |= V3D_ALIGN;
else
vd->flag &= ~V3D_ALIGN;
+
+ if (G.vd->flag2 & V3D_VGROUP_EDIT)
+ vd->flag2 |= V3D_VGROUP_EDIT;
+ else
+ vd->flag2 &= ~V3D_VGROUP_EDIT;
+
scrarea_queue_headredraw(sa);
}
}
Index: source/blender/src/header_view3d.c
===================================================================
--- source/blender/src/header_view3d.c (revision 11461)
+++ source/blender/src/header_view3d.c (working copy)
@@ -63,6 +63,7 @@
#include "BKE_action.h"
#include "BKE_curve.h"
+#include "BKE_deform.h"
#include "BKE_depsgraph.h"
#include "BKE_displist.h"
#include "BKE_effect.h"
@@ -80,6 +81,7 @@
#include "BLI_arithb.h"
#include "BLI_blenlib.h"
+#include "BLI_dynstr.h"
#include "BLI_editVert.h"
#include "BSE_edit.h"
@@ -4919,7 +4921,20 @@
G.vd->twtype= V3D_MANIP_SCALE;
allqueue(REDRAWVIEW3D, 1);
break;
-
+ case B_VGROUP:
+ if(ob->actdef == 32767) {
+ add_defgroup(ob);
+ assign_verts_defgroup();
+ }
+ else {
+ EM_clear_flag_all(SELECT);
+ sel_verts_defgroup(1);
+ }
+
+ allqueue(REDRAWVIEW3D, 1);
+ allqueue(REDRAWOOPS, 0);
+ countall();
+ break;
default:
if(event>=B_LAY && event<B_LAY+31) {
@@ -5090,9 +5105,36 @@
*xcoord= xco;
}
+static void update_selection_cb(void *poin, void *poin2)
+{
+ sel_verts_defgroup(1);
+ handle_view3d_around(); /* copies to other 3d windows */
+
+ allqueue(REDRAWVIEW3D, 1);
+ allqueue(REDRAWOOPS, 0);
+ countall();
+}
+
+static void verify_vertexgroup_name_func(void *datav, void *data2_unused)
+{
+ unique_vertexgroup_name((bDeformGroup*)datav, OBACT);
+}
+
+static void delete_current_vgroup_cb(void *poin, void *poin2)
+{
+ Object *ob = (Object *)poin;
+
+ del_defgroup(ob);
+
+ allqueue(REDRAWVIEW3D, 1);
+ allqueue(REDRAWOOPS, 0);
+ BIF_undo_push("Delete vertex group");
+}
+
void view3d_buttons(void)
{
uiBlock *block;
+ uiBut *bt;
Object *ob= OBACT;
int a;
short xco = 0;
@@ -5280,6 +5322,58 @@
xco+= 10;
}
+ /* Vertex groups */
+ if(G.obedit && (G.obedit->type == OB_MESH || ob->type==OB_LATTICE)) {
+ uiBlockBeginAlign(block);
+
+ bt= uiDefIconButBitS(block, TOG, V3D_VGROUP_EDIT, B_REDR, ICON_VERTEXSEL,xco,0,XIC,YIC, &G.vd->flag2, 0, 0, 0, 0, "Edit Vertex Groups"); /* TODO: icon */
+ uiButSetFunc(bt, update_selection_cb, NULL, NULL);
+ xco+= XIC;
+
+ if(G.vd->flag2 & V3D_VGROUP_EDIT) {
+ DynStr *dstr= BLI_dynstr_new();
+ bDeformGroup *defGroup;
+ static float editbutvweight= 1;
+ int defCount;
+ char *str;
+ char *vgroupmenustr= get_vertexgroup_menustr(ob);
+
+ BLI_dynstr_append(dstr, "Vertex Group%t|ADD NEW %x32767");
+ if(strcmp(vgroupmenustr, "No Vertex Groups in Object") != 0) {
+ BLI_dynstr_append(dstr, "|");
+ BLI_dynstr_append(dstr, vgroupmenustr);
+ }
+ str= BLI_dynstr_get_cstring(dstr);
+
+ defCount= BLI_countlist(&ob->defbase);
+
+ uiDefButS(block, MENU, B_VGROUP, str,xco,0,XIC,YIC, (short *)&ob->actdef, 1, defCount, 0, 0, "Browses available vertex groups");
+ xco+= XIC;
+
+ if(ob->actdef) {
+ defGroup = BLI_findlink(&ob->defbase, ob->actdef-1);
+ bt= uiDefBut(block, TEX, REDRAWBUTSEDIT,"",xco,0,100,YIC, defGroup->name, 0, 31, 0, 0, "Displays current vertex group name. Click to change. (Match bone name for deformation.)");
+ uiButSetFunc(bt, verify_vertexgroup_name_func, defGroup, NULL);
+ uiButSetCompleteFunc(bt, autocomplete_vgroup, (void *)ob);
+ xco+= 100;
+
+ uiDefButF(block, NUM, REDRAWVIEW3D, "", xco,0,3*XIC,YIC, &editbutvweight, 0, 1, 10, 0, "Sets the current vertex group's bone deformation strength");
+ xco+= 3*XIC;
+ }
+
+ bt= uiDefIconBut(block, BUT, B_NOP, ICON_X,xco,0,XIC,YIC, 0, 0, 0, 0, 0, "Delete vertex group");
+ uiButSetFunc(bt, delete_current_vgroup_cb, ob, NULL);
+ xco+= XIC;
+
+ BLI_dynstr_free(dstr);
+ MEM_freeN(str);
+ MEM_freeN(vgroupmenustr);
+ }
+
+ uiBlockEndAlign(block);
+ xco+= 10;
+ }
+
/* selection modus */
if(G.obedit && (G.obedit->type == OB_MESH)) {
uiBlockBeginAlign(block);
Index: source/blender/src/editdeform.c
===================================================================
--- source/blender/src/editdeform.c (revision 11461)
+++ source/blender/src/editdeform.c (working copy)
@@ -611,7 +611,7 @@
dg=BLI_findlink(&ob->defbase, ob->actdef-1);
if (!dg){
- error ("No vertex group is active");
+ //error ("No vertex group is active");
return;
}
@@ -724,7 +724,7 @@
dg=BLI_findlink(&ob->defbase, ob->actdef-1);
if (!dg){
- error ("No vertex group is active");
+ //error ("No vertex group is active");
return;
}
Index: source/blender/src/editmesh_mods.c
===================================================================
--- source/blender/src/editmesh_mods.c (revision 11461)
+++ source/blender/src/editmesh_mods.c (working copy)
@@ -73,6 +73,7 @@
#include "BKE_verse.h"
#endif
+#include "BIF_editdeform.h"
#include "BIF_editmesh.h"
#include "BIF_resources.h"
#include "BIF_gl.h"
@@ -1668,6 +1669,12 @@
EM_selectmode_flush();
countall();
+ /* update active vertex group */
+ if(G.vd->flag2 & V3D_VGROUP_EDIT) {
+ remove_verts_defgroup(1);
+ assign_verts_defgroup();
+ }
+
allqueue(REDRAWVIEW3D, 0);
}

File Metadata

Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ad/f6/bc01b63487412a9796576cefcc52

Event Timeline