2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2008 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup spview3d
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
|
2022-09-28 11:52:22 +02:00
|
|
|
/* Allow using deprecated functionality for .blend file I/O. */
|
|
|
|
|
#define DNA_DEPRECATED_ALLOW
|
|
|
|
|
|
2022-10-05 13:44:02 -05:00
|
|
|
#include <cstring>
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2023-07-04 14:46:19 +02:00
|
|
|
#include "AS_asset_representation.hh"
|
2023-06-09 15:17:48 +02:00
|
|
|
|
2022-04-01 16:41:52 +02:00
|
|
|
#include "DNA_collection_types.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "DNA_defaults.h"
|
2024-04-24 17:01:22 +02:00
|
|
|
#include "DNA_gpencil_legacy_types.h"
|
2018-07-11 16:54:10 +02:00
|
|
|
#include "DNA_lightprobe_types.h"
|
2008-01-07 18:03:41 +00:00
|
|
|
#include "DNA_object_types.h"
|
|
|
|
|
#include "DNA_scene_types.h"
|
2021-10-15 11:42:21 +02:00
|
|
|
#include "DNA_view3d_types.h"
|
2008-01-07 18:03:41 +00:00
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
2025-02-11 16:59:42 +01:00
|
|
|
#include "BLI_listbase.h"
|
Cleanup: reduce amount of math-related includes
Using ClangBuildAnalyzer on the whole Blender build, it was pointing
out that BLI_math.h is the heaviest "header hub" (i.e. non tiny file
that is included a lot).
However, there's very little (actually zero) source files in Blender
that need "all the math" (base, colors, vectors, matrices,
quaternions, intersection, interpolation, statistics, solvers and
time). A common use case is source files needing just vectors, or
just vectors & matrices, or just colors etc. Actually, 181 files
were including the whole math thing without needing it at all.
This change removes BLI_math.h completely, and instead in all the
places that need it, includes BLI_math_vector.h or BLI_math_color.h
and so on.
Change from that:
- BLI_math_color.h was included 1399 times -> now 408 (took 114.0sec
to parse -> now 36.3sec)
- BLI_simd.h 1403 -> 418 (109.7sec -> 34.9sec).
Full rebuild of Blender (Apple M1, Xcode, RelWithDebInfo) is not
affected much (342sec -> 334sec). Most of benefit would be when
someone's changing BLI_simd.h or BLI_math_color.h or similar files,
that now there's 3x fewer files result in a recompile.
Pull Request #110944
2023-08-09 11:39:20 +03:00
|
|
|
#include "BLI_math_matrix.h"
|
|
|
|
|
#include "BLI_math_vector.h"
|
2023-11-27 16:14:49 +01:00
|
|
|
#include "BLI_math_vector.hh"
|
2025-01-16 23:17:51 +01:00
|
|
|
#include "BLI_string.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2024-02-09 18:59:42 +01:00
|
|
|
#include "BLT_translation.hh"
|
2020-09-06 18:35:27 +10:00
|
|
|
|
2023-11-16 11:41:55 +01:00
|
|
|
#include "BKE_asset.hh"
|
|
|
|
|
#include "BKE_context.hh"
|
2024-02-10 18:25:14 +01:00
|
|
|
#include "BKE_global.hh"
|
2023-03-13 10:42:51 +01:00
|
|
|
#include "BKE_gpencil_legacy.h"
|
2024-03-26 12:57:30 -04:00
|
|
|
#include "BKE_idprop.hh"
|
2024-01-23 15:18:09 -05:00
|
|
|
#include "BKE_layer.hh"
|
2024-01-15 12:44:04 -05:00
|
|
|
#include "BKE_lib_id.hh"
|
2024-01-18 12:20:42 +01:00
|
|
|
#include "BKE_lib_query.hh"
|
2023-11-30 19:51:22 +01:00
|
|
|
#include "BKE_lib_remap.hh"
|
2025-02-07 17:47:16 +01:00
|
|
|
#include "BKE_library.hh"
|
2023-12-01 19:43:16 +01:00
|
|
|
#include "BKE_main.hh"
|
2023-10-09 23:41:53 +02:00
|
|
|
#include "BKE_object.hh"
|
2024-02-10 19:16:25 +01:00
|
|
|
#include "BKE_scene.hh"
|
2023-09-25 17:48:21 -04:00
|
|
|
#include "BKE_screen.hh"
|
2023-11-16 11:41:55 +01:00
|
|
|
#include "BKE_viewer_path.hh"
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2024-01-26 15:23:10 -05:00
|
|
|
#include "ED_asset_shelf.hh"
|
2023-08-05 02:57:52 +02:00
|
|
|
#include "ED_geometry.hh"
|
|
|
|
|
#include "ED_object.hh"
|
|
|
|
|
#include "ED_outliner.hh"
|
|
|
|
|
#include "ED_render.hh"
|
2023-08-04 23:11:22 +02:00
|
|
|
#include "ED_screen.hh"
|
2023-08-05 02:57:52 +02:00
|
|
|
#include "ED_space_api.hh"
|
|
|
|
|
#include "ED_transform.hh"
|
|
|
|
|
#include "ED_undo.hh"
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2024-03-23 01:24:18 +01:00
|
|
|
#include "GPU_matrix.hh"
|
2010-03-09 06:20:08 +00:00
|
|
|
|
2024-01-05 11:16:57 -05:00
|
|
|
#include "DRW_engine.hh"
|
2018-02-26 19:41:17 +01:00
|
|
|
|
2023-08-04 23:11:22 +02:00
|
|
|
#include "WM_api.hh"
|
|
|
|
|
#include "WM_message.hh"
|
2024-01-04 14:30:21 -05:00
|
|
|
#include "WM_toolsystem.hh"
|
2023-08-04 23:11:22 +02:00
|
|
|
#include "WM_types.hh"
|
2008-12-12 18:47:12 +00:00
|
|
|
|
2023-08-10 22:40:27 +02:00
|
|
|
#include "RNA_access.hh"
|
2009-03-19 19:03:38 +00:00
|
|
|
|
2023-08-05 02:57:52 +02:00
|
|
|
#include "UI_interface.hh"
|
|
|
|
|
#include "UI_resources.hh"
|
2010-05-09 18:07:17 +00:00
|
|
|
|
2023-08-28 15:01:05 +02:00
|
|
|
#include "BLO_read_write.hh"
|
2022-09-28 11:52:22 +02:00
|
|
|
|
2013-12-17 18:44:56 +11:00
|
|
|
#ifdef WITH_PYTHON
|
2024-09-24 17:07:49 +02:00
|
|
|
# include "BPY_extern.hh"
|
2013-12-17 18:44:56 +11:00
|
|
|
#endif
|
|
|
|
|
|
2023-09-22 03:18:17 +02:00
|
|
|
#include "DEG_depsgraph.hh"
|
|
|
|
|
#include "DEG_depsgraph_build.hh"
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
|
2024-03-26 20:34:48 -04:00
|
|
|
#include "view3d_intern.hh" /* own include */
|
2023-07-10 21:48:38 +02:00
|
|
|
#include "view3d_navigate.hh"
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2009-02-10 15:38:00 +00:00
|
|
|
/* ******************** manage regions ********************* */
|
|
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
bool ED_view3d_area_user_region(const ScrArea *area, const View3D *v3d, ARegion **r_region)
|
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 20:20:55 +01:00
|
|
|
{
|
2022-09-23 16:51:29 +02:00
|
|
|
RegionView3D *rv3d = nullptr;
|
|
|
|
|
ARegion *region_unlock_user = nullptr;
|
|
|
|
|
ARegion *region_unlock = nullptr;
|
2020-04-03 13:25:03 +02:00
|
|
|
const ListBase *region_list = (v3d == area->spacedata.first) ? &area->regionbase :
|
|
|
|
|
&v3d->regionbase;
|
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 20:20:55 +01:00
|
|
|
|
|
|
|
|
BLI_assert(v3d->spacetype == SPACE_VIEW3D);
|
|
|
|
|
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (ARegion *, region, region_list) {
|
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 20:20:55 +01:00
|
|
|
/* find the first unlocked rv3d */
|
|
|
|
|
if (region->regiondata && region->regiontype == RGN_TYPE_WINDOW) {
|
2022-09-23 16:51:29 +02:00
|
|
|
rv3d = static_cast<RegionView3D *>(region->regiondata);
|
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 20:20:55 +01:00
|
|
|
if ((rv3d->viewlock & RV3D_LOCK_ROTATION) == 0) {
|
2020-04-03 12:51:03 +02:00
|
|
|
region_unlock = region;
|
2020-11-06 12:30:59 +11:00
|
|
|
if (ELEM(rv3d->persp, RV3D_PERSP, RV3D_CAMOB)) {
|
2020-04-03 12:51:03 +02:00
|
|
|
region_unlock_user = region;
|
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 20:20:55 +01:00
|
|
|
break;
|
2012-01-14 12:24:25 +00:00
|
|
|
}
|
2011-04-28 08:26:49 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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 20:20:55 +01:00
|
|
|
/* camera/perspective view get priority when the active region is locked */
|
2020-04-03 12:51:03 +02:00
|
|
|
if (region_unlock_user) {
|
|
|
|
|
*r_region = region_unlock_user;
|
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 20:20:55 +01:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-03 12:51:03 +02:00
|
|
|
if (region_unlock) {
|
|
|
|
|
*r_region = region_unlock;
|
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 20:20:55 +01:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-20 23:14:18 +00:00
|
|
|
return false;
|
2011-04-28 08:26:49 +00:00
|
|
|
}
|
|
|
|
|
|
2023-06-03 08:36:28 +10:00
|
|
|
void ED_view3d_init_mats_rv3d(const Object *ob, RegionView3D *rv3d)
|
2009-10-11 19:57:56 +00:00
|
|
|
{
|
|
|
|
|
/* local viewmat and persmat, to calculate projections */
|
2024-02-14 16:14:49 +01:00
|
|
|
mul_m4_m4m4(rv3d->viewmatob, rv3d->viewmat, ob->object_to_world().ptr());
|
|
|
|
|
mul_m4_m4m4(rv3d->persmatob, rv3d->persmat, ob->object_to_world().ptr());
|
2010-02-01 15:32:55 +00:00
|
|
|
|
2011-06-09 03:56:32 +00:00
|
|
|
/* initializes object space clipping, speeds up clip tests */
|
2024-02-14 16:14:49 +01:00
|
|
|
ED_view3d_clipping_local(rv3d, ob->object_to_world().ptr());
|
2011-06-09 03:56:32 +00:00
|
|
|
}
|
|
|
|
|
|
2023-06-03 08:36:28 +10:00
|
|
|
void ED_view3d_init_mats_rv3d_gl(const Object *ob, RegionView3D *rv3d)
|
2011-06-09 03:56:32 +00:00
|
|
|
{
|
|
|
|
|
ED_view3d_init_mats_rv3d(ob, rv3d);
|
|
|
|
|
|
2022-09-25 15:24:37 +10:00
|
|
|
/* We have to multiply instead of loading `viewmatob` to make
|
|
|
|
|
* it work with duplis using display-lists, otherwise it will
|
|
|
|
|
* override the dupli-matrix. */
|
2024-02-14 16:14:49 +01:00
|
|
|
GPU_matrix_mul(ob->object_to_world().ptr());
|
2009-10-11 19:57:56 +00:00
|
|
|
}
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
|
2023-12-04 15:13:06 +01:00
|
|
|
#ifndef NDEBUG
|
2023-09-08 08:27:17 -04:00
|
|
|
void ED_view3d_clear_mats_rv3d(RegionView3D *rv3d)
|
2013-05-08 13:00:52 +00:00
|
|
|
{
|
|
|
|
|
zero_m4(rv3d->viewmatob);
|
|
|
|
|
zero_m4(rv3d->persmatob);
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-08 08:27:17 -04:00
|
|
|
void ED_view3d_check_mats_rv3d(RegionView3D *rv3d)
|
2013-05-08 13:00:52 +00:00
|
|
|
{
|
|
|
|
|
BLI_ASSERT_ZERO_M4(rv3d->viewmatob);
|
|
|
|
|
BLI_ASSERT_ZERO_M4(rv3d->persmatob);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
void ED_view3d_stop_render_preview(wmWindowManager *wm, ARegion *region)
|
2013-12-05 15:22:55 +09:00
|
|
|
{
|
2022-09-23 16:51:29 +02:00
|
|
|
RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
|
2013-12-05 15:22:55 +09:00
|
|
|
|
2023-07-18 17:17:48 +02:00
|
|
|
if (rv3d->view_render) {
|
2013-12-17 18:44:56 +11:00
|
|
|
#ifdef WITH_PYTHON
|
|
|
|
|
BPy_BEGIN_ALLOW_THREADS;
|
|
|
|
|
#endif
|
|
|
|
|
|
2024-06-21 13:34:14 +02:00
|
|
|
WM_jobs_kill_type(wm, nullptr, WM_JOB_TYPE_RENDER_PREVIEW);
|
2013-12-17 18:44:56 +11:00
|
|
|
|
|
|
|
|
#ifdef WITH_PYTHON
|
|
|
|
|
BPy_END_ALLOW_THREADS;
|
|
|
|
|
#endif
|
|
|
|
|
|
2023-10-03 16:01:33 +02:00
|
|
|
DRW_engine_external_free(rv3d);
|
2013-12-05 15:22:55 +09:00
|
|
|
}
|
2020-04-27 21:13:53 +02:00
|
|
|
|
|
|
|
|
/* A bit overkill but this make sure the viewport is reset completely. (fclem) */
|
2023-10-30 12:40:00 +01:00
|
|
|
WM_draw_region_free(region);
|
2013-12-05 15:22:55 +09:00
|
|
|
}
|
|
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
void ED_view3d_shade_update(Main *bmain, View3D *v3d, ScrArea *area)
|
2013-10-04 12:30:00 +00:00
|
|
|
{
|
2022-09-23 16:51:29 +02:00
|
|
|
wmWindowManager *wm = static_cast<wmWindowManager *>(bmain->wm.first);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-11 14:20:39 +02:00
|
|
|
if (v3d->shading.type != OB_RENDER) {
|
2023-08-04 08:51:13 +10:00
|
|
|
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
|
2020-03-06 16:56:42 +01:00
|
|
|
if ((region->regiontype == RGN_TYPE_WINDOW) && region->regiondata) {
|
|
|
|
|
ED_view3d_stop_render_preview(wm, region);
|
2018-06-15 14:58:45 +02:00
|
|
|
}
|
2013-10-04 12:30:00 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
/* ******************** default callbacks for view3d space ***************** */
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static SpaceLink *view3d_create(const ScrArea * /*area*/, const Scene *scene)
|
2008-01-07 18:03:41 +00:00
|
|
|
{
|
2020-03-06 16:56:42 +01:00
|
|
|
ARegion *region;
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
View3D *v3d;
|
|
|
|
|
RegionView3D *rv3d;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-09-12 06:48:13 +10:00
|
|
|
v3d = DNA_struct_default_alloc(View3D);
|
|
|
|
|
|
2012-02-22 16:52:06 +00:00
|
|
|
if (scene) {
|
2012-03-25 23:54:33 +00:00
|
|
|
v3d->camera = scene->camera;
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-09-28 14:44:36 +10:00
|
|
|
/* header */
|
2024-11-15 02:00:11 +01:00
|
|
|
region = BKE_area_region_new();
|
2019-04-18 21:13:22 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
BLI_addtail(&v3d->regionbase, region);
|
2021-09-28 14:44:36 +10:00
|
|
|
region->regiontype = RGN_TYPE_HEADER;
|
2020-03-06 16:56:42 +01:00
|
|
|
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
2019-04-18 21:13:22 +02:00
|
|
|
|
2021-09-28 14:44:36 +10:00
|
|
|
/* tool header */
|
2024-11-15 02:00:11 +01:00
|
|
|
region = BKE_area_region_new();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
BLI_addtail(&v3d->regionbase, region);
|
2021-09-28 14:44:36 +10:00
|
|
|
region->regiontype = RGN_TYPE_TOOL_HEADER;
|
2020-03-06 16:56:42 +01:00
|
|
|
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
2021-09-28 14:44:36 +10:00
|
|
|
region->flag = RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-08-03 16:58:37 +02:00
|
|
|
/* asset shelf */
|
2024-11-15 02:00:11 +01:00
|
|
|
region = BKE_area_region_new();
|
2023-08-03 16:58:37 +02:00
|
|
|
|
|
|
|
|
BLI_addtail(&v3d->regionbase, region);
|
|
|
|
|
region->regiontype = RGN_TYPE_ASSET_SHELF;
|
|
|
|
|
region->alignment = RGN_ALIGN_BOTTOM;
|
2023-10-30 18:02:51 +01:00
|
|
|
region->flag |= RGN_FLAG_HIDDEN;
|
2023-08-03 16:58:37 +02:00
|
|
|
|
|
|
|
|
/* asset shelf header */
|
2024-11-15 02:00:11 +01:00
|
|
|
region = BKE_area_region_new();
|
2023-08-03 16:58:37 +02:00
|
|
|
BLI_addtail(&v3d->regionbase, region);
|
|
|
|
|
region->regiontype = RGN_TYPE_ASSET_SHELF_HEADER;
|
2023-10-31 15:01:21 +01:00
|
|
|
region->alignment = RGN_ALIGN_BOTTOM | RGN_ALIGN_HIDE_WITH_PREV;
|
2023-08-03 16:58:37 +02:00
|
|
|
|
2010-01-12 07:50:14 +00:00
|
|
|
/* tool shelf */
|
2024-11-15 02:00:11 +01:00
|
|
|
region = BKE_area_region_new();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
BLI_addtail(&v3d->regionbase, region);
|
|
|
|
|
region->regiontype = RGN_TYPE_TOOLS;
|
|
|
|
|
region->alignment = RGN_ALIGN_LEFT;
|
|
|
|
|
region->flag = RGN_FLAG_HIDDEN;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-02-10 15:38:00 +00:00
|
|
|
/* buttons/list view */
|
2024-11-15 02:00:11 +01:00
|
|
|
region = BKE_area_region_new();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
BLI_addtail(&v3d->regionbase, region);
|
|
|
|
|
region->regiontype = RGN_TYPE_UI;
|
|
|
|
|
region->alignment = RGN_ALIGN_RIGHT;
|
|
|
|
|
region->flag = RGN_FLAG_HIDDEN;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-11-28 17:14:45 +01:00
|
|
|
/* main region */
|
2024-11-15 02:00:11 +01:00
|
|
|
region = BKE_area_region_new();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
BLI_addtail(&v3d->regionbase, region);
|
|
|
|
|
region->regiontype = RGN_TYPE_WINDOW;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-09-23 16:51:29 +02:00
|
|
|
region->regiondata = MEM_cnew<RegionView3D>("region view3d");
|
|
|
|
|
rv3d = static_cast<RegionView3D *>(region->regiondata);
|
2012-03-25 23:54:33 +00:00
|
|
|
rv3d->viewquat[0] = 1.0f;
|
|
|
|
|
rv3d->persp = RV3D_PERSP;
|
2015-10-23 04:54:07 +11:00
|
|
|
rv3d->view = RV3D_VIEW_USER;
|
2012-03-25 23:54:33 +00:00
|
|
|
rv3d->dist = 10.0;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
return (SpaceLink *)v3d;
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
|
|
2023-06-09 11:39:27 +10:00
|
|
|
/* Doesn't free the space-link itself. */
|
2008-01-07 18:03:41 +00:00
|
|
|
static void view3d_free(SpaceLink *sl)
|
|
|
|
|
{
|
2012-03-25 23:54:33 +00:00
|
|
|
View3D *vd = (View3D *)sl;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (vd->localvd) {
|
|
|
|
|
MEM_freeN(vd->localvd);
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2025-02-20 10:37:10 +01:00
|
|
|
/* Cannot use MEM_SAFE_FREE, as #SceneStats type is only forward-declared in `DNA_layer_types.h`
|
|
|
|
|
*/
|
|
|
|
|
if (vd->runtime.local_stats) {
|
|
|
|
|
MEM_freeN(static_cast<void *>(vd->runtime.local_stats));
|
|
|
|
|
vd->runtime.local_stats = nullptr;
|
|
|
|
|
}
|
2021-06-15 19:01:53 -07:00
|
|
|
|
2023-08-25 18:36:04 +02:00
|
|
|
if (vd->runtime.properties_storage_free) {
|
|
|
|
|
vd->runtime.properties_storage_free(vd->runtime.properties_storage);
|
|
|
|
|
vd->runtime.properties_storage_free = nullptr;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-09-05 12:47:20 +02:00
|
|
|
if (vd->shading.prop) {
|
|
|
|
|
IDP_FreeProperty(vd->shading.prop);
|
2022-09-23 16:51:29 +02:00
|
|
|
vd->shading.prop = nullptr;
|
2019-09-05 12:47:20 +02:00
|
|
|
}
|
Geometry Nodes: viewport preview
This adds support for showing geometry passed to the Viewer in the 3d
viewport (instead of just in the spreadsheet). The "viewer geometry"
bypasses the group output. So it is not necessary to change the final
output of the node group to be able to see the intermediate geometry.
**Activation and deactivation of a viewer node**
* A viewer node is activated by clicking on it.
* Ctrl+shift+click on any node/socket connects it to the viewer and
makes it active.
* Ctrl+shift+click in empty space deactivates the active viewer.
* When the active viewer is not visible anymore (e.g. another object
is selected, or the current node group is exit), it is deactivated.
* Clicking on the icon in the header of the Viewer node toggles whether
its active or not.
**Pinning**
* The spreadsheet still allows pinning the active viewer as before.
When pinned, the spreadsheet still references the viewer node even
when it becomes inactive.
* The viewport does not support pinning at the moment. It always shows
the active viewer.
**Attribute**
* When a field is linked to the second input of the viewer node it is
displayed as an overlay in the viewport.
* When possible the correct domain for the attribute is determined
automatically. This does not work in all cases. It falls back to the
face corner domain on meshes and the point domain on curves. When
necessary, the domain can be picked manually.
* The spreadsheet now only shows the "Viewer" column for the domain
that is selected in the Viewer node.
* Instance attributes are visualized as a constant color per instance.
**Viewport Options**
* The attribute overlay opacity can be controlled with the "Viewer Node"
setting in the overlays popover.
* A viewport can be configured not to show intermediate viewer-geometry
by disabling the "Viewer Node" option in the "View" menu.
**Implementation Details**
* The "spreadsheet context path" was generalized to a "viewer path" that
is used in more places now.
* The viewer node itself determines the attribute domain, evaluates the
field and stores the result in a `.viewer` attribute.
* A new "viewer attribute' overlay displays the data from the `.viewer`
attribute.
* The ground truth for the active viewer node is stored in the workspace
now. Node editors, spreadsheets and viewports retrieve the active
viewer from there unless they are pinned.
* The depsgraph object iterator has a new "viewer path" setting. When set,
the viewed geometry of the corresponding object is part of the iterator
instead of the final evaluated geometry.
* To support the instance attribute overlay `DupliObject` was extended
to contain the information necessary for drawing the overlay.
* The ctrl+shift+click operator has been refactored so that it can make
existing links to viewers active again.
* The auto-domain-detection in the Viewer node works by checking the
"preferred domain" for every field input. If there is not exactly one
preferred domain, the fallback is used.
Known limitations:
* Loose edges of meshes don't have the attribute overlay. This could be
added separately if necessary.
* Some attributes are hard to visualize as a color directly. For example,
the values might have to be normalized or some should be drawn as arrays.
For now, we encourage users to build node groups that generate appropriate
viewer-geometry. We might include some of that functionality in future versions.
Support for displaying attribute values as text in the viewport is planned as well.
* There seems to be an issue with the attribute overlay for pointclouds on
nvidia gpus, to be investigated.
Differential Revision: https://developer.blender.org/D15954
2022-09-28 17:54:59 +02:00
|
|
|
|
|
|
|
|
BKE_viewer_path_clear(&vd->viewer_path);
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* spacetype; init callback */
|
2023-03-29 16:50:54 +02:00
|
|
|
static void view3d_init(wmWindowManager * /*wm*/, ScrArea * /*area*/) {}
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void view3d_exit(wmWindowManager * /*wm*/, ScrArea *area)
|
2021-06-15 19:01:53 -07:00
|
|
|
{
|
|
|
|
|
BLI_assert(area->spacetype == SPACE_VIEW3D);
|
2022-09-23 16:51:29 +02:00
|
|
|
View3D *v3d = static_cast<View3D *>(area->spacedata.first);
|
2025-02-20 10:37:10 +01:00
|
|
|
/* Cannot use MEM_SAFE_FREE, as #SceneStats type is only forward-declared in `DNA_layer_types.h`
|
|
|
|
|
*/
|
|
|
|
|
if (v3d->runtime.local_stats) {
|
|
|
|
|
MEM_freeN(static_cast<void *>(v3d->runtime.local_stats));
|
|
|
|
|
v3d->runtime.local_stats = nullptr;
|
|
|
|
|
}
|
2021-06-15 19:01:53 -07:00
|
|
|
}
|
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
static SpaceLink *view3d_duplicate(SpaceLink *sl)
|
|
|
|
|
{
|
2012-03-25 23:54:33 +00:00
|
|
|
View3D *v3do = (View3D *)sl;
|
2022-09-23 16:51:29 +02:00
|
|
|
View3D *v3dn = static_cast<View3D *>(MEM_dupallocN(sl));
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2021-06-15 12:50:08 +10:00
|
|
|
memset(&v3dn->runtime, 0x0, sizeof(v3dn->runtime));
|
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
/* clear or remove stuff from old */
|
2014-10-09 22:39:59 +02:00
|
|
|
|
2013-06-24 06:44:00 +00:00
|
|
|
if (v3dn->localvd) {
|
2022-09-23 16:51:29 +02:00
|
|
|
v3dn->localvd = nullptr;
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
2011-11-02 18:20:53 +00:00
|
|
|
|
2024-01-23 16:06:45 +11:00
|
|
|
v3dn->local_collections_uid = 0;
|
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 20:20:55 +01:00
|
|
|
v3dn->flag &= ~(V3D_LOCAL_COLLECTIONS | V3D_XR_SESSION_MIRROR);
|
2019-10-03 19:22:36 -03:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (v3dn->shading.type == OB_RENDER) {
|
2018-07-11 14:20:39 +02:00
|
|
|
v3dn->shading.type = OB_SOLID;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-09-17 13:08:37 +02:00
|
|
|
if (v3dn->shading.prop) {
|
|
|
|
|
v3dn->shading.prop = IDP_CopyProperty(v3do->shading.prop);
|
|
|
|
|
}
|
|
|
|
|
|
Geometry Nodes: viewport preview
This adds support for showing geometry passed to the Viewer in the 3d
viewport (instead of just in the spreadsheet). The "viewer geometry"
bypasses the group output. So it is not necessary to change the final
output of the node group to be able to see the intermediate geometry.
**Activation and deactivation of a viewer node**
* A viewer node is activated by clicking on it.
* Ctrl+shift+click on any node/socket connects it to the viewer and
makes it active.
* Ctrl+shift+click in empty space deactivates the active viewer.
* When the active viewer is not visible anymore (e.g. another object
is selected, or the current node group is exit), it is deactivated.
* Clicking on the icon in the header of the Viewer node toggles whether
its active or not.
**Pinning**
* The spreadsheet still allows pinning the active viewer as before.
When pinned, the spreadsheet still references the viewer node even
when it becomes inactive.
* The viewport does not support pinning at the moment. It always shows
the active viewer.
**Attribute**
* When a field is linked to the second input of the viewer node it is
displayed as an overlay in the viewport.
* When possible the correct domain for the attribute is determined
automatically. This does not work in all cases. It falls back to the
face corner domain on meshes and the point domain on curves. When
necessary, the domain can be picked manually.
* The spreadsheet now only shows the "Viewer" column for the domain
that is selected in the Viewer node.
* Instance attributes are visualized as a constant color per instance.
**Viewport Options**
* The attribute overlay opacity can be controlled with the "Viewer Node"
setting in the overlays popover.
* A viewport can be configured not to show intermediate viewer-geometry
by disabling the "Viewer Node" option in the "View" menu.
**Implementation Details**
* The "spreadsheet context path" was generalized to a "viewer path" that
is used in more places now.
* The viewer node itself determines the attribute domain, evaluates the
field and stores the result in a `.viewer` attribute.
* A new "viewer attribute' overlay displays the data from the `.viewer`
attribute.
* The ground truth for the active viewer node is stored in the workspace
now. Node editors, spreadsheets and viewports retrieve the active
viewer from there unless they are pinned.
* The depsgraph object iterator has a new "viewer path" setting. When set,
the viewed geometry of the corresponding object is part of the iterator
instead of the final evaluated geometry.
* To support the instance attribute overlay `DupliObject` was extended
to contain the information necessary for drawing the overlay.
* The ctrl+shift+click operator has been refactored so that it can make
existing links to viewers active again.
* The auto-domain-detection in the Viewer node works by checking the
"preferred domain" for every field input. If there is not exactly one
preferred domain, the fallback is used.
Known limitations:
* Loose edges of meshes don't have the attribute overlay. This could be
added separately if necessary.
* Some attributes are hard to visualize as a color directly. For example,
the values might have to be normalized or some should be drawn as arrays.
For now, we encourage users to build node groups that generate appropriate
viewer-geometry. We might include some of that functionality in future versions.
Support for displaying attribute values as text in the viewport is planned as well.
* There seems to be an issue with the attribute overlay for pointclouds on
nvidia gpus, to be investigated.
Differential Revision: https://developer.blender.org/D15954
2022-09-28 17:54:59 +02:00
|
|
|
BKE_viewer_path_copy(&v3dn->viewer_path, &v3do->viewer_path);
|
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
/* copy or clear inside new stuff */
|
|
|
|
|
|
|
|
|
|
return (SpaceLink *)v3dn;
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-19 17:14:02 +00:00
|
|
|
/* add handlers, stuff you only do once or on area/region changes */
|
2020-03-06 16:56:42 +01:00
|
|
|
static void view3d_main_region_init(wmWindowManager *wm, ARegion *region)
|
2008-12-19 17:14:02 +00:00
|
|
|
{
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
ListBase *lb;
|
2009-09-17 21:36:02 +00:00
|
|
|
wmKeyMap *keymap;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2010-11-30 05:15:58 +00:00
|
|
|
/* object ops. */
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2010-11-30 05:15:58 +00:00
|
|
|
/* important to be before Pose keymap since they can both be enabled at once */
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(
|
|
|
|
|
wm->defaultconf, "Paint Face Mask (Weight, Vertex, Texture)", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(
|
|
|
|
|
wm->defaultconf, "Paint Vertex Selection (Weight, Vertex)", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2011-07-13 20:45:09 +00:00
|
|
|
|
2021-02-05 19:07:03 -08:00
|
|
|
/* Before 'Weight/Vertex Paint' so adding curve points is not overridden. */
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Paint Curve", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2020-12-28 17:39:12 +01:00
|
|
|
|
2020-02-15 18:50:52 +11:00
|
|
|
/* Before 'Pose' so weight paint menus aren't overridden by pose menus. */
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Weight Paint", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2020-02-15 18:50:52 +11:00
|
|
|
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Vertex Paint", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2020-02-15 18:50:52 +11:00
|
|
|
|
2009-02-01 19:53:24 +00:00
|
|
|
/* pose is not modal, operator poll checks for this */
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Pose", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Object Mode", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2009-09-17 21:36:02 +00:00
|
|
|
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Curve", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2014-07-21 12:02:05 +02:00
|
|
|
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Curves", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2023-01-20 16:40:51 +01:00
|
|
|
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Image Paint", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2009-09-18 15:48:49 +00:00
|
|
|
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Sculpt", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Mesh", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Armature", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2009-09-17 21:36:02 +00:00
|
|
|
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Metaball", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Lattice", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2009-09-17 21:36:02 +00:00
|
|
|
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Particle", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2009-09-17 21:36:02 +00:00
|
|
|
|
2025-02-17 08:44:05 +01:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Point Cloud", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
|
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
|
|
|
|
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Sculpt Curves", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2022-02-18 09:12:41 +01:00
|
|
|
|
2024-05-03 11:32:43 +10:00
|
|
|
/* NOTE: Grease Pencil handlers used to be added using `ED_KEYMAP_GPENCIL` in
|
2023-06-06 14:45:54 +02:00
|
|
|
* `ed_default_handlers` because it needed to be added to multiple editors (as other editors use
|
|
|
|
|
* annotations.). But for OB_GREASE_PENCIL, we only need it to register the keymaps for the
|
|
|
|
|
* 3D View. */
|
2024-10-03 17:45:04 +02:00
|
|
|
keymap = WM_keymap_ensure(
|
|
|
|
|
wm->defaultconf, "Grease Pencil Selection", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2024-10-03 17:45:04 +02:00
|
|
|
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(
|
|
|
|
|
wm->defaultconf, "Grease Pencil Edit Mode", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2023-06-06 14:45:54 +02:00
|
|
|
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(
|
|
|
|
|
wm->defaultconf, "Grease Pencil Paint Mode", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2023-07-03 16:34:30 +02:00
|
|
|
|
2024-04-11 09:39:48 +02:00
|
|
|
keymap = WM_keymap_ensure(
|
|
|
|
|
wm->defaultconf, "Grease Pencil Sculpt Mode", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2024-04-11 09:39:48 +02:00
|
|
|
|
GPv3: Weight Paint tools (Draw, Blur, Average, Smear, Sample weight)
This PR implements the Weight Paint tools for GPv3.
Tools:
- Draw, for assigning weight to stroke points
- Blur, smooths out weight using adjacent stroke point weights
- Average, smooths weight using the average weight under the brush
- Smear, like finger painting, drags weights in the direction of the brush
- Sample weight, sets the brush weight to the weight under the cursor
The weights are assigned to the active vertex group. When there is no
active vertex group, a group is automatically created.
When the Auto Normalize option is enabled, it is ensured that all
bone-deforming vertex groups add up to the weight of 1.0.
When a vertex group is locked, it's weights will not be altered by
Auto Normalize.
The PR already supports multi frame editing, including the use of a
falloff (defined by a curve).
The implementation is in accordance with the Weight Paint tools in GPv2.
Pull Request: https://projects.blender.org/blender/blender/pulls/118347
2024-04-25 15:21:14 +02:00
|
|
|
keymap = WM_keymap_ensure(
|
|
|
|
|
wm->defaultconf, "Grease Pencil Weight Paint", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
GPv3: Weight Paint tools (Draw, Blur, Average, Smear, Sample weight)
This PR implements the Weight Paint tools for GPv3.
Tools:
- Draw, for assigning weight to stroke points
- Blur, smooths out weight using adjacent stroke point weights
- Average, smooths weight using the average weight under the brush
- Smear, like finger painting, drags weights in the direction of the brush
- Sample weight, sets the brush weight to the weight under the cursor
The weights are assigned to the active vertex group. When there is no
active vertex group, a group is automatically created.
When the Auto Normalize option is enabled, it is ensured that all
bone-deforming vertex groups add up to the weight of 1.0.
When a vertex group is locked, it's weights will not be altered by
Auto Normalize.
The PR already supports multi frame editing, including the use of a
falloff (defined by a curve).
The implementation is in accordance with the Weight Paint tools in GPv2.
Pull Request: https://projects.blender.org/blender/blender/pulls/118347
2024-04-25 15:21:14 +02:00
|
|
|
|
2024-09-10 18:56:31 +02:00
|
|
|
keymap = WM_keymap_ensure(
|
|
|
|
|
wm->defaultconf, "Grease Pencil Vertex Paint", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2024-09-10 18:56:31 +02:00
|
|
|
|
2024-05-15 13:36:06 +02:00
|
|
|
keymap = WM_keymap_ensure(
|
|
|
|
|
wm->defaultconf, "Grease Pencil Brush Stroke", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2024-05-15 13:36:06 +02:00
|
|
|
|
|
|
|
|
keymap = WM_keymap_ensure(
|
|
|
|
|
wm->defaultconf, "Grease Pencil Fill Tool", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2024-05-15 13:36:06 +02:00
|
|
|
|
2023-08-03 08:56:59 +10:00
|
|
|
/* Edit-font key-map swallows almost all (because of text input). */
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Font", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2009-09-18 15:48:49 +00:00
|
|
|
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Object Non-modal", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2009-10-15 17:59:42 +00:00
|
|
|
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Frames", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2009-11-11 14:30:12 +00:00
|
|
|
|
2009-09-18 15:48:49 +00:00
|
|
|
/* own keymap, last so modes can override it */
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2009-09-18 15:48:49 +00:00
|
|
|
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "3D View", SPACE_VIEW3D, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
/* add drop boxes */
|
2012-03-25 23:54:33 +00:00
|
|
|
lb = WM_dropboxmap_find("View3D", SPACE_VIEW3D, RGN_TYPE_WINDOW);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_dropbox_handler(®ion->runtime->handlers, lb);
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
}
|
|
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
static void view3d_main_region_exit(wmWindowManager *wm, ARegion *region)
|
2013-03-15 19:56:29 +00:00
|
|
|
{
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_view3d_stop_render_preview(wm, region);
|
2013-03-15 19:56:29 +00:00
|
|
|
}
|
|
|
|
|
|
Asset System: Support dragging assets and appending on drop
For the Asset Browser, it needs to be possible to drag assets into various
editors, which may not come from the current .blend file. In other words, the
dragging needs to work with just the asset metadata, without direct access to
the data-block itself.
Idea is simple: When dragging an asset, store the source file-path and
data-block name and when dropping, append the data-block. It uses existing drop
operators, but the function to get the dropped data-block is replaced with one
that returns the local data-block, or, in case of an external asset, appends
the data-block first.
The drop operators need to be adjusted to use this new function that respects
assets. With this patch it only works for dragging assets into the 3D view.
Note that I expect this to be a short-lived change. A refactor like D4071 is
needed to make the drag & drop system more future proof for assets and other
use cases.
Part of the first Asset Browser milestone. Check the #asset_browser_milestone_1
project milestone on developer.blender.org.
Differential Revision: https://developer.blender.org/D9721
Reviewed by: Bastien Montagne, Brecht Van Lommel
2020-12-14 13:31:55 +01:00
|
|
|
static bool view3d_drop_in_main_region_poll(bContext *C, const wmEvent *event)
|
|
|
|
|
{
|
|
|
|
|
ScrArea *area = CTX_wm_area(C);
|
2021-10-20 23:45:30 +11:00
|
|
|
return ED_region_overlap_isect_any_xy(area, event->xy) == false;
|
Asset System: Support dragging assets and appending on drop
For the Asset Browser, it needs to be possible to drag assets into various
editors, which may not come from the current .blend file. In other words, the
dragging needs to work with just the asset metadata, without direct access to
the data-block itself.
Idea is simple: When dragging an asset, store the source file-path and
data-block name and when dropping, append the data-block. It uses existing drop
operators, but the function to get the dropped data-block is replaced with one
that returns the local data-block, or, in case of an external asset, appends
the data-block first.
The drop operators need to be adjusted to use this new function that respects
assets. With this patch it only works for dragging assets into the 3D view.
Note that I expect this to be a short-lived change. A refactor like D4071 is
needed to make the drag & drop system more future proof for assets and other
use cases.
Part of the first Asset Browser milestone. Check the #asset_browser_milestone_1
project milestone on developer.blender.org.
Differential Revision: https://developer.blender.org/D9721
Reviewed by: Bastien Montagne, Brecht Van Lommel
2020-12-14 13:31:55 +01:00
|
|
|
}
|
|
|
|
|
|
2021-01-24 22:17:06 +01:00
|
|
|
static ID_Type view3d_drop_id_in_main_region_poll_get_id_type(bContext *C,
|
|
|
|
|
wmDrag *drag,
|
|
|
|
|
const wmEvent *event)
|
2020-03-12 19:34:59 +01:00
|
|
|
{
|
2021-01-24 22:17:06 +01:00
|
|
|
const ScrArea *area = CTX_wm_area(C);
|
|
|
|
|
|
2021-10-20 23:45:30 +11:00
|
|
|
if (ED_region_overlap_isect_any_xy(area, event->xy)) {
|
2022-09-23 16:51:29 +02:00
|
|
|
return ID_Type(0);
|
2021-01-24 22:17:06 +01:00
|
|
|
}
|
|
|
|
|
if (!view3d_drop_in_main_region_poll(C, event)) {
|
2022-09-23 16:51:29 +02:00
|
|
|
return ID_Type(0);
|
2021-01-24 22:17:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ID *local_id = WM_drag_get_local_ID(drag, 0);
|
|
|
|
|
if (local_id) {
|
|
|
|
|
return GS(local_id->name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wmDragAsset *asset_drag = WM_drag_get_asset_data(drag, 0);
|
|
|
|
|
if (asset_drag) {
|
2023-07-04 14:46:19 +02:00
|
|
|
return asset_drag->asset->get_id_type();
|
2020-03-12 19:34:59 +01:00
|
|
|
}
|
2021-01-24 22:17:06 +01:00
|
|
|
|
2022-09-23 16:51:29 +02:00
|
|
|
return ID_Type(0);
|
2020-09-06 18:35:27 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool view3d_drop_id_in_main_region_poll(bContext *C,
|
|
|
|
|
wmDrag *drag,
|
|
|
|
|
const wmEvent *event,
|
|
|
|
|
ID_Type id_type)
|
|
|
|
|
{
|
Asset System: Support dragging assets and appending on drop
For the Asset Browser, it needs to be possible to drag assets into various
editors, which may not come from the current .blend file. In other words, the
dragging needs to work with just the asset metadata, without direct access to
the data-block itself.
Idea is simple: When dragging an asset, store the source file-path and
data-block name and when dropping, append the data-block. It uses existing drop
operators, but the function to get the dropped data-block is replaced with one
that returns the local data-block, or, in case of an external asset, appends
the data-block first.
The drop operators need to be adjusted to use this new function that respects
assets. With this patch it only works for dragging assets into the 3D view.
Note that I expect this to be a short-lived change. A refactor like D4071 is
needed to make the drag & drop system more future proof for assets and other
use cases.
Part of the first Asset Browser milestone. Check the #asset_browser_milestone_1
project milestone on developer.blender.org.
Differential Revision: https://developer.blender.org/D9721
Reviewed by: Bastien Montagne, Brecht Van Lommel
2020-12-14 13:31:55 +01:00
|
|
|
if (!view3d_drop_in_main_region_poll(C, event)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-24 20:39:09 +01:00
|
|
|
return WM_drag_is_ID_type(drag, id_type);
|
2020-03-12 19:34:59 +01:00
|
|
|
}
|
|
|
|
|
|
2023-10-12 18:27:46 +02:00
|
|
|
static void view3d_ob_drop_on_enter(wmDropBox *drop, wmDrag *drag)
|
2021-10-25 08:02:08 -03:00
|
|
|
{
|
2022-09-23 16:51:29 +02:00
|
|
|
V3DSnapCursorState *state = static_cast<V3DSnapCursorState *>(drop->draw_data);
|
2021-10-25 08:02:08 -03:00
|
|
|
if (state) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2021-10-25 19:39:56 -03:00
|
|
|
|
2021-10-26 20:25:19 +02:00
|
|
|
/* Don't use the snap cursor when linking the object. Object transform isn't editable then and
|
|
|
|
|
* would be reset on reload. */
|
|
|
|
|
if (WM_drag_asset_will_import_linked(drag)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-26 20:08:00 +01:00
|
|
|
state = ED_view3d_cursor_snap_state_create();
|
2022-09-23 16:51:29 +02:00
|
|
|
drop->draw_data = state;
|
2021-10-26 10:07:49 -03:00
|
|
|
state->draw_plane = true;
|
2021-10-25 08:02:08 -03:00
|
|
|
|
|
|
|
|
float dimensions[3] = {0.0f};
|
|
|
|
|
if (drag->type == WM_DRAG_ID) {
|
|
|
|
|
Object *ob = (Object *)WM_drag_get_local_ID(drag, ID_OB);
|
2023-11-15 11:03:04 +01:00
|
|
|
BKE_object_dimensions_eval_cached_get(ob, dimensions);
|
2021-10-25 08:02:08 -03:00
|
|
|
}
|
|
|
|
|
else {
|
2023-06-03 08:36:28 +10:00
|
|
|
AssetMetaData *meta_data = WM_drag_get_asset_meta_data(drag, ID_OB);
|
2021-10-25 08:02:08 -03:00
|
|
|
IDProperty *dimensions_prop = BKE_asset_metadata_idprop_find(meta_data, "dimensions");
|
|
|
|
|
if (dimensions_prop) {
|
2022-09-23 16:51:29 +02:00
|
|
|
copy_v3_v3(dimensions, static_cast<float *>(IDP_Array(dimensions_prop)));
|
2021-10-25 08:02:08 -03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!is_zero_v3(dimensions)) {
|
|
|
|
|
mul_v3_v3fl(state->box_dimensions, dimensions, 0.5f);
|
|
|
|
|
UI_GetThemeColor4ubv(TH_GIZMO_PRIMARY, state->color_box);
|
|
|
|
|
state->draw_box = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-12 18:27:46 +02:00
|
|
|
static void view3d_ob_drop_on_exit(wmDropBox *drop, wmDrag * /*drag*/)
|
2021-10-25 08:02:08 -03:00
|
|
|
{
|
2022-09-23 16:51:29 +02:00
|
|
|
V3DSnapCursorState *state = static_cast<V3DSnapCursorState *>(drop->draw_data);
|
2021-10-26 20:25:19 +02:00
|
|
|
if (state) {
|
2023-05-11 11:42:52 -03:00
|
|
|
ED_view3d_cursor_snap_state_free(state);
|
2022-09-23 16:51:29 +02:00
|
|
|
drop->draw_data = nullptr;
|
2021-10-26 20:25:19 +02:00
|
|
|
}
|
2021-10-25 08:02:08 -03:00
|
|
|
}
|
|
|
|
|
|
2021-08-02 15:09:15 +02:00
|
|
|
static bool view3d_ob_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
{
|
2020-03-12 19:34:59 +01:00
|
|
|
return view3d_drop_id_in_main_region_poll(C, drag, event, ID_OB);
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
}
|
2021-10-27 04:19:45 +11:00
|
|
|
static bool view3d_ob_drop_poll_external_asset(bContext *C, wmDrag *drag, const wmEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (!view3d_ob_drop_poll(C, drag, event) || (drag->type != WM_DRAG_ASSET)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \note the term local here refers to not being an external asset,
|
|
|
|
|
* poll will succeed for linked library objects.
|
|
|
|
|
*/
|
|
|
|
|
static bool view3d_ob_drop_poll_local_id(bContext *C, wmDrag *drag, const wmEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (!view3d_ob_drop_poll(C, drag, event) || (drag->type != WM_DRAG_ID)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
|
2021-08-02 15:09:15 +02:00
|
|
|
static bool view3d_collection_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
|
2012-12-22 18:34:17 +00:00
|
|
|
{
|
2020-03-12 19:34:59 +01:00
|
|
|
return view3d_drop_id_in_main_region_poll(C, drag, event, ID_GR);
|
2012-12-22 18:34:17 +00:00
|
|
|
}
|
|
|
|
|
|
2022-04-01 16:41:52 +02:00
|
|
|
static bool view3d_collection_drop_poll_local_id(bContext *C, wmDrag *drag, const wmEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (!view3d_collection_drop_poll(C, drag, event) || (drag->type != WM_DRAG_ID)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool view3d_collection_drop_poll_external_asset(bContext *C,
|
|
|
|
|
wmDrag *drag,
|
|
|
|
|
const wmEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (!view3d_collection_drop_poll(C, drag, event) || (drag->type != WM_DRAG_ASSET)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-02 15:09:15 +02:00
|
|
|
static bool view3d_mat_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
{
|
2024-10-17 14:54:45 +02:00
|
|
|
if (!view3d_drop_id_in_main_region_poll(C, drag, event, ID_MA)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Object *ob = ED_view3d_give_object_under_cursor(C, event->mval);
|
|
|
|
|
|
|
|
|
|
return (ob && ID_IS_EDITABLE(&ob->id) && !ID_IS_OVERRIDE_LIBRARY(&ob->id));
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
}
|
|
|
|
|
|
2024-01-19 10:45:33 -05:00
|
|
|
static std::string view3d_mat_drop_tooltip(bContext *C,
|
|
|
|
|
wmDrag *drag,
|
|
|
|
|
const int xy[2],
|
|
|
|
|
wmDropBox * /*drop*/)
|
2021-08-04 08:58:19 +02:00
|
|
|
{
|
2021-08-05 12:10:49 +02:00
|
|
|
const char *name = WM_drag_get_item_name(drag);
|
2021-10-25 10:07:00 -03:00
|
|
|
ARegion *region = CTX_wm_region(C);
|
2022-06-09 21:26:48 +10:00
|
|
|
const int mval[2] = {
|
2021-10-25 10:07:00 -03:00
|
|
|
xy[0] - region->winrct.xmin,
|
|
|
|
|
xy[1] - region->winrct.ymin,
|
|
|
|
|
};
|
2024-03-28 01:30:38 +01:00
|
|
|
return blender::ed::object::drop_named_material_tooltip(C, name, mval);
|
2021-08-04 08:58:19 +02:00
|
|
|
}
|
|
|
|
|
|
2021-09-27 21:00:17 -07:00
|
|
|
static bool view3d_world_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
|
|
|
|
|
{
|
|
|
|
|
return view3d_drop_id_in_main_region_poll(C, drag, event, ID_WO);
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-02 15:09:15 +02:00
|
|
|
static bool view3d_object_data_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
|
2020-09-06 18:35:27 +10:00
|
|
|
{
|
2021-01-24 22:17:06 +01:00
|
|
|
ID_Type id_type = view3d_drop_id_in_main_region_poll_get_id_type(C, drag, event);
|
2021-08-02 15:09:15 +02:00
|
|
|
if (id_type && OB_DATA_SUPPORT_ID(id_type)) {
|
|
|
|
|
return true;
|
2020-09-06 18:35:27 +10:00
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-19 10:45:33 -05:00
|
|
|
static std::string view3d_object_data_drop_tooltip(bContext * /*C*/,
|
|
|
|
|
wmDrag * /*drag*/,
|
|
|
|
|
const int /*xy*/[2],
|
|
|
|
|
wmDropBox * /*drop*/)
|
2021-08-02 15:09:15 +02:00
|
|
|
{
|
2024-01-19 10:45:33 -05:00
|
|
|
return TIP_("Create object instance from object-data");
|
2021-08-02 15:09:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool view3d_ima_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
|
2010-09-01 13:41:53 +00:00
|
|
|
{
|
2021-10-20 23:45:30 +11:00
|
|
|
if (ED_region_overlap_isect_any_xy(CTX_wm_area(C), event->xy)) {
|
2020-03-12 19:34:59 +01:00
|
|
|
return false;
|
|
|
|
|
}
|
2021-01-24 20:39:09 +01:00
|
|
|
return WM_drag_is_ID_type(drag, ID_IM);
|
2010-09-01 13:41:53 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-06 09:10:07 +02:00
|
|
|
static bool view3d_ima_bg_is_camera_view(bContext *C)
|
|
|
|
|
{
|
|
|
|
|
RegionView3D *rv3d = CTX_wm_region_view3d(C);
|
2022-09-25 15:14:13 +10:00
|
|
|
if (rv3d && (rv3d->persp == RV3D_CAMOB)) {
|
2018-07-06 09:10:07 +02:00
|
|
|
View3D *v3d = CTX_wm_view3d(C);
|
|
|
|
|
if (v3d && v3d->camera && v3d->camera->type == OB_CAMERA) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-02 15:09:15 +02:00
|
|
|
static bool view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
|
2013-02-27 10:14:36 +00:00
|
|
|
{
|
2021-08-02 15:09:15 +02:00
|
|
|
if (!view3d_ima_drop_poll(C, drag, event)) {
|
2018-10-16 11:17:32 +02:00
|
|
|
return false;
|
2018-07-06 09:10:07 +02:00
|
|
|
}
|
2013-02-27 10:14:36 +00:00
|
|
|
|
2018-10-17 09:53:05 +02:00
|
|
|
if (ED_view3d_is_object_under_cursor(C, event->mval)) {
|
2018-10-16 11:17:32 +02:00
|
|
|
return false;
|
2013-02-27 10:14:36 +00:00
|
|
|
}
|
2018-10-16 11:17:32 +02:00
|
|
|
|
|
|
|
|
return view3d_ima_bg_is_camera_view(C);
|
2013-02-27 10:14:36 +00:00
|
|
|
}
|
2010-09-01 13:41:53 +00:00
|
|
|
|
2021-08-02 15:09:15 +02:00
|
|
|
static bool view3d_ima_empty_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
{
|
2021-08-02 15:09:15 +02:00
|
|
|
if (!view3d_ima_drop_poll(C, drag, event)) {
|
2018-10-16 11:17:32 +02:00
|
|
|
return false;
|
2018-07-06 09:10:07 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-16 11:17:32 +02:00
|
|
|
Object *ob = ED_view3d_give_object_under_cursor(C, event->mval);
|
|
|
|
|
|
2022-09-23 16:51:29 +02:00
|
|
|
if (ob == nullptr) {
|
2018-10-16 11:17:32 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
2013-02-27 10:14:36 +00:00
|
|
|
|
2018-10-16 11:17:32 +02:00
|
|
|
if (ob->type == OB_EMPTY && ob->empty_drawtype == OB_EMPTY_IMAGE) {
|
|
|
|
|
return true;
|
2014-06-03 23:00:39 +10:00
|
|
|
}
|
2013-03-02 12:05:25 +00:00
|
|
|
|
2018-10-16 11:17:32 +02:00
|
|
|
return false;
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
}
|
|
|
|
|
|
2023-02-09 16:04:14 +01:00
|
|
|
static bool view3d_geometry_nodes_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (!view3d_drop_id_in_main_region_poll(C, drag, event, ID_NT)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (drag->type == WM_DRAG_ID) {
|
|
|
|
|
const bNodeTree *node_tree = reinterpret_cast<const bNodeTree *>(
|
|
|
|
|
WM_drag_get_local_ID(drag, ID_NT));
|
|
|
|
|
if (!node_tree) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return node_tree->type == NTREE_GEOMETRY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (drag->type == WM_DRAG_ASSET) {
|
|
|
|
|
const wmDragAsset *asset_data = WM_drag_get_asset_data(drag, ID_NT);
|
|
|
|
|
if (!asset_data) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2023-07-04 14:46:19 +02:00
|
|
|
const AssetMetaData *metadata = &asset_data->asset->get_metadata();
|
2023-06-09 15:17:48 +02:00
|
|
|
const IDProperty *tree_type = BKE_asset_metadata_idprop_find(metadata, "type");
|
2023-02-09 16:04:14 +01:00
|
|
|
if (!tree_type || IDP_Int(tree_type) != NTREE_GEOMETRY) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (wmDropBox *drop_box = drag->drop_state.active_dropbox) {
|
2024-01-22 13:47:13 +01:00
|
|
|
const uint32_t uid = RNA_int_get(drop_box->ptr, "session_uid");
|
2023-02-09 16:04:14 +01:00
|
|
|
const bNodeTree *node_tree = reinterpret_cast<const bNodeTree *>(
|
2024-01-22 13:47:13 +01:00
|
|
|
BKE_libblock_find_session_uid(CTX_data_main(C), ID_NT, uid));
|
2023-02-09 16:04:14 +01:00
|
|
|
if (node_tree) {
|
|
|
|
|
return node_tree->type == NTREE_GEOMETRY;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-19 10:45:33 -05:00
|
|
|
static std::string view3d_geometry_nodes_drop_tooltip(bContext *C,
|
|
|
|
|
wmDrag * /*drag*/,
|
|
|
|
|
const int xy[2],
|
|
|
|
|
wmDropBox *drop)
|
2023-02-09 16:04:14 +01:00
|
|
|
{
|
|
|
|
|
ARegion *region = CTX_wm_region(C);
|
|
|
|
|
int mval[2] = {xy[0] - region->winrct.xmin, xy[1] - region->winrct.ymin};
|
2024-03-28 01:30:38 +01:00
|
|
|
return blender::ed::object::drop_geometry_nodes_tooltip(C, drop->ptr, mval);
|
2023-02-09 16:04:14 +01:00
|
|
|
}
|
|
|
|
|
|
2021-10-27 04:19:45 +11:00
|
|
|
static void view3d_ob_drop_matrix_from_snap(V3DSnapCursorState *snap_state,
|
|
|
|
|
Object *ob,
|
|
|
|
|
float obmat_final[4][4])
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
{
|
2023-11-27 16:14:49 +01:00
|
|
|
using namespace blender;
|
2022-04-28 11:28:22 -03:00
|
|
|
V3DSnapCursorData *snap_data = ED_view3d_cursor_snap_data_get();
|
2021-10-27 04:19:45 +11:00
|
|
|
BLI_assert(snap_state->draw_box || snap_state->draw_plane);
|
2022-04-28 11:18:56 -05:00
|
|
|
UNUSED_VARS_NDEBUG(snap_state);
|
2021-10-25 19:39:56 -03:00
|
|
|
copy_m4_m3(obmat_final, snap_data->plane_omat);
|
|
|
|
|
copy_v3_v3(obmat_final[3], snap_data->loc);
|
|
|
|
|
|
|
|
|
|
float scale[3];
|
2024-02-14 16:14:49 +01:00
|
|
|
mat4_to_size(scale, ob->object_to_world().ptr());
|
2021-10-25 19:39:56 -03:00
|
|
|
rescale_m4(obmat_final, scale);
|
|
|
|
|
|
2023-11-27 16:14:49 +01:00
|
|
|
if (const std::optional<Bounds<float3>> bb = BKE_object_boundbox_get(ob)) {
|
|
|
|
|
float3 offset = math::midpoint(bb->min, bb->max);
|
|
|
|
|
offset[2] = bb->min[2];
|
2021-10-25 19:39:56 -03:00
|
|
|
mul_mat3_m4_v3(obmat_final, offset);
|
|
|
|
|
sub_v3_v3(obmat_final[3], offset);
|
2021-10-25 08:02:08 -03:00
|
|
|
}
|
2021-10-27 04:19:45 +11:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void view3d_ob_drop_copy_local_id(bContext * /*C*/, wmDrag *drag, wmDropBox *drop)
|
2021-10-27 04:19:45 +11:00
|
|
|
{
|
|
|
|
|
ID *id = WM_drag_get_local_ID(drag, ID_OB);
|
|
|
|
|
|
2024-01-22 13:47:13 +01:00
|
|
|
RNA_int_set(drop->ptr, "session_uid", id->session_uid);
|
2021-10-27 04:19:45 +11:00
|
|
|
/* Don't duplicate ID's which were just imported. Only do that for existing, local IDs. */
|
|
|
|
|
BLI_assert(drag->type != WM_DRAG_ASSET);
|
|
|
|
|
|
2023-05-11 11:42:52 -03:00
|
|
|
V3DSnapCursorState *snap_state = ED_view3d_cursor_snap_state_active_get();
|
2021-10-27 04:19:45 +11:00
|
|
|
float obmat_final[4][4];
|
|
|
|
|
|
|
|
|
|
view3d_ob_drop_matrix_from_snap(snap_state, (Object *)id, obmat_final);
|
|
|
|
|
|
|
|
|
|
RNA_float_set_array(drop->ptr, "matrix", &obmat_final[0][0]);
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-01 16:41:52 +02:00
|
|
|
/* Mostly the same logic as #view3d_collection_drop_copy_external_asset(), just different enough to
|
|
|
|
|
* make sharing code a bit difficult. */
|
2023-07-28 12:16:52 +02:00
|
|
|
static void view3d_ob_drop_copy_external_asset(bContext *C, wmDrag *drag, wmDropBox *drop)
|
2021-10-27 04:19:45 +11:00
|
|
|
{
|
2023-02-09 11:30:25 +11:00
|
|
|
/* NOTE(@ideasman42): Selection is handled here, de-selecting objects before append,
|
2021-10-27 04:19:45 +11:00
|
|
|
* using auto-select to ensure the new objects are selected.
|
|
|
|
|
* This is done so #OBJECT_OT_transform_to_mouse (which runs after this drop handler)
|
|
|
|
|
* can use the context setup here to place the objects. */
|
|
|
|
|
BLI_assert(drag->type == WM_DRAG_ASSET);
|
|
|
|
|
|
|
|
|
|
wmDragAsset *asset_drag = WM_drag_get_asset_data(drag, 0);
|
|
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
|
ViewLayer *view_layer = CTX_data_view_layer(C);
|
|
|
|
|
|
2022-09-14 21:30:20 +02:00
|
|
|
BKE_view_layer_base_deselect_all(scene, view_layer);
|
2021-10-27 04:19:45 +11:00
|
|
|
|
2024-09-19 18:43:52 +02:00
|
|
|
ID *id = WM_drag_asset_id_import(C, asset_drag, FILE_AUTOSELECT);
|
2021-10-27 04:19:45 +11:00
|
|
|
|
2021-10-26 19:56:53 +02:00
|
|
|
/* TODO(sergey): Only update relations for the current scene. */
|
|
|
|
|
DEG_relations_tag_update(CTX_data_main(C));
|
2021-10-26 19:55:51 +02:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
|
|
|
|
|
|
2024-09-19 18:43:52 +02:00
|
|
|
RNA_int_set(drop->ptr, "session_uid", id->session_uid);
|
2021-10-27 04:19:45 +11:00
|
|
|
|
2022-09-14 21:33:51 +02:00
|
|
|
BKE_view_layer_synced_ensure(scene, view_layer);
|
2024-09-19 18:43:52 +02:00
|
|
|
Base *base = BKE_view_layer_base_find(view_layer, (Object *)id);
|
|
|
|
|
if (base != nullptr) {
|
|
|
|
|
BKE_view_layer_base_select_and_set_active(view_layer, base);
|
|
|
|
|
WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene);
|
|
|
|
|
}
|
2021-10-27 04:19:45 +11:00
|
|
|
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
|
|
|
|
|
ED_outliner_select_sync_from_object_tag(C);
|
|
|
|
|
|
2024-03-06 12:23:50 -05:00
|
|
|
/* Make sure the depsgraph is evaluated so the new object's transforms are up-to-date.
|
|
|
|
|
* The evaluated #Object::object_to_world() will be copied back to the original object
|
|
|
|
|
* and used below. */
|
|
|
|
|
CTX_data_ensure_evaluated_depsgraph(C);
|
|
|
|
|
|
2022-09-23 16:51:29 +02:00
|
|
|
V3DSnapCursorState *snap_state = static_cast<V3DSnapCursorState *>(drop->draw_data);
|
2021-10-26 20:25:19 +02:00
|
|
|
if (snap_state) {
|
|
|
|
|
float obmat_final[4][4];
|
2021-10-27 04:19:45 +11:00
|
|
|
|
2024-09-19 18:43:52 +02:00
|
|
|
view3d_ob_drop_matrix_from_snap(snap_state, (Object *)id, obmat_final);
|
2021-10-27 04:19:45 +11:00
|
|
|
|
2021-10-26 20:25:19 +02:00
|
|
|
RNA_float_set_array(drop->ptr, "matrix", &obmat_final[0][0]);
|
|
|
|
|
}
|
2009-01-01 13:15:35 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void view3d_collection_drop_copy_local_id(bContext * /*C*/, wmDrag *drag, wmDropBox *drop)
|
2012-12-22 18:34:17 +00:00
|
|
|
{
|
2022-04-01 16:41:52 +02:00
|
|
|
ID *id = WM_drag_get_local_ID(drag, ID_GR);
|
2024-01-22 13:47:13 +01:00
|
|
|
RNA_int_set(drop->ptr, "session_uid", int(id->session_uid));
|
2022-04-01 16:41:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Mostly the same logic as #view3d_ob_drop_copy_external_asset(), just different enough to make
|
|
|
|
|
* sharing code a bit difficult. */
|
2023-07-28 12:16:52 +02:00
|
|
|
static void view3d_collection_drop_copy_external_asset(bContext *C, wmDrag *drag, wmDropBox *drop)
|
2022-04-01 16:41:52 +02:00
|
|
|
{
|
|
|
|
|
BLI_assert(drag->type == WM_DRAG_ASSET);
|
|
|
|
|
|
|
|
|
|
wmDragAsset *asset_drag = WM_drag_get_asset_data(drag, 0);
|
|
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
|
ViewLayer *view_layer = CTX_data_view_layer(C);
|
|
|
|
|
|
2022-09-14 21:30:20 +02:00
|
|
|
BKE_view_layer_base_deselect_all(scene, view_layer);
|
2022-04-01 16:41:52 +02:00
|
|
|
|
2023-07-28 12:16:52 +02:00
|
|
|
ID *id = WM_drag_asset_id_import(C, asset_drag, FILE_AUTOSELECT);
|
2022-04-01 16:41:52 +02:00
|
|
|
Collection *collection = (Collection *)id;
|
|
|
|
|
|
|
|
|
|
/* TODO(sergey): Only update relations for the current scene. */
|
|
|
|
|
DEG_relations_tag_update(CTX_data_main(C));
|
|
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2024-01-22 13:47:13 +01:00
|
|
|
RNA_int_set(drop->ptr, "session_uid", int(id->session_uid));
|
2022-04-01 16:41:52 +02:00
|
|
|
|
|
|
|
|
/* Make an object active, just use the first one in the collection. */
|
2022-09-23 16:51:29 +02:00
|
|
|
CollectionObject *cobject = static_cast<CollectionObject *>(collection->gobject.first);
|
2022-09-14 21:33:51 +02:00
|
|
|
BKE_view_layer_synced_ensure(scene, view_layer);
|
2022-09-23 16:51:29 +02:00
|
|
|
Base *base = cobject ? BKE_view_layer_base_find(view_layer, cobject->ob) : nullptr;
|
2022-04-01 16:41:52 +02:00
|
|
|
if (base) {
|
|
|
|
|
BLI_assert((base->flag & BASE_SELECTABLE) && (base->flag & BASE_ENABLED_VIEWPORT));
|
|
|
|
|
BKE_view_layer_base_select_and_set_active(view_layer, base);
|
|
|
|
|
WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene);
|
|
|
|
|
}
|
|
|
|
|
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
|
|
|
|
|
ED_outliner_select_sync_from_object_tag(C);
|
|
|
|
|
|
|
|
|
|
/* XXX Without an undo push here, there will be a crash when the user modifies operator
|
|
|
|
|
* properties. The stuff we do in these drop callbacks just isn't safe over undo/redo. */
|
|
|
|
|
ED_undo_push(C, "Collection_Drop");
|
2012-12-22 18:34:17 +00:00
|
|
|
}
|
|
|
|
|
|
2023-07-28 12:16:52 +02:00
|
|
|
static void view3d_id_drop_copy(bContext *C, wmDrag *drag, wmDropBox *drop)
|
2010-01-27 15:08:30 +00:00
|
|
|
{
|
2023-07-28 12:16:52 +02:00
|
|
|
ID *id = WM_drag_get_local_ID_or_import_from_asset(C, drag, 0);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2022-05-23 20:54:15 +02:00
|
|
|
WM_operator_properties_id_lookup_set_from_id(drop->ptr, id);
|
2023-09-07 14:47:40 +02:00
|
|
|
RNA_boolean_set(drop->ptr, "show_datablock_in_modifier", (drag->type != WM_DRAG_ASSET));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void view3d_geometry_nodes_drop_copy(bContext *C, wmDrag *drag, wmDropBox *drop)
|
|
|
|
|
{
|
|
|
|
|
view3d_id_drop_copy(C, drag, drop);
|
|
|
|
|
RNA_boolean_set(drop->ptr, "show_datablock_in_modifier", (drag->type != WM_DRAG_ASSET));
|
2010-01-27 15:08:30 +00:00
|
|
|
}
|
|
|
|
|
|
2023-07-28 12:16:52 +02:00
|
|
|
static void view3d_id_drop_copy_with_type(bContext *C, wmDrag *drag, wmDropBox *drop)
|
2020-09-06 18:35:27 +10:00
|
|
|
{
|
2023-07-28 12:16:52 +02:00
|
|
|
ID *id = WM_drag_get_local_ID_or_import_from_asset(C, drag, 0);
|
2020-09-06 18:35:27 +10:00
|
|
|
|
|
|
|
|
RNA_enum_set(drop->ptr, "type", GS(id->name));
|
2022-05-23 20:54:15 +02:00
|
|
|
WM_operator_properties_id_lookup_set_from_id(drop->ptr, id);
|
2020-09-06 18:35:27 +10:00
|
|
|
}
|
|
|
|
|
|
2023-07-28 12:16:52 +02:00
|
|
|
static void view3d_id_path_drop_copy(bContext *C, wmDrag *drag, wmDropBox *drop)
|
2010-05-09 18:07:17 +00:00
|
|
|
{
|
2023-07-28 12:16:52 +02:00
|
|
|
ID *id = WM_drag_get_local_ID_or_import_from_asset(C, drag, 0);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-30 17:18:03 +01:00
|
|
|
if (id) {
|
2022-05-23 20:54:15 +02:00
|
|
|
WM_operator_properties_id_lookup_set_from_id(drop->ptr, id);
|
2014-11-30 17:18:03 +01:00
|
|
|
RNA_struct_property_unset(drop->ptr, "filepath");
|
2023-02-27 16:31:31 +01:00
|
|
|
return;
|
2014-11-30 17:18:03 +01:00
|
|
|
}
|
2010-05-09 18:07:17 +00:00
|
|
|
}
|
|
|
|
|
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
/* region dropbox definition */
|
2022-10-05 13:44:02 -05:00
|
|
|
static void view3d_dropboxes()
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
{
|
2012-03-25 23:54:33 +00:00
|
|
|
ListBase *lb = WM_dropboxmap_find("View3D", SPACE_VIEW3D, RGN_TYPE_WINDOW);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-06-03 08:36:28 +10:00
|
|
|
wmDropBox *drop;
|
2021-10-25 08:02:08 -03:00
|
|
|
drop = WM_dropbox_add(lb,
|
|
|
|
|
"OBJECT_OT_add_named",
|
2021-10-27 04:19:45 +11:00
|
|
|
view3d_ob_drop_poll_local_id,
|
|
|
|
|
view3d_ob_drop_copy_local_id,
|
2021-10-25 08:02:08 -03:00
|
|
|
WM_drag_free_imported_drag_ID,
|
2022-09-23 16:51:29 +02:00
|
|
|
nullptr);
|
2021-10-25 08:02:08 -03:00
|
|
|
|
2022-04-28 12:50:22 +02:00
|
|
|
drop->draw_droptip = WM_drag_draw_item_name_fn;
|
2023-10-12 18:27:46 +02:00
|
|
|
drop->on_enter = view3d_ob_drop_on_enter;
|
|
|
|
|
drop->on_exit = view3d_ob_drop_on_exit;
|
2021-10-25 08:02:08 -03:00
|
|
|
|
2021-10-27 04:19:45 +11:00
|
|
|
drop = WM_dropbox_add(lb,
|
|
|
|
|
"OBJECT_OT_transform_to_mouse",
|
|
|
|
|
view3d_ob_drop_poll_external_asset,
|
|
|
|
|
view3d_ob_drop_copy_external_asset,
|
|
|
|
|
WM_drag_free_imported_drag_ID,
|
2022-09-23 16:51:29 +02:00
|
|
|
nullptr);
|
2021-10-27 04:19:45 +11:00
|
|
|
|
2022-04-28 12:50:22 +02:00
|
|
|
drop->draw_droptip = WM_drag_draw_item_name_fn;
|
2023-10-12 18:27:46 +02:00
|
|
|
drop->on_enter = view3d_ob_drop_on_enter;
|
|
|
|
|
drop->on_exit = view3d_ob_drop_on_exit;
|
2021-10-27 04:19:45 +11:00
|
|
|
|
2022-04-01 16:41:52 +02:00
|
|
|
WM_dropbox_add(lb,
|
|
|
|
|
"OBJECT_OT_collection_external_asset_drop",
|
|
|
|
|
view3d_collection_drop_poll_external_asset,
|
|
|
|
|
view3d_collection_drop_copy_external_asset,
|
|
|
|
|
WM_drag_free_imported_drag_ID,
|
2022-09-23 16:51:29 +02:00
|
|
|
nullptr);
|
2022-04-01 16:41:52 +02:00
|
|
|
WM_dropbox_add(lb,
|
|
|
|
|
"OBJECT_OT_collection_instance_add",
|
|
|
|
|
view3d_collection_drop_poll_local_id,
|
|
|
|
|
view3d_collection_drop_copy_local_id,
|
|
|
|
|
WM_drag_free_imported_drag_ID,
|
2022-09-23 16:51:29 +02:00
|
|
|
nullptr);
|
2022-04-01 16:41:52 +02:00
|
|
|
|
2021-02-16 15:24:22 +01:00
|
|
|
WM_dropbox_add(lb,
|
|
|
|
|
"OBJECT_OT_drop_named_material",
|
|
|
|
|
view3d_mat_drop_poll,
|
|
|
|
|
view3d_id_drop_copy,
|
2021-08-02 15:09:15 +02:00
|
|
|
WM_drag_free_imported_drag_ID,
|
2021-08-04 08:58:19 +02:00
|
|
|
view3d_mat_drop_tooltip);
|
2023-02-09 16:04:14 +01:00
|
|
|
WM_dropbox_add(lb,
|
|
|
|
|
"OBJECT_OT_drop_geometry_nodes",
|
|
|
|
|
view3d_geometry_nodes_drop_poll,
|
2023-09-07 14:47:40 +02:00
|
|
|
view3d_geometry_nodes_drop_copy,
|
2023-02-09 16:04:14 +01:00
|
|
|
WM_drag_free_imported_drag_ID,
|
|
|
|
|
view3d_geometry_nodes_drop_tooltip);
|
2021-02-16 15:24:22 +01:00
|
|
|
WM_dropbox_add(lb,
|
2024-03-11 16:18:25 +01:00
|
|
|
"VIEW3D_OT_camera_background_image_add",
|
2021-02-16 15:24:22 +01:00
|
|
|
view3d_ima_bg_drop_poll,
|
|
|
|
|
view3d_id_path_drop_copy,
|
2021-08-02 15:09:15 +02:00
|
|
|
WM_drag_free_imported_drag_ID,
|
2022-09-23 16:51:29 +02:00
|
|
|
nullptr);
|
2021-02-16 15:24:22 +01:00
|
|
|
WM_dropbox_add(lb,
|
2024-03-11 16:18:25 +01:00
|
|
|
"OBJECT_OT_empty_image_add",
|
2021-02-16 15:24:22 +01:00
|
|
|
view3d_ima_empty_drop_poll,
|
|
|
|
|
view3d_id_path_drop_copy,
|
2021-08-02 15:09:15 +02:00
|
|
|
WM_drag_free_imported_drag_ID,
|
2022-09-23 16:51:29 +02:00
|
|
|
nullptr);
|
2020-09-06 18:35:27 +10:00
|
|
|
WM_dropbox_add(lb,
|
|
|
|
|
"OBJECT_OT_data_instance_add",
|
|
|
|
|
view3d_object_data_drop_poll,
|
2021-02-16 15:24:22 +01:00
|
|
|
view3d_id_drop_copy_with_type,
|
2021-08-02 15:09:15 +02:00
|
|
|
WM_drag_free_imported_drag_ID,
|
|
|
|
|
view3d_object_data_drop_tooltip);
|
2021-09-27 21:00:17 -07:00
|
|
|
WM_dropbox_add(lb,
|
|
|
|
|
"VIEW3D_OT_drop_world",
|
|
|
|
|
view3d_world_drop_poll,
|
|
|
|
|
view3d_id_drop_copy,
|
|
|
|
|
WM_drag_free_imported_drag_ID,
|
2022-09-23 16:51:29 +02:00
|
|
|
nullptr);
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-05 13:44:02 -05:00
|
|
|
static void view3d_widgets()
|
2017-04-07 00:35:57 +10:00
|
|
|
{
|
2022-09-23 16:51:29 +02:00
|
|
|
wmGizmoMapType_Params params{SPACE_VIEW3D, RGN_TYPE_WINDOW};
|
|
|
|
|
wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(¶ms);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2025-02-18 01:27:04 +01:00
|
|
|
WM_gizmogrouptype_append_and_link(gzmap_type,
|
|
|
|
|
blender::ed::transform::VIEW3D_GGT_xform_gizmo_context);
|
2019-02-27 12:02:02 +11:00
|
|
|
WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_light_spot);
|
2023-02-13 11:18:21 +01:00
|
|
|
WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_light_point);
|
2019-02-27 12:02:02 +11:00
|
|
|
WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_light_area);
|
|
|
|
|
WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_light_target);
|
2018-07-15 14:24:10 +02:00
|
|
|
WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_force_field);
|
|
|
|
|
WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_camera);
|
|
|
|
|
WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_camera_view);
|
|
|
|
|
WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_empty_image);
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_geometry_nodes);
|
2023-02-09 11:30:25 +11:00
|
|
|
/* TODO(@ideasman42): Not working well enough, disable for now. */
|
2019-07-18 22:03:04 +10:00
|
|
|
#if 0
|
2018-07-15 14:24:10 +02:00
|
|
|
WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_armature_spline);
|
2019-07-18 22:03:04 +10:00
|
|
|
#endif
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2025-02-18 01:27:04 +01:00
|
|
|
WM_gizmogrouptype_append(blender::ed::transform::VIEW3D_GGT_xform_gizmo);
|
|
|
|
|
WM_gizmogrouptype_append(blender::ed::transform::VIEW3D_GGT_xform_cage);
|
|
|
|
|
WM_gizmogrouptype_append(blender::ed::transform::VIEW3D_GGT_xform_shear);
|
|
|
|
|
WM_gizmogrouptype_append(blender::ed::transform::VIEW3D_GGT_xform_extrude);
|
2018-09-09 16:11:02 +10:00
|
|
|
WM_gizmogrouptype_append(VIEW3D_GGT_mesh_preselect_elem);
|
2018-08-21 19:02:28 +10:00
|
|
|
WM_gizmogrouptype_append(VIEW3D_GGT_mesh_preselect_edgering);
|
2019-12-07 03:45:50 +11:00
|
|
|
WM_gizmogrouptype_append(VIEW3D_GGT_tool_generic_handle_normal);
|
|
|
|
|
WM_gizmogrouptype_append(VIEW3D_GGT_tool_generic_handle_free);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-15 14:24:10 +02:00
|
|
|
WM_gizmogrouptype_append(VIEW3D_GGT_ruler);
|
|
|
|
|
WM_gizmotype_append(VIEW3D_GT_ruler_item);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-05-28 14:34:17 +10:00
|
|
|
WM_gizmogrouptype_append(VIEW3D_GGT_placement);
|
|
|
|
|
|
2018-07-15 14:24:10 +02:00
|
|
|
WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_navigate);
|
|
|
|
|
WM_gizmotype_append(VIEW3D_GT_navigate_rotate);
|
2017-04-07 00:35:57 +10:00
|
|
|
}
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
/* type callback, not region itself */
|
2020-03-06 16:56:42 +01:00
|
|
|
static void view3d_main_region_free(ARegion *region)
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
{
|
2022-09-23 16:51:29 +02:00
|
|
|
RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-02-22 16:52:06 +00:00
|
|
|
if (rv3d) {
|
2019-03-26 21:16:47 +11:00
|
|
|
if (rv3d->localvd) {
|
|
|
|
|
MEM_freeN(rv3d->localvd);
|
|
|
|
|
}
|
|
|
|
|
if (rv3d->clipbb) {
|
|
|
|
|
MEM_freeN(rv3d->clipbb);
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-07-18 17:17:48 +02:00
|
|
|
if (rv3d->view_render) {
|
2023-10-03 16:01:33 +02:00
|
|
|
DRW_engine_external_free(rv3d);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-01-17 09:11:51 +00:00
|
|
|
if (rv3d->sms) {
|
2025-02-20 10:37:10 +01:00
|
|
|
MEM_freeN(static_cast<void *>(rv3d->sms));
|
2013-01-17 09:11:51 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
MEM_freeN(rv3d);
|
2022-09-23 16:51:29 +02:00
|
|
|
region->regiondata = nullptr;
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* copy regiondata */
|
2015-11-28 17:14:45 +01:00
|
|
|
static void *view3d_main_region_duplicate(void *poin)
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
{
|
2012-02-22 16:52:06 +00:00
|
|
|
if (poin) {
|
2022-09-23 16:51:29 +02:00
|
|
|
RegionView3D *rv3d = static_cast<RegionView3D *>(poin);
|
|
|
|
|
RegionView3D *new_rv3d;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-09-23 16:51:29 +02:00
|
|
|
new_rv3d = static_cast<RegionView3D *>(MEM_dupallocN(rv3d));
|
2019-03-26 21:16:47 +11:00
|
|
|
if (rv3d->localvd) {
|
2022-09-23 16:51:29 +02:00
|
|
|
new_rv3d->localvd = static_cast<RegionView3D *>(MEM_dupallocN(rv3d->localvd));
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
|
|
|
|
if (rv3d->clipbb) {
|
2022-09-23 16:51:29 +02:00
|
|
|
new_rv3d->clipbb = static_cast<BoundBox *>(MEM_dupallocN(rv3d->clipbb));
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-07-18 17:17:48 +02:00
|
|
|
new_rv3d->view_render = nullptr;
|
2022-09-23 16:51:29 +02:00
|
|
|
new_rv3d->sms = nullptr;
|
|
|
|
|
new_rv3d->smooth_timer = nullptr;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-09-23 16:51:29 +02:00
|
|
|
return new_rv3d;
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
}
|
2022-09-23 16:51:29 +02:00
|
|
|
return nullptr;
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
}
|
|
|
|
|
|
2021-01-19 12:59:00 +11:00
|
|
|
static void view3d_main_region_listener(const wmRegionListenerParams *params)
|
2008-12-27 17:43:05 +00:00
|
|
|
{
|
2021-01-29 15:55:41 +01:00
|
|
|
wmWindow *window = params->window;
|
2021-01-18 17:28:47 -06:00
|
|
|
ScrArea *area = params->area;
|
|
|
|
|
ARegion *region = params->region;
|
2022-08-27 12:50:43 +10:00
|
|
|
const wmNotifier *wmn = params->notifier;
|
2021-01-18 17:28:47 -06:00
|
|
|
const Scene *scene = params->scene;
|
2022-09-23 16:51:29 +02:00
|
|
|
View3D *v3d = static_cast<View3D *>(area->spacedata.first);
|
|
|
|
|
RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
|
2024-11-21 19:34:53 +01:00
|
|
|
wmGizmoMap *gzmap = region->runtime->gizmo_map;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-12-27 17:43:05 +00:00
|
|
|
/* context changes */
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (wmn->category) {
|
2017-04-15 15:58:49 +02:00
|
|
|
case NC_WM:
|
|
|
|
|
if (ELEM(wmn->data, ND_UNDO)) {
|
2018-07-15 14:24:10 +02:00
|
|
|
WM_gizmomap_tag_refresh(gzmap);
|
2017-04-15 15:58:49 +02:00
|
|
|
}
|
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 20:20:55 +01:00
|
|
|
else if (ELEM(wmn->data, ND_XR_DATA_CHANGED)) {
|
|
|
|
|
/* Only cause a redraw if this a VR session mirror. Should more features be added that
|
|
|
|
|
* require redraws, we could pass something to wmn->reference, e.g. the flag value. */
|
|
|
|
|
if (v3d->flag & V3D_XR_SESSION_MIRROR) {
|
|
|
|
|
ED_region_tag_redraw(region);
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-04-15 15:58:49 +02:00
|
|
|
break;
|
2009-07-10 10:48:25 +00:00
|
|
|
case NC_ANIMATION:
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (wmn->data) {
|
2009-07-10 10:48:25 +00:00
|
|
|
case ND_KEYFRAME_PROP:
|
|
|
|
|
case ND_NLA_ACTCHANGE:
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2009-07-10 10:48:25 +00:00
|
|
|
break;
|
2010-06-18 04:39:32 +00:00
|
|
|
case ND_NLA:
|
|
|
|
|
case ND_KEYFRAME:
|
2019-03-26 21:16:47 +11:00
|
|
|
if (ELEM(wmn->action, NA_EDITED, NA_ADDED, NA_REMOVED)) {
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2010-06-18 04:39:32 +00:00
|
|
|
break;
|
|
|
|
|
case ND_ANIMCHAN:
|
2019-03-26 21:16:47 +11:00
|
|
|
if (ELEM(wmn->action, NA_EDITED, NA_ADDED, NA_REMOVED, NA_SELECTED)) {
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2010-06-18 04:39:32 +00:00
|
|
|
break;
|
2009-07-10 10:48:25 +00:00
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
break;
|
2008-12-27 17:43:05 +00:00
|
|
|
case NC_SCENE:
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (wmn->data) {
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
case ND_SCENEBROWSE:
|
2010-08-28 07:07:02 +00:00
|
|
|
case ND_LAYER_CONTENT:
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2018-07-15 14:24:10 +02:00
|
|
|
WM_gizmomap_tag_refresh(gzmap);
|
2024-07-23 18:23:02 +02:00
|
|
|
if (v3d->localvd && v3d->localvd->runtime.flag & V3D_RUNTIME_LOCAL_MAYBE_EMPTY) {
|
|
|
|
|
ED_area_tag_refresh(area);
|
|
|
|
|
}
|
2010-08-28 07:07:02 +00:00
|
|
|
break;
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
case ND_LAYER:
|
|
|
|
|
if (wmn->reference) {
|
2022-09-23 16:51:29 +02:00
|
|
|
BKE_screen_view3d_sync(v3d, static_cast<Scene *>(wmn->reference));
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
}
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2018-07-15 14:24:10 +02:00
|
|
|
WM_gizmomap_tag_refresh(gzmap);
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
break;
|
2008-12-29 12:15:42 +00:00
|
|
|
case ND_OB_ACTIVE:
|
|
|
|
|
case ND_OB_SELECT:
|
2023-07-10 21:48:38 +02:00
|
|
|
[[fallthrough]];
|
2017-06-19 12:36:34 +02:00
|
|
|
case ND_FRAME:
|
|
|
|
|
case ND_TRANSFORM:
|
2010-09-22 13:42:20 +00:00
|
|
|
case ND_OB_VISIBLE:
|
2009-12-17 06:06:30 +00:00
|
|
|
case ND_RENDER_OPTIONS:
|
2013-11-26 15:01:13 +06:00
|
|
|
case ND_MARKERS:
|
2009-01-01 13:15:35 +00:00
|
|
|
case ND_MODE:
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2018-07-15 14:24:10 +02:00
|
|
|
WM_gizmomap_tag_refresh(gzmap);
|
2009-01-01 13:15:35 +00:00
|
|
|
break;
|
2010-10-13 01:10:56 +00:00
|
|
|
case ND_WORLD:
|
2010-10-20 04:12:01 +00:00
|
|
|
/* handled by space_view3d_listener() for v3d access */
|
2010-10-13 01:10:56 +00:00
|
|
|
break;
|
2015-01-19 16:30:35 +11:00
|
|
|
case ND_DRAW_RENDER_VIEWPORT: {
|
|
|
|
|
if (v3d->camera && (scene == wmn->reference)) {
|
|
|
|
|
if (rv3d->persp == RV3D_CAMOB) {
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2015-01-19 16:30:35 +11:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2008-12-27 17:43:05 +00:00
|
|
|
}
|
2019-03-26 21:16:47 +11:00
|
|
|
if (wmn->action == NA_EDITED) {
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2008-12-27 17:43:05 +00:00
|
|
|
break;
|
2008-12-29 12:15:42 +00:00
|
|
|
case NC_OBJECT:
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (wmn->data) {
|
2008-12-29 12:15:42 +00:00
|
|
|
case ND_BONE_ACTIVE:
|
|
|
|
|
case ND_BONE_SELECT:
|
2023-09-08 15:15:34 +02:00
|
|
|
case ND_BONE_COLLECTION:
|
2008-12-29 12:15:42 +00:00
|
|
|
case ND_TRANSFORM:
|
2009-09-19 11:59:23 +00:00
|
|
|
case ND_POSE:
|
2009-01-03 05:41:58 +00:00
|
|
|
case ND_DRAW:
|
2009-01-03 07:25:22 +00:00
|
|
|
case ND_MODIFIER:
|
2020-07-06 13:17:07 -04:00
|
|
|
case ND_SHADERFX:
|
2009-05-27 00:03:49 +00:00
|
|
|
case ND_CONSTRAINT:
|
2009-01-28 18:26:47 +00:00
|
|
|
case ND_KEYS:
|
2016-12-28 17:30:58 +01:00
|
|
|
case ND_PARTICLE:
|
2017-03-06 16:25:26 +01:00
|
|
|
case ND_POINTCACHE:
|
2013-12-17 14:42:47 -08:00
|
|
|
case ND_LOD:
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2018-07-15 14:24:10 +02:00
|
|
|
WM_gizmomap_tag_refresh(gzmap);
|
2009-01-03 05:41:58 +00:00
|
|
|
break;
|
2021-03-18 13:42:28 +01:00
|
|
|
case ND_DRAW_ANIMVIZ:
|
|
|
|
|
ED_region_tag_redraw(region);
|
|
|
|
|
break;
|
2009-01-03 05:41:58 +00:00
|
|
|
}
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (wmn->action) {
|
2010-11-25 14:56:02 +00:00
|
|
|
case NA_ADDED:
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2010-11-25 14:56:02 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
break;
|
|
|
|
|
case NC_GEOM:
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (wmn->data) {
|
2017-03-06 03:58:08 +01:00
|
|
|
case ND_SELECT: {
|
2018-07-15 14:24:10 +02:00
|
|
|
WM_gizmomap_tag_refresh(gzmap);
|
2017-05-21 09:39:31 +10:00
|
|
|
ATTR_FALLTHROUGH;
|
2017-03-06 03:58:08 +01:00
|
|
|
}
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
case ND_DATA:
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2019-11-08 19:17:27 +11:00
|
|
|
WM_gizmomap_tag_refresh(gzmap);
|
|
|
|
|
break;
|
2012-11-25 06:55:39 +00:00
|
|
|
case ND_VERTEX_GROUP:
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (wmn->action) {
|
2010-01-11 05:10:57 +00:00
|
|
|
case NA_EDITED:
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2010-01-11 05:10:57 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
break;
|
2015-01-19 15:40:05 +11:00
|
|
|
case NC_CAMERA:
|
|
|
|
|
switch (wmn->data) {
|
|
|
|
|
case ND_DRAW_RENDER_VIEWPORT: {
|
|
|
|
|
if (v3d->camera && (v3d->camera->data == wmn->reference)) {
|
|
|
|
|
if (rv3d->persp == RV3D_CAMOB) {
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2015-01-19 15:40:05 +11:00
|
|
|
}
|
|
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2015-01-19 15:40:05 +11:00
|
|
|
}
|
|
|
|
|
break;
|
2009-01-20 11:09:26 +00:00
|
|
|
case NC_GROUP:
|
|
|
|
|
/* all group ops for now */
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2009-01-20 11:09:26 +00:00
|
|
|
break;
|
2010-01-04 00:39:55 +00:00
|
|
|
case NC_BRUSH:
|
2015-02-17 03:26:03 +01:00
|
|
|
switch (wmn->action) {
|
|
|
|
|
case NA_EDITED:
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw_cursor(region);
|
2015-02-18 09:08:24 +11:00
|
|
|
break;
|
2015-02-17 03:26:03 +01:00
|
|
|
case NA_SELECTED:
|
2015-02-18 09:08:24 +11:00
|
|
|
/* used on brush changes - needed because 3d cursor
|
|
|
|
|
* has to be drawn if clone brush is selected */
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2015-02-18 09:08:24 +11:00
|
|
|
break;
|
2015-02-17 03:26:03 +01:00
|
|
|
}
|
2012-10-21 05:46:41 +00:00
|
|
|
break;
|
2009-01-03 05:41:58 +00:00
|
|
|
case NC_MATERIAL:
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (wmn->data) {
|
2013-06-24 22:41:33 +00:00
|
|
|
case ND_SHADING:
|
|
|
|
|
case ND_NODES:
|
2020-09-19 14:32:41 +10:00
|
|
|
/* TODO(sergey): This is a bit too much updates, but needed to
|
2017-01-24 12:25:58 +01:00
|
|
|
* have proper material drivers update in the viewport.
|
|
|
|
|
*
|
|
|
|
|
* How to solve?
|
|
|
|
|
*/
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2013-06-24 22:41:33 +00:00
|
|
|
break;
|
2009-01-03 05:41:58 +00:00
|
|
|
case ND_SHADING_DRAW:
|
2012-11-26 08:52:07 +00:00
|
|
|
case ND_SHADING_LINKS:
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2009-01-03 05:41:58 +00:00
|
|
|
break;
|
|
|
|
|
}
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
break;
|
2022-08-10 09:14:22 +02:00
|
|
|
case NC_NODE:
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
switch (wmn->data) {
|
|
|
|
|
case ND_NODE_GIZMO: {
|
|
|
|
|
WM_gizmomap_tag_refresh(gzmap);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-08-10 09:14:22 +02:00
|
|
|
ED_region_tag_redraw(region);
|
|
|
|
|
break;
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
case NC_WORLD:
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (wmn->data) {
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
case ND_WORLD_DRAW:
|
2010-10-20 04:12:01 +00:00
|
|
|
/* handled by space_view3d_listener() for v3d access */
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
break;
|
2017-06-29 12:24:05 +02:00
|
|
|
case ND_WORLD:
|
|
|
|
|
/* Needed for updating world materials */
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2017-06-29 12:24:05 +02:00
|
|
|
break;
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
}
|
|
|
|
|
break;
|
2009-01-03 05:41:58 +00:00
|
|
|
case NC_LAMP:
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (wmn->data) {
|
2013-06-26 12:33:30 +00:00
|
|
|
case ND_LIGHTING:
|
2017-01-24 12:52:05 +01:00
|
|
|
/* TODO(sergey): This is a bit too much, but needed to
|
|
|
|
|
* handle updates from new depsgraph.
|
|
|
|
|
*/
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2008-12-29 12:15:42 +00:00
|
|
|
break;
|
2013-06-26 12:33:30 +00:00
|
|
|
case ND_LIGHTING_DRAW:
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2018-07-15 14:24:10 +02:00
|
|
|
WM_gizmomap_tag_refresh(gzmap);
|
2013-06-26 12:33:30 +00:00
|
|
|
break;
|
2008-12-29 12:15:42 +00:00
|
|
|
}
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
break;
|
2018-07-10 15:02:25 +02:00
|
|
|
case NC_LIGHTPROBE:
|
2020-04-03 13:25:03 +02:00
|
|
|
ED_area_tag_refresh(area);
|
2018-07-10 15:02:25 +02:00
|
|
|
break;
|
2012-10-21 05:46:41 +00:00
|
|
|
case NC_IMAGE:
|
2009-02-19 23:53:40 +00:00
|
|
|
/* this could be more fine grained checks if we had
|
|
|
|
|
* more context than just the region */
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2009-02-19 23:53:40 +00:00
|
|
|
break;
|
2012-10-21 05:46:41 +00:00
|
|
|
case NC_TEXTURE:
|
2024-06-23 12:14:19 +10:00
|
|
|
/* Same as #NC_IMAGE. */
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2010-05-24 07:30:50 +00:00
|
|
|
break;
|
2011-11-07 12:55:18 +00:00
|
|
|
case NC_MOVIECLIP:
|
2019-03-26 21:16:47 +11:00
|
|
|
if (wmn->data == ND_DISPLAY || wmn->action == NA_EDITED) {
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2011-11-07 12:55:18 +00:00
|
|
|
break;
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
case NC_SPACE:
|
2012-02-22 16:52:06 +00:00
|
|
|
if (wmn->data == ND_SPACE_VIEW3D) {
|
2010-03-09 06:20:08 +00:00
|
|
|
if (wmn->subtype == NS_VIEW3D_GPU) {
|
|
|
|
|
rv3d->rflag |= RV3D_GPULIGHT_UPDATE;
|
|
|
|
|
}
|
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 20:20:55 +01:00
|
|
|
else if (wmn->subtype == NS_VIEW3D_SHADING) {
|
2021-01-28 13:36:23 +01:00
|
|
|
#ifdef WITH_XR_OPENXR
|
2022-09-23 16:51:29 +02:00
|
|
|
ED_view3d_xr_shading_update(
|
|
|
|
|
static_cast<wmWindowManager *>(G_MAIN->wm.first), v3d, scene);
|
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 20:20:55 +01:00
|
|
|
#endif
|
2021-01-28 13:36:23 +01:00
|
|
|
|
2021-01-29 15:55:41 +01:00
|
|
|
ViewLayer *view_layer = WM_window_get_active_view_layer(window);
|
2021-01-28 13:36:23 +01:00
|
|
|
Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer);
|
|
|
|
|
if (depsgraph) {
|
2021-01-29 15:55:41 +01:00
|
|
|
ED_render_view3d_update(depsgraph, window, area, true);
|
2021-01-28 13:36:23 +01:00
|
|
|
}
|
|
|
|
|
}
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2018-07-15 14:24:10 +02:00
|
|
|
WM_gizmomap_tag_refresh(gzmap);
|
2010-03-09 06:20:08 +00:00
|
|
|
}
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
break;
|
2009-11-25 23:13:47 +00:00
|
|
|
case NC_ID:
|
2021-03-18 15:28:21 +01:00
|
|
|
if (ELEM(wmn->action, NA_RENAME, NA_EDITED, NA_ADDED, NA_REMOVED)) {
|
2024-07-23 18:23:02 +02:00
|
|
|
if (ELEM(wmn->action, NA_EDITED, NA_REMOVED) && v3d->localvd &&
|
|
|
|
|
v3d->localvd->runtime.flag & V3D_RUNTIME_LOCAL_MAYBE_EMPTY)
|
|
|
|
|
{
|
|
|
|
|
ED_area_tag_refresh(area);
|
|
|
|
|
}
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
WM_gizmomap_tag_refresh(gzmap);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2009-11-25 23:13:47 +00:00
|
|
|
break;
|
2010-01-27 11:56:14 +00:00
|
|
|
case NC_SCREEN:
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (wmn->data) {
|
2010-10-02 09:28:41 +00:00
|
|
|
case ND_ANIMPLAY:
|
2010-12-12 16:15:49 +00:00
|
|
|
case ND_SKETCH:
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2010-10-02 09:28:41 +00:00
|
|
|
break;
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
case ND_LAYOUTBROWSE:
|
|
|
|
|
case ND_LAYOUTDELETE:
|
|
|
|
|
case ND_LAYOUTSET:
|
2018-07-15 14:24:10 +02:00
|
|
|
WM_gizmomap_tag_refresh(gzmap);
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2010-10-02 09:28:41 +00:00
|
|
|
break;
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
case ND_LAYER:
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
break;
|
2010-10-02 09:28:41 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2010-01-27 11:56:14 +00:00
|
|
|
break;
|
2012-10-05 19:51:11 +00:00
|
|
|
case NC_GPENCIL:
|
2015-04-22 14:02:48 +02:00
|
|
|
if (wmn->data == ND_DATA || ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
- Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
to enter "Stroke Edit Mode". In this mode, many common editing tools will
operate on Grease Pencil stroke points instead.
- Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
- Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
NOTE: Currently drivers don't work, but if time allows, this may still be
added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
colour/opacity settings to the ones used for the lines themselves.
This makes use of OpenGL filled polys, which has the limitation of only
being able to fill convex shapes. Some artifacts may be visible on concave
shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
has been added which draws strokes as a series of screen-aligned discs.
While this was originally a partial experimental technique at getting better
quality 3D lines, the effects possible using this technique were interesting
enough to warrant making this a dedicated feature. Best results when partial
opacity and large stroke widths are used.
5) Improved Onion Skinning Support
- Different colours can be selected for the before/after ghosts. To do so,
enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
the colours accordingly.
- Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
the active object.
- For a long time, the object-attachment has proved to be quite problematic
for users to keep track of. Now that this is done at scene level, it is
easier for most users to use.
- An exception for old files (and for any addons which may benefit from object
attachment instead), is that if the active object has a Grease Pencil datablock,
that will be used instead.
- It is not currently possible to choose object-attachment from the UI, but
it is simple to do this from the console instead, by doing:
context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
- The layers UI has been cleaned up to use a list instead of the nested-panels
design. Apart from saving space, this is also much nicer to look at now.
- The UI code is now all defined in Python. To support this, it has been necessary
to add some new context properties to make it easier to access these settings.
e.g. "gpencil_data" for the datablock
"active_gpencil_layer" and "active_gpencil_frame" for active data,
"editable_gpencil_strokes" for the strokes that can be edited
- The "stroke placement/alignment" settings (previously "Drawing Settings" at the
bottom of the Grease Pencil panel in the Properties Region) is now located in
the toolbar. These were more toolsettings than properties for how GPencil got drawn.
- "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
suggestion for an earlier discussion on developer.blender.org
- By default, the painting operator will wait for a mouse button to be pressed
before it starts creating the stroke. This is to make it easier to include
this operator in various toolbars/menus/etc. To get it immediately starting
(as when you hold down DKEy to draw), set "wait_for_input" to False.
- GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
- Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
A set of experimental pie menus has been included for quick access to many
tools and settings. It is not necessary to use these to get things done,
but they have been designed to help make certain common tasks easier.
- Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
spatially stable manner.
- D Q = "Quick Settings" pie. This allows quick access to the active
layer's settings. Notably, colours, thickness, and turning
onion skinning on/off.
2014-12-01 01:52:06 +13:00
|
|
|
}
|
2012-10-05 19:51:11 +00:00
|
|
|
break;
|
2022-07-07 18:14:05 +02:00
|
|
|
case NC_WORKSPACE:
|
|
|
|
|
/* In case the region displays workspace settings. */
|
|
|
|
|
ED_region_tag_redraw(region);
|
|
|
|
|
break;
|
Geometry Nodes: viewport preview
This adds support for showing geometry passed to the Viewer in the 3d
viewport (instead of just in the spreadsheet). The "viewer geometry"
bypasses the group output. So it is not necessary to change the final
output of the node group to be able to see the intermediate geometry.
**Activation and deactivation of a viewer node**
* A viewer node is activated by clicking on it.
* Ctrl+shift+click on any node/socket connects it to the viewer and
makes it active.
* Ctrl+shift+click in empty space deactivates the active viewer.
* When the active viewer is not visible anymore (e.g. another object
is selected, or the current node group is exit), it is deactivated.
* Clicking on the icon in the header of the Viewer node toggles whether
its active or not.
**Pinning**
* The spreadsheet still allows pinning the active viewer as before.
When pinned, the spreadsheet still references the viewer node even
when it becomes inactive.
* The viewport does not support pinning at the moment. It always shows
the active viewer.
**Attribute**
* When a field is linked to the second input of the viewer node it is
displayed as an overlay in the viewport.
* When possible the correct domain for the attribute is determined
automatically. This does not work in all cases. It falls back to the
face corner domain on meshes and the point domain on curves. When
necessary, the domain can be picked manually.
* The spreadsheet now only shows the "Viewer" column for the domain
that is selected in the Viewer node.
* Instance attributes are visualized as a constant color per instance.
**Viewport Options**
* The attribute overlay opacity can be controlled with the "Viewer Node"
setting in the overlays popover.
* A viewport can be configured not to show intermediate viewer-geometry
by disabling the "Viewer Node" option in the "View" menu.
**Implementation Details**
* The "spreadsheet context path" was generalized to a "viewer path" that
is used in more places now.
* The viewer node itself determines the attribute domain, evaluates the
field and stores the result in a `.viewer` attribute.
* A new "viewer attribute' overlay displays the data from the `.viewer`
attribute.
* The ground truth for the active viewer node is stored in the workspace
now. Node editors, spreadsheets and viewports retrieve the active
viewer from there unless they are pinned.
* The depsgraph object iterator has a new "viewer path" setting. When set,
the viewed geometry of the corresponding object is part of the iterator
instead of the final evaluated geometry.
* To support the instance attribute overlay `DupliObject` was extended
to contain the information necessary for drawing the overlay.
* The ctrl+shift+click operator has been refactored so that it can make
existing links to viewers active again.
* The auto-domain-detection in the Viewer node works by checking the
"preferred domain" for every field input. If there is not exactly one
preferred domain, the fallback is used.
Known limitations:
* Loose edges of meshes don't have the attribute overlay. This could be
added separately if necessary.
* Some attributes are hard to visualize as a color directly. For example,
the values might have to be normalized or some should be drawn as arrays.
For now, we encourage users to build node groups that generate appropriate
viewer-geometry. We might include some of that functionality in future versions.
Support for displaying attribute values as text in the viewport is planned as well.
* There seems to be an issue with the attribute overlay for pointclouds on
nvidia gpus, to be investigated.
Differential Revision: https://developer.blender.org/D15954
2022-09-28 17:54:59 +02:00
|
|
|
case NC_VIEWER_PATH: {
|
|
|
|
|
if (v3d->flag2 & V3D_SHOW_VIEWER) {
|
|
|
|
|
ViewLayer *view_layer = WM_window_get_active_view_layer(window);
|
|
|
|
|
if (Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer)) {
|
|
|
|
|
ED_render_view3d_update(depsgraph, window, area, true);
|
|
|
|
|
}
|
|
|
|
|
ED_region_tag_redraw(region);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2008-12-27 17:43:05 +00:00
|
|
|
}
|
|
|
|
|
}
|
2008-12-13 19:08:44 +00:00
|
|
|
|
2023-06-03 08:36:28 +10:00
|
|
|
static void view3d_do_msg_notify_workbench_view_update(bContext *C,
|
|
|
|
|
wmMsgSubscribeKey * /*msg_key*/,
|
|
|
|
|
wmMsgSubscribeValue *msg_val)
|
2022-04-08 16:37:35 +02:00
|
|
|
{
|
|
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
|
ScrArea *area = (ScrArea *)msg_val->user_data;
|
|
|
|
|
View3D *v3d = (View3D *)area->spacedata.first;
|
|
|
|
|
if (v3d->shading.type == OB_SOLID) {
|
|
|
|
|
RenderEngineType *engine_type = ED_view3d_engine_type(scene, v3d->shading.type);
|
2022-09-23 16:51:29 +02:00
|
|
|
DRWUpdateContext drw_context = {nullptr};
|
2022-04-08 16:37:35 +02:00
|
|
|
drw_context.bmain = CTX_data_main(C);
|
|
|
|
|
drw_context.depsgraph = CTX_data_depsgraph_pointer(C);
|
|
|
|
|
drw_context.scene = scene;
|
|
|
|
|
drw_context.view_layer = CTX_data_view_layer(C);
|
|
|
|
|
drw_context.region = (ARegion *)(msg_val->owner);
|
|
|
|
|
drw_context.v3d = v3d;
|
|
|
|
|
drw_context.engine_type = engine_type;
|
|
|
|
|
DRW_notify_view_update(&drw_context);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-19 12:59:00 +11:00
|
|
|
static void view3d_main_region_message_subscribe(const wmRegionMessageSubscribeParams *params)
|
2017-11-13 19:43:34 +11:00
|
|
|
{
|
2023-06-03 08:36:28 +10:00
|
|
|
wmMsgBus *mbus = params->message_bus;
|
2021-01-18 17:28:47 -06:00
|
|
|
const bContext *C = params->context;
|
|
|
|
|
ScrArea *area = params->area;
|
|
|
|
|
ARegion *region = params->region;
|
|
|
|
|
|
2021-07-03 23:08:40 +10:00
|
|
|
/* Developer NOTE: there are many properties that impact 3D view drawing,
|
2017-11-13 19:43:34 +11:00
|
|
|
* so instead of subscribing to individual properties, just subscribe to types
|
|
|
|
|
* accepting some redundant redraws.
|
|
|
|
|
*
|
|
|
|
|
* For other space types we might try avoid this, keep the 3D view as an exceptional case! */
|
2022-10-05 13:44:02 -05:00
|
|
|
wmMsgParams_RNA msg_key_params{};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-11-13 19:43:34 +11:00
|
|
|
/* Only subscribe to types. */
|
|
|
|
|
StructRNA *type_array[] = {
|
2017-12-15 15:46:42 +01:00
|
|
|
&RNA_Window,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-11-13 19:43:34 +11:00
|
|
|
/* These object have properties that impact drawing. */
|
2018-06-27 14:41:53 +02:00
|
|
|
&RNA_AreaLight,
|
2017-11-13 19:43:34 +11:00
|
|
|
&RNA_Camera,
|
2018-06-27 14:41:53 +02:00
|
|
|
&RNA_Light,
|
2017-11-13 19:43:34 +11:00
|
|
|
&RNA_Speaker,
|
2018-06-27 14:41:53 +02:00
|
|
|
&RNA_SunLight,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-11-13 19:43:34 +11:00
|
|
|
/* General types the 3D view depends on. */
|
|
|
|
|
&RNA_Object,
|
|
|
|
|
&RNA_UnitSettings, /* grid-floor */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-12-16 00:15:13 +11:00
|
|
|
&RNA_View3DCursor,
|
2018-04-30 12:33:46 +02:00
|
|
|
&RNA_View3DOverlay,
|
|
|
|
|
&RNA_View3DShading,
|
2017-11-13 19:43:34 +11:00
|
|
|
&RNA_World,
|
|
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-09-23 16:51:29 +02:00
|
|
|
wmMsgSubscribeValue msg_sub_value_region_tag_redraw{};
|
|
|
|
|
msg_sub_value_region_tag_redraw.owner = region;
|
|
|
|
|
msg_sub_value_region_tag_redraw.user_data = region;
|
|
|
|
|
msg_sub_value_region_tag_redraw.notify = ED_region_do_msg_notify_tag_redraw;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-09-23 16:51:29 +02:00
|
|
|
wmMsgSubscribeValue msg_sub_value_workbench_view_update{};
|
|
|
|
|
msg_sub_value_workbench_view_update.owner = region;
|
|
|
|
|
msg_sub_value_workbench_view_update.user_data = area;
|
|
|
|
|
msg_sub_value_workbench_view_update.notify = view3d_do_msg_notify_workbench_view_update;
|
2022-04-08 16:37:35 +02:00
|
|
|
|
2017-11-13 19:43:34 +11:00
|
|
|
for (int i = 0; i < ARRAY_SIZE(type_array); i++) {
|
|
|
|
|
msg_key_params.ptr.type = type_array[i];
|
|
|
|
|
WM_msg_subscribe_rna_params(mbus, &msg_key_params, &msg_sub_value_region_tag_redraw, __func__);
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-11-13 19:43:34 +11:00
|
|
|
/* Subscribe to a handful of other properties. */
|
2022-09-23 16:51:29 +02:00
|
|
|
RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-17 13:35:05 +02:00
|
|
|
WM_msg_subscribe_rna_anon_prop(mbus, RenderSettings, engine, &msg_sub_value_region_tag_redraw);
|
2017-11-13 19:43:34 +11:00
|
|
|
WM_msg_subscribe_rna_anon_prop(
|
|
|
|
|
mbus, RenderSettings, resolution_x, &msg_sub_value_region_tag_redraw);
|
|
|
|
|
WM_msg_subscribe_rna_anon_prop(
|
|
|
|
|
mbus, RenderSettings, resolution_y, &msg_sub_value_region_tag_redraw);
|
|
|
|
|
WM_msg_subscribe_rna_anon_prop(
|
|
|
|
|
mbus, RenderSettings, pixel_aspect_x, &msg_sub_value_region_tag_redraw);
|
|
|
|
|
WM_msg_subscribe_rna_anon_prop(
|
|
|
|
|
mbus, RenderSettings, pixel_aspect_y, &msg_sub_value_region_tag_redraw);
|
|
|
|
|
if (rv3d->persp == RV3D_CAMOB) {
|
|
|
|
|
WM_msg_subscribe_rna_anon_prop(
|
|
|
|
|
mbus, RenderSettings, use_border, &msg_sub_value_region_tag_redraw);
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-16 19:34:24 +02:00
|
|
|
WM_msg_subscribe_rna_anon_type(mbus, SceneEEVEE, &msg_sub_value_region_tag_redraw);
|
2018-05-09 13:30:27 +02:00
|
|
|
WM_msg_subscribe_rna_anon_type(mbus, SceneDisplay, &msg_sub_value_region_tag_redraw);
|
2018-05-09 15:13:12 +02:00
|
|
|
WM_msg_subscribe_rna_anon_type(mbus, ObjectDisplay, &msg_sub_value_region_tag_redraw);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-09-14 21:33:51 +02:00
|
|
|
const Scene *scene = CTX_data_scene(C);
|
2018-05-09 14:59:29 +02:00
|
|
|
ViewLayer *view_layer = CTX_data_view_layer(C);
|
2022-09-14 21:33:51 +02:00
|
|
|
BKE_view_layer_synced_ensure(scene, view_layer);
|
2022-09-01 10:00:53 +02:00
|
|
|
Object *obact = BKE_view_layer_active_object_get(view_layer);
|
2022-09-23 16:51:29 +02:00
|
|
|
if (obact != nullptr) {
|
2018-05-09 14:59:29 +02:00
|
|
|
switch (obact->mode) {
|
|
|
|
|
case OB_MODE_PARTICLE_EDIT:
|
|
|
|
|
WM_msg_subscribe_rna_anon_type(mbus, ParticleEdit, &msg_sub_value_region_tag_redraw);
|
|
|
|
|
break;
|
2022-04-08 16:37:35 +02:00
|
|
|
|
|
|
|
|
case OB_MODE_SCULPT:
|
|
|
|
|
WM_msg_subscribe_rna_anon_prop(
|
|
|
|
|
mbus, WorkSpace, tools, &msg_sub_value_workbench_view_update);
|
|
|
|
|
break;
|
2018-05-09 14:59:29 +02:00
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2019-06-28 18:47:47 +10:00
|
|
|
|
|
|
|
|
{
|
2022-09-23 16:51:29 +02:00
|
|
|
wmMsgSubscribeValue msg_sub_value_region_tag_refresh{};
|
|
|
|
|
msg_sub_value_region_tag_refresh.owner = region;
|
|
|
|
|
msg_sub_value_region_tag_refresh.user_data = area;
|
|
|
|
|
msg_sub_value_region_tag_refresh.notify = WM_toolsystem_do_msg_notify_tag_refresh;
|
2019-06-28 18:47:47 +10:00
|
|
|
WM_msg_subscribe_rna_anon_prop(mbus, Object, mode, &msg_sub_value_region_tag_refresh);
|
|
|
|
|
WM_msg_subscribe_rna_anon_prop(mbus, LayerObjects, active, &msg_sub_value_region_tag_refresh);
|
|
|
|
|
}
|
2017-11-13 19:43:34 +11:00
|
|
|
}
|
|
|
|
|
|
2020-05-25 11:53:02 +02:00
|
|
|
/* concept is to retrieve cursor type context-less */
|
2020-04-03 13:25:03 +02:00
|
|
|
static void view3d_main_region_cursor(wmWindow *win, ScrArea *area, ARegion *region)
|
2009-01-04 19:17:34 +00:00
|
|
|
{
|
2020-05-25 11:53:02 +02:00
|
|
|
if (WM_cursor_set_from_tool(win, area, region)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-14 21:33:51 +02:00
|
|
|
Scene *scene = WM_window_get_active_scene(win);
|
2020-05-25 11:53:02 +02:00
|
|
|
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
|
2022-09-14 21:33:51 +02:00
|
|
|
BKE_view_layer_synced_ensure(scene, view_layer);
|
2022-09-01 10:00:53 +02:00
|
|
|
Object *obedit = BKE_view_layer_edit_object_get(view_layer);
|
2020-05-25 11:53:02 +02:00
|
|
|
if (obedit) {
|
|
|
|
|
WM_cursor_set(win, WM_CURSOR_EDIT);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2019-09-26 14:31:48 +02:00
|
|
|
WM_cursor_set(win, WM_CURSOR_DEFAULT);
|
2009-01-04 19:17:34 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-12 18:47:12 +00:00
|
|
|
/* add handlers, stuff you only do once or on area/region changes */
|
2020-03-06 16:56:42 +01:00
|
|
|
static void view3d_header_region_init(wmWindowManager *wm, ARegion *region)
|
2008-12-12 18:47:12 +00:00
|
|
|
{
|
2023-09-14 13:32:42 +10:00
|
|
|
wmKeyMap *keymap = WM_keymap_ensure(
|
|
|
|
|
wm->defaultconf, "3D View Generic", SPACE_VIEW3D, RGN_TYPE_WINDOW);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2009-07-11 13:32:20 +00:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_header_init(region);
|
2008-12-12 18:47:12 +00:00
|
|
|
}
|
|
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
static void view3d_header_region_draw(const bContext *C, ARegion *region)
|
2008-12-12 18:47:12 +00:00
|
|
|
{
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_header(C, region);
|
2008-12-12 18:47:12 +00:00
|
|
|
}
|
|
|
|
|
|
2021-01-19 12:59:00 +11:00
|
|
|
static void view3d_header_region_listener(const wmRegionListenerParams *params)
|
2009-01-01 13:15:35 +00:00
|
|
|
{
|
2021-01-18 17:28:47 -06:00
|
|
|
ARegion *region = params->region;
|
2022-08-27 12:50:43 +10:00
|
|
|
const wmNotifier *wmn = params->notifier;
|
2021-01-18 17:28:47 -06:00
|
|
|
|
2009-01-01 13:15:35 +00:00
|
|
|
/* context changes */
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (wmn->category) {
|
2009-01-01 13:15:35 +00:00
|
|
|
case NC_SCENE:
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (wmn->data) {
|
2009-01-01 13:15:35 +00:00
|
|
|
case ND_FRAME:
|
|
|
|
|
case ND_OB_ACTIVE:
|
|
|
|
|
case ND_OB_SELECT:
|
2010-09-27 21:22:20 +00:00
|
|
|
case ND_OB_VISIBLE:
|
2009-01-01 13:15:35 +00:00
|
|
|
case ND_MODE:
|
2009-10-26 12:42:25 +00:00
|
|
|
case ND_LAYER:
|
2010-01-14 01:47:25 +00:00
|
|
|
case ND_TOOLSETTINGS:
|
2010-08-28 07:07:02 +00:00
|
|
|
case ND_LAYER_CONTENT:
|
2014-06-06 14:14:56 +02:00
|
|
|
case ND_RENDER_OPTIONS:
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2009-01-01 13:15:35 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
case NC_SPACE:
|
2023-09-14 17:43:33 +02:00
|
|
|
switch (wmn->data) {
|
|
|
|
|
case ND_SPACE_VIEW3D:
|
|
|
|
|
ED_region_tag_redraw(region);
|
|
|
|
|
break;
|
|
|
|
|
case ND_SPACE_ASSET_PARAMS:
|
|
|
|
|
blender::ed::geometry::clear_operator_asset_trees();
|
|
|
|
|
ED_region_tag_redraw(region);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case NC_ASSET:
|
|
|
|
|
switch (wmn->data) {
|
2023-10-19 16:55:58 +02:00
|
|
|
case ND_ASSET_CATALOGS:
|
2023-09-14 17:43:33 +02:00
|
|
|
case ND_ASSET_LIST_READING:
|
|
|
|
|
blender::ed::geometry::clear_operator_asset_trees();
|
|
|
|
|
ED_region_tag_redraw(region);
|
|
|
|
|
break;
|
2023-09-26 16:38:50 +02:00
|
|
|
default:
|
|
|
|
|
if (ELEM(wmn->action, NA_ADDED, NA_REMOVED)) {
|
|
|
|
|
blender::ed::geometry::clear_operator_asset_trees();
|
|
|
|
|
ED_region_tag_redraw(region);
|
|
|
|
|
}
|
2023-09-14 17:43:33 +02:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case NC_NODE:
|
|
|
|
|
switch (wmn->data) {
|
|
|
|
|
case ND_NODE_ASSET_DATA:
|
|
|
|
|
blender::ed::geometry::clear_operator_asset_trees();
|
|
|
|
|
ED_region_tag_redraw(region);
|
|
|
|
|
break;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
break;
|
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
- Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
to enter "Stroke Edit Mode". In this mode, many common editing tools will
operate on Grease Pencil stroke points instead.
- Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
- Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
NOTE: Currently drivers don't work, but if time allows, this may still be
added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
colour/opacity settings to the ones used for the lines themselves.
This makes use of OpenGL filled polys, which has the limitation of only
being able to fill convex shapes. Some artifacts may be visible on concave
shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
has been added which draws strokes as a series of screen-aligned discs.
While this was originally a partial experimental technique at getting better
quality 3D lines, the effects possible using this technique were interesting
enough to warrant making this a dedicated feature. Best results when partial
opacity and large stroke widths are used.
5) Improved Onion Skinning Support
- Different colours can be selected for the before/after ghosts. To do so,
enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
the colours accordingly.
- Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
the active object.
- For a long time, the object-attachment has proved to be quite problematic
for users to keep track of. Now that this is done at scene level, it is
easier for most users to use.
- An exception for old files (and for any addons which may benefit from object
attachment instead), is that if the active object has a Grease Pencil datablock,
that will be used instead.
- It is not currently possible to choose object-attachment from the UI, but
it is simple to do this from the console instead, by doing:
context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
- The layers UI has been cleaned up to use a list instead of the nested-panels
design. Apart from saving space, this is also much nicer to look at now.
- The UI code is now all defined in Python. To support this, it has been necessary
to add some new context properties to make it easier to access these settings.
e.g. "gpencil_data" for the datablock
"active_gpencil_layer" and "active_gpencil_frame" for active data,
"editable_gpencil_strokes" for the strokes that can be edited
- The "stroke placement/alignment" settings (previously "Drawing Settings" at the
bottom of the Grease Pencil panel in the Properties Region) is now located in
the toolbar. These were more toolsettings than properties for how GPencil got drawn.
- "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
suggestion for an earlier discussion on developer.blender.org
- By default, the painting operator will wait for a mouse button to be pressed
before it starts creating the stroke. This is to make it easier to include
this operator in various toolbars/menus/etc. To get it immediately starting
(as when you hold down DKEy to draw), set "wait_for_input" to False.
- GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
- Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
A set of experimental pie menus has been included for quick access to many
tools and settings. It is not necessary to use these to get things done,
but they have been designed to help make certain common tasks easier.
- Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
spatially stable manner.
- D Q = "Quick Settings" pie. This allows quick access to the active
layer's settings. Notably, colours, thickness, and turning
onion skinning on/off.
2014-12-01 01:52:06 +13:00
|
|
|
case NC_GPENCIL:
|
2019-03-26 21:16:47 +11:00
|
|
|
if (wmn->data & ND_GPENCIL_EDITMODE) {
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2019-10-15 14:56:50 +02:00
|
|
|
else if (wmn->action == NA_EDITED) {
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2019-10-15 14:56:50 +02:00
|
|
|
}
|
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
- Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
to enter "Stroke Edit Mode". In this mode, many common editing tools will
operate on Grease Pencil stroke points instead.
- Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
- Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
NOTE: Currently drivers don't work, but if time allows, this may still be
added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
colour/opacity settings to the ones used for the lines themselves.
This makes use of OpenGL filled polys, which has the limitation of only
being able to fill convex shapes. Some artifacts may be visible on concave
shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
has been added which draws strokes as a series of screen-aligned discs.
While this was originally a partial experimental technique at getting better
quality 3D lines, the effects possible using this technique were interesting
enough to warrant making this a dedicated feature. Best results when partial
opacity and large stroke widths are used.
5) Improved Onion Skinning Support
- Different colours can be selected for the before/after ghosts. To do so,
enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
the colours accordingly.
- Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
the active object.
- For a long time, the object-attachment has proved to be quite problematic
for users to keep track of. Now that this is done at scene level, it is
easier for most users to use.
- An exception for old files (and for any addons which may benefit from object
attachment instead), is that if the active object has a Grease Pencil datablock,
that will be used instead.
- It is not currently possible to choose object-attachment from the UI, but
it is simple to do this from the console instead, by doing:
context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
- The layers UI has been cleaned up to use a list instead of the nested-panels
design. Apart from saving space, this is also much nicer to look at now.
- The UI code is now all defined in Python. To support this, it has been necessary
to add some new context properties to make it easier to access these settings.
e.g. "gpencil_data" for the datablock
"active_gpencil_layer" and "active_gpencil_frame" for active data,
"editable_gpencil_strokes" for the strokes that can be edited
- The "stroke placement/alignment" settings (previously "Drawing Settings" at the
bottom of the Grease Pencil panel in the Properties Region) is now located in
the toolbar. These were more toolsettings than properties for how GPencil got drawn.
- "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
suggestion for an earlier discussion on developer.blender.org
- By default, the painting operator will wait for a mouse button to be pressed
before it starts creating the stroke. This is to make it easier to include
this operator in various toolbars/menus/etc. To get it immediately starting
(as when you hold down DKEy to draw), set "wait_for_input" to False.
- GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
- Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
A set of experimental pie menus has been included for quick access to many
tools and settings. It is not necessary to use these to get things done,
but they have been designed to help make certain common tasks easier.
- Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
spatially stable manner.
- D Q = "Quick Settings" pie. This allows quick access to the active
layer's settings. Notably, colours, thickness, and turning
onion skinning on/off.
2014-12-01 01:52:06 +13:00
|
|
|
break;
|
2019-05-15 15:20:57 +02:00
|
|
|
case NC_BRUSH:
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2019-05-15 15:20:57 +02:00
|
|
|
break;
|
2023-09-12 15:43:57 +02:00
|
|
|
case NC_GEOM:
|
2024-03-26 15:29:11 +11:00
|
|
|
if (ELEM(wmn->data, ND_VERTEX_GROUP, ND_DATA)) {
|
2023-09-12 15:43:57 +02:00
|
|
|
ED_region_tag_redraw(region);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2024-01-23 17:27:28 +01:00
|
|
|
case NC_MATERIAL:
|
|
|
|
|
/* For the canvas picker. */
|
|
|
|
|
if (wmn->data == ND_SHADING_LINKS) {
|
|
|
|
|
ED_region_tag_redraw(region);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2009-01-01 13:15:35 +00:00
|
|
|
}
|
2019-04-18 21:13:22 +02:00
|
|
|
|
2022-09-17 14:46:50 +10:00
|
|
|
/* From top-bar, which ones are needed? split per header? */
|
2019-08-01 13:53:25 +10:00
|
|
|
/* Disable for now, re-enable if needed, or remove - campbell. */
|
2019-04-18 21:13:22 +02:00
|
|
|
#if 0
|
|
|
|
|
/* context changes */
|
|
|
|
|
switch (wmn->category) {
|
|
|
|
|
case NC_WM:
|
|
|
|
|
if (wmn->data == ND_HISTORY) {
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2019-04-18 21:13:22 +02:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case NC_SCENE:
|
|
|
|
|
if (wmn->data == ND_MODE) {
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2019-04-18 21:13:22 +02:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case NC_SPACE:
|
|
|
|
|
if (wmn->data == ND_SPACE_VIEW3D) {
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2019-04-18 21:13:22 +02:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case NC_GPENCIL:
|
|
|
|
|
if (wmn->data == ND_DATA) {
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2019-04-18 21:13:22 +02:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2009-01-01 13:15:35 +00:00
|
|
|
}
|
|
|
|
|
|
2021-01-19 12:59:00 +11:00
|
|
|
static void view3d_header_region_message_subscribe(const wmRegionMessageSubscribeParams *params)
|
2018-05-06 18:08:27 +02:00
|
|
|
{
|
2023-06-03 08:36:28 +10:00
|
|
|
wmMsgBus *mbus = params->message_bus;
|
2021-01-18 17:28:47 -06:00
|
|
|
ARegion *region = params->region;
|
|
|
|
|
|
2022-10-05 13:44:02 -05:00
|
|
|
wmMsgParams_RNA msg_key_params{};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-06 18:08:27 +02:00
|
|
|
/* Only subscribe to types. */
|
|
|
|
|
StructRNA *type_array[] = {
|
|
|
|
|
&RNA_View3DShading,
|
|
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-09-23 16:51:29 +02:00
|
|
|
wmMsgSubscribeValue msg_sub_value_region_tag_redraw{};
|
|
|
|
|
msg_sub_value_region_tag_redraw.owner = region;
|
|
|
|
|
msg_sub_value_region_tag_redraw.user_data = region;
|
|
|
|
|
msg_sub_value_region_tag_redraw.notify = ED_region_do_msg_notify_tag_redraw;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-06 18:08:27 +02:00
|
|
|
for (int i = 0; i < ARRAY_SIZE(type_array); i++) {
|
|
|
|
|
msg_key_params.ptr.type = type_array[i];
|
|
|
|
|
WM_msg_subscribe_rna_params(mbus, &msg_key_params, &msg_sub_value_region_tag_redraw, __func__);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-10 15:38:00 +00:00
|
|
|
/* add handlers, stuff you only do once or on area/region changes */
|
2020-03-06 16:56:42 +01:00
|
|
|
static void view3d_buttons_region_init(wmWindowManager *wm, ARegion *region)
|
2009-02-10 15:38:00 +00:00
|
|
|
{
|
2009-09-17 21:36:02 +00:00
|
|
|
wmKeyMap *keymap;
|
2009-05-19 17:13:33 +00:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_panels_init(wm, region);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2009-02-10 15:38:00 +00:00
|
|
|
}
|
|
|
|
|
|
2019-05-10 13:43:07 +10:00
|
|
|
void ED_view3d_buttons_region_layout_ex(const bContext *C,
|
2020-03-06 16:56:42 +01:00
|
|
|
ARegion *region,
|
2019-05-10 13:43:07 +10:00
|
|
|
const char *category_override)
|
2009-02-10 15:38:00 +00:00
|
|
|
{
|
2019-05-10 13:43:07 +10:00
|
|
|
const enum eContextObjectMode mode = CTX_data_mode_enum(C);
|
|
|
|
|
|
2022-09-23 16:51:29 +02:00
|
|
|
const char *contexts_base[4] = {nullptr};
|
2019-05-10 13:43:07 +10:00
|
|
|
contexts_base[0] = CTX_data_mode_string(C);
|
|
|
|
|
|
|
|
|
|
const char **contexts = &contexts_base[1];
|
|
|
|
|
|
|
|
|
|
switch (mode) {
|
|
|
|
|
case CTX_MODE_EDIT_MESH:
|
|
|
|
|
ARRAY_SET_ITEMS(contexts, ".mesh_edit");
|
|
|
|
|
break;
|
|
|
|
|
case CTX_MODE_EDIT_CURVE:
|
|
|
|
|
ARRAY_SET_ITEMS(contexts, ".curve_edit");
|
|
|
|
|
break;
|
2022-02-18 11:16:02 +01:00
|
|
|
case CTX_MODE_EDIT_CURVES:
|
|
|
|
|
ARRAY_SET_ITEMS(contexts, ".curves_edit");
|
|
|
|
|
break;
|
2019-05-10 13:43:07 +10:00
|
|
|
case CTX_MODE_EDIT_SURFACE:
|
|
|
|
|
ARRAY_SET_ITEMS(contexts, ".curve_edit");
|
|
|
|
|
break;
|
|
|
|
|
case CTX_MODE_EDIT_TEXT:
|
|
|
|
|
ARRAY_SET_ITEMS(contexts, ".text_edit");
|
|
|
|
|
break;
|
|
|
|
|
case CTX_MODE_EDIT_ARMATURE:
|
|
|
|
|
ARRAY_SET_ITEMS(contexts, ".armature_edit");
|
|
|
|
|
break;
|
|
|
|
|
case CTX_MODE_EDIT_METABALL:
|
|
|
|
|
ARRAY_SET_ITEMS(contexts, ".mball_edit");
|
|
|
|
|
break;
|
|
|
|
|
case CTX_MODE_EDIT_LATTICE:
|
|
|
|
|
ARRAY_SET_ITEMS(contexts, ".lattice_edit");
|
|
|
|
|
break;
|
2023-06-21 16:47:18 +02:00
|
|
|
case CTX_MODE_EDIT_GREASE_PENCIL:
|
|
|
|
|
ARRAY_SET_ITEMS(contexts, ".grease_pencil_edit");
|
|
|
|
|
break;
|
2024-02-29 10:44:19 +01:00
|
|
|
case CTX_MODE_PAINT_GREASE_PENCIL:
|
|
|
|
|
ARRAY_SET_ITEMS(contexts, ".grease_pencil_paint");
|
|
|
|
|
break;
|
2024-04-11 09:39:48 +02:00
|
|
|
case CTX_MODE_SCULPT_GREASE_PENCIL:
|
|
|
|
|
ARRAY_SET_ITEMS(contexts, ".paint_common", ".grease_pencil_sculpt");
|
|
|
|
|
break;
|
2024-04-23 15:48:27 +02:00
|
|
|
case CTX_MODE_WEIGHT_GREASE_PENCIL:
|
GPv3: Weight Paint tools (Draw, Blur, Average, Smear, Sample weight)
This PR implements the Weight Paint tools for GPv3.
Tools:
- Draw, for assigning weight to stroke points
- Blur, smooths out weight using adjacent stroke point weights
- Average, smooths weight using the average weight under the brush
- Smear, like finger painting, drags weights in the direction of the brush
- Sample weight, sets the brush weight to the weight under the cursor
The weights are assigned to the active vertex group. When there is no
active vertex group, a group is automatically created.
When the Auto Normalize option is enabled, it is ensured that all
bone-deforming vertex groups add up to the weight of 1.0.
When a vertex group is locked, it's weights will not be altered by
Auto Normalize.
The PR already supports multi frame editing, including the use of a
falloff (defined by a curve).
The implementation is in accordance with the Weight Paint tools in GPv2.
Pull Request: https://projects.blender.org/blender/blender/pulls/118347
2024-04-25 15:21:14 +02:00
|
|
|
ARRAY_SET_ITEMS(contexts, ".greasepencil_weight");
|
2024-04-23 15:48:27 +02:00
|
|
|
break;
|
2024-09-10 18:56:31 +02:00
|
|
|
case CTX_MODE_VERTEX_GREASE_PENCIL:
|
2024-10-21 11:21:16 +02:00
|
|
|
ARRAY_SET_ITEMS(contexts, ".greasepencil_vertex");
|
2024-09-10 18:56:31 +02:00
|
|
|
break;
|
2025-02-19 17:11:08 +01:00
|
|
|
case CTX_MODE_EDIT_POINTCLOUD:
|
|
|
|
|
ARRAY_SET_ITEMS(contexts, ".pointcloud_edit");
|
2023-06-28 12:52:45 -04:00
|
|
|
break;
|
2019-05-10 13:43:07 +10:00
|
|
|
case CTX_MODE_POSE:
|
|
|
|
|
ARRAY_SET_ITEMS(contexts, ".posemode");
|
|
|
|
|
break;
|
|
|
|
|
case CTX_MODE_SCULPT:
|
|
|
|
|
ARRAY_SET_ITEMS(contexts, ".paint_common", ".sculpt_mode");
|
|
|
|
|
break;
|
|
|
|
|
case CTX_MODE_PAINT_WEIGHT:
|
|
|
|
|
ARRAY_SET_ITEMS(contexts, ".paint_common", ".weightpaint");
|
|
|
|
|
break;
|
|
|
|
|
case CTX_MODE_PAINT_VERTEX:
|
|
|
|
|
ARRAY_SET_ITEMS(contexts, ".paint_common", ".vertexpaint");
|
|
|
|
|
break;
|
|
|
|
|
case CTX_MODE_PAINT_TEXTURE:
|
|
|
|
|
ARRAY_SET_ITEMS(contexts, ".paint_common", ".imagepaint");
|
|
|
|
|
break;
|
|
|
|
|
case CTX_MODE_PARTICLE:
|
|
|
|
|
ARRAY_SET_ITEMS(contexts, ".paint_common", ".particlemode");
|
|
|
|
|
break;
|
|
|
|
|
case CTX_MODE_OBJECT:
|
|
|
|
|
ARRAY_SET_ITEMS(contexts, ".objectmode");
|
|
|
|
|
break;
|
2023-07-03 15:15:54 +02:00
|
|
|
case CTX_MODE_PAINT_GPENCIL_LEGACY:
|
2019-05-10 13:43:07 +10:00
|
|
|
ARRAY_SET_ITEMS(contexts, ".greasepencil_paint");
|
|
|
|
|
break;
|
2023-07-03 15:15:54 +02:00
|
|
|
case CTX_MODE_SCULPT_GPENCIL_LEGACY:
|
2019-05-10 13:43:07 +10:00
|
|
|
ARRAY_SET_ITEMS(contexts, ".greasepencil_sculpt");
|
|
|
|
|
break;
|
2023-07-03 15:15:54 +02:00
|
|
|
case CTX_MODE_WEIGHT_GPENCIL_LEGACY:
|
2019-05-10 13:43:07 +10:00
|
|
|
ARRAY_SET_ITEMS(contexts, ".greasepencil_weight");
|
|
|
|
|
break;
|
2023-07-03 15:15:54 +02:00
|
|
|
case CTX_MODE_VERTEX_GPENCIL_LEGACY:
|
2020-03-09 16:27:24 +01:00
|
|
|
ARRAY_SET_ITEMS(contexts, ".greasepencil_vertex");
|
|
|
|
|
break;
|
2022-02-18 09:12:41 +01:00
|
|
|
case CTX_MODE_SCULPT_CURVES:
|
2022-04-21 14:51:37 +02:00
|
|
|
ARRAY_SET_ITEMS(contexts, ".paint_common", ".curves_sculpt");
|
2022-02-18 09:12:41 +01:00
|
|
|
break;
|
2019-05-10 13:43:07 +10:00
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (mode) {
|
2023-07-03 15:15:54 +02:00
|
|
|
case CTX_MODE_PAINT_GPENCIL_LEGACY:
|
2019-05-10 13:43:07 +10:00
|
|
|
ARRAY_SET_ITEMS(contexts, ".greasepencil_paint");
|
|
|
|
|
break;
|
2023-07-03 15:15:54 +02:00
|
|
|
case CTX_MODE_SCULPT_GPENCIL_LEGACY:
|
2019-05-10 13:43:07 +10:00
|
|
|
ARRAY_SET_ITEMS(contexts, ".greasepencil_sculpt");
|
|
|
|
|
break;
|
2023-07-03 15:15:54 +02:00
|
|
|
case CTX_MODE_WEIGHT_GPENCIL_LEGACY:
|
2019-05-10 13:43:07 +10:00
|
|
|
ARRAY_SET_ITEMS(contexts, ".greasepencil_weight");
|
|
|
|
|
break;
|
2023-06-21 16:47:18 +02:00
|
|
|
case CTX_MODE_EDIT_GPENCIL_LEGACY:
|
2019-05-10 13:43:07 +10:00
|
|
|
ARRAY_SET_ITEMS(contexts, ".greasepencil_edit");
|
|
|
|
|
break;
|
2023-07-03 15:15:54 +02:00
|
|
|
case CTX_MODE_VERTEX_GPENCIL_LEGACY:
|
2020-03-09 16:27:24 +01:00
|
|
|
ARRAY_SET_ITEMS(contexts, ".greasepencil_vertex");
|
|
|
|
|
break;
|
2019-05-10 13:43:07 +10:00
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-21 19:34:53 +01:00
|
|
|
ListBase *paneltypes = ®ion->runtime->type->paneltypes;
|
2019-05-10 13:43:07 +10:00
|
|
|
|
|
|
|
|
/* Allow drawing 3D view toolbar from non 3D view space type. */
|
2022-09-23 16:51:29 +02:00
|
|
|
if (category_override != nullptr) {
|
2019-05-10 13:43:07 +10:00
|
|
|
SpaceType *st = BKE_spacetype_from_id(SPACE_VIEW3D);
|
|
|
|
|
ARegionType *art = BKE_regiontype_from_id(st, RGN_TYPE_UI);
|
|
|
|
|
paneltypes = &art->paneltypes;
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-31 19:04:09 +01:00
|
|
|
ED_region_panels_layout_ex(
|
|
|
|
|
C, region, paneltypes, WM_OP_INVOKE_REGION_WIN, contexts_base, category_override);
|
2019-05-10 13:43:07 +10:00
|
|
|
}
|
|
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
static void view3d_buttons_region_layout(const bContext *C, ARegion *region)
|
2019-05-10 13:43:07 +10:00
|
|
|
{
|
2022-09-23 16:51:29 +02:00
|
|
|
ED_view3d_buttons_region_layout_ex(C, region, nullptr);
|
2009-02-10 15:38:00 +00:00
|
|
|
}
|
|
|
|
|
|
2021-01-19 12:59:00 +11:00
|
|
|
static void view3d_buttons_region_listener(const wmRegionListenerParams *params)
|
2009-02-10 15:38:00 +00:00
|
|
|
{
|
2021-01-18 17:28:47 -06:00
|
|
|
ARegion *region = params->region;
|
2022-08-27 12:50:43 +10:00
|
|
|
const wmNotifier *wmn = params->notifier;
|
2021-01-18 17:28:47 -06:00
|
|
|
|
2009-02-10 15:38:00 +00:00
|
|
|
/* context changes */
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (wmn->category) {
|
2009-07-12 03:42:39 +00:00
|
|
|
case NC_ANIMATION:
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (wmn->data) {
|
2009-07-12 03:42:39 +00:00
|
|
|
case ND_KEYFRAME_PROP:
|
|
|
|
|
case ND_NLA_ACTCHANGE:
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2009-07-12 03:42:39 +00:00
|
|
|
break;
|
2010-06-18 04:39:32 +00:00
|
|
|
case ND_NLA:
|
|
|
|
|
case ND_KEYFRAME:
|
2019-03-26 21:16:47 +11:00
|
|
|
if (ELEM(wmn->action, NA_EDITED, NA_ADDED, NA_REMOVED)) {
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2012-10-21 05:46:41 +00:00
|
|
|
break;
|
2009-07-12 03:42:39 +00:00
|
|
|
}
|
|
|
|
|
break;
|
2009-02-10 15:38:00 +00:00
|
|
|
case NC_SCENE:
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (wmn->data) {
|
2009-02-10 15:38:00 +00:00
|
|
|
case ND_FRAME:
|
|
|
|
|
case ND_OB_ACTIVE:
|
|
|
|
|
case ND_OB_SELECT:
|
2010-09-27 21:22:20 +00:00
|
|
|
case ND_OB_VISIBLE:
|
2009-02-10 15:38:00 +00:00
|
|
|
case ND_MODE:
|
2009-10-26 12:42:25 +00:00
|
|
|
case ND_LAYER:
|
2010-08-28 07:07:02 +00:00
|
|
|
case ND_LAYER_CONTENT:
|
2011-11-05 10:19:36 +00:00
|
|
|
case ND_TOOLSETTINGS:
|
2024-04-05 16:26:27 +02:00
|
|
|
case ND_TRANSFORM:
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2009-02-10 15:38:00 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (wmn->action) {
|
2010-01-26 23:32:03 +00:00
|
|
|
case NA_EDITED:
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2010-01-26 23:32:03 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2009-02-10 15:38:00 +00:00
|
|
|
break;
|
|
|
|
|
case NC_OBJECT:
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (wmn->data) {
|
2009-02-10 15:38:00 +00:00
|
|
|
case ND_BONE_ACTIVE:
|
|
|
|
|
case ND_BONE_SELECT:
|
2023-09-08 15:15:34 +02:00
|
|
|
case ND_BONE_COLLECTION:
|
2009-02-10 15:38:00 +00:00
|
|
|
case ND_TRANSFORM:
|
2009-09-19 11:59:23 +00:00
|
|
|
case ND_POSE:
|
2009-02-10 15:38:00 +00:00
|
|
|
case ND_DRAW:
|
|
|
|
|
case ND_KEYS:
|
2010-06-30 05:03:41 +00:00
|
|
|
case ND_MODIFIER:
|
2020-07-06 13:17:07 -04:00
|
|
|
case ND_SHADERFX:
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2009-02-10 15:38:00 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
break;
|
|
|
|
|
case NC_GEOM:
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (wmn->data) {
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
case ND_DATA:
|
2012-11-25 06:55:39 +00:00
|
|
|
case ND_VERTEX_GROUP:
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
case ND_SELECT:
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2019-03-26 21:16:47 +11:00
|
|
|
if (wmn->action == NA_EDITED) {
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
break;
|
2010-01-03 23:46:19 +00:00
|
|
|
case NC_TEXTURE:
|
2012-02-17 16:06:32 +00:00
|
|
|
case NC_MATERIAL:
|
2010-01-03 23:46:19 +00:00
|
|
|
/* for brush textures */
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2010-01-03 23:46:19 +00:00
|
|
|
break;
|
2009-09-18 03:11:17 +00:00
|
|
|
case NC_BRUSH:
|
2015-03-09 14:48:56 +01:00
|
|
|
/* NA_SELECTED is used on brush changes */
|
2019-03-26 21:16:47 +11:00
|
|
|
if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2009-09-18 03:11:17 +00:00
|
|
|
break;
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
case NC_SPACE:
|
2019-03-26 21:16:47 +11:00
|
|
|
if (wmn->data == ND_SPACE_VIEW3D) {
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
break;
|
2009-11-25 23:13:47 +00:00
|
|
|
case NC_ID:
|
2019-03-26 21:16:47 +11:00
|
|
|
if (wmn->action == NA_RENAME) {
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2009-11-25 23:13:47 +00:00
|
|
|
break;
|
2012-10-05 19:51:11 +00:00
|
|
|
case NC_GPENCIL:
|
2019-03-26 21:16:47 +11:00
|
|
|
if ((wmn->data & (ND_DATA | ND_GPENCIL_EDITMODE)) || (wmn->action == NA_EDITED)) {
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2010-02-26 10:01:49 +00:00
|
|
|
break;
|
2014-07-21 12:02:05 +02:00
|
|
|
case NC_IMAGE:
|
|
|
|
|
/* Update for the image layers in texture paint. */
|
2019-03-26 21:16:47 +11:00
|
|
|
if (wmn->action == NA_EDITED) {
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2014-07-21 12:02:05 +02:00
|
|
|
break;
|
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 20:20:55 +01:00
|
|
|
case NC_WM:
|
|
|
|
|
if (wmn->data == ND_XR_DATA_CHANGED) {
|
|
|
|
|
ED_region_tag_redraw(region);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2009-02-10 15:38:00 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
/* add handlers, stuff you only do once or on area/region changes */
|
2020-03-06 16:56:42 +01:00
|
|
|
static void view3d_tools_region_init(wmWindowManager *wm, ARegion *region)
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{
|
2009-09-17 21:36:02 +00:00
|
|
|
wmKeyMap *keymap;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_panels_init(wm, region);
|
2009-05-19 17:13:33 +00:00
|
|
|
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
}
|
|
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
static void view3d_tools_region_draw(const bContext *C, ARegion *region)
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{
|
2022-09-23 16:51:29 +02:00
|
|
|
const char *contexts[] = {CTX_data_mode_string(C), nullptr};
|
2024-01-31 19:04:09 +01:00
|
|
|
ED_region_panels_ex(C, region, WM_OP_INVOKE_REGION_WIN, contexts);
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
}
|
|
|
|
|
|
2023-09-27 11:57:37 +02:00
|
|
|
static void view3d_tools_header_region_draw(const bContext *C, ARegion *region)
|
|
|
|
|
{
|
2023-09-27 19:53:11 +02:00
|
|
|
ED_region_header_with_button_sections(
|
|
|
|
|
C,
|
|
|
|
|
region,
|
|
|
|
|
(RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_TOP) ?
|
|
|
|
|
uiButtonSectionsAlign::Top :
|
|
|
|
|
uiButtonSectionsAlign::Bottom);
|
2023-09-27 11:57:37 +02:00
|
|
|
}
|
|
|
|
|
|
2023-08-03 16:58:37 +02:00
|
|
|
/* add handlers, stuff you only do once or on area/region changes */
|
|
|
|
|
static void view3d_asset_shelf_region_init(wmWindowManager *wm, ARegion *region)
|
|
|
|
|
{
|
2024-01-26 18:30:55 -05:00
|
|
|
using namespace blender::ed;
|
2023-09-14 13:32:42 +10:00
|
|
|
wmKeyMap *keymap = WM_keymap_ensure(
|
|
|
|
|
wm->defaultconf, "3D View Generic", SPACE_VIEW3D, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler(®ion->runtime->handlers, keymap);
|
2023-08-03 16:58:37 +02:00
|
|
|
|
2024-01-26 18:30:55 -05:00
|
|
|
asset::shelf::region_init(wm, region);
|
2023-08-03 16:58:37 +02:00
|
|
|
}
|
|
|
|
|
|
2015-11-28 17:14:45 +01:00
|
|
|
/* area (not region) level listener */
|
2021-01-19 12:59:00 +11:00
|
|
|
static void space_view3d_listener(const wmSpaceTypeListenerParams *params)
|
2010-10-20 04:12:01 +00:00
|
|
|
{
|
2021-01-18 17:28:47 -06:00
|
|
|
ScrArea *area = params->area;
|
2022-08-27 12:50:43 +10:00
|
|
|
const wmNotifier *wmn = params->notifier;
|
2022-09-23 16:51:29 +02:00
|
|
|
View3D *v3d = static_cast<View3D *>(area->spacedata.first);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2010-10-20 04:12:01 +00:00
|
|
|
/* context changes */
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (wmn->category) {
|
2010-10-20 04:12:01 +00:00
|
|
|
case NC_SCENE:
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (wmn->data) {
|
2021-09-27 21:00:17 -07:00
|
|
|
case ND_WORLD: {
|
2021-10-15 11:42:21 +02:00
|
|
|
const bool use_scene_world = V3D_USES_SCENE_WORLD(v3d);
|
2021-09-27 21:00:17 -07:00
|
|
|
if (v3d->flag2 & V3D_HIDE_OVERLAYS || use_scene_world) {
|
2020-04-03 13:25:03 +02:00
|
|
|
ED_area_tag_redraw_regiontype(area, RGN_TYPE_WINDOW);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2010-10-20 04:12:01 +00:00
|
|
|
break;
|
2021-09-27 21:00:17 -07:00
|
|
|
}
|
2010-10-20 04:12:01 +00:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case NC_WORLD:
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (wmn->data) {
|
2010-10-20 04:12:01 +00:00
|
|
|
case ND_WORLD_DRAW:
|
2014-11-24 17:18:56 +01:00
|
|
|
case ND_WORLD:
|
2018-11-14 23:30:20 +11:00
|
|
|
if (v3d->shading.background_type == V3D_SHADING_BACKGROUND_WORLD) {
|
2020-04-03 13:25:03 +02:00
|
|
|
ED_area_tag_redraw_regiontype(area, RGN_TYPE_WINDOW);
|
2018-11-14 23:30:20 +11:00
|
|
|
}
|
2010-10-20 04:12:01 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2011-05-02 12:31:09 +00:00
|
|
|
case NC_MATERIAL:
|
2012-03-25 23:54:33 +00:00
|
|
|
switch (wmn->data) {
|
2011-05-02 12:31:09 +00:00
|
|
|
case ND_NODES:
|
2019-03-26 21:16:47 +11:00
|
|
|
if (v3d->shading.type == OB_TEXTURE) {
|
2020-04-03 13:25:03 +02:00
|
|
|
ED_area_tag_redraw_regiontype(area, RGN_TYPE_WINDOW);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2011-05-02 12:31:09 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2010-10-20 04:12:01 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-15 19:01:53 -07:00
|
|
|
static void space_view3d_refresh(const bContext *C, ScrArea *area)
|
2018-07-10 15:02:25 +02:00
|
|
|
{
|
2021-06-15 19:01:53 -07:00
|
|
|
View3D *v3d = (View3D *)area->spacedata.first;
|
2025-02-20 10:37:10 +01:00
|
|
|
/* Cannot use MEM_SAFE_FREE, as #SceneStats type is only forward-declared in `DNA_layer_types.h`
|
|
|
|
|
*/
|
|
|
|
|
if (v3d->runtime.local_stats) {
|
|
|
|
|
MEM_freeN(static_cast<void *>(v3d->runtime.local_stats));
|
|
|
|
|
v3d->runtime.local_stats = nullptr;
|
|
|
|
|
}
|
2024-07-23 18:23:02 +02:00
|
|
|
|
|
|
|
|
if (v3d->localvd && v3d->localvd->runtime.flag & V3D_RUNTIME_LOCAL_MAYBE_EMPTY) {
|
|
|
|
|
ED_localview_exit_if_empty(CTX_data_ensure_evaluated_depsgraph(C),
|
|
|
|
|
CTX_data_scene(C),
|
|
|
|
|
CTX_data_view_layer(C),
|
|
|
|
|
CTX_wm_manager(C),
|
|
|
|
|
CTX_wm_window(C),
|
|
|
|
|
v3d,
|
|
|
|
|
CTX_wm_area(C),
|
|
|
|
|
true,
|
2024-09-10 17:31:08 +10:00
|
|
|
U.smooth_viewtx);
|
2024-07-23 18:23:02 +02:00
|
|
|
}
|
2018-07-10 15:02:25 +02:00
|
|
|
}
|
|
|
|
|
|
2024-02-13 15:36:38 +01:00
|
|
|
static void view3d_id_remap_v3d_ob_centers(View3D *v3d,
|
|
|
|
|
const blender::bke::id::IDRemapper &mappings)
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
{
|
2024-03-06 18:32:11 -05:00
|
|
|
if (mappings.apply(reinterpret_cast<ID **>(&v3d->ob_center), ID_REMAP_APPLY_DEFAULT) ==
|
2022-01-25 14:51:35 +01:00
|
|
|
ID_REMAP_RESULT_SOURCE_UNASSIGNED)
|
|
|
|
|
{
|
2022-09-25 15:24:37 +10:00
|
|
|
/* Otherwise, bone-name may remain valid...
|
2022-01-25 14:51:35 +01:00
|
|
|
* We could be smart and check this, too? */
|
|
|
|
|
v3d->ob_center_bone[0] = '\0';
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
}
|
2022-01-25 14:51:35 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-02-13 15:36:38 +01:00
|
|
|
static void view3d_id_remap_v3d(ScrArea *area,
|
|
|
|
|
SpaceLink *slink,
|
|
|
|
|
View3D *v3d,
|
|
|
|
|
const blender::bke::id::IDRemapper &mappings,
|
|
|
|
|
const bool is_local)
|
2022-01-25 14:51:35 +01:00
|
|
|
{
|
2024-03-06 18:32:11 -05:00
|
|
|
if (mappings.apply(reinterpret_cast<ID **>(&v3d->camera), ID_REMAP_APPLY_DEFAULT) ==
|
2022-01-25 14:51:35 +01:00
|
|
|
ID_REMAP_RESULT_SOURCE_UNASSIGNED)
|
|
|
|
|
{
|
|
|
|
|
/* 3D view might be inactive, in that case needs to use slink->regionbase */
|
|
|
|
|
ListBase *regionbase = (slink == area->spacedata.first) ? &area->regionbase :
|
|
|
|
|
&slink->regionbase;
|
2023-08-04 08:51:13 +10:00
|
|
|
LISTBASE_FOREACH (ARegion *, region, regionbase) {
|
2022-01-25 14:51:35 +01:00
|
|
|
if (region->regiontype == RGN_TYPE_WINDOW) {
|
|
|
|
|
RegionView3D *rv3d = is_local ? ((RegionView3D *)region->regiondata)->localvd :
|
2022-09-23 16:51:29 +02:00
|
|
|
static_cast<RegionView3D *>(region->regiondata);
|
2022-01-25 14:51:35 +01:00
|
|
|
if (rv3d && (rv3d->persp == RV3D_CAMOB)) {
|
|
|
|
|
rv3d->persp = RV3D_PERSP;
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2022-01-25 14:51:35 +01:00
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-02-13 15:36:38 +01:00
|
|
|
static void view3d_id_remap(ScrArea *area,
|
|
|
|
|
SpaceLink *slink,
|
|
|
|
|
const blender::bke::id::IDRemapper &mappings)
|
2022-01-25 14:51:35 +01:00
|
|
|
{
|
2024-02-13 15:36:38 +01:00
|
|
|
if (!mappings.contains_mappings_for_any(FILTER_ID_OB | FILTER_ID_MA | FILTER_ID_IM |
|
|
|
|
|
FILTER_ID_MC))
|
2022-01-25 14:51:35 +01:00
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
View3D *view3d = (View3D *)slink;
|
|
|
|
|
view3d_id_remap_v3d(area, slink, view3d, mappings, false);
|
|
|
|
|
view3d_id_remap_v3d_ob_centers(view3d, mappings);
|
2022-09-23 16:51:29 +02:00
|
|
|
if (view3d->localvd != nullptr) {
|
2023-02-12 14:37:16 +11:00
|
|
|
/* Object centers in local-view aren't used, see: #52663 */
|
2022-01-25 14:51:35 +01:00
|
|
|
view3d_id_remap_v3d(area, slink, view3d->localvd, mappings, true);
|
2024-07-23 18:23:02 +02:00
|
|
|
/* Remapping is potentially modifying ID pointers, and there is a local View3D, mark it for a
|
|
|
|
|
* check for emptiness. */
|
|
|
|
|
view3d->localvd->runtime.flag |= V3D_RUNTIME_LOCAL_MAYBE_EMPTY;
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
}
|
Geometry Nodes: viewport preview
This adds support for showing geometry passed to the Viewer in the 3d
viewport (instead of just in the spreadsheet). The "viewer geometry"
bypasses the group output. So it is not necessary to change the final
output of the node group to be able to see the intermediate geometry.
**Activation and deactivation of a viewer node**
* A viewer node is activated by clicking on it.
* Ctrl+shift+click on any node/socket connects it to the viewer and
makes it active.
* Ctrl+shift+click in empty space deactivates the active viewer.
* When the active viewer is not visible anymore (e.g. another object
is selected, or the current node group is exit), it is deactivated.
* Clicking on the icon in the header of the Viewer node toggles whether
its active or not.
**Pinning**
* The spreadsheet still allows pinning the active viewer as before.
When pinned, the spreadsheet still references the viewer node even
when it becomes inactive.
* The viewport does not support pinning at the moment. It always shows
the active viewer.
**Attribute**
* When a field is linked to the second input of the viewer node it is
displayed as an overlay in the viewport.
* When possible the correct domain for the attribute is determined
automatically. This does not work in all cases. It falls back to the
face corner domain on meshes and the point domain on curves. When
necessary, the domain can be picked manually.
* The spreadsheet now only shows the "Viewer" column for the domain
that is selected in the Viewer node.
* Instance attributes are visualized as a constant color per instance.
**Viewport Options**
* The attribute overlay opacity can be controlled with the "Viewer Node"
setting in the overlays popover.
* A viewport can be configured not to show intermediate viewer-geometry
by disabling the "Viewer Node" option in the "View" menu.
**Implementation Details**
* The "spreadsheet context path" was generalized to a "viewer path" that
is used in more places now.
* The viewer node itself determines the attribute domain, evaluates the
field and stores the result in a `.viewer` attribute.
* A new "viewer attribute' overlay displays the data from the `.viewer`
attribute.
* The ground truth for the active viewer node is stored in the workspace
now. Node editors, spreadsheets and viewports retrieve the active
viewer from there unless they are pinned.
* The depsgraph object iterator has a new "viewer path" setting. When set,
the viewed geometry of the corresponding object is part of the iterator
instead of the final evaluated geometry.
* To support the instance attribute overlay `DupliObject` was extended
to contain the information necessary for drawing the overlay.
* The ctrl+shift+click operator has been refactored so that it can make
existing links to viewers active again.
* The auto-domain-detection in the Viewer node works by checking the
"preferred domain" for every field input. If there is not exactly one
preferred domain, the fallback is used.
Known limitations:
* Loose edges of meshes don't have the attribute overlay. This could be
added separately if necessary.
* Some attributes are hard to visualize as a color directly. For example,
the values might have to be normalized or some should be drawn as arrays.
For now, we encourage users to build node groups that generate appropriate
viewer-geometry. We might include some of that functionality in future versions.
Support for displaying attribute values as text in the viewport is planned as well.
* There seems to be an issue with the attribute overlay for pointclouds on
nvidia gpus, to be investigated.
Differential Revision: https://developer.blender.org/D15954
2022-09-28 17:54:59 +02:00
|
|
|
BKE_viewer_path_id_remap(&view3d->viewer_path, mappings);
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
}
|
2010-01-14 02:16:45 +00:00
|
|
|
|
2023-08-17 14:42:04 +02:00
|
|
|
static void view3d_foreach_id(SpaceLink *space_link, LibraryForeachIDData *data)
|
|
|
|
|
{
|
|
|
|
|
View3D *v3d = reinterpret_cast<View3D *>(space_link);
|
|
|
|
|
|
2024-05-24 13:28:34 +02:00
|
|
|
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, v3d->camera, IDWALK_CB_DIRECT_WEAK_LINK);
|
|
|
|
|
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, v3d->ob_center, IDWALK_CB_DIRECT_WEAK_LINK);
|
2023-08-17 14:42:04 +02:00
|
|
|
if (v3d->localvd) {
|
2024-05-24 13:28:34 +02:00
|
|
|
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, v3d->localvd->camera, IDWALK_CB_DIRECT_WEAK_LINK);
|
2024-07-23 18:23:02 +02:00
|
|
|
|
|
|
|
|
/* If potentially modifying ID pointers, and there is a local View3D, mark it for a check for
|
|
|
|
|
* emptiness. */
|
|
|
|
|
const int flags = BKE_lib_query_foreachid_process_flags_get(data);
|
|
|
|
|
if ((flags & IDWALK_READONLY) == 0) {
|
|
|
|
|
v3d->localvd->runtime.flag |= V3D_RUNTIME_LOCAL_MAYBE_EMPTY;
|
|
|
|
|
}
|
2023-08-17 14:42:04 +02:00
|
|
|
}
|
|
|
|
|
BKE_viewer_path_foreach_id(data, &v3d->viewer_path);
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-27 14:42:21 +10:00
|
|
|
static void view3d_space_blend_read_data(BlendDataReader *reader, SpaceLink *sl)
|
2022-09-28 11:52:22 +02:00
|
|
|
{
|
|
|
|
|
View3D *v3d = (View3D *)sl;
|
|
|
|
|
|
|
|
|
|
memset(&v3d->runtime, 0x0, sizeof(v3d->runtime));
|
|
|
|
|
|
|
|
|
|
if (v3d->gpd) {
|
2024-04-24 17:01:22 +02:00
|
|
|
BLO_read_struct(reader, bGPdata, &v3d->gpd);
|
2022-09-28 11:52:22 +02:00
|
|
|
BKE_gpencil_blend_read_data(reader, v3d->gpd);
|
|
|
|
|
}
|
2024-04-24 17:01:22 +02:00
|
|
|
BLO_read_struct(reader, RegionView3D, &v3d->localvd);
|
2022-09-28 11:52:22 +02:00
|
|
|
|
|
|
|
|
/* render can be quite heavy, set to solid on load */
|
|
|
|
|
if (v3d->shading.type == OB_RENDER) {
|
|
|
|
|
v3d->shading.type = OB_SOLID;
|
|
|
|
|
}
|
|
|
|
|
v3d->shading.prev_type = OB_SOLID;
|
|
|
|
|
|
|
|
|
|
BKE_screen_view3d_shading_blend_read_data(reader, &v3d->shading);
|
|
|
|
|
|
|
|
|
|
BKE_screen_view3d_do_versions_250(v3d, &sl->regionbase);
|
Geometry Nodes: viewport preview
This adds support for showing geometry passed to the Viewer in the 3d
viewport (instead of just in the spreadsheet). The "viewer geometry"
bypasses the group output. So it is not necessary to change the final
output of the node group to be able to see the intermediate geometry.
**Activation and deactivation of a viewer node**
* A viewer node is activated by clicking on it.
* Ctrl+shift+click on any node/socket connects it to the viewer and
makes it active.
* Ctrl+shift+click in empty space deactivates the active viewer.
* When the active viewer is not visible anymore (e.g. another object
is selected, or the current node group is exit), it is deactivated.
* Clicking on the icon in the header of the Viewer node toggles whether
its active or not.
**Pinning**
* The spreadsheet still allows pinning the active viewer as before.
When pinned, the spreadsheet still references the viewer node even
when it becomes inactive.
* The viewport does not support pinning at the moment. It always shows
the active viewer.
**Attribute**
* When a field is linked to the second input of the viewer node it is
displayed as an overlay in the viewport.
* When possible the correct domain for the attribute is determined
automatically. This does not work in all cases. It falls back to the
face corner domain on meshes and the point domain on curves. When
necessary, the domain can be picked manually.
* The spreadsheet now only shows the "Viewer" column for the domain
that is selected in the Viewer node.
* Instance attributes are visualized as a constant color per instance.
**Viewport Options**
* The attribute overlay opacity can be controlled with the "Viewer Node"
setting in the overlays popover.
* A viewport can be configured not to show intermediate viewer-geometry
by disabling the "Viewer Node" option in the "View" menu.
**Implementation Details**
* The "spreadsheet context path" was generalized to a "viewer path" that
is used in more places now.
* The viewer node itself determines the attribute domain, evaluates the
field and stores the result in a `.viewer` attribute.
* A new "viewer attribute' overlay displays the data from the `.viewer`
attribute.
* The ground truth for the active viewer node is stored in the workspace
now. Node editors, spreadsheets and viewports retrieve the active
viewer from there unless they are pinned.
* The depsgraph object iterator has a new "viewer path" setting. When set,
the viewed geometry of the corresponding object is part of the iterator
instead of the final evaluated geometry.
* To support the instance attribute overlay `DupliObject` was extended
to contain the information necessary for drawing the overlay.
* The ctrl+shift+click operator has been refactored so that it can make
existing links to viewers active again.
* The auto-domain-detection in the Viewer node works by checking the
"preferred domain" for every field input. If there is not exactly one
preferred domain, the fallback is used.
Known limitations:
* Loose edges of meshes don't have the attribute overlay. This could be
added separately if necessary.
* Some attributes are hard to visualize as a color directly. For example,
the values might have to be normalized or some should be drawn as arrays.
For now, we encourage users to build node groups that generate appropriate
viewer-geometry. We might include some of that functionality in future versions.
Support for displaying attribute values as text in the viewport is planned as well.
* There seems to be an issue with the attribute overlay for pointclouds on
nvidia gpus, to be investigated.
Differential Revision: https://developer.blender.org/D15954
2022-09-28 17:54:59 +02:00
|
|
|
|
|
|
|
|
BKE_viewer_path_blend_read_data(reader, &v3d->viewer_path);
|
2022-09-28 11:52:22 +02:00
|
|
|
}
|
|
|
|
|
|
2023-04-27 14:42:21 +10:00
|
|
|
static void view3d_space_blend_write(BlendWriter *writer, SpaceLink *sl)
|
2022-09-28 11:52:22 +02:00
|
|
|
{
|
|
|
|
|
View3D *v3d = (View3D *)sl;
|
|
|
|
|
BLO_write_struct(writer, View3D, v3d);
|
|
|
|
|
|
|
|
|
|
if (v3d->localvd) {
|
|
|
|
|
BLO_write_struct(writer, View3D, v3d->localvd);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BKE_screen_view3d_shading_blend_write(writer, &v3d->shading);
|
Geometry Nodes: viewport preview
This adds support for showing geometry passed to the Viewer in the 3d
viewport (instead of just in the spreadsheet). The "viewer geometry"
bypasses the group output. So it is not necessary to change the final
output of the node group to be able to see the intermediate geometry.
**Activation and deactivation of a viewer node**
* A viewer node is activated by clicking on it.
* Ctrl+shift+click on any node/socket connects it to the viewer and
makes it active.
* Ctrl+shift+click in empty space deactivates the active viewer.
* When the active viewer is not visible anymore (e.g. another object
is selected, or the current node group is exit), it is deactivated.
* Clicking on the icon in the header of the Viewer node toggles whether
its active or not.
**Pinning**
* The spreadsheet still allows pinning the active viewer as before.
When pinned, the spreadsheet still references the viewer node even
when it becomes inactive.
* The viewport does not support pinning at the moment. It always shows
the active viewer.
**Attribute**
* When a field is linked to the second input of the viewer node it is
displayed as an overlay in the viewport.
* When possible the correct domain for the attribute is determined
automatically. This does not work in all cases. It falls back to the
face corner domain on meshes and the point domain on curves. When
necessary, the domain can be picked manually.
* The spreadsheet now only shows the "Viewer" column for the domain
that is selected in the Viewer node.
* Instance attributes are visualized as a constant color per instance.
**Viewport Options**
* The attribute overlay opacity can be controlled with the "Viewer Node"
setting in the overlays popover.
* A viewport can be configured not to show intermediate viewer-geometry
by disabling the "Viewer Node" option in the "View" menu.
**Implementation Details**
* The "spreadsheet context path" was generalized to a "viewer path" that
is used in more places now.
* The viewer node itself determines the attribute domain, evaluates the
field and stores the result in a `.viewer` attribute.
* A new "viewer attribute' overlay displays the data from the `.viewer`
attribute.
* The ground truth for the active viewer node is stored in the workspace
now. Node editors, spreadsheets and viewports retrieve the active
viewer from there unless they are pinned.
* The depsgraph object iterator has a new "viewer path" setting. When set,
the viewed geometry of the corresponding object is part of the iterator
instead of the final evaluated geometry.
* To support the instance attribute overlay `DupliObject` was extended
to contain the information necessary for drawing the overlay.
* The ctrl+shift+click operator has been refactored so that it can make
existing links to viewers active again.
* The auto-domain-detection in the Viewer node works by checking the
"preferred domain" for every field input. If there is not exactly one
preferred domain, the fallback is used.
Known limitations:
* Loose edges of meshes don't have the attribute overlay. This could be
added separately if necessary.
* Some attributes are hard to visualize as a color directly. For example,
the values might have to be normalized or some should be drawn as arrays.
For now, we encourage users to build node groups that generate appropriate
viewer-geometry. We might include some of that functionality in future versions.
Support for displaying attribute values as text in the viewport is planned as well.
* There seems to be an issue with the attribute overlay for pointclouds on
nvidia gpus, to be investigated.
Differential Revision: https://developer.blender.org/D15954
2022-09-28 17:54:59 +02:00
|
|
|
|
|
|
|
|
BKE_viewer_path_blend_write(writer, &v3d->viewer_path);
|
2022-09-28 11:52:22 +02:00
|
|
|
}
|
|
|
|
|
|
2022-10-05 13:44:02 -05:00
|
|
|
void ED_spacetype_view3d()
|
2008-01-07 18:03:41 +00:00
|
|
|
{
|
2024-01-26 18:30:55 -05:00
|
|
|
using namespace blender::ed;
|
2024-02-02 20:59:20 +01:00
|
|
|
std::unique_ptr<SpaceType> st = std::make_unique<SpaceType>();
|
2008-12-09 15:59:43 +00:00
|
|
|
ARegionType *art;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-25 23:54:33 +00:00
|
|
|
st->spaceid = SPACE_VIEW3D;
|
2022-09-10 16:51:15 +10:00
|
|
|
STRNCPY(st->name, "View3D");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-08-04 14:39:53 +02:00
|
|
|
st->create = view3d_create;
|
2012-03-25 23:54:33 +00:00
|
|
|
st->free = view3d_free;
|
|
|
|
|
st->init = view3d_init;
|
2021-06-15 19:01:53 -07:00
|
|
|
st->exit = view3d_exit;
|
2010-10-20 04:12:01 +00:00
|
|
|
st->listener = space_view3d_listener;
|
2018-07-10 15:02:25 +02:00
|
|
|
st->refresh = space_view3d_refresh;
|
2012-03-25 23:54:33 +00:00
|
|
|
st->duplicate = view3d_duplicate;
|
|
|
|
|
st->operatortypes = view3d_operatortypes;
|
|
|
|
|
st->keymap = view3d_keymap;
|
|
|
|
|
st->dropboxes = view3d_dropboxes;
|
2018-07-14 23:49:00 +02:00
|
|
|
st->gizmos = view3d_widgets;
|
2012-03-25 23:54:33 +00:00
|
|
|
st->context = view3d_context;
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
st->id_remap = view3d_id_remap;
|
2023-08-17 14:42:04 +02:00
|
|
|
st->foreach_id = view3d_foreach_id;
|
2023-04-27 14:42:21 +10:00
|
|
|
st->blend_read_data = view3d_space_blend_read_data;
|
2023-03-11 18:07:59 +01:00
|
|
|
st->blend_read_after_liblink = nullptr;
|
2023-04-27 14:42:21 +10:00
|
|
|
st->blend_write = view3d_space_blend_write;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-12-09 15:59:43 +00:00
|
|
|
/* regions: main window */
|
2022-09-23 16:51:29 +02:00
|
|
|
art = MEM_cnew<ARegionType>("spacetype view3d main region");
|
2008-12-09 15:59:43 +00:00
|
|
|
art->regionid = RGN_TYPE_WINDOW;
|
2019-02-20 14:29:29 +11:00
|
|
|
art->keymapflag = ED_KEYMAP_GIZMO | ED_KEYMAP_TOOL | ED_KEYMAP_GPENCIL;
|
2015-11-28 17:14:45 +01:00
|
|
|
art->draw = view3d_main_region_draw;
|
|
|
|
|
art->init = view3d_main_region_init;
|
|
|
|
|
art->exit = view3d_main_region_exit;
|
|
|
|
|
art->free = view3d_main_region_free;
|
|
|
|
|
art->duplicate = view3d_main_region_duplicate;
|
|
|
|
|
art->listener = view3d_main_region_listener;
|
2017-11-13 19:43:34 +11:00
|
|
|
art->message_subscribe = view3d_main_region_message_subscribe;
|
2015-11-28 17:14:45 +01:00
|
|
|
art->cursor = view3d_main_region_cursor;
|
2012-03-25 23:54:33 +00:00
|
|
|
art->lock = 1; /* can become flag, see BKE_spacedata_draw_locks */
|
2008-12-09 15:59:43 +00:00
|
|
|
BLI_addhead(&st->regiontypes, art);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-05-24 11:21:18 +10:00
|
|
|
/* regions: list-view/buttons */
|
2022-09-23 16:51:29 +02:00
|
|
|
art = MEM_cnew<ARegionType>("spacetype view3d buttons region");
|
2009-02-10 15:38:00 +00:00
|
|
|
art->regionid = RGN_TYPE_UI;
|
2019-05-15 16:17:23 +02:00
|
|
|
art->prefsizex = UI_SIDEBAR_PANEL_WIDTH;
|
2012-03-25 23:54:33 +00:00
|
|
|
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
|
2015-11-28 17:14:45 +01:00
|
|
|
art->listener = view3d_buttons_region_listener;
|
2019-05-03 14:15:38 +10:00
|
|
|
art->message_subscribe = ED_area_do_mgs_subscribe_for_tool_ui;
|
2015-11-28 17:14:45 +01:00
|
|
|
art->init = view3d_buttons_region_init;
|
2019-05-10 13:43:07 +10:00
|
|
|
art->layout = view3d_buttons_region_layout;
|
|
|
|
|
art->draw = ED_region_panels_draw;
|
2009-02-10 15:38:00 +00:00
|
|
|
BLI_addhead(&st->regiontypes, art);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-05-19 17:13:33 +00:00
|
|
|
view3d_buttons_register(art);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
/* regions: tool(bar) */
|
2022-09-23 16:51:29 +02:00
|
|
|
art = MEM_cnew<ARegionType>("spacetype view3d tools region");
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
art->regionid = RGN_TYPE_TOOLS;
|
2023-06-08 18:27:59 +02:00
|
|
|
art->prefsizex = int(UI_TOOLBAR_WIDTH);
|
2012-07-08 20:36:00 +00:00
|
|
|
art->prefsizey = 50; /* XXX */
|
2012-03-25 23:54:33 +00:00
|
|
|
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
|
2015-11-28 17:14:45 +01:00
|
|
|
art->listener = view3d_buttons_region_listener;
|
2018-10-04 08:54:48 +10:00
|
|
|
art->message_subscribe = ED_region_generic_tools_region_message_subscribe;
|
|
|
|
|
art->snap_size = ED_region_generic_tools_region_snap_size;
|
2015-11-28 17:14:45 +01:00
|
|
|
art->init = view3d_tools_region_init;
|
|
|
|
|
art->draw = view3d_tools_region_draw;
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
BLI_addhead(&st->regiontypes, art);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-18 21:13:22 +02:00
|
|
|
/* regions: tool header */
|
2022-09-23 16:51:29 +02:00
|
|
|
art = MEM_cnew<ARegionType>("spacetype view3d tool header region");
|
2019-04-18 21:13:22 +02:00
|
|
|
art->regionid = RGN_TYPE_TOOL_HEADER;
|
|
|
|
|
art->prefsizey = HEADERY;
|
|
|
|
|
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER;
|
|
|
|
|
art->listener = view3d_header_region_listener;
|
2019-05-03 14:15:38 +10:00
|
|
|
art->message_subscribe = ED_area_do_mgs_subscribe_for_tool_header;
|
2019-04-18 21:13:22 +02:00
|
|
|
art->init = view3d_header_region_init;
|
2023-09-27 11:57:37 +02:00
|
|
|
art->draw = view3d_tools_header_region_draw;
|
2019-04-18 21:13:22 +02:00
|
|
|
BLI_addhead(&st->regiontypes, art);
|
|
|
|
|
|
2008-12-09 15:59:43 +00:00
|
|
|
/* regions: header */
|
2022-09-23 16:51:29 +02:00
|
|
|
art = MEM_cnew<ARegionType>("spacetype view3d header region");
|
2008-12-09 15:59:43 +00:00
|
|
|
art->regionid = RGN_TYPE_HEADER;
|
2012-03-25 23:54:33 +00:00
|
|
|
art->prefsizey = HEADERY;
|
|
|
|
|
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER;
|
2015-11-28 17:14:45 +01:00
|
|
|
art->listener = view3d_header_region_listener;
|
2019-05-03 14:15:38 +10:00
|
|
|
art->message_subscribe = view3d_header_region_message_subscribe;
|
2015-11-28 17:14:45 +01:00
|
|
|
art->init = view3d_header_region_init;
|
|
|
|
|
art->draw = view3d_header_region_draw;
|
2008-12-09 15:59:43 +00:00
|
|
|
BLI_addhead(&st->regiontypes, art);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-08-03 16:58:37 +02:00
|
|
|
/* regions: asset shelf */
|
|
|
|
|
art = MEM_cnew<ARegionType>("spacetype view3d asset shelf region");
|
|
|
|
|
art->regionid = RGN_TYPE_ASSET_SHELF;
|
|
|
|
|
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_ASSET_SHELF | ED_KEYMAP_FRAMES;
|
2024-01-26 18:30:55 -05:00
|
|
|
art->duplicate = asset::shelf::region_duplicate;
|
|
|
|
|
art->free = asset::shelf::region_free;
|
2024-05-02 10:27:55 -04:00
|
|
|
art->on_poll_success = asset::shelf::region_on_poll_success;
|
2024-01-26 18:30:55 -05:00
|
|
|
art->listener = asset::shelf::region_listen;
|
2024-07-07 18:47:33 +02:00
|
|
|
art->message_subscribe = asset::shelf::region_message_subscribe;
|
2024-01-26 18:30:55 -05:00
|
|
|
art->poll = asset::shelf::regions_poll;
|
|
|
|
|
art->snap_size = asset::shelf::region_snap;
|
|
|
|
|
art->on_user_resize = asset::shelf::region_on_user_resize;
|
|
|
|
|
art->context = asset::shelf::context;
|
2023-08-03 16:58:37 +02:00
|
|
|
art->init = view3d_asset_shelf_region_init;
|
2024-01-26 18:30:55 -05:00
|
|
|
art->layout = asset::shelf::region_layout;
|
|
|
|
|
art->draw = asset::shelf::region_draw;
|
2023-08-03 16:58:37 +02:00
|
|
|
BLI_addhead(&st->regiontypes, art);
|
|
|
|
|
|
|
|
|
|
/* regions: asset shelf header */
|
|
|
|
|
art = MEM_cnew<ARegionType>("spacetype view3d asset shelf header region");
|
|
|
|
|
art->regionid = RGN_TYPE_ASSET_SHELF_HEADER;
|
|
|
|
|
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_ASSET_SHELF | ED_KEYMAP_VIEW2D | ED_KEYMAP_FOOTER;
|
2024-01-26 18:30:55 -05:00
|
|
|
art->init = asset::shelf::header_region_init;
|
|
|
|
|
art->poll = asset::shelf::regions_poll;
|
|
|
|
|
art->draw = asset::shelf::header_region;
|
|
|
|
|
art->listener = asset::shelf::header_region_listen;
|
|
|
|
|
art->context = asset::shelf::context;
|
2023-08-03 16:58:37 +02:00
|
|
|
BLI_addhead(&st->regiontypes, art);
|
2024-07-07 20:00:35 +02:00
|
|
|
asset::shelf::types_register(art, SPACE_VIEW3D);
|
2023-08-03 16:58:37 +02:00
|
|
|
|
2018-06-12 10:11:32 +02:00
|
|
|
/* regions: hud */
|
|
|
|
|
art = ED_area_type_hud(st->spaceid);
|
|
|
|
|
BLI_addhead(&st->regiontypes, art);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-10-12 16:18:05 +09:00
|
|
|
/* regions: xr */
|
2022-09-23 16:51:29 +02:00
|
|
|
art = MEM_cnew<ARegionType>("spacetype view3d xr region");
|
2021-10-12 16:18:05 +09:00
|
|
|
art->regionid = RGN_TYPE_XR;
|
|
|
|
|
BLI_addhead(&st->regiontypes, art);
|
|
|
|
|
|
2023-06-29 13:57:54 +02:00
|
|
|
WM_menutype_add(
|
2024-06-24 17:55:32 +02:00
|
|
|
MEM_cnew<MenuType>(__func__, blender::ed::geometry::node_group_operator_assets_menu()));
|
|
|
|
|
WM_menutype_add(MEM_cnew<MenuType>(
|
2023-09-14 17:35:24 +02:00
|
|
|
__func__, blender::ed::geometry::node_group_operator_assets_menu_unassigned()));
|
2023-06-29 13:57:54 +02:00
|
|
|
|
2024-02-02 20:59:20 +01:00
|
|
|
BKE_spacetype_register(std::move(st));
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|