Commit Graph

1524 Commits

Author SHA1 Message Date
Dalai Felinto
2d1cce8331 Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
Julian Eisel
99be00fdb1 Cleanup: Prepare XR code for sorted headers 2020-03-18 20:53:02 +01:00
Julian Eisel
dc2df8307f VR: Initial Virtual Reality support - Milestone 1, Scene Inspection
NOTE: While most of the milestone 1 goals are there, a few smaller features and
improvements are still to be done.

Big picture of this milestone: Initial, OpenXR-based virtual reality support
for users and foundation for advanced use cases.
Maniphest Task: https://developer.blender.org/T71347
The tasks contains more information about this milestone.

To be clear: This is not a feature rich VR implementation, it's focused on the
initial scene inspection use case. We intentionally focused on that, further
features like controller support are part of the next milestone.

- How to use?
Instructions on how to use this are here:
https://wiki.blender.org/wiki/User:Severin/GSoC-2019/How_to_Test
These will be updated and moved to a more official place (likely the manual) soon.

Currently Windows Mixed Reality and Oculus devices are usable. Valve/HTC
headsets don't support the OpenXR standard yet and hence, do not work with this
implementation.

---------------

This is the C-side implementation of the features added for initial VR
support as per milestone 1. A "VR Scene Inspection" Add-on will be
committed separately, to expose the VR functionality in the UI. It also
adds some further features for milestone 1, namely a landmarking system
(stored view locations in the VR space)

Main additions/features:
* Support for rendering viewports to an HMD, with good performance.
* Option to sync the VR view perspective with a fully interactive,
  regular 3D View (VR-Mirror).
* Option to disable positional tracking. Keeps the current position (calculated
  based on the VR eye center pose) when enabled while a VR session is running.
* Some regular viewport settings for the VR view
* RNA/Python-API to query and set VR session state information.
* WM-XR: Layer tying Ghost-XR to the Blender specific APIs/data
* wmSurface API: drawable, non-window container (manages Ghost-OpenGL and GPU
  context)
* DNA/RNA for management of VR session settings
* `--debug-xr` and `--debug-xr-time` commandline options
* Utility batch & config file for using the Oculus runtime on Windows.
* Most VR data is runtime only. The exception is user settings which are saved
  to files (`XrSessionSettings`).
* VR support can be disabled through the `WITH_XR_OPENXR` compiler flag.

For architecture and code documentation, see
https://wiki.blender.org/wiki/Source/Interface/XR.

---------------

A few thank you's:
* A huge shoutout to Ray Molenkamp for his help during the project - it would
  have not been that successful without him!
* Sebastian Koenig and Simeon Conzendorf for testing and feedback!
* The reviewers, especially Brecht Van Lommel!
* Dalai Felinto for pushing and managing me to get this done ;)
* The OpenXR working group for providing an open standard. I think we're the
  first bigger application to adopt OpenXR. Congratulations to them and
  ourselves :)

This project started as a Google Summer of Code 2019 project - "Core Support of
Virtual Reality Headsets through OpenXR" (see
https://wiki.blender.org/wiki/User:Severin/GSoC-2019/).
Some further information, including ideas for further improvements can be found
in the final GSoC report:
https://wiki.blender.org/wiki/User:Severin/GSoC-2019/Final_Report

Differential Revisions: D6193, D7098

Reviewed by: Brecht Van Lommel, Jeroen Bakker
2020-03-17 21:42:44 +01:00
Julian Eisel
406bfd4304 Ghost: Ghost-XR API to abstract away and access OpenXR functionality
Extends Ghost to include an abstraction for OpenXR, which I refer to as
Ghost-XR. Such an API is the base for the following commit, which introduces VR
support to Blender.

Main features:
* Simple and high-level interface for Blender specific code to call.
* Extensible for muliple graphics backends, currently OpenGL and a DirectX
  compatibility layer are supported.
* Carefully designed error handling strategy allowing Blender to handle errors
  gracefully and with useful error messages.
