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
path: root/source
diff options
context:
space:
mode:
authorAntonio Vazquez <blendergit@gmail.com>2021-08-26 22:57:59 +0300
committerAntonio Vazquez <blendergit@gmail.com>2021-08-26 23:00:24 +0300
commit2b64b4d90d677dd0055f966814df76486ebbd7dc (patch)
treea68e3d71b74ca3aad4ab03ab271396f8176c2b23 /source
parente5ed9991eaf0734e4b2ea9c3580a578af1827e50 (diff)
Fix T90973: GPencil - Add buttons to move up and down vertex groups
These buttons were in Meshes but not for Grease Pencil. This patch add them in order to keep consistency. Reviewed By: HooglyBoogly Maniphest Tasks: T90973 Differential Revision: https://developer.blender.org/D12328
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/object/object_vgroup.c40
1 files changed, 32 insertions, 8 deletions
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 7a42c9d5d8b..f0ab082cd9c 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -28,6 +28,7 @@
#include "MEM_guardedalloc.h"
#include "DNA_curve_types.h"
+#include "DNA_gpencil_types.h"
#include "DNA_lattice_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
@@ -39,6 +40,7 @@
#include "BLI_alloca.h"
#include "BLI_array.h"
#include "BLI_blenlib.h"
+#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_utildefines_stack.h"
@@ -4083,16 +4085,38 @@ static int vgroup_do_remap(Object *ob, const char *name_array, wmOperator *op)
}
else {
int dvert_tot = 0;
+ /* Grease pencil stores vertex groups separately for each stroke,
+ * so remap each stroke's weights separately. */
+ if (ob->type == OB_GPENCIL) {
+ bGPdata *gpd = ob->data;
+ LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
+ LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
+ LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
+ dvert = gps->dvert;
+ dvert_tot = gps->totpoints;
+ if (dvert) {
+ while (dvert_tot--) {
+ if (dvert->totweight) {
+ BKE_defvert_remap(dvert, sort_map, defbase_tot);
+ }
+ dvert++;
+ }
+ }
+ }
+ }
+ }
+ }
+ else {
+ BKE_object_defgroup_array_get(ob->data, &dvert, &dvert_tot);
- BKE_object_defgroup_array_get(ob->data, &dvert, &dvert_tot);
-
- /* Create as necessary. */
- if (dvert) {
- while (dvert_tot--) {
- if (dvert->totweight) {
- BKE_defvert_remap(dvert, sort_map, defbase_tot);
+ /* Create as necessary. */
+ if (dvert) {
+ while (dvert_tot--) {
+ if (dvert->totweight) {
+ BKE_defvert_remap(dvert, sort_map, defbase_tot);
+ }
+ dvert++;
}
- dvert++;
}
}
}