[Bf-blender-cvs] [646e90dee26] greasepencil-object: Move Vertex Opacity from Tolsettings to View3D
Antonio Vazquez
noreply at git.blender.org
Sun Jul 8 12:36:47 CEST 2018
Commit: 646e90dee26ccdb206802702ff52dad7f5a457b8
Author: Antonio Vazquez
Date: Sun Jul 8 12:36:39 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB646e90dee26ccdb206802702ff52dad7f5a457b8
Move Vertex Opacity from Tolsettings to View3D
The vertex opacity is a parameter of the view and not of toolsettings as it was defined before.
With this commit we moved the last parameter to control the view look to the right place.
===================================================================
M release/scripts/startup/bl_ui/space_view3d.py
M source/blender/blenloader/intern/versioning_270.c
M source/blender/blenloader/intern/versioning_280.c
M source/blender/blenloader/intern/versioning_defaults.c
M source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M source/blender/editors/gpencil/annotate_draw.c
M source/blender/editors/gpencil/drawgpencil.c
M source/blender/editors/gpencil/gpencil_edit.c
M source/blender/editors/space_view3d/space_view3d.c
M source/blender/makesdna/DNA_scene_types.h
M source/blender/makesdna/DNA_view3d_types.h
M source/blender/makesrna/intern/rna_sculpt_paint.c
M source/blender/makesrna/intern/rna_space.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 34e05f60459..f6ea5ff5257 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -4323,8 +4323,6 @@ class VIEW3D_PT_overlay_gpencil_options(Panel):
def draw(self, context):
layout = self.layout
view = context.space_data
- tool_settings = context.tool_settings
- gpd = context.gpencil_data
layout.prop(view, "use_gpencil_paper", text="Drawing Paper")
@@ -4341,7 +4339,7 @@ class VIEW3D_PT_overlay_gpencil_options(Panel):
if context.object.mode in {'GPENCIL_EDIT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT'}:
layout.prop(view, "use_gpencil_edit_lines", text="Show Edit Lines")
layout.prop(view, "use_gpencil_multiedit_line_only", text="Only Edit Lines In Multiframe")
- layout.prop(tool_settings.gpencil_sculpt, "selection_alpha", text="Vertex Opacity", slider=True)
+ layout.prop(view, "vertex_opacity", text="Vertex Opacity", slider=True)
class VIEW3D_PT_quad_view(Panel):
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index dc5546d8b7a..6e79a7baa36 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -1405,8 +1405,6 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
ToolSettings *ts = scene->toolsettings;
/* initialize use position for sculpt brushes */
ts->gp_sculpt.flag |= GP_BRUSHEDIT_FLAG_APPLY_POSITION;
- /* initialize selected vertices alpha factor */
- ts->gp_sculpt.alpha = 1.0f;
/* new strength sculpt brush */
if (ts->gp_sculpt.brush[0].size >= 11) {
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index a23ecd07c01..5050504afb1 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -896,7 +896,6 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* sculpt brushes */
GP_BrushEdit_Settings *gset = &scene->toolsettings->gp_sculpt;
if (gset) {
- gset->alpha = 1.0f;
gset->weighttype = GP_EDITBRUSH_TYPE_WEIGHT;
}
}
@@ -1670,5 +1669,20 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
+ /* initialize grease pencil view data */
+ if (!DNA_struct_elem_find(fd->filesdna, "SpaceView3D", "float", "vertex_opacity")) {
+ for (bScreen *sc = bmain->screen.first; sc; sc = sc->id.next) {
+ for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
+ for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_VIEW3D) {
+ View3D *v3d = (View3D *)sl;
+ v3d->vertex_opacity = 1.0f;
+ v3d->flag3 |= V3D_GP_SHOW_EDIT_LINES;
+ }
+ }
+ }
+ }
+ }
+
}
}
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index 003fc6fa679..c2b8d71db0b 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -175,8 +175,6 @@ void BLO_update_defaults_startup_blend(Main *bmain)
ARRAY_SET_ITEMS(curcolor_add, 1.0f, 0.6f, 0.6f);
ARRAY_SET_ITEMS(curcolor_sub, 0.6f, 0.6f, 1.0f);
- /* edit points alpha color */
- gset->alpha = 1.0f;
/* default sculpt brush */
gset->brushtype = GP_EDITBRUSH_TYPE_PUSH;
/* default weight paint brush */
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 5f0c5f6fb63..bba41a5a1af 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -634,7 +634,7 @@ static void gpencil_add_editpoints_shgroup(
MaterialGPencilStyle *gp_style = BKE_material_gpencil_settings_get(ob, gps->mat_nr + 1);
/* alpha factor for edit points/line to make them more subtle */
- float edit_alpha = ts->gp_sculpt.alpha;
+ float edit_alpha = v3d->vertex_opacity;
if (GPENCIL_ANY_EDIT_MODE(gpd)) {
Object *obact = DRW_context_state_get()->obact;
diff --git a/source/blender/editors/gpencil/annotate_draw.c b/source/blender/editors/gpencil/annotate_draw.c
index 9e69ab9f842..d4b2db99dd2 100644
--- a/source/blender/editors/gpencil/annotate_draw.c
+++ b/source/blender/editors/gpencil/annotate_draw.c
@@ -917,8 +917,6 @@ static void gp_draw_data_all(Scene *scene, bGPdata *gpd, int offsx, int offsy, i
gpd_source = (scene->clip->gpd ? scene->clip->gpd : NULL);
}
- alpha = ts->gp_sculpt.alpha;
-
if (gpd_source) {
gp_draw_data(gpd_source, offsx, offsy, winx, winy, cfra, dflag, alpha);
}
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 50e5d1ac08d..9d84a05435a 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -1670,7 +1670,7 @@ static void gp_draw_data_all(RegionView3D *rv3d, Scene *scene, bGPdata *gpd, int
if (gpd_source) {
if (brush != NULL) {
- gp_draw_data(rv3d, brush, ts->gp_sculpt.alpha, NULL, gpd_source,
+ gp_draw_data(rv3d, brush, 1.0f, NULL, gpd_source,
offsx, offsy, winx, winy, cfra, dflag);
}
}
@@ -1680,7 +1680,7 @@ static void gp_draw_data_all(RegionView3D *rv3d, Scene *scene, bGPdata *gpd, int
* if gpd_source == gpd, we don't have any object/track data and we can skip */
if (gpd_source == NULL || (gpd_source && gpd_source != gpd)) {
if (brush != NULL) {
- gp_draw_data(rv3d, brush, ts->gp_sculpt.alpha, NULL, gpd,
+ gp_draw_data(rv3d, brush, 1.0f, NULL, gpd,
offsx, offsy, winx, winy, cfra, dflag);
}
}
@@ -1808,7 +1808,7 @@ void ED_gpencil_draw_view3d_object(wmWindowManager *wm, Scene *scene, Depsgraph
ToolSettings *ts = scene->toolsettings;
Brush *brush = BKE_brush_getactive_gpencil(ts);
if (brush != NULL) {
- gp_draw_data(rv3d, brush, ts->gp_sculpt.alpha, ob, gpd,
+ gp_draw_data(rv3d, brush, 1.0f, ob, gpd,
offsx, offsy, winx, winy, CFRA, dflag);
}
}
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 7035d8d7d81..9e412936050 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -453,17 +453,16 @@ static bool gp_strokes_edit3d_poll(bContext *C)
static int gpencil_hideselect_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
- ToolSettings *ts = CTX_data_tool_settings(C);
-
- if (ts == NULL)
+ View3D *v3d = CTX_wm_view3d(C);
+ if (v3d == NULL)
return OPERATOR_CANCELLED;
/* Just toggle alpha... */
- if (ts->gp_sculpt.alpha > 0.0f) {
- ts->gp_sculpt.alpha = 0.0f;
+ if (v3d->vertex_opacity > 0.0f) {
+ v3d->vertex_opacity = 0.0f;
}
else {
- ts->gp_sculpt.alpha = 1.0f;
+ v3d->vertex_opacity = 1.0f;
}
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA, NULL);
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 4e9970c4617..91ae7ba3d6b 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -364,6 +364,10 @@ static SpaceLink *view3d_new(const ScrArea *UNUSED(sa), const Scene *scene)
v3d->stereo3d_convergence_alpha = 0.15f;
v3d->stereo3d_volume_alpha = 0.05f;
+ /* grease pencil settings */
+ v3d->vertex_opacity = 1.0f;
+ v3d->flag3 |= V3D_GP_SHOW_EDIT_LINES;
+
/* header */
ar = MEM_callocN(sizeof(ARegion), "header for view3d");
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 569e04fd0bb..7aac4786fc0 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -996,7 +996,7 @@ typedef struct GP_BrushEdit_Settings {
int brushtype; /* eGP_EditBrush_Types (sculpt) */
int flag; /* eGP_BrushEdit_SettingsFlag */
int lock_axis; /* eGP_Lockaxis_Types lock drawing to one axis */
- float alpha; /* alpha factor for selection color */
+ char pad1[4];
/* weight paint is a submode of sculpt but use its own index. All weight paint
* brushes must be defined at the end of the brush array.
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index 18fb31f1019..25c06cd2b21 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -247,7 +247,8 @@ typedef struct View3D {
char multiview_eye; /* multiview current eye - for internal use */
- char pad3[4];
+ /* actually only used to define the opacity of the grease pencil vertex in edit mode */
+ float vertex_opacity;
/* note, 'fx_settings.dof' is currently _not_ allocated,
* instead set (temporarily) from camera */
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index f28f9ec181f..12d91ecc6ec 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -1149,13 +1149,6 @@ static void rna_def_gpencil_sculpt(BlenderRNA *brna)
RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
- prop = RNA_def_property(srna, "selection_alpha", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "alpha");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Alpha", "Alpha value for selected vertices");
- RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_GPencil_update");
-
prop = RNA_def_property(srna, "use_multiframe_falloff", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSHEDIT_FLAG_FRAME_FALLOFF);
RNA_def_p
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list