2017-10-23 17:46:35 -02: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
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup RNA
|
2017-10-23 17:46:35 -02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "DNA_layer_types.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "DNA_scene_types.h"
|
2018-04-19 09:45:52 +02:00
|
|
|
#include "DNA_view3d_types.h"
|
2017-10-23 17:46:35 -02:00
|
|
|
|
|
|
|
|
#include "BLT_translation.h"
|
|
|
|
|
|
|
|
|
|
#include "ED_object.h"
|
|
|
|
|
#include "ED_render.h"
|
|
|
|
|
|
|
|
|
|
#include "RE_engine.h"
|
|
|
|
|
|
|
|
|
|
#include "WM_api.h"
|
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
|
|
|
|
#include "RNA_define.h"
|
|
|
|
|
|
|
|
|
|
#include "rna_internal.h"
|
|
|
|
|
|
|
|
|
|
#ifdef RNA_RUNTIME
|
|
|
|
|
|
2018-06-07 12:37:48 +02:00
|
|
|
# ifdef WITH_PYTHON
|
|
|
|
|
# include "BPY_extern.h"
|
|
|
|
|
# endif
|
|
|
|
|
|
2018-08-29 15:32:50 +02:00
|
|
|
# include "DNA_collection_types.h"
|
2017-10-23 17:46:35 -02:00
|
|
|
# include "DNA_object_types.h"
|
|
|
|
|
|
|
|
|
|
# include "RNA_access.h"
|
|
|
|
|
|
|
|
|
|
# include "BKE_idprop.h"
|
|
|
|
|
# include "BKE_layer.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
# include "BKE_mesh.h"
|
2017-10-23 17:46:35 -02:00
|
|
|
# include "BKE_node.h"
|
|
|
|
|
# include "BKE_scene.h"
|
2017-10-24 09:18:35 -02:00
|
|
|
|
2020-04-03 17:38:58 +02:00
|
|
|
# include "BLI_listbase.h"
|
|
|
|
|
|
2017-10-23 17:46:35 -02:00
|
|
|
# include "DEG_depsgraph_build.h"
|
|
|
|
|
# include "DEG_depsgraph_query.h"
|
|
|
|
|
|
|
|
|
|
/***********************************/
|
|
|
|
|
|
2018-11-06 17:20:49 +01:00
|
|
|
static PointerRNA rna_ViewLayer_active_layer_collection_get(PointerRNA *ptr)
|
2017-10-23 17:46:35 -02:00
|
|
|
{
|
2017-11-22 10:52:39 -02:00
|
|
|
ViewLayer *view_layer = (ViewLayer *)ptr->data;
|
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 = view_layer->active_collection;
|
2017-10-23 17:46:35 -02:00
|
|
|
return rna_pointer_inherit_refine(ptr, &RNA_LayerCollection, lc);
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-20 18:06:09 +10:00
|
|
|
static void rna_ViewLayer_active_layer_collection_set(PointerRNA *ptr,
|
|
|
|
|
PointerRNA value,
|
|
|
|
|
struct ReportList *UNUSED(reports))
|
2017-10-23 17:46:35 -02:00
|
|
|
{
|
2017-11-22 10:52:39 -02:00
|
|
|
ViewLayer *view_layer = (ViewLayer *)ptr->data;
|
2017-10-23 17:46:35 -02:00
|
|
|
LayerCollection *lc = (LayerCollection *)value.data;
|
2017-11-22 10:52:39 -02:00
|
|
|
const int index = BKE_layer_collection_findindex(view_layer, lc);
|
2018-11-06 17:20:49 +01:00
|
|
|
if (index != -1) {
|
|
|
|
|
BKE_layer_collection_activate(view_layer, lc);
|
|
|
|
|
}
|
2017-10-23 17:46:35 -02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PointerRNA rna_LayerObjects_active_object_get(PointerRNA *ptr)
|
|
|
|
|
{
|
2017-11-22 10:52:39 -02:00
|
|
|
ViewLayer *view_layer = (ViewLayer *)ptr->data;
|
|
|
|
|
return rna_pointer_inherit_refine(
|
|
|
|
|
ptr, &RNA_Object, view_layer->basact ? view_layer->basact->object : NULL);
|
2017-10-23 17:46:35 -02:00
|
|
|
}
|
|
|
|
|
|
2019-05-20 18:06:09 +10:00
|
|
|
static void rna_LayerObjects_active_object_set(PointerRNA *ptr,
|
|
|
|
|
PointerRNA value,
|
2020-02-10 21:58:52 +11:00
|
|
|
struct ReportList *reports)
|
2017-10-23 17:46:35 -02:00
|
|
|
{
|
2017-11-22 10:52:39 -02:00
|
|
|
ViewLayer *view_layer = (ViewLayer *)ptr->data;
|
2019-06-04 00:21:57 +10:00
|
|
|
if (value.data) {
|
2020-02-10 21:58:52 +11:00
|
|
|
Object *ob = value.data;
|
|
|
|
|
Base *basact_test = BKE_view_layer_base_find(view_layer, ob);
|
|
|
|
|
if (basact_test != NULL) {
|
|
|
|
|
view_layer->basact = basact_test;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
BKE_reportf(reports,
|
|
|
|
|
RPT_ERROR,
|
|
|
|
|
"ViewLayer '%s' does not contain object '%s'",
|
|
|
|
|
view_layer->name,
|
|
|
|
|
ob->id.name + 2);
|
|
|
|
|
}
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2017-11-22 10:52:39 -02:00
|
|
|
view_layer->basact = NULL;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2017-10-23 17:46:35 -02:00
|
|
|
}
|
|
|
|
|
|
2018-04-24 15:20:17 +02:00
|
|
|
static char *rna_ViewLayer_path(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
ViewLayer *srl = (ViewLayer *)ptr->data;
|
|
|
|
|
char name_esc[sizeof(srl->name) * 2];
|
|
|
|
|
|
2020-12-10 13:25:49 +11:00
|
|
|
BLI_str_escape(name_esc, srl->name, sizeof(name_esc));
|
2018-04-24 15:20:17 +02:00
|
|
|
return BLI_sprintfN("view_layers[\"%s\"]", name_esc);
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-22 10:52:39 -02:00
|
|
|
static IDProperty *rna_ViewLayer_idprops(PointerRNA *ptr, bool create)
|
2017-10-23 17:46:35 -02:00
|
|
|
{
|
2017-11-22 10:52:39 -02:00
|
|
|
ViewLayer *view_layer = (ViewLayer *)ptr->data;
|
2017-10-23 17:46:35 -02:00
|
|
|
|
2017-11-22 10:52:39 -02:00
|
|
|
if (create && !view_layer->id_properties) {
|
2017-11-16 13:39:25 -02:00
|
|
|
IDPropertyTemplate val = {0};
|
2017-11-22 10:52:39 -02:00
|
|
|
view_layer->id_properties = IDP_New(IDP_GROUP, &val, "ViewLayer ID properties");
|
2017-11-16 13:39:25 -02:00
|
|
|
}
|
2017-10-23 17:46:35 -02:00
|
|
|
|
2017-11-22 10:52:39 -02:00
|
|
|
return view_layer->id_properties;
|
2017-11-16 13:39:25 -02:00
|
|
|
}
|
2017-10-23 17:46:35 -02:00
|
|
|
|
2019-08-19 14:25:29 -03:00
|
|
|
static bool rna_LayerCollection_visible_get(LayerCollection *layer_collection, bContext *C)
|
|
|
|
|
{
|
|
|
|
|
View3D *v3d = CTX_wm_view3d(C);
|
|
|
|
|
|
2019-10-03 19:22:36 -03:00
|
|
|
if ((v3d == NULL) || ((v3d->flag & V3D_LOCAL_COLLECTIONS) == 0)) {
|
|
|
|
|
return (layer_collection->runtime_flag & LAYER_COLLECTION_VISIBLE_VIEW_LAYER) != 0;
|
2019-08-19 14:25:29 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (v3d->local_collections_uuid & layer_collection->local_collections_bits) {
|
2019-10-03 19:22:36 -03:00
|
|
|
return (layer_collection->runtime_flag & LAYER_COLLECTION_RESTRICT_VIEWPORT) == 0;
|
2019-08-19 14:25:29 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-22 10:52:39 -02:00
|
|
|
static void rna_ViewLayer_update_render_passes(ID *id)
|
2017-11-16 13:39:25 -02:00
|
|
|
{
|
|
|
|
|
Scene *scene = (Scene *)id;
|
2019-06-04 00:21:57 +10:00
|
|
|
if (scene->nodetree) {
|
2017-11-16 13:39:25 -02:00
|
|
|
ntreeCompositUpdateRLayers(scene->nodetree);
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2020-12-04 08:13:54 +01:00
|
|
|
|
|
|
|
|
RenderEngineType *engine_type = RE_engines_find(scene->r.engine);
|
|
|
|
|
if (engine_type->update_render_passes) {
|
|
|
|
|
RenderEngine *engine = RE_engine_create(engine_type);
|
|
|
|
|
if (engine) {
|
|
|
|
|
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
|
|
|
|
|
BKE_view_layer_verify_aov(engine, scene, view_layer);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
RE_engine_free(engine);
|
|
|
|
|
engine = NULL;
|
2020-12-04 11:28:56 +01:00
|
|
|
}
|
|
|
|
|
}
|
2017-10-23 17:46:35 -02:00
|
|
|
|
2017-11-22 10:52:39 -02:00
|
|
|
static PointerRNA rna_ViewLayer_objects_get(CollectionPropertyIterator *iter)
|
2017-10-23 17:46:35 -02:00
|
|
|
{
|
|
|
|
|
ListBaseIterator *internal = &iter->internal.listbase;
|
|
|
|
|
|
2018-05-08 15:57:20 +02:00
|
|
|
/* we are actually iterating a ObjectBase list */
|
2017-10-23 17:46:35 -02:00
|
|
|
Base *base = (Base *)internal->link;
|
|
|
|
|
return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, base->object);
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-22 10:52:39 -02:00
|
|
|
static int rna_ViewLayer_objects_selected_skip(CollectionPropertyIterator *iter,
|
|
|
|
|
void *UNUSED(data))
|
2017-10-23 17:46:35 -02:00
|
|
|
{
|
|
|
|
|
ListBaseIterator *internal = &iter->internal.listbase;
|
|
|
|
|
Base *base = (Base *)internal->link;
|
|
|
|
|
|
|
|
|
|
if ((base->flag & BASE_SELECTED) != 0) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
};
|
|
|
|
|
|
2017-11-22 10:52:39 -02:00
|
|
|
static PointerRNA rna_ViewLayer_depsgraph_get(PointerRNA *ptr)
|
2017-11-03 17:27:13 +01:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
ID *id = ptr->owner_id;
|
2018-02-01 12:09:22 +01:00
|
|
|
if (GS(id->name) == ID_SCE) {
|
|
|
|
|
Scene *scene = (Scene *)id;
|
|
|
|
|
ViewLayer *view_layer = (ViewLayer *)ptr->data;
|
2020-08-21 11:56:03 +02:00
|
|
|
Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer);
|
2018-02-01 12:09:22 +01:00
|
|
|
return rna_pointer_inherit_refine(ptr, &RNA_Depsgraph, depsgraph);
|
|
|
|
|
}
|
|
|
|
|
return PointerRNA_NULL;
|
2017-11-03 17:27:13 +01:00
|
|
|
}
|
|
|
|
|
|
2017-10-23 17:46:35 -02:00
|
|
|
static void rna_LayerObjects_selected_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
|
|
|
|
{
|
2017-11-22 10:52:39 -02:00
|
|
|
ViewLayer *view_layer = (ViewLayer *)ptr->data;
|
|
|
|
|
rna_iterator_listbase_begin(
|
|
|
|
|
iter, &view_layer->object_bases, rna_ViewLayer_objects_selected_skip);
|
2017-10-23 17:46:35 -02:00
|
|
|
}
|
|
|
|
|
|
2019-10-10 12:25:23 +02:00
|
|
|
static void rna_ViewLayer_update_tagged(ID *id_ptr,
|
|
|
|
|
ViewLayer *view_layer,
|
|
|
|
|
Main *bmain,
|
|
|
|
|
ReportList *reports)
|
2017-10-23 17:46:35 -02:00
|
|
|
{
|
2019-10-10 12:25:23 +02:00
|
|
|
Scene *scene = (Scene *)id_ptr;
|
2020-08-21 11:56:03 +02:00
|
|
|
Depsgraph *depsgraph = BKE_scene_ensure_depsgraph(bmain, scene, view_layer);
|
2019-10-10 12:25:23 +02:00
|
|
|
|
|
|
|
|
if (DEG_is_evaluating(depsgraph)) {
|
|
|
|
|
BKE_report(reports, RPT_ERROR, "Dependency graph update requested during evaluation");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-07 12:37:48 +02:00
|
|
|
# ifdef WITH_PYTHON
|
|
|
|
|
/* Allow drivers to be evaluated */
|
|
|
|
|
BPy_BEGIN_ALLOW_THREADS;
|
|
|
|
|
# endif
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-07-25 16:36:22 +02:00
|
|
|
/* NOTE: This is similar to CTX_data_depsgraph_pointer(). Ideally such access would be
|
|
|
|
|
* de-duplicated across all possible cases, but for now this is safest and easiest way to go.
|
2019-07-04 13:10:09 +02:00
|
|
|
*
|
|
|
|
|
* The reason for this is that it's possible to have Python operator which asks view layer to
|
|
|
|
|
* be updated. After re-do of such operator view layer's dependency graph will not be marked
|
|
|
|
|
* as active. */
|
|
|
|
|
DEG_make_active(depsgraph);
|
2018-06-06 16:31:05 +02:00
|
|
|
BKE_scene_graph_update_tagged(depsgraph, bmain);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-07 12:37:48 +02:00
|
|
|
# ifdef WITH_PYTHON
|
|
|
|
|
BPy_END_ALLOW_THREADS;
|
|
|
|
|
# endif
|
2017-10-23 17:46:35 -02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_ObjectBase_select_update(Main *UNUSED(bmain),
|
|
|
|
|
Scene *UNUSED(scene),
|
|
|
|
|
PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
Base *base = (Base *)ptr->data;
|
|
|
|
|
short mode = (base->flag & BASE_SELECTED) ? BA_SELECT : BA_DESELECT;
|
|
|
|
|
ED_object_base_select(base, mode);
|
|
|
|
|
}
|
|
|
|
|
|
Outliner Visibility Update
See T61578 for discussions and mockups.
Visibility Options
==================
We are adding more granular control over restriction columns in the outliner,
exposing "indirect only" and "holdout" as options, and change the way
users enable/disable collections in a viewlayer.
We also rename the object viewport restriction to hide instance.
So the options we have are:
Collection
----------
* Render Visibility
* Instance Visibility
* Selectable
(View) Layer Collection
-----------------------
* Enable
* Holdout
* Indirect Only
* Viewport
Shortcuts
=========
Isolate Collection
------------------
* Ctr + click isolates the collection.
It turns all its parents and children "visible", and all the other
collections "invisible".
If ALL the collections were already properly set, we re-set the
collections to their default value.
Set Collection Inside Collections and Objects
---------------------------------------------
* Shift + click: Set/unset inside collections and objects.
We only set objects values as well when we are in View Layer mode and
(obviously) when the objects have a matching property.
Icons
=====
Little reminder that we will need better icons for holdout, indirect only, and
probably instanced (nothing wrong with the current, but it differs from
the proposal when it is turned off).
Also, we need to decide where do we want the modifier/bones/... icons to
be (in which column) and ideally make sure their icons match the ones we
use for collections/objects.
At the moment those are using the screen icon, which is not being used
by collections.
Reviewers: brecht, billrey
Subscribers: pablovazquez
Differential Revision: https://developer.blender.org/D4823
2019-05-04 14:14:37 -03:00
|
|
|
static void rna_ObjectBase_hide_viewport_update(bContext *C, PointerRNA *UNUSED(ptr))
|
|
|
|
|
{
|
|
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
|
ViewLayer *view_layer = CTX_data_view_layer(C);
|
|
|
|
|
BKE_layer_collection_sync(scene, view_layer);
|
|
|
|
|
DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
|
|
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-08 11:34:18 +01:00
|
|
|
static void rna_LayerCollection_name_get(struct PointerRNA *ptr, char *value)
|
|
|
|
|
{
|
|
|
|
|
ID *id = (ID *)((LayerCollection *)ptr->data)->collection;
|
|
|
|
|
BLI_strncpy(value, id->name + 2, sizeof(id->name) - 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int rna_LayerCollection_name_length(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
ID *id = (ID *)((LayerCollection *)ptr->data)->collection;
|
|
|
|
|
return strlen(id->name + 2);
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-31 13:17:16 -03:00
|
|
|
static void rna_LayerCollection_flag_set(PointerRNA *ptr, const bool value, const int flag)
|
|
|
|
|
{
|
|
|
|
|
LayerCollection *layer_collection = (LayerCollection *)ptr->data;
|
|
|
|
|
Collection *collection = layer_collection->collection;
|
|
|
|
|
|
|
|
|
|
if (collection->flag & COLLECTION_IS_MASTER) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (value) {
|
|
|
|
|
layer_collection->flag |= flag;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
layer_collection->flag &= ~flag;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_LayerCollection_exclude_set(PointerRNA *ptr, bool value)
|
|
|
|
|
{
|
|
|
|
|
rna_LayerCollection_flag_set(ptr, value, LAYER_COLLECTION_EXCLUDE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_LayerCollection_holdout_set(PointerRNA *ptr, bool value)
|
|
|
|
|
{
|
|
|
|
|
rna_LayerCollection_flag_set(ptr, value, LAYER_COLLECTION_HOLDOUT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_LayerCollection_indirect_only_set(PointerRNA *ptr, bool value)
|
|
|
|
|
{
|
|
|
|
|
rna_LayerCollection_flag_set(ptr, value, LAYER_COLLECTION_INDIRECT_ONLY);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_LayerCollection_hide_viewport_set(PointerRNA *ptr, bool value)
|
|
|
|
|
{
|
|
|
|
|
rna_LayerCollection_flag_set(ptr, value, LAYER_COLLECTION_HIDE);
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-30 02:24:06 -02:00
|
|
|
static void rna_LayerCollection_exclude_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
|
2017-10-23 17:46:35 -02:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Scene *scene = (Scene *)ptr->owner_id;
|
2018-05-20 08:52:10 +02:00
|
|
|
LayerCollection *lc = (LayerCollection *)ptr->data;
|
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 *view_layer = BKE_view_layer_find_from_collection(scene, lc);
|
2017-10-23 17:46:35 -02:00
|
|
|
|
2019-07-05 16:25:54 +10:00
|
|
|
/* Set/Unset it recursively to match the behavior of excluding via the menu or shortcuts. */
|
|
|
|
|
const bool exclude = (lc->flag & LAYER_COLLECTION_EXCLUDE) != 0;
|
2020-04-09 19:33:57 +02:00
|
|
|
BKE_layer_collection_set_flag(lc, LAYER_COLLECTION_EXCLUDE, exclude);
|
Outliner Visibility Update
See T61578 for discussions and mockups.
Visibility Options
==================
We are adding more granular control over restriction columns in the outliner,
exposing "indirect only" and "holdout" as options, and change the way
users enable/disable collections in a viewlayer.
We also rename the object viewport restriction to hide instance.
So the options we have are:
Collection
----------
* Render Visibility
* Instance Visibility
* Selectable
(View) Layer Collection
-----------------------
* Enable
* Holdout
* Indirect Only
* Viewport
Shortcuts
=========
Isolate Collection
------------------
* Ctr + click isolates the collection.
It turns all its parents and children "visible", and all the other
collections "invisible".
If ALL the collections were already properly set, we re-set the
collections to their default value.
Set Collection Inside Collections and Objects
---------------------------------------------
* Shift + click: Set/unset inside collections and objects.
We only set objects values as well when we are in View Layer mode and
(obviously) when the objects have a matching property.
Icons
=====
Little reminder that we will need better icons for holdout, indirect only, and
probably instanced (nothing wrong with the current, but it differs from
the proposal when it is turned off).
Also, we need to decide where do we want the modifier/bones/... icons to
be (in which column) and ideally make sure their icons match the ones we
use for collections/objects.
At the moment those are using the screen icon, which is not being used
by collections.
Reviewers: brecht, billrey
Subscribers: pablovazquez
Differential Revision: https://developer.blender.org/D4823
2019-05-04 14:14:37 -03:00
|
|
|
|
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
|
|
|
BKE_layer_collection_sync(scene, view_layer);
|
2017-10-23 17:46:35 -02:00
|
|
|
|
2020-11-26 17:30:20 +01:00
|
|
|
DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
|
2020-11-26 11:08:51 +01:00
|
|
|
if (!exclude) {
|
|
|
|
|
/* We need to update animation of objects added back to the scene through enabling this view
|
|
|
|
|
* layer. */
|
|
|
|
|
FOREACH_OBJECT_BEGIN (view_layer, ob) {
|
|
|
|
|
DEG_id_tag_update(&ob->id, ID_RECALC_ANIMATION);
|
|
|
|
|
}
|
|
|
|
|
FOREACH_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
|
|
|
DEG_relations_tag_update(bmain);
|
|
|
|
|
WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
|
2019-07-05 16:25:54 +10:00
|
|
|
if (exclude) {
|
|
|
|
|
ED_object_base_active_refresh(bmain, scene, view_layer);
|
|
|
|
|
}
|
2017-10-23 17:46:35 -02:00
|
|
|
}
|
|
|
|
|
|
2018-11-30 02:24:06 -02:00
|
|
|
static void rna_LayerCollection_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
|
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Scene *scene = (Scene *)ptr->owner_id;
|
2018-11-30 02:24:06 -02:00
|
|
|
LayerCollection *lc = (LayerCollection *)ptr->data;
|
|
|
|
|
ViewLayer *view_layer = BKE_view_layer_find_from_collection(scene, lc);
|
|
|
|
|
|
|
|
|
|
BKE_layer_collection_sync(scene, view_layer);
|
|
|
|
|
|
|
|
|
|
DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
|
|
|
|
|
|
|
|
|
|
WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-15 11:13:26 -02:00
|
|
|
static bool rna_LayerCollection_has_objects(LayerCollection *lc)
|
|
|
|
|
{
|
|
|
|
|
return (lc->runtime_flag & LAYER_COLLECTION_HAS_OBJECTS) != 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool rna_LayerCollection_has_selected_objects(LayerCollection *lc, ViewLayer *view_layer)
|
|
|
|
|
{
|
|
|
|
|
return BKE_layer_collection_has_selected_objects(view_layer, lc);
|
|
|
|
|
}
|
|
|
|
|
|
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
|
2017-10-23 17:46:35 -02:00
|
|
|
|
|
|
|
|
static void rna_def_layer_collection(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
2018-11-15 11:13:26 -02:00
|
|
|
FunctionRNA *func;
|
2017-10-23 17:46:35 -02:00
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-23 17:46:35 -02:00
|
|
|
srna = RNA_def_struct(brna, "LayerCollection", NULL);
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Layer Collection", "Layer collection");
|
2020-11-13 18:39:19 -07:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_OUTLINER_COLLECTION);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-23 17:46:35 -02:00
|
|
|
prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
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
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE | PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Collection");
|
2017-10-23 17:46:35 -02:00
|
|
|
RNA_def_property_ui_text(prop, "Collection", "Collection this layer collection is wrapping");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-11-08 11:34:18 +01:00
|
|
|
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "collection->id.name");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE | PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Name", "Name of this view layer (same as its collection one)");
|
|
|
|
|
RNA_def_property_string_funcs(
|
|
|
|
|
prop, "rna_LayerCollection_name_get", "rna_LayerCollection_name_length", NULL);
|
|
|
|
|
RNA_def_struct_name_property(srna, prop);
|
2019-04-17 06:17:24 +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
|
|
|
prop = RNA_def_property(srna, "children", PROP_COLLECTION, PROP_NONE);
|
2017-10-23 17:46:35 -02:00
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "layer_collections", NULL);
|
|
|
|
|
RNA_def_property_struct_type(prop, "LayerCollection");
|
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
|
|
|
RNA_def_property_ui_text(prop, "Children", "Child layer collections");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Outliner Visibility Update
See T61578 for discussions and mockups.
Visibility Options
==================
We are adding more granular control over restriction columns in the outliner,
exposing "indirect only" and "holdout" as options, and change the way
users enable/disable collections in a viewlayer.
We also rename the object viewport restriction to hide instance.
So the options we have are:
Collection
----------
* Render Visibility
* Instance Visibility
* Selectable
(View) Layer Collection
-----------------------
* Enable
* Holdout
* Indirect Only
* Viewport
Shortcuts
=========
Isolate Collection
------------------
* Ctr + click isolates the collection.
It turns all its parents and children "visible", and all the other
collections "invisible".
If ALL the collections were already properly set, we re-set the
collections to their default value.
Set Collection Inside Collections and Objects
---------------------------------------------
* Shift + click: Set/unset inside collections and objects.
We only set objects values as well when we are in View Layer mode and
(obviously) when the objects have a matching property.
Icons
=====
Little reminder that we will need better icons for holdout, indirect only, and
probably instanced (nothing wrong with the current, but it differs from
the proposal when it is turned off).
Also, we need to decide where do we want the modifier/bones/... icons to
be (in which column) and ideally make sure their icons match the ones we
use for collections/objects.
At the moment those are using the screen icon, which is not being used
by collections.
Reviewers: brecht, billrey
Subscribers: pablovazquez
Differential Revision: https://developer.blender.org/D4823
2019-05-04 14:14:37 -03:00
|
|
|
/* Restriction flags. */
|
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
|
|
|
prop = RNA_def_property(srna, "exclude", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_EXCLUDE);
|
2019-05-31 13:17:16 -03:00
|
|
|
RNA_def_property_boolean_funcs(prop, NULL, "rna_LayerCollection_exclude_set");
|
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
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
2019-05-14 14:28:28 -03:00
|
|
|
RNA_def_property_ui_text(prop, "Exclude from View Layer", "Exclude from view layer");
|
Outliner Visibility Update
See T61578 for discussions and mockups.
Visibility Options
==================
We are adding more granular control over restriction columns in the outliner,
exposing "indirect only" and "holdout" as options, and change the way
users enable/disable collections in a viewlayer.
We also rename the object viewport restriction to hide instance.
So the options we have are:
Collection
----------
* Render Visibility
* Instance Visibility
* Selectable
(View) Layer Collection
-----------------------
* Enable
* Holdout
* Indirect Only
* Viewport
Shortcuts
=========
Isolate Collection
------------------
* Ctr + click isolates the collection.
It turns all its parents and children "visible", and all the other
collections "invisible".
If ALL the collections were already properly set, we re-set the
collections to their default value.
Set Collection Inside Collections and Objects
---------------------------------------------
* Shift + click: Set/unset inside collections and objects.
We only set objects values as well when we are in View Layer mode and
(obviously) when the objects have a matching property.
Icons
=====
Little reminder that we will need better icons for holdout, indirect only, and
probably instanced (nothing wrong with the current, but it differs from
the proposal when it is turned off).
Also, we need to decide where do we want the modifier/bones/... icons to
be (in which column) and ideally make sure their icons match the ones we
use for collections/objects.
At the moment those are using the screen icon, which is not being used
by collections.
Reviewers: brecht, billrey
Subscribers: pablovazquez
Differential Revision: https://developer.blender.org/D4823
2019-05-04 14:14:37 -03:00
|
|
|
RNA_def_property_ui_icon(prop, ICON_CHECKBOX_HLT, -1);
|
2018-11-30 02:24:06 -02:00
|
|
|
RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_exclude_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-25 12:26:09 +02:00
|
|
|
prop = RNA_def_property(srna, "holdout", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_HOLDOUT);
|
2019-05-31 13:17:16 -03:00
|
|
|
RNA_def_property_boolean_funcs(prop, NULL, "rna_LayerCollection_holdout_set");
|
2018-07-25 12:26:09 +02:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
2019-05-17 23:22:22 +02:00
|
|
|
RNA_def_property_ui_icon(prop, ICON_HOLDOUT_OFF, 1);
|
2018-07-25 12:26:09 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Holdout", "Mask out objects in collection from view layer");
|
2018-11-30 02:24:06 -02:00
|
|
|
RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-25 12:26:09 +02:00
|
|
|
prop = RNA_def_property(srna, "indirect_only", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_INDIRECT_ONLY);
|
2019-05-31 13:17:16 -03:00
|
|
|
RNA_def_property_boolean_funcs(prop, NULL, "rna_LayerCollection_indirect_only_set");
|
2018-07-25 12:26:09 +02:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
2019-05-17 23:22:22 +02:00
|
|
|
RNA_def_property_ui_icon(prop, ICON_INDIRECT_ONLY_OFF, 1);
|
2018-11-06 17:20:49 +01:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Indirect Only",
|
|
|
|
|
"Objects in collection only contribute indirectly (through shadows and reflections) "
|
|
|
|
|
"in the view layer");
|
2018-11-30 02:24:06 -02:00
|
|
|
RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-11-28 00:49:36 -02:00
|
|
|
prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
|
2019-05-14 17:45:47 -03:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_HIDE);
|
2019-05-31 13:17:16 -03:00
|
|
|
RNA_def_property_boolean_funcs(prop, NULL, "rna_LayerCollection_hide_viewport_set");
|
2019-06-14 23:16:04 +02:00
|
|
|
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
2019-05-15 08:17:09 -03:00
|
|
|
RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
|
2019-05-14 14:28:28 -03:00
|
|
|
RNA_def_property_ui_text(prop, "Hide in Viewport", "Temporarily hide in viewport");
|
2018-11-30 02:24:06 -02:00
|
|
|
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-08-19 14:25:29 -03:00
|
|
|
func = RNA_def_function(srna, "visible_get", "rna_LayerCollection_visible_get");
|
|
|
|
|
RNA_def_function_ui_description(func,
|
|
|
|
|
"Whether this collection is visible, take into account the "
|
|
|
|
|
"collection parent and the viewport");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
|
|
|
|
RNA_def_function_return(func, RNA_def_boolean(func, "result", 0, "", ""));
|
|
|
|
|
|
Outliner Visibility Update
See T61578 for discussions and mockups.
Visibility Options
==================
We are adding more granular control over restriction columns in the outliner,
exposing "indirect only" and "holdout" as options, and change the way
users enable/disable collections in a viewlayer.
We also rename the object viewport restriction to hide instance.
So the options we have are:
Collection
----------
* Render Visibility
* Instance Visibility
* Selectable
(View) Layer Collection
-----------------------
* Enable
* Holdout
* Indirect Only
* Viewport
Shortcuts
=========
Isolate Collection
------------------
* Ctr + click isolates the collection.
It turns all its parents and children "visible", and all the other
collections "invisible".
If ALL the collections were already properly set, we re-set the
collections to their default value.
Set Collection Inside Collections and Objects
---------------------------------------------
* Shift + click: Set/unset inside collections and objects.
We only set objects values as well when we are in View Layer mode and
(obviously) when the objects have a matching property.
Icons
=====
Little reminder that we will need better icons for holdout, indirect only, and
probably instanced (nothing wrong with the current, but it differs from
the proposal when it is turned off).
Also, we need to decide where do we want the modifier/bones/... icons to
be (in which column) and ideally make sure their icons match the ones we
use for collections/objects.
At the moment those are using the screen icon, which is not being used
by collections.
Reviewers: brecht, billrey
Subscribers: pablovazquez
Differential Revision: https://developer.blender.org/D4823
2019-05-04 14:14:37 -03:00
|
|
|
/* Run-time flags. */
|
2018-11-28 00:49:36 -02:00
|
|
|
prop = RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
|
2019-10-03 19:22:36 -03:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "runtime_flag", LAYER_COLLECTION_VISIBLE_VIEW_LAYER);
|
2018-11-28 00:49:36 -02:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2019-10-03 19:22:36 -03:00
|
|
|
RNA_def_property_ui_text(prop,
|
|
|
|
|
"Visible",
|
2020-02-17 13:00:01 +01:00
|
|
|
"Whether this collection is visible for the view layer, take into "
|
2019-10-03 19:22:36 -03:00
|
|
|
"account the collection parent");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-11-15 11:13:26 -02:00
|
|
|
func = RNA_def_function(srna, "has_objects", "rna_LayerCollection_has_objects");
|
|
|
|
|
RNA_def_function_ui_description(func, "");
|
|
|
|
|
RNA_def_function_return(func, RNA_def_boolean(func, "result", 0, "", ""));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-11-15 11:13:26 -02:00
|
|
|
func = RNA_def_function(
|
|
|
|
|
srna, "has_selected_objects", "rna_LayerCollection_has_selected_objects");
|
|
|
|
|
RNA_def_function_ui_description(func, "");
|
|
|
|
|
prop = RNA_def_pointer(
|
2020-02-17 13:00:01 +01:00
|
|
|
func, "view_layer", "ViewLayer", "", "View layer the layer collection belongs to");
|
2018-11-15 11:13:26 -02:00
|
|
|
RNA_def_parameter_flags(prop, 0, PARM_REQUIRED);
|
|
|
|
|
RNA_def_function_return(func, RNA_def_boolean(func, "result", 0, "", ""));
|
2017-10-23 17:46:35 -02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_layer_objects(BlenderRNA *brna, PropertyRNA *cprop)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-23 17:46:35 -02:00
|
|
|
RNA_def_property_srna(cprop, "LayerObjects");
|
|
|
|
|
srna = RNA_def_struct(brna, "LayerObjects", NULL);
|
2017-11-22 10:52:39 -02:00
|
|
|
RNA_def_struct_sdna(srna, "ViewLayer");
|
2017-10-23 17:46:35 -02:00
|
|
|
RNA_def_struct_ui_text(srna, "Layer Objects", "Collections of objects");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-23 17:46:35 -02:00
|
|
|
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Object");
|
2018-11-06 17:20:49 +01:00
|
|
|
RNA_def_property_pointer_funcs(prop,
|
|
|
|
|
"rna_LayerObjects_active_object_get",
|
|
|
|
|
"rna_LayerObjects_active_object_set",
|
|
|
|
|
NULL,
|
|
|
|
|
NULL);
|
2018-04-05 18:20:27 +02:00
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
|
2017-10-23 17:46:35 -02:00
|
|
|
RNA_def_property_ui_text(prop, "Active Object", "Active object for this layer");
|
2020-07-07 12:44:47 +10:00
|
|
|
/* Could call: `ED_object_base_activate(C, view_layer->basact);`
|
2017-10-23 17:46:35 -02:00
|
|
|
* but would be a bad level call and it seems the notifier is enough */
|
2018-04-05 18:20:27 +02:00
|
|
|
RNA_def_property_update(prop, NC_SCENE | ND_OB_ACTIVE, NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-23 17:46:35 -02:00
|
|
|
prop = RNA_def_property(srna, "selected", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "object_bases", NULL);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Object");
|
|
|
|
|
RNA_def_property_collection_funcs(prop,
|
|
|
|
|
"rna_LayerObjects_selected_begin",
|
|
|
|
|
"rna_iterator_listbase_next",
|
2017-11-22 10:52:39 -02:00
|
|
|
"rna_iterator_listbase_end",
|
|
|
|
|
"rna_ViewLayer_objects_get",
|
2017-10-23 17:46:35 -02:00
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Selected Objects", "All the selected objects of this layer");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_object_base(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-23 17:46:35 -02:00
|
|
|
srna = RNA_def_struct(brna, "ObjectBase", NULL);
|
|
|
|
|
RNA_def_struct_sdna(srna, "Base");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Object Base", "An object instance in a render layer");
|
|
|
|
|
RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-23 17:46:35 -02:00
|
|
|
prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "object");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Object", "Object this base links to");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-23 17:46:35 -02:00
|
|
|
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", BASE_SELECTED);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Select", "Object base selection state");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ObjectBase_select_update");
|
Outliner Visibility Update
See T61578 for discussions and mockups.
Visibility Options
==================
We are adding more granular control over restriction columns in the outliner,
exposing "indirect only" and "holdout" as options, and change the way
users enable/disable collections in a viewlayer.
We also rename the object viewport restriction to hide instance.
So the options we have are:
Collection
----------
* Render Visibility
* Instance Visibility
* Selectable
(View) Layer Collection
-----------------------
* Enable
* Holdout
* Indirect Only
* Viewport
Shortcuts
=========
Isolate Collection
------------------
* Ctr + click isolates the collection.
It turns all its parents and children "visible", and all the other
collections "invisible".
If ALL the collections were already properly set, we re-set the
collections to their default value.
Set Collection Inside Collections and Objects
---------------------------------------------
* Shift + click: Set/unset inside collections and objects.
We only set objects values as well when we are in View Layer mode and
(obviously) when the objects have a matching property.
Icons
=====
Little reminder that we will need better icons for holdout, indirect only, and
probably instanced (nothing wrong with the current, but it differs from
the proposal when it is turned off).
Also, we need to decide where do we want the modifier/bones/... icons to
be (in which column) and ideally make sure their icons match the ones we
use for collections/objects.
At the moment those are using the screen icon, which is not being used
by collections.
Reviewers: brecht, billrey
Subscribers: pablovazquez
Differential Revision: https://developer.blender.org/D4823
2019-05-04 14:14:37 -03:00
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", BASE_HIDDEN);
|
2019-05-24 10:25:05 -03:00
|
|
|
RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
|
2019-06-14 23:16:04 +02:00
|
|
|
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
2019-05-15 08:17:09 -03:00
|
|
|
RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
|
2019-05-14 14:28:28 -03:00
|
|
|
RNA_def_property_ui_text(prop, "Hide in Viewport", "Temporarily hide in viewport");
|
Outliner Visibility Update
See T61578 for discussions and mockups.
Visibility Options
==================
We are adding more granular control over restriction columns in the outliner,
exposing "indirect only" and "holdout" as options, and change the way
users enable/disable collections in a viewlayer.
We also rename the object viewport restriction to hide instance.
So the options we have are:
Collection
----------
* Render Visibility
* Instance Visibility
* Selectable
(View) Layer Collection
-----------------------
* Enable
* Holdout
* Indirect Only
* Viewport
Shortcuts
=========
Isolate Collection
------------------
* Ctr + click isolates the collection.
It turns all its parents and children "visible", and all the other
collections "invisible".
If ALL the collections were already properly set, we re-set the
collections to their default value.
Set Collection Inside Collections and Objects
---------------------------------------------
* Shift + click: Set/unset inside collections and objects.
We only set objects values as well when we are in View Layer mode and
(obviously) when the objects have a matching property.
Icons
=====
Little reminder that we will need better icons for holdout, indirect only, and
probably instanced (nothing wrong with the current, but it differs from
the proposal when it is turned off).
Also, we need to decide where do we want the modifier/bones/... icons to
be (in which column) and ideally make sure their icons match the ones we
use for collections/objects.
At the moment those are using the screen icon, which is not being used
by collections.
Reviewers: brecht, billrey
Subscribers: pablovazquez
Differential Revision: https://developer.blender.org/D4823
2019-05-04 14:14:37 -03:00
|
|
|
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ObjectBase_hide_viewport_update");
|
2017-10-23 17:46:35 -02:00
|
|
|
}
|
|
|
|
|
|
2017-11-22 10:52:39 -02:00
|
|
|
void RNA_def_view_layer(BlenderRNA *brna)
|
2017-10-23 17:46:35 -02:00
|
|
|
{
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-11-22 10:52:39 -02:00
|
|
|
srna = RNA_def_struct(brna, "ViewLayer", NULL);
|
2018-05-23 13:39:35 +02:00
|
|
|
RNA_def_struct_ui_text(srna, "View Layer", "View layer");
|
2018-04-24 15:20:17 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_RENDER_RESULT);
|
|
|
|
|
RNA_def_struct_path_func(srna, "rna_ViewLayer_path");
|
2017-11-22 10:52:39 -02:00
|
|
|
RNA_def_struct_idprops_func(srna, "rna_ViewLayer_idprops");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-29 10:04:39 +11:00
|
|
|
rna_def_view_layer_common(srna, true);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-11-22 10:52:39 -02:00
|
|
|
func = RNA_def_function(srna, "update_render_passes", "rna_ViewLayer_update_render_passes");
|
2017-11-16 13:39:25 -02:00
|
|
|
RNA_def_function_ui_description(func,
|
|
|
|
|
"Requery the enabled render passes from the render engine");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_NO_SELF);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-11-06 17:20:49 +01:00
|
|
|
prop = RNA_def_property(srna, "layer_collection", PROP_POINTER, PROP_NONE);
|
2017-10-23 17:46:35 -02:00
|
|
|
RNA_def_property_struct_type(prop, "LayerCollection");
|
2018-11-06 17:20:49 +01:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "layer_collections.first");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Layer Collection",
|
|
|
|
|
"Root of collections hierarchy of this view layer,"
|
|
|
|
|
"its 'collection' pointer property is the same as the scene's master collection");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-11-06 17:20:49 +01:00
|
|
|
prop = RNA_def_property(srna, "active_layer_collection", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "LayerCollection");
|
|
|
|
|
RNA_def_property_pointer_funcs(prop,
|
|
|
|
|
"rna_ViewLayer_active_layer_collection_get",
|
|
|
|
|
"rna_ViewLayer_active_layer_collection_set",
|
|
|
|
|
NULL,
|
|
|
|
|
NULL);
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Active Layer Collection", "Active layer collection in this view layer's hierarchy");
|
|
|
|
|
RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-23 17:46:35 -02:00
|
|
|
prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "object_bases", NULL);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Object");
|
2017-11-22 10:52:39 -02:00
|
|
|
RNA_def_property_collection_funcs(
|
|
|
|
|
prop, NULL, NULL, NULL, "rna_ViewLayer_objects_get", NULL, NULL, NULL, NULL);
|
2017-10-23 17:46:35 -02:00
|
|
|
RNA_def_property_ui_text(prop, "Objects", "All the objects in this layer");
|
|
|
|
|
rna_def_layer_objects(brna, prop);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-23 17:46:35 -02:00
|
|
|
/* layer options */
|
|
|
|
|
prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
|
2017-11-22 10:52:39 -02:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", VIEW_LAYER_RENDER);
|
2019-05-06 14:24:33 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Enabled", "Enable or disable rendering of this View Layer");
|
2017-10-23 17:46:35 -02:00
|
|
|
RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-11-16 13:39:25 -02:00
|
|
|
prop = RNA_def_property(srna, "use_freestyle", PROP_BOOLEAN, PROP_NONE);
|
2017-11-22 10:52:39 -02:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", VIEW_LAYER_FREESTYLE);
|
2017-11-16 13:39:25 -02:00
|
|
|
RNA_def_property_ui_text(prop, "Freestyle", "Render stylized strokes in this Layer");
|
|
|
|
|
RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-11-16 13:39:25 -02:00
|
|
|
/* Freestyle */
|
|
|
|
|
rna_def_freestyle_settings(brna);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-11-16 13:39:25 -02:00
|
|
|
prop = RNA_def_property(srna, "freestyle_settings", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "freestyle_config");
|
|
|
|
|
RNA_def_property_struct_type(prop, "FreestyleSettings");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Freestyle Settings", "");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-23 17:46:35 -02:00
|
|
|
/* debug update routine */
|
2017-11-22 10:52:39 -02:00
|
|
|
func = RNA_def_function(srna, "update", "rna_ViewLayer_update_tagged");
|
2019-10-10 12:25:23 +02:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS);
|
2017-10-23 17:46:35 -02:00
|
|
|
RNA_def_function_ui_description(
|
|
|
|
|
func, "Update data tagged to be updated from previous access to data or operators");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-11-03 17:27:13 +01:00
|
|
|
/* Dependency Graph */
|
|
|
|
|
prop = RNA_def_property(srna, "depsgraph", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Depsgraph");
|
2020-02-19 16:07:21 +01:00
|
|
|
RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
|
2017-11-03 17:27:13 +01:00
|
|
|
RNA_def_property_ui_text(prop, "Dependency Graph", "Dependencies in the scene data");
|
2017-11-22 10:52:39 -02:00
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_ViewLayer_depsgraph_get", NULL, NULL, NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-23 17:46:35 -02:00
|
|
|
/* Nested Data */
|
|
|
|
|
/* *** Non-Animated *** */
|
|
|
|
|
RNA_define_animate_sdna(false);
|
|
|
|
|
rna_def_layer_collection(brna);
|
|
|
|
|
rna_def_object_base(brna);
|
|
|
|
|
RNA_define_animate_sdna(true);
|
|
|
|
|
/* *** Animated *** */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|