[Bf-blender-cvs] [3cdf852425c] greasepencil-edit-curve: GPencil: Fix Selection mode buttons in Beziser submode
Antonio Vazquez
noreply at git.blender.org
Sat Jun 6 11:53:08 CEST 2020
Commit: 3cdf852425c087cb63bdc2a3f3453f667745c8c9
Author: Antonio Vazquez
Date: Sat Jun 6 11:53:00 2020 +0200
Branches: greasepencil-edit-curve
https://developer.blender.org/rB3cdf852425c087cb63bdc2a3f3453f667745c8c9
GPencil: Fix Selection mode buttons in Beziser submode
Also changed the BEZIER flag bit becaus ethe previous was already used.
===================================================================
M release/scripts/startup/bl_ui/space_view3d.py
M source/blender/makesdna/DNA_gpencil_types.h
M source/blender/makesrna/intern/rna_gpencil.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index e351c678789..9e66cc72bf8 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -720,7 +720,17 @@ class VIEW3D_HT_header(Header):
# Select mode for Editing
if gpd.use_stroke_edit_mode:
row = layout.row(align=True)
- row.prop(tool_settings, "gpencil_selectmode_edit", text="", expand=True)
+ row.prop_enum(tool_settings, "gpencil_selectmode_edit", text="", value='POINT')
+ row.prop_enum(tool_settings, "gpencil_selectmode_edit", text="", value='STROKE')
+
+ subrow = row.row(align=True)
+ subrow.enabled = not gpd.use_curve_edit
+ subrow.prop_enum(tool_settings, "gpencil_selectmode_edit", text="", value='SEGMENT')
+
+ # Curve edit submode
+ row = layout.row(align=True)
+ row.prop(gpd, "use_curve_edit", text="",
+ icon='IPO_BEZIER')
# Select mode for Sculpt
if gpd.is_stroke_sculpt_mode:
@@ -736,12 +746,6 @@ class VIEW3D_HT_header(Header):
row.prop(tool_settings, "use_gpencil_vertex_select_mask_stroke", text="")
row.prop(tool_settings, "use_gpencil_vertex_select_mask_segment", text="")
- # Curve edit mode
- if gpd.use_stroke_edit_mode:
- row = layout.row(align=True)
- row.prop(gpd, "use_curve_edit", text="",
- icon='IPO_BEZIER')
-
if (
gpd.use_stroke_edit_mode or
gpd.is_stroke_sculpt_mode or
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 34d280cd849..209ac9976a2 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -699,14 +699,14 @@ typedef enum eGPdata_Flag {
/* Allow edit several frames at the same time */
GP_DATA_STROKE_MULTIEDIT = (1 << 16),
- /* Enable Bezier Editing Curve (a submode of Edit mode). */
- GP_DATA_CURVE_EDIT_MODE = (1 << 17),
-
/* Vertex Paint Mode - Toggle paint mode */
GP_DATA_STROKE_VERTEXMODE = (1 << 18),
/* Autolock not active layers */
GP_DATA_AUTOLOCK_LAYERS = (1 << 20),
+
+ /* Enable Bezier Editing Curve (a submode of Edit mode). */
+ GP_DATA_CURVE_EDIT_MODE = (1 << 21),
} eGPdata_Flag;
/* gpd->onion_flag */
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index 4f5c0c22f15..66ac64725b0 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -150,6 +150,22 @@ static void rna_GPencil_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Pointe
WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
}
+static void rna_GPencil_curve_edit_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ ToolSettings *ts = scene->toolsettings;
+ bGPdata *gpd = (bGPdata *)ptr->owner_id;
+
+ /* If the current select mode is segment and the Bezier mode is on, change
+ * to Point because segment is not supported. */
+ if ((GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd)) &&
+ (ts->gpencil_selectmode_edit == GP_SELECTMODE_SEGMENT)) {
+ ts->gpencil_selectmode_edit = GP_SELECTMODE_POINT;
+ }
+
+ /* Standard update. */
+ rna_GPencil_update(bmain, scene, ptr);
+}
+
static void rna_GPencil_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
DEG_id_tag_update(ptr->owner_id, ID_RECALC_TRANSFORM);
@@ -2111,7 +2127,7 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_curve_edit", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_CURVE_EDIT_MODE);
RNA_def_property_ui_text(prop, "Curve Edit", "Edit strokes using curve handles");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_curve_edit_update");
prop = RNA_def_property(srna, "use_autolock_layers", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_AUTOLOCK_LAYERS);
More information about the Bf-blender-cvs
mailing list