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:
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py38
-rw-r--r--source/blender/draw/intern/DRW_render.h2
-rw-r--r--source/blender/draw/intern/draw_manager.c7
-rw-r--r--source/blender/draw/modes/edit_mesh_mode.c4
-rw-r--r--source/blender/draw/modes/object_mode.c15
-rw-r--r--source/blender/editors/include/ED_view3d.h2
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c7
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c8
-rw-r--r--source/blender/editors/transform/transform_snap_object.c2
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_space.c6
11 files changed, 36 insertions, 57 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 095bac456d2..00b96912ceb 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -55,15 +55,6 @@ class VIEW3D_HT_header(Header):
row = layout.row()
row.prop(tool_settings.particle_edit, "select_mode", text="", expand=True)
- # Occlude geometry
- if (
- (((shading.type not in {'SOLID', 'TEXTURED'}) or not shading.show_xray) and
- (object_mode == 'PARTICLE_EDIT' or (object_mode == 'EDIT' and obj.type == 'MESH'))) or
- (object_mode in {'WEIGHT_PAINT', 'VERTEX_PAINT'})
- ):
- row = layout.row()
- row.prop(view, "use_occlude_geometry", text="")
-
# Pose
if obj and object_mode == 'POSE':
row = layout.row(align=True)
@@ -4053,7 +4044,9 @@ class VIEW3D_PT_shading_color(Panel):
layout.row().prop(shading, "background_color", text="")
def draw(self, context):
- self._draw_color_type(context)
+ shading = VIEW3D_PT_shading.get_shading(context)
+ if shading.type != 'WIREFRAME':
+ self._draw_color_type(context)
self._draw_background_color(context)
@@ -4063,11 +4056,6 @@ class VIEW3D_PT_shading_options(Panel):
bl_label = "Options"
bl_parent_id = 'VIEW3D_PT_shading'
- @classmethod
- def poll(cls, context):
- shading = VIEW3D_PT_shading.get_shading(context)
- return shading.type in {'WIREFRAME', 'SOLID'}
-
def draw(self, context):
layout = self.layout
@@ -4113,15 +4101,16 @@ class VIEW3D_PT_shading_options(Panel):
text=""
)
- row = layout.split()
- row.prop(shading, "show_object_outline")
- sub = row.row()
- sub.active = shading.show_object_outline
- sub.prop(shading, "object_outline_color", text="")
+ if shading.type in {'SOLID', 'WIREFRAME'}:
+ row = layout.split()
+ row.prop(shading, "show_object_outline")
+ sub = row.row()
+ sub.active = shading.show_object_outline
+ sub.prop(shading, "object_outline_color", text="")
- col = layout.column()
- if shading.light not in {'WIREFRAME', 'MATCAP'}:
- col.prop(shading, "show_specular_highlight")
+ col = layout.column()
+ if (shading.light is not 'MATCAP') and (shading.type is not 'WIREFRAME'):
+ col.prop(shading, "show_specular_highlight")
class VIEW3D_PT_shading_options_shadow(Panel):
@@ -4365,6 +4354,7 @@ class VIEW3D_PT_overlay_edit_mesh(Panel):
view = context.space_data
overlay = view.overlay
+ shading = view.shading
display_all = overlay.show_overlays
data = context.active_object.data
@@ -4378,7 +4368,7 @@ class VIEW3D_PT_overlay_edit_mesh(Panel):
sub = split.column()
sub.prop(data, "show_faces", text="Faces")
sub = split.column()
- sub.active = view.use_occlude_geometry
+ sub.active = shading.show_xray
sub.prop(data, "show_face_center", text="Center")
row = col.row(align=True)
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index 2e0de3b903b..aaad7a8c7a9 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -592,4 +592,6 @@ typedef struct DRWContextState {
const DRWContextState *DRW_context_state_get(void);
+#define XRAY_ENABLED(v3d) ((((v3d)->shading.flag & V3D_SHADING_XRAY) != 0) && ((v3d)->shading.xray_alpha < 1.0f))
+
#endif /* __DRW_RENDER_H__ */
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 73e2c4920b8..36c2497291f 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1160,7 +1160,7 @@ static void drw_engines_enable_external(void)
/* TODO revisit this when proper layering is implemented */
/* Gather all draw engines needed and store them in DST.enabled_engines
* That also define the rendering order of engines */
-static void drw_engines_enable_from_engine(RenderEngineType *engine_type, int drawtype, int shading_flags)
+static void drw_engines_enable_from_engine(RenderEngineType *engine_type, int drawtype, bool use_xray)
{
switch (drawtype) {
case OB_WIRE:
@@ -1168,7 +1168,7 @@ static void drw_engines_enable_from_engine(RenderEngineType *engine_type, int dr
break;
case OB_SOLID:
- if (shading_flags & V3D_SHADING_XRAY) {
+ if (use_xray) {
use_drw_engine(&draw_engine_workbench_transparent);
}
else {
@@ -1288,8 +1288,9 @@ static void drw_engines_enable(ViewLayer *view_layer, RenderEngineType *engine_t
const int mode = CTX_data_mode_enum_ex(DST.draw_ctx.object_edit, obact, DST.draw_ctx.object_mode);
View3D * v3d = DST.draw_ctx.v3d;
const int drawtype = v3d->shading.type;
+ const bool use_xray = XRAY_ENABLED(v3d);
- drw_engines_enable_from_engine(engine_type, drawtype, v3d->shading.flag);
+ drw_engines_enable_from_engine(engine_type, drawtype, use_xray);
if (DRW_state_draw_support()) {
/* Draw paint modes first so that they are drawn below the wireframes. */
diff --git a/source/blender/draw/modes/edit_mesh_mode.c b/source/blender/draw/modes/edit_mesh_mode.c
index 30049bd701a..4cf99ef3c1e 100644
--- a/source/blender/draw/modes/edit_mesh_mode.c
+++ b/source/blender/draw/modes/edit_mesh_mode.c
@@ -393,9 +393,7 @@ static void EDIT_MESH_cache_init(void *vedata)
stl->g_data->do_faces = true;
stl->g_data->do_edges = true;
- const bool xray_enabled = ((draw_ctx->v3d->shading.flag & V3D_SHADING_XRAY) != 0) &&
- (draw_ctx->v3d->shading.type < OB_MATERIAL);
- stl->g_data->do_zbufclip = ((v3d->flag & V3D_ZBUF_SELECT) == 0) || xray_enabled;
+ stl->g_data->do_zbufclip = ((v3d)->shading.flag & V3D_SHADING_XRAY) != 0;
/* Applies on top of the theme edge width, so edge-mode can have thick edges. */
stl->g_data->edge_width_scale = (tsettings->selectmode & (SCE_SELECT_EDGE)) ? 1.75f : 1.0f;
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c
index a9e0992016e..bea32cc1af1 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -279,6 +279,8 @@ typedef struct OBJECT_PrivateData {
int id_ofs_prb_active;
int id_ofs_prb_select;
int id_ofs_prb_transform;
+
+ bool xray_enabled;
} OBJECT_PrivateData; /* Transient data */
static struct {
@@ -934,8 +936,6 @@ static void OBJECT_cache_init(void *vedata)
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
OBJECT_PrivateData *g_data;
const DRWContextState *draw_ctx = DRW_context_state_get();
- const bool xray_enabled = ((draw_ctx->v3d->shading.flag & V3D_SHADING_XRAY) != 0) &&
- (draw_ctx->v3d->shading.type < OB_MATERIAL);
/* TODO : use dpi setting for enabling the second pass */
const bool do_outline_expand = false;
@@ -945,6 +945,7 @@ static void OBJECT_cache_init(void *vedata)
}
g_data = stl->g_data;
+ g_data->xray_enabled = XRAY_ENABLED(draw_ctx->v3d) && (draw_ctx->v3d->shading.type < OB_MATERIAL);
{
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_WIRE;
@@ -952,7 +953,7 @@ static void OBJECT_cache_init(void *vedata)
GPUShader *sh = e_data.outline_prepass_sh;
- if (xray_enabled) {
+ if (g_data->xray_enabled) {
sh = e_data.outline_prepass_wire_sh;
}
@@ -990,14 +991,14 @@ static void OBJECT_cache_init(void *vedata)
DRWState state = DRW_STATE_WRITE_COLOR;
struct GPUBatch *quad = DRW_cache_fullscreen_quad_get();
/* Don't occlude the "outline" detection pass if in xray mode (too much flickering). */
- float alphaOcclu = (xray_enabled) ? 1.0f : 0.35f;
+ float alphaOcclu = (g_data->xray_enabled) ? 1.0f : 0.35f;
/* Reminder : bool uniforms need to be 4 bytes. */
static const int bTrue = true;
static const int bFalse = false;
psl->outlines_search = DRW_pass_create("Outlines Detect Pass", state);
- GPUShader *sh = (xray_enabled) ? e_data.outline_detect_wire_sh : e_data.outline_detect_sh;
+ GPUShader *sh = (g_data->xray_enabled) ? e_data.outline_detect_wire_sh : e_data.outline_detect_sh;
DRWShadingGroup *grp = DRW_shgroup_create(sh, psl->outlines_search);
DRW_shgroup_uniform_texture_ref(grp, "outlineId", &e_data.outlines_id_tx);
DRW_shgroup_uniform_texture_ref(grp, "outlineDepth", &e_data.outlines_depth_tx);
@@ -2636,8 +2637,6 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
if (do_outlines) {
if (!BKE_object_is_in_editmode(ob) && !((ob == draw_ctx->obact) && (draw_ctx->object_mode & OB_MODE_ALL_PAINT))) {
struct GPUBatch *geom;
- const bool xray_enabled = ((v3d->shading.flag & V3D_SHADING_XRAY) != 0) &&
- (v3d->shading.type < OB_MATERIAL);
/* This fixes only the biggest case which is a plane in ortho view. */
int flat_axis = 0;
@@ -2645,7 +2644,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
DRW_object_is_flat(ob, &flat_axis) &&
DRW_object_axis_orthogonal_to_view(ob, flat_axis);
- if (xray_enabled || is_flat_object_viewed_from_side) {
+ if (stl->g_data->xray_enabled || is_flat_object_viewed_from_side) {
geom = DRW_cache_object_edge_detection_get(ob, NULL);
}
else {
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 30daaad3c2c..605c9bc3d97 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -536,7 +536,7 @@ void ED_view3d_stop_render_preview(struct wmWindowManager *wm, struct ARegion *a
void ED_view3d_shade_update(struct Main *bmain, struct View3D *v3d, struct ScrArea *sa);
#define V3D_IS_ZBUF(v3d) \
- (((v3d)->flag & V3D_ZBUF_SELECT) && ((v3d)->shading.type > OB_WIRE))
+ (((v3d)->shading.flag & V3D_SHADING_XRAY) == 0)
void ED_view3d_id_remap(struct View3D *v3d, const struct ID *old_id, struct ID *new_id);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 493d2138e2e..a8eea8c64f7 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -4879,12 +4879,7 @@ static int toggle_shading_exec(bContext *C, wmOperator *op)
if (type == OB_SOLID) {
if (v3d->shading.type == OB_SOLID) {
/* Toggle X-Ray if already in solid mode. */
- if (ED_operator_posemode(C) || ED_operator_editmesh(C)) {
- v3d->flag ^= V3D_ZBUF_SELECT;
- }
- else {
- v3d->shading.flag ^= V3D_SHADING_XRAY;
- }
+ v3d->shading.flag ^= V3D_SHADING_XRAY;
}
else {
/* Go to solid mode. */
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index d32176ab20a..61e26d4b1ef 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -875,7 +875,7 @@ static void do_lasso_select_meshobject__doSelectVert(void *userData, MVert *mv,
}
static void do_lasso_select_paintvert(ViewContext *vc, const int mcords[][2], short moves, const eSelectOp sel_op)
{
- const bool use_zbuf = (vc->v3d->flag & V3D_ZBUF_SELECT) != 0;
+ const bool use_zbuf = V3D_IS_ZBUF(vc->v3d);
Object *ob = vc->obact;
Mesh *me = ob->data;
rcti rect;
@@ -1896,7 +1896,7 @@ static void do_paintvert_box_select__doSelectVert(void *userData, MVert *mv, con
static int do_paintvert_box_select(
ViewContext *vc, rcti *rect, const eSelectOp sel_op)
{
- const bool use_zbuf = (vc->v3d->flag & V3D_ZBUF_SELECT) != 0;
+ const bool use_zbuf = V3D_IS_ZBUF(vc->v3d);
Mesh *me;
MVert *mvert;
struct ImBuf *ibuf;
@@ -2606,7 +2606,7 @@ static bool ed_wpaint_vertex_select_pick(
bool extend, bool deselect, bool toggle, Object *obact)
{
View3D *v3d = CTX_wm_view3d(C);
- const bool use_zbuf = (v3d->flag & V3D_ZBUF_SELECT) != 0;
+ const bool use_zbuf = V3D_IS_ZBUF(v3d);
Mesh *me = obact->data; /* already checked for NULL */
unsigned int index = 0;
@@ -2877,7 +2877,7 @@ static void paint_vertsel_circle_select_doSelectVert(void *userData, MVert *mv,
}
static void paint_vertsel_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
{
- const bool use_zbuf = (vc->v3d->flag & V3D_ZBUF_SELECT) != 0;
+ const bool use_zbuf = V3D_IS_ZBUF(vc->v3d);
Object *ob = vc->obact;
Mesh *me = ob->data;
bool bbsel;
diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c
index 777ff47b69c..647c3f86ff2 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -727,7 +727,7 @@ static bool raycastObj(
if (use_occlusion_test) {
if (use_obedit && sctx->use_v3d &&
- !(sctx->v3d_data.v3d->flag & V3D_ZBUF_SELECT))
+ !V3D_IS_ZBUF(sctx->v3d_data.v3d))
{
/* Use of occlude geometry in editing mode disabled. */
return false;
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index bf5a5cf846f..5574ab3a6a1 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -308,7 +308,7 @@ typedef struct View3D {
/* #define V3D_FLAG_DEPRECATED_10 (1 << 10) */ /* UNUSED */
#define V3D_SELECT_OUTLINE 2048
-#define V3D_ZBUF_SELECT 4096
+#define V3D_ZBUF_SELECT 4096 /* XXX: DNA deprecated */
#define V3D_GLOBAL_STATS 8192
#define V3D_DRAW_CENTERS 32768
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 8552d8ea731..f80145aec98 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -3051,12 +3051,6 @@ static void rna_def_space_view3d(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Lock Camera to View", "Enable view navigation within the camera view");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
- prop = RNA_def_property(srna, "use_occlude_geometry", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_ZBUF_SELECT);
- RNA_def_property_ui_text(prop, "Occlude Geometry", "Limit selection to visible (clipped with depth buffer)");
- RNA_def_property_ui_icon(prop, ICON_ORTHO, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
prop = RNA_def_property(srna, "show_gizmo", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "gizmo_flag", V3D_GIZMO_HIDE);
RNA_def_property_ui_text(prop, "Show Gizmo", "Show gizmos of all types");