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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-03-12 20:24:33 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-03-12 20:28:49 +0300
commitc427590c4eb60a7187d9f340066ff837f9179cd5 (patch)
tree38d95e2825dedbe66692aea16c3798bf81092e0d /source/blender/blenkernel/intern/layer.c
parent834d3962b99df675788021766679e7e889694926 (diff)
Fix T62388: object.visible_get() not affected by object.hide_viewport.
After recent changes BASE_VISIBLE was not always disabled properly when the object is hidden. This refactors the code a bit to hopefully be more clear.
Diffstat (limited to 'source/blender/blenkernel/intern/layer.c')
-rw-r--r--source/blender/blenkernel/intern/layer.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index a5360f34312..9a6e570e03b 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -1443,23 +1443,35 @@ void BKE_view_layer_bases_in_mode_iterator_end(BLI_Iterator *UNUSED(iter))
/* Evaluation */
/* Applies object's restrict flags on top of flags coming from the collection
- * and stores those in base->flag. */
+ * and stores those in base->flag. BASE_VISIBLE is based on viewport visibility. */
void BKE_base_eval_flags(Base *base)
{
- const int object_restrict = base->object->restrictflag;
+ /* Apply collection flags. */
base->flag &= ~g_base_collection_flags;
base->flag |= (base->flag_from_collection & g_base_collection_flags);
+
+ /* Apply object restrictions. */
+ const int object_restrict = base->object->restrictflag;
if (object_restrict & OB_RESTRICT_VIEW) {
- base->flag &= ~(BASE_ENABLED_VIEWPORT | BASE_SELECTABLE);
+ base->flag &= ~BASE_ENABLED_VIEWPORT;
+ }
+ if (object_restrict & OB_RESTRICT_RENDER) {
+ base->flag &= ~BASE_ENABLED_RENDER;
}
if (object_restrict & OB_RESTRICT_SELECT) {
base->flag &= ~BASE_SELECTABLE;
}
- if (object_restrict & OB_RESTRICT_RENDER) {
- base->flag &= ~BASE_ENABLED_RENDER;
+
+ /* Apply viewport visibility by default. The dependency graph for render
+ * can change these again, but for tools we always want the viewport
+ * visibility to be in sync regardless if depsgraph was evaluated. */
+ if (!(base->flag & BASE_ENABLED_VIEWPORT) || (base->flag & BASE_HIDDEN)) {
+ base->flag &= ~(BASE_VISIBLE | BASE_SELECTABLE);
}
- if (base->flag & BASE_HIDDEN) {
- base->flag &= ~BASE_VISIBLE;
+
+ /* Deselect unselectable objects. */
+ if (!(base->flag & BASE_SELECTABLE)) {
+ base->flag &= ~BASE_SELECTED;
}
}