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:
authorAntonioya <blendergit@gmail.com>2019-04-16 12:27:36 +0300
committerAntonioya <blendergit@gmail.com>2019-04-16 14:10:04 +0300
commit5494926ee564dcde052e875debb90e27c60cd6aa (patch)
treec7fa42b881c7940b93219a22ff30b4c5ca21bf38 /source/blender/editors/gpencil/gpencil_data.c
parenta8852ade8aa65cc591d1fa20d732bb766aefe60a (diff)
GPencil: Add lock icon to Vertex Groups list
Also check this flag in operators. Note: This is required for the development of the new Normalize All operator.
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_data.c')
-rw-r--r--source/blender/editors/gpencil/gpencil_data.c43
1 files changed, 32 insertions, 11 deletions
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index 81da4ab8bc9..52c4354697e 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -1725,19 +1725,26 @@ void GPENCIL_OT_vertex_group_deselect(wmOperatorType *ot)
}
/* invert */
-static int gpencil_vertex_group_invert_exec(bContext *C, wmOperator *UNUSED(op))
+static int gpencil_vertex_group_invert_exec(bContext *C, wmOperator *op)
{
ToolSettings *ts = CTX_data_tool_settings(C);
Object *ob = CTX_data_active_object(C);
/* sanity checks */
- if (ELEM(NULL, ts, ob, ob->data))
+ if (ELEM(NULL, ts, ob, ob->data)) {
return OPERATOR_CANCELLED;
+ }
MDeformVert *dvert;
const int def_nr = ob->actdef - 1;
- if (!BLI_findlink(&ob->defbase, def_nr))
+ bDeformGroup *defgroup = BLI_findlink(&ob->defbase, def_nr);
+ if (defgroup == NULL) {
+ return OPERATOR_CANCELLED;
+ }
+ if (defgroup->flag & DG_LOCK_WEIGHT) {
+ BKE_report(op->reports, RPT_ERROR, "Current Vertex Group is locked");
return OPERATOR_CANCELLED;
+ }
CTX_DATA_BEGIN(C, bGPDstroke *, gps, editable_gpencil_strokes)
{
@@ -1790,15 +1797,22 @@ static int gpencil_vertex_group_smooth_exec(bContext *C, wmOperator *op)
Object *ob = CTX_data_active_object(C);
/* sanity checks */
- if (ELEM(NULL, ts, ob, ob->data))
+ if (ELEM(NULL, ts, ob, ob->data)) {
return OPERATOR_CANCELLED;
-
- bGPDspoint *pta, *ptb, *ptc;
- MDeformVert *dverta, *dvertb;
+ }
const int def_nr = ob->actdef - 1;
- if (!BLI_findlink(&ob->defbase, def_nr))
+ bDeformGroup *defgroup = BLI_findlink(&ob->defbase, def_nr);
+ if (defgroup == NULL) {
return OPERATOR_CANCELLED;
+ }
+ if (defgroup->flag & DG_LOCK_WEIGHT) {
+ BKE_report(op->reports, RPT_ERROR, "Current Vertex Group is locked");
+ return OPERATOR_CANCELLED;
+ }
+
+ bGPDspoint *pta, *ptb, *ptc;
+ MDeformVert *dverta, *dvertb;
CTX_DATA_BEGIN(C, bGPDstroke *, gps, editable_gpencil_strokes)
{
@@ -1874,19 +1888,26 @@ void GPENCIL_OT_vertex_group_smooth(wmOperatorType *ot)
}
/* normalize */
-static int gpencil_vertex_group_normalize_exec(bContext *C, wmOperator *UNUSED(op))
+static int gpencil_vertex_group_normalize_exec(bContext *C, wmOperator *op)
{
ToolSettings *ts = CTX_data_tool_settings(C);
Object *ob = CTX_data_active_object(C);
/* sanity checks */
- if (ELEM(NULL, ts, ob, ob->data))
+ if (ELEM(NULL, ts, ob, ob->data)) {
return OPERATOR_CANCELLED;
+ }
MDeformVert *dvert;
const int def_nr = ob->actdef - 1;
- if (!BLI_findlink(&ob->defbase, def_nr))
+ bDeformGroup *defgroup = BLI_findlink(&ob->defbase, def_nr);
+ if (defgroup == NULL) {
return OPERATOR_CANCELLED;
+ }
+ if (defgroup->flag & DG_LOCK_WEIGHT) {
+ BKE_report(op->reports, RPT_ERROR, "Current Vertex Group is locked");
+ return OPERATOR_CANCELLED;
+ }
CTX_DATA_BEGIN(C, bGPDstroke *, gps, editable_gpencil_strokes)
{