Skip to content

Commit

Permalink
Visualization refactor: Open3DViewer and rendering::Scene (#2125)
Browse files Browse the repository at this point in the history
* Refactor: added Open3DScene (#1992)

* Refactor: added Open3DScene, refactored SceneWidget and GuiVisualizer to use it

* Removed now-unnecessary visualization:: qualification in SceneWidget

* Fixed model rotation not working

* Remove unused variable that GCC complains about

* Fixed include path

* Fixed another include path

* Include path fix

* Refactored GuiVisualizer so that the view settings are more independent and more MVC-like

* Merged master into vis-refactor. (#2099)

* Updated Info.plist file for app to claim it edits and is the default type for the file associations. Also adds .pcd as a supported file type. (#2001)

* fix obb rotate and scale (#1999)

* python-based parallel style check for py/cpp/jupyter (#2003)

* python-based parallel style check for py/cpp/jupyter

* intentially introduce style error

* remove redundant `pass`

* reorder code

* fix clang-format finder

* require py36, hand-coded version parsing

* fix intentional style errors

* do not use system jsoncpp (#2005)

* Reorg: Added namespace 'rendering' for visualization/rendering (#2002)

* Reorg: Added namespace 'rendering' for visualization/rendering

* Reorg: modify unit test to use new 'rendering' namespace

* overload draw_geometries (#1997)

* std::min of extent in visualizer (#2008)

* remove voxel_pooling namespace (#2014)

* ml namespaces reorg (#2017)

* rename shape_checking -> op_util

* rename detail -> impl

* adapt includes in ml

* fix namespace in shapechecking unit test

* fix paths in CMakeLists for tensorflow and pytorch ops

* reorg: remove hash_* namespaces (#2025)

* reorg: hash_*::hash to hash_* (remove hash_* namespaces)

* reorg: apply-style

* Rename GLHelper namespace (#2024)

* Reorg: change namespace GLHelper to gl_util

* Style fixes

* Reorg: remove texture_loading namespace

* Removed visualization::gui::util namespace (#2013)

* Removed visualization::gui::util namespace

* Style fixes

* add make check-cpp-style, apply-cpp-style (#2016)

* move dlpack (#2009)

* move dlpack

* move dlpack tests

* add license header

* move Open3DDLManagedTensor constructor

* more license

* DLManagedTensor:Create

* update Eigen to use the GitLab commit id (#2030)

* Update PointCloud.h (#2032)

Changed Incorrect interchanged description for variable points_ and colors_

* Update CHANGELOG.md (#2033)

As required by guidelines with respect to Pull request #2032

* fix coord frame origin bug (#2034)

* Added comment explaining why Util.h only has one function in it (#2028)

* expose poisson rec threads param (#2035)

* remove clean up

* fix path (#2048)

* Adds menu option on macOS to make Open3D viewer default for file types (#2031)

* Adds menu option on macOS to make Open3D viewer default for file types we load. Also makes macOS menu more Mac-like, and fixes problems with auto-centering windows.

* Linux fixes

* Applied style

* Get rid of some magic numbers

* Use GitHub actions again for macOS CI (#2045)

* enable macos github actions, disable macos travis

* use ccache

* skip brew upgrade

* torch op nvcc bugfix and impl namespace (#2044)

* fix deprecated warning with torch 1.5

* fix problems with compile options and nvcc

* add shape checking code for pytorch op

* namespace rename open3d::ml::detail -> open3d::ml::impl

* only modify torch_cuda when building with cuda

* use full include paths

* disable CreateFromPointCloudPoisson test for macos (#2054)

* disable CreateFromPointCloudPoisson test for macos

* set macos threads=1

* ml op test code and torch reduce_subarrays_sum op (#2050)

* fix deprecated warning with torch 1.5

* fix problems with compile options and nvcc

* add shape checking code for pytorch op

* namespace rename open3d::ml::detail -> open3d::ml::impl

* only modify torch_cuda when building with cuda

* -updated and cleaned up code for testing across ml frameworks

* added reduce_subarrays_sum op for torch

* rename dir with ml op tests to ml_ops

* fix include paths

* -fix missing entry in _build_config.py
-fix bug not running the tests on the gpu
-fix problems detected by pylint

* add more information to open3d._build_config

* fix another pytorch problem

* catch ImportError for compatibility with python 3.5

* add missing import statement

* rename mltest.parameterize -> mltest.parametrize

* CUDA header as system header for CMake 3.16 (#2058)

* update CI badges, remove appveyor (#2059)

* Docs updated for build with CUDA (#2055)

* Add building with CUDA

* fix style

* fixes

* remove space

* Remove space

* TensorList refactoring and comparison tensor ops (#2066)

* refactor TensorList, add Tensor comp ops

* fix msvc error

* fix utility::LogXX {} escape problem (#2072)

* fix LogXX {} escape problem

* fix a typo

* specifying utf-8 encoding to open nb_path (#1935)

* Release Python GIL for fast multithreaded IO (#1936)

* ClassIO Python bindings now release GIL
This allows multithreaded loading of PCD files, etc.

* Update CHANGELOG.md as requested

* Incorrect list-item indent: add 2 spaces

* clang-format class_io.cpp

Co-authored-by: Samson Lee <samson.lee@visionarymachines.com>

* Fix window showing buffer from last resize when a window is moved on macOS (#2076)

* lower case "open3d/3rdparty" intall dir (#2083)

* fix bug in import_3rdparty_library for paths without trailing '/' (#2084)

* -fix bug in import_3rdparty_library for paths without trailing '/' and allow to pass multiple include dirs

* improved doc for import_3rdparty_library and build_3rdparty_library

* fetch Filament with CMake FetchContent (#2085)

* Implements python bindings for gui namespace (#2042)

* no message

* Added pybinds for TabControl and FileDialog

* Add C++ function to initialize with a resource path, updated python package to include resources and update pybind to get resource path from module path

* Added pybinds for Menu.

* Refactored to gui pybinds to export properties wherever feasible

* Fix height used for auto-sizing windows to be less than the monitor size to account for window titles and global menu/toolbar

* Added python GUI example

* Style changes

* Merge branch 'master' into prewettg/pybind-gui

* Don't include GUI pybinds if ENABLE_GUI=OFF

* Fixed dynamic link error when importing open3d and ENABLE_GUI=OFF

* Add python example of Open3DViewer UI, added some float->int bindings, and added a Window.set_on_layout() function to implement a layout callback.

* Fix macOS sometimes not issuing draw event when UI is run through Python

* Added documentation to gui pybinds

* Style fixes

* Added open3d.visualization.gui to the documentation, improved docstrings.

* Style fix

* Made GUI examples more like a framework of a simple app, rather than just functions that use the API. Also fixed crash when macOS file dialog has no filters, and a bug with dialogs sometimes not displaying until a mouse move.

* Style fixes

* Updated some copyright dates

* Removed unused function

* Moved nested callback functions to be top-level methods in GUI python examples

* Fixed documentation failing when built with ENABLE_GUI=OFF

* Style fixes

* scalar support to more binary ops (#2093)

* scalar support for more binary ops

* fix boolean advanced indexing

* Added gui::TreeView widget (#2081)

* Build: exclude refactored Gui related classes when ENABLE_GUI=OFF

* Build: Make sure refactored files are exluded from build when ENABLE_GUI=OFF

Co-authored-by: prewettg <prewettg@gmail.com>
Co-authored-by: Gernot <gernotriegler@gmail.com>
Co-authored-by: Yixing Lao <yixing.lao@gmail.com>
Co-authored-by: Benjamin Ummenhofer <benjaminum@gmail.com>
Co-authored-by: pvarvak <60749825+pvarvak@users.noreply.github.com>
Co-authored-by: Pranay Mathur <37473401+Matnay@users.noreply.github.com>
Co-authored-by: Sanskar Agrawal <sanskaragrawal107@gmail.com>
Co-authored-by: johnbomidi <37553132+johnbomidi@users.noreply.github.com>
Co-authored-by: sammo2828 <sammo2828@gmail.com>
Co-authored-by: Samson Lee <samson.lee@visionarymachines.com>

* New Scene Interface [not ready for master] (#2102)

* Updated Info.plist file for app to claim it edits and is the default type for the file associations. Also adds .pcd as a supported file type. (#2001)

* fix obb rotate and scale (#1999)

* python-based parallel style check for py/cpp/jupyter (#2003)

* python-based parallel style check for py/cpp/jupyter

* intentially introduce style error

* remove redundant `pass`

* reorder code

* fix clang-format finder

* require py36, hand-coded version parsing

* fix intentional style errors

* do not use system jsoncpp (#2005)

* Reorg: Added namespace 'rendering' for visualization/rendering (#2002)

* Reorg: Added namespace 'rendering' for visualization/rendering

* Reorg: modify unit test to use new 'rendering' namespace

* overload draw_geometries (#1997)

* std::min of extent in visualizer (#2008)

* remove voxel_pooling namespace (#2014)

* ml namespaces reorg (#2017)

* rename shape_checking -> op_util

* rename detail -> impl

* adapt includes in ml

* fix namespace in shapechecking unit test

* fix paths in CMakeLists for tensorflow and pytorch ops

* reorg: remove hash_* namespaces (#2025)

* reorg: hash_*::hash to hash_* (remove hash_* namespaces)

* reorg: apply-style

* Rename GLHelper namespace (#2024)

* Reorg: change namespace GLHelper to gl_util

* Style fixes

* Reorg: remove texture_loading namespace

* Removed visualization::gui::util namespace (#2013)

* Removed visualization::gui::util namespace

* Style fixes

* add make check-cpp-style, apply-cpp-style (#2016)

* move dlpack (#2009)

* move dlpack

* move dlpack tests

* add license header

* move Open3DDLManagedTensor constructor

* more license

* DLManagedTensor:Create

* update Eigen to use the GitLab commit id (#2030)

* Update PointCloud.h (#2032)

Changed Incorrect interchanged description for variable points_ and colors_

* Update CHANGELOG.md (#2033)

As required by guidelines with respect to Pull request #2032

* fix coord frame origin bug (#2034)

* Added comment explaining why Util.h only has one function in it (#2028)

* expose poisson rec threads param (#2035)

* remove clean up

* fix path (#2048)

* Adds menu option on macOS to make Open3D viewer default for file types (#2031)

* Adds menu option on macOS to make Open3D viewer default for file types we load. Also makes macOS menu more Mac-like, and fixes problems with auto-centering windows.

* Linux fixes

* Applied style

* Get rid of some magic numbers

* Use GitHub actions again for macOS CI (#2045)

* enable macos github actions, disable macos travis

* use ccache

* skip brew upgrade

* torch op nvcc bugfix and impl namespace (#2044)

* fix deprecated warning with torch 1.5

* fix problems with compile options and nvcc

* add shape checking code for pytorch op

* namespace rename open3d::ml::detail -> open3d::ml::impl

* only modify torch_cuda when building with cuda

* use full include paths

* disable CreateFromPointCloudPoisson test for macos (#2054)

* disable CreateFromPointCloudPoisson test for macos

* set macos threads=1

* ml op test code and torch reduce_subarrays_sum op (#2050)

* fix deprecated warning with torch 1.5

* fix problems with compile options and nvcc

* add shape checking code for pytorch op

* namespace rename open3d::ml::detail -> open3d::ml::impl

* only modify torch_cuda when building with cuda

* -updated and cleaned up code for testing across ml frameworks

* added reduce_subarrays_sum op for torch

* rename dir with ml op tests to ml_ops

* fix include paths

* -fix missing entry in _build_config.py
-fix bug not running the tests on the gpu
-fix problems detected by pylint

* add more information to open3d._build_config

* fix another pytorch problem

* catch ImportError for compatibility with python 3.5

* add missing import statement

* rename mltest.parameterize -> mltest.parametrize

* CUDA header as system header for CMake 3.16 (#2058)

* update CI badges, remove appveyor (#2059)

* Docs updated for build with CUDA (#2055)

* Add building with CUDA

* fix style

* fixes

* remove space

* Remove space

* TensorList refactoring and comparison tensor ops (#2066)

* refactor TensorList, add Tensor comp ops

* fix msvc error

* fix utility::LogXX {} escape problem (#2072)

* fix LogXX {} escape problem

* fix a typo

* specifying utf-8 encoding to open nb_path (#1935)

* Release Python GIL for fast multithreaded IO (#1936)

* ClassIO Python bindings now release GIL
This allows multithreaded loading of PCD files, etc.

* Update CHANGELOG.md as requested

* Incorrect list-item indent: add 2 spaces

* clang-format class_io.cpp

Co-authored-by: Samson Lee <samson.lee@visionarymachines.com>

* Fix window showing buffer from last resize when a window is moved on macOS (#2076)

* lower case "open3d/3rdparty" intall dir (#2083)

* fix bug in import_3rdparty_library for paths without trailing '/' (#2084)

* -fix bug in import_3rdparty_library for paths without trailing '/' and allow to pass multiple include dirs

* improved doc for import_3rdparty_library and build_3rdparty_library

* fetch Filament with CMake FetchContent (#2085)

* Implements python bindings for gui namespace (#2042)

* no message

* Added pybinds for TabControl and FileDialog

* Add C++ function to initialize with a resource path, updated python package to include resources and update pybind to get resource path from module path

* Added pybinds for Menu.

* Refactored to gui pybinds to export properties wherever feasible

* Fix height used for auto-sizing windows to be less than the monitor size to account for window titles and global menu/toolbar

* Added python GUI example

* Style changes

* Merge branch 'master' into prewettg/pybind-gui

* Don't include GUI pybinds if ENABLE_GUI=OFF

* Fixed dynamic link error when importing open3d and ENABLE_GUI=OFF

* Add python example of Open3DViewer UI, added some float->int bindings, and added a Window.set_on_layout() function to implement a layout callback.

* Fix macOS sometimes not issuing draw event when UI is run through Python

* Added documentation to gui pybinds

* Style fixes

* Added open3d.visualization.gui to the documentation, improved docstrings.

* Style fix

* Made GUI examples more like a framework of a simple app, rather than just functions that use the API. Also fixed crash when macOS file dialog has no filters, and a bug with dialogs sometimes not displaying until a mouse move.

* Style fixes

* Updated some copyright dates

* Removed unused function

* Moved nested callback functions to be top-level methods in GUI python examples

* Fixed documentation failing when built with ENABLE_GUI=OFF

* Style fixes

* scalar support to more binary ops (#2093)

* scalar support for more binary ops

* fix boolean advanced indexing

* Added gui::TreeView widget (#2081)

* Build: exclude refactored Gui related classes when ENABLE_GUI=OFF

* Build: Make sure refactored files are exluded from build when ENABLE_GUI=OFF

* Refactor: Initial working version of Scene interface

* Update Open3DViewer and associated files to use new Scene interfaces (+ style changes)

* Fix spurious warnings

* Fix material switching to work with new Scene interface

Co-authored-by: prewettg <prewettg@gmail.com>
Co-authored-by: Gernot <gernotriegler@gmail.com>
Co-authored-by: Yixing Lao <yixing.lao@gmail.com>
Co-authored-by: Benjamin Ummenhofer <benjaminum@gmail.com>
Co-authored-by: pvarvak <60749825+pvarvak@users.noreply.github.com>
Co-authored-by: Pranay Mathur <37473401+Matnay@users.noreply.github.com>
Co-authored-by: Sanskar Agrawal <sanskaragrawal107@gmail.com>
Co-authored-by: johnbomidi <37553132+johnbomidi@users.noreply.github.com>
Co-authored-by: sammo2828 <sammo2828@gmail.com>
Co-authored-by: Samson Lee <samson.lee@visionarymachines.com>

* Bug fixes for refactor (#2114)

* Added pybinds open3d::visualization::rendering and implement Python equivalent of vis app (#2113)

* Fix compile warnings

* Axes shouldn't cast or receive shadows

* Removed code marked as unnecessary

* Fix Windows error

* Style fix and Windows fix

* Don't include rendering pybinds if ENABLE_GUI=OFF

* Code review changes

* Removed unused member variable

* Removed warning if attempting to remove non-existent geometry from the Scene

Co-authored-by: Rene <errissa@gmail.com>
Co-authored-by: Gernot <gernotriegler@gmail.com>
Co-authored-by: Yixing Lao <yixing.lao@gmail.com>
Co-authored-by: Benjamin Ummenhofer <benjaminum@gmail.com>
Co-authored-by: pvarvak <60749825+pvarvak@users.noreply.github.com>
Co-authored-by: Pranay Mathur <37473401+Matnay@users.noreply.github.com>
Co-authored-by: Sanskar Agrawal <sanskaragrawal107@gmail.com>
Co-authored-by: johnbomidi <37553132+johnbomidi@users.noreply.github.com>
Co-authored-by: sammo2828 <sammo2828@gmail.com>
Co-authored-by: Samson Lee <samson.lee@visionarymachines.com>
  • Loading branch information
11 people authored Aug 3, 2020
1 parent d443d84 commit 125458a
Show file tree
Hide file tree
Showing 44 changed files with 3,840 additions and 2,079 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ doxygen/
docs/python_api/
node_modules/

# Editor files
*.*~

# Local configs
_vimrc_local.vim
.vs/
Expand Down
6 changes: 6 additions & 0 deletions cpp/open3d/visualization/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ if (ENABLE_GUI)
else ()
list(FILTER VISUALIZATION_ALL_HEADER_FILES EXCLUDE REGEX .*GuiVisualizer.h)
list(FILTER VISUALIZATION_ALL_SOURCE_FILES EXCLUDE REGEX .*GuiVisualizer.cpp)
list(FILTER VISUALIZATION_ALL_SOURCE_FILES EXCLUDE REGEX .*GuiSettingsModel.cpp)
list(FILTER VISUALIZATION_ALL_SOURCE_FILES EXCLUDE REGEX .*GuiSettingsModel.h)
list(FILTER VISUALIZATION_ALL_SOURCE_FILES EXCLUDE REGEX .*GuiSettingsView.cpp)
list(FILTER VISUALIZATION_ALL_SOURCE_FILES EXCLUDE REGEX .*GuiSettingsView.h)
list(FILTER VISUALIZATION_ALL_SOURCE_FILES EXCLUDE REGEX .*GuiWidgets.cpp)
list(FILTER VISUALIZATION_ALL_SOURCE_FILES EXCLUDE REGEX .*GuiWidgets.h)
endif()

# create object library
Expand Down
3 changes: 3 additions & 0 deletions cpp/open3d/visualization/gui/Color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ Color::Color() : rgba_{0.0f, 0.0f, 0.0f, 1.0f} {}
Color::Color(float r, float g, float b, float a /*= 1.0*/)
: rgba_{r, g, b, a} {}

Color::Color(const Eigen::Vector3f& rgb)
: rgba_{rgb.x(), rgb.y(), rgb.z(), 1.0f} {}

bool Color::operator==(const Color& rhs) const {
return (this->rgba_[0] == rhs.rgba_[0] && this->rgba_[1] == rhs.rgba_[1] &&
this->rgba_[2] == rhs.rgba_[2] && this->rgba_[3] == rhs.rgba_[3]);
Expand Down
3 changes: 3 additions & 0 deletions cpp/open3d/visualization/gui/Color.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

#pragma once

#include <Eigen/Geometry>

namespace open3d {
namespace visualization {
namespace gui {
Expand All @@ -34,6 +36,7 @@ class Color {
public:
Color();
Color(float r, float g, float b, float a = 1.0);
Color(const Eigen::Vector3f& rgb); // not explicit: want auto-convert

float GetRed() const;
float GetGreen() const;
Expand Down
9 changes: 7 additions & 2 deletions cpp/open3d/visualization/gui/Combobox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ void Combobox::RemoveItem(int index) {
}
}

int Combobox::GetNumberOfItems() const {
return static_cast<int>(impl_->items_.size());
}

const char* Combobox::GetItem(int index) const {
return impl_->items_[index].c_str();
}
Expand All @@ -131,14 +135,15 @@ void Combobox::SetSelectedIndex(int index) {
}
}

void Combobox::SetSelectedValue(const char* value) {
bool Combobox::SetSelectedValue(const char* value) {
std::string svalue = value;
for (size_t i = 0; i < impl_->items_.size(); ++i) {
if (impl_->items_[i] == svalue) {
SetSelectedIndex(i);
return;
return true;
}
}
return false;
}

void Combobox::SetOnValueChanged(
Expand Down
6 changes: 4 additions & 2 deletions cpp/open3d/visualization/gui/Combobox.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class Combobox : public Widget {
/// Removes the item at \param index.
void RemoveItem(int index);

int GetNumberOfItems() const;

/// Returns the text of the item at \param index. \param index must be
/// valid.
const char* GetItem(int index) const;
Expand All @@ -69,8 +71,8 @@ class Combobox : public Widget {
/// callback.
void SetSelectedIndex(int index);
/// Sets the selected item by value. Does nothing if \param value is not an
/// item. Does not call the onValueChanged callback
void SetSelectedValue(const char* value);
/// item, but will return false. Does not call the onValueChanged callback
bool SetSelectedValue(const char* value);

Size CalcPreferredSize(const Theme& theme) const override;

Expand Down
3 changes: 3 additions & 0 deletions cpp/open3d/visualization/gui/Layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ int Layout1D::GetSpacing() const { return impl_->spacing_; }
const Margins& Layout1D::GetMargins() const { return impl_->margins_; }
Margins& Layout1D::GetMutableMargins() { return impl_->margins_; }

void Layout1D::SetSpacing(int spacing) { impl_->spacing_ = spacing; }
void Layout1D::SetMargins(const Margins& margins) { impl_->margins_ = margins; }

void Layout1D::AddFixed(int size) {
AddChild(std::make_shared<Fixed>(size, impl_->dir_));
}
Expand Down
6 changes: 6 additions & 0 deletions cpp/open3d/visualization/gui/Layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ class Layout1D : public Widget {

int GetSpacing() const;
const Margins& GetMargins() const;
/// Sets spacing. Need to signal a relayout after calling (unless it is
/// before a layout that will happen, such as before adding as a child).
void SetSpacing(int spacing);
/// Sets margins. Need to signal a relayout after calling (unless it is
/// before a layout that will happen, such as before adding as a child).
void SetMargins(const Margins& margins);

Size CalcPreferredSize(const Theme& theme) const override;
void Layout(const Theme& theme) override;
Expand Down
Loading

0 comments on commit 125458a

Please sign in to comment.