2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-11-14 17:05:25 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2018-06-01 18:19:39 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
2008-11-14 17:05:25 +00:00
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-11-14 17:05:25 +00:00
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2008 Blender Foundation.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup spoutliner
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#pragma once
|
2008-11-14 17:05:25 +00:00
|
|
|
|
2008-12-30 21:28:27 +00:00
|
|
|
#include "RNA_types.h"
|
|
|
|
|
|
UI Code Quality: Start refactoring Outliner tree building (using C++)
This introduces a new C++ abstraction "tree-display" (in this commit named
tree-view, renamed in a followup) to help constructing and managing the tree
for the different display types (View Layer, Scene, Blender file, etc.).
See https://developer.blender.org/D9499 for more context. Other developers
approved this rather significantly different design approach there.
----
Motivation
General problems with current design:
* The Outliner tree building code is messy and hard to follow.
* Hard-coded display mode checks are scattered over many places.
* Data is passed around in rather unsafe ways (e.g. lots of `void *`).
* There are no individually testable units.
* Data-structure use is inefficient.
The current Outliner code needs quite some untangling, the tree building seems
like a good place to start. This and the followup commits tackle that.
----
Design Idea
Idea is to have an abstract base class (`AbstractTreeDisplay`), and then
sub-classes with the implementation for each display type (e.g.
`TreeDisplayViewLayer`, `TreeDisplayDataAPI`, etc). The tree-display is kept
alive until tree-rebuild as runtime data of the space, so that further queries
based on the display type can be executed (e.g. "does the display support
selection syncing?", "does it support restriction toggle columns?", etc.).
New files are in a new `space_outliner/tree` sub-directory.
With the new design, display modes become proper units, making them more
maintainable, safer and testable. It should also be easier now to add new
display modes.
2020-11-06 20:54:20 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2008-11-14 17:05:25 +00:00
|
|
|
/* internal exports only */
|
|
|
|
|
|
Outliner Filtering System + Cleanup
User notes:
The outliner so far was a great system to handle the object oriented workflow
we had in Blender prior to 2.8. However with the introduction of collections
the bloated ammount of data we were exposed at a given time was eventually
getting on the way of fully utilizing the outliner to manage collections and
their objects.
We hope that with this filtering system the user can put together the outliner
with whichever options he or she seem fit for a given task.
Features:
* Collection filter: In case users are only focused on objects.
* Object filter: Allow users to focus on collections only.
* (Object) content filter: Modifiers, mesh, contrainst, materials, ...
* (Object) children filter: Hide object children [1].
* Object State (visible, active, selected).
* Compact header: hide search options under a search toggle.
* Preserve scrolling position before/after filtering [2].
[1] - Note we still need to be able to tell if a children of an object is in a
collection, or if the parent object is the only one in the collection.
This in fact was one of the first motivations for this patch. But it is to
be addressed separately now that we can at least hide children away.
[2] - We look at the top-most collection in the outliner, and try to find it again
after the filtering and make sure it is in the same position as before.
This works nice now. But to work REALLY, REALLY nice we need to also store
the previous filter options to be sure the element we try to keep on top
was valid for both old and new filters. I would rather do this later though
since this smell a lot like feature creeping ;)
Remove no longer needed display options:
* Current Scene (replaced by View Layer/Collections)
* Visible (replaced by filter)
* Selected (same)
* Active (same)
* Same Type (same-ish)
How about All Scenes? I have a patch that will come next to replace the current
behaviour and focus only on compositing. So basically stop showing the objects
and show only view layers, their passes and collections, besides freestyle.
Also, while at this I'm also reorganizing the menu to keep View Layer and
Collections on top.
Developer notes:
* Unlike the per-object filtering, for collections we need to filter at tree
creation time, to prevent duplication of objects in the outliner.
Acknowledgements:
Thanks Pablo Vazquez for helping testing, thinking some design questions
together and pushing this to its final polished state as you see here.
Thanks Sergey Sharybin and Julian Eisel for code review. Julian couldn't do a
final review pass after I addressed his concerns. So blame is on me for any
issue I may be introducing here. Sergey was the author of the "preserve
scrolling position" idea. I'm happy with how it is working, thank you.
Reviewers: sergey, Severin, venomgfx
Subscribers: lichtwerk, duarteframos
Differential Revision: https://developer.blender.org/D2992
2018-01-19 11:39:54 -02:00
|
|
|
struct ARegion;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct EditBone;
|
|
|
|
|
struct ID;
|
2018-02-06 13:19:52 -02:00
|
|
|
struct ListBase;
|
2017-04-25 18:43:53 +02:00
|
|
|
struct Main;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct Object;
|
2008-12-22 19:31:23 +00:00
|
|
|
struct Scene;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct TreeElement;
|
|
|
|
|
struct TreeStoreElem;
|
2017-11-22 10:52:39 -02:00
|
|
|
struct ViewLayer;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct bContext;
|
2020-12-16 16:26:23 +11:00
|
|
|
struct bContextDataResult;
|
2016-04-26 12:54:51 +10:00
|
|
|
struct bPoseChannel;
|
2017-02-28 21:35:29 +01:00
|
|
|
struct wmKeyConfig;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct wmOperatorType;
|
Outliner: Delete all selected collections, not just active one
There were some issues with how we store outliner tree elements:
Apparently the only removable elements have been data-blocks so far.
When recreating the TreeElements, their TreeStoreElem instances were
mainly identified by their ID pointer. However non-data-blocks mostly
depend on an index. For collections, such an index isn't a reliable
measure though if we want to allow removing items. Depending on it for
identifying the TreeStoreElem instance would cause some quite noticeable
glitches (wrong highlights, two elements sharing highlight, etc).
For now I've solved that by actually removing the TreeStoreElem that
represents the removed element. A little limitation of this is that
after undoing the removal, some information might get lost, like
flags to store selection, or opened/closed state.
A better solution that would also fix this issue would be having a real
unique identifier for each non-data-block element, like an idname or even
its data-pointer. Not sure if we can get those to work reliable with
file read/write though, would have to investigate...
Also added a general Outliner tree traversal utility.
2017-02-28 20:37:14 +01:00
|
|
|
|
UI Code Quality: Start refactoring Outliner tree building (using C++)
This introduces a new C++ abstraction "tree-display" (in this commit named
tree-view, renamed in a followup) to help constructing and managing the tree
for the different display types (View Layer, Scene, Blender file, etc.).
See https://developer.blender.org/D9499 for more context. Other developers
approved this rather significantly different design approach there.
----
Motivation
General problems with current design:
* The Outliner tree building code is messy and hard to follow.
* Hard-coded display mode checks are scattered over many places.
* Data is passed around in rather unsafe ways (e.g. lots of `void *`).
* There are no individually testable units.
* Data-structure use is inefficient.
The current Outliner code needs quite some untangling, the tree building seems
like a good place to start. This and the followup commits tackle that.
----
Design Idea
Idea is to have an abstract base class (`AbstractTreeDisplay`), and then
sub-classes with the implementation for each display type (e.g.
`TreeDisplayViewLayer`, `TreeDisplayDataAPI`, etc). The tree-display is kept
alive until tree-rebuild as runtime data of the space, so that further queries
based on the display type can be executed (e.g. "does the display support
selection syncing?", "does it support restriction toggle columns?", etc.).
New files are in a new `space_outliner/tree` sub-directory.
With the new design, display modes become proper units, making them more
maintainable, safer and testable. It should also be easier now to add new
display modes.
2020-11-06 20:54:20 +01:00
|
|
|
typedef struct SpaceOutliner_Runtime {
|
2020-12-04 19:43:33 +01:00
|
|
|
/** Internal C++ object to create and manage the tree for a specific display type (View Layers,
|
|
|
|
|
* Scenes, Blender File, etc.). */
|
2020-11-09 13:25:59 +01:00
|
|
|
struct TreeDisplay *tree_display;
|
2020-12-04 19:43:33 +01:00
|
|
|
|
2020-12-07 13:24:58 +11:00
|
|
|
/** Pointers to tree-store elements, grouped by `(id, type, nr)`
|
|
|
|
|
* in hash-table for faster searching. */
|
2020-12-04 19:43:33 +01:00
|
|
|
struct GHash *treehash;
|
UI Code Quality: Start refactoring Outliner tree building (using C++)
This introduces a new C++ abstraction "tree-display" (in this commit named
tree-view, renamed in a followup) to help constructing and managing the tree
for the different display types (View Layer, Scene, Blender file, etc.).
See https://developer.blender.org/D9499 for more context. Other developers
approved this rather significantly different design approach there.
----
Motivation
General problems with current design:
* The Outliner tree building code is messy and hard to follow.
* Hard-coded display mode checks are scattered over many places.
* Data is passed around in rather unsafe ways (e.g. lots of `void *`).
* There are no individually testable units.
* Data-structure use is inefficient.
The current Outliner code needs quite some untangling, the tree building seems
like a good place to start. This and the followup commits tackle that.
----
Design Idea
Idea is to have an abstract base class (`AbstractTreeDisplay`), and then
sub-classes with the implementation for each display type (e.g.
`TreeDisplayViewLayer`, `TreeDisplayDataAPI`, etc). The tree-display is kept
alive until tree-rebuild as runtime data of the space, so that further queries
based on the display type can be executed (e.g. "does the display support
selection syncing?", "does it support restriction toggle columns?", etc.).
New files are in a new `space_outliner/tree` sub-directory.
With the new design, display modes become proper units, making them more
maintainable, safer and testable. It should also be easier now to add new
display modes.
2020-11-06 20:54:20 +01:00
|
|
|
} SpaceOutliner_Runtime;
|
|
|
|
|
|
2017-03-02 17:11:09 +01:00
|
|
|
typedef enum TreeElementInsertType {
|
2017-03-10 15:03:06 +01:00
|
|
|
TE_INSERT_BEFORE,
|
2017-03-02 17:11:09 +01:00
|
|
|
TE_INSERT_AFTER,
|
|
|
|
|
TE_INSERT_INTO,
|
|
|
|
|
} TreeElementInsertType;
|
|
|
|
|
|
2017-03-01 11:28:17 +01:00
|
|
|
typedef enum TreeTraversalAction {
|
2020-07-03 11:20:52 +10:00
|
|
|
/** Continue traversal regularly, don't skip children. */
|
Outliner: Delete all selected collections, not just active one
There were some issues with how we store outliner tree elements:
Apparently the only removable elements have been data-blocks so far.
When recreating the TreeElements, their TreeStoreElem instances were
mainly identified by their ID pointer. However non-data-blocks mostly
depend on an index. For collections, such an index isn't a reliable
measure though if we want to allow removing items. Depending on it for
identifying the TreeStoreElem instance would cause some quite noticeable
glitches (wrong highlights, two elements sharing highlight, etc).
For now I've solved that by actually removing the TreeStoreElem that
represents the removed element. A little limitation of this is that
after undoing the removal, some information might get lost, like
flags to store selection, or opened/closed state.
A better solution that would also fix this issue would be having a real
unique identifier for each non-data-block element, like an idname or even
its data-pointer. Not sure if we can get those to work reliable with
file read/write though, would have to investigate...
Also added a general Outliner tree traversal utility.
2017-02-28 20:37:14 +01:00
|
|
|
TRAVERSE_CONTINUE = 0,
|
2020-07-03 11:20:52 +10:00
|
|
|
/** Stop traversal. */
|
Outliner: Delete all selected collections, not just active one
There were some issues with how we store outliner tree elements:
Apparently the only removable elements have been data-blocks so far.
When recreating the TreeElements, their TreeStoreElem instances were
mainly identified by their ID pointer. However non-data-blocks mostly
depend on an index. For collections, such an index isn't a reliable
measure though if we want to allow removing items. Depending on it for
identifying the TreeStoreElem instance would cause some quite noticeable
glitches (wrong highlights, two elements sharing highlight, etc).
For now I've solved that by actually removing the TreeStoreElem that
represents the removed element. A little limitation of this is that
after undoing the removal, some information might get lost, like
flags to store selection, or opened/closed state.
A better solution that would also fix this issue would be having a real
unique identifier for each non-data-block element, like an idname or even
its data-pointer. Not sure if we can get those to work reliable with
file read/write though, would have to investigate...
Also added a general Outliner tree traversal utility.
2017-02-28 20:37:14 +01:00
|
|
|
TRAVERSE_BREAK,
|
2020-07-03 11:20:52 +10:00
|
|
|
/** Continue traversal, but skip children of traversed element. */
|
Outliner: Delete all selected collections, not just active one
There were some issues with how we store outliner tree elements:
Apparently the only removable elements have been data-blocks so far.
When recreating the TreeElements, their TreeStoreElem instances were
mainly identified by their ID pointer. However non-data-blocks mostly
depend on an index. For collections, such an index isn't a reliable
measure though if we want to allow removing items. Depending on it for
identifying the TreeStoreElem instance would cause some quite noticeable
glitches (wrong highlights, two elements sharing highlight, etc).
For now I've solved that by actually removing the TreeStoreElem that
represents the removed element. A little limitation of this is that
after undoing the removal, some information might get lost, like
flags to store selection, or opened/closed state.
A better solution that would also fix this issue would be having a real
unique identifier for each non-data-block element, like an idname or even
its data-pointer. Not sure if we can get those to work reliable with
file read/write though, would have to investigate...
Also added a general Outliner tree traversal utility.
2017-02-28 20:37:14 +01:00
|
|
|
TRAVERSE_SKIP_CHILDS,
|
2017-03-01 11:28:17 +01:00
|
|
|
} TreeTraversalAction;
|
Outliner: Delete all selected collections, not just active one
There were some issues with how we store outliner tree elements:
Apparently the only removable elements have been data-blocks so far.
When recreating the TreeElements, their TreeStoreElem instances were
mainly identified by their ID pointer. However non-data-blocks mostly
depend on an index. For collections, such an index isn't a reliable
measure though if we want to allow removing items. Depending on it for
identifying the TreeStoreElem instance would cause some quite noticeable
glitches (wrong highlights, two elements sharing highlight, etc).
For now I've solved that by actually removing the TreeStoreElem that
represents the removed element. A little limitation of this is that
after undoing the removal, some information might get lost, like
flags to store selection, or opened/closed state.
A better solution that would also fix this issue would be having a real
unique identifier for each non-data-block element, like an idname or even
its data-pointer. Not sure if we can get those to work reliable with
file read/write though, would have to investigate...
Also added a general Outliner tree traversal utility.
2017-02-28 20:37:14 +01:00
|
|
|
|
2017-03-01 11:28:17 +01:00
|
|
|
typedef TreeTraversalAction (*TreeTraversalFunc)(struct TreeElement *te, void *customdata);
|
Outliner: Delete all selected collections, not just active one
There were some issues with how we store outliner tree elements:
Apparently the only removable elements have been data-blocks so far.
When recreating the TreeElements, their TreeStoreElem instances were
mainly identified by their ID pointer. However non-data-blocks mostly
depend on an index. For collections, such an index isn't a reliable
measure though if we want to allow removing items. Depending on it for
identifying the TreeStoreElem instance would cause some quite noticeable
glitches (wrong highlights, two elements sharing highlight, etc).
For now I've solved that by actually removing the TreeStoreElem that
represents the removed element. A little limitation of this is that
after undoing the removal, some information might get lost, like
flags to store selection, or opened/closed state.
A better solution that would also fix this issue would be having a real
unique identifier for each non-data-block element, like an idname or even
its data-pointer. Not sure if we can get those to work reliable with
file read/write though, would have to investigate...
Also added a general Outliner tree traversal utility.
2017-02-28 20:37:14 +01:00
|
|
|
|
2008-12-14 10:08:00 +00:00
|
|
|
typedef struct TreeElement {
|
|
|
|
|
struct TreeElement *next, *prev, *parent;
|
UI Code Quality: Start refactoring Outliner tree-element building (using C++)
Continuation of the work started with 249e4df110e0. After all display modes
were ported to this new design, this commit starts the (more complex) work on
the individual tree-element types. More concretely it ports animation
tree-elements (action data-blocks, drivers and NLA data).
The commit above explains motivations. In short, we need a better design that's
easier to reason about and better testable.
Changes done here are pretty straight forward and introduce similar class
hierarchy and building patterns as introduced for the display modes already.
I.e. an abstract base class, `AbstractTreeElement` with derived classes for the
concrete types, and a C-API with a switch to create the needed objects from a
type enum. The latter should be replacable with something nicer later on (RAII
based, and type-safer through meta-programming).
Each tree-element type has its own class, with an own header and source file
(okay some closely related types can share a header and source file, like the
NLA ones).
I added some further temporary bits for the transition to the new design, such
as the `TreeElement.type`. It should entirely replace `TreeElement` eventually,
just as `outliner_add_element()` should be quite small by then and easily
replacable by a `TreeBuilder` helper.
2020-12-07 14:50:08 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Handle to the new C++ object (a derived type of base #AbstractTreeElement) that should replace
|
|
|
|
|
* #TreeElement. Step by step, data should be moved to it and operations based on the type should
|
|
|
|
|
* become virtual methods of the class hierarchy.
|
|
|
|
|
*/
|
|
|
|
|
struct TreeElementType *type;
|
|
|
|
|
|
2008-12-14 10:08:00 +00:00
|
|
|
ListBase subtree;
|
2020-07-03 13:31:42 -06:00
|
|
|
int xs, ys; /* Do selection. */
|
|
|
|
|
TreeStoreElem *store_elem; /* Element in tree store. */
|
|
|
|
|
short flag; /* Flag for non-saved stuff. */
|
|
|
|
|
short index; /* Index for data arrays. */
|
|
|
|
|
short idcode; /* From TreeStore id. */
|
|
|
|
|
short xend; /* Width of item display, for select. */
|
2010-12-03 17:05:21 +00:00
|
|
|
const char *name;
|
2020-07-03 13:31:42 -06:00
|
|
|
void *directdata; /* Armature Bones, Base, Sequence, Strip... */
|
|
|
|
|
PointerRNA rnaptr; /* RNA Pointer. */
|
2017-02-22 16:02:43 +01:00
|
|
|
} TreeElement;
|
2008-12-14 10:08:00 +00:00
|
|
|
|
2018-08-07 10:55:03 +02:00
|
|
|
typedef struct TreeElementIcon {
|
|
|
|
|
struct ID *drag_id, *drag_parent;
|
|
|
|
|
int icon;
|
|
|
|
|
} TreeElementIcon;
|
|
|
|
|
|
2015-04-30 14:04:41 +02:00
|
|
|
#define TREESTORE_ID_TYPE(_id) \
|
2015-08-29 15:51:11 +02:00
|
|
|
(ELEM(GS((_id)->name), \
|
|
|
|
|
ID_SCE, \
|
|
|
|
|
ID_LI, \
|
|
|
|
|
ID_OB, \
|
|
|
|
|
ID_ME, \
|
|
|
|
|
ID_CU, \
|
|
|
|
|
ID_MB, \
|
|
|
|
|
ID_NT, \
|
|
|
|
|
ID_MA, \
|
|
|
|
|
ID_TE, \
|
|
|
|
|
ID_IM, \
|
|
|
|
|
ID_LT, \
|
|
|
|
|
ID_LA, \
|
|
|
|
|
ID_CA) || \
|
2017-06-12 20:59:54 +10:00
|
|
|
ELEM(GS((_id)->name), \
|
|
|
|
|
ID_KE, \
|
|
|
|
|
ID_WO, \
|
|
|
|
|
ID_SPK, \
|
|
|
|
|
ID_GR, \
|
|
|
|
|
ID_AR, \
|
|
|
|
|
ID_AC, \
|
|
|
|
|
ID_BR, \
|
|
|
|
|
ID_PA, \
|
|
|
|
|
ID_GD, \
|
|
|
|
|
ID_LS, \
|
2020-03-17 14:41:48 +01:00
|
|
|
ID_LP, \
|
|
|
|
|
ID_HA, \
|
|
|
|
|
ID_PT, \
|
2020-04-20 10:37:38 +02:00
|
|
|
ID_VO, \
|
|
|
|
|
ID_SIM) || /* Only in 'blendfile' mode ... :/ */ \
|
2019-03-04 11:51:11 +01:00
|
|
|
ELEM(GS((_id)->name), \
|
|
|
|
|
ID_SCR, \
|
|
|
|
|
ID_WM, \
|
|
|
|
|
ID_TXT, \
|
|
|
|
|
ID_VF, \
|
|
|
|
|
ID_SO, \
|
|
|
|
|
ID_CF, \
|
|
|
|
|
ID_PAL, \
|
|
|
|
|
ID_MC, \
|
|
|
|
|
ID_WS, \
|
|
|
|
|
ID_MSK, \
|
|
|
|
|
ID_PC))
|
2015-04-30 14:04:41 +02:00
|
|
|
|
2008-12-14 10:08:00 +00:00
|
|
|
/* TreeElement->flag */
|
2016-10-16 02:53:11 +02:00
|
|
|
enum {
|
|
|
|
|
TE_ACTIVE = (1 << 0),
|
|
|
|
|
/* Closed items display their children as icon within the row. TE_ICONROW is for
|
|
|
|
|
* these child-items that are visible but only within the row of the closed parent. */
|
|
|
|
|
TE_ICONROW = (1 << 1),
|
|
|
|
|
TE_LAZY_CLOSED = (1 << 2),
|
|
|
|
|
TE_FREE_NAME = (1 << 3),
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
TE_DISABLED = (1 << 4),
|
2018-08-10 17:04:05 +02:00
|
|
|
TE_DRAGGING = (1 << 5),
|
2019-04-24 11:41:35 +00:00
|
|
|
TE_CHILD_NOT_IN_COLLECTION = (1 << 6),
|
2019-08-18 04:11:50 +10:00
|
|
|
/* Child elements of the same type in the icon-row are drawn merged as one icon.
|
|
|
|
|
* This flag is set for an element that is part of these merged child icons. */
|
2019-08-08 15:37:32 -06:00
|
|
|
TE_ICONROW_MERGED = (1 << 7),
|
2016-10-16 02:53:11 +02:00
|
|
|
};
|
2008-12-14 10:08:00 +00:00
|
|
|
|
|
|
|
|
/* button events */
|
2012-05-07 17:56:30 +00:00
|
|
|
#define OL_NAMEBUTTON 1
|
2008-12-14 10:08:00 +00:00
|
|
|
|
2014-01-16 20:22:45 +11:00
|
|
|
typedef enum {
|
|
|
|
|
OL_DRAWSEL_NONE = 0, /* inactive (regular black text) */
|
|
|
|
|
OL_DRAWSEL_NORMAL = 1, /* active object (draws white text) */
|
|
|
|
|
OL_DRAWSEL_ACTIVE = 2, /* active obdata (draws a circle around the icon) */
|
|
|
|
|
} eOLDrawState;
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
|
OL_SETSEL_NONE = 0, /* don't change the selection state */
|
|
|
|
|
OL_SETSEL_NORMAL = 1, /* select the item */
|
|
|
|
|
OL_SETSEL_EXTEND = 2, /* select the item and extend (also toggles selection) */
|
|
|
|
|
} eOLSetState;
|
|
|
|
|
|
2018-06-04 09:31:30 +02:00
|
|
|
/* get TreeStoreElem associated with a TreeElement
|
2011-07-11 10:59:53 +00:00
|
|
|
* < a: (TreeElement) tree element to find stored element for
|
|
|
|
|
*/
|
2013-08-03 11:35:09 +00:00
|
|
|
#define TREESTORE(a) ((a)->store_elem)
|
2008-12-14 10:08:00 +00:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* size constants */
|
2012-05-07 17:56:30 +00:00
|
|
|
#define OL_Y_OFFSET 2
|
2008-11-14 17:05:25 +00:00
|
|
|
|
Outliner Visibility Update
See T61578 for discussions and mockups.
Visibility Options
==================
We are adding more granular control over restriction columns in the outliner,
exposing "indirect only" and "holdout" as options, and change the way
users enable/disable collections in a viewlayer.
We also rename the object viewport restriction to hide instance.
So the options we have are:
Collection
----------
* Render Visibility
* Instance Visibility
* Selectable
(View) Layer Collection
-----------------------
* Enable
* Holdout
* Indirect Only
* Viewport
Shortcuts
=========
Isolate Collection
------------------
* Ctr + click isolates the collection.
It turns all its parents and children "visible", and all the other
collections "invisible".
If ALL the collections were already properly set, we re-set the
collections to their default value.
Set Collection Inside Collections and Objects
---------------------------------------------
* Shift + click: Set/unset inside collections and objects.
We only set objects values as well when we are in View Layer mode and
(obviously) when the objects have a matching property.
Icons
=====
Little reminder that we will need better icons for holdout, indirect only, and
probably instanced (nothing wrong with the current, but it differs from
the proposal when it is turned off).
Also, we need to decide where do we want the modifier/bones/... icons to
be (in which column) and ideally make sure their icons match the ones we
use for collections/objects.
At the moment those are using the screen icon, which is not being used
by collections.
Reviewers: brecht, billrey
Subscribers: pablovazquez
Differential Revision: https://developer.blender.org/D4823
2019-05-04 14:14:37 -03:00
|
|
|
#define OL_TOG_USER_BUTS_USERS (UI_UNIT_X * 2.0f + V2D_SCROLL_WIDTH)
|
2020-06-22 09:34:50 -06:00
|
|
|
#define OL_TOG_USER_BUTS_STATUS (UI_UNIT_X + V2D_SCROLL_WIDTH)
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
#define OL_RNA_COLX (UI_UNIT_X * 15)
|
|
|
|
|
#define OL_RNA_COL_SIZEX (UI_UNIT_X * 7.5f)
|
|
|
|
|
#define OL_RNA_COL_SPACEX (UI_UNIT_X * 2.5f)
|
2011-07-11 10:59:53 +00:00
|
|
|
|
Outliner Filtering System + Cleanup
User notes:
The outliner so far was a great system to handle the object oriented workflow
we had in Blender prior to 2.8. However with the introduction of collections
the bloated ammount of data we were exposed at a given time was eventually
getting on the way of fully utilizing the outliner to manage collections and
their objects.
We hope that with this filtering system the user can put together the outliner
with whichever options he or she seem fit for a given task.
Features:
* Collection filter: In case users are only focused on objects.
* Object filter: Allow users to focus on collections only.
* (Object) content filter: Modifiers, mesh, contrainst, materials, ...
* (Object) children filter: Hide object children [1].
* Object State (visible, active, selected).
* Compact header: hide search options under a search toggle.
* Preserve scrolling position before/after filtering [2].
[1] - Note we still need to be able to tell if a children of an object is in a
collection, or if the parent object is the only one in the collection.
This in fact was one of the first motivations for this patch. But it is to
be addressed separately now that we can at least hide children away.
[2] - We look at the top-most collection in the outliner, and try to find it again
after the filtering and make sure it is in the same position as before.
This works nice now. But to work REALLY, REALLY nice we need to also store
the previous filter options to be sure the element we try to keep on top
was valid for both old and new filters. I would rather do this later though
since this smell a lot like feature creeping ;)
Remove no longer needed display options:
* Current Scene (replaced by View Layer/Collections)
* Visible (replaced by filter)
* Selected (same)
* Active (same)
* Same Type (same-ish)
How about All Scenes? I have a patch that will come next to replace the current
behaviour and focus only on compositing. So basically stop showing the objects
and show only view layers, their passes and collections, besides freestyle.
Also, while at this I'm also reorganizing the menu to keep View Layer and
Collections on top.
Developer notes:
* Unlike the per-object filtering, for collections we need to filter at tree
creation time, to prevent duplication of objects in the outliner.
Acknowledgements:
Thanks Pablo Vazquez for helping testing, thinking some design questions
together and pushing this to its final polished state as you see here.
Thanks Sergey Sharybin and Julian Eisel for code review. Julian couldn't do a
final review pass after I addressed his concerns. So blame is on me for any
issue I may be introducing here. Sergey was the author of the "preserve
scrolling position" idea. I'm happy with how it is working, thank you.
Reviewers: sergey, Severin, venomgfx
Subscribers: lichtwerk, duarteframos
Differential Revision: https://developer.blender.org/D2992
2018-01-19 11:39:54 -02:00
|
|
|
/* The outliner display modes that support the filter system.
|
|
|
|
|
* Note: keep it synced with space_outliner.py */
|
2020-08-07 11:47:23 -06:00
|
|
|
#define SUPPORT_FILTER_OUTLINER(space_outliner_) \
|
|
|
|
|
(ELEM((space_outliner_)->outlinevis, SO_VIEW_LAYER))
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2011-09-09 12:46:07 +00:00
|
|
|
/* Outliner Searching --
|
2012-03-03 16:31:46 +00:00
|
|
|
*
|
|
|
|
|
* Are we looking for something in the outliner?
|
|
|
|
|
* If so finding matches in child items makes it more useful
|
|
|
|
|
*
|
2018-06-01 18:19:39 +02:00
|
|
|
* - We want to flag parents to act as being open to filter child matches
|
2012-03-03 16:31:46 +00:00
|
|
|
* - and also flag matches so we can highlight them
|
|
|
|
|
* - Flags are stored in TreeStoreElem->flag
|
|
|
|
|
* - Flag options defined in DNA_outliner_types.h
|
|
|
|
|
* - SO_SEARCH_RECURSIVE defined in DNA_space_types.h
|
|
|
|
|
*
|
2019-06-12 09:04:10 +10:00
|
|
|
* - NOT in data-blocks view - searching all data-blocks takes way too long
|
2012-03-03 16:31:46 +00:00
|
|
|
* to be useful
|
|
|
|
|
* - not searching into RNA items helps but isn't the complete solution
|
|
|
|
|
*/
|
2011-09-09 12:46:07 +00:00
|
|
|
|
2018-06-25 12:14:38 +02:00
|
|
|
#define SEARCHING_OUTLINER(sov) (sov->search_flags & SO_SEARCH_RECURSIVE)
|
2011-09-09 12:46:07 +00:00
|
|
|
|
2018-09-27 15:35:22 +02:00
|
|
|
/* is the current element open? if so we also show children */
|
2012-05-07 17:56:30 +00:00
|
|
|
#define TSELEM_OPEN(telm, sv) \
|
2020-04-05 13:53:24 +10:00
|
|
|
(((telm)->flag & TSE_CLOSED) == 0 || \
|
|
|
|
|
(SEARCHING_OUTLINER(sv) && ((telm)->flag & TSE_CHILDSEARCH)))
|
2011-09-09 12:46:07 +00:00
|
|
|
|
2019-11-02 03:11:56 +11:00
|
|
|
/**
|
|
|
|
|
* Container to avoid passing around these variables to many functions.
|
2019-11-08 11:41:34 +11:00
|
|
|
* Also so we can have one place to assign these variables.
|
2019-11-02 03:11:56 +11:00
|
|
|
*/
|
|
|
|
|
typedef struct TreeViewContext {
|
|
|
|
|
/* Scene level. */
|
|
|
|
|
struct Scene *scene;
|
|
|
|
|
struct ViewLayer *view_layer;
|
|
|
|
|
|
|
|
|
|
/* Object level. */
|
|
|
|
|
/** Avoid OBACT macro everywhere. */
|
|
|
|
|
Object *obact;
|
|
|
|
|
Object *ob_edit;
|
|
|
|
|
/**
|
|
|
|
|
* The pose object may not be the active object (when in weight paint mode).
|
|
|
|
|
* Checking this in draw loops isn't efficient, so set only once. */
|
|
|
|
|
Object *ob_pose;
|
|
|
|
|
} TreeViewContext;
|
|
|
|
|
|
2020-06-19 12:35:09 -06:00
|
|
|
typedef enum TreeItemSelectAction {
|
|
|
|
|
OL_ITEM_DESELECT = 0, /* Deselect the item */
|
|
|
|
|
OL_ITEM_SELECT = (1 << 0), /* Select the item */
|
|
|
|
|
OL_ITEM_SELECT_DATA = (1 << 1), /* Select object data */
|
|
|
|
|
OL_ITEM_ACTIVATE = (1 << 2), /* Activate the item */
|
|
|
|
|
OL_ITEM_EXTEND = (1 << 3), /* Extend the current selection */
|
|
|
|
|
OL_ITEM_RECURSIVE = (1 << 4), /* Select recursively */
|
|
|
|
|
} TreeItemSelectAction;
|
|
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* outliner_tree.c ----------------------------------------------- */
|
|
|
|
|
|
2018-01-10 22:45:44 +01:00
|
|
|
void outliner_free_tree(ListBase *tree);
|
2020-08-07 11:47:23 -06:00
|
|
|
void outliner_cleanup_tree(struct SpaceOutliner *space_outliner);
|
2018-01-10 22:45:44 +01:00
|
|
|
void outliner_free_tree_element(TreeElement *element, ListBase *parent_subtree);
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2018-02-06 17:11:46 +11:00
|
|
|
void outliner_build_tree(struct Main *mainvar,
|
|
|
|
|
struct Scene *scene,
|
|
|
|
|
struct ViewLayer *view_layer,
|
2020-08-07 11:47:23 -06:00
|
|
|
struct SpaceOutliner *space_outliner,
|
2020-03-06 16:56:42 +01:00
|
|
|
struct ARegion *region);
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2020-10-12 18:04:52 +02:00
|
|
|
bool outliner_requires_rebuild_on_select_or_active_change(
|
|
|
|
|
const struct SpaceOutliner *space_outliner);
|
2020-10-12 18:19:14 +02:00
|
|
|
bool outliner_requires_rebuild_on_open_change(const struct SpaceOutliner *space_outliner);
|
2020-06-19 19:09:32 +02:00
|
|
|
|
2018-08-29 18:07:14 +02:00
|
|
|
typedef struct IDsSelectedData {
|
|
|
|
|
struct ListBase selected_array;
|
|
|
|
|
} IDsSelectedData;
|
2018-02-06 13:19:52 -02:00
|
|
|
|
2018-08-29 18:07:14 +02:00
|
|
|
TreeTraversalAction outliner_find_selected_collections(struct TreeElement *te, void *customdata);
|
2018-02-06 13:19:52 -02:00
|
|
|
TreeTraversalAction outliner_find_selected_objects(struct TreeElement *te, void *customdata);
|
|
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* outliner_draw.c ---------------------------------------------- */
|
2008-12-22 19:31:23 +00:00
|
|
|
|
|
|
|
|
void draw_outliner(const struct bContext *C);
|
|
|
|
|
|
2020-11-10 13:53:05 +01:00
|
|
|
void outliner_tree_dimensions(struct SpaceOutliner *space_outliner, int *r_width, int *r_height);
|
|
|
|
|
|
2018-08-07 10:55:03 +02:00
|
|
|
TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te);
|
|
|
|
|
|
2019-05-31 15:46:18 -03:00
|
|
|
void outliner_collection_isolate_flag(struct Scene *scene,
|
|
|
|
|
struct ViewLayer *view_layer,
|
|
|
|
|
struct LayerCollection *layer_collection,
|
|
|
|
|
struct Collection *collection,
|
|
|
|
|
struct PropertyRNA *layer_or_collection_prop,
|
|
|
|
|
const char *propname,
|
|
|
|
|
const bool value);
|
|
|
|
|
|
2019-08-08 15:37:32 -06:00
|
|
|
int tree_element_id_type_to_index(TreeElement *te);
|
|
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* outliner_select.c -------------------------------------------- */
|
2014-01-16 20:22:45 +11:00
|
|
|
eOLDrawState tree_element_type_active(struct bContext *C,
|
2019-11-02 03:11:56 +11:00
|
|
|
const TreeViewContext *tvc,
|
2020-08-07 11:47:23 -06:00
|
|
|
struct SpaceOutliner *space_outliner,
|
2014-01-16 20:22:45 +11:00
|
|
|
TreeElement *te,
|
|
|
|
|
TreeStoreElem *tselem,
|
|
|
|
|
const eOLSetState set,
|
|
|
|
|
bool recursive);
|
2019-02-16 09:47:19 +11:00
|
|
|
eOLDrawState tree_element_active(struct bContext *C,
|
2019-11-02 03:11:56 +11:00
|
|
|
const TreeViewContext *tvc,
|
2020-08-07 11:47:23 -06:00
|
|
|
SpaceOutliner *space_outliner,
|
2014-03-24 13:08:29 +01:00
|
|
|
TreeElement *te,
|
|
|
|
|
const eOLSetState set,
|
|
|
|
|
const bool handle_all_types);
|
2017-11-20 16:01:04 +11:00
|
|
|
|
2020-09-15 15:23:08 -06:00
|
|
|
struct bPoseChannel *outliner_find_parent_bone(TreeElement *te, TreeElement **r_bone_te);
|
|
|
|
|
|
2020-06-19 12:35:09 -06:00
|
|
|
void outliner_item_select(struct bContext *C,
|
2020-08-07 11:47:23 -06:00
|
|
|
struct SpaceOutliner *space_outliner,
|
2020-06-19 12:35:09 -06:00
|
|
|
struct TreeElement *te,
|
|
|
|
|
const short select_flag);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-11-01 06:18:08 +11:00
|
|
|
bool outliner_item_is_co_over_name_icons(const TreeElement *te, float view_co_x);
|
2020-11-23 15:58:56 -07:00
|
|
|
bool outliner_item_is_co_over_icon(const TreeElement *te, float view_co_x);
|
2020-10-15 20:23:13 +02:00
|
|
|
bool outliner_item_is_co_over_name(const TreeElement *te, float view_co_x);
|
2019-11-01 06:18:08 +11:00
|
|
|
bool outliner_item_is_co_within_close_toggle(const TreeElement *te, float view_co_x);
|
2020-09-10 08:35:58 -06:00
|
|
|
bool outliner_is_co_within_mode_column(SpaceOutliner *space_outliner, const float view_mval[2]);
|
|
|
|
|
|
|
|
|
|
void outliner_item_mode_toggle(struct bContext *C,
|
|
|
|
|
TreeViewContext *tvc,
|
|
|
|
|
TreeElement *te,
|
|
|
|
|
const bool do_extend);
|
2019-08-08 15:37:32 -06:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* outliner_edit.c ---------------------------------------------- */
|
2020-08-07 10:27:53 -06:00
|
|
|
typedef void (*outliner_operation_fn)(struct bContext *C,
|
2016-07-01 17:16:39 +02:00
|
|
|
struct ReportList *,
|
|
|
|
|
struct Scene *scene,
|
|
|
|
|
struct TreeElement *,
|
|
|
|
|
struct TreeStoreElem *,
|
|
|
|
|
TreeStoreElem *,
|
|
|
|
|
void *);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-10-22 18:42:44 +11:00
|
|
|
void outliner_do_object_operation_ex(struct bContext *C,
|
2019-02-16 09:47:19 +11:00
|
|
|
struct ReportList *reports,
|
|
|
|
|
struct Scene *scene,
|
2020-08-07 11:47:23 -06:00
|
|
|
struct SpaceOutliner *space_outliner,
|
2019-01-16 17:34:31 +01:00
|
|
|
struct ListBase *lb,
|
2020-08-07 10:27:53 -06:00
|
|
|
outliner_operation_fn operation_fn,
|
2019-01-16 17:34:31 +01:00
|
|
|
void *user_data,
|
|
|
|
|
bool recurse_selected);
|
2015-10-22 18:42:44 +11:00
|
|
|
void outliner_do_object_operation(struct bContext *C,
|
2019-02-16 09:47:19 +11:00
|
|
|
struct ReportList *reports,
|
|
|
|
|
struct Scene *scene,
|
2020-08-07 11:47:23 -06:00
|
|
|
struct SpaceOutliner *space_outliner,
|
2017-02-28 21:35:29 +01:00
|
|
|
struct ListBase *lb,
|
2020-08-07 10:27:53 -06:00
|
|
|
outliner_operation_fn operation_fn);
|
2011-07-11 10:59:53 +00:00
|
|
|
|
|
|
|
|
int common_restrict_check(struct bContext *C, struct Object *ob);
|
|
|
|
|
|
2018-07-06 14:40:13 +02:00
|
|
|
int outliner_flag_is_any_test(ListBase *lb, short flag, const int curlevel);
|
2018-07-06 14:41:14 +02:00
|
|
|
bool outliner_flag_set(ListBase *lb, short flag, short set);
|
2018-07-06 14:45:30 +02:00
|
|
|
bool outliner_flag_flip(ListBase *lb, short flag);
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2020-08-07 10:27:53 -06:00
|
|
|
void item_rename_fn(struct bContext *C,
|
2016-07-01 17:16:39 +02:00
|
|
|
struct ReportList *reports,
|
|
|
|
|
struct Scene *scene,
|
|
|
|
|
TreeElement *te,
|
|
|
|
|
struct TreeStoreElem *tsep,
|
|
|
|
|
struct TreeStoreElem *tselem,
|
|
|
|
|
void *user_data);
|
2020-08-07 10:27:53 -06:00
|
|
|
void lib_relocate_fn(struct bContext *C,
|
2016-07-01 17:16:39 +02:00
|
|
|
struct ReportList *reports,
|
|
|
|
|
struct Scene *scene,
|
|
|
|
|
struct TreeElement *te,
|
2016-06-22 18:05:55 +02:00
|
|
|
struct TreeStoreElem *tsep,
|
|
|
|
|
struct TreeStoreElem *tselem,
|
|
|
|
|
void *user_data);
|
2020-08-07 10:27:53 -06:00
|
|
|
void lib_reload_fn(struct bContext *C,
|
2016-07-01 17:16:39 +02:00
|
|
|
struct ReportList *reports,
|
|
|
|
|
struct Scene *scene,
|
|
|
|
|
struct TreeElement *te,
|
2016-06-22 18:05:55 +02:00
|
|
|
struct TreeStoreElem *tsep,
|
|
|
|
|
struct TreeStoreElem *tselem,
|
|
|
|
|
void *user_data);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-08-07 10:27:53 -06:00
|
|
|
void id_delete_fn(struct bContext *C,
|
2016-07-01 17:16:39 +02:00
|
|
|
struct ReportList *reports,
|
|
|
|
|
struct Scene *scene,
|
|
|
|
|
struct TreeElement *te,
|
2016-06-22 18:05:55 +02:00
|
|
|
struct TreeStoreElem *tsep,
|
|
|
|
|
struct TreeStoreElem *tselem,
|
|
|
|
|
void *user_data);
|
2020-08-07 10:27:53 -06:00
|
|
|
void id_remap_fn(struct bContext *C,
|
2016-07-01 17:16:39 +02:00
|
|
|
struct ReportList *reports,
|
|
|
|
|
struct Scene *scene,
|
|
|
|
|
struct TreeElement *te,
|
2015-12-18 22:12:32 +01:00
|
|
|
struct TreeStoreElem *tsep,
|
|
|
|
|
struct TreeStoreElem *tselem,
|
|
|
|
|
void *user_data);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-08-07 10:27:53 -06:00
|
|
|
void item_object_mode_enter_fn(struct bContext *C,
|
2018-06-20 10:04:43 +02:00
|
|
|
struct ReportList *reports,
|
|
|
|
|
struct Scene *scene,
|
|
|
|
|
TreeElement *te,
|
|
|
|
|
struct TreeStoreElem *tsep,
|
|
|
|
|
struct TreeStoreElem *tselem,
|
|
|
|
|
void *user_data);
|
2020-08-07 10:27:53 -06:00
|
|
|
void item_object_mode_exit_fn(struct bContext *C,
|
2018-06-20 10:04:43 +02:00
|
|
|
struct ReportList *reports,
|
|
|
|
|
struct Scene *scene,
|
|
|
|
|
TreeElement *te,
|
|
|
|
|
struct TreeStoreElem *tsep,
|
|
|
|
|
struct TreeStoreElem *tselem,
|
|
|
|
|
void *user_data);
|
|
|
|
|
|
2020-08-07 11:47:23 -06:00
|
|
|
void outliner_set_coordinates(struct ARegion *region, struct SpaceOutliner *space_outliner);
|
Outliner Filtering System + Cleanup
User notes:
The outliner so far was a great system to handle the object oriented workflow
we had in Blender prior to 2.8. However with the introduction of collections
the bloated ammount of data we were exposed at a given time was eventually
getting on the way of fully utilizing the outliner to manage collections and
their objects.
We hope that with this filtering system the user can put together the outliner
with whichever options he or she seem fit for a given task.
Features:
* Collection filter: In case users are only focused on objects.
* Object filter: Allow users to focus on collections only.
* (Object) content filter: Modifiers, mesh, contrainst, materials, ...
* (Object) children filter: Hide object children [1].
* Object State (visible, active, selected).
* Compact header: hide search options under a search toggle.
* Preserve scrolling position before/after filtering [2].
[1] - Note we still need to be able to tell if a children of an object is in a
collection, or if the parent object is the only one in the collection.
This in fact was one of the first motivations for this patch. But it is to
be addressed separately now that we can at least hide children away.
[2] - We look at the top-most collection in the outliner, and try to find it again
after the filtering and make sure it is in the same position as before.
This works nice now. But to work REALLY, REALLY nice we need to also store
the previous filter options to be sure the element we try to keep on top
was valid for both old and new filters. I would rather do this later though
since this smell a lot like feature creeping ;)
Remove no longer needed display options:
* Current Scene (replaced by View Layer/Collections)
* Visible (replaced by filter)
* Selected (same)
* Active (same)
* Same Type (same-ish)
How about All Scenes? I have a patch that will come next to replace the current
behaviour and focus only on compositing. So basically stop showing the objects
and show only view layers, their passes and collections, besides freestyle.
Also, while at this I'm also reorganizing the menu to keep View Layer and
Collections on top.
Developer notes:
* Unlike the per-object filtering, for collections we need to filter at tree
creation time, to prevent duplication of objects in the outliner.
Acknowledgements:
Thanks Pablo Vazquez for helping testing, thinking some design questions
together and pushing this to its final polished state as you see here.
Thanks Sergey Sharybin and Julian Eisel for code review. Julian couldn't do a
final review pass after I addressed his concerns. So blame is on me for any
issue I may be introducing here. Sergey was the author of the "preserve
scrolling position" idea. I'm happy with how it is working, thank you.
Reviewers: sergey, Severin, venomgfx
Subscribers: lichtwerk, duarteframos
Differential Revision: https://developer.blender.org/D2992
2018-01-19 11:39:54 -02:00
|
|
|
|
2020-08-27 09:41:05 -06:00
|
|
|
void outliner_item_openclose(struct SpaceOutliner *space_outliner,
|
|
|
|
|
TreeElement *te,
|
|
|
|
|
bool open,
|
|
|
|
|
bool toggle_all);
|
2019-08-08 22:00:57 -06:00
|
|
|
|
2018-08-07 10:23:07 +02:00
|
|
|
/* outliner_dragdrop.c */
|
|
|
|
|
void outliner_dropboxes(void);
|
|
|
|
|
|
|
|
|
|
void OUTLINER_OT_item_drag_drop(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_parent_drop(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_parent_clear(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_scene_drop(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_material_drop(struct wmOperatorType *ot);
|
2020-09-15 15:23:08 -06:00
|
|
|
void OUTLINER_OT_datastack_drop(struct wmOperatorType *ot);
|
2018-08-07 10:23:07 +02:00
|
|
|
void OUTLINER_OT_collection_drop(struct wmOperatorType *ot);
|
|
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* ...................................................... */
|
|
|
|
|
|
2016-10-15 00:40:33 +02:00
|
|
|
void OUTLINER_OT_highlight_update(struct wmOperatorType *ot);
|
|
|
|
|
|
2009-07-25 13:40:59 +00:00
|
|
|
void OUTLINER_OT_item_activate(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_item_openclose(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_item_rename(struct wmOperatorType *ot);
|
2016-06-22 18:05:55 +02:00
|
|
|
void OUTLINER_OT_lib_relocate(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_lib_reload(struct wmOperatorType *ot);
|
2009-07-14 12:23:08 +00:00
|
|
|
|
2016-06-22 18:05:55 +02:00
|
|
|
void OUTLINER_OT_id_delete(struct wmOperatorType *ot);
|
2015-12-01 15:33:44 +01:00
|
|
|
|
2009-07-14 11:56:24 +00:00
|
|
|
void OUTLINER_OT_show_one_level(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_show_active(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_show_hierarchy(struct wmOperatorType *ot);
|
2009-04-20 03:52:13 +00:00
|
|
|
|
2018-10-05 10:27:04 +10:00
|
|
|
void OUTLINER_OT_select_box(struct wmOperatorType *ot);
|
2019-08-08 22:00:57 -06:00
|
|
|
void OUTLINER_OT_select_walk(struct wmOperatorType *ot);
|
2012-01-18 21:12:51 +00:00
|
|
|
|
2018-07-06 14:45:30 +02:00
|
|
|
void OUTLINER_OT_select_all(struct wmOperatorType *ot);
|
2009-07-14 12:23:08 +00:00
|
|
|
void OUTLINER_OT_expanded_toggle(struct wmOperatorType *ot);
|
|
|
|
|
|
2011-01-08 18:37:11 +00:00
|
|
|
void OUTLINER_OT_scroll_page(struct wmOperatorType *ot);
|
|
|
|
|
|
2009-02-11 12:19:42 +00:00
|
|
|
void OUTLINER_OT_keyingset_add_selected(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_keyingset_remove_selected(struct wmOperatorType *ot);
|
2008-12-12 17:10:54 +00:00
|
|
|
|
2009-10-21 05:59:51 +00:00
|
|
|
void OUTLINER_OT_drivers_add_selected(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_drivers_delete_selected(struct wmOperatorType *ot);
|
2009-04-20 03:52:13 +00:00
|
|
|
|
2015-02-16 01:15:58 +13:00
|
|
|
void OUTLINER_OT_orphans_purge(struct wmOperatorType *ot);
|
|
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* outliner_tools.c ---------------------------------------------- */
|
|
|
|
|
|
2019-08-08 15:37:32 -06:00
|
|
|
void merged_element_search_menu_invoke(struct bContext *C,
|
|
|
|
|
TreeElement *parent_te,
|
|
|
|
|
TreeElement *activate_te);
|
|
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
void OUTLINER_OT_operation(struct wmOperatorType *ot);
|
2015-08-14 15:15:25 +02:00
|
|
|
void OUTLINER_OT_scene_operation(struct wmOperatorType *ot);
|
2011-07-11 10:59:53 +00:00
|
|
|
void OUTLINER_OT_object_operation(struct wmOperatorType *ot);
|
2015-12-01 15:33:44 +01:00
|
|
|
void OUTLINER_OT_lib_operation(struct wmOperatorType *ot);
|
2011-07-11 10:59:53 +00:00
|
|
|
void OUTLINER_OT_id_operation(struct wmOperatorType *ot);
|
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
|
|
|
void OUTLINER_OT_id_remap(struct wmOperatorType *ot);
|
2019-03-21 14:59:25 +01:00
|
|
|
void OUTLINER_OT_id_copy(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_id_paste(struct wmOperatorType *ot);
|
2011-07-11 10:59:53 +00:00
|
|
|
void OUTLINER_OT_data_operation(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_animdata_operation(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_action_set(struct wmOperatorType *ot);
|
2015-02-12 07:25:36 +11:00
|
|
|
void OUTLINER_OT_constraint_operation(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_modifier_operation(struct wmOperatorType *ot);
|
2020-04-30 19:51:14 +10:00
|
|
|
void OUTLINER_OT_delete(struct wmOperatorType *ot);
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* ---------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
/* outliner_ops.c */
|
|
|
|
|
void outliner_operatortypes(void);
|
|
|
|
|
void outliner_keymap(struct wmKeyConfig *keyconf);
|
|
|
|
|
|
2017-02-15 17:50:49 +01:00
|
|
|
/* outliner_collections.c */
|
|
|
|
|
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
bool outliner_is_collection_tree_element(const TreeElement *te);
|
|
|
|
|
struct Collection *outliner_collection_from_tree_element(const TreeElement *te);
|
2020-04-30 19:51:14 +10:00
|
|
|
void outliner_collection_delete(struct bContext *C,
|
|
|
|
|
struct Main *bmain,
|
|
|
|
|
struct Scene *scene,
|
|
|
|
|
struct ReportList *reports,
|
|
|
|
|
bool hierarchy);
|
2017-03-01 13:10:29 +01:00
|
|
|
|
2017-02-16 10:54:09 +01:00
|
|
|
void OUTLINER_OT_collection_new(struct wmOperatorType *ot);
|
2019-03-01 11:43:30 -03:00
|
|
|
void OUTLINER_OT_collection_duplicate_linked(struct wmOperatorType *ot);
|
2019-03-06 15:09:16 +01:00
|
|
|
void OUTLINER_OT_collection_duplicate(struct wmOperatorType *ot);
|
2020-04-30 19:51:14 +10:00
|
|
|
void OUTLINER_OT_collection_hierarchy_delete(struct wmOperatorType *ot);
|
2018-02-01 15:53:54 -02:00
|
|
|
void OUTLINER_OT_collection_objects_select(struct wmOperatorType *ot);
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
void OUTLINER_OT_collection_objects_deselect(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_collection_link(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_collection_instance(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_collection_exclude_set(struct wmOperatorType *ot);
|
2018-07-25 12:26:09 +02:00
|
|
|
void OUTLINER_OT_collection_exclude_clear(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_collection_holdout_set(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_collection_holdout_clear(struct wmOperatorType *ot);
|
2018-07-25 12:26:09 +02:00
|
|
|
void OUTLINER_OT_collection_indirect_only_set(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_collection_indirect_only_clear(struct wmOperatorType *ot);
|
2017-02-15 17:50:49 +01:00
|
|
|
|
2018-11-30 02:24:06 -02:00
|
|
|
void OUTLINER_OT_collection_isolate(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_collection_show(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_collection_hide(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_collection_show_inside(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_collection_hide_inside(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_collection_enable(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_collection_disable(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_collection_enable_render(struct wmOperatorType *ot);
|
|
|
|
|
void OUTLINER_OT_collection_disable_render(struct wmOperatorType *ot);
|
2019-02-08 19:38:45 -02:00
|
|
|
void OUTLINER_OT_hide(struct wmOperatorType *ot);
|
2019-02-08 19:52:28 -02:00
|
|
|
void OUTLINER_OT_unhide_all(struct wmOperatorType *ot);
|
2018-11-30 02:24:06 -02:00
|
|
|
|
2020-09-15 12:29:26 -06:00
|
|
|
void OUTLINER_OT_collection_color_tag_set(struct wmOperatorType *ot);
|
|
|
|
|
|
2017-02-28 21:35:29 +01:00
|
|
|
/* outliner_utils.c ---------------------------------------------- */
|
|
|
|
|
|
2019-11-02 03:11:56 +11:00
|
|
|
void outliner_viewcontext_init(const struct bContext *C, TreeViewContext *tvc);
|
|
|
|
|
|
2020-08-07 11:47:23 -06:00
|
|
|
TreeElement *outliner_find_item_at_y(const SpaceOutliner *space_outliner,
|
2019-02-16 09:47:19 +11:00
|
|
|
const ListBase *tree,
|
|
|
|
|
float view_co_y);
|
2020-08-07 11:47:23 -06:00
|
|
|
TreeElement *outliner_find_item_at_x_in_row(const SpaceOutliner *space_outliner,
|
2020-11-26 13:30:31 -07:00
|
|
|
TreeElement *parent_te,
|
2019-08-08 15:37:32 -06:00
|
|
|
float view_co_x,
|
2020-11-26 13:30:31 -07:00
|
|
|
bool *r_is_merged_icon,
|
|
|
|
|
bool *r_is_over_icon);
|
2020-08-07 11:47:23 -06:00
|
|
|
TreeElement *outliner_find_tse(struct SpaceOutliner *space_outliner, const TreeStoreElem *tse);
|
2017-02-28 21:35:29 +01:00
|
|
|
TreeElement *outliner_find_tree_element(ListBase *lb, const TreeStoreElem *store_elem);
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
TreeElement *outliner_find_parent_element(ListBase *lb,
|
|
|
|
|
TreeElement *parent_te,
|
|
|
|
|
const TreeElement *child_te);
|
2020-08-07 11:47:23 -06:00
|
|
|
TreeElement *outliner_find_id(struct SpaceOutliner *space_outliner,
|
|
|
|
|
ListBase *lb,
|
|
|
|
|
const struct ID *id);
|
2017-02-28 21:35:29 +01:00
|
|
|
TreeElement *outliner_find_posechannel(ListBase *lb, const struct bPoseChannel *pchan);
|
|
|
|
|
TreeElement *outliner_find_editbone(ListBase *lb, const struct EditBone *ebone);
|
2020-06-17 20:15:21 -06:00
|
|
|
TreeElement *outliner_search_back_te(TreeElement *te, short idcode);
|
2020-03-07 11:19:39 -07:00
|
|
|
struct ID *outliner_search_back(TreeElement *te, short idcode);
|
2020-08-07 11:47:23 -06:00
|
|
|
bool outliner_tree_traverse(const SpaceOutliner *space_outliner,
|
2019-02-16 09:47:19 +11:00
|
|
|
ListBase *tree,
|
|
|
|
|
int filter_te_flag,
|
|
|
|
|
int filter_tselem_flag,
|
2017-02-28 21:35:29 +01:00
|
|
|
TreeTraversalFunc func,
|
|
|
|
|
void *customdata);
|
2020-08-07 11:47:23 -06:00
|
|
|
float outliner_restrict_columns_width(const struct SpaceOutliner *space_outliner);
|
2019-08-08 22:00:57 -06:00
|
|
|
TreeElement *outliner_find_element_with_flag(const ListBase *lb, short flag);
|
|
|
|
|
bool outliner_is_element_visible(const TreeElement *te);
|
2020-11-12 15:17:07 +11:00
|
|
|
void outliner_scroll_view(struct SpaceOutliner *space_outliner,
|
|
|
|
|
struct ARegion *region,
|
|
|
|
|
int delta_y);
|
2020-08-20 20:17:00 +02:00
|
|
|
void outliner_tag_redraw_avoid_rebuild_on_open_change(const struct SpaceOutliner *space_outliner,
|
|
|
|
|
struct ARegion *region);
|
2017-02-15 17:50:49 +01:00
|
|
|
|
2019-08-07 22:27:07 -06:00
|
|
|
/* outliner_sync.c ---------------------------------------------- */
|
|
|
|
|
|
2020-08-07 11:47:23 -06:00
|
|
|
void outliner_sync_selection(const struct bContext *C, struct SpaceOutliner *space_outliner);
|
UI Code Quality: Start refactoring Outliner tree building (using C++)
This introduces a new C++ abstraction "tree-display" (in this commit named
tree-view, renamed in a followup) to help constructing and managing the tree
for the different display types (View Layer, Scene, Blender file, etc.).
See https://developer.blender.org/D9499 for more context. Other developers
approved this rather significantly different design approach there.
----
Motivation
General problems with current design:
* The Outliner tree building code is messy and hard to follow.
* Hard-coded display mode checks are scattered over many places.
* Data is passed around in rather unsafe ways (e.g. lots of `void *`).
* There are no individually testable units.
* Data-structure use is inefficient.
The current Outliner code needs quite some untangling, the tree building seems
like a good place to start. This and the followup commits tackle that.
----
Design Idea
Idea is to have an abstract base class (`AbstractTreeDisplay`), and then
sub-classes with the implementation for each display type (e.g.
`TreeDisplayViewLayer`, `TreeDisplayDataAPI`, etc). The tree-display is kept
alive until tree-rebuild as runtime data of the space, so that further queries
based on the display type can be executed (e.g. "does the display support
selection syncing?", "does it support restriction toggle columns?", etc.).
New files are in a new `space_outliner/tree` sub-directory.
With the new design, display modes become proper units, making them more
maintainable, safer and testable. It should also be easier now to add new
display modes.
2020-11-06 20:54:20 +01:00
|
|
|
|
2020-12-11 21:54:10 +01:00
|
|
|
/* outliner_context.c ------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
int outliner_context(const struct bContext *C,
|
|
|
|
|
const char *member,
|
|
|
|
|
struct bContextDataResult *result);
|
|
|
|
|
|
UI Code Quality: Start refactoring Outliner tree building (using C++)
This introduces a new C++ abstraction "tree-display" (in this commit named
tree-view, renamed in a followup) to help constructing and managing the tree
for the different display types (View Layer, Scene, Blender file, etc.).
See https://developer.blender.org/D9499 for more context. Other developers
approved this rather significantly different design approach there.
----
Motivation
General problems with current design:
* The Outliner tree building code is messy and hard to follow.
* Hard-coded display mode checks are scattered over many places.
* Data is passed around in rather unsafe ways (e.g. lots of `void *`).
* There are no individually testable units.
* Data-structure use is inefficient.
The current Outliner code needs quite some untangling, the tree building seems
like a good place to start. This and the followup commits tackle that.
----
Design Idea
Idea is to have an abstract base class (`AbstractTreeDisplay`), and then
sub-classes with the implementation for each display type (e.g.
`TreeDisplayViewLayer`, `TreeDisplayDataAPI`, etc). The tree-display is kept
alive until tree-rebuild as runtime data of the space, so that further queries
based on the display type can be executed (e.g. "does the display support
selection syncing?", "does it support restriction toggle columns?", etc.).
New files are in a new `space_outliner/tree` sub-directory.
With the new design, display modes become proper units, making them more
maintainable, safer and testable. It should also be easier now to add new
display modes.
2020-11-06 20:54:20 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|