Cleanup: Overlay-Next: Use convenience function for overlay flags
This commit is contained in:
@@ -133,7 +133,7 @@ class Armatures {
|
||||
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
{
|
||||
enabled_ = state.is_space_v3d() && !(state.overlay.flag & V3D_OVERLAY_HIDE_BONES);
|
||||
enabled_ = state.is_space_v3d() && state.show_bones();
|
||||
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -34,8 +34,7 @@ class AttributeViewer {
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
{
|
||||
ps_.init();
|
||||
enabled_ = state.is_space_v3d() && !res.is_selection() &&
|
||||
(state.overlay.flag & V3D_OVERLAY_VIEWER_ATTRIBUTE);
|
||||
enabled_ = state.is_space_v3d() && !res.is_selection() && state.show_attribute_viewer();
|
||||
if (!enabled_) {
|
||||
return;
|
||||
};
|
||||
|
||||
@@ -94,7 +94,7 @@ class Cameras {
|
||||
void begin_sync(Resources &res, State &state, View &view)
|
||||
{
|
||||
enabled_ = state.is_space_v3d();
|
||||
extras_enabled_ = enabled_ && !(state.overlay.flag & V3D_OVERLAY_HIDE_OBJECT_XTRAS);
|
||||
extras_enabled_ = enabled_ && state.show_extras();
|
||||
motion_tracking_enabled_ = enabled_ && state.v3d->flag2 & V3D_SHOW_RECONSTRUCTION;
|
||||
images_enabled_ = enabled_ && !res.is_selection();
|
||||
enabled_ = extras_enabled_ || images_enabled_ || motion_tracking_enabled_;
|
||||
|
||||
@@ -55,7 +55,7 @@ class Empties {
|
||||
|
||||
void begin_sync(Resources &res, const State &state, View &view)
|
||||
{
|
||||
enabled_ = state.is_space_v3d() && !(state.overlay.flag & V3D_OVERLAY_HIDE_OBJECT_XTRAS);
|
||||
enabled_ = state.is_space_v3d() && state.show_extras();
|
||||
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -28,8 +28,8 @@ class Facing {
|
||||
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
{
|
||||
enabled_ = state.v3d && (state.overlay.flag & V3D_OVERLAY_FACE_ORIENTATION) &&
|
||||
!state.xray_enabled && !res.is_selection();
|
||||
enabled_ = state.v3d && state.show_face_orientation() && !state.xray_enabled &&
|
||||
!res.is_selection();
|
||||
if (!enabled_) {
|
||||
/* Not used. But release the data. */
|
||||
ps_.init();
|
||||
|
||||
@@ -33,8 +33,7 @@ class Fade {
|
||||
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
{
|
||||
const bool do_edit_mesh_fade_geom = !state.xray_enabled &&
|
||||
(state.overlay.flag & V3D_OVERLAY_FADE_INACTIVE);
|
||||
const bool do_edit_mesh_fade_geom = !state.xray_enabled && state.show_fade_inactive();
|
||||
enabled_ = state.is_space_v3d() && (do_edit_mesh_fade_geom || state.do_pose_fade_geom) &&
|
||||
!res.is_selection();
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ void Instance::init()
|
||||
state.overlay.wireframe_opacity = state.v3d->overlay.wireframe_opacity;
|
||||
}
|
||||
|
||||
state.do_pose_xray = (state.overlay.flag & V3D_OVERLAY_BONE_SELECT);
|
||||
state.do_pose_xray = state.show_bone_selection();
|
||||
state.do_pose_fade_geom = state.do_pose_xray && !(state.object_mode & OB_MODE_WEIGHT_PAINT) &&
|
||||
ctx->object_pose != nullptr;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class Lattices {
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
{
|
||||
enabled_ = state.is_space_v3d();
|
||||
enabled_ &= !(state.overlay.flag & V3D_OVERLAY_HIDE_OBJECT_XTRAS);
|
||||
enabled_ &= state.show_extras();
|
||||
if (!enabled_) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class Lights {
|
||||
|
||||
void begin_sync(const State &state)
|
||||
{
|
||||
enabled_ = state.is_space_v3d() && !(state.overlay.flag & V3D_OVERLAY_HIDE_OBJECT_XTRAS);
|
||||
enabled_ = state.is_space_v3d() && state.show_extras();
|
||||
if (!enabled_) {
|
||||
return;
|
||||
}
|
||||
@@ -94,7 +94,7 @@ class Lights {
|
||||
call_buffers_.ground_line_buf.append(float4(matrix.location()), select_id);
|
||||
|
||||
const float4 light_color = {la.r, la.g, la.b, 1.0f};
|
||||
const bool show_light_colors = state.overlay.flag & V3D_OVERLAY_SHOW_LIGHT_COLORS;
|
||||
const bool show_light_colors = state.show_light_colors();
|
||||
|
||||
/* Draw the outer ring of the light icon and the sun rays in `light_color`, if required. */
|
||||
call_buffers_.icon_outer_buf.append(data, select_id);
|
||||
|
||||
@@ -46,7 +46,7 @@ class LightProbes {
|
||||
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
{
|
||||
enabled_ = state.is_space_v3d() && !(state.overlay.flag & V3D_OVERLAY_HIDE_OBJECT_XTRAS);
|
||||
enabled_ = state.is_space_v3d() && state.show_extras();
|
||||
if (!enabled_) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -32,8 +32,7 @@ class MotionPath {
|
||||
public:
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
{
|
||||
enabled_ = state.v3d && !(state.overlay.flag & V3D_OVERLAY_HIDE_MOTION_PATHS) &&
|
||||
!res.is_selection();
|
||||
enabled_ = state.v3d && state.show_motion_paths() && !res.is_selection();
|
||||
if (!enabled_) {
|
||||
/* Not used. But release the data. */
|
||||
motion_path_ps_.init();
|
||||
|
||||
@@ -28,8 +28,7 @@ class Origins {
|
||||
const bool is_paint_mode = (state.object_mode &
|
||||
(OB_MODE_ALL_PAINT | OB_MODE_ALL_PAINT_GPENCIL |
|
||||
OB_MODE_SCULPT_CURVES)) != 0;
|
||||
enabled_ = state.is_space_v3d() && !is_paint_mode &&
|
||||
(state.overlay.flag & V3D_OVERLAY_HIDE_OBJECT_ORIGINS) == 0;
|
||||
enabled_ = state.is_space_v3d() && !is_paint_mode && state.show_object_origins();
|
||||
point_buf_.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -115,6 +115,63 @@ struct State {
|
||||
{
|
||||
return this->space_type == SPACE_NODE;
|
||||
}
|
||||
|
||||
bool show_extras() const
|
||||
{
|
||||
return (this->overlay.flag & V3D_OVERLAY_HIDE_OBJECT_XTRAS) == 0;
|
||||
}
|
||||
bool show_face_orientation() const
|
||||
{
|
||||
return (this->overlay.flag & V3D_OVERLAY_FACE_ORIENTATION);
|
||||
}
|
||||
bool show_bone_selection() const
|
||||
{
|
||||
return (this->overlay.flag & V3D_OVERLAY_BONE_SELECT);
|
||||
}
|
||||
bool show_wireframes() const
|
||||
{
|
||||
return (this->overlay.flag & V3D_OVERLAY_WIREFRAMES);
|
||||
}
|
||||
bool show_motion_paths() const
|
||||
{
|
||||
return (this->overlay.flag & V3D_OVERLAY_HIDE_MOTION_PATHS) == 0;
|
||||
}
|
||||
bool show_bones() const
|
||||
{
|
||||
return (this->overlay.flag & V3D_OVERLAY_HIDE_BONES) == 0;
|
||||
}
|
||||
bool show_object_origins() const
|
||||
{
|
||||
return (this->overlay.flag & V3D_OVERLAY_HIDE_OBJECT_ORIGINS) == 0;
|
||||
}
|
||||
bool show_fade_inactive() const
|
||||
{
|
||||
return (this->overlay.flag & V3D_OVERLAY_FADE_INACTIVE);
|
||||
}
|
||||
bool show_attribute_viewer() const
|
||||
{
|
||||
return (this->overlay.flag & V3D_OVERLAY_VIEWER_ATTRIBUTE);
|
||||
}
|
||||
bool show_attribute_viewer_text() const
|
||||
{
|
||||
return (this->overlay.flag & V3D_OVERLAY_VIEWER_ATTRIBUTE_TEXT);
|
||||
}
|
||||
bool show_sculpt_mask() const
|
||||
{
|
||||
return (this->overlay.flag & V3D_OVERLAY_SCULPT_SHOW_MASK);
|
||||
}
|
||||
bool show_sculpt_face_sets() const
|
||||
{
|
||||
return (this->overlay.flag & V3D_OVERLAY_SCULPT_SHOW_FACE_SETS);
|
||||
}
|
||||
bool show_sculpt_curves_cage() const
|
||||
{
|
||||
return (this->overlay.flag & V3D_OVERLAY_SCULPT_CURVES_CAGE);
|
||||
}
|
||||
bool show_light_colors() const
|
||||
{
|
||||
return (this->overlay.flag & V3D_OVERLAY_SHOW_LIGHT_COLORS);
|
||||
}
|
||||
};
|
||||
|
||||
static inline float4x4 winmat_polygon_offset(float4x4 winmat, float view_dist, float offset)
|
||||
|
||||
@@ -42,12 +42,13 @@ class Sculpts {
|
||||
|
||||
void begin_sync(Resources &res, const State &state)
|
||||
{
|
||||
const int sculpt_overlay_flags = V3D_OVERLAY_SCULPT_SHOW_FACE_SETS |
|
||||
V3D_OVERLAY_SCULPT_SHOW_MASK | V3D_OVERLAY_SCULPT_CURVES_CAGE;
|
||||
show_curves_cage_ = state.show_sculpt_curves_cage();
|
||||
show_face_set_ = state.show_sculpt_face_sets();
|
||||
show_mask_ = state.show_sculpt_mask();
|
||||
|
||||
enabled_ = state.is_space_v3d() && !state.xray_enabled && !res.is_selection() &&
|
||||
ELEM(state.object_mode, OB_MODE_SCULPT_CURVES, OB_MODE_SCULPT) &&
|
||||
(state.overlay.flag & sculpt_overlay_flags);
|
||||
(show_curves_cage_ || show_face_set_ || show_mask_);
|
||||
|
||||
if (!enabled_) {
|
||||
/* Not used. But release the data. */
|
||||
@@ -56,10 +57,6 @@ class Sculpts {
|
||||
return;
|
||||
}
|
||||
|
||||
show_curves_cage_ = state.overlay.flag & V3D_OVERLAY_SCULPT_CURVES_CAGE;
|
||||
show_face_set_ = state.overlay.flag & V3D_OVERLAY_SCULPT_SHOW_FACE_SETS;
|
||||
show_mask_ = state.overlay.flag & V3D_OVERLAY_SCULPT_SHOW_MASK;
|
||||
|
||||
float curve_cage_opacity = show_curves_cage_ ? state.overlay.sculpt_curves_cage_opacity : 0.0f;
|
||||
float face_set_opacity = show_face_set_ ? state.overlay.sculpt_mode_face_sets_opacity : 0.0f;
|
||||
float mask_opacity = show_mask_ ? state.overlay.sculpt_mode_mask_opacity : 0.0f;
|
||||
|
||||
@@ -31,7 +31,7 @@ class Speakers {
|
||||
|
||||
void begin_sync(const State &state)
|
||||
{
|
||||
enabled_ = state.is_space_v3d() && !(state.overlay.flag & V3D_OVERLAY_HIDE_OBJECT_XTRAS);
|
||||
enabled_ = state.is_space_v3d() && state.show_extras();
|
||||
|
||||
if (!enabled_) {
|
||||
return;
|
||||
|
||||
@@ -45,7 +45,7 @@ class Wireframe {
|
||||
return;
|
||||
}
|
||||
|
||||
show_wire_ = state.is_wireframe_mode || (state.overlay.flag & V3D_OVERLAY_WIREFRAMES);
|
||||
show_wire_ = state.is_wireframe_mode || state.show_wireframes();
|
||||
|
||||
const bool is_selection = res.is_selection();
|
||||
const bool do_smooth_lines = (U.gpu_flag & USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE) != 0;
|
||||
|
||||
Reference in New Issue
Block a user