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:
authorSergey Sharybin <sergey@blender.org>2022-08-30 17:54:17 +0300
committerSergey Sharybin <sergey@blender.org>2022-08-31 16:11:18 +0300
commitac20970bc208aef6257b16e129f08dcbe892869d (patch)
tree467f47604378424240577b9af2f500075efc9abd /source/blender/depsgraph/intern/eval/deg_eval_visibility.cc
parent5a1b733a67e35c4a6d043197b3a88fa178225869 (diff)
Depsgraph: optimize out evaluation of hidden objects
This change makes it so that objects which are temporary hidden from the viewport (the icon toggle in outliner) do not affect on the performance of the viewport. The attached file demonstrates the issue. Before this change hiding the object does not change FPS, after this change FPS goes high when the object is hidden. F13435936 Changing the object temporary visibility is already expected to tag scene for bases updates, which flushes down the stream to the object visibility update. So the only remaining topic was to ensure the graph does a special round of visibility update on such changes. Differential Revision: https://developer.blender.org/D15813
Diffstat (limited to 'source/blender/depsgraph/intern/eval/deg_eval_visibility.cc')
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_visibility.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_visibility.cc b/source/blender/depsgraph/intern/eval/deg_eval_visibility.cc
index a056ba1dfa7..e35e992fc8b 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_visibility.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_visibility.cc
@@ -34,10 +34,14 @@ void deg_evaluate_object_node_visibility(::Depsgraph *depsgraph, IDNode *id_node
DEG_debug_print_eval(depsgraph, __func__, object->id.name, &object->id);
- const int required_flags = (graph->mode == DAG_EVAL_VIEWPORT) ? BASE_ENABLED_VIEWPORT :
- BASE_ENABLED_RENDER;
-
- const bool is_enabled = object->base_flag & required_flags;
+ bool is_enabled;
+ if (graph->mode == DAG_EVAL_VIEWPORT) {
+ is_enabled = (object->base_flag & BASE_ENABLED_VIEWPORT) &&
+ ((object->base_flag & BASE_HIDDEN) == 0);
+ }
+ else {
+ is_enabled = (object->base_flag & BASE_ENABLED_RENDER);
+ };
if (id_node->is_enabled_on_eval != is_enabled) {
id_node->is_enabled_on_eval = is_enabled;