2011-07-11 10:59:53 +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.
|
2011-07-11 10:59:53 +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,
|
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2004 Blender Foundation.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup spoutliner
|
2011-07-11 10:59:53 +00:00
|
|
|
*/
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
#include <math.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
|
|
#include "DNA_anim_types.h"
|
|
|
|
|
#include "DNA_armature_types.h"
|
|
|
|
|
#include "DNA_constraint_types.h"
|
|
|
|
|
#include "DNA_camera_types.h"
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
#include "DNA_cachefile_types.h"
|
2018-08-29 15:32:50 +02:00
|
|
|
#include "DNA_collection_types.h"
|
2015-02-07 12:28:17 +13:00
|
|
|
#include "DNA_gpencil_types.h"
|
2011-07-11 10:59:53 +00:00
|
|
|
#include "DNA_key_types.h"
|
2019-02-27 12:34:56 +11:00
|
|
|
#include "DNA_light_types.h"
|
2011-07-11 10:59:53 +00:00
|
|
|
#include "DNA_material_types.h"
|
|
|
|
|
#include "DNA_mesh_types.h"
|
|
|
|
|
#include "DNA_meta_types.h"
|
2017-06-12 20:59:54 +10:00
|
|
|
#include "DNA_lightprobe_types.h"
|
2016-12-28 17:30:58 +01:00
|
|
|
#include "DNA_particle_types.h"
|
2011-07-11 10:59:53 +00:00
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
|
#include "DNA_world_types.h"
|
|
|
|
|
#include "DNA_sequence_types.h"
|
2011-08-01 11:44:20 +00:00
|
|
|
#include "DNA_speaker_types.h"
|
2011-07-11 10:59:53 +00:00
|
|
|
#include "DNA_object_types.h"
|
2013-09-04 01:15:23 +00:00
|
|
|
#include "DNA_linestyle_types.h"
|
2011-07-11 10:59:53 +00:00
|
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
|
#include "BLI_utildefines.h"
|
2013-08-03 11:35:09 +00:00
|
|
|
#include "BLI_mempool.h"
|
2013-08-27 18:29:30 +00:00
|
|
|
#include "BLI_fnmatch.h"
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2015-08-16 17:32:01 +10:00
|
|
|
#include "BLT_translation.h"
|
2013-03-11 15:01:03 +00:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
#include "BKE_fcurve.h"
|
2018-11-07 18:00:24 +01:00
|
|
|
#include "BKE_idcode.h"
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
#include "BKE_layer.h"
|
2012-12-22 13:39:44 +00:00
|
|
|
#include "BKE_library.h"
|
2018-11-07 18:00:24 +01:00
|
|
|
#include "BKE_main.h"
|
2011-07-11 10:59:53 +00:00
|
|
|
#include "BKE_modifier.h"
|
2015-04-07 11:01:47 +10:00
|
|
|
#include "BKE_outliner_treehash.h"
|
2018-11-07 18:00:24 +01:00
|
|
|
#include "BKE_sequencer.h"
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2018-01-15 19:06:30 -02:00
|
|
|
#include "DEG_depsgraph.h"
|
2017-06-08 10:14:53 +02:00
|
|
|
#include "DEG_depsgraph_build.h"
|
|
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
#include "ED_armature.h"
|
|
|
|
|
#include "ED_screen.h"
|
|
|
|
|
|
|
|
|
|
#include "WM_api.h"
|
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
|
|
|
|
#include "RNA_access.h"
|
|
|
|
|
|
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
|
|
|
#include "UI_interface.h"
|
|
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
#include "outliner_intern.h"
|
|
|
|
|
|
2014-05-01 07:21:08 +10:00
|
|
|
#ifdef WIN32
|
|
|
|
|
# include "BLI_math_base.h" /* M_PI */
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-02-15 19:08:23 +01:00
|
|
|
/* prototypes */
|
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
|
|
|
static TreeElement *outliner_add_collection_recursive(
|
2019-02-16 09:47:19 +11:00
|
|
|
SpaceOutliner *soops, Collection *collection, TreeElement *ten);
|
2018-04-23 20:39:05 +02:00
|
|
|
static void outliner_make_object_parent_hierarchy(ListBase *lb);
|
2017-02-15 19:08:23 +01:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* ********************************************************* */
|
2011-11-03 03:00:45 +00:00
|
|
|
/* Persistent Data */
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2019-02-16 09:47:19 +11:00
|
|
|
static void outliner_storage_cleanup(SpaceOutliner *soops)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
2013-08-03 11:35:09 +00:00
|
|
|
BLI_mempool *ts = soops->treestore;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ts) {
|
2011-07-11 10:59:53 +00:00
|
|
|
TreeStoreElem *tselem;
|
2013-08-03 11:35:09 +00:00
|
|
|
int unused = 0;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* each element used once, for ID blocks with more users to have each a treestore */
|
2013-08-03 11:35:09 +00:00
|
|
|
BLI_mempool_iter iter;
|
|
|
|
|
|
|
|
|
|
BLI_mempool_iternew(ts, &iter);
|
|
|
|
|
while ((tselem = BLI_mempool_iterstep(&iter))) {
|
|
|
|
|
tselem->used = 0;
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* cleanup only after reading file or undo step, and always for
|
|
|
|
|
* RNA datablocks view in order to save memory */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (soops->storeflag & SO_TREESTORE_CLEANUP) {
|
2015-05-11 10:58:53 +10:00
|
|
|
soops->storeflag &= ~SO_TREESTORE_CLEANUP;
|
|
|
|
|
|
2013-08-03 11:35:09 +00:00
|
|
|
BLI_mempool_iternew(ts, &iter);
|
|
|
|
|
while ((tselem = BLI_mempool_iterstep(&iter))) {
|
2019-03-26 21:16:47 +11:00
|
|
|
if (tselem->id == NULL) {
|
|
|
|
|
unused++;
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (unused) {
|
2018-02-15 23:36:11 +11:00
|
|
|
if (BLI_mempool_len(ts) == unused) {
|
2013-08-03 11:35:09 +00:00
|
|
|
BLI_mempool_destroy(ts);
|
|
|
|
|
soops->treestore = NULL;
|
|
|
|
|
if (soops->treehash) {
|
2015-04-07 11:01:47 +10:00
|
|
|
BKE_outliner_treehash_free(soops->treehash);
|
2013-08-03 11:35:09 +00:00
|
|
|
soops->treehash = NULL;
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2013-08-03 11:35:09 +00:00
|
|
|
TreeStoreElem *tsenew;
|
2018-02-15 23:36:11 +11:00
|
|
|
BLI_mempool *new_ts = BLI_mempool_create(sizeof(TreeStoreElem), BLI_mempool_len(ts) - unused,
|
2013-08-03 11:35:09 +00:00
|
|
|
512, BLI_MEMPOOL_ALLOW_ITER);
|
|
|
|
|
BLI_mempool_iternew(ts, &iter);
|
|
|
|
|
while ((tselem = BLI_mempool_iterstep(&iter))) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (tselem->id) {
|
2013-08-03 11:35:09 +00:00
|
|
|
tsenew = BLI_mempool_alloc(new_ts);
|
|
|
|
|
*tsenew = *tselem;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
BLI_mempool_destroy(ts);
|
|
|
|
|
soops->treestore = new_ts;
|
|
|
|
|
if (soops->treehash) {
|
|
|
|
|
/* update hash table to fix broken pointers */
|
2015-04-07 11:01:47 +10:00
|
|
|
BKE_outliner_treehash_rebuild_from_treestore(soops->treehash, soops->treestore);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-05-28 17:07:52 +02:00
|
|
|
else if (soops->treehash) {
|
|
|
|
|
BKE_outliner_treehash_clear_used(soops->treehash);
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 09:47:19 +11:00
|
|
|
static void check_persistent(SpaceOutliner *soops, TreeElement *te, ID *id, short type, short nr)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
2013-08-17 11:49:18 +00:00
|
|
|
TreeStoreElem *tselem;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
if (soops->treestore == NULL) {
|
2013-08-03 11:35:09 +00:00
|
|
|
/* if treestore was not created in readfile.c, create it here */
|
|
|
|
|
soops->treestore = BLI_mempool_create(sizeof(TreeStoreElem), 1, 512, BLI_MEMPOOL_ALLOW_ITER);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2013-08-23 20:35:00 +00:00
|
|
|
if (soops->treehash == NULL) {
|
2015-04-07 11:01:47 +10:00
|
|
|
soops->treehash = BKE_outliner_treehash_create_from_treestore(soops->treestore);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2013-08-03 11:35:09 +00:00
|
|
|
|
2013-08-18 20:07:49 +00:00
|
|
|
/* find any unused tree element in treestore and mark it as used
|
|
|
|
|
* (note that there may be multiple unused elements in case of linked objects) */
|
2015-04-07 11:01:47 +10:00
|
|
|
tselem = BKE_outliner_treehash_lookup_unused(soops->treehash, type, nr, id);
|
2013-08-17 11:49:18 +00:00
|
|
|
if (tselem) {
|
2013-08-03 11:35:09 +00:00
|
|
|
te->store_elem = tselem;
|
|
|
|
|
tselem->used = 1;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* add 1 element to treestore */
|
|
|
|
|
tselem = BLI_mempool_alloc(soops->treestore);
|
2012-05-07 17:56:30 +00:00
|
|
|
tselem->type = type;
|
2013-08-03 11:35:09 +00:00
|
|
|
tselem->nr = type ? nr : 0;
|
2012-05-07 17:56:30 +00:00
|
|
|
tselem->id = id;
|
2011-07-11 10:59:53 +00:00
|
|
|
tselem->used = 0;
|
2012-05-07 17:56:30 +00:00
|
|
|
tselem->flag = TSE_CLOSED;
|
2013-08-03 11:35:09 +00:00
|
|
|
te->store_elem = tselem;
|
2015-04-07 11:01:47 +10:00
|
|
|
BKE_outliner_treehash_add_element(soops->treehash, tselem);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ********************************************************* */
|
|
|
|
|
/* Tree Management */
|
|
|
|
|
|
2018-01-10 22:45:44 +01:00
|
|
|
void outliner_free_tree(ListBase *tree)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
2018-01-10 22:45:44 +01:00
|
|
|
for (TreeElement *element = tree->first, *element_next; element; element = element_next) {
|
|
|
|
|
element_next = element->next;
|
|
|
|
|
outliner_free_tree_element(element, tree);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 09:47:19 +11:00
|
|
|
void outliner_cleanup_tree(SpaceOutliner *soops)
|
2011-09-02 13:23:44 +00:00
|
|
|
{
|
|
|
|
|
outliner_free_tree(&soops->tree);
|
|
|
|
|
outliner_storage_cleanup(soops);
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-10 22:45:44 +01:00
|
|
|
/**
|
|
|
|
|
* Free \a element and its sub-tree and remove its link in \a parent_subtree.
|
|
|
|
|
*
|
2019-03-08 17:48:49 +11:00
|
|
|
* \note Does not remove the #TreeStoreElem of \a element!
|
|
|
|
|
* \param parent_subtree: Sub-tree of the parent element, so the list containing \a element.
|
2018-01-10 22:45:44 +01:00
|
|
|
*/
|
|
|
|
|
void outliner_free_tree_element(TreeElement *element, ListBase *parent_subtree)
|
|
|
|
|
{
|
|
|
|
|
BLI_assert(BLI_findindex(parent_subtree, element) > -1);
|
|
|
|
|
BLI_remlink(parent_subtree, element);
|
|
|
|
|
|
|
|
|
|
outliner_free_tree(&element->subtree);
|
|
|
|
|
|
|
|
|
|
if (element->flag & TE_FREE_NAME) {
|
|
|
|
|
MEM_freeN((void *)element->name);
|
|
|
|
|
}
|
|
|
|
|
MEM_freeN(element);
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
|
|
|
|
|
/* ********************************************************* */
|
|
|
|
|
|
|
|
|
|
/* Prototype, see functions below */
|
2019-02-16 09:47:19 +11:00
|
|
|
static TreeElement *outliner_add_element(SpaceOutliner *soops, ListBase *lb, void *idv,
|
2018-04-05 18:20:27 +02:00
|
|
|
TreeElement *parent, short type, short index);
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2011-07-11 13:36:38 +00:00
|
|
|
/* -------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
/* special handling of hierarchical non-lib data */
|
2019-02-16 09:47:19 +11:00
|
|
|
static void outliner_add_bone(SpaceOutliner *soops, ListBase *lb, ID *id, Bone *curBone,
|
2018-04-05 18:20:27 +02:00
|
|
|
TreeElement *parent, int *a)
|
2011-07-11 13:36:38 +00:00
|
|
|
{
|
2018-04-05 18:20:27 +02:00
|
|
|
TreeElement *te = outliner_add_element(soops, lb, id, parent, TSE_BONE, *a);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 13:36:38 +00:00
|
|
|
(*a)++;
|
2012-05-07 17:56:30 +00:00
|
|
|
te->name = curBone->name;
|
|
|
|
|
te->directdata = curBone;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
for (curBone = curBone->childbase.first; curBone; curBone = curBone->next) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_bone(soops, &te->subtree, id, curBone, te, a);
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-28 15:37:18 +00:00
|
|
|
static bool outliner_animdata_test(AnimData *adt)
|
2013-04-28 09:16:10 +00:00
|
|
|
{
|
2019-03-26 21:16:47 +11:00
|
|
|
if (adt) {
|
2013-04-28 09:16:10 +00:00
|
|
|
return (adt->action || adt->drivers.first || adt->nla_tracks.first);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2013-04-28 15:37:18 +00:00
|
|
|
return false;
|
2013-04-28 09:16:10 +00:00
|
|
|
}
|
|
|
|
|
|
2014-05-08 10:00:49 +09:00
|
|
|
#ifdef WITH_FREESTYLE
|
2019-02-16 09:47:19 +11:00
|
|
|
static void outliner_add_line_styles(SpaceOutliner *soops, ListBase *lb, Scene *sce, TreeElement *te)
|
2013-09-04 01:15:23 +00:00
|
|
|
{
|
2017-11-22 10:52:39 -02:00
|
|
|
ViewLayer *view_layer;
|
2013-09-04 01:15:23 +00:00
|
|
|
FreestyleLineSet *lineset;
|
|
|
|
|
|
2017-11-22 10:52:39 -02:00
|
|
|
for (view_layer = sce->view_layers.first; view_layer; view_layer = view_layer->next) {
|
|
|
|
|
for (lineset = view_layer->freestyle_config.linesets.first; lineset; lineset = lineset->next) {
|
2013-09-30 08:43:22 +00:00
|
|
|
FreestyleLineStyle *linestyle = lineset->linestyle;
|
|
|
|
|
if (linestyle) {
|
Split id->flag in two, persistent flags and runtime tags.
This is purely internal sanitizing/cleanup, no change in behavior is expected at all.
This change was also needed because we were getting short on ID flags, and
future enhancement of 'user_one' ID behavior requires two new ones.
id->flag remains for persistent data (fakeuser only, so far!), this also allows us
100% backward & forward compatibility.
New id->tag is used for most flags. Though written in .blend files, its content
is cleared at read time.
Note that .blend file version was bumped, so that we can clear runtimeflags from
old .blends, important in case we add new persistent flags in future.
Also, behavior of tags (either status ones, or whether they need to be cleared before/after use)
has been added as comments to their declaration.
Reviewers: sergey, campbellbarton
Differential Revision: https://developer.blender.org/D1683
2015-12-27 11:53:50 +01:00
|
|
|
linestyle->id.tag |= LIB_TAG_DOIT;
|
2013-09-30 08:43:22 +00:00
|
|
|
}
|
2013-09-04 01:15:23 +00:00
|
|
|
}
|
|
|
|
|
}
|
2017-11-22 10:52:39 -02:00
|
|
|
for (view_layer = sce->view_layers.first; view_layer; view_layer = view_layer->next) {
|
|
|
|
|
for (lineset = view_layer->freestyle_config.linesets.first; lineset; lineset = lineset->next) {
|
2013-09-04 01:15:23 +00:00
|
|
|
FreestyleLineStyle *linestyle = lineset->linestyle;
|
2013-09-30 08:43:22 +00:00
|
|
|
if (linestyle) {
|
2019-03-26 21:16:47 +11:00
|
|
|
if (!(linestyle->id.tag & LIB_TAG_DOIT)) {
|
2013-09-30 08:43:22 +00:00
|
|
|
continue;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
Split id->flag in two, persistent flags and runtime tags.
This is purely internal sanitizing/cleanup, no change in behavior is expected at all.
This change was also needed because we were getting short on ID flags, and
future enhancement of 'user_one' ID behavior requires two new ones.
id->flag remains for persistent data (fakeuser only, so far!), this also allows us
100% backward & forward compatibility.
New id->tag is used for most flags. Though written in .blend files, its content
is cleared at read time.
Note that .blend file version was bumped, so that we can clear runtimeflags from
old .blends, important in case we add new persistent flags in future.
Also, behavior of tags (either status ones, or whether they need to be cleared before/after use)
has been added as comments to their declaration.
Reviewers: sergey, campbellbarton
Differential Revision: https://developer.blender.org/D1683
2015-12-27 11:53:50 +01:00
|
|
|
linestyle->id.tag &= ~LIB_TAG_DOIT;
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, lb, linestyle, te, 0, 0);
|
2013-09-30 08:43:22 +00:00
|
|
|
}
|
2013-09-04 01:15:23 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-05-08 10:00:49 +09:00
|
|
|
#endif
|
2013-09-04 01:15:23 +00:00
|
|
|
|
2019-02-16 09:47:19 +11:00
|
|
|
static void outliner_add_scene_contents(SpaceOutliner *soops, ListBase *lb, Scene *sce, TreeElement *te)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
2018-04-23 20:39:05 +02:00
|
|
|
/* View layers */
|
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 *ten = outliner_add_element(soops, lb, sce, te, TSE_R_LAYER_BASE, 0);
|
|
|
|
|
ten->name = IFACE_("View Layers");
|
2018-04-23 20:39:05 +02:00
|
|
|
|
|
|
|
|
ViewLayer *view_layer;
|
2018-04-24 15:20:17 +02:00
|
|
|
for (view_layer = sce->view_layers.first; view_layer; view_layer = view_layer->next) {
|
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 *tenlay = outliner_add_element(soops, &ten->subtree, sce, te, TSE_R_LAYER, 0);
|
2017-11-22 10:52:39 -02:00
|
|
|
tenlay->name = view_layer->name;
|
2018-04-24 15:20:17 +02:00
|
|
|
tenlay->directdata = view_layer;
|
2018-04-23 20:39:05 +02:00
|
|
|
}
|
2018-01-18 18:30:30 -02:00
|
|
|
|
2018-04-23 20:39:05 +02:00
|
|
|
/* Collections */
|
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
|
|
|
ten = outliner_add_element(soops, lb, &sce->id, te, TSE_SCENE_COLLECTION_BASE, 0);
|
|
|
|
|
ten->name = IFACE_("Scene Collection");
|
|
|
|
|
outliner_add_collection_recursive(soops, sce->master_collection, ten);
|
2018-01-18 18:30:30 -02:00
|
|
|
|
2018-04-23 20:39:05 +02:00
|
|
|
/* Objects */
|
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
|
|
|
ten = outliner_add_element(soops, lb, sce, te, TSE_SCENE_OBJECTS_BASE, 0);
|
|
|
|
|
ten->name = IFACE_("Objects");
|
2018-04-23 20:39:05 +02:00
|
|
|
FOREACH_SCENE_OBJECT_BEGIN(sce, ob)
|
|
|
|
|
{
|
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
|
|
|
outliner_add_element(soops, &ten->subtree, ob, NULL, 0, 0);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2018-04-23 20:39:05 +02:00
|
|
|
FOREACH_SCENE_OBJECT_END;
|
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
|
|
|
outliner_make_object_parent_hierarchy(&ten->subtree);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-04-23 20:39:05 +02:00
|
|
|
/* Animation Data */
|
2019-03-26 21:16:47 +11:00
|
|
|
if (outliner_animdata_test(sce->adt)) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, lb, sce, te, TSE_ANIM_DATA, 0);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
|
2011-07-11 13:36:38 +00:00
|
|
|
// can be inlined if necessary
|
2019-02-16 09:47:19 +11:00
|
|
|
static void outliner_add_object_contents(SpaceOutliner *soops, TreeElement *te, TreeStoreElem *tselem, Object *ob)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
2019-03-26 21:16:47 +11:00
|
|
|
if (outliner_animdata_test(ob->adt)) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, ob, te, TSE_ANIM_DATA, 0);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2017-03-10 20:47:48 +01:00
|
|
|
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, ob->poselib, te, 0, 0); // XXX FIXME.. add a special type for this
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (ob->proxy && !ID_IS_LINKED(ob)) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, ob->proxy, te, TSE_PROXY, 0);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, ob->gpd, te, 0, 0);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, ob->data, te, 0, 0);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 13:36:38 +00:00
|
|
|
if (ob->pose) {
|
2012-05-07 17:56:30 +00:00
|
|
|
bArmature *arm = ob->data;
|
2011-07-11 13:36:38 +00:00
|
|
|
bPoseChannel *pchan;
|
2018-04-05 18:20:27 +02:00
|
|
|
TreeElement *tenla = outliner_add_element(soops, &te->subtree, ob, te, TSE_POSE_BASE, 0);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2013-03-11 15:01:03 +00:00
|
|
|
tenla->name = IFACE_("Pose");
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 13:36:38 +00:00
|
|
|
/* channels undefined in editmode, but we want the 'tenla' pose icon itself */
|
2018-04-05 18:20:27 +02:00
|
|
|
if ((arm->edbo == NULL) && (ob->mode & OB_MODE_POSE)) {
|
2015-11-23 15:44:15 +11:00
|
|
|
TreeElement *ten;
|
2012-05-07 17:56:30 +00:00
|
|
|
int a = 0, const_index = 1000; /* ensure unique id for bone constraints */
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next, a++) {
|
2018-04-05 18:20:27 +02:00
|
|
|
ten = outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_POSE_CHANNEL, a);
|
2012-05-07 17:56:30 +00:00
|
|
|
ten->name = pchan->name;
|
|
|
|
|
ten->directdata = pchan;
|
|
|
|
|
pchan->temp = (void *)ten;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (pchan->constraints.first) {
|
2011-07-11 10:59:53 +00:00
|
|
|
//Object *target;
|
|
|
|
|
bConstraint *con;
|
2011-07-11 13:36:38 +00:00
|
|
|
TreeElement *ten1;
|
2018-04-05 18:20:27 +02:00
|
|
|
TreeElement *tenla1 = outliner_add_element(soops, &ten->subtree, ob, ten, TSE_CONSTRAINT_BASE, 0);
|
2011-07-11 10:59:53 +00:00
|
|
|
//char *str;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2013-03-11 15:01:03 +00:00
|
|
|
tenla1->name = IFACE_("Constraints");
|
2012-05-07 17:56:30 +00:00
|
|
|
for (con = pchan->constraints.first; con; con = con->next, const_index++) {
|
2018-04-05 18:20:27 +02:00
|
|
|
ten1 = outliner_add_element(soops, &tenla1->subtree, ob, tenla1, TSE_CONSTRAINT, const_index);
|
2011-07-11 13:36:38 +00:00
|
|
|
#if 0 /* disabled as it needs to be reworked for recoded constraints system */
|
2012-05-07 17:56:30 +00:00
|
|
|
target = get_constraint_target(con, &str);
|
|
|
|
|
if (str && str[0]) ten1->name = str;
|
|
|
|
|
else if (target) ten1->name = target->id.name + 2;
|
|
|
|
|
else ten1->name = con->name;
|
2011-07-11 10:59:53 +00:00
|
|
|
#endif
|
2012-05-07 17:56:30 +00:00
|
|
|
ten1->name = con->name;
|
|
|
|
|
ten1->directdata = con;
|
2011-07-11 10:59:53 +00:00
|
|
|
/* possible add all other types links? */
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
|
|
|
|
/* make hierarchy */
|
2012-05-07 17:56:30 +00:00
|
|
|
ten = tenla->subtree.first;
|
2012-03-24 06:38:07 +00:00
|
|
|
while (ten) {
|
2012-05-07 17:56:30 +00:00
|
|
|
TreeElement *nten = ten->next, *par;
|
|
|
|
|
tselem = TREESTORE(ten);
|
|
|
|
|
if (tselem->type == TSE_POSE_CHANNEL) {
|
|
|
|
|
pchan = (bPoseChannel *)ten->directdata;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (pchan->parent) {
|
2011-07-11 13:36:38 +00:00
|
|
|
BLI_remlink(&tenla->subtree, ten);
|
2012-05-07 17:56:30 +00:00
|
|
|
par = (TreeElement *)pchan->parent->temp;
|
2011-07-11 13:36:38 +00:00
|
|
|
BLI_addtail(&par->subtree, ten);
|
2012-05-07 17:56:30 +00:00
|
|
|
ten->parent = par;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
ten = nten;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 13:36:38 +00:00
|
|
|
/* Pose Groups */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ob->pose->agroups.first) {
|
2011-07-11 13:36:38 +00:00
|
|
|
bActionGroup *agrp;
|
2018-04-05 18:20:27 +02:00
|
|
|
TreeElement *ten_bonegrp = outliner_add_element(soops, &te->subtree, ob, te, TSE_POSEGRP_BASE, 0);
|
2012-05-07 17:56:30 +00:00
|
|
|
int a = 0;
|
2015-11-23 15:44:15 +11:00
|
|
|
|
|
|
|
|
ten_bonegrp->name = IFACE_("Bone Groups");
|
2012-05-07 17:56:30 +00:00
|
|
|
for (agrp = ob->pose->agroups.first; agrp; agrp = agrp->next, a++) {
|
2015-11-23 15:44:15 +11:00
|
|
|
TreeElement *ten;
|
2018-04-05 18:20:27 +02:00
|
|
|
ten = outliner_add_element(soops, &ten_bonegrp->subtree, ob, ten_bonegrp, TSE_POSEGRP, a);
|
2012-05-07 17:56:30 +00:00
|
|
|
ten->name = agrp->name;
|
|
|
|
|
ten->directdata = agrp;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2015-11-23 15:44:15 +11:00
|
|
|
for (int a = 0; a < ob->totcol; a++) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, ob->mat[a], te, 0, a);
|
2015-11-23 15:44:15 +11:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ob->constraints.first) {
|
2011-07-11 13:36:38 +00:00
|
|
|
//Object *target;
|
|
|
|
|
bConstraint *con;
|
|
|
|
|
TreeElement *ten;
|
2018-04-05 18:20:27 +02:00
|
|
|
TreeElement *tenla = outliner_add_element(soops, &te->subtree, ob, te, TSE_CONSTRAINT_BASE, 0);
|
2011-07-11 13:36:38 +00:00
|
|
|
//char *str;
|
2015-11-23 15:44:15 +11:00
|
|
|
int a;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2013-03-11 15:01:03 +00:00
|
|
|
tenla->name = IFACE_("Constraints");
|
2012-05-07 17:56:30 +00:00
|
|
|
for (con = ob->constraints.first, a = 0; con; con = con->next, a++) {
|
2018-04-05 18:20:27 +02:00
|
|
|
ten = outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_CONSTRAINT, a);
|
2011-07-11 13:36:38 +00:00
|
|
|
#if 0 /* disabled due to constraints system targets recode... code here needs review */
|
2012-05-07 17:56:30 +00:00
|
|
|
target = get_constraint_target(con, &str);
|
|
|
|
|
if (str && str[0]) ten->name = str;
|
|
|
|
|
else if (target) ten->name = target->id.name + 2;
|
|
|
|
|
else ten->name = con->name;
|
2011-07-11 13:36:38 +00:00
|
|
|
#endif
|
2012-05-07 17:56:30 +00:00
|
|
|
ten->name = con->name;
|
|
|
|
|
ten->directdata = con;
|
2011-07-11 13:36:38 +00:00
|
|
|
/* possible add all other types links? */
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 13:36:38 +00:00
|
|
|
if (ob->modifiers.first) {
|
|
|
|
|
ModifierData *md;
|
2018-04-05 18:20:27 +02:00
|
|
|
TreeElement *ten_mod = outliner_add_element(soops, &te->subtree, ob, te, TSE_MODIFIER_BASE, 0);
|
2011-07-11 13:36:38 +00:00
|
|
|
int index;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2015-11-23 15:44:15 +11:00
|
|
|
ten_mod->name = IFACE_("Modifiers");
|
2012-05-07 17:56:30 +00:00
|
|
|
for (index = 0, md = ob->modifiers.first; md; index++, md = md->next) {
|
2018-04-05 18:20:27 +02:00
|
|
|
TreeElement *ten = outliner_add_element(soops, &ten_mod->subtree, ob, ten_mod, TSE_MODIFIER, index);
|
2015-11-23 15:44:15 +11:00
|
|
|
ten->name = md->name;
|
|
|
|
|
ten->directdata = md;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
if (md->type == eModifierType_Lattice) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &ten->subtree, ((LatticeModifierData *) md)->object, ten, TSE_LINKED_OB, 0);
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
else if (md->type == eModifierType_Curve) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &ten->subtree, ((CurveModifierData *) md)->object, ten, TSE_LINKED_OB, 0);
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
else if (md->type == eModifierType_Armature) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &ten->subtree, ((ArmatureModifierData *) md)->object, ten, TSE_LINKED_OB, 0);
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
else if (md->type == eModifierType_Hook) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &ten->subtree, ((HookModifierData *) md)->object, ten, TSE_LINKED_OB, 0);
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2016-12-28 17:30:58 +01:00
|
|
|
else if (md->type == eModifierType_ParticleSystem) {
|
|
|
|
|
ParticleSystem *psys = ((ParticleSystemModifierData *) md)->psys;
|
|
|
|
|
TreeElement *ten_psys;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-04-05 18:20:27 +02:00
|
|
|
ten_psys = outliner_add_element(soops, &ten->subtree, ob, te, TSE_LINKED_PSYS, 0);
|
2016-12-28 17:30:58 +01:00
|
|
|
ten_psys->directdata = psys;
|
|
|
|
|
ten_psys->name = psys->part->id.name + 2;
|
|
|
|
|
}
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 13:36:38 +00:00
|
|
|
/* vertex groups */
|
|
|
|
|
if (ob->defbase.first) {
|
|
|
|
|
bDeformGroup *defgroup;
|
|
|
|
|
TreeElement *ten;
|
2018-04-05 18:20:27 +02:00
|
|
|
TreeElement *tenla = outliner_add_element(soops, &te->subtree, ob, te, TSE_DEFGROUP_BASE, 0);
|
2015-11-23 15:44:15 +11:00
|
|
|
int a;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2013-03-11 15:01:03 +00:00
|
|
|
tenla->name = IFACE_("Vertex Groups");
|
2012-05-07 17:56:30 +00:00
|
|
|
for (defgroup = ob->defbase.first, a = 0; defgroup; defgroup = defgroup->next, a++) {
|
2018-04-05 18:20:27 +02:00
|
|
|
ten = outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_DEFGROUP, a);
|
2012-05-07 17:56:30 +00:00
|
|
|
ten->name = defgroup->name;
|
|
|
|
|
ten->directdata = defgroup;
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 13:36:38 +00:00
|
|
|
/* duplicated group */
|
2019-03-26 21:16:47 +11:00
|
|
|
if (ob->instance_collection) {
|
2019-02-17 19:00:54 +11:00
|
|
|
outliner_add_element(soops, &te->subtree, ob->instance_collection, te, 0, 0);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-22 16:49:50 +00:00
|
|
|
|
2011-07-11 13:36:38 +00:00
|
|
|
// can be inlined if necessary
|
2019-02-16 09:47:19 +11:00
|
|
|
static void outliner_add_id_contents(SpaceOutliner *soops, TreeElement *te, TreeStoreElem *tselem, ID *id)
|
2011-07-11 13:36:38 +00:00
|
|
|
{
|
|
|
|
|
/* tuck pointer back in object, to construct hierarchy */
|
2019-03-26 21:16:47 +11:00
|
|
|
if (GS(id->name) == ID_OB) {
|
|
|
|
|
id->newid = (ID *)te;
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 13:36:38 +00:00
|
|
|
/* expand specific data always */
|
|
|
|
|
switch (GS(id->name)) {
|
|
|
|
|
case ID_LI:
|
|
|
|
|
{
|
2012-05-07 17:56:30 +00:00
|
|
|
te->name = ((Library *)id)->name;
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
|
|
|
|
case ID_SCE:
|
|
|
|
|
{
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_scene_contents(soops, &te->subtree, (Scene *)id, te);
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
|
|
|
|
case ID_OB:
|
|
|
|
|
{
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_object_contents(soops, te, tselem, (Object *)id);
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
|
|
|
|
case ID_ME:
|
|
|
|
|
{
|
2012-05-07 17:56:30 +00:00
|
|
|
Mesh *me = (Mesh *)id;
|
2011-07-11 13:36:38 +00:00
|
|
|
int a;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (outliner_animdata_test(me->adt)) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, me, te, TSE_ANIM_DATA, 0);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, me->key, te, 0, 0);
|
2019-03-26 21:16:47 +11:00
|
|
|
for (a = 0; a < me->totcol; a++) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, me->mat[a], te, 0, a);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2011-07-11 13:36:38 +00:00
|
|
|
/* could do tfaces with image links, but the images are not grouped nicely.
|
2012-03-03 16:31:46 +00:00
|
|
|
* would require going over all tfaces, sort images in use. etc... */
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
|
|
|
|
case ID_CU:
|
|
|
|
|
{
|
2012-05-07 17:56:30 +00:00
|
|
|
Curve *cu = (Curve *)id;
|
2011-07-11 13:36:38 +00:00
|
|
|
int a;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (outliner_animdata_test(cu->adt)) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, cu, te, TSE_ANIM_DATA, 0);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
for (a = 0; a < cu->totcol; a++) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, cu->mat[a], te, 0, a);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
|
|
|
|
case ID_MB:
|
|
|
|
|
{
|
2012-05-07 17:56:30 +00:00
|
|
|
MetaBall *mb = (MetaBall *)id;
|
2011-07-11 13:36:38 +00:00
|
|
|
int a;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (outliner_animdata_test(mb->adt)) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, mb, te, TSE_ANIM_DATA, 0);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
for (a = 0; a < mb->totcol; a++) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, mb->mat[a], te, 0, a);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
|
|
|
|
case ID_MA:
|
|
|
|
|
{
|
2012-05-07 17:56:30 +00:00
|
|
|
Material *ma = (Material *)id;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (outliner_animdata_test(ma->adt)) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, ma, te, TSE_ANIM_DATA, 0);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
|
|
|
|
case ID_TE:
|
|
|
|
|
{
|
2012-05-07 17:56:30 +00:00
|
|
|
Tex *tex = (Tex *)id;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (outliner_animdata_test(tex->adt)) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, tex, te, TSE_ANIM_DATA, 0);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, tex->ima, te, 0, 0);
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
|
|
|
|
case ID_CA:
|
|
|
|
|
{
|
2012-05-07 17:56:30 +00:00
|
|
|
Camera *ca = (Camera *)id;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (outliner_animdata_test(ca->adt)) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, ca, te, TSE_ANIM_DATA, 0);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
case ID_CF:
|
|
|
|
|
{
|
|
|
|
|
CacheFile *cache_file = (CacheFile *)id;
|
|
|
|
|
|
|
|
|
|
if (outliner_animdata_test(cache_file->adt)) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, cache_file, te, TSE_ANIM_DATA, 0);
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
2011-07-11 13:36:38 +00:00
|
|
|
case ID_LA:
|
|
|
|
|
{
|
2019-02-27 10:46:48 +11:00
|
|
|
Light *la = (Light *)id;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (outliner_animdata_test(la->adt)) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, la, te, TSE_ANIM_DATA, 0);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
2011-08-01 11:44:20 +00:00
|
|
|
case ID_SPK:
|
2012-05-07 17:56:30 +00:00
|
|
|
{
|
|
|
|
|
Speaker *spk = (Speaker *)id;
|
2011-08-01 11:44:20 +00:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (outliner_animdata_test(spk->adt)) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, spk, te, TSE_ANIM_DATA, 0);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2012-05-07 17:56:30 +00:00
|
|
|
}
|
2017-06-12 20:59:54 +10:00
|
|
|
case ID_LP:
|
2017-06-07 15:23:58 +02:00
|
|
|
{
|
2017-06-12 20:59:54 +10:00
|
|
|
LightProbe *prb = (LightProbe *)id;
|
2017-06-07 15:23:58 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (outliner_animdata_test(prb->adt)) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, prb, te, TSE_ANIM_DATA, 0);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2017-06-07 15:23:58 +02:00
|
|
|
break;
|
|
|
|
|
}
|
2011-07-11 13:36:38 +00:00
|
|
|
case ID_WO:
|
|
|
|
|
{
|
2012-05-07 17:56:30 +00:00
|
|
|
World *wrld = (World *)id;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (outliner_animdata_test(wrld->adt)) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, wrld, te, TSE_ANIM_DATA, 0);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
|
|
|
|
case ID_KE:
|
|
|
|
|
{
|
2012-05-07 17:56:30 +00:00
|
|
|
Key *key = (Key *)id;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (outliner_animdata_test(key->adt)) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, key, te, TSE_ANIM_DATA, 0);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
|
|
|
|
case ID_AC:
|
|
|
|
|
{
|
|
|
|
|
// XXX do we want to be exposing the F-Curves here?
|
2012-10-26 04:14:10 +00:00
|
|
|
//bAction *act = (bAction *)id;
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
|
|
|
|
case ID_AR:
|
|
|
|
|
{
|
2012-05-07 17:56:30 +00:00
|
|
|
bArmature *arm = (bArmature *)id;
|
|
|
|
|
int a = 0;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (outliner_animdata_test(arm->adt)) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, arm, te, TSE_ANIM_DATA, 0);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (arm->edbo) {
|
2011-07-11 13:36:38 +00:00
|
|
|
EditBone *ebone;
|
|
|
|
|
TreeElement *ten;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
for (ebone = arm->edbo->first; ebone; ebone = ebone->next, a++) {
|
2018-04-05 18:20:27 +02:00
|
|
|
ten = outliner_add_element(soops, &te->subtree, id, te, TSE_EBONE, a);
|
2012-05-07 17:56:30 +00:00
|
|
|
ten->directdata = ebone;
|
|
|
|
|
ten->name = ebone->name;
|
2015-03-28 04:34:28 +11:00
|
|
|
ebone->temp.p = ten;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2011-07-11 13:36:38 +00:00
|
|
|
/* make hierarchy */
|
2015-03-28 04:34:28 +11:00
|
|
|
ten = arm->edbo->first ? ((EditBone *)arm->edbo->first)->temp.p : NULL;
|
2012-03-24 06:38:07 +00:00
|
|
|
while (ten) {
|
2012-05-07 17:56:30 +00:00
|
|
|
TreeElement *nten = ten->next, *par;
|
|
|
|
|
ebone = (EditBone *)ten->directdata;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ebone->parent) {
|
2011-07-11 13:36:38 +00:00
|
|
|
BLI_remlink(&te->subtree, ten);
|
2015-03-28 04:34:28 +11:00
|
|
|
par = ebone->parent->temp.p;
|
2011-07-11 13:36:38 +00:00
|
|
|
BLI_addtail(&par->subtree, ten);
|
2012-05-07 17:56:30 +00:00
|
|
|
ten->parent = par;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
ten = nten;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* do not extend Armature when we have posemode */
|
2012-05-07 17:56:30 +00:00
|
|
|
tselem = TREESTORE(te->parent);
|
2018-04-05 18:20:27 +02:00
|
|
|
if (GS(tselem->id->name) == ID_OB && ((Object *)tselem->id)->mode & OB_MODE_POSE) {
|
2012-10-07 09:48:59 +00:00
|
|
|
/* pass */
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
else {
|
2011-07-11 13:36:38 +00:00
|
|
|
Bone *curBone;
|
2012-05-07 17:56:30 +00:00
|
|
|
for (curBone = arm->bonebase.first; curBone; curBone = curBone->next) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_bone(soops, &te->subtree, id, curBone, te, &a);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2013-09-04 01:15:23 +00:00
|
|
|
case ID_LS:
|
|
|
|
|
{
|
|
|
|
|
FreestyleLineStyle *linestyle = (FreestyleLineStyle *)id;
|
2014-04-23 15:07:04 +09:00
|
|
|
int a;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (outliner_animdata_test(linestyle->adt)) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, linestyle, te, TSE_ANIM_DATA, 0);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2014-04-23 15:07:04 +09:00
|
|
|
|
|
|
|
|
for (a = 0; a < MAX_MTEX; a++) {
|
2019-03-26 21:16:47 +11:00
|
|
|
if (linestyle->mtex[a]) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, linestyle->mtex[a]->tex, te, 0, a);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2014-04-23 15:07:04 +09:00
|
|
|
}
|
2013-09-04 01:15:23 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2015-02-07 12:28:17 +13:00
|
|
|
case ID_GD:
|
|
|
|
|
{
|
|
|
|
|
bGPdata *gpd = (bGPdata *)id;
|
|
|
|
|
bGPDlayer *gpl;
|
|
|
|
|
int a = 0;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (outliner_animdata_test(gpd->adt)) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, gpd, te, TSE_ANIM_DATA, 0);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2015-02-07 12:50:22 +13:00
|
|
|
// TODO: base element for layers?
|
2019-03-21 09:29:16 +01:00
|
|
|
for (gpl = gpd->layers.last; gpl; gpl = gpl->prev) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, gpl, te, TSE_GP_LAYER, a);
|
2015-02-07 12:28:17 +13:00
|
|
|
a++;
|
|
|
|
|
}
|
2015-02-11 18:38:41 +11:00
|
|
|
break;
|
2015-02-07 12:28:17 +13:00
|
|
|
}
|
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
|
|
|
case ID_GR:
|
|
|
|
|
{
|
2018-05-25 13:42:20 +02:00
|
|
|
/* Don't expand for instances, creates too many elements. */
|
|
|
|
|
if (!(te->parent && te->parent->idcode == ID_OB)) {
|
|
|
|
|
Collection *collection = (Collection *)id;
|
|
|
|
|
outliner_add_collection_recursive(soops, collection, te);
|
|
|
|
|
}
|
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
|
|
|
}
|
2017-08-28 11:19:58 +02:00
|
|
|
default:
|
|
|
|
|
break;
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: this function needs to be split up! It's getting a bit too large...
|
2012-12-22 13:39:44 +00:00
|
|
|
// Note: "ID" is not always a real ID
|
2019-02-16 09:47:19 +11:00
|
|
|
static TreeElement *outliner_add_element(SpaceOutliner *soops, ListBase *lb, void *idv,
|
2018-04-05 18:20:27 +02:00
|
|
|
TreeElement *parent, short type, short index)
|
2011-07-11 13:36:38 +00:00
|
|
|
{
|
|
|
|
|
TreeElement *te;
|
|
|
|
|
TreeStoreElem *tselem;
|
2012-05-07 17:56:30 +00:00
|
|
|
ID *id = idv;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-07-20 01:30:29 +10:00
|
|
|
if (ELEM(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
|
2012-05-07 17:56:30 +00:00
|
|
|
id = ((PointerRNA *)idv)->id.data;
|
2019-03-26 21:16:47 +11:00
|
|
|
if (!id) {
|
|
|
|
|
id = ((PointerRNA *)idv)->data;
|
|
|
|
|
}
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
2015-08-22 16:37:35 +10:00
|
|
|
else if (type == TSE_GP_LAYER) {
|
|
|
|
|
/* idv is the layer its self */
|
|
|
|
|
id = TREESTORE(parent)->id;
|
|
|
|
|
}
|
2011-07-11 13:36:38 +00:00
|
|
|
|
2017-02-09 17:19:07 +01:00
|
|
|
/* exceptions */
|
2017-12-01 11:24:21 -02:00
|
|
|
if (type == TSE_ID_BASE) {
|
2012-12-23 01:18:35 +00:00
|
|
|
/* pass */
|
|
|
|
|
}
|
|
|
|
|
else if (id == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2011-07-11 13:36:38 +00:00
|
|
|
|
2015-04-30 14:04:41 +02:00
|
|
|
if (type == 0) {
|
|
|
|
|
/* Zero type means real ID, ensure we do not get non-outliner ID types here... */
|
|
|
|
|
BLI_assert(TREESTORE_ID_TYPE(id));
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
te = MEM_callocN(sizeof(TreeElement), "tree elem");
|
2011-07-11 13:36:38 +00:00
|
|
|
/* add to the visual tree */
|
|
|
|
|
BLI_addtail(lb, te);
|
|
|
|
|
/* add to the storage */
|
2011-11-03 03:00:45 +00:00
|
|
|
check_persistent(soops, te, id, type, index);
|
2012-05-07 17:56:30 +00:00
|
|
|
tselem = TREESTORE(te);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-09-09 12:46:07 +00:00
|
|
|
/* if we are searching for something expand to see child elements */
|
2019-03-26 21:16:47 +11:00
|
|
|
if (SEARCHING_OUTLINER(soops)) {
|
2011-09-09 12:46:07 +00:00
|
|
|
tselem->flag |= TSE_CHILDSEARCH;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
te->parent = parent;
|
2018-09-27 15:35:22 +02:00
|
|
|
te->index = index; // for data arrays
|
2014-07-20 01:30:29 +10:00
|
|
|
if (ELEM(type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) {
|
2012-10-07 09:48:59 +00:00
|
|
|
/* pass */
|
|
|
|
|
}
|
2014-07-20 01:30:29 +10:00
|
|
|
else if (ELEM(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
|
2012-10-07 09:48:59 +00:00
|
|
|
/* pass */
|
|
|
|
|
}
|
|
|
|
|
else if (type == TSE_ANIM_DATA) {
|
|
|
|
|
/* pass */
|
|
|
|
|
}
|
2015-02-07 12:50:22 +13:00
|
|
|
else if (type == TSE_GP_LAYER) {
|
|
|
|
|
/* pass */
|
|
|
|
|
}
|
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
|
|
|
else if (ELEM(type, TSE_LAYER_COLLECTION, TSE_SCENE_COLLECTION_BASE, TSE_VIEW_COLLECTION_BASE)) {
|
2017-02-09 17:19:07 +01:00
|
|
|
/* pass */
|
|
|
|
|
}
|
2012-12-22 13:39:44 +00:00
|
|
|
else if (type == TSE_ID_BASE) {
|
|
|
|
|
/* pass */
|
|
|
|
|
}
|
2011-07-11 13:36:38 +00:00
|
|
|
else {
|
2012-12-27 19:07:16 +00:00
|
|
|
/* do here too, for blend file viewer, own ID_LI then shows file name */
|
2019-03-26 21:16:47 +11:00
|
|
|
if (GS(id->name) == ID_LI) {
|
2012-12-27 19:07:16 +00:00
|
|
|
te->name = ((Library *)id)->name;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
|
|
|
|
else {
|
2012-12-27 19:07:16 +00:00
|
|
|
te->name = id->name + 2; // default, can be overridden by Library or non-ID data
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
te->idcode = GS(id->name);
|
2011-07-11 13:36:38 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
if (type == 0) {
|
2012-12-22 13:39:44 +00:00
|
|
|
TreeStoreElem *tsepar = parent ? TREESTORE(parent) : NULL;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 13:36:38 +00:00
|
|
|
/* ID datablock */
|
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
|
|
|
if (tsepar == NULL || tsepar->type != TSE_ID_BASE || soops->filter_id_type) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_id_contents(soops, te, tselem, id);
|
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
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
else if (type == TSE_ANIM_DATA) {
|
2011-07-11 10:59:53 +00:00
|
|
|
IdAdtTemplate *iat = (IdAdtTemplate *)idv;
|
2012-05-07 17:56:30 +00:00
|
|
|
AnimData *adt = (AnimData *)iat->adt;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* this element's info */
|
2013-03-11 15:01:03 +00:00
|
|
|
te->name = IFACE_("Animation");
|
2012-05-07 17:56:30 +00:00
|
|
|
te->directdata = adt;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* Action */
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, adt->action, te, 0, 0);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* Drivers */
|
|
|
|
|
if (adt->drivers.first) {
|
2018-04-05 18:20:27 +02:00
|
|
|
TreeElement *ted = outliner_add_element(soops, &te->subtree, adt, te, TSE_DRIVER_BASE, 0);
|
2012-05-07 17:56:30 +00:00
|
|
|
ID *lastadded = NULL;
|
2011-07-11 10:59:53 +00:00
|
|
|
FCurve *fcu;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2013-03-11 15:01:03 +00:00
|
|
|
ted->name = IFACE_("Drivers");
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
for (fcu = adt->drivers.first; fcu; fcu = fcu->next) {
|
2012-02-27 10:35:39 +00:00
|
|
|
if (fcu->driver && fcu->driver->variables.first) {
|
2012-05-07 17:56:30 +00:00
|
|
|
ChannelDriver *driver = fcu->driver;
|
2011-07-11 10:59:53 +00:00
|
|
|
DriverVar *dvar;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
|
2011-07-11 10:59:53 +00:00
|
|
|
/* loop over all targets used here */
|
2018-11-30 15:08:47 +11:00
|
|
|
DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
|
|
|
|
if (lastadded != dtar->id) {
|
|
|
|
|
// XXX this lastadded check is rather lame, and also fails quite badly...
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &ted->subtree, dtar->id, ted, TSE_LINKED_OB, 0);
|
2012-05-07 17:56:30 +00:00
|
|
|
lastadded = dtar->id;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
2018-11-30 15:08:47 +11:00
|
|
|
DRIVER_TARGETS_LOOPER_END;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* NLA Data */
|
|
|
|
|
if (adt->nla_tracks.first) {
|
2018-04-05 18:20:27 +02:00
|
|
|
TreeElement *tenla = outliner_add_element(soops, &te->subtree, adt, te, TSE_NLA, 0);
|
2011-07-11 10:59:53 +00:00
|
|
|
NlaTrack *nlt;
|
2012-05-07 17:56:30 +00:00
|
|
|
int a = 0;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2013-03-11 15:01:03 +00:00
|
|
|
tenla->name = IFACE_("NLA Tracks");
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
|
2018-04-05 18:20:27 +02:00
|
|
|
TreeElement *tenlt = outliner_add_element(soops, &tenla->subtree, nlt, tenla, TSE_NLA_TRACK, a);
|
2011-07-11 10:59:53 +00:00
|
|
|
NlaStrip *strip;
|
|
|
|
|
TreeElement *ten;
|
2012-05-07 17:56:30 +00:00
|
|
|
int b = 0;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
tenlt->name = nlt->name;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
for (strip = nlt->strips.first; strip; strip = strip->next, b++) {
|
2018-04-05 18:20:27 +02:00
|
|
|
ten = outliner_add_element(soops, &tenlt->subtree, strip->act, tenlt, TSE_NLA_ACTION, b);
|
2019-03-26 21:16:47 +11:00
|
|
|
if (ten) {
|
|
|
|
|
ten->directdata = strip;
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-02-07 12:50:22 +13:00
|
|
|
else if (type == TSE_GP_LAYER) {
|
|
|
|
|
bGPDlayer *gpl = (bGPDlayer *)idv;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2015-02-07 12:50:22 +13:00
|
|
|
te->name = gpl->info;
|
|
|
|
|
te->directdata = gpl;
|
|
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
else if (type == TSE_SEQUENCE) {
|
|
|
|
|
Sequence *seq = (Sequence *) idv;
|
2011-07-11 10:59:53 +00:00
|
|
|
Sequence *p;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* The idcode is a little hack, but the outliner
|
|
|
|
|
* only check te->idcode if te->type is equal to zero,
|
|
|
|
|
* so this is "safe".
|
|
|
|
|
*/
|
2012-05-07 17:56:30 +00:00
|
|
|
te->idcode = seq->type;
|
|
|
|
|
te->directdata = seq;
|
2012-05-29 05:45:06 +00:00
|
|
|
te->name = seq->name + 2;
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2015-07-01 17:32:56 +02:00
|
|
|
if (!(seq->type & SEQ_TYPE_EFFECT)) {
|
2011-07-11 10:59:53 +00:00
|
|
|
/*
|
|
|
|
|
* This work like the sequence.
|
|
|
|
|
* If the sequence have a name (not default name)
|
|
|
|
|
* show it, in other case put the filename.
|
|
|
|
|
*/
|
|
|
|
|
|
2012-06-07 15:49:02 +00:00
|
|
|
if (seq->type == SEQ_TYPE_META) {
|
2012-05-07 17:56:30 +00:00
|
|
|
p = seq->seqbase.first;
|
2012-03-24 06:38:07 +00:00
|
|
|
while (p) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, (void *)p, te, TSE_SEQUENCE, index);
|
2012-05-07 17:56:30 +00:00
|
|
|
p = p->next;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
2019-03-26 21:16:47 +11:00
|
|
|
else {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, (void *)seq->strip, te, TSE_SEQ_STRIP, index);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
else if (type == TSE_SEQ_STRIP) {
|
|
|
|
|
Strip *strip = (Strip *)idv;
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (strip->dir[0] != '\0') {
|
2012-05-07 17:56:30 +00:00
|
|
|
te->name = strip->dir;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
|
|
|
|
else {
|
2013-03-11 15:01:03 +00:00
|
|
|
te->name = IFACE_("Strip None");
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
te->directdata = strip;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
else if (type == TSE_SEQUENCE_DUP) {
|
|
|
|
|
Sequence *seq = (Sequence *)idv;
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
te->idcode = seq->type;
|
|
|
|
|
te->directdata = seq;
|
|
|
|
|
te->name = seq->strip->stripdata->name;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2014-07-20 01:30:29 +10:00
|
|
|
else if (ELEM(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
|
2012-05-07 17:56:30 +00:00
|
|
|
PointerRNA pptr, propptr, *ptr = (PointerRNA *)idv;
|
2011-07-11 10:59:53 +00:00
|
|
|
PropertyRNA *prop, *iterprop;
|
|
|
|
|
PropertyType proptype;
|
2017-06-30 10:04:32 +10:00
|
|
|
|
|
|
|
|
/* Don't display arrays larger, weak but index is stored as a short,
|
|
|
|
|
* also the outliner isn't intended for editing such large data-sets. */
|
|
|
|
|
BLI_STATIC_ASSERT(sizeof(te->index) == 2, "Index is no longer short!");
|
|
|
|
|
const int tot_limit = SHRT_MAX;
|
|
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
int a, tot;
|
|
|
|
|
|
2018-09-27 15:35:22 +02:00
|
|
|
/* we do lazy build, for speed and to avoid infinite recursion */
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ptr->data == NULL) {
|
2013-03-11 15:01:03 +00:00
|
|
|
te->name = IFACE_("(empty)");
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (type == TSE_RNA_STRUCT) {
|
2011-07-11 10:59:53 +00:00
|
|
|
/* struct */
|
2012-05-07 17:56:30 +00:00
|
|
|
te->name = RNA_struct_name_get_alloc(ptr, NULL, 0, NULL);
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (te->name) {
|
2011-07-11 10:59:53 +00:00
|
|
|
te->flag |= TE_FREE_NAME;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
|
|
|
|
else {
|
2012-05-07 17:56:30 +00:00
|
|
|
te->name = RNA_struct_ui_name(ptr->type);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2011-09-09 12:46:07 +00:00
|
|
|
/* If searching don't expand RNA entries */
|
2019-03-26 21:16:47 +11:00
|
|
|
if (SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA", te->name) == 0) {
|
|
|
|
|
tselem->flag &= ~TSE_CHILDSEARCH;
|
|
|
|
|
}
|
2011-09-09 12:46:07 +00:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
iterprop = RNA_struct_iterator_property(ptr->type);
|
|
|
|
|
tot = RNA_property_collection_length(ptr, iterprop);
|
2017-06-30 10:04:32 +10:00
|
|
|
CLAMP_MAX(tot, tot_limit);
|
2011-07-11 10:59:53 +00:00
|
|
|
|
|
|
|
|
/* auto open these cases */
|
2019-03-26 21:16:47 +11:00
|
|
|
if (!parent || (RNA_property_type(parent->directdata)) == PROP_POINTER) {
|
|
|
|
|
if (!tselem->used) {
|
2011-07-11 10:59:53 +00:00
|
|
|
tselem->flag &= ~TSE_CLOSED;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
if (TSELEM_OPEN(tselem, soops)) {
|
2016-11-19 01:15:08 +01:00
|
|
|
for (a = 0; a < tot; a++) {
|
|
|
|
|
RNA_property_collection_lookup_int(ptr, iterprop, a, &propptr);
|
|
|
|
|
if (!(RNA_property_flag(propptr.data) & PROP_HIDDEN)) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, (void *)ptr, te, TSE_RNA_PROPERTY, a);
|
2016-11-19 01:15:08 +01:00
|
|
|
}
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2019-03-26 21:16:47 +11:00
|
|
|
else if (tot) {
|
2011-07-11 10:59:53 +00:00
|
|
|
te->flag |= TE_LAZY_CLOSED;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
te->rnaptr = *ptr;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (type == TSE_RNA_PROPERTY) {
|
2011-07-11 10:59:53 +00:00
|
|
|
/* property */
|
2012-05-07 17:56:30 +00:00
|
|
|
iterprop = RNA_struct_iterator_property(ptr->type);
|
2011-07-11 10:59:53 +00:00
|
|
|
RNA_property_collection_lookup_int(ptr, iterprop, index, &propptr);
|
|
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
prop = propptr.data;
|
|
|
|
|
proptype = RNA_property_type(prop);
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
te->name = RNA_property_ui_name(prop);
|
|
|
|
|
te->directdata = prop;
|
|
|
|
|
te->rnaptr = *ptr;
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2011-09-09 12:46:07 +00:00
|
|
|
/* If searching don't expand RNA entries */
|
2019-03-26 21:16:47 +11:00
|
|
|
if (SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA", te->name) == 0) {
|
|
|
|
|
tselem->flag &= ~TSE_CHILDSEARCH;
|
|
|
|
|
}
|
2011-09-09 12:46:07 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (proptype == PROP_POINTER) {
|
2012-05-07 17:56:30 +00:00
|
|
|
pptr = RNA_property_pointer_get(ptr, prop);
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (pptr.data) {
|
2019-03-26 21:16:47 +11:00
|
|
|
if (TSELEM_OPEN(tselem, soops)) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, (void *)&pptr, te, TSE_RNA_STRUCT, -1);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
|
|
|
|
else {
|
2011-07-11 10:59:53 +00:00
|
|
|
te->flag |= TE_LAZY_CLOSED;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (proptype == PROP_COLLECTION) {
|
2012-05-07 17:56:30 +00:00
|
|
|
tot = RNA_property_collection_length(ptr, prop);
|
2017-06-30 10:04:32 +10:00
|
|
|
CLAMP_MAX(tot, tot_limit);
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
if (TSELEM_OPEN(tselem, soops)) {
|
2012-05-07 17:56:30 +00:00
|
|
|
for (a = 0; a < tot; a++) {
|
2011-07-11 10:59:53 +00:00
|
|
|
RNA_property_collection_lookup_int(ptr, prop, a, &pptr);
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, (void *)&pptr, te, TSE_RNA_STRUCT, a);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
2019-03-26 21:16:47 +11:00
|
|
|
else if (tot) {
|
2011-07-11 10:59:53 +00:00
|
|
|
te->flag |= TE_LAZY_CLOSED;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2014-07-20 01:30:29 +10:00
|
|
|
else if (ELEM(proptype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
|
2012-05-07 17:56:30 +00:00
|
|
|
tot = RNA_property_array_length(ptr, prop);
|
2017-06-30 10:04:32 +10:00
|
|
|
CLAMP_MAX(tot, tot_limit);
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
if (TSELEM_OPEN(tselem, soops)) {
|
2019-03-26 21:16:47 +11:00
|
|
|
for (a = 0; a < tot; a++) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &te->subtree, (void *)ptr, te, TSE_RNA_ARRAY_ELEM, a);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2019-03-26 21:16:47 +11:00
|
|
|
else if (tot) {
|
2011-07-11 10:59:53 +00:00
|
|
|
te->flag |= TE_LAZY_CLOSED;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (type == TSE_RNA_ARRAY_ELEM) {
|
2011-07-11 10:59:53 +00:00
|
|
|
char c;
|
|
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
prop = parent->directdata;
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
te->directdata = prop;
|
|
|
|
|
te->rnaptr = *ptr;
|
|
|
|
|
te->index = index;
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
c = RNA_property_array_item_char(prop, index);
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
te->name = MEM_callocN(sizeof(char) * 20, "OutlinerRNAArrayName");
|
2019-03-26 21:16:47 +11:00
|
|
|
if (c) {
|
|
|
|
|
sprintf((char *)te->name, " %c", c);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
sprintf((char *)te->name, " %d", index + 1);
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
te->flag |= TE_FREE_NAME;
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (type == TSE_KEYMAP) {
|
2012-05-07 17:56:30 +00:00
|
|
|
wmKeyMap *km = (wmKeyMap *)idv;
|
2011-07-11 10:59:53 +00:00
|
|
|
wmKeyMapItem *kmi;
|
|
|
|
|
char opname[OP_MAX_TYPENAME];
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
te->directdata = idv;
|
|
|
|
|
te->name = km->idname;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
if (TSELEM_OPEN(tselem, soops)) {
|
2013-07-30 08:45:45 +00:00
|
|
|
int a = 0;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
for (kmi = km->items.first; kmi; kmi = kmi->next, a++) {
|
2015-07-03 15:07:46 +02:00
|
|
|
const char *key = WM_key_event_string(kmi->type, false);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (key[0]) {
|
2012-05-07 17:56:30 +00:00
|
|
|
wmOperatorType *ot = NULL;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-10-07 09:48:59 +00:00
|
|
|
if (kmi->propvalue) {
|
|
|
|
|
/* pass */
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
ot = WM_operatortype_find(kmi->idname, 0);
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ot || kmi->propvalue) {
|
2018-04-05 18:20:27 +02:00
|
|
|
TreeElement *ten = outliner_add_element(soops, &te->subtree, kmi, te, TSE_KEYMAP_ITEM, a);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
ten->directdata = kmi;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (kmi->propvalue) {
|
2013-03-11 15:01:03 +00:00
|
|
|
ten->name = IFACE_("Modal map, not yet");
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
WM_operator_py_idname(opname, ot->idname);
|
2012-05-07 17:56:30 +00:00
|
|
|
ten->name = BLI_strdup(opname);
|
2011-07-11 10:59:53 +00:00
|
|
|
ten->flag |= TE_FREE_NAME;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-03-26 21:16:47 +11:00
|
|
|
else {
|
2011-07-11 10:59:53 +00:00
|
|
|
te->flag |= TE_LAZY_CLOSED;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return te;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ======================================================= */
|
|
|
|
|
/* Sequencer mode tree building */
|
|
|
|
|
|
|
|
|
|
/* Helped function to put duplicate sequence in the same tree. */
|
|
|
|
|
static int need_add_seq_dup(Sequence *seq)
|
|
|
|
|
{
|
|
|
|
|
Sequence *p;
|
|
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if ((!seq->strip) || (!seq->strip->stripdata)) {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* First check backward, if we found a duplicate
|
|
|
|
|
* sequence before this, don't need it, just return.
|
|
|
|
|
*/
|
2012-05-07 17:56:30 +00:00
|
|
|
p = seq->prev;
|
2012-03-24 06:38:07 +00:00
|
|
|
while (p) {
|
2013-07-27 09:20:10 +00:00
|
|
|
if ((!p->strip) || (!p->strip->stripdata)) {
|
2012-05-07 17:56:30 +00:00
|
|
|
p = p->prev;
|
2011-07-11 10:59:53 +00:00
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (STREQ(p->strip->stripdata->name, seq->strip->stripdata->name)) {
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
p = p->prev;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
p = seq->next;
|
2012-03-24 06:38:07 +00:00
|
|
|
while (p) {
|
2013-07-27 09:20:10 +00:00
|
|
|
if ((!p->strip) || (!p->strip->stripdata)) {
|
2012-05-07 17:56:30 +00:00
|
|
|
p = p->next;
|
2011-07-11 10:59:53 +00:00
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (STREQ(p->strip->stripdata->name, seq->strip->stripdata->name)) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
p = p->next;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
return(1);
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 09:47:19 +11:00
|
|
|
static void outliner_add_seq_dup(SpaceOutliner *soops, Sequence *seq, TreeElement *te, short index)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
2011-09-20 08:48:48 +00:00
|
|
|
/* TreeElement *ch; */ /* UNUSED */
|
2011-07-11 10:59:53 +00:00
|
|
|
Sequence *p;
|
|
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
p = seq;
|
2012-03-24 06:38:07 +00:00
|
|
|
while (p) {
|
2013-07-16 11:42:07 +00:00
|
|
|
if ((!p->strip) || (!p->strip->stripdata) || (p->strip->stripdata->name[0] == '\0')) {
|
2012-05-07 17:56:30 +00:00
|
|
|
p = p->next;
|
2011-07-11 10:59:53 +00:00
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (STREQ(p->strip->stripdata->name, seq->strip->stripdata->name)) {
|
2018-04-05 18:20:27 +02:00
|
|
|
/* ch = */ /* UNUSED */ outliner_add_element(soops, &te->subtree, (void *)p, te, TSE_SEQUENCE, index);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
p = p->next;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-16 00:25:55 +13:00
|
|
|
|
|
|
|
|
/* ----------------------------------------------- */
|
|
|
|
|
|
2018-05-17 12:20:40 +02:00
|
|
|
static const char *outliner_idcode_to_plural(short idcode)
|
|
|
|
|
{
|
|
|
|
|
const char *propname = BKE_idcode_to_name_plural(idcode);
|
|
|
|
|
PropertyRNA *prop = RNA_struct_type_find_property(&RNA_BlendData, propname);
|
2018-05-17 13:40:59 +02:00
|
|
|
return (prop) ? RNA_property_ui_name(prop) : "UNKNOWN";
|
2018-05-17 12:20:40 +02:00
|
|
|
}
|
2015-02-16 00:25:55 +13:00
|
|
|
|
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
|
|
|
static bool outliner_library_id_show(Library *lib, ID *id, short filter_id_type)
|
|
|
|
|
{
|
|
|
|
|
if (id->lib != lib) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (filter_id_type == ID_GR) {
|
|
|
|
|
/* Don't show child collections of non-scene master collection,
|
|
|
|
|
* they are already shown as children. */
|
|
|
|
|
Collection *collection = (Collection *)id;
|
|
|
|
|
bool has_non_scene_parent = false;
|
|
|
|
|
|
|
|
|
|
for (CollectionParent *cparent = collection->parents.first; cparent; cparent = cparent->next) {
|
|
|
|
|
if (!(cparent->collection->flag & COLLECTION_IS_MASTER)) {
|
|
|
|
|
has_non_scene_parent = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (has_non_scene_parent) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 09:47:19 +11:00
|
|
|
static TreeElement *outliner_add_library_contents(Main *mainvar, SpaceOutliner *soops, ListBase *lb, Library *lib)
|
2015-02-16 00:25:55 +13:00
|
|
|
{
|
2018-05-23 14:37:43 +02:00
|
|
|
TreeElement *ten, *tenlib = NULL;
|
2015-02-16 00:25:55 +13:00
|
|
|
ListBase *lbarray[MAX_LIBARRAY];
|
|
|
|
|
int a, tot;
|
2018-05-17 13:40:59 +02:00
|
|
|
short filter_id_type = (soops->filter & SO_FILTER_ID_TYPE) ? soops->filter_id_type : 0;
|
2018-06-04 09:39:04 +02:00
|
|
|
|
2018-05-17 13:40:59 +02:00
|
|
|
if (filter_id_type) {
|
|
|
|
|
lbarray[0] = which_libbase(mainvar, soops->filter_id_type);
|
|
|
|
|
tot = 1;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
tot = set_listbasepointers(mainvar, lbarray);
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-16 00:25:55 +13:00
|
|
|
for (a = 0; a < tot; a++) {
|
2018-05-17 13:40:59 +02:00
|
|
|
if (lbarray[a] && lbarray[a]->first) {
|
2015-02-16 00:25:55 +13:00
|
|
|
ID *id = lbarray[a]->first;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2015-02-16 00:25:55 +13:00
|
|
|
/* check if there's data in current lib */
|
2019-03-26 21:16:47 +11:00
|
|
|
for (; id; id = id->next) {
|
|
|
|
|
if (id->lib == lib) {
|
2015-02-16 00:25:55 +13:00
|
|
|
break;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2015-02-16 00:25:55 +13:00
|
|
|
if (id) {
|
2018-05-23 14:37:43 +02:00
|
|
|
if (!tenlib) {
|
|
|
|
|
/* Create library tree element on demand, depending if there are any datablocks. */
|
|
|
|
|
if (lib) {
|
|
|
|
|
tenlib = outliner_add_element(soops, lb, lib, NULL, 0, 0);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
tenlib = outliner_add_element(soops, lb, mainvar, NULL, TSE_ID_BASE, 0);
|
|
|
|
|
tenlib->name = IFACE_("Current File");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Create datablock list parent element on demand. */
|
2018-05-17 13:40:59 +02:00
|
|
|
if (filter_id_type) {
|
2018-05-23 14:37:43 +02:00
|
|
|
ten = tenlib;
|
2018-05-17 13:40:59 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2018-05-23 14:37:43 +02:00
|
|
|
ten = outliner_add_element(soops, &tenlib->subtree, lbarray[a], NULL, TSE_ID_BASE, 0);
|
2018-05-17 13:40:59 +02:00
|
|
|
ten->directdata = lbarray[a];
|
|
|
|
|
ten->name = outliner_idcode_to_plural(GS(id->name));
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2015-02-16 00:25:55 +13:00
|
|
|
for (id = lbarray[a]->first; id; id = id->next) {
|
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
|
|
|
if (outliner_library_id_show(lib, id, filter_id_type)) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_element(soops, &ten->subtree, id, ten, 0, 0);
|
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
|
|
|
}
|
2015-02-16 00:25:55 +13:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-05-23 14:37:43 +02:00
|
|
|
|
|
|
|
|
return tenlib;
|
2015-02-16 00:25:55 +13:00
|
|
|
}
|
|
|
|
|
|
2019-02-16 09:47:19 +11:00
|
|
|
static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOutliner *soops)
|
2015-02-16 00:25:55 +13:00
|
|
|
{
|
|
|
|
|
TreeElement *ten;
|
|
|
|
|
ListBase *lbarray[MAX_LIBARRAY];
|
|
|
|
|
int a, tot;
|
2018-05-17 13:40:59 +02:00
|
|
|
short filter_id_type = (soops->filter & SO_FILTER_ID_TYPE) ? soops->filter_id_type : 0;
|
2018-06-04 09:39:04 +02:00
|
|
|
|
2018-05-17 13:40:59 +02:00
|
|
|
if (filter_id_type) {
|
|
|
|
|
lbarray[0] = which_libbase(mainvar, soops->filter_id_type);
|
|
|
|
|
tot = 1;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
tot = set_listbasepointers(mainvar, lbarray);
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-16 00:25:55 +13:00
|
|
|
for (a = 0; a < tot; a++) {
|
2018-05-17 13:40:59 +02:00
|
|
|
if (lbarray[a] && lbarray[a]->first) {
|
2015-02-16 00:25:55 +13:00
|
|
|
ID *id = lbarray[a]->first;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2015-02-16 00:25:55 +13:00
|
|
|
/* check if there are any datablocks of this type which are orphans */
|
|
|
|
|
for (; id; id = id->next) {
|
2019-03-26 21:16:47 +11:00
|
|
|
if (ID_REAL_USERS(id) <= 0) {
|
2015-02-16 00:25:55 +13:00
|
|
|
break;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2015-02-16 00:25:55 +13:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2015-02-16 00:25:55 +13:00
|
|
|
if (id) {
|
|
|
|
|
/* header for this type of datablock */
|
2018-05-17 13:40:59 +02:00
|
|
|
if (filter_id_type) {
|
|
|
|
|
ten = NULL;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
ten = outliner_add_element(soops, &soops->tree, lbarray[a], NULL, TSE_ID_BASE, 0);
|
|
|
|
|
ten->directdata = lbarray[a];
|
|
|
|
|
ten->name = outliner_idcode_to_plural(GS(id->name));
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2015-02-16 00:25:55 +13:00
|
|
|
/* add the orphaned datablocks - these will not be added with any subtrees attached */
|
|
|
|
|
for (id = lbarray[a]->first; id; id = id->next) {
|
2019-03-26 21:16:47 +11:00
|
|
|
if (ID_REAL_USERS(id) <= 0) {
|
2018-05-17 13:40:59 +02:00
|
|
|
outliner_add_element(soops, (ten) ? &ten->subtree : &soops->tree, id, ten, 0, 0);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2015-02-16 00:25:55 +13:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
static void outliner_add_layer_collection_objects(
|
2019-02-16 09:47:19 +11:00
|
|
|
SpaceOutliner *soops, ListBase *tree, ViewLayer *layer,
|
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
|
|
|
LayerCollection *lc, TreeElement *ten)
|
|
|
|
|
{
|
|
|
|
|
for (CollectionObject *cob = lc->collection->gobject.first; cob; cob = cob->next) {
|
|
|
|
|
Base *base = BKE_view_layer_base_find(layer, cob->ob);
|
|
|
|
|
TreeElement *te_object = outliner_add_element(soops, tree, base->object, ten, 0, 0);
|
|
|
|
|
te_object->directdata = base;
|
Objects: restore H key per object hiding.
H hides selected objects, Shift+H hides unselected objects, and Alt+H
reveals hidden objects.
This hiding state is distinct from restrict viewport and render, and
meant for temporarily hiding objects without affecting more persistent
collection hiding.
Object hiding is per view-layer, same as selection. It affects the
viewport and any preview renders in there, but not final renders.
In the outliner, different icons are now used for temporary hiding, and
restrict viewport and render. Hidden objects are greyed out.
Remaining design issues:
* For lamps we probably still want to keep their effect on the scene,
currently they are fully disabled by hiding. Arguably mesh lights or
even objects being reflected or casting shadows are not that different
but perhaps the special lamp exception from local view should remain.
* We need a feature still to disabled this hiding for specific viewports,
for render or animation preview where you want to see the entire scene
while working in another view.
* We need a new icon for restrict viewport, for now it uses a grid similar
to the 2.4 icon.
* Hiding objects does not preserve selection state as it did in 2.7,
it's probably convenient to support this again?
2018-05-14 23:36:56 +02:00
|
|
|
|
2018-06-25 13:50:11 +02:00
|
|
|
if (!(base->flag & BASE_VISIBLE)) {
|
Objects: restore H key per object hiding.
H hides selected objects, Shift+H hides unselected objects, and Alt+H
reveals hidden objects.
This hiding state is distinct from restrict viewport and render, and
meant for temporarily hiding objects without affecting more persistent
collection hiding.
Object hiding is per view-layer, same as selection. It affects the
viewport and any preview renders in there, but not final renders.
In the outliner, different icons are now used for temporary hiding, and
restrict viewport and render. Hidden objects are greyed out.
Remaining design issues:
* For lamps we probably still want to keep their effect on the scene,
currently they are fully disabled by hiding. Arguably mesh lights or
even objects being reflected or casting shadows are not that different
but perhaps the special lamp exception from local view should remain.
* We need a feature still to disabled this hiding for specific viewports,
for render or animation preview where you want to see the entire scene
while working in another view.
* We need a new icon for restrict viewport, for now it uses a grid similar
to the 2.4 icon.
* Hiding objects does not preserve selection state as it did in 2.7,
it's probably convenient to support this again?
2018-05-14 23:36:56 +02:00
|
|
|
te_object->flag |= TE_DISABLED;
|
|
|
|
|
}
|
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
|
|
|
}
|
2017-03-10 17:05:50 +01:00
|
|
|
}
|
2017-02-22 16:02:43 +01:00
|
|
|
|
2017-03-10 23:11:58 +01:00
|
|
|
static void outliner_add_layer_collections_recursive(
|
2019-02-16 09:47:19 +11:00
|
|
|
SpaceOutliner *soops, ListBase *tree, ViewLayer *layer,
|
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
|
|
|
ListBase *layer_collections, TreeElement *parent_ten,
|
2018-01-18 18:30:30 -02:00
|
|
|
const bool show_objects)
|
2017-03-10 23:11:58 +01:00
|
|
|
{
|
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
|
|
|
for (LayerCollection *lc = layer_collections->first; lc; lc = lc->next) {
|
|
|
|
|
ID *id = &lc->collection->id;
|
2018-04-05 18:20:27 +02:00
|
|
|
TreeElement *ten = outliner_add_element(soops, tree, id, parent_ten, TSE_LAYER_COLLECTION, 0);
|
2017-03-10 23:11:58 +01:00
|
|
|
|
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
|
|
|
ten->name = id->name + 2;
|
|
|
|
|
ten->directdata = lc;
|
2017-03-10 23:11:58 +01:00
|
|
|
|
2018-12-31 16:36:25 +01:00
|
|
|
/* Open by default. */
|
|
|
|
|
TreeStoreElem *tselem = TREESTORE(ten);
|
|
|
|
|
if (!tselem->used) {
|
|
|
|
|
tselem->flag &= ~TSE_CLOSED;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
const bool exclude = (lc->flag & LAYER_COLLECTION_EXCLUDE) != 0;
|
2018-11-28 14:05:08 +01:00
|
|
|
if (exclude ||
|
2018-11-29 18:56:10 -02:00
|
|
|
((lc->runtime_flag & LAYER_COLLECTION_VISIBLE) == 0))
|
2018-11-28 14:05:08 +01:00
|
|
|
{
|
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
|
|
|
ten->flag |= TE_DISABLED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
outliner_add_layer_collections_recursive(soops, &ten->subtree, layer, &lc->layer_collections, ten, show_objects);
|
|
|
|
|
if (!exclude && show_objects) {
|
|
|
|
|
outliner_add_layer_collection_objects(soops, &ten->subtree, layer, lc, ten);
|
2017-03-10 23:11:58 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-01-18 18:30:30 -02:00
|
|
|
|
2019-02-16 09:47:19 +11:00
|
|
|
static void outliner_add_view_layer(SpaceOutliner *soops, ListBase *tree, TreeElement *parent,
|
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
|
|
|
ViewLayer *layer, const bool show_objects)
|
2017-03-10 17:05:50 +01:00
|
|
|
{
|
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
|
|
|
/* First layer collection is for master collection, don't show it. */
|
|
|
|
|
LayerCollection *lc = layer->layer_collections.first;
|
|
|
|
|
if (lc == NULL) {
|
|
|
|
|
return;
|
2017-03-10 17:05:50 +01:00
|
|
|
}
|
|
|
|
|
|
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
|
|
|
outliner_add_layer_collections_recursive(soops, tree, layer, &lc->layer_collections, parent, show_objects);
|
|
|
|
|
if (show_objects) {
|
|
|
|
|
outliner_add_layer_collection_objects(soops, tree, layer, lc, parent);
|
2017-03-10 17:05:50 +01:00
|
|
|
}
|
|
|
|
|
}
|
2017-03-02 18:12:30 +01:00
|
|
|
|
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
|
|
|
BLI_INLINE void outliner_add_collection_init(TreeElement *te, Collection *collection)
|
2018-01-02 12:30:48 -02:00
|
|
|
{
|
2018-11-13 18:10:30 -02:00
|
|
|
te->name = BKE_collection_ui_name_get(collection);
|
2018-01-02 12:30:48 -02:00
|
|
|
te->directdata = collection;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
BLI_INLINE void outliner_add_collection_objects(
|
2019-02-16 09:47:19 +11:00
|
|
|
SpaceOutliner *soops, ListBase *tree, Collection *collection, TreeElement *parent)
|
2017-04-12 14:45:42 +02:00
|
|
|
{
|
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
|
|
|
for (CollectionObject *cob = collection->gobject.first; cob; cob = cob->next) {
|
|
|
|
|
outliner_add_element(soops, tree, cob->ob, parent, 0, 0);
|
2017-04-12 14:45:42 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
static TreeElement *outliner_add_collection_recursive(
|
2019-02-16 09:47:19 +11:00
|
|
|
SpaceOutliner *soops, Collection *collection, TreeElement *ten)
|
2017-02-27 22:17:19 +01:00
|
|
|
{
|
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
|
|
|
outliner_add_collection_init(ten, collection);
|
2018-04-23 20:39:05 +02:00
|
|
|
|
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
|
|
|
for (CollectionChild *child = collection->children.first; child; child = child->next) {
|
|
|
|
|
outliner_add_element(soops, &ten->subtree, &child->collection->id, ten, 0, 0);
|
2018-04-23 20:39:05 +02:00
|
|
|
}
|
2017-03-15 21:48:18 +01:00
|
|
|
|
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
|
|
|
if (soops->outlinevis != SO_SCENES) {
|
|
|
|
|
outliner_add_collection_objects(soops, &ten->subtree, collection, ten);
|
2017-02-27 22:17:19 +01:00
|
|
|
}
|
2018-01-02 12:30:48 -02:00
|
|
|
|
2018-01-02 14:00:03 -02:00
|
|
|
return ten;
|
2017-02-27 22:17:19 +01:00
|
|
|
}
|
2018-01-02 12:30:48 -02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* ======================================================= */
|
|
|
|
|
/* Generic Tree Building helpers - order these are called is top to bottom */
|
|
|
|
|
|
|
|
|
|
/* Hierarchy --------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
/* make sure elements are correctly nested */
|
2018-04-23 20:39:05 +02:00
|
|
|
static void outliner_make_object_parent_hierarchy(ListBase *lb)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
|
|
|
|
TreeElement *te, *ten, *tep;
|
|
|
|
|
TreeStoreElem *tselem;
|
|
|
|
|
|
|
|
|
|
/* build hierarchy */
|
|
|
|
|
// XXX also, set extents here...
|
2012-05-07 17:56:30 +00:00
|
|
|
te = lb->first;
|
2012-03-24 06:38:07 +00:00
|
|
|
while (te) {
|
2012-05-07 17:56:30 +00:00
|
|
|
ten = te->next;
|
|
|
|
|
tselem = TREESTORE(te);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
if (tselem->type == 0 && te->idcode == ID_OB) {
|
|
|
|
|
Object *ob = (Object *)tselem->id;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ob->parent && ob->parent->id.newid) {
|
2011-07-11 10:59:53 +00:00
|
|
|
BLI_remlink(lb, te);
|
2012-05-07 17:56:30 +00:00
|
|
|
tep = (TreeElement *)ob->parent->id.newid;
|
2011-07-11 10:59:53 +00:00
|
|
|
BLI_addtail(&tep->subtree, te);
|
|
|
|
|
// set correct parent pointers
|
2019-03-26 21:16:47 +11:00
|
|
|
for (te = tep->subtree.first; te; te = te->next) {
|
|
|
|
|
te->parent = tep;
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
te = ten;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Sorting ------------------------------------------------------ */
|
|
|
|
|
|
|
|
|
|
typedef struct tTreeSort {
|
|
|
|
|
TreeElement *te;
|
|
|
|
|
ID *id;
|
|
|
|
|
const char *name;
|
|
|
|
|
short idcode;
|
|
|
|
|
} tTreeSort;
|
|
|
|
|
|
2012-12-22 13:39:44 +00:00
|
|
|
/* alphabetical comparator, tryping to put objects first */
|
|
|
|
|
static int treesort_alpha_ob(const void *v1, const void *v2)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
2012-05-07 17:56:30 +00:00
|
|
|
const tTreeSort *x1 = v1, *x2 = v2;
|
2011-07-11 10:59:53 +00:00
|
|
|
int comp;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* first put objects last (hierarchy) */
|
2012-05-07 17:56:30 +00:00
|
|
|
comp = (x1->idcode == ID_OB);
|
2019-03-26 21:16:47 +11:00
|
|
|
if (x2->idcode == ID_OB) {
|
|
|
|
|
comp += 2;
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (comp == 1) {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else if (comp == 2) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
else if (comp == 3) {
|
|
|
|
|
comp = strcmp(x1->name, x2->name);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (comp > 0) {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else if (comp < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-22 13:39:44 +00:00
|
|
|
/* alphabetical comparator */
|
|
|
|
|
static int treesort_alpha(const void *v1, const void *v2)
|
|
|
|
|
{
|
|
|
|
|
const tTreeSort *x1 = v1, *x2 = v2;
|
|
|
|
|
int comp;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-12-22 13:39:44 +00:00
|
|
|
comp = strcmp(x1->name, x2->name);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (comp > 0) {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else if (comp < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2012-12-22 13:39:44 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-09-27 15:35:22 +02:00
|
|
|
/* this is nice option for later? doesn't look too useful... */
|
2011-07-11 10:59:53 +00:00
|
|
|
#if 0
|
|
|
|
|
static int treesort_obtype_alpha(const void *v1, const void *v2)
|
|
|
|
|
{
|
2012-05-07 17:56:30 +00:00
|
|
|
const tTreeSort *x1 = v1, *x2 = v2;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* first put objects last (hierarchy) */
|
2013-03-09 03:46:30 +00:00
|
|
|
if (x1->idcode == ID_OB && x2->idcode != ID_OB) {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else if (x2->idcode == ID_OB && x1->idcode != ID_OB) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
else {
|
|
|
|
|
/* 2nd we check ob type */
|
2012-05-07 17:56:30 +00:00
|
|
|
if (x1->idcode == ID_OB && x2->idcode == ID_OB) {
|
2013-03-09 03:46:30 +00:00
|
|
|
if (((Object *)x1->id)->type > ((Object *)x2->id)->type) return 1;
|
2012-09-09 00:00:21 +00:00
|
|
|
else if (((Object *)x1->id)->type > ((Object *)x2->id)->type) return -1;
|
2011-07-11 10:59:53 +00:00
|
|
|
else return 0;
|
|
|
|
|
}
|
|
|
|
|
else {
|
2012-05-07 17:56:30 +00:00
|
|
|
int comp = strcmp(x1->name, x2->name);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2013-03-09 03:46:30 +00:00
|
|
|
if (comp > 0) return 1;
|
2012-05-07 17:56:30 +00:00
|
|
|
else if (comp < 0) return -1;
|
2011-07-11 10:59:53 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* sort happens on each subtree individual */
|
2016-10-16 15:19:18 +02:00
|
|
|
static void outliner_sort(ListBase *lb)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
|
|
|
|
TreeElement *te;
|
|
|
|
|
TreeStoreElem *tselem;
|
2015-01-19 01:01:23 +01:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
te = lb->last;
|
2019-03-26 21:16:47 +11:00
|
|
|
if (te == NULL) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
tselem = TREESTORE(te);
|
2017-02-22 16:02:43 +01:00
|
|
|
|
2012-12-22 13:39:44 +00:00
|
|
|
/* sorting rules; only object lists, ID lists, or deformgroups */
|
2017-02-22 16:02:43 +01:00
|
|
|
if (ELEM(tselem->type, TSE_DEFGROUP, TSE_ID_BASE) || (tselem->type == 0 && te->idcode == ID_OB)) {
|
|
|
|
|
int totelem = BLI_listbase_count(lb);
|
|
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
if (totelem > 1) {
|
|
|
|
|
tTreeSort *tear = MEM_mallocN(totelem * sizeof(tTreeSort), "tree sort array");
|
|
|
|
|
tTreeSort *tp = tear;
|
|
|
|
|
int skip = 0;
|
|
|
|
|
|
|
|
|
|
for (te = lb->first; te; te = te->next, tp++) {
|
|
|
|
|
tselem = TREESTORE(te);
|
|
|
|
|
tp->te = te;
|
|
|
|
|
tp->name = te->name;
|
|
|
|
|
tp->idcode = te->idcode;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (tselem->type && tselem->type != TSE_DEFGROUP) {
|
2012-12-22 13:39:44 +00:00
|
|
|
tp->idcode = 0; // don't sort this
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
|
|
|
|
if (tselem->type == TSE_ID_BASE) {
|
2012-12-22 13:39:44 +00:00
|
|
|
tp->idcode = 1; // do sort this
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
tp->id = tselem->id;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-12-22 13:39:44 +00:00
|
|
|
/* just sort alphabetically */
|
|
|
|
|
if (tear->idcode == 1) {
|
|
|
|
|
qsort(tear, totelem, sizeof(tTreeSort), treesort_alpha);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* keep beginning of list */
|
2019-03-26 21:16:47 +11:00
|
|
|
for (tp = tear, skip = 0; skip < totelem; skip++, tp++) {
|
|
|
|
|
if (tp->idcode) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (skip < totelem) {
|
2012-12-22 13:39:44 +00:00
|
|
|
qsort(tear + skip, totelem - skip, sizeof(tTreeSort), treesort_alpha_ob);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2012-12-22 13:39:44 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-02-08 06:07:10 +11:00
|
|
|
BLI_listbase_clear(lb);
|
2012-05-07 17:56:30 +00:00
|
|
|
tp = tear;
|
2012-03-24 06:38:07 +00:00
|
|
|
while (totelem--) {
|
2011-07-11 10:59:53 +00:00
|
|
|
BLI_addtail(lb, tp->te);
|
|
|
|
|
tp++;
|
|
|
|
|
}
|
|
|
|
|
MEM_freeN(tear);
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
for (te = lb->first; te; te = te->next) {
|
2016-10-16 15:19:18 +02:00
|
|
|
outliner_sort(&te->subtree);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Filtering ----------------------------------------------- */
|
|
|
|
|
|
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
|
|
|
typedef struct OutlinerTreeElementFocus {
|
|
|
|
|
TreeStoreElem *tselem;
|
|
|
|
|
int ys;
|
|
|
|
|
} OutlinerTreeElementFocus;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Bring the outliner scrolling back to where it was in relation to the original focus element
|
|
|
|
|
* Caller is expected to handle redrawing of ARegion.
|
|
|
|
|
*/
|
2019-02-16 09:47:19 +11:00
|
|
|
static void outliner_restore_scrolling_position(SpaceOutliner *soops, ARegion *ar, OutlinerTreeElementFocus *focus)
|
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
|
|
|
{
|
|
|
|
|
View2D *v2d = &ar->v2d;
|
|
|
|
|
int ytop;
|
|
|
|
|
|
|
|
|
|
if (focus->tselem != NULL) {
|
|
|
|
|
outliner_set_coordinates(ar, soops);
|
|
|
|
|
|
|
|
|
|
TreeElement *te_new = outliner_find_tree_element(&soops->tree, focus->tselem);
|
|
|
|
|
|
|
|
|
|
if (te_new != NULL) {
|
|
|
|
|
int ys_new, ys_old;
|
|
|
|
|
|
|
|
|
|
ys_new = te_new->ys;
|
|
|
|
|
ys_old = focus->ys;
|
|
|
|
|
|
|
|
|
|
ytop = v2d->cur.ymax + (ys_new - ys_old) -1;
|
2019-03-26 21:16:47 +11:00
|
|
|
if (ytop > 0) {
|
|
|
|
|
ytop = 0;
|
|
|
|
|
}
|
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
|
|
|
|
|
|
|
|
v2d->cur.ymax = (float)ytop;
|
|
|
|
|
v2d->cur.ymin = (float)(ytop - BLI_rcti_size_y(&v2d->mask));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool test_collection_callback(TreeElement *te)
|
|
|
|
|
{
|
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
|
|
|
return outliner_is_collection_tree_element(te);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool test_object_callback(TreeElement *te)
|
|
|
|
|
{
|
|
|
|
|
TreeStoreElem *tselem = TREESTORE(te);
|
|
|
|
|
return ((tselem->type == 0) && (te->idcode == ID_OB));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* See if TreeElement or any of its children pass the callback_test.
|
|
|
|
|
*/
|
|
|
|
|
static TreeElement *outliner_find_first_desired_element_at_y_recursive(
|
2019-02-16 09:47:19 +11:00
|
|
|
const SpaceOutliner *soops,
|
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
|
|
|
TreeElement *te,
|
|
|
|
|
const float limit,
|
|
|
|
|
bool (*callback_test)(TreeElement *))
|
|
|
|
|
{
|
|
|
|
|
if (callback_test(te)) {
|
|
|
|
|
return te;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (TSELEM_OPEN(te->store_elem, soops)) {
|
|
|
|
|
TreeElement *te_iter, *te_sub;
|
|
|
|
|
for (te_iter = te->subtree.first; te_iter; te_iter = te_iter->next) {
|
|
|
|
|
te_sub = outliner_find_first_desired_element_at_y_recursive(soops, te_iter, limit, callback_test);
|
|
|
|
|
if (te_sub != NULL) {
|
|
|
|
|
return te_sub;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Find the first element that passes a test starting from a reference vertical coordinate
|
|
|
|
|
*
|
|
|
|
|
* If the element that is in the position is not what we are looking for, keep looking for its
|
2019-03-08 17:48:49 +11:00
|
|
|
* children, siblings, and eventually, aunts, cousins, distant families, ... etc.
|
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
|
|
|
*
|
|
|
|
|
* Basically we keep going up and down the outliner tree from that point forward, until we find
|
|
|
|
|
* what we are looking for. If we are past the visible range and we can't find a valid element
|
|
|
|
|
* we return NULL.
|
|
|
|
|
*/
|
|
|
|
|
static TreeElement *outliner_find_first_desired_element_at_y(
|
2019-02-16 09:47:19 +11:00
|
|
|
const SpaceOutliner *soops,
|
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
|
|
|
const float view_co,
|
|
|
|
|
const float view_co_limit)
|
|
|
|
|
{
|
|
|
|
|
TreeElement *te, *te_sub;
|
|
|
|
|
te = outliner_find_item_at_y(soops, &soops->tree, view_co);
|
|
|
|
|
|
|
|
|
|
bool (*callback_test)(TreeElement *);
|
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
|
|
|
if ((soops->outlinevis == SO_VIEW_LAYER) &&
|
2018-05-20 08:52:10 +02:00
|
|
|
(soops->filter & SO_FILTER_NO_COLLECTION))
|
|
|
|
|
{
|
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
|
|
|
callback_test = test_object_callback;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
callback_test = test_collection_callback;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (te != NULL) {
|
|
|
|
|
te_sub = outliner_find_first_desired_element_at_y_recursive(soops, te, view_co_limit, callback_test);
|
|
|
|
|
if (te_sub != NULL) {
|
|
|
|
|
/* Skip the element if it was not visible to start with. */
|
|
|
|
|
if (te->ys + UI_UNIT_Y > view_co_limit) {
|
|
|
|
|
return te_sub;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (te->next) {
|
|
|
|
|
te = te->next;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (te->parent == NULL) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (te->parent) {
|
|
|
|
|
if (te->parent->next) {
|
|
|
|
|
te = te->parent->next;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
te = te->parent;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Store information of current outliner scrolling status to be restored later
|
|
|
|
|
*
|
|
|
|
|
* Finds the top-most collection visible in the outliner and populates the OutlinerTreeElementFocus
|
|
|
|
|
* struct to retrieve this element later to make sure it is in the same original position as before filtering
|
|
|
|
|
*/
|
2019-02-16 09:47:19 +11:00
|
|
|
static void outliner_store_scrolling_position(SpaceOutliner *soops, ARegion *ar, OutlinerTreeElementFocus *focus)
|
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
|
|
|
{
|
|
|
|
|
TreeElement *te;
|
|
|
|
|
float limit = ar->v2d.cur.ymin;
|
|
|
|
|
|
|
|
|
|
outliner_set_coordinates(ar, soops);
|
|
|
|
|
|
|
|
|
|
te = outliner_find_first_desired_element_at_y(soops, ar->v2d.cur.ymax, limit);
|
|
|
|
|
|
|
|
|
|
if (te != NULL) {
|
|
|
|
|
focus->tselem = TREESTORE(te);
|
|
|
|
|
focus->ys = te->ys;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
focus->tselem = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 09:47:19 +11:00
|
|
|
static int outliner_exclude_filter_get(SpaceOutliner *soops)
|
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
|
|
|
{
|
2018-05-09 13:40:34 +02:00
|
|
|
int exclude_filter = soops->filter & ~SO_FILTER_OB_STATE;
|
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
|
|
|
|
2018-06-25 12:14:38 +02:00
|
|
|
if (soops->search_string[0] != 0) {
|
|
|
|
|
exclude_filter |= SO_FILTER_SEARCH;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
exclude_filter &= ~SO_FILTER_SEARCH;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Let's have this for the collection options at first. */
|
|
|
|
|
if (!SUPPORT_FILTER_OUTLINER(soops)) {
|
|
|
|
|
return (exclude_filter & SO_FILTER_SEARCH);
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
if (soops->filter & SO_FILTER_NO_OBJECT) {
|
|
|
|
|
exclude_filter |= SO_FILTER_OB_TYPE;
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-09 13:40:34 +02:00
|
|
|
switch (soops->filter_state) {
|
|
|
|
|
case SO_FILTER_OB_VISIBLE:
|
|
|
|
|
exclude_filter |= SO_FILTER_OB_STATE_VISIBLE;
|
|
|
|
|
break;
|
|
|
|
|
case SO_FILTER_OB_SELECTED:
|
|
|
|
|
exclude_filter |= SO_FILTER_OB_STATE_SELECTED;
|
|
|
|
|
break;
|
|
|
|
|
case SO_FILTER_OB_ACTIVE:
|
|
|
|
|
exclude_filter |= SO_FILTER_OB_STATE_ACTIVE;
|
|
|
|
|
break;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return exclude_filter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool outliner_element_visible_get(ViewLayer *view_layer, TreeElement *te, const int exclude_filter)
|
|
|
|
|
{
|
2018-05-09 13:40:34 +02:00
|
|
|
if ((exclude_filter & SO_FILTER_ANY) == 0) {
|
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
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TreeStoreElem *tselem = TREESTORE(te);
|
|
|
|
|
if ((tselem->type == 0) && (te->idcode == ID_OB)) {
|
2018-05-09 13:40:34 +02:00
|
|
|
if ((exclude_filter & SO_FILTER_OB_TYPE) == SO_FILTER_OB_TYPE) {
|
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
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Object *ob = (Object *)tselem->id;
|
|
|
|
|
Base *base = (Base *)te->directdata;
|
|
|
|
|
BLI_assert((base == NULL) || (base->object == ob));
|
|
|
|
|
|
|
|
|
|
if (exclude_filter & SO_FILTER_OB_TYPE) {
|
|
|
|
|
switch (ob->type) {
|
|
|
|
|
case OB_MESH:
|
|
|
|
|
if (exclude_filter & SO_FILTER_NO_OB_MESH) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case OB_ARMATURE:
|
|
|
|
|
if (exclude_filter & SO_FILTER_NO_OB_ARMATURE) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case OB_EMPTY:
|
|
|
|
|
if (exclude_filter & SO_FILTER_NO_OB_EMPTY) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case OB_LAMP:
|
|
|
|
|
if (exclude_filter & SO_FILTER_NO_OB_LAMP) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case OB_CAMERA:
|
|
|
|
|
if (exclude_filter & SO_FILTER_NO_OB_CAMERA) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
if (exclude_filter & SO_FILTER_NO_OB_OTHERS) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (exclude_filter & SO_FILTER_OB_STATE) {
|
|
|
|
|
if (base == NULL) {
|
|
|
|
|
base = BKE_view_layer_base_find(view_layer, ob);
|
|
|
|
|
|
|
|
|
|
if (base == NULL) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (exclude_filter & SO_FILTER_OB_STATE_VISIBLE) {
|
2018-06-25 13:50:11 +02:00
|
|
|
if ((base->flag & BASE_VISIBLE) == 0) {
|
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
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (exclude_filter & SO_FILTER_OB_STATE_SELECTED) {
|
|
|
|
|
if ((base->flag & BASE_SELECTED) == 0) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
BLI_assert(exclude_filter & SO_FILTER_OB_STATE_ACTIVE);
|
|
|
|
|
if (base != BASACT(view_layer)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((te->parent != NULL) &&
|
|
|
|
|
(TREESTORE(te->parent)->type == 0) && (te->parent->idcode == ID_OB))
|
|
|
|
|
{
|
|
|
|
|
if (exclude_filter & SO_FILTER_NO_CHILDREN) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (te->parent != NULL &&
|
2018-04-19 07:47:03 +02:00
|
|
|
TREESTORE(te->parent)->type == 0 && te->parent->idcode == ID_OB)
|
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
|
|
|
{
|
|
|
|
|
if (exclude_filter & SO_FILTER_NO_OB_CONTENT) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-03 10:13:02 +01:00
|
|
|
static bool outliner_filter_has_name(TreeElement *te, const char *name, int flags)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
2012-05-07 17:56:30 +00:00
|
|
|
int fn_flag = 0;
|
2015-01-03 10:13:02 +01:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if ((flags & SO_FIND_CASE_SENSITIVE) == 0) {
|
2011-07-11 10:59:53 +00:00
|
|
|
fn_flag |= FNM_CASEFOLD;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2015-01-03 10:13:02 +01:00
|
|
|
return fnmatch(name, te->name, fn_flag) == 0;
|
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
|
|
|
static int outliner_filter_subtree(
|
2019-02-16 09:47:19 +11:00
|
|
|
SpaceOutliner *soops, ViewLayer *view_layer, ListBase *lb, const char *search_string, const int exclude_filter)
|
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
|
|
|
TreeElement *te, *te_next;
|
2011-07-11 10:59:53 +00:00
|
|
|
TreeStoreElem *tselem;
|
2015-01-03 10:13:02 +01: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
|
|
|
for (te = lb->first; te; te = te_next) {
|
|
|
|
|
te_next = te->next;
|
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
|
|
|
if ((outliner_element_visible_get(view_layer, te, exclude_filter) == false)) {
|
|
|
|
|
outliner_free_tree_element(te, lb);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else if ((exclude_filter & SO_FILTER_SEARCH) == 0) {
|
|
|
|
|
/* Filter subtree too. */
|
|
|
|
|
outliner_filter_subtree(soops, view_layer, &te->subtree, search_string, exclude_filter);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2015-01-03 10:13:02 +01:00
|
|
|
|
|
|
|
|
if (!outliner_filter_has_name(te, search_string, soops->search_flags)) {
|
2011-07-11 10:59:53 +00:00
|
|
|
/* item isn't something we're looking for, but...
|
2018-11-14 12:53:15 +11:00
|
|
|
* - if the subtree is expanded, check if there are any matches that can be easily found
|
|
|
|
|
* so that searching for "cu" in the default scene will still match the Cube
|
|
|
|
|
* - otherwise, we can't see within the subtree and the item doesn't match,
|
|
|
|
|
* so these can be safely ignored (i.e. the subtree can get freed)
|
2011-07-11 10:59:53 +00:00
|
|
|
*/
|
2012-05-07 17:56:30 +00:00
|
|
|
tselem = TREESTORE(te);
|
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
|
|
|
|
2011-09-09 12:46:07 +00:00
|
|
|
/* flag as not a found item */
|
|
|
|
|
tselem->flag &= ~TSE_SEARCHMATCH;
|
2018-06-04 09:31:30 +02: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
|
|
|
if ((!TSELEM_OPEN(tselem, soops)) ||
|
|
|
|
|
outliner_filter_subtree(soops, view_layer, &te->subtree, search_string, exclude_filter) == 0)
|
|
|
|
|
{
|
2018-01-10 22:45:44 +01:00
|
|
|
outliner_free_tree_element(te, lb);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2012-05-07 17:56:30 +00:00
|
|
|
tselem = TREESTORE(te);
|
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
|
|
|
|
2011-09-09 12:46:07 +00:00
|
|
|
/* flag as a found item - we can then highlight it */
|
|
|
|
|
tselem->flag |= TSE_SEARCHMATCH;
|
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
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* filter subtree too */
|
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
|
|
|
outliner_filter_subtree(soops, view_layer, &te->subtree, search_string, exclude_filter);
|
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
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* if there are still items in the list, that means that there were still some matches */
|
2014-02-08 06:07:10 +11:00
|
|
|
return (BLI_listbase_is_empty(lb) == false);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
|
2019-02-16 09:47:19 +11:00
|
|
|
static void outliner_filter_tree(SpaceOutliner *soops, ViewLayer *view_layer)
|
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
|
|
|
{
|
2019-02-16 09:47:19 +11:00
|
|
|
char search_buff[sizeof(((struct SpaceOutliner *)NULL)->search_string) + 2];
|
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
|
|
|
char *search_string;
|
|
|
|
|
|
|
|
|
|
const int exclude_filter = outliner_exclude_filter_get(soops);
|
|
|
|
|
|
|
|
|
|
if (exclude_filter == 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (soops->search_flags & SO_FIND_COMPLETE) {
|
|
|
|
|
search_string = soops->search_string;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* Implicitly add heading/trailing wildcards if needed. */
|
|
|
|
|
BLI_strncpy_ensure_pad(search_buff, soops->search_string, '*', sizeof(search_buff));
|
|
|
|
|
search_string = search_buff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
outliner_filter_subtree(soops, view_layer, &soops->tree, search_string, exclude_filter);
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* ======================================================= */
|
|
|
|
|
/* Main Tree Building API */
|
|
|
|
|
|
|
|
|
|
/* Main entry point for building the tree data-structure that the outliner represents */
|
|
|
|
|
// TODO: split each mode into its own function?
|
2019-02-16 09:47:19 +11:00
|
|
|
void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, SpaceOutliner *soops, ARegion *ar)
|
2011-07-11 10:59:53 +00:00
|
|
|
{
|
2012-05-07 17:56:30 +00:00
|
|
|
TreeElement *te = NULL, *ten;
|
2011-07-11 10:59:53 +00:00
|
|
|
TreeStoreElem *tselem;
|
2019-01-15 23:24:20 +11:00
|
|
|
/* on first view, we open scenes */
|
|
|
|
|
int show_opened = !soops->treestore || !BLI_mempool_len(soops->treestore);
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2011-09-09 12:46:07 +00:00
|
|
|
/* Are we looking for something - we want to tag parents to filter child matches
|
2012-03-03 16:31:46 +00:00
|
|
|
* - NOT in datablocks view - searching all datablocks takes way too long to be useful
|
|
|
|
|
* - this variable is only set once per tree build */
|
2019-03-26 21:16:47 +11:00
|
|
|
if (soops->search_string[0] != 0 && soops->outlinevis != SO_DATA_API) {
|
2011-09-09 12:46:07 +00:00
|
|
|
soops->search_flags |= SO_SEARCH_RECURSIVE;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
|
|
|
|
else {
|
2011-09-09 12:46:07 +00:00
|
|
|
soops->search_flags &= ~SO_SEARCH_RECURSIVE;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2011-09-09 12:46:07 +00:00
|
|
|
|
2018-08-20 15:08:45 +02:00
|
|
|
if (soops->treehash && (soops->storeflag & SO_TREESTORE_REBUILD) && soops->treestore) {
|
2015-05-11 11:06:35 +10:00
|
|
|
soops->storeflag &= ~SO_TREESTORE_REBUILD;
|
|
|
|
|
BKE_outliner_treehash_rebuild_from_treestore(soops->treehash, soops->treestore);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-15 17:07:13 +02:00
|
|
|
if (ar->do_draw & RGN_DRAW_NO_REBUILD) {
|
2011-07-11 10:59:53 +00:00
|
|
|
return;
|
2018-05-15 12:49:38 +02:00
|
|
|
}
|
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
|
|
|
OutlinerTreeElementFocus focus;
|
|
|
|
|
outliner_store_scrolling_position(soops, ar, &focus);
|
|
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
outliner_free_tree(&soops->tree);
|
|
|
|
|
outliner_storage_cleanup(soops);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
/* options */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (soops->outlinevis == SO_LIBRARIES) {
|
2011-07-11 10:59:53 +00:00
|
|
|
Library *lib;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-12-22 17:32:56 +00:00
|
|
|
/* current file first - mainvar provides tselem with unique pointer - not used */
|
2018-05-23 14:37:43 +02:00
|
|
|
ten = outliner_add_library_contents(mainvar, soops, &soops->tree, NULL);
|
|
|
|
|
if (ten) {
|
|
|
|
|
tselem = TREESTORE(ten);
|
2019-03-26 21:16:47 +11:00
|
|
|
if (!tselem->used) {
|
2018-05-23 14:37:43 +02:00
|
|
|
tselem->flag &= ~TSE_CLOSED;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2018-05-23 14:37:43 +02:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-08 09:29:17 +11:00
|
|
|
for (lib = mainvar->libraries.first; lib; lib = lib->id.next) {
|
2018-05-23 14:37:43 +02:00
|
|
|
ten = outliner_add_library_contents(mainvar, soops, &soops->tree, lib);
|
|
|
|
|
if (ten) {
|
|
|
|
|
lib->id.newid = (ID *)ten;
|
|
|
|
|
}
|
2012-12-22 16:49:50 +00:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
/* make hierarchy */
|
2012-05-07 17:56:30 +00:00
|
|
|
ten = soops->tree.first;
|
2018-07-12 13:37:29 +02:00
|
|
|
if (ten != NULL) {
|
|
|
|
|
ten = ten->next; /* first one is main */
|
|
|
|
|
while (ten) {
|
|
|
|
|
TreeElement *nten = ten->next, *par;
|
|
|
|
|
tselem = TREESTORE(ten);
|
|
|
|
|
lib = (Library *)tselem->id;
|
|
|
|
|
if (lib && lib->parent) {
|
|
|
|
|
par = (TreeElement *)lib->parent->id.newid;
|
|
|
|
|
if (tselem->id->tag & LIB_TAG_INDIRECT) {
|
|
|
|
|
/* Only remove from 'first level' if lib is not also directly used. */
|
|
|
|
|
BLI_remlink(&soops->tree, ten);
|
|
|
|
|
BLI_addtail(&par->subtree, ten);
|
|
|
|
|
ten->parent = par;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* Else, make a new copy of the libtree for our parent. */
|
|
|
|
|
TreeElement *dupten = outliner_add_library_contents(mainvar, soops, &par->subtree, lib);
|
|
|
|
|
if (dupten) {
|
|
|
|
|
dupten->parent = par;
|
|
|
|
|
}
|
2018-05-23 14:37:43 +02:00
|
|
|
}
|
2015-01-05 11:28:34 +01:00
|
|
|
}
|
2018-07-12 13:37:29 +02:00
|
|
|
ten = nten;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* restore newid pointers */
|
2019-03-26 21:16:47 +11:00
|
|
|
for (lib = mainvar->libraries.first; lib; lib = lib->id.next) {
|
2012-05-07 17:56:30 +00:00
|
|
|
lib->id.newid = NULL;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2018-01-18 18:30:30 -02:00
|
|
|
else if (soops->outlinevis == SO_SCENES) {
|
2011-07-11 10:59:53 +00:00
|
|
|
Scene *sce;
|
2019-03-08 09:29:17 +11:00
|
|
|
for (sce = mainvar->scenes.first; sce; sce = sce->id.next) {
|
2018-04-05 18:20:27 +02:00
|
|
|
te = outliner_add_element(soops, &soops->tree, sce, NULL, 0, 0);
|
2012-05-07 17:56:30 +00:00
|
|
|
tselem = TREESTORE(te);
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
|
2018-01-18 18:30:30 -02:00
|
|
|
if (sce == scene && show_opened) {
|
|
|
|
|
tselem->flag &= ~TSE_CLOSED;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
|
2018-04-23 20:39:05 +02:00
|
|
|
outliner_make_object_parent_hierarchy(&te->subtree);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
else if (soops->outlinevis == SO_SEQUENCE) {
|
2011-07-11 10:59:53 +00:00
|
|
|
Sequence *seq;
|
2014-03-20 15:45:20 +06:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, false);
|
2011-07-11 10:59:53 +00:00
|
|
|
int op;
|
|
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (ed == NULL) {
|
2011-07-11 10:59:53 +00:00
|
|
|
return;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2012-05-07 17:56:30 +00:00
|
|
|
seq = ed->seqbasep->first;
|
2019-03-26 21:16:47 +11:00
|
|
|
if (!seq) {
|
2011-07-11 10:59:53 +00:00
|
|
|
return;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
while (seq) {
|
2012-05-07 17:56:30 +00:00
|
|
|
op = need_add_seq_dup(seq);
|
|
|
|
|
if (op == 1) {
|
2018-04-05 18:20:27 +02:00
|
|
|
/* ten = */ outliner_add_element(soops, &soops->tree, (void *)seq, NULL, TSE_SEQUENCE, 0);
|
2011-09-22 14:42:29 +00:00
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
else if (op == 0) {
|
2018-04-05 18:20:27 +02:00
|
|
|
ten = outliner_add_element(soops, &soops->tree, (void *)seq, NULL, TSE_SEQUENCE_DUP, 0);
|
|
|
|
|
outliner_add_seq_dup(soops, seq, ten, 0);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
2012-05-07 17:56:30 +00:00
|
|
|
seq = seq->next;
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
2018-05-17 12:20:10 +02:00
|
|
|
else if (soops->outlinevis == SO_DATA_API) {
|
2011-07-11 10:59:53 +00:00
|
|
|
PointerRNA mainptr;
|
|
|
|
|
|
|
|
|
|
RNA_main_pointer_create(mainvar, &mainptr);
|
|
|
|
|
|
2018-04-05 18:20:27 +02:00
|
|
|
ten = outliner_add_element(soops, &soops->tree, (void *)&mainptr, NULL, TSE_RNA_STRUCT, -1);
|
2011-07-11 10:59:53 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (show_opened) {
|
2012-05-07 17:56:30 +00:00
|
|
|
tselem = TREESTORE(ten);
|
2011-07-11 10:59:53 +00:00
|
|
|
tselem->flag &= ~TSE_CLOSED;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-02-15 21:55:49 +13:00
|
|
|
else if (soops->outlinevis == SO_ID_ORPHANS) {
|
2018-04-05 18:20:27 +02:00
|
|
|
outliner_add_orphaned_datablocks(mainvar, soops);
|
2015-02-15 21:55:49 +13:00
|
|
|
}
|
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
|
|
|
else if (soops->outlinevis == SO_VIEW_LAYER) {
|
2018-05-09 13:40:34 +02:00
|
|
|
if (soops->filter & SO_FILTER_NO_COLLECTION) {
|
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
|
|
|
/* Show objects in the view layer. */
|
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
|
|
|
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
|
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 *te_object = outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
|
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
|
|
|
te_object->directdata = base;
|
|
|
|
|
}
|
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
|
|
|
|
|
|
|
|
outliner_make_object_parent_hierarchy(&soops->tree);
|
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
|
|
|
}
|
|
|
|
|
else {
|
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
|
|
|
/* Show collections in the view layer. */
|
|
|
|
|
ten = outliner_add_element(soops, &soops->tree, scene, NULL, TSE_VIEW_COLLECTION_BASE, 0);
|
|
|
|
|
ten->name = IFACE_("Scene Collection");
|
|
|
|
|
TREESTORE(ten)->flag &= ~TSE_CLOSED;
|
|
|
|
|
|
|
|
|
|
bool show_objects = !(soops->filter & SO_FILTER_NO_OBJECT);
|
|
|
|
|
outliner_add_view_layer(soops, &ten->subtree, ten, view_layer, show_objects);
|
2017-12-29 09:55:13 -02:00
|
|
|
}
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|
|
|
|
|
|
2017-02-26 19:24:01 +01:00
|
|
|
if ((soops->flag & SO_SKIP_SORT_ALPHA) == 0) {
|
|
|
|
|
outliner_sort(&soops->tree);
|
|
|
|
|
}
|
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
|
|
|
|
|
|
|
|
outliner_filter_tree(soops, view_layer);
|
|
|
|
|
outliner_restore_scrolling_position(soops, ar, &focus);
|
2016-11-30 15:25:54 +01:00
|
|
|
|
|
|
|
|
BKE_main_id_clear_newpoins(mainvar);
|
2011-07-11 10:59:53 +00:00
|
|
|
}
|