Skip to content

Commit

Permalink
replace deprecated imgui functions and add DESKTOP_INSTALL_DIR cache …
Browse files Browse the repository at this point in the history
…variable for apps (isl-org#6854)

* Allow compiling open3d-cpu python package on NixOs 24.05
* Remove the use of deprecated functions in ImGui
* CMake option to exclude uvatlas as dependency as a single function
  leads to the inclusion of many libraries.
* CMake option to override the desktop install path

* Set the frame size as initial item heights in the ListView.

* Allow compiling open3d-cpu python package on NixOs 24.05
* Remove the use of deprecated functions in ImGui
* CMake option to exclude uvatlas as dependency as a single function
  leads to the inclusion of many libraries.
* CMake option to override the desktop install path

* Set the frame size as initial item heights in the ListView.

* Fix style errors and disable the 'uvatlas' tests when the feature is not enabled.

* make DESKTOP_INSTALL_DIR a CACHE variable to allow setting it on the
cmdline

* keep compute_uvatlas in the core feature set

* add missing docstring

---------

Co-authored-by: Ernesto Rodriguez <[email protected]>
Co-authored-by: Sameer Sheorey <[email protected]>
Co-authored-by: Benjamin Ummenhofer <[email protected]>
  • Loading branch information
4 people authored Dec 19, 2024
1 parent ba2a6b1 commit 2a67419
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cpp/apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ macro(open3d_add_app_gui SRC_DIR APP_NAME TARGET_NAME)
DESTINATION "${CMAKE_INSTALL_PREFIX}/bin"
USE_SOURCE_PERMISSIONS)
if (CMAKE_INSTALL_PREFIX MATCHES "^(/usr/local|/opt)")
set(DESKTOP_INSTALL_DIR "/usr/share")
set(DESKTOP_INSTALL_DIR "/usr/share" CACHE PATH "The install directory for the desktop apps")
else()
set(DESKTOP_INSTALL_DIR "$ENV{HOME}/.local/share")
set(DESKTOP_INSTALL_DIR "$ENV{HOME}/.local/share" CACHE PATH "The install directory for the desktop apps")
endif()
configure_file("${SOURCE_DIR}/${TARGET_NAME}.desktop.in"
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${APP_NAME}.desktop")
Expand Down
9 changes: 3 additions & 6 deletions cpp/open3d/visualization/gui/ListView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,12 @@ Widget::DrawResult ListView::Draw(const DrawContext &context) {
ImGui::PushStyleColor(ImGuiCol_HeaderActive, // click-hold color
colorToImgui(context.theme.list_selected_color));

int height_in_items =
int(std::floor(frame.height / ImGui::GetFrameHeight()));

auto result = Widget::DrawResult::NONE;
auto new_selected_idx = impl_->selected_index_;
bool is_double_click = false;
DrawImGuiPushEnabledState();
if (ImGui::ListBoxHeader(impl_->imgui_id_.c_str(),
int(impl_->items_.size()), height_in_items)) {
ImVec2 initial_size(0, frame.height);
if (ImGui::BeginListBox(impl_->imgui_id_.c_str(), initial_size)) {
for (size_t i = 0; i < impl_->items_.size(); ++i) {
bool is_selected = (int(i) == impl_->selected_index_);
// ImGUI's list wants to hover over items, which is not done by
Expand Down Expand Up @@ -155,7 +152,7 @@ Widget::DrawResult ListView::Draw(const DrawContext &context) {
}
ImGui::PopStyleColor();
}
ImGui::ListBoxFooter();
ImGui::EndListBox();

if (new_selected_idx != impl_->selected_index_ || is_double_click) {
impl_->selected_index_ = new_selected_idx;
Expand Down

0 comments on commit 2a67419

Please sign in to comment.