diff --git a/common/model-views.cpp b/common/model-views.cpp index 7dc5f91a11..a66b9583d7 100644 --- a/common/model-views.cpp +++ b/common/model-views.cpp @@ -909,15 +909,7 @@ namespace rs2 bool option_model::allow_change(float val, std::string& error_message) const { - // Deny enabling IR Reflectivity on ROI != 20% [RS5-8358] - if ((RS2_OPTION_ENABLE_IR_REFLECTIVITY == opt) && (1.0f == val)) - { - if (0.2f != dev->roi_percentage) - { - error_message = "Please set 'VGA' resolution, 'Max Range' preset and 20% ROI before enabling IR Reflectivity"; - return false; - } - } + // Place here option restrictions return true; } @@ -2295,17 +2287,16 @@ namespace rs2 } _stream_not_alive.reset(); - try + try { - if( ! viewer.is_option_skipped( RS2_OPTION_ENABLE_IR_REFLECTIVITY ) ) + auto ds = d->dev.first< depth_sensor >(); + if( viewer._support_ir_reflectivity + && ds.supports( RS2_OPTION_ENABLE_IR_REFLECTIVITY ) + && ds.supports( RS2_OPTION_ENABLE_MAX_USABLE_RANGE ) + && ( ( p.stream_type() == RS2_STREAM_INFRARED ) + || ( p.stream_type() == RS2_STREAM_DEPTH ) ) ) { - auto ds = d->dev.first< depth_sensor >(); - if( ds.supports( RS2_OPTION_ENABLE_IR_REFLECTIVITY ) - && ds.supports( RS2_OPTION_ENABLE_MAX_USABLE_RANGE ) - && ( ( p.stream_type() == RS2_STREAM_INFRARED ) || ( p.stream_type() == RS2_STREAM_DEPTH ) ) ) - { - _reflectivity = std::unique_ptr< reflectivity >( new reflectivity() ); - } + _reflectivity = std::unique_ptr< reflectivity >( new reflectivity() ); } } catch(...) {}; diff --git a/common/viewer.cpp b/common/viewer.cpp index 50ad2cb559..81c6bd5cbe 100644 --- a/common/viewer.cpp +++ b/common/viewer.cpp @@ -939,12 +939,13 @@ namespace rs2 - viewer_model::viewer_model(context &ctx_) - : ppf(*this), - ctx(ctx_), - frameset_alloc(this), - synchronization_enable(true), - zo_sensors(0) + viewer_model::viewer_model( context & ctx_ ) + : ppf( *this ) + , ctx( ctx_ ) + , frameset_alloc( this ) + , synchronization_enable( true ) + , zo_sensors( 0 ) + , _support_ir_reflectivity( false ) { syncer = std::make_shared(); diff --git a/common/viewer.h b/common/viewer.h index bcd9b097ea..b8fb73eea0 100644 --- a/common/viewer.h +++ b/common/viewer.h @@ -192,6 +192,7 @@ namespace rs2 std::shared_ptr updates; std::unordered_set _hidden_options; + bool _support_ir_reflectivity; private: void check_permissions(); diff --git a/tools/depth-quality/depth-quality-model.cpp b/tools/depth-quality/depth-quality-model.cpp index cf45e02e0f..8d4f8d805a 100644 --- a/tools/depth-quality/depth-quality-model.cpp +++ b/tools/depth-quality/depth-quality-model.cpp @@ -33,9 +33,10 @@ namespace rs2 _viewer_model.draw_plane = true; _viewer_model.synchronization_enable = false; _viewer_model.support_non_syncronized_mode = false; //pipeline outputs only syncronized frameset - + _viewer_model._support_ir_reflectivity = true; // Hide options from the DQT application _viewer_model._hidden_options.emplace(RS2_OPTION_ENABLE_MAX_USABLE_RANGE); + _viewer_model._hidden_options.emplace(RS2_OPTION_ENABLE_IR_REFLECTIVITY); } bool tool_model::start(ux_window& window) @@ -646,6 +647,45 @@ namespace rs2 ImGui::PopStyleColor(); ImGui::PopItemWidth(); + + try + { + if (_depth_sensor_model) + { + auto && ds = _depth_sensor_model->dev.first< depth_sensor >(); + if (ds.supports(RS2_OPTION_ENABLE_IR_REFLECTIVITY)) + { + ImGui::SetCursorPosX(col0); + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5); + + bool current_ir_reflectivity_opt + = ds.get_option(RS2_OPTION_ENABLE_IR_REFLECTIVITY); + + if (ImGui::Checkbox("IR Reflectivity", + ¤t_ir_reflectivity_opt)) + { + // Deny enabling IR Reflectivity on ROI != 20% [RS5-8358] + if (0.2f == _roi_percent) + ds.set_option(RS2_OPTION_ENABLE_IR_REFLECTIVITY, + current_ir_reflectivity_opt); + else + _error_message + = "Please set 'VGA' resolution, 'Max Range' preset and " + "20% ROI before enabling IR Reflectivity"; + } + + if (ImGui::IsItemHovered()) + { + ImGui::SetTooltip(ds.get_option_description(RS2_OPTION_ENABLE_IR_REFLECTIVITY)); + } + } + } + } + catch (const std::exception& e) + { + _error_message = e.what(); + } + ImGui::SetCursorPosX(col0); ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5);