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 <lichtwerk>2020-09-03 15:59:34 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2020-09-03 16:01:50 +0300
commitf00cb93dbec7bf5dc05302c868f20fcd5aed7db7 (patch)
tree2631292eb3265ad366165ea0fe567d31a1f1f1b5 /source/blender/editors/gpencil/gpencil_edit.c
parenta505a85873602a9e265bafb107d2ea356fc23a17 (diff)
Fix T63125: Gpencil: bones cannot be selected in weightpaint mode
Some underlying functionality was not ready for greasepencil: - BKE_modifiers_get_virtual_modifierlist (now introduce dedicated BKE_gpencil_modifiers_get_virtual_modifierlist) - BKE_modifiers_is_deformed_by_armature - checks in drawing code - checks in (pose) selection code A couple of changes to make this work: - `eGpencilModifierType_Armature` has to be respected (not only `eModifierType_Armature`) - `OB_MODE_WEIGHT_GPENCIL` has to be respected (not only `OB_MODE_WEIGHT_PAINT`) -- (now use new `OB_MODE_ALL_WEIGHT_PAINT`) - `gpencil_weightmode_toggle_exec` now shares functionality from `wpaint_mode_toggle_exec` -- moved to new `ED_object_posemode_set_for_weight_paint` This patch will also set the context member "weight_paint_object" for greasepencil (otherwise some appropriate pose operators wont work when in weightpaint mode) Reviewed By: campbellbarton Maniphest Tasks: T63125 Differential Revision: https://developer.blender.org/D8483
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_edit.c')
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 1bbba6c4b8a..37338ec4592 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -39,6 +39,7 @@
#include "BLT_translation.h"
+#include "DNA_gpencil_modifier_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
@@ -52,7 +53,9 @@
#include "BKE_global.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_geom.h"
+#include "BKE_layer.h"
#include "BKE_lib_id.h"
+#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_object.h"
@@ -75,6 +78,7 @@
#include "UI_view2d.h"
+#include "ED_armature.h"
#include "ED_gpencil.h"
#include "ED_object.h"
#include "ED_outliner.h"
@@ -571,6 +575,8 @@ static int gpencil_weightmode_toggle_exec(bContext *C, wmOperator *op)
gpd = ob->data;
is_object = true;
}
+ const int mode_flag = OB_MODE_WEIGHT_GPENCIL;
+ const bool is_mode_set = (ob->mode & mode_flag) != 0;
if (gpd == NULL) {
return OPERATOR_CANCELLED;
@@ -593,6 +599,9 @@ static int gpencil_weightmode_toggle_exec(bContext *C, wmOperator *op)
}
ob->restore_mode = ob->mode;
ob->mode = mode;
+
+ /* Prepare armature posemode. */
+ ED_object_posemode_set_for_weight_paint(C, bmain, ob, is_mode_set);
}
if (mode == OB_MODE_WEIGHT_GPENCIL) {