diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-03-17 14:47:29 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-04-01 02:27:08 +0300 |
commit | eba09b1520c06df304bc353e93d7220b4e83b755 (patch) | |
tree | 27f1e1e397a78b3f2f11a986599ee82d7bbcb89d /source/blender/blenkernel/BKE_layer.h | |
parent | 97b9afda3719627b9e52d1862ffd3b0b3ef12518 (diff) |
Blender 2.8: Hook of layer collections evaluation in DEG
This moves selectability/visibility flag flush from some hardcoded
places in the code to depsgraph. This way it is possible to simply
tag depsgraph to update those flags and rest it'll do on its own.
Using depsgraph for such flush is an overkill: those flags are fully
static and can not be animated, so it doesn't really make sense to
hook only those to depsgraph.
However, in the future we will have overrides on collections, which
ideally would need to be animatable and drivable and easiest way
to support this is to do this on depsgraph level, so it ensures
proper order of evaluation for animation and drivers. And it seems
logical to do both overrides and flags flush from depsgraph from
this point of view.
This commit also includes the evaluation of IDProperty for collections,
which basically are just another form of override. So once we implement
the other kind of overrides the flushing and collection evaluation won't
change.
Patch by Sergey Sharybin and Dalai Felinto
Diffstat (limited to 'source/blender/blenkernel/BKE_layer.h')
-rw-r--r-- | source/blender/blenkernel/BKE_layer.h | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h index 07d1c255188..9e7155cf482 100644 --- a/source/blender/blenkernel/BKE_layer.h +++ b/source/blender/blenkernel/BKE_layer.h @@ -44,6 +44,7 @@ extern "C" { #define ROOT_PROP "root" +struct EvaluationContext; struct LayerCollection; struct ID; struct IDProperty; @@ -72,12 +73,6 @@ struct SceneLayer *BKE_scene_layer_find_from_collection(const struct Scene *scen struct Base *BKE_scene_layer_base_find(struct SceneLayer *sl, struct Object *ob); void BKE_scene_layer_base_deselect_all(struct SceneLayer *sl); void BKE_scene_layer_base_select(struct SceneLayer *sl, struct Base *selbase); -void BKE_scene_layer_base_flag_recalculate(struct SceneLayer *sl); - -void BKE_scene_layer_engine_settings_recalculate(struct SceneLayer *sl); -void BKE_scene_layer_engine_settings_object_recalculate(struct SceneLayer *sl, struct Object *ob); -void BKE_scene_layer_engine_settings_collection_recalculate(struct SceneLayer *sl, struct LayerCollection *lc); -void BKE_scene_layer_engine_settings_update(struct Scene *scene, struct SceneLayer *sl); void BKE_layer_collection_free(struct SceneLayer *sl, struct LayerCollection *lc); @@ -129,6 +124,18 @@ void BKE_collection_engine_property_value_set_int(struct IDProperty *props, cons void BKE_collection_engine_property_value_set_float(struct IDProperty *props, const char *name, float value); void BKE_collection_engine_property_value_set_bool(struct IDProperty *props, const char *name, bool value); +/* evaluation */ + +void BKE_layer_eval_layer_collection_pre(struct EvaluationContext *eval_ctx, + struct Scene *scene, + struct SceneLayer *scene_layer); +void BKE_layer_eval_layer_collection(struct EvaluationContext *eval_ctx, + struct Scene *scene, + struct LayerCollection *layer_collection, + struct LayerCollection *parent_layer_collection); +void BKE_layer_eval_layer_collection_post(struct EvaluationContext *eval_ctx, + struct SceneLayer *scene_layer); + /* iterators */ void BKE_selected_objects_Iterator_begin(Iterator *iter, void *data_in); @@ -188,18 +195,18 @@ void BKE_visible_bases_Iterator_end(Iterator *iter); IteratorBeginCb func_begin; \ IteratorCb func_next, func_end; \ void *data_in; \ - \ + \ if (flag == SELECT) { \ - func_begin = &BKE_selected_objects_Iterator_begin; \ - func_next = &BKE_selected_objects_Iterator_next; \ - func_end = &BKE_selected_objects_Iterator_end; \ - data_in = (sl); \ + func_begin = &BKE_selected_objects_Iterator_begin; \ + func_next = &BKE_selected_objects_Iterator_next; \ + func_end = &BKE_selected_objects_Iterator_end; \ + data_in = (sl); \ } \ else { \ - func_begin = BKE_scene_objects_Iterator_begin; \ - func_next = BKE_scene_objects_Iterator_next; \ - func_end = BKE_scene_objects_Iterator_end; \ - data_in = (scene); \ + func_begin = BKE_scene_objects_Iterator_begin; \ + func_next = BKE_scene_objects_Iterator_next; \ + func_end = BKE_scene_objects_Iterator_end; \ + data_in = (scene); \ } \ ITER_BEGIN(func_begin, func_next, func_end, data_in, Object *, _instance) @@ -208,24 +215,20 @@ void BKE_visible_bases_Iterator_end(Iterator *iter); ITER_END \ } -/* temporary hacky solution waiting for final depsgraph evaluation */ -#define DEG_OBJECT_ITER(scene_, sl_, instance_) \ +/* temporary hacky solution waiting for CoW depsgraph implementation */ +#define DEG_OBJECT_ITER(sl_, instance_) \ { \ + /* flush all the depsgraph data to objects */ \ Object *instance_; \ - /* temporary solution, waiting for depsgraph update */ \ - BKE_scene_layer_engine_settings_update(scene_, sl_); \ - \ - /* flush all the data to objects*/ \ Base *base_; \ for (base_ = (sl_)->object_bases.first; base_; base_ = base_->next) { \ - if ((base_->flag & BASE_VISIBLED) == 0) { \ - continue; \ - } \ - \ - instance_ = base_->object; \ - instance_->base_flag = base_->flag; + if ((base_->flag & BASE_VISIBLED) != 0) { \ + instance_ = base_->object; \ + instance_->base_flag = base_->flag; \ + instance_->base_collection_properties = base_->collection_properties; #define DEG_OBJECT_ITER_END \ + } \ } \ } |