Outliner/visibility: revert changes for now until we find better solutions.
See T57857 for discussion. This reverts: "Outliner: Do not gray out empty collections"4521d3e707. "Remove eye column from the outliner"fd16b35997. Fix/workaround issues in pose and edit mode"6d2e2e30d5. "Per view-layer collection visibility"4de6a210c6.
This commit is contained in:
@@ -4078,8 +4078,11 @@ class VIEW3D_PT_collections(Panel):
|
|||||||
sub = row.split()
|
sub = row.split()
|
||||||
subrow = sub.row(align=True)
|
subrow = sub.row(align=True)
|
||||||
subrow.alignment = 'RIGHT'
|
subrow.alignment = 'RIGHT'
|
||||||
subrow.active = collection.is_visible # Parent collection runtime visibility
|
icon = 'HIDE_OFF' if has_visible_objects else 'HIDE_ON'
|
||||||
subrow.prop(child, "hide_viewport", text="", emboss=False)
|
props = subrow.operator("object.hide_collection", text="", icon=icon, emboss=False)
|
||||||
|
props.collection_index = index
|
||||||
|
props.toggle = True
|
||||||
|
subrow.prop(child.collection, "hide_select", text="", emboss=False)
|
||||||
|
|
||||||
for child in collection.children:
|
for child in collection.children:
|
||||||
index = self._draw_collection(layout, view_layer, child, index)
|
index = self._draw_collection(layout, view_layer, child, index)
|
||||||
|
|||||||
@@ -113,8 +113,6 @@ bool BKE_layer_collection_objects_select(
|
|||||||
struct ViewLayer *view_layer, struct LayerCollection *lc, bool deselect);
|
struct ViewLayer *view_layer, struct LayerCollection *lc, bool deselect);
|
||||||
bool BKE_layer_collection_has_selected_objects(
|
bool BKE_layer_collection_has_selected_objects(
|
||||||
struct ViewLayer *view_layer, struct LayerCollection *lc);
|
struct ViewLayer *view_layer, struct LayerCollection *lc);
|
||||||
bool BKE_layer_collection_has_layer_collection(
|
|
||||||
struct LayerCollection *lc_parent, struct LayerCollection *lc_child);
|
|
||||||
|
|
||||||
void BKE_base_set_visible(struct Scene *scene, struct ViewLayer *view_layer, struct Base *base, bool extend);
|
void BKE_base_set_visible(struct Scene *scene, struct ViewLayer *view_layer, struct Base *base, bool extend);
|
||||||
void BKE_layer_collection_set_visible(struct Scene *scene, struct ViewLayer *view_layer, struct LayerCollection *lc, bool extend);
|
void BKE_layer_collection_set_visible(struct Scene *scene, struct ViewLayer *view_layer, struct LayerCollection *lc, bool extend);
|
||||||
|
|||||||
@@ -610,7 +610,7 @@ int BKE_layer_collection_findindex(ViewLayer *view_layer, const LayerCollection
|
|||||||
static short layer_collection_sync(
|
static short layer_collection_sync(
|
||||||
ViewLayer *view_layer, const ListBase *lb_scene,
|
ViewLayer *view_layer, const ListBase *lb_scene,
|
||||||
ListBase *lb_layer, ListBase *new_object_bases,
|
ListBase *lb_layer, ListBase *new_object_bases,
|
||||||
short parent_exclude, short parent_restrict, short parent_layer_restrict)
|
short parent_exclude, short parent_restrict)
|
||||||
{
|
{
|
||||||
/* TODO: support recovery after removal of intermediate collections, reordering, ..
|
/* TODO: support recovery after removal of intermediate collections, reordering, ..
|
||||||
* For local edits we can make editing operating do the appropriate thing, but for
|
* For local edits we can make editing operating do the appropriate thing, but for
|
||||||
@@ -655,17 +655,15 @@ static short layer_collection_sync(
|
|||||||
|
|
||||||
/* Collection restrict is inherited. */
|
/* Collection restrict is inherited. */
|
||||||
short child_restrict = parent_restrict;
|
short child_restrict = parent_restrict;
|
||||||
short child_layer_restrict = parent_layer_restrict;
|
|
||||||
if (!(collection->flag & COLLECTION_IS_MASTER)) {
|
if (!(collection->flag & COLLECTION_IS_MASTER)) {
|
||||||
child_restrict |= collection->flag;
|
child_restrict |= collection->flag;
|
||||||
child_layer_restrict |= lc->flag;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sync child collections. */
|
/* Sync child collections. */
|
||||||
short child_runtime_flag = layer_collection_sync(
|
short child_runtime_flag = layer_collection_sync(
|
||||||
view_layer, &collection->children,
|
view_layer, &collection->children,
|
||||||
&lc->layer_collections, new_object_bases,
|
&lc->layer_collections, new_object_bases,
|
||||||
lc->flag, child_restrict, child_layer_restrict);
|
lc->flag, child_restrict);
|
||||||
|
|
||||||
/* Layer collection exclude is not inherited. */
|
/* Layer collection exclude is not inherited. */
|
||||||
if (lc->flag & LAYER_COLLECTION_EXCLUDE) {
|
if (lc->flag & LAYER_COLLECTION_EXCLUDE) {
|
||||||
@@ -676,10 +674,6 @@ static short layer_collection_sync(
|
|||||||
lc->runtime_flag = child_runtime_flag;
|
lc->runtime_flag = child_runtime_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((child_layer_restrict & LAYER_COLLECTION_RESTRICT_VIEW) == 0) {
|
|
||||||
lc->runtime_flag |= LAYER_COLLECTION_VISIBLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sync objects, except if collection was excluded. */
|
/* Sync objects, except if collection was excluded. */
|
||||||
for (CollectionObject *cob = collection->gobject.first; cob; cob = cob->next) {
|
for (CollectionObject *cob = collection->gobject.first; cob; cob = cob->next) {
|
||||||
if (cob->ob == NULL) {
|
if (cob->ob == NULL) {
|
||||||
@@ -707,7 +701,6 @@ static short layer_collection_sync(
|
|||||||
int object_restrict = base->object->restrictflag;
|
int object_restrict = base->object->restrictflag;
|
||||||
|
|
||||||
if (((child_restrict & COLLECTION_RESTRICT_VIEW) == 0) &&
|
if (((child_restrict & COLLECTION_RESTRICT_VIEW) == 0) &&
|
||||||
((child_layer_restrict & LAYER_COLLECTION_RESTRICT_VIEW) == 0) &&
|
|
||||||
((object_restrict & OB_RESTRICT_VIEW) == 0))
|
((object_restrict & OB_RESTRICT_VIEW) == 0))
|
||||||
{
|
{
|
||||||
base->flag |= BASE_VISIBLE | BASE_ENABLED | BASE_ENABLED_VIEWPORT;
|
base->flag |= BASE_VISIBLE | BASE_ENABLED | BASE_ENABLED_VIEWPORT;
|
||||||
@@ -721,6 +714,7 @@ static short layer_collection_sync(
|
|||||||
|
|
||||||
if (((child_restrict & COLLECTION_RESTRICT_RENDER) == 0) &&
|
if (((child_restrict & COLLECTION_RESTRICT_RENDER) == 0) &&
|
||||||
((object_restrict & OB_RESTRICT_RENDER) == 0))
|
((object_restrict & OB_RESTRICT_RENDER) == 0))
|
||||||
|
|
||||||
{
|
{
|
||||||
base->flag |= BASE_ENABLED_RENDER;
|
base->flag |= BASE_ENABLED_RENDER;
|
||||||
}
|
}
|
||||||
@@ -797,11 +791,11 @@ void BKE_layer_collection_sync(const Scene *scene, ViewLayer *view_layer)
|
|||||||
const ListBase collections = {&child, &child};
|
const ListBase collections = {&child, &child};
|
||||||
ListBase new_object_bases = {NULL, NULL};
|
ListBase new_object_bases = {NULL, NULL};
|
||||||
|
|
||||||
const short parent_exclude = 0, parent_restrict = 0, parent_layer_restrict = 0;
|
const short parent_exclude = 0, parent_restrict = 0;
|
||||||
layer_collection_sync(
|
layer_collection_sync(
|
||||||
view_layer, &collections,
|
view_layer, &collections,
|
||||||
&view_layer->layer_collections, &new_object_bases,
|
&view_layer->layer_collections, &new_object_bases,
|
||||||
parent_exclude, parent_restrict, parent_layer_restrict);
|
parent_exclude, parent_restrict);
|
||||||
|
|
||||||
/* Any remaning object bases are to be removed. */
|
/* Any remaning object bases are to be removed. */
|
||||||
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
|
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
|
||||||
@@ -925,7 +919,7 @@ bool BKE_layer_collection_has_selected_objects(ViewLayer *view_layer, LayerColle
|
|||||||
for (CollectionObject *cob = lc->collection->gobject.first; cob; cob = cob->next) {
|
for (CollectionObject *cob = lc->collection->gobject.first; cob; cob = cob->next) {
|
||||||
Base *base = BKE_view_layer_base_find(view_layer, cob->ob);
|
Base *base = BKE_view_layer_base_find(view_layer, cob->ob);
|
||||||
|
|
||||||
if (base && (base->flag & BASE_SELECTED) && (base->flag & BASE_VISIBLE)) {
|
if (base && (base->flag & BASE_SELECTED)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -940,20 +934,6 @@ bool BKE_layer_collection_has_selected_objects(ViewLayer *view_layer, LayerColle
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BKE_layer_collection_has_layer_collection(LayerCollection *lc_parent, LayerCollection *lc_child)
|
|
||||||
{
|
|
||||||
if (lc_parent == lc_child) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (LayerCollection *lc_iter = lc_parent->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
|
|
||||||
if (BKE_layer_collection_has_layer_collection(lc_iter, lc_child)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* Update after toggling visibility of an object base. */
|
/* Update after toggling visibility of an object base. */
|
||||||
@@ -975,62 +955,44 @@ void BKE_base_set_visible(Scene *scene, ViewLayer *view_layer, Base *base, bool
|
|||||||
BKE_layer_collection_sync(scene, view_layer);
|
BKE_layer_collection_sync(scene, view_layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void layer_collection_flag_set_recursive(LayerCollection *lc, const int flag)
|
|
||||||
{
|
|
||||||
lc->flag |= flag;
|
|
||||||
for (LayerCollection *lc_iter = lc->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
|
|
||||||
layer_collection_flag_set_recursive(lc_iter, flag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void layer_collection_flag_unset_recursive(LayerCollection *lc, const int flag)
|
|
||||||
{
|
|
||||||
lc->flag &= ~flag;
|
|
||||||
for (LayerCollection *lc_iter = lc->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
|
|
||||||
layer_collection_flag_unset_recursive(lc_iter, flag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set collection per-view layer visiblity.
|
|
||||||
* When not extending, we show all the direct parents and all children of the layer collection.
|
|
||||||
*/
|
|
||||||
void BKE_layer_collection_set_visible(Scene *scene, ViewLayer *view_layer, LayerCollection *lc, bool extend)
|
void BKE_layer_collection_set_visible(Scene *scene, ViewLayer *view_layer, LayerCollection *lc, bool extend)
|
||||||
{
|
{
|
||||||
if (!extend) {
|
if (!extend) {
|
||||||
/* Make only this collection visible. */
|
/* Make only objects from one collection visible. */
|
||||||
for (LayerCollection *lc_iter = view_layer->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
|
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
|
||||||
layer_collection_flag_set_recursive(lc_iter, LAYER_COLLECTION_RESTRICT_VIEW);
|
base->flag |= BASE_HIDDEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make all the direct parents visible. */
|
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(lc->collection, ob)
|
||||||
LayerCollection *lc_parent = lc;
|
{
|
||||||
LayerCollection *lc_master = view_layer->layer_collections.first;
|
Base *base = BLI_ghash_lookup(view_layer->object_bases_hash, ob);
|
||||||
for (LayerCollection *lc_iter = lc_master->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
|
|
||||||
if (BKE_layer_collection_has_layer_collection(lc_iter, lc)) {
|
if (base) {
|
||||||
lc_parent = lc_iter;
|
base->flag &= ~BASE_HIDDEN;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
|
||||||
while (lc_parent != lc) {
|
|
||||||
lc_parent->flag &= ~LAYER_COLLECTION_RESTRICT_VIEW;
|
|
||||||
|
|
||||||
for (LayerCollection *lc_iter = lc_parent->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
|
|
||||||
if (BKE_layer_collection_has_layer_collection(lc_iter, lc)) {
|
|
||||||
lc_parent = lc_iter;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Make all the children visible. */
|
|
||||||
layer_collection_flag_unset_recursive(lc, LAYER_COLLECTION_RESTRICT_VIEW);
|
|
||||||
|
|
||||||
BKE_layer_collection_activate(view_layer, lc);
|
BKE_layer_collection_activate(view_layer, lc);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lc->flag ^= LAYER_COLLECTION_RESTRICT_VIEW;
|
/* Toggle visibility of objects from collection. */
|
||||||
|
bool hide = (lc->runtime_flag & LAYER_COLLECTION_HAS_VISIBLE_OBJECTS) != 0;
|
||||||
|
|
||||||
|
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(lc->collection, ob)
|
||||||
|
{
|
||||||
|
Base *base = BLI_ghash_lookup(view_layer->object_bases_hash, ob);
|
||||||
|
|
||||||
|
if (base) {
|
||||||
|
if (hide) {
|
||||||
|
base->flag |= BASE_HIDDEN;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
base->flag &= ~BASE_HIDDEN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
BKE_layer_collection_sync(scene, view_layer);
|
BKE_layer_collection_sync(scene, view_layer);
|
||||||
@@ -1139,7 +1101,7 @@ typedef struct LayerObjectBaseIteratorData {
|
|||||||
Base *base;
|
Base *base;
|
||||||
} LayerObjectBaseIteratorData;
|
} LayerObjectBaseIteratorData;
|
||||||
|
|
||||||
static bool object_bases_iterator_is_valid_ex(View3D *v3d, Base *base, const int flags)
|
static bool object_bases_iterator_is_valid_ex(View3D *v3d, Base *base, const int flag)
|
||||||
{
|
{
|
||||||
if (v3d != NULL) {
|
if (v3d != NULL) {
|
||||||
if ((v3d->object_type_exclude_viewport & (1 << base->object->type)) != 0) {
|
if ((v3d->object_type_exclude_viewport & (1 << base->object->type)) != 0) {
|
||||||
@@ -1150,12 +1112,12 @@ static bool object_bases_iterator_is_valid_ex(View3D *v3d, Base *base, const int
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Any flag satisfies the condition. */
|
|
||||||
if (flags == ~0) {
|
if ((base->flag & flag) == 0) {
|
||||||
return (base->flag != 0);
|
return false;
|
||||||
}
|
}
|
||||||
/* flags may be more than one flag, so we can't check != 0. */
|
|
||||||
return ((base->flag & flags) == flags);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool object_bases_iterator_is_valid(View3D *v3d, Base *base)
|
static bool object_bases_iterator_is_valid(View3D *v3d, Base *base)
|
||||||
@@ -1243,12 +1205,12 @@ static void objects_iterator_end(BLI_Iterator *iter)
|
|||||||
|
|
||||||
void BKE_view_layer_selected_objects_iterator_begin(BLI_Iterator *iter, void *data_in)
|
void BKE_view_layer_selected_objects_iterator_begin(BLI_Iterator *iter, void *data_in)
|
||||||
{
|
{
|
||||||
objects_iterator_begin(iter, data_in, BASE_VISIBLE | BASE_SELECTED);
|
objects_iterator_begin(iter, data_in, BASE_SELECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BKE_view_layer_selected_objects_iterator_next(BLI_Iterator *iter)
|
void BKE_view_layer_selected_objects_iterator_next(BLI_Iterator *iter)
|
||||||
{
|
{
|
||||||
objects_iterator_next(iter, BASE_VISIBLE | BASE_SELECTED);
|
objects_iterator_next(iter, BASE_SELECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BKE_view_layer_selected_objects_iterator_end(BLI_Iterator *iter)
|
void BKE_view_layer_selected_objects_iterator_end(BLI_Iterator *iter)
|
||||||
@@ -1285,7 +1247,7 @@ void BKE_view_layer_visible_objects_iterator_end(BLI_Iterator *iter)
|
|||||||
|
|
||||||
void BKE_view_layer_selected_editable_objects_iterator_begin(BLI_Iterator *iter, void *data_in)
|
void BKE_view_layer_selected_editable_objects_iterator_begin(BLI_Iterator *iter, void *data_in)
|
||||||
{
|
{
|
||||||
objects_iterator_begin(iter, data_in, BASE_VISIBLE | BASE_SELECTED);
|
objects_iterator_begin(iter, data_in, BASE_SELECTED);
|
||||||
if (iter->valid) {
|
if (iter->valid) {
|
||||||
if (BKE_object_is_libdata((Object *)iter->current) == false) {
|
if (BKE_object_is_libdata((Object *)iter->current) == false) {
|
||||||
// First object is valid (selectable and not libdata) -> all good.
|
// First object is valid (selectable and not libdata) -> all good.
|
||||||
@@ -1302,7 +1264,7 @@ void BKE_view_layer_selected_editable_objects_iterator_next(BLI_Iterator *iter)
|
|||||||
{
|
{
|
||||||
// Search while there are objects and the one we have is not editable (editable = not libdata).
|
// Search while there are objects and the one we have is not editable (editable = not libdata).
|
||||||
do {
|
do {
|
||||||
objects_iterator_next(iter, BASE_VISIBLE | BASE_SELECTED);
|
objects_iterator_next(iter, BASE_SELECTED);
|
||||||
} while (iter->valid && BKE_object_is_libdata((Object *)iter->current) != false);
|
} while (iter->valid && BKE_object_is_libdata((Object *)iter->current) != false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1319,12 +1281,12 @@ void BKE_view_layer_selected_editable_objects_iterator_end(BLI_Iterator *iter)
|
|||||||
|
|
||||||
void BKE_view_layer_selected_bases_iterator_begin(BLI_Iterator *iter, void *data_in)
|
void BKE_view_layer_selected_bases_iterator_begin(BLI_Iterator *iter, void *data_in)
|
||||||
{
|
{
|
||||||
objects_iterator_begin(iter, data_in, BASE_VISIBLE | BASE_SELECTED);
|
objects_iterator_begin(iter, data_in, BASE_SELECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BKE_view_layer_selected_bases_iterator_next(BLI_Iterator *iter)
|
void BKE_view_layer_selected_bases_iterator_next(BLI_Iterator *iter)
|
||||||
{
|
{
|
||||||
object_bases_iterator_next(iter, BASE_VISIBLE | BASE_SELECTED);
|
object_bases_iterator_next(iter, BASE_SELECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BKE_view_layer_selected_bases_iterator_end(BLI_Iterator *iter)
|
void BKE_view_layer_selected_bases_iterator_end(BLI_Iterator *iter)
|
||||||
|
|||||||
@@ -71,11 +71,6 @@ void DepsgraphNodeBuilder::build_layer_collections(ListBase *lb)
|
|||||||
COLLECTION_RESTRICT_VIEW : COLLECTION_RESTRICT_RENDER;
|
COLLECTION_RESTRICT_VIEW : COLLECTION_RESTRICT_RENDER;
|
||||||
|
|
||||||
for (LayerCollection *lc = (LayerCollection *)lb->first; lc; lc = lc->next) {
|
for (LayerCollection *lc = (LayerCollection *)lb->first; lc; lc = lc->next) {
|
||||||
if ((graph_->mode == DAG_EVAL_VIEWPORT) &&
|
|
||||||
((lc->flag & LAYER_COLLECTION_RESTRICT_VIEW) != 0))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (lc->collection->flag & restrict_flag) {
|
if (lc->collection->flag & restrict_flag) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,11 +75,6 @@ void DepsgraphRelationBuilder::build_layer_collections(ListBase *lb)
|
|||||||
COLLECTION_RESTRICT_VIEW : COLLECTION_RESTRICT_RENDER;
|
COLLECTION_RESTRICT_VIEW : COLLECTION_RESTRICT_RENDER;
|
||||||
|
|
||||||
for (LayerCollection *lc = (LayerCollection *)lb->first; lc; lc = lc->next) {
|
for (LayerCollection *lc = (LayerCollection *)lb->first; lc; lc = lc->next) {
|
||||||
if ((graph_->mode == DAG_EVAL_VIEWPORT) &&
|
|
||||||
((lc->flag & LAYER_COLLECTION_RESTRICT_VIEW) != 0))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ((lc->collection->flag & restrict_flag)) {
|
if ((lc->collection->flag & restrict_flag)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -295,7 +295,6 @@ static int object_hide_collection_exec(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
BKE_layer_collection_set_visible(scene, view_layer, lc, extend);
|
BKE_layer_collection_set_visible(scene, view_layer, lc, extend);
|
||||||
|
|
||||||
DEG_relations_tag_update(CTX_data_main(C));
|
|
||||||
DEG_id_tag_update(&scene->id, DEG_TAG_BASE_FLAGS_UPDATE);
|
DEG_id_tag_update(&scene->id, DEG_TAG_BASE_FLAGS_UPDATE);
|
||||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
||||||
|
|
||||||
@@ -369,7 +368,7 @@ static int object_hide_collection_invoke(bContext *C, wmOperator *op, const wmEv
|
|||||||
void OBJECT_OT_hide_collection(wmOperatorType *ot)
|
void OBJECT_OT_hide_collection(wmOperatorType *ot)
|
||||||
{
|
{
|
||||||
/* identifiers */
|
/* identifiers */
|
||||||
ot->name = "Hide Collection";
|
ot->name = "Hide Objects By Collection";
|
||||||
ot->description = "Show only objects in collection (Shift to extend)";
|
ot->description = "Show only objects in collection (Shift to extend)";
|
||||||
ot->idname = "OBJECT_OT_hide_collection";
|
ot->idname = "OBJECT_OT_hide_collection";
|
||||||
|
|
||||||
|
|||||||
@@ -203,9 +203,6 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
|||||||
if (v3d && ((v3d->object_type_exclude_viewport & (1 << base->object->type)) != 0)) {
|
if (v3d && ((v3d->object_type_exclude_viewport & (1 << base->object->type)) != 0)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((base->flag & BASE_VISIBLE) == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ((base->flag & BASE_SELECTED) != 0) {
|
if ((base->flag & BASE_SELECTED) != 0) {
|
||||||
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
|
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
|
||||||
}
|
}
|
||||||
@@ -221,9 +218,6 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
|||||||
if (v3d && ((v3d->object_type_exclude_viewport & (1 << base->object->type)) != 0)) {
|
if (v3d && ((v3d->object_type_exclude_viewport & (1 << base->object->type)) != 0)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((base->flag & BASE_VISIBLE) == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ((base->flag & BASE_SELECTED) != 0) {
|
if ((base->flag & BASE_SELECTED) != 0) {
|
||||||
if (0 == BKE_object_is_libdata(base->object)) {
|
if (0 == BKE_object_is_libdata(base->object)) {
|
||||||
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
|
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
|
||||||
|
|||||||
@@ -274,6 +274,44 @@ static void restrictbutton_id_user_toggle(bContext *UNUSED(C), void *poin, void
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void hidebutton_base_flag_cb(bContext *C, void *poin, void *poin2)
|
||||||
|
{
|
||||||
|
Scene *scene = CTX_data_scene(C);
|
||||||
|
ViewLayer *view_layer = poin;
|
||||||
|
Base *base = poin2;
|
||||||
|
bool extend = (CTX_wm_window(C)->eventstate->ctrl == 0);
|
||||||
|
|
||||||
|
/* Undo button toggle, let function do it. */
|
||||||
|
base->flag ^= BASE_HIDDEN;
|
||||||
|
|
||||||
|
BKE_base_set_visible(scene, view_layer, base, extend);
|
||||||
|
|
||||||
|
if (!extend && (base->flag & BASE_VISIBLE)) {
|
||||||
|
/* Auto select solo-ed object. */
|
||||||
|
ED_object_base_select(base, BA_SELECT);
|
||||||
|
view_layer->basact = base;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEG_id_tag_update(&scene->id, DEG_TAG_BASE_FLAGS_UPDATE);
|
||||||
|
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void hidebutton_layer_collection_flag_cb(bContext *C, void *poin, void *poin2)
|
||||||
|
{
|
||||||
|
Scene *scene = CTX_data_scene(C);
|
||||||
|
ViewLayer *view_layer = poin;
|
||||||
|
LayerCollection *lc = poin2;
|
||||||
|
bool extend = (CTX_wm_window(C)->eventstate->ctrl == 0);
|
||||||
|
|
||||||
|
/* Undo button toggle, let function do it. */
|
||||||
|
lc->runtime_flag ^= LAYER_COLLECTION_HAS_VISIBLE_OBJECTS;
|
||||||
|
|
||||||
|
BKE_layer_collection_set_visible(scene, view_layer, lc, extend);
|
||||||
|
|
||||||
|
DEG_id_tag_update(&scene->id, DEG_TAG_BASE_FLAGS_UPDATE);
|
||||||
|
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
|
||||||
|
}
|
||||||
|
|
||||||
static void namebutton_cb(bContext *C, void *tsep, char *oldname)
|
static void namebutton_cb(bContext *C, void *tsep, char *oldname)
|
||||||
{
|
{
|
||||||
Main *bmain = CTX_data_main(C);
|
Main *bmain = CTX_data_main(C);
|
||||||
@@ -487,6 +525,18 @@ static void outliner_draw_restrictbuts(
|
|||||||
}
|
}
|
||||||
else if (tselem->type == 0 && te->idcode == ID_OB) {
|
else if (tselem->type == 0 && te->idcode == ID_OB) {
|
||||||
Object *ob = (Object *)tselem->id;
|
Object *ob = (Object *)tselem->id;
|
||||||
|
Base *base = BKE_view_layer_base_find(view_layer, ob);
|
||||||
|
|
||||||
|
if (base) {
|
||||||
|
bt = uiDefIconButBitS(
|
||||||
|
block, UI_BTYPE_ICON_TOGGLE, BASE_HIDDEN, 0, ICON_HIDE_OFF,
|
||||||
|
(int)(ar->v2d.cur.xmax - OL_TOG_HIDEX), te->ys, UI_UNIT_X,
|
||||||
|
UI_UNIT_Y, &base->flag, 0, 0, 0, 0,
|
||||||
|
TIP_("Hide object in viewport (Ctrl to isolate)"));
|
||||||
|
UI_but_func_set(bt, hidebutton_base_flag_cb, view_layer, base);
|
||||||
|
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
||||||
|
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
|
||||||
|
}
|
||||||
|
|
||||||
PointerRNA ptr;
|
PointerRNA ptr;
|
||||||
RNA_pointer_create(&ob->id, &RNA_Object, ob, &ptr);
|
RNA_pointer_create(&ob->id, &RNA_Object, ob, &ptr);
|
||||||
@@ -598,6 +648,17 @@ static void outliner_draw_restrictbuts(
|
|||||||
if ((!lc || !(lc->flag & LAYER_COLLECTION_EXCLUDE)) &&
|
if ((!lc || !(lc->flag & LAYER_COLLECTION_EXCLUDE)) &&
|
||||||
!(collection->flag & COLLECTION_IS_MASTER))
|
!(collection->flag & COLLECTION_IS_MASTER))
|
||||||
{
|
{
|
||||||
|
if (lc && (lc->runtime_flag & LAYER_COLLECTION_HAS_ENABLED_OBJECTS)) {
|
||||||
|
bt = uiDefIconButBitS(
|
||||||
|
block, UI_BTYPE_ICON_TOGGLE_N, LAYER_COLLECTION_HAS_VISIBLE_OBJECTS, 0, ICON_HIDE_OFF,
|
||||||
|
(int)(ar->v2d.cur.xmax - OL_TOG_HIDEX), te->ys, UI_UNIT_X,
|
||||||
|
UI_UNIT_Y, &lc->runtime_flag, 0, 0, 0, 0,
|
||||||
|
TIP_("Hide collection in viewport (Ctrl to isolate)"));
|
||||||
|
UI_but_func_set(bt, hidebutton_layer_collection_flag_cb, view_layer, lc);
|
||||||
|
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
||||||
|
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
|
||||||
|
}
|
||||||
|
|
||||||
PointerRNA collection_ptr;
|
PointerRNA collection_ptr;
|
||||||
RNA_id_pointer_create(&collection->id, &collection_ptr);
|
RNA_id_pointer_create(&collection->id, &collection_ptr);
|
||||||
|
|
||||||
@@ -2059,7 +2120,10 @@ static void outliner_draw_restrictcols(ARegion *ar)
|
|||||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||||
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
||||||
immUniformThemeColorShadeAlpha(TH_BACK, -15, -200);
|
immUniformThemeColorShadeAlpha(TH_BACK, -15, -200);
|
||||||
immBegin(GPU_PRIM_LINES, 6);
|
immBegin(GPU_PRIM_LINES, 8);
|
||||||
|
|
||||||
|
immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_HIDEX), (int)ar->v2d.cur.ymax);
|
||||||
|
immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_HIDEX), (int)ar->v2d.cur.ymin);
|
||||||
|
|
||||||
immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)ar->v2d.cur.ymax);
|
immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)ar->v2d.cur.ymax);
|
||||||
immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)ar->v2d.cur.ymin);
|
immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)ar->v2d.cur.ymin);
|
||||||
|
|||||||
@@ -129,11 +129,12 @@ typedef enum {
|
|||||||
/* size constants */
|
/* size constants */
|
||||||
#define OL_Y_OFFSET 2
|
#define OL_Y_OFFSET 2
|
||||||
|
|
||||||
|
#define OL_TOG_HIDEX (UI_UNIT_X * 4.0f + V2D_SCROLL_WIDTH)
|
||||||
#define OL_TOG_RESTRICT_SELECTX (UI_UNIT_X * 3.0f + V2D_SCROLL_WIDTH)
|
#define OL_TOG_RESTRICT_SELECTX (UI_UNIT_X * 3.0f + V2D_SCROLL_WIDTH)
|
||||||
#define OL_TOG_RESTRICT_VIEWX (UI_UNIT_X * 2.0f + V2D_SCROLL_WIDTH)
|
#define OL_TOG_RESTRICT_VIEWX (UI_UNIT_X * 2.0f + V2D_SCROLL_WIDTH)
|
||||||
#define OL_TOG_RESTRICT_RENDERX (UI_UNIT_X + V2D_SCROLL_WIDTH)
|
#define OL_TOG_RESTRICT_RENDERX (UI_UNIT_X + V2D_SCROLL_WIDTH)
|
||||||
|
|
||||||
#define OL_TOGW OL_TOG_RESTRICT_SELECTX
|
#define OL_TOGW OL_TOG_HIDEX
|
||||||
|
|
||||||
#define OL_RNA_COLX (UI_UNIT_X * 15)
|
#define OL_RNA_COLX (UI_UNIT_X * 15)
|
||||||
#define OL_RNA_COL_SIZEX (UI_UNIT_X * 7.5f)
|
#define OL_RNA_COL_SIZEX (UI_UNIT_X * 7.5f)
|
||||||
|
|||||||
@@ -1314,7 +1314,10 @@ static void outliner_add_layer_collections_recursive(
|
|||||||
ten->directdata = lc;
|
ten->directdata = lc;
|
||||||
|
|
||||||
const bool exclude = (lc->flag & LAYER_COLLECTION_EXCLUDE) != 0;
|
const bool exclude = (lc->flag & LAYER_COLLECTION_EXCLUDE) != 0;
|
||||||
if (exclude) {
|
if (exclude ||
|
||||||
|
((layer->runtime_flag & VIEW_LAYER_HAS_HIDE) &&
|
||||||
|
!(lc->runtime_flag & LAYER_COLLECTION_HAS_VISIBLE_OBJECTS)))
|
||||||
|
{
|
||||||
ten->flag |= TE_DISABLED;
|
ten->flag |= TE_DISABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5906,8 +5906,7 @@ static int count_proportional_objects(TransInfo *t)
|
|||||||
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
|
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
|
||||||
/* all base not already selected or marked that is editable */
|
/* all base not already selected or marked that is editable */
|
||||||
if ((base->object->flag & (BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 &&
|
if ((base->object->flag & (BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 &&
|
||||||
((base->flag & BASE_VISIBLE) != 0 &&
|
(base->flag & BASE_SELECTED) == 0 &&
|
||||||
(base->flag & BASE_SELECTED) == 0) &&
|
|
||||||
(BASE_EDITABLE_BGMODE(v3d, base)))
|
(BASE_EDITABLE_BGMODE(v3d, base)))
|
||||||
{
|
{
|
||||||
mark_children(base->object);
|
mark_children(base->object);
|
||||||
@@ -5921,8 +5920,7 @@ static int count_proportional_objects(TransInfo *t)
|
|||||||
* selection and it is editable.
|
* selection and it is editable.
|
||||||
*/
|
*/
|
||||||
if ((ob->flag & (BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 &&
|
if ((ob->flag & (BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 &&
|
||||||
((base->flag & BASE_VISIBLE) != 0 &&
|
(base->flag & BASE_SELECTED) == 0 &&
|
||||||
(base->flag & BASE_SELECTED) == 0) &&
|
|
||||||
(BASE_EDITABLE_BGMODE(v3d, base)))
|
(BASE_EDITABLE_BGMODE(v3d, base)))
|
||||||
{
|
{
|
||||||
flush_trans_object_base_deps_flag(depsgraph, ob);
|
flush_trans_object_base_deps_flag(depsgraph, ob);
|
||||||
|
|||||||
@@ -117,7 +117,6 @@ enum {
|
|||||||
LAYER_COLLECTION_EXCLUDE = (1 << 4),
|
LAYER_COLLECTION_EXCLUDE = (1 << 4),
|
||||||
LAYER_COLLECTION_HOLDOUT = (1 << 5),
|
LAYER_COLLECTION_HOLDOUT = (1 << 5),
|
||||||
LAYER_COLLECTION_INDIRECT_ONLY = (1 << 6),
|
LAYER_COLLECTION_INDIRECT_ONLY = (1 << 6),
|
||||||
LAYER_COLLECTION_RESTRICT_VIEW = (1 << 7),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Layer Collection->runtime_flag */
|
/* Layer Collection->runtime_flag */
|
||||||
@@ -126,7 +125,6 @@ enum {
|
|||||||
LAYER_COLLECTION_HAS_VISIBLE_OBJECTS = (1 << 1),
|
LAYER_COLLECTION_HAS_VISIBLE_OBJECTS = (1 << 1),
|
||||||
LAYER_COLLECTION_HAS_HIDDEN_OBJECTS = (1 << 2),
|
LAYER_COLLECTION_HAS_HIDDEN_OBJECTS = (1 << 2),
|
||||||
LAYER_COLLECTION_HAS_ENABLED_OBJECTS = (1 << 3),
|
LAYER_COLLECTION_HAS_ENABLED_OBJECTS = (1 << 3),
|
||||||
LAYER_COLLECTION_VISIBLE = (1 << 4),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ViewLayer->flag */
|
/* ViewLayer->flag */
|
||||||
|
|||||||
@@ -297,19 +297,6 @@ static void rna_def_layer_collection(BlenderRNA *brna)
|
|||||||
"in the view layer");
|
"in the view layer");
|
||||||
RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_use_update");
|
RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_use_update");
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
|
|
||||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_RESTRICT_VIEW);
|
|
||||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
|
|
||||||
RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
|
|
||||||
RNA_def_property_ui_text(prop, "Disable Viewport", "Disable collection in viewport for this view layer");
|
|
||||||
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_use_update");
|
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
|
|
||||||
RNA_def_property_boolean_sdna(prop, NULL, "runtime_flag", LAYER_COLLECTION_VISIBLE);
|
|
||||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
||||||
RNA_def_property_ui_text(prop, "Visible",
|
|
||||||
"Whether this collection is visible, take into account the collection parent");
|
|
||||||
|
|
||||||
func = RNA_def_function(srna, "has_objects", "rna_LayerCollection_has_objects");
|
func = RNA_def_function(srna, "has_objects", "rna_LayerCollection_has_objects");
|
||||||
RNA_def_function_ui_description(func, "");
|
RNA_def_function_ui_description(func, "");
|
||||||
RNA_def_function_return(func, RNA_def_boolean(func, "result", 0, "", ""));
|
RNA_def_function_return(func, RNA_def_boolean(func, "result", 0, "", ""));
|
||||||
|
|||||||
Reference in New Issue
Block a user