diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-06-01 16:26:47 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-06-02 11:45:45 +0300 |
commit | 824bf261f773465fd3463d39725143ba827a5808 (patch) | |
tree | d56204f12bda0951e8c313d3f26cd98193c152e7 /source/blender/depsgraph/DEG_depsgraph_query.h | |
parent | f8ea2c92db4a49b2de8bd3059190d2342380c03c (diff) |
Initial implememtation for dupli objects
Now dupli groups, objects, particles, ... are all working.
This introduces a flag for the iterator to determine whether we go over
Set and dupli objects or not.
Important to remember to keep the iteration of DEG_ as readonly.
Cycles is not working well for dupli groups, and it's memleaking
for dupli particles. So for now we iterate over main objects and set
only, not dupli.
To change that go in rna_scene.c and:
-DEG_OBJECT_ITER(graph, ob, DEG_OBJECT_ITER_FLAG_SET)
+DEG_OBJECT_ITER(graph, ob, DEG_OBJECT_ITER_FLAG_ALL)
Review and suggestions by Sergey Sharybin
Diffstat (limited to 'source/blender/depsgraph/DEG_depsgraph_query.h')
-rw-r--r-- | source/blender/depsgraph/DEG_depsgraph_query.h | 53 |
1 files changed, 43 insertions, 10 deletions
diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h b/source/blender/depsgraph/DEG_depsgraph_query.h index 6f7f98861dd..ff2126992c4 100644 --- a/source/blender/depsgraph/DEG_depsgraph_query.h +++ b/source/blender/depsgraph/DEG_depsgraph_query.h @@ -35,8 +35,12 @@ struct ID; -struct Depsgraph; +struct Base; struct BLI_Iterator; +struct Depsgraph; +struct DupliObject; +struct ListBase; +struct Scene; struct SceneLayer; #ifdef __cplusplus @@ -60,19 +64,48 @@ struct Object *DEG_get_object(struct Depsgraph *depsgraph, struct Object *ob); /* ************************ DAG iterators ********************* */ -void DEG_objects_iterator_begin(struct BLI_Iterator *iter, void *data_in); +enum { + DEG_OBJECT_ITER_FLAG_SET = (1 << 0), + DEG_OBJECT_ITER_FLAG_DUPLI = (1 << 1), +}; + +#define DEG_OBJECT_ITER_FLAG_ALL (DEG_OBJECT_ITER_FLAG_SET | DEG_OBJECT_ITER_FLAG_DUPLI) + +typedef struct DEGObjectsIteratorData { + struct Depsgraph *graph; + struct Scene *scene; + struct EvaluationContext *eval_ctx; + struct SceneLayer *scene_layer; + struct Base *base; + int base_flag; + int flag; + + /* Dupli */ + struct ListBase *dupli_list; + struct DupliObject *dupli_object; + struct Object temp_dupli_object; +} DEGObjectsIteratorData; + +void DEG_objects_iterator_begin(struct BLI_Iterator *iter, DEGObjectsIteratorData *data); void DEG_objects_iterator_next(struct BLI_Iterator *iter); void DEG_objects_iterator_end(struct BLI_Iterator *iter); /* Temporary hacky solution waiting for cow depsgraph implementation. */ -#define DEG_OBJECT_ITER(graph_, instance_) \ - ITER_BEGIN(DEG_objects_iterator_begin, \ - DEG_objects_iterator_next, \ - DEG_objects_iterator_end, \ - graph_, Object *, instance_) - -#define DEG_OBJECT_ITER_END \ - ITER_END +#define DEG_OBJECT_ITER(graph_, instance_, flag_) \ + { \ + DEGObjectsIteratorData data_ = { \ + .graph = (graph_), \ + .flag = (flag_), \ + }; \ + \ + ITER_BEGIN(DEG_objects_iterator_begin, \ + DEG_objects_iterator_next, \ + DEG_objects_iterator_end, \ + &data_, Object *, instance_) + +#define DEG_OBJECT_ITER_END \ + ITER_END \ + } #ifdef __cplusplus } /* extern "C" */ |