Cleanup: CodeQuality: Replace OB_DRAWXRAY by OB_DRAW_IN_FRONT

This is to match the option name and to avoid confusion with
workbench xray mode.
This commit is contained in:
Clément Foucault 2020-07-21 12:53:30 +02:00
parent 3fe5c0e5df
commit 727e569ac3
17 changed files with 23 additions and 22 deletions

View File

@ -1339,7 +1339,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
arm = blo_do_versions_newlibadr(fd, lib, ob->data);
enum { ARM_DRAWXRAY = (1 << 1) };
if (arm->flag & ARM_DRAWXRAY) {
ob->dtx |= OB_DRAWXRAY;
ob->dtx |= OB_DRAW_IN_FRONT;
}
}
else if (ob->type == OB_MESH) {

View File

@ -165,7 +165,7 @@ static void basic_cache_populate(void *vedata, Object *ob)
return;
}
bool do_in_front = (ob->dtx & OB_DRAWXRAY) != 0;
bool do_in_front = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
const DRWContextState *draw_ctx = DRW_context_state_get();
if (ob != draw_ctx->object_edit) {

View File

@ -106,7 +106,7 @@ GPENCIL_tObject *gpencil_object_cache_add(GPENCIL_PrivateData *pd, Object *ob)
copy_v3_v3(tgp_ob->plane_mat[3], center);
/* Add to corresponding list if is in front. */
if (ob->dtx & OB_DRAWXRAY) {
if (ob->dtx & OB_DRAW_IN_FRONT) {
BLI_LINKS_APPEND(&pd->tobjects_infront, tgp_ob);
}
else {
@ -258,7 +258,7 @@ GPENCIL_tLayer *gpencil_layer_cache_add(GPENCIL_PrivateData *pd,
{
bGPdata *gpd = (bGPdata *)ob->data;
const bool is_in_front = (ob->dtx & OB_DRAWXRAY);
const bool is_in_front = (ob->dtx & OB_DRAW_IN_FRONT);
const bool is_screenspace = (gpd->flag & GP_DATA_STROKE_KEEPTHICKNESS) != 0;
const bool overide_vertcol = (pd->v3d_color_type != -1);
const bool is_vert_col_mode = (pd->v3d_color_type == V3D_SHADING_VERTEX_COLOR) ||

View File

@ -2122,7 +2122,8 @@ static void armature_context_setup(ArmatureDrawContext *ctx,
const float *const_color)
{
const bool is_object_mode = !do_envelope_dist;
const bool is_xray = (ob->dtx & OB_DRAWXRAY) != 0 || (pd->armature.do_pose_xray && is_pose_mode);
const bool is_xray = (ob->dtx & OB_DRAW_IN_FRONT) != 0 ||
(pd->armature.do_pose_xray && is_pose_mode);
const bool draw_as_wire = (ob->dt < OB_SOLID);
const bool is_filled = (!pd->armature.transparent && !draw_as_wire) || !is_object_mode;
const bool is_transparent = pd->armature.transparent || (draw_as_wire && !is_object_mode);

View File

@ -78,7 +78,7 @@ void OVERLAY_edit_curve_cache_populate(OVERLAY_Data *vedata, Object *ob)
{
OVERLAY_PrivateData *pd = vedata->stl->pd;
bool draw_normals = (pd->overlay.edit_flag & V3D_OVERLAY_EDIT_CU_NORMALS) != 0;
bool do_xray = (ob->dtx & OB_DRAWXRAY) != 0;
bool do_xray = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
Curve *cu = ob->data;
struct GPUBatch *geom;

View File

@ -270,7 +270,7 @@ void OVERLAY_edit_mesh_cache_populate(OVERLAY_Data *vedata, Object *ob)
struct GPUBatch *geom = NULL;
bool draw_as_solid = (ob->dt > OB_WIRE);
bool do_in_front = (ob->dtx & OB_DRAWXRAY) != 0;
bool do_in_front = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
bool do_occlude_wire = (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_OCCLUDE_WIRE) != 0;
bool do_show_mesh_analysis = (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_STATVIS) != 0;
bool fnormals_do = (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_FACE_NORMALS) != 0;
@ -312,7 +312,7 @@ void OVERLAY_edit_mesh_cache_populate(OVERLAY_Data *vedata, Object *ob)
overlay_edit_mesh_add_ob_to_pass(pd, ob, do_in_front);
}
pd->edit_mesh.ghost_ob += (ob->dtx & OB_DRAWXRAY) ? 1 : 0;
pd->edit_mesh.ghost_ob += (ob->dtx & OB_DRAW_IN_FRONT) ? 1 : 0;
pd->edit_mesh.edit_ob += 1;
if (DRW_state_show_text() && (pd->edit_mesh.flag & OVERLAY_EDIT_TEXT)) {

View File

@ -182,7 +182,7 @@ void OVERLAY_edit_text_cache_populate(OVERLAY_Data *vedata, Object *ob)
OVERLAY_PrivateData *pd = vedata->stl->pd;
Curve *cu = ob->data;
struct GPUBatch *geom;
bool do_in_front = (ob->dtx & OB_DRAWXRAY) != 0;
bool do_in_front = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
bool has_surface = (cu->flag & (CU_FRONT | CU_BACK)) || cu->ext1 != 0.0f || cu->ext2 != 0.0f;
if ((cu->flag & CU_FAST) || !has_surface) {

View File

@ -258,7 +258,7 @@ void OVERLAY_extra_line(OVERLAY_ExtraCallBuffers *cb,
OVERLAY_ExtraCallBuffers *OVERLAY_extra_call_buffer_get(OVERLAY_Data *vedata, Object *ob)
{
bool do_in_front = (ob->dtx & OB_DRAWXRAY) != 0;
bool do_in_front = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
OVERLAY_PrivateData *pd = vedata->stl->pd;
return &pd->extra_call_buffers[do_in_front];
}

View File

@ -60,7 +60,7 @@ void OVERLAY_facing_cache_populate(OVERLAY_Data *vedata, Object *ob)
const DRWContextState *draw_ctx = DRW_context_state_get();
const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d) &&
!DRW_state_is_image_render();
const bool is_xray = (ob->dtx & OB_DRAWXRAY) != 0;
const bool is_xray = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
if (use_sculpt_pbvh) {
DRW_shgroup_call_sculpt(pd->facing_grp[is_xray], ob, false, false);

View File

@ -405,7 +405,7 @@ void OVERLAY_image_empty_cache_populate(OVERLAY_Data *vedata, Object *ob)
/* Use the actual depth if we are doing depth tests to determine the distance to the object */
char depth_mode = DRW_state_is_depth() ? OB_EMPTY_IMAGE_DEPTH_DEFAULT : ob->empty_image_depth;
DRWPass *pass = NULL;
if ((ob->dtx & OB_DRAWXRAY) != 0) {
if ((ob->dtx & OB_DRAW_IN_FRONT) != 0) {
/* Object In Front overrides image empty depth mode. */
pass = psl->image_empties_front_ps;
}

View File

@ -69,7 +69,7 @@ static void metaball_instance_data_set(
void OVERLAY_edit_metaball_cache_populate(OVERLAY_Data *vedata, Object *ob)
{
const bool do_in_front = (ob->dtx & OB_DRAWXRAY) != 0;
const bool do_in_front = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
const bool is_select = DRW_state_is_select();
OVERLAY_PrivateData *pd = vedata->stl->pd;
MetaBall *mb = ob->data;
@ -112,7 +112,7 @@ void OVERLAY_edit_metaball_cache_populate(OVERLAY_Data *vedata, Object *ob)
void OVERLAY_metaball_cache_populate(OVERLAY_Data *vedata, Object *ob)
{
const bool do_in_front = (ob->dtx & OB_DRAWXRAY) != 0;
const bool do_in_front = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
OVERLAY_PrivateData *pd = vedata->stl->pd;
MetaBall *mb = ob->data;
const DRWContextState *draw_ctx = DRW_context_state_get();

View File

@ -63,7 +63,7 @@ void OVERLAY_paint_init(OVERLAY_Data *vedata)
const DRWContextState *draw_ctx = DRW_context_state_get();
pd->painting.in_front = pd->use_in_front && draw_ctx->obact &&
(draw_ctx->obact->dtx & OB_DRAWXRAY);
(draw_ctx->obact->dtx & OB_DRAW_IN_FRONT);
pd->painting.alpha_blending = paint_object_is_rendered_transparent(draw_ctx->v3d,
draw_ctx->obact);
}

View File

@ -131,7 +131,7 @@ void OVERLAY_wireframe_cache_init(OVERLAY_Data *vedata)
static void wireframe_hair_cache_populate(OVERLAY_Data *vedata, Object *ob, ParticleSystem *psys)
{
OVERLAY_PrivateData *pd = vedata->stl->pd;
const bool is_xray = (ob->dtx & OB_DRAWXRAY) != 0;
const bool is_xray = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
Object *dupli_parent = DRW_object_get_dupli_parent(ob);
DupliObject *dupli_object = DRW_object_get_dupli(ob);
@ -167,7 +167,7 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata,
OVERLAY_PrivateData *pd = vedata->stl->pd;
const DRWContextState *draw_ctx = DRW_context_state_get();
const bool all_wires = (ob->dtx & OB_DRAW_ALL_EDGES) != 0;
const bool is_xray = (ob->dtx & OB_DRAWXRAY) != 0;
const bool is_xray = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
const bool is_mesh = ob->type == OB_MESH;
const bool is_mesh_verts_only = is_mesh && (((Mesh *)ob->data)->totedge == 0 &&
((Mesh *)ob->data)->totvert > 0);

View File

@ -168,7 +168,7 @@ DRWShadingGroup *workbench_material_setup_ex(WORKBENCH_PrivateData *wpd,
Image *ima = NULL;
ImageUser *iuser = NULL;
eGPUSamplerState sampler;
const bool infront = (ob->dtx & OB_DRAWXRAY) != 0;
const bool infront = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
if (color_type == V3D_SHADING_TEXTURE_COLOR) {
workbench_material_get_image(ob, mat_nr, &ima, &iuser, &sampler);
@ -273,7 +273,7 @@ DRWShadingGroup *workbench_image_setup_ex(WORKBENCH_PrivateData *wpd,
tex = wpd->dummy_image_tx;
}
const bool infront = (ob->dtx & OB_DRAWXRAY) != 0;
const bool infront = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
const bool transp = wpd->shading.xray_alpha < 1.0f;
WORKBENCH_Prepass *prepass = &wpd->prepass[transp][infront][datatype];

View File

@ -2362,7 +2362,7 @@ static Object *modifier_skin_armature_create(Depsgraph *depsgraph,
BKE_object_transform_copy(arm_ob, skin_ob);
arm = arm_ob->data;
arm->layer = 1;
arm_ob->dtx |= OB_DRAWXRAY;
arm_ob->dtx |= OB_DRAW_IN_FRONT;
arm->drawtype = ARM_LINE;
arm->edbo = MEM_callocN(sizeof(ListBase), "edbo armature");

View File

@ -564,7 +564,7 @@ enum {
/* for solid+wire display */
OB_DRAWWIRE = 1 << 5,
/* for overdraw s*/
OB_DRAWXRAY = 1 << 6,
OB_DRAW_IN_FRONT = 1 << 6,
/* enable transparent draw */
OB_DRAWTRANSP = 1 << 7,
OB_DRAW_ALL_EDGES = 1 << 8, /* only for meshes currently */

View File

@ -3242,7 +3242,7 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
prop = RNA_def_property(srna, "show_in_front", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWXRAY);
RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAW_IN_FRONT);
RNA_def_property_ui_text(prop, "In Front", "Make the object draw in front of others");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_GPencil_update");