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:
authorPhilipp Oeser <info@graphics-engineer.com>2021-10-18 17:34:16 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2021-10-18 20:11:19 +0300
commit3a2550114344d328d026f6f04b0fbfd7f7ef95c6 (patch)
tree3a39fd1ff0cc0af306163d724d3f989920eba9e9 /source/blender/editors/gpencil
parenta9cb33081506f14ffb693e3b82742a940b6c80b2 (diff)
Fix T92314: Auto naming of the Vertex Group doesn't work for Grease
Pencil Not naming the auto-generated vertexgroup after the selected bone was just confusing (since the group would not have an effect), so now use similar code that is used for meshes for greasepencil as well. Maniphest Tasks: T92314 Differential Revision: https://developer.blender.org/D12906
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r--source/blender/editors/gpencil/gpencil_weight_paint.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/source/blender/editors/gpencil/gpencil_weight_paint.c b/source/blender/editors/gpencil/gpencil_weight_paint.c
index d14322e12b5..b3249294119 100644
--- a/source/blender/editors/gpencil/gpencil_weight_paint.c
+++ b/source/blender/editors/gpencil/gpencil_weight_paint.c
@@ -29,15 +29,18 @@
#include "BLT_translation.h"
+#include "DNA_armature_types.h"
#include "DNA_brush_types.h"
#include "DNA_gpencil_types.h"
+#include "BKE_action.h"
#include "BKE_brush.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_gpencil.h"
#include "BKE_main.h"
+#include "BKE_modifier.h"
#include "BKE_object_deform.h"
#include "BKE_report.h"
#include "DNA_meshdata_types.h"
@@ -246,7 +249,22 @@ static bool brush_draw_apply(tGP_BrushWeightpaintData *gso,
/* need a vertex group */
if (gso->vrgroup == -1) {
if (gso->object) {
- BKE_object_defgroup_add(gso->object);
+ Object *ob_armature = BKE_modifiers_is_deformed_by_armature(gso->object);
+ if ((ob_armature != NULL)) {
+ Bone *actbone = ((bArmature *)ob_armature->data)->act_bone;
+ if (actbone != NULL) {
+ bPoseChannel *pchan = BKE_pose_channel_find_name(ob_armature->pose, actbone->name);
+ if (pchan != NULL) {
+ bDeformGroup *dg = BKE_object_defgroup_find_name(gso->object, pchan->name);
+ if (dg == NULL) {
+ dg = BKE_object_defgroup_add_name(gso->object, pchan->name);
+ }
+ }
+ }
+ }
+ else {
+ BKE_object_defgroup_add(gso->object);
+ }
DEG_relations_tag_update(gso->bmain);
gso->vrgroup = 0;
}