Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
/*
|
|
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2013 Blender Foundation.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Original Author: Joshua Leung
|
|
|
|
|
* Contributor(s): None Yet
|
|
|
|
|
*
|
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2015-05-20 12:54:45 +10:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/** \file blender/depsgraph/intern/depsgraph_query.cc
|
|
|
|
|
* \ingroup depsgraph
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
*
|
|
|
|
|
* Implementation of Querying and Filtering API's
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
|
|
extern "C" {
|
2017-06-01 15:26:47 +02:00
|
|
|
#include "BLI_math.h"
|
|
|
|
|
#include "BKE_anim.h"
|
2016-08-08 17:51:15 +02:00
|
|
|
#include "BKE_idcode.h"
|
2017-04-20 17:09:18 +02:00
|
|
|
#include "BKE_layer.h"
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
#include "BKE_main.h"
|
2017-06-06 12:14:39 +02:00
|
|
|
} /* extern "C" */
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
|
2017-04-21 11:42:59 +02:00
|
|
|
#include "DNA_object_types.h"
|
2017-04-20 17:09:18 +02:00
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
|
|
2017-06-01 15:26:47 +02:00
|
|
|
#include "DEG_depsgraph.h"
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
#include "DEG_depsgraph_query.h"
|
|
|
|
|
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
#include "intern/depsgraph_intern.h"
|
2017-04-20 17:09:18 +02:00
|
|
|
#include "util/deg_util_foreach.h"
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
|
|
|
|
|
bool DEG_id_type_tagged(Main *bmain, short idtype)
|
|
|
|
|
{
|
2016-08-08 17:51:15 +02:00
|
|
|
return bmain->id_tag_update[BKE_idcode_to_index(idtype)] != 0;
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
short DEG_get_eval_flags_for_id(Depsgraph *graph, ID *id)
|
|
|
|
|
{
|
|
|
|
|
if (graph == NULL) {
|
|
|
|
|
/* Happens when converting objects to mesh from a python script
|
|
|
|
|
* after modifying scene graph.
|
|
|
|
|
*
|
|
|
|
|
* Currently harmless because it's only called for temporary
|
|
|
|
|
* objects which are out of the DAG anyway.
|
|
|
|
|
*/
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
Depsgraph: Cleanup and code simplification
This is mainly a maintenance commit which was aimed to make work with
this module more pleasant and solve such issues as:
- Annoyance with looong files, which had craftload in them
- Usage of STL for the data structures we've got in BLI
- Possible symbol conflicts
- Not real clear layout of what is located where
So in this commit the following changes are done:
- STL is prohibited, it's not really predictable on various compilers,
with our BLI algorithms we can predict things much better.
There are still few usages of std::vector, but that we'll be
solving later once we've got similar thing in BLI.
- Simplify foreach loops, avoid using const_iterator all over the place.
- New directory layout, which is hopefully easier to follow.
- Some files were split, some of them will be split soon.
The idea of this is to split huge functions into own files with
good documentation and everything.
- Removed stuff which was planned for use in the future but was never
finished, tested or anything.
Let's wipe it out for now, and bring back once we really start using
it, so it'll be more clear if it solves our needs.
- All the internal routines were moved to DEG namespace to separate
them better from rest of blender.
Some places now annoyingly using DEG::foo, but that we can olve by
moving some utility functions inside of the namespace.
While working on this we've found some hotspot in updates flush, so
now playback of blenrig is few percent faster (something like 96fps
with previous master and around 99-100fps after this change).
Not saying it's something final, there is still room for cleanup and
API simplification, but those might happen as a regular development
now without doing any global changes.
2016-05-27 18:01:18 +02:00
|
|
|
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
|
|
|
|
|
|
|
|
|
|
DEG::IDDepsNode *id_node = deg_graph->find_id_node(id);
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
if (id_node == NULL) {
|
|
|
|
|
/* TODO(sergey): Does it mean we need to check set scene? */
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return id_node->eval_flags;
|
|
|
|
|
}
|
2017-04-20 17:09:18 +02:00
|
|
|
|
2017-05-26 11:23:10 +02:00
|
|
|
Scene *DEG_get_scene(Depsgraph *graph)
|
2017-04-20 17:09:18 +02:00
|
|
|
{
|
2017-04-25 17:46:23 +02:00
|
|
|
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
|
|
|
|
|
return deg_graph->scene;
|
2017-04-20 17:09:18 +02:00
|
|
|
}
|
2017-04-20 18:59:47 +02:00
|
|
|
|
2017-05-26 11:23:10 +02:00
|
|
|
SceneLayer *DEG_get_scene_layer(Depsgraph *graph)
|
2017-04-20 18:59:47 +02:00
|
|
|
{
|
2017-05-26 11:23:10 +02:00
|
|
|
Scene *scene = DEG_get_scene(graph);
|
2017-04-20 18:59:47 +02:00
|
|
|
if (scene) {
|
|
|
|
|
return BKE_scene_layer_context_active(scene);
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2017-04-21 11:29:47 +02:00
|
|
|
|
2017-05-26 11:23:10 +02:00
|
|
|
Object *DEG_get_object(Depsgraph * /*depsgraph*/, Object *ob)
|
2017-04-21 11:29:47 +02:00
|
|
|
{
|
|
|
|
|
/* XXX TODO */
|
|
|
|
|
return ob;
|
|
|
|
|
}
|
2017-04-21 11:42:59 +02:00
|
|
|
|
|
|
|
|
/* ************************ DAG ITERATORS ********************* */
|
|
|
|
|
|
2017-06-03 02:21:10 +10:00
|
|
|
#define BASE_FLUSH_FLAGS (BASE_FROM_SET | BASE_FROMDUPLI)
|
|
|
|
|
|
2017-06-01 15:26:47 +02:00
|
|
|
void DEG_objects_iterator_begin(BLI_Iterator *iter, DEGObjectsIteratorData *data)
|
2017-04-21 11:42:59 +02:00
|
|
|
{
|
2017-06-01 15:26:47 +02:00
|
|
|
Depsgraph *graph = data->graph;
|
2017-06-06 13:58:40 +02:00
|
|
|
SceneLayer *scene_layer = DEG_get_scene_layer(graph);
|
2017-06-01 15:26:47 +02:00
|
|
|
|
2017-04-21 11:42:59 +02:00
|
|
|
iter->data = data;
|
|
|
|
|
iter->valid = true;
|
|
|
|
|
|
2017-05-26 11:23:10 +02:00
|
|
|
data->scene = DEG_get_scene(graph);
|
2017-06-08 16:11:14 +02:00
|
|
|
DEG_evaluation_context_init(&data->eval_ctx, DAG_EVAL_RENDER);
|
2017-04-21 11:42:59 +02:00
|
|
|
|
2017-06-06 13:58:40 +02:00
|
|
|
/* TODO(sergey): It's really confusing to store pointer to a local data. */
|
2017-04-21 11:42:59 +02:00
|
|
|
Base base = {(Base *)scene_layer->object_bases.first, NULL};
|
|
|
|
|
data->base = &base;
|
2017-06-06 13:58:40 +02:00
|
|
|
|
|
|
|
|
data->base_flag = ~(BASE_FLUSH_FLAGS);
|
|
|
|
|
|
|
|
|
|
data->dupli_parent = NULL;
|
|
|
|
|
data->dupli_list = NULL;
|
|
|
|
|
data->dupli_object_next = NULL;
|
|
|
|
|
data->dupli_object_current = NULL;
|
|
|
|
|
|
2017-05-26 11:23:10 +02:00
|
|
|
DEG_objects_iterator_next(iter);
|
2017-04-21 11:42:59 +02:00
|
|
|
}
|
|
|
|
|
|
2017-06-01 15:26:47 +02:00
|
|
|
/**
|
|
|
|
|
* Temporary function to flush depsgraph until we get copy on write (CoW)
|
|
|
|
|
*/
|
2017-06-06 13:58:40 +02:00
|
|
|
static void deg_flush_base_flags_and_settings(Object *ob, Base *base, const int flag)
|
2017-06-01 15:26:47 +02:00
|
|
|
{
|
2017-06-03 02:21:10 +10:00
|
|
|
ob->base_flag = (base->flag | BASE_FLUSH_FLAGS) & flag;
|
2017-06-01 15:26:47 +02:00
|
|
|
ob->base_collection_properties = base->collection_properties;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool deg_objects_dupli_iterator_next(BLI_Iterator *iter)
|
|
|
|
|
{
|
|
|
|
|
DEGObjectsIteratorData *data = (DEGObjectsIteratorData *)iter->data;
|
2017-06-06 13:58:40 +02:00
|
|
|
while (data->dupli_object_next != NULL) {
|
|
|
|
|
DupliObject *dob = data->dupli_object_next;
|
2017-06-01 15:26:47 +02:00
|
|
|
Object *obd = dob->ob;
|
|
|
|
|
|
2017-06-06 13:58:40 +02:00
|
|
|
data->dupli_object_next = data->dupli_object_next->next;
|
2017-06-01 15:26:47 +02:00
|
|
|
|
2017-06-08 19:03:42 +02:00
|
|
|
/* Group duplis need to set ob matrices correct, for deform. so no_draw
|
|
|
|
|
* is part handled.
|
|
|
|
|
*/
|
|
|
|
|
if ((obd->transflag & OB_RENDER_DUPLI) == 0 && dob->no_draw) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-01 15:26:47 +02:00
|
|
|
if (obd->type == OB_MBALL) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-06 13:58:40 +02:00
|
|
|
data->dupli_object_current = dob;
|
|
|
|
|
|
2017-06-01 15:26:47 +02:00
|
|
|
/* Temporary object to evaluate. */
|
|
|
|
|
data->temp_dupli_object = *dob->ob;
|
|
|
|
|
copy_m4_m4(data->temp_dupli_object.obmat, dob->mat);
|
|
|
|
|
|
2017-06-06 13:58:40 +02:00
|
|
|
deg_flush_base_flags_and_settings(&data->temp_dupli_object,
|
|
|
|
|
data->base,
|
|
|
|
|
data->base_flag | BASE_FROMDUPLI);
|
2017-06-01 15:26:47 +02:00
|
|
|
iter->current = &data->temp_dupli_object;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-26 11:23:10 +02:00
|
|
|
void DEG_objects_iterator_next(BLI_Iterator *iter)
|
2017-04-21 11:42:59 +02:00
|
|
|
{
|
2017-05-26 11:23:10 +02:00
|
|
|
DEGObjectsIteratorData *data = (DEGObjectsIteratorData *)iter->data;
|
2017-06-01 15:26:47 +02:00
|
|
|
Base *base;
|
|
|
|
|
|
|
|
|
|
if (data->dupli_list) {
|
|
|
|
|
if (deg_objects_dupli_iterator_next(iter)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
free_object_duplilist(data->dupli_list);
|
2017-06-06 13:58:40 +02:00
|
|
|
data->dupli_parent = NULL;
|
2017-06-01 15:26:47 +02:00
|
|
|
data->dupli_list = NULL;
|
2017-06-06 13:58:40 +02:00
|
|
|
data->dupli_object_next = NULL;
|
|
|
|
|
data->dupli_object_current = NULL;
|
2017-06-01 15:26:47 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
base = data->base->next;
|
2017-06-06 13:58:40 +02:00
|
|
|
while (base != NULL) {
|
2017-04-21 15:26:53 +02:00
|
|
|
if ((base->flag & BASE_VISIBLED) != 0) {
|
2017-05-26 11:23:10 +02:00
|
|
|
Object *ob = DEG_get_object(data->graph, base->object);
|
2017-04-21 11:42:59 +02:00
|
|
|
iter->current = ob;
|
2017-06-01 15:26:47 +02:00
|
|
|
data->base = base;
|
2017-04-21 11:42:59 +02:00
|
|
|
|
2017-05-24 19:07:07 +02:00
|
|
|
/* Make sure we have the base collection settings is already populated.
|
|
|
|
|
* This will fail when BKE_layer_eval_layer_collection_pre hasn't run yet
|
|
|
|
|
* Which usually means a missing call to DAG_id_tag_update(). */
|
|
|
|
|
BLI_assert(!BLI_listbase_is_empty(&base->collection_properties->data.group));
|
|
|
|
|
|
2017-04-21 11:42:59 +02:00
|
|
|
/* Flushing depsgraph data. */
|
2017-06-06 13:58:40 +02:00
|
|
|
deg_flush_base_flags_and_settings(ob,
|
|
|
|
|
base,
|
|
|
|
|
data->base_flag);
|
2017-06-01 15:26:47 +02:00
|
|
|
|
|
|
|
|
if ((data->flag & DEG_OBJECT_ITER_FLAG_DUPLI) && (ob->transflag & OB_DUPLI)) {
|
2017-06-06 13:58:40 +02:00
|
|
|
data->dupli_parent = ob;
|
2017-06-08 16:11:14 +02:00
|
|
|
data->dupli_list = object_duplilist(&data->eval_ctx, data->scene, ob);
|
2017-06-06 13:58:40 +02:00
|
|
|
data->dupli_object_next = (DupliObject *)data->dupli_list->first;
|
2017-06-01 15:26:47 +02:00
|
|
|
}
|
2017-04-21 11:42:59 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
base = base->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Look for an object in the next set. */
|
2017-06-01 15:26:47 +02:00
|
|
|
if ((data->flag & DEG_OBJECT_ITER_FLAG_SET) && data->scene->set) {
|
2017-04-21 11:42:59 +02:00
|
|
|
SceneLayer *scene_layer;
|
|
|
|
|
data->scene = data->scene->set;
|
2017-06-01 15:26:47 +02:00
|
|
|
data->base_flag = ~(BASE_SELECTED | BASE_SELECTABLED);
|
2017-04-21 11:42:59 +02:00
|
|
|
|
|
|
|
|
/* For the sets we use the layer used for rendering. */
|
|
|
|
|
scene_layer = BKE_scene_layer_render_active(data->scene);
|
|
|
|
|
|
2017-06-06 13:58:40 +02:00
|
|
|
/* TODO(sergey): It's really confusing to store pointer to a local data. */
|
2017-04-21 11:42:59 +02:00
|
|
|
Base base = {(Base *)scene_layer->object_bases.first, NULL};
|
|
|
|
|
data->base = &base;
|
2017-05-26 11:23:10 +02:00
|
|
|
DEG_objects_iterator_next(iter);
|
2017-04-21 11:42:59 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
iter->current = NULL;
|
|
|
|
|
iter->valid = false;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-26 11:23:10 +02:00
|
|
|
void DEG_objects_iterator_end(BLI_Iterator *iter)
|
2017-04-21 11:42:59 +02:00
|
|
|
{
|
2017-06-08 16:11:14 +02:00
|
|
|
#ifndef NDEBUG
|
2017-05-26 11:23:10 +02:00
|
|
|
DEGObjectsIteratorData *data = (DEGObjectsIteratorData *)iter->data;
|
2017-06-06 12:47:47 +02:00
|
|
|
/* Force crash in case the iterator data is referenced and accessed down the line. (T51718) */
|
2017-06-08 16:11:14 +02:00
|
|
|
memset(&data->temp_dupli_object, 0xff, sizeof(data->temp_dupli_object));
|
|
|
|
|
#else
|
|
|
|
|
(void) iter;
|
2017-06-06 12:47:47 +02:00
|
|
|
#endif
|
2017-04-21 11:42:59 +02:00
|
|
|
}
|