* OpenXR extension and API-layer management.
* OpenXR session management.
* Basic OpenXR event management.
* Debug utilities for Ghost-XR and OpenXR

For more information on this API, check
https://wiki.blender.org/wiki/Source/Interface/XR.

Reviewed by: Brecht Van Lommel

Differential Revision: https://developer.blender.org/D6188
2020-03-17 21:39:59 +01:00
William Reynish
4031d8bcb7 UI: Fix capitalization in the macOS app menu 2020-03-15 11:16:08 +01:00
Campbell Barton
60e3f690cb Cleanup: sort file lists & struct declatations 2020-03-14 15:39:59 +11:00
Campbell Barton
d195deef5c Cleanup: clang-format 2020-03-11 19:23:52 +11:00
Campbell Barton
1c9829f351 GHOST: tests now build again
GLX gears work as expected, multitest_c only creates windows
but misses font drawing still.
2020-03-11 15:17:27 +11:00
Campbell Barton
15983243a4 Cleanup: remove bitmap font drawing ifdef from MultiTest.c 2020-03-11 15:01:14 +11:00
Dalai Felinto
96e2bd8493 Cleanup: Fix forward declaration of headers 2020-03-06 17:26:32 +01:00
Campbell Barton
0b16b63d87 Cleanup: spelling 2020-03-07 00:19:01 +11:00
Julian Eisel
c72317943b Attempt to fix build errors on macOS
Mistake in 5be0e3430d13
2020-03-06 11:43:13 +01:00
Campbell Barton
5be0e3430d GHOST/Keymap: support for detecting repeat events
- Keymap items now have 'repeat' boolean which can be set
  to make keymap items respond to key repeat events or not.
- Support for X11 & WIN32 (not macOS currently).

This allows for the possibility to perform actions while a key is held
and finish the action upon release.

Thanks to @Severin for review and WIN32 support.
2020-03-06 17:31:28 +11:00
Julian Eisel
3b1ef223ba Ghost: Support drawing OpenGL framebuffers into a DirectX 11 buffer
Adds a minimal DirectX 11 Ghost context, plus some shared DirectX-OpenGL
resource interface using the NV_DX_interop2 WGL extension. From what I
know, this should be available on modern GPUs. If not, it should fail
gracefully.
There should be no user visible changes at this point.

Needed for DirectX-only OpenXR platforms (e.g. Windows Mixed Reality). I
heard there are other use-cases as well though.

It's known that this currently fails on some AMD systems, but that seems
to be fixable.

Most of this comes from the 2019 GSoC project, "Core Support of Virtual
Reality Headsets through OpenXR"
(https://wiki.blender.org/wiki/User:Severin/GSoC-2019/).

Reviewed by: Jeroen Bakker, Ray Molenkam, Brecht van Lommel

Differential Revision: https://developer.blender.org/D6190
2020-03-05 18:29:29 +01:00
Campbell Barton
5a6a6ef0c6 Cleanup: spelling 2020-02-26 15:22:46 +11:00
Bastien Montagne
d119e163d0 Fix many typos and other issues in UI messages. 2020-02-17 13:01:07 +01:00
Aaron Carlisle
e0499387ca GHOST: Init New Windows with a closer theme color
The user theme is loaded after window creation so we should create the 
window with a color that at least matches the default theme.

Differential Revision: https://developer.blender.org/D6858
2020-02-15 12:44:52 -05:00
f0c991a380 Cleanup: work around clang-format differences between versions
Ref T73747
2020-02-15 14:03:51 +01:00
Campbell Barton
7d90ff08f3 Fix incorrect enum in GHOST test 2020-02-15 10:40:42 +11:00
Ray Molenkamp
75a5ea01c1 Cleanup/MSVC: Enable C++ conformance mode on compiler versions that support it.
MSVC has a conformance mode (/permissive-) where the C++ standard is more strictly
enforced. This mode is available on MSVC 15.5+ [1]

This patch enables this mode on compilers that support it and cleans up the few violations it threw up in the process.

- Mantaflow was using M_PI without requesting them using the _USE_MATH_DEFINES define to opt in to non default behaviour.
- Collada did not include the right header for std::cerr, this seemingly was fixed for other platforms already but put inside a platform guard.
- Ghost had some scoping issues regarding uninitialized variables and goto behaviour

Second landing of this patch, earlier commit was reverted due to some compiler configurations having slipped though testing

[1] https://docs.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance

Differential Revision: https://developer.blender.org/D6824

Reviewed By: brecht
2020-02-13 17:13:07 -07:00
Ray Molenkamp
6022cd015f Revert "Cleanup/MSVC: Enable C++ conformance mode on compiler versions that support it."
It is breaking compilation on some configurations, revert for now while
i see what is wrong.

This reverts commit 9fe469c110940af5d2525158305d5d365bd15276.
2020-02-13 07:04:30 -07:00
Ray Molenkamp
9fe469c110 Cleanup/MSVC: Enable C++ conformance mode on compiler versions that support it.
MSVC has a conformance mode (/permissive-) where the C++ standard is more strictly
enforced. This mode is available on MSVC 15.5+ [1]

This patch enables this mode on compilers that support it and cleans up the few violations it threw up in the process.

- Mantaflow was using M_PI without requesting them using the _USE_MATH_DEFINES define to opt in to non default behaviour.
- Collada did not include the right header for std::cerr, this seemingly was fixed for other platforms already but put inside a platform guard.
- Ghost had some scoping issues regarding uninitialized variables and goto behaviour

[1] https://docs.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance

Differential Revision: https://developer.blender.org/D6824

Reviewed By: brecht
2020-02-12 12:49:34 -07:00
Yevgeny Makarov
2fb9285371 Fix T70039, T68707: issues when opening .blend file from Finder on macOS
* Missing close dialog displayed to warn about unsaved changes.
* No reaction when the file was opened on a different desktop.

Differential Revision: https://developer.blender.org/D6765
2020-02-11 17:45:02 +01:00
Yevgeny Makarov
bf361fc9a0 Fix T64024: monitor/fullscreen switching on macOS shows red line artifacts 2020-02-11 15:30:30 +01:00
Campbell Barton
cdfaddbb1d Cleanup: spelling 2020-02-10 10:33:00 +11:00
Campbell Barton
f48e876459 Cleanup: clang-format 2020-02-02 11:47:49 +11:00
f9d09a1209 Merge branch 'blender-v2.82-release' 2020-01-31 19:26:20 +01:00
Yevgeny Makarov
5780142679 Fix T64024: fullscreen switching on macOS shows red line artifacts
Specifically, this happened when automatically hiding and showing of the
menu bar and dock was enabled in the system preferences.

Differential Revision: https://developer.blender.org/D6710
2020-01-31 18:40:45 +01:00
Nicholas Rishel
4633bb9939 Cleanup: enforce immutability through const, instead of a comment
Differential Revision: https://developer.blender.org/D6504
2020-01-31 17:48:26 +01:00
Yevgeny Makarov
773beec541 macOS: add trackpad smart zoom event support
This is done with two-finger double tap on trackpads, and is usually used to
zoom into an element under the cursor.

It can now be used for toggling local view in the 3D viewport.

Differential Revision: https://developer.blender.org/D6588
2020-01-28 11:35:18 +01:00
Christian Rauch
bb65f49005 Linux: update EGL context code to fully work, including offscreen rendering
This is a step towards Wayland and headless rendering support, using EGL
instead of GLX. The EGL backend is not enabled by default, it can be tested
using WITH_GL_EGL=ON.

Differential Revision: https://developer.blender.org/D6585
2020-01-28 10:59:42 +01:00
Harley Acheson
22ca8b8aee UI: Win32 - Restore Minimized App On WM_Close
Changes needed for Windows 10 to restore and show close dialog from minimized state.

https://developer.blender.org/D5107

Reviewed by Brecht Van Lommel
2020-01-27 10:41:39 -08:00
mano-wii
67f3941dd5 Merge branch 'blender-v2.82-release' 2020-01-27 14:17:51 -03:00
Yevgeny Makarov
f4f57ed21a Fix part of T65404: quit dialog doesn't show if Blender is minimized
This solves the problem for macOS and Linux, but not Windows yet.

Differential Revision: https://developer.blender.org/D6673
2020-01-27 17:38:21 +01:00
Sergey Sharybin
6fff73e3f0 Merge branch 'blender-v2.82-release' 2020-01-23 16:59:50 +01:00
Sergey Sharybin
517870a4a1 CMake: Refactor external dependencies handling
This is a more correct fix to the issue Brecht was fixing in D6600.

While the fix in that patch worked fine for linking it broke ASAN
runtime under some circumstances.
For example, `make full debug developer` would compile, but trying
to start blender will cause assert failure in ASAN (related on check
that ASAN is not running already).

Top-level idea: leave it to CMake to keep track of dependency graph.

The root of the issue comes to the fact that target like "blender" is
configured to use a lot of static libraries coming from Blender sources
and to use external static libraries. There is nothing which ensures
order between blender's and external libraries. Only order of blender
libraries is guaranteed.

It was possible that due to a cycle or other circumstances some of
blender libraries would have been passed to linker after libraries
it uses, causing linker errors.

For example, this order will likely fail:

  libbf_blenfont.a libfreetype6.a libbf_blenfont.a

This change makes it so blender libraries are explicitly provided
their dependencies to an external libraries, which allows CMake to
ensure they are always linked against them.

General rule here: if bf_foo depends on an external library it is
to be provided to LIBS for bf_foo.
For example, if bf_blenkernel depends on opensubdiv then LIBS in
blenkernel's CMakeLists.txt is to include OPENSUBDIB_LIBRARIES.

The change is made based on searching for used include folders
such as OPENSUBDIV_INCLUDE_DIRS and adding corresponding libraries
to LIBS ion that CMakeLists.txt. Transitive dependencies are not
simplified by this approach, but I am not aware of any downside of
this: CMake should be smart enough to simplify them on its side.
And even if not, this shouldn't affect linking time.

Benefit of not relying on transitive dependencies is that build
system is more robust towards future changes. For example, if
bf_intern_opensubiv is no longer depends on OPENSUBDIV_LIBRARIES
and all such code is moved to bf_blenkernel this will not break
linking.

The not-so-trivial part is change to blender_add_lib (and its
version in Cycles). The complexity is caused by libraries being
provided as a single list argument which doesn't allow to use
different release and debug libraries on Windows. The idea is:

- Have every library prefixed as "optimized" or "debug" if
  separation is needed (non-prefixed libraries will be considered
  "generic").

- Loop through libraries passed to function and do simple parsing
  which will look for "optimized" and "debug" words and specify
  following library to corresponding category.

This isn't something particularly great. Alternative would be to
use target_link_libraries() directly, which sounds like more code
but which is more explicit and allows to have more flexibility
and control comparing to wrapper approach.

Tested the following configurations on Linux, macOS and Windows:

- make full debug developer
- make full release developer
- make lite debug developer
- make lite release developer

NOTE: Linux libraries needs to be compiled with D6641 applied,
otherwise, depending on configuration, it's possible to run into
duplicated zlib symbols error.

Differential Revision: https://developer.blender.org/D6642
2020-01-23 16:59:18 +01:00
2e9d5ba211 GHOST: bundle tablet data with GHOST event
Previously the window manager would receive the GHOST event and then query the
latest tablet data from the window to go along with it. If multiple events were
queued, it would then use too new tablet data for handling older events.

Fixes T62565: tablet pressure not working on macOS with some devices
2020-01-21 12:24:01 +01:00
db33867270 Fix T71952, T70125: Blender Linux crash on startup with some tablets
It's not certain this fixes the issue since I can't reproduce the crash, but
the code was wrong in any case.

Thanks to Ray Molenkamp and Anonymous for finding this.
2020-01-16 16:14:57 +01:00
Jean First
6c2eeba0c7 Fix T72382: Arrow keys fail in search menu 2019-12-24 07:55:38 +11:00
Harley Acheson
b7533f92e5 GHOST: add support for application/menu key
Support the application key on Linux & Windows.
2019-12-10 17:13:02 +11:00
dd4b98133e Fix T71342: macOS does not always use the discrete GPU for Blender
This reverts commit 3d9cc4d3f174d01c96d65a4e9cd751699bcb8744. The commit
message and intent behind the commit is unclear. We generally want the
discrete GPU to be used for best performance, not the integrated GPU.
2019-12-06 19:21:02 +01:00
Campbell Barton
eeaf452381 Cleanup: clang-format 2019-12-07 01:35:53 +11:00
Harley Acheson
601eafd104 Fix T72118: Enable Windows 10 Non-client DPI Scaling
Enables Windows 10 feature that automatically adjusts non-client area (title bar) on high-DPI displays.

Differential Revision: https://developer.blender.org/D6370

Reviewed by Brecht Van Lommel
2019-12-05 16:50:30 -08:00
Ray Molenkamp
61a02a7aa1 Cleanup: Windows Manifest usage.
We had a manifest file, but it was seemingly not used, some
settings were done using linker pragmas, some of them visual
studio would set by default for us, others where not set at all.

This patch changes:

- Single manifest file where we can maintain all settings in
a single location, removal of any linker pragmas related to
the manifest.

- Compatibly settings for win vista - win10, without this any
call to any of the GetVersion and related functions (GetVersionEx,
VerifyVersionInfo, IsWindowsXxxx) will by default say we are
on vista and OS specific optimizations in external libraries may
be missed.

-Rather than having it in the .RC file in an #ifdef which may
or may not trigger depending on the build tool used, we tell
cmake to treat it as a source file and it will do the right
thing for both the ninja and visual studio generators.

Differential Revision: https://developer.blender.org/D6136

Reviewers: brecht
2019-12-05 12:15:04 -07:00
Campbell Barton
249f4423ee Cleanup: doxygen comments
Also correct some outdated symbol references,
add missing 'name' commands.
2019-11-25 01:51:11 +11:00
Campbell Barton
ace5677ef0 Cleanup: spelling, repeated words 2019-11-25 00:55:11 +11:00
Sergey Sharybin
8d4460b6c4 GHOST: Only spam about X11 errors when using --debug-ghost
This commit adds a new command line argument --debug-ghost and
makes it so X11 errors happening during context initialization
are only printed when this new flag is sued.

There is no need to flood users with errors when their GPU is
not supporting latest OpenGL version. Or, at a very minimum,
the error must be more meaning full.

Differential Revision: https://developer.blender.org/D6057
2019-11-18 09:28:17 +01:00
Alexander Gavrilov
e385bdb228 Fix a bug in the T34039 hack in case when a modifier key is not mapped.
In order to recover from a transient Focus Out - Focus In disruption
in the middle of a shortcut, which can be caused by certain window
managers, Blender has code that checks which modifier keys are pressed
after Focus In and restores the modifier state based on that.

If one of the Ctrl, Shift, Alt, Super keys is not mapped anywhere
in the active keyboard layout, XKeysymToKeycode returns the invalid
zero keycode, and reading the key state produces garbage, which can
cause an invalid modifier state. Check the return value to avoid this.
2019-11-16 11:56:38 +03:00
Julian Eisel
97f3626533 Merge branch 'blender-v2.81-release' 2019-11-15 16:34:46 +01:00
Julian Eisel
f641c60530 Fix T70991: Maximized file browser hides file name bar on Windows
`WS_CHILD` is a different kind of child window that what we define as
child window. See http://forums.codeguru.com/showthread.php?491604.

Setting this style flag seems to mess things up a bit in our
configuration. The name bar is actually being overlapped by the Windows
task bar then. Not totally sure why this happens, but I think it's
because windows with the `WS_CHILD` style are positioned relative to the
parent, not the desktop (screen without taskbar). So it uses the full
space available when maximized, which isn't clipped by the taskbar
anymore.
2019-11-15 16:34:09 +01:00