GP: Reorganize origin popover and top area
- Draw on back buttons moves near mode - zDepth offset moved from View Panel to Popover - Target for Stroke mode moved to popover - New First point snap mode
This commit is contained in:
parent
e6da49295c
commit
1237e50c9b
|
@ -357,7 +357,6 @@ class DATA_PT_gpencil_display(DataButtonsPanel, Panel):
|
|||
|
||||
layout.prop(gpd, "use_force_fill_recalc", text="Force Fill Update")
|
||||
layout.prop(gpd, "use_adaptative_uv", text="Adaptative UVs")
|
||||
layout.prop(gpd, "zdepth_offset", text="Surface Offset")
|
||||
|
||||
|
||||
class DATA_PT_gpencil_canvas(DataButtonsPanel, Panel):
|
||||
|
|
|
@ -210,13 +210,6 @@ class TOPBAR_HT_lower_bar(Header):
|
|||
panel="TOPBAR_PT_gpencil_layers",
|
||||
text=text,
|
||||
)
|
||||
if tool_mode == 'GPENCIL_PAINT':
|
||||
tool_settings = context.tool_settings
|
||||
layout.prop(tool_settings, "use_gpencil_draw_onback", text="", icon='MOD_OPACITY')
|
||||
layout.prop(tool_settings, "use_gpencil_weight_data_add", text="", icon='WPAINT_HLT')
|
||||
layout.prop(tool_settings, "use_gpencil_additive_drawing", text="", icon='FREEZE')
|
||||
if tool_settings.gpencil_stroke_placement_view3d == 'STROKE':
|
||||
layout.prop(tool_settings, "use_gpencil_stroke_endpoints", text="", icon='CURVE_DATA')
|
||||
elif tool_space_type == 'IMAGE_EDITOR':
|
||||
if tool_mode == 'PAINT':
|
||||
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".imagepaint_2d", category="")
|
||||
|
|
|
@ -65,7 +65,12 @@ class VIEW3D_HT_header(Header):
|
|||
gpd = context.gpencil_data
|
||||
|
||||
if gpd.is_stroke_paint_mode:
|
||||
row = layout.row(align=True)
|
||||
row = layout.row()
|
||||
sub = row.row(align=True)
|
||||
sub.prop(tool_settings, "use_gpencil_draw_onback", text="", icon='MOD_OPACITY')
|
||||
sub.prop(tool_settings, "use_gpencil_weight_data_add", text="", icon='WPAINT_HLT')
|
||||
sub.prop(tool_settings, "use_gpencil_additive_drawing", text="", icon='FREEZE')
|
||||
|
||||
row.popover(
|
||||
panel="VIEW3D_PT_tools_grease_pencil_shapes",
|
||||
text="Shapes"
|
||||
|
@ -4888,11 +4893,26 @@ class VIEW3D_PT_gpencil_origin(Panel):
|
|||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
ts = context.tool_settings
|
||||
gpd = context.gpencil_data
|
||||
|
||||
layout.label(text="Stroke Placement")
|
||||
|
||||
row = layout.row()
|
||||
col = row.column()
|
||||
col.prop(context.tool_settings, "gpencil_stroke_placement_view3d", expand=True)
|
||||
col.prop(ts, "gpencil_stroke_placement_view3d", expand=True)
|
||||
|
||||
if ts.gpencil_stroke_placement_view3d == 'SURFACE':
|
||||
row = layout.row()
|
||||
row.label(text="Offset")
|
||||
row = layout.row()
|
||||
row.prop(gpd, "zdepth_offset", text="")
|
||||
|
||||
if ts.gpencil_stroke_placement_view3d == 'STROKE':
|
||||
row = layout.row()
|
||||
row.label(text="Target")
|
||||
row = layout.row()
|
||||
row.prop(ts, "gpencil_stroke_snap_mode", expand=True)
|
||||
|
||||
|
||||
class VIEW3D_PT_gpencil_lock(Panel):
|
||||
|
|
|
@ -1040,7 +1040,9 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
|
|||
depth_arr[i] = 0.9999f;
|
||||
}
|
||||
else {
|
||||
if (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE_ENDPOINTS) {
|
||||
if ((ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE_ENDPOINTS) ||
|
||||
(ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE_FIRST))
|
||||
{
|
||||
int first_valid = 0;
|
||||
int last_valid = 0;
|
||||
|
||||
|
@ -1052,12 +1054,16 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
|
|||
first_valid = i;
|
||||
|
||||
/* find last valid contact point */
|
||||
for (i = gpd->runtime.sbuffer_size - 1; i >= 0; i--) {
|
||||
if (depth_arr[i] != FLT_MAX)
|
||||
break;
|
||||
if (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE_FIRST) {
|
||||
last_valid = first_valid;
|
||||
}
|
||||
else {
|
||||
for (i = gpd->runtime.sbuffer_size - 1; i >= 0; i--) {
|
||||
if (depth_arr[i] != FLT_MAX)
|
||||
break;
|
||||
}
|
||||
last_valid = i;
|
||||
}
|
||||
last_valid = i;
|
||||
|
||||
/* invalidate any point other point, to interpolate between
|
||||
* first and last contact in an imaginary line between them */
|
||||
for (i = 0; i < gpd->runtime.sbuffer_size; i++) {
|
||||
|
|
|
@ -2122,6 +2122,7 @@ typedef enum eGPencil_Placement_Flags {
|
|||
/* "Use Endpoints" */
|
||||
GP_PROJECT_DEPTH_STROKE_ENDPOINTS = (1 << 4),
|
||||
GP_PROJECT_CURSOR = (1 << 5),
|
||||
GP_PROJECT_DEPTH_STROKE_FIRST = (1 << 6),
|
||||
} eGPencil_Placement_Flags;
|
||||
|
||||
/* ToolSettings.gpencil_selectmode */
|
||||
|
|
|
@ -2229,6 +2229,13 @@ static void rna_def_tool_settings(BlenderRNA *brna)
|
|||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
static const EnumPropertyItem gpencil_stroke_snap_items[] = {
|
||||
{0, "NONE", 0, "All points", "No snap"},
|
||||
{GP_PROJECT_DEPTH_STROKE_ENDPOINTS, "ENDS", 0, "End points", "Snap to first and last points and interpolate" },
|
||||
{GP_PROJECT_DEPTH_STROKE_FIRST, "FIRST", 0, "First point", "Snap to first point" },
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
static const EnumPropertyItem gpencil_selectmode_items[] = {
|
||||
{GP_SELECTMODE_POINT, "POINT", ICON_GP_SELECT_POINTS, "Point", "Select only points"},
|
||||
{GP_SELECTMODE_STROKE, "STROKE", ICON_GP_SELECT_STROKES, "Stroke", "Select all stroke points" },
|
||||
|
@ -2522,6 +2529,12 @@ static void rna_def_tool_settings(BlenderRNA *brna)
|
|||
RNA_def_property_ui_text(prop, "Stroke Placement (3D View)", "");
|
||||
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "gpencil_stroke_snap_mode", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_v3d_align");
|
||||
RNA_def_property_enum_items(prop, gpencil_stroke_snap_items);
|
||||
RNA_def_property_ui_text(prop, "Stroke Snap", "");
|
||||
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "use_gpencil_stroke_endpoints", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "gpencil_v3d_align", GP_PROJECT_DEPTH_STROKE_ENDPOINTS);
|
||||
RNA_def_property_ui_text(prop, "Only Endpoints", "Only use the first and last parts of the stroke for snapping");
|
||||
|
|
Loading…
Reference in New Issue