Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--intern/cycles/blender/blender_object.cpp5
-rw-r--r--source/blender/blenkernel/BKE_layer.h1
-rw-r--r--source/blender/blenkernel/intern/collection.c3
-rw-r--r--source/blender/blenkernel/intern/layer.c27
-rw-r--r--source/blender/blenlib/BLI_gsqueue.h2
-rw-r--r--source/blender/blenlib/intern/storage.c1
-rw-r--r--source/blender/draw/intern/draw_manager.c25
-rw-r--r--source/blender/editors/space_file/filelist.c2
-rw-r--r--source/blender/editors/space_file/filesel.c8
-rw-r--r--source/blender/makesdna/DNA_ID.h7
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c15
11 files changed, 61 insertions, 35 deletions
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp
index 59509d20fb2..d3efc18a990 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -541,7 +541,6 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
const bool show_lights = BlenderViewportParameters(b_v3d).use_scene_lights;
BL::ViewLayer b_view_layer = b_depsgraph.view_layer_eval();
- const bool has_local_view = b_v3d && b_v3d.local_view();
BL::Depsgraph::object_instances_iterator b_instance_iter;
for (b_depsgraph.object_instances.begin(b_instance_iter);
@@ -555,10 +554,10 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
/* test if object needs to be hidden */
const bool show_self = b_instance.show_self();
- const bool show_local_view = !has_local_view || b_ob.local_view_get(b_v3d);
const bool show_particles = b_instance.show_particles();
+ const bool show_in_viewport = b_ob.visible_in_viewport_get(b_v3d);
- if (show_local_view && (show_self || show_particles)) {
+ if (show_in_viewport && (show_self || show_particles)) {
/* object itself */
sync_object(b_depsgraph,
b_view_layer,
diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h
index d2c869532c8..19eb40debe6 100644
--- a/source/blender/blenkernel/BKE_layer.h
+++ b/source/blender/blenkernel/BKE_layer.h
@@ -115,6 +115,7 @@ void BKE_base_set_visible(struct Scene *scene,
struct Base *base,
bool extend);
bool BKE_base_is_visible(const struct View3D *v3d, const struct Base *base);
+bool BKE_object_is_visible_in_viewport(const struct View3D *v3d, const struct Object *ob);
void BKE_layer_collection_isolate_global(struct Scene *scene,
struct ViewLayer *view_layer,
struct LayerCollection *lc,
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index 931d248558d..68a38c94ff7 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -1305,6 +1305,9 @@ bool BKE_collection_move(Main *bmain,
BLI_ghash_free(view_layer_hash, NULL, NULL);
+ /* We need to sync it again to pass the correct flags to the collections objects. */
+ BKE_main_collection_sync(bmain);
+
return true;
}
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index 726ca9d705b..b915fddca18 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -1059,6 +1059,33 @@ bool BKE_base_is_visible(const View3D *v3d, const Base *base)
return base->flag & BASE_VISIBLE_VIEWLAYER;
}
+bool BKE_object_is_visible_in_viewport(const struct View3D *v3d, const struct Object *ob)
+{
+ if (ob->restrictflag & OB_RESTRICT_VIEWPORT) {
+ return false;
+ }
+
+ if ((v3d->object_type_exclude_viewport & (1 << ob->type)) != 0) {
+ return false;
+ }
+
+ if (v3d->localvd && ((v3d->local_view_uuid & ob->base_local_view_bits) == 0)) {
+ return false;
+ }
+
+ if ((v3d->flag & V3D_LOCAL_COLLECTIONS) &&
+ ((v3d->local_collections_uuid & ob->runtime.local_collections_bits) == 0)) {
+ return false;
+ }
+
+ /* If not using local view or local collection the object may still be in a hidden collection. */
+ if (((v3d->localvd) == NULL) && ((v3d->flag & V3D_LOCAL_COLLECTIONS) == 0)) {
+ return (ob->base_flag & BASE_VISIBLE_VIEWLAYER) != 0;
+ }
+
+ return true;
+}
+
static void layer_collection_flag_set_recursive(LayerCollection *lc, const int flag)
{
lc->flag |= flag;
diff --git a/source/blender/blenlib/BLI_gsqueue.h b/source/blender/blenlib/BLI_gsqueue.h
index 4bd53dfddbe..b8a87e9d9fa 100644
--- a/source/blender/blenlib/BLI_gsqueue.h
+++ b/source/blender/blenlib/BLI_gsqueue.h
@@ -26,7 +26,7 @@
typedef struct _GSQueue GSQueue;
-GSQueue *BLI_gsqueue_new(size_t elem_size);
+GSQueue *BLI_gsqueue_new(const size_t elem_size);
bool BLI_gsqueue_is_empty(const GSQueue *gq);
size_t BLI_gsqueue_len(const GSQueue *gq);
void BLI_gsqueue_pop(GSQueue *gq, void *r_item);
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index 05a2d766fe0..fd5de717a24 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -209,7 +209,6 @@ int BLI_exists(const char *name)
BLI_stat_t st;
wchar_t *tmp_16 = alloc_utf16_from_8(name, 1);
int len, res;
- unsigned int old_error_mode;
len = wcslen(tmp_16);
/* in Windows #stat doesn't recognize dir ending on a slash
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 51db656bf63..9e28627ba3d 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1575,25 +1575,6 @@ void DRW_draw_view(const bContext *C)
DRW_draw_render_loop_ex(depsgraph, engine_type, ar, v3d, viewport, C);
}
-static bool is_object_visible_in_viewport(View3D *v3d, Object *ob)
-{
- if (v3d->localvd && ((v3d->local_view_uuid & ob->base_local_view_bits) == 0)) {
- return false;
- }
-
- if ((v3d->flag & V3D_LOCAL_COLLECTIONS) &&
- ((v3d->local_collections_uuid & ob->runtime.local_collections_bits) == 0)) {
- return false;
- }
-
- /* If not using local view or local collection the object may still be in a hidden collection. */
- if (((v3d->localvd) == NULL) && ((v3d->flag & V3D_LOCAL_COLLECTIONS) == 0)) {
- return (ob->base_flag & BASE_VISIBLE_VIEWLAYER) != 0;
- }
-
- return true;
-}
-
/**
* Used for both regular and off-screen drawing.
* Need to reset DST before calling this function
@@ -1669,7 +1650,7 @@ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph,
if ((object_type_exclude_viewport & (1 << ob->type)) != 0) {
continue;
}
- if (!is_object_visible_in_viewport(v3d, ob)) {
+ if (!BKE_object_is_visible_in_viewport(v3d, ob)) {
continue;
}
DST.dupli_parent = data_.dupli_parent;
@@ -2369,7 +2350,7 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph,
v3d->object_type_exclude_select);
bool filter_exclude = false;
DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN (depsgraph, ob) {
- if (!is_object_visible_in_viewport(v3d, ob)) {
+ if (!BKE_object_is_visible_in_viewport(v3d, ob)) {
continue;
}
if ((ob->base_flag & BASE_SELECTABLE) &&
@@ -2519,7 +2500,7 @@ static void drw_draw_depth_loop_imp(struct Depsgraph *depsgraph,
if ((object_type_exclude_viewport & (1 << ob->type)) != 0) {
continue;
}
- if (!is_object_visible_in_viewport(v3d, ob)) {
+ if (!BKE_object_is_visible_in_viewport(v3d, ob)) {
continue;
}
DST.dupli_parent = data_.dupli_parent;
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 27cccf6bab1..d29233618de 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -831,7 +831,7 @@ void filelist_setfilter_options(FileList *filelist,
}
if ((filelist->filter_data.filter != filter) || (filelist->filter_data.filter_id != filter_id)) {
filelist->filter_data.filter = filter;
- filelist->filter_data.filter_id = filter_id;
+ filelist->filter_data.filter_id = (filter & FILE_TYPE_BLENDERLIB) ? filter_id : FILTER_ID_ALL;
update = true;
}
if (!STREQ(filelist->filter_data.filter_glob, filter_glob)) {
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 0b6d5661577..ba4ccb4fba9 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -247,13 +247,7 @@ short ED_fileselect_set_params(SpaceFile *sfile)
}
/* For now, always init filterid to 'all true' */
- params->filter_id = FILTER_ID_AC | FILTER_ID_AR | FILTER_ID_BR | FILTER_ID_CA | FILTER_ID_CU |
- FILTER_ID_GD | FILTER_ID_GR | FILTER_ID_IM | FILTER_ID_LA | FILTER_ID_LS |
- FILTER_ID_LT | FILTER_ID_MA | FILTER_ID_MB | FILTER_ID_MC | FILTER_ID_ME |
- FILTER_ID_MSK | FILTER_ID_NT | FILTER_ID_OB | FILTER_ID_PA |
- FILTER_ID_PAL | FILTER_ID_PC | FILTER_ID_SCE | FILTER_ID_SPK |
- FILTER_ID_SO | FILTER_ID_TE | FILTER_ID_TXT | FILTER_ID_VF | FILTER_ID_WO |
- FILTER_ID_CF | FILTER_ID_WS | FILTER_ID_LP;
+ params->filter_id = FILTER_ID_ALL;
if (U.uiflag & USER_HIDE_DOT) {
params->flag |= FILE_HIDE_DOT;
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index a6212e09567..47bf49294b6 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -697,6 +697,13 @@ enum {
FILTER_ID_LP = (1u << 31),
};
+#define FILTER_ID_ALL \
+ (FILTER_ID_AC | FILTER_ID_AR | FILTER_ID_BR | FILTER_ID_CA | FILTER_ID_CU | FILTER_ID_GD | \
+ FILTER_ID_LS | FILTER_ID_LT | FILTER_ID_MA | FILTER_ID_MB | FILTER_ID_MC | FILTER_ID_ME | \
+ FILTER_ID_MSK | FILTER_ID_NT | FILTER_ID_OB | FILTER_ID_PA | FILTER_ID_PAL | FILTER_ID_PC | \
+ FILTER_ID_SCE | FILTER_ID_SPK | FILTER_ID_SO | FILTER_ID_TE | FILTER_ID_TXT | FILTER_ID_VF | \
+ FILTER_ID_WO | FILTER_ID_CF | FILTER_ID_WS | FILTER_ID_LP)
+
/* IMPORTANT: this enum matches the order currently use in set_listbasepointers,
* keep them in sync! */
enum {
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 56d25f5bebf..babf388bfc7 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -70,6 +70,7 @@ static const EnumPropertyItem space_items[] = {
# include "BKE_customdata.h"
# include "BKE_font.h"
# include "BKE_global.h"
+# include "BKE_layer.h"
# include "BKE_main.h"
# include "BKE_mesh.h"
# include "BKE_mball.h"
@@ -283,6 +284,11 @@ static void rna_Object_local_view_set(Object *ob,
}
}
+static bool rna_Object_visible_in_viewport_get(Object *ob, View3D *v3d)
+{
+ return BKE_object_is_visible_in_viewport(v3d, ob);
+}
+
/* Convert a given matrix from a space to another (using the object and/or a bone as
* reference). */
static void rna_Object_mat_convert_space(Object *ob,
@@ -825,6 +831,15 @@ void RNA_api_object(StructRNA *srna)
parm = RNA_def_boolean(func, "state", 0, "", "Local view state to define");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* Viewport */
+ func = RNA_def_function(srna, "visible_in_viewport_get", "rna_Object_visible_in_viewport_get");
+ RNA_def_function_ui_description(
+ func, "Check for local view and local collections for this viewport and object");
+ parm = RNA_def_pointer(func, "viewport", "SpaceView3D", "", "Viewport in local collections");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_boolean(func, "result", 0, "", "Object viewport visibility");
+ RNA_def_function_return(func, parm);
+
/* Matrix space conversion */
func = RNA_def_function(srna, "convert_space", "rna_Object_mat_convert_space");
RNA_def_function_ui_description(