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
|
|
|
/*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup RNA
|
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 <stdlib.h>
|
|
|
|
|
|
|
|
|
|
#include "BLI_path_util.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BLI_utildefines.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 "RNA_define.h"
|
|
|
|
|
#include "RNA_enum_types.h"
|
|
|
|
|
|
|
|
|
|
#include "rna_internal.h"
|
|
|
|
|
|
2017-06-06 13:58:40 +02:00
|
|
|
#include "DNA_object_types.h"
|
|
|
|
|
|
2018-02-23 09:22:35 -03:00
|
|
|
#include "DEG_depsgraph.h"
|
|
|
|
|
|
2017-10-25 12:06:56 +02:00
|
|
|
#define STATS_MAX_SIZE 16384
|
|
|
|
|
|
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
|
|
|
#ifdef RNA_RUNTIME
|
|
|
|
|
|
2019-05-16 14:53:01 +02:00
|
|
|
# ifdef WITH_PYTHON
|
|
|
|
|
# include "BPY_extern.h"
|
|
|
|
|
# endif
|
|
|
|
|
|
2017-04-21 12:31:48 +02:00
|
|
|
# include "BLI_iterator.h"
|
2018-09-19 15:44:10 +02:00
|
|
|
# include "BLI_math.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
|
|
|
|
2020-09-13 15:28:41 +10:00
|
|
|
# include "RNA_access.h"
|
|
|
|
|
|
2020-04-03 11:35:04 +02:00
|
|
|
# include "BKE_duplilist.h"
|
2018-12-18 18:18:00 +01:00
|
|
|
# include "BKE_object.h"
|
Dependency graph API changes
Main goal here is to make it obvious and predictable about
what is going on.
Summary of changes.
- Access to dependency graph is now only possible to a fully evaluated
graph. This is now done via context.evaluated_depsgraph_get().
The call will ensure both relations and datablocks are updated.
This way we don't allow access to some known bad state of the graph,
and also making explicit that getting update dependency graph is not
cheap.
- Access to evaluated ID is now possible via id.evaluated_get().
It was already possible to get evaluated ID via dependency graph,
but that was a bit confusing why access to original is done via ID
and to evaluated via depsgraph.
If datablock is not covered by dependency graph it will be returned
as-is.
- Similarly, request for original from an ID which is not evaluated
will return ID as-is.
- Removed scene.update().
This is very expensive to update all the view layers.
- Added depsgraph.update().
Now when temporary changes to objects are to be done, this is to
happen on original object and then dependency graph is to be
updated.
- Changed object.to_mesh() to behave the following way:
* When is used for original object modifiers are ignored.
For meshes this acts similar to mesh-copy, not very useful but
allows to keep code paths similar (i.e. for exporter which has
Apply Modifiers option it's only matter choosing between original
and evaluated object, the to_mesh() part can stay the same).
For curves this gives a mesh which is constructed from displist
without taking own modifiers and modifiers of bevel/taper objects
into account.
For metaballs this gives empty mesh.
Polygonization of metaball is not possible from a single object.
* When is used for evaluated object modifiers are always applied.
In fact, no evaluation is happening, the mesh is either copied
as-is, or constructed from current state of curve cache.
Arguments to apply modifiers and calculate original coordinates (ORCO,
aka undeformed coordinates) are removed. The ORCO is to be calculated
as part of dependency graph evaluation.
File used to regression-test (a packed Python script into .blend):
{F7033464}
Patch to make addons tests to pass:
{F7033466}
NOTE: I've included changes to FBX exporter, and those are addressing
report T63689.
NOTE: All the enabled-by-default addons are to be ported still, but
first want to have agreement on this part of changes.
NOTE: Also need to work on documentation for Python API, but, again,
better be done after having agreement on this work.
Reviewers: brecht, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D4834
2019-05-09 11:26:49 +02:00
|
|
|
# include "BKE_scene.h"
|
2018-06-06 14:39:05 +02:00
|
|
|
|
2017-06-08 10:14:53 +02:00
|
|
|
# include "DEG_depsgraph_build.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_debug.h"
|
2017-04-20 17:21:06 +02:00
|
|
|
# include "DEG_depsgraph_query.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
|
|
|
|
2017-04-21 12:31:48 +02:00
|
|
|
# include "MEM_guardedalloc.h"
|
|
|
|
|
|
2018-05-30 15:21:21 +02:00
|
|
|
/* **************** Object Instance **************** */
|
2017-06-06 13:58:40 +02:00
|
|
|
|
2018-05-30 15:21:21 +02:00
|
|
|
static PointerRNA rna_DepsgraphObjectInstance_object_get(PointerRNA *ptr)
|
2017-06-06 13:58:40 +02:00
|
|
|
{
|
|
|
|
|
BLI_Iterator *iterator = ptr->data;
|
|
|
|
|
return rna_pointer_inherit_refine(ptr, &RNA_Object, iterator->current);
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-19 15:44:10 +02:00
|
|
|
static int rna_DepsgraphObjectInstance_is_instance_get(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
BLI_Iterator *iterator = ptr->data;
|
|
|
|
|
DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
|
|
|
|
|
return (deg_iter->dupli_object_current != NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-30 15:21:21 +02:00
|
|
|
static PointerRNA rna_DepsgraphObjectInstance_instance_object_get(PointerRNA *ptr)
|
2017-06-06 16:27:02 +02:00
|
|
|
{
|
|
|
|
|
BLI_Iterator *iterator = ptr->data;
|
2017-12-15 08:11:19 -02:00
|
|
|
DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
|
2017-06-06 16:27:02 +02:00
|
|
|
Object *instance_object = NULL;
|
|
|
|
|
if (deg_iter->dupli_object_current != NULL) {
|
|
|
|
|
instance_object = deg_iter->dupli_object_current->ob;
|
|
|
|
|
}
|
|
|
|
|
return rna_pointer_inherit_refine(ptr, &RNA_Object, instance_object);
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-18 18:18:00 +01:00
|
|
|
static bool rna_DepsgraphObjectInstance_show_self_get(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
BLI_Iterator *iterator = ptr->data;
|
|
|
|
|
DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
|
|
|
|
|
int ob_visibility = BKE_object_visibility(iterator->current, deg_iter->eval_mode);
|
|
|
|
|
return (ob_visibility & OB_VISIBLE_SELF) != 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool rna_DepsgraphObjectInstance_show_particles_get(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
BLI_Iterator *iterator = ptr->data;
|
|
|
|
|
DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
|
|
|
|
|
int ob_visibility = BKE_object_visibility(iterator->current, deg_iter->eval_mode);
|
|
|
|
|
return (ob_visibility & OB_VISIBLE_PARTICLES) != 0;
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-30 15:21:21 +02:00
|
|
|
static PointerRNA rna_DepsgraphObjectInstance_parent_get(PointerRNA *ptr)
|
2017-06-06 13:58:40 +02:00
|
|
|
{
|
|
|
|
|
BLI_Iterator *iterator = ptr->data;
|
2017-12-15 08:11:19 -02:00
|
|
|
DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
|
2017-06-06 13:58:40 +02:00
|
|
|
Object *dupli_parent = NULL;
|
|
|
|
|
if (deg_iter->dupli_object_current != NULL) {
|
|
|
|
|
dupli_parent = deg_iter->dupli_parent;
|
|
|
|
|
}
|
|
|
|
|
return rna_pointer_inherit_refine(ptr, &RNA_Object, dupli_parent);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-30 15:21:21 +02:00
|
|
|
static PointerRNA rna_DepsgraphObjectInstance_particle_system_get(PointerRNA *ptr)
|
2018-04-04 13:16:56 +02:00
|
|
|
{
|
|
|
|
|
BLI_Iterator *iterator = ptr->data;
|
|
|
|
|
DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
|
2018-09-19 15:44:10 +02:00
|
|
|
struct ParticleSystem *particle_system = NULL;
|
|
|
|
|
if (deg_iter->dupli_object_current != NULL) {
|
|
|
|
|
particle_system = deg_iter->dupli_object_current->particle_system;
|
|
|
|
|
}
|
|
|
|
|
return rna_pointer_inherit_refine(ptr, &RNA_ParticleSystem, particle_system);
|
2018-04-04 13:16:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-05-30 15:21:21 +02:00
|
|
|
static void rna_DepsgraphObjectInstance_persistent_id_get(PointerRNA *ptr, int *persistent_id)
|
2017-06-06 13:58:40 +02:00
|
|
|
{
|
|
|
|
|
BLI_Iterator *iterator = ptr->data;
|
2017-12-15 08:11:19 -02:00
|
|
|
DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
|
2018-09-19 15:44:10 +02:00
|
|
|
if (deg_iter->dupli_object_current != NULL) {
|
|
|
|
|
memcpy(persistent_id,
|
|
|
|
|
deg_iter->dupli_object_current->persistent_id,
|
|
|
|
|
sizeof(deg_iter->dupli_object_current->persistent_id));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
memset(persistent_id, 0, sizeof(deg_iter->dupli_object_current->persistent_id));
|
|
|
|
|
}
|
2017-06-06 13:58:40 +02:00
|
|
|
}
|
|
|
|
|
|
2018-09-19 15:44:10 +02:00
|
|
|
static unsigned int rna_DepsgraphObjectInstance_random_id_get(PointerRNA *ptr)
|
2017-06-06 13:58:40 +02:00
|
|
|
{
|
|
|
|
|
BLI_Iterator *iterator = ptr->data;
|
2017-12-15 08:11:19 -02:00
|
|
|
DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
|
2018-09-19 15:44:10 +02:00
|
|
|
if (deg_iter->dupli_object_current != NULL) {
|
|
|
|
|
return deg_iter->dupli_object_current->random_id;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2017-06-06 13:58:40 +02:00
|
|
|
}
|
|
|
|
|
|
2018-09-19 15:44:10 +02:00
|
|
|
static void rna_DepsgraphObjectInstance_matrix_world_get(PointerRNA *ptr, float *mat)
|
2017-06-06 13:58:40 +02:00
|
|
|
{
|
|
|
|
|
BLI_Iterator *iterator = ptr->data;
|
2017-12-15 08:11:19 -02:00
|
|
|
DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
|
2018-09-19 15:44:10 +02:00
|
|
|
if (deg_iter->dupli_object_current != NULL) {
|
|
|
|
|
copy_m4_m4((float(*)[4])mat, deg_iter->dupli_object_current->mat);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2019-01-17 12:28:50 +01:00
|
|
|
/* We can return actual object's matrix here, no reason to return identity matrix
|
|
|
|
|
* when this is not actually an instance... */
|
|
|
|
|
Object *ob = (Object *)iterator->current;
|
|
|
|
|
copy_m4_m4((float(*)[4])mat, ob->obmat);
|
2018-09-19 15:44:10 +02:00
|
|
|
}
|
2017-06-06 13:58:40 +02:00
|
|
|
}
|
|
|
|
|
|
2018-09-19 15:44:10 +02:00
|
|
|
static void rna_DepsgraphObjectInstance_orco_get(PointerRNA *ptr, float *orco)
|
2017-06-06 13:58:40 +02:00
|
|
|
{
|
|
|
|
|
BLI_Iterator *iterator = ptr->data;
|
2017-12-15 08:11:19 -02:00
|
|
|
DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
|
2018-09-19 15:44:10 +02:00
|
|
|
if (deg_iter->dupli_object_current != NULL) {
|
|
|
|
|
copy_v3_v3(orco, deg_iter->dupli_object_current->orco);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
zero_v3(orco);
|
|
|
|
|
}
|
2017-06-06 13:58:40 +02:00
|
|
|
}
|
|
|
|
|
|
2018-09-19 15:44:10 +02:00
|
|
|
static void rna_DepsgraphObjectInstance_uv_get(PointerRNA *ptr, float *uv)
|
2017-06-06 16:27:02 +02:00
|
|
|
{
|
|
|
|
|
BLI_Iterator *iterator = ptr->data;
|
2017-12-15 08:11:19 -02:00
|
|
|
DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
|
2018-09-19 15:44:10 +02:00
|
|
|
if (deg_iter->dupli_object_current != NULL) {
|
|
|
|
|
copy_v2_v2(uv, deg_iter->dupli_object_current->uv);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
zero_v2(uv);
|
|
|
|
|
}
|
2017-06-06 16:27:02 +02:00
|
|
|
}
|
|
|
|
|
|
2018-06-06 16:38:10 +02:00
|
|
|
/* ******************** Sorted ***************** */
|
|
|
|
|
|
|
|
|
|
static int rna_Depsgraph_mode_get(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
Depsgraph *depsgraph = ptr->data;
|
|
|
|
|
return DEG_get_mode(depsgraph);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-30 15:21:21 +02:00
|
|
|
/* ******************** Updates ***************** */
|
|
|
|
|
|
|
|
|
|
static PointerRNA rna_DepsgraphUpdate_id_get(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
return rna_pointer_inherit_refine(ptr, &RNA_ID, ptr->data);
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-13 23:15:15 +11:00
|
|
|
static bool rna_DepsgraphUpdate_is_updated_transform_get(PointerRNA *ptr)
|
2018-05-30 15:21:21 +02:00
|
|
|
{
|
|
|
|
|
ID *id = ptr->data;
|
2018-12-13 23:15:15 +11:00
|
|
|
return ((id->recalc & ID_RECALC_TRANSFORM) != 0);
|
2018-05-30 15:21:21 +02:00
|
|
|
}
|
|
|
|
|
|
2020-04-22 13:50:21 +02:00
|
|
|
static bool rna_DepsgraphUpdate_is_updated_shading_get(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
ID *id = ptr->data;
|
|
|
|
|
return ((id->recalc & ID_RECALC_SHADING) != 0);
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-13 23:15:15 +11:00
|
|
|
static bool rna_DepsgraphUpdate_is_updated_geometry_get(PointerRNA *ptr)
|
2018-05-30 15:21:21 +02:00
|
|
|
{
|
|
|
|
|
ID *id = ptr->data;
|
|
|
|
|
if (id->recalc & ID_RECALC_GEOMETRY) {
|
2018-12-13 23:15:15 +11:00
|
|
|
return true;
|
2018-05-30 15:21:21 +02:00
|
|
|
}
|
|
|
|
|
if (GS(id->name) != ID_OB) {
|
2018-12-13 23:15:15 +11:00
|
|
|
return false;
|
2018-05-30 15:21:21 +02:00
|
|
|
}
|
|
|
|
|
Object *object = (Object *)id;
|
|
|
|
|
ID *data = object->data;
|
|
|
|
|
if (data == NULL) {
|
2018-12-13 23:15:15 +11:00
|
|
|
return false;
|
2018-05-30 15:21:21 +02:00
|
|
|
}
|
2018-12-13 23:15:15 +11:00
|
|
|
return ((data->recalc & ID_RECALC_ALL) != 0);
|
2018-05-30 15:21:21 +02:00
|
|
|
}
|
|
|
|
|
|
2017-06-06 13:58:40 +02:00
|
|
|
/* **************** Depsgraph **************** */
|
|
|
|
|
|
2018-01-16 16:38:39 +01:00
|
|
|
static void rna_Depsgraph_debug_relations_graphviz(Depsgraph *depsgraph, const char *filename)
|
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
|
|
|
{
|
|
|
|
|
FILE *f = fopen(filename, "w");
|
2017-10-25 12:07:51 +02:00
|
|
|
if (f == NULL) {
|
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
|
|
|
return;
|
2017-10-25 12:07:51 +02:00
|
|
|
}
|
2018-01-16 16:38:39 +01:00
|
|
|
DEG_debug_relations_graphviz(depsgraph, f, "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
|
|
|
fclose(f);
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-16 16:38:39 +01:00
|
|
|
static void rna_Depsgraph_debug_stats_gnuplot(Depsgraph *depsgraph,
|
2017-12-21 16:14:15 +01:00
|
|
|
const char *filename,
|
|
|
|
|
const char *output_filename)
|
|
|
|
|
{
|
|
|
|
|
FILE *f = fopen(filename, "w");
|
|
|
|
|
if (f == NULL) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2018-01-16 16:38:39 +01:00
|
|
|
DEG_debug_stats_gnuplot(depsgraph, f, "Timing Statistics", output_filename);
|
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
|
|
|
fclose(f);
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-16 16:38:39 +01:00
|
|
|
static void rna_Depsgraph_debug_tag_update(Depsgraph *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
|
|
|
{
|
2018-01-16 16:38:39 +01:00
|
|
|
DEG_graph_tag_relations_update(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
|
|
|
}
|
|
|
|
|
|
2018-01-16 16:38:39 +01:00
|
|
|
static void rna_Depsgraph_debug_stats(Depsgraph *depsgraph, char *result)
|
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
|
|
|
{
|
|
|
|
|
size_t outer, ops, rels;
|
2018-01-16 16:38:39 +01:00
|
|
|
DEG_stats_simple(depsgraph, &outer, &ops, &rels);
|
2017-10-25 12:06:56 +02:00
|
|
|
BLI_snprintf(result,
|
|
|
|
|
STATS_MAX_SIZE,
|
2019-11-18 16:25:59 +11:00
|
|
|
"Approx %zu Operations, %zu Relations, %zu Outer Nodes",
|
2017-10-25 12:17:45 +02:00
|
|
|
ops,
|
|
|
|
|
rels,
|
|
|
|
|
outer);
|
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
|
|
|
}
|
|
|
|
|
|
2019-10-10 12:25:23 +02:00
|
|
|
static void rna_Depsgraph_update(Depsgraph *depsgraph, Main *bmain, ReportList *reports)
|
Dependency graph API changes
Main goal here is to make it obvious and predictable about
what is going on.
Summary of changes.
- Access to dependency graph is now only possible to a fully evaluated
graph. This is now done via context.evaluated_depsgraph_get().
The call will ensure both relations and datablocks are updated.
This way we don't allow access to some known bad state of the graph,
and also making explicit that getting update dependency graph is not
cheap.
- Access to evaluated ID is now possible via id.evaluated_get().
It was already possible to get evaluated ID via dependency graph,
but that was a bit confusing why access to original is done via ID
and to evaluated via depsgraph.
If datablock is not covered by dependency graph it will be returned
as-is.
- Similarly, request for original from an ID which is not evaluated
will return ID as-is.
- Removed scene.update().
This is very expensive to update all the view layers.
- Added depsgraph.update().
Now when temporary changes to objects are to be done, this is to
happen on original object and then dependency graph is to be
updated.
- Changed object.to_mesh() to behave the following way:
* When is used for original object modifiers are ignored.
For meshes this acts similar to mesh-copy, not very useful but
allows to keep code paths similar (i.e. for exporter which has
Apply Modifiers option it's only matter choosing between original
and evaluated object, the to_mesh() part can stay the same).
For curves this gives a mesh which is constructed from displist
without taking own modifiers and modifiers of bevel/taper objects
into account.
For metaballs this gives empty mesh.
Polygonization of metaball is not possible from a single object.
* When is used for evaluated object modifiers are always applied.
In fact, no evaluation is happening, the mesh is either copied
as-is, or constructed from current state of curve cache.
Arguments to apply modifiers and calculate original coordinates (ORCO,
aka undeformed coordinates) are removed. The ORCO is to be calculated
as part of dependency graph evaluation.
File used to regression-test (a packed Python script into .blend):
{F7033464}
Patch to make addons tests to pass:
{F7033466}
NOTE: I've included changes to FBX exporter, and those are addressing
report T63689.
NOTE: All the enabled-by-default addons are to be ported still, but
first want to have agreement on this part of changes.
NOTE: Also need to work on documentation for Python API, but, again,
better be done after having agreement on this work.
Reviewers: brecht, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D4834
2019-05-09 11:26:49 +02:00
|
|
|
{
|
2019-10-10 12:25:23 +02:00
|
|
|
if (DEG_is_evaluating(depsgraph)) {
|
|
|
|
|
BKE_report(reports, RPT_ERROR, "Dependency graph update requested during evaluation");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-16 14:53:01 +02:00
|
|
|
# ifdef WITH_PYTHON
|
|
|
|
|
/* Allow drivers to be evaluated */
|
|
|
|
|
BPy_BEGIN_ALLOW_THREADS;
|
|
|
|
|
# endif
|
|
|
|
|
|
Dependency graph API changes
Main goal here is to make it obvious and predictable about
what is going on.
Summary of changes.
- Access to dependency graph is now only possible to a fully evaluated
graph. This is now done via context.evaluated_depsgraph_get().
The call will ensure both relations and datablocks are updated.
This way we don't allow access to some known bad state of the graph,
and also making explicit that getting update dependency graph is not
cheap.
- Access to evaluated ID is now possible via id.evaluated_get().
It was already possible to get evaluated ID via dependency graph,
but that was a bit confusing why access to original is done via ID
and to evaluated via depsgraph.
If datablock is not covered by dependency graph it will be returned
as-is.
- Similarly, request for original from an ID which is not evaluated
will return ID as-is.
- Removed scene.update().
This is very expensive to update all the view layers.
- Added depsgraph.update().
Now when temporary changes to objects are to be done, this is to
happen on original object and then dependency graph is to be
updated.
- Changed object.to_mesh() to behave the following way:
* When is used for original object modifiers are ignored.
For meshes this acts similar to mesh-copy, not very useful but
allows to keep code paths similar (i.e. for exporter which has
Apply Modifiers option it's only matter choosing between original
and evaluated object, the to_mesh() part can stay the same).
For curves this gives a mesh which is constructed from displist
without taking own modifiers and modifiers of bevel/taper objects
into account.
For metaballs this gives empty mesh.
Polygonization of metaball is not possible from a single object.
* When is used for evaluated object modifiers are always applied.
In fact, no evaluation is happening, the mesh is either copied
as-is, or constructed from current state of curve cache.
Arguments to apply modifiers and calculate original coordinates (ORCO,
aka undeformed coordinates) are removed. The ORCO is to be calculated
as part of dependency graph evaluation.
File used to regression-test (a packed Python script into .blend):
{F7033464}
Patch to make addons tests to pass:
{F7033466}
NOTE: I've included changes to FBX exporter, and those are addressing
report T63689.
NOTE: All the enabled-by-default addons are to be ported still, but
first want to have agreement on this part of changes.
NOTE: Also need to work on documentation for Python API, but, again,
better be done after having agreement on this work.
Reviewers: brecht, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D4834
2019-05-09 11:26:49 +02:00
|
|
|
BKE_scene_graph_update_tagged(depsgraph, bmain);
|
2019-05-16 14:53:01 +02:00
|
|
|
|
|
|
|
|
# ifdef WITH_PYTHON
|
|
|
|
|
BPy_END_ALLOW_THREADS;
|
|
|
|
|
# endif
|
Dependency graph API changes
Main goal here is to make it obvious and predictable about
what is going on.
Summary of changes.
- Access to dependency graph is now only possible to a fully evaluated
graph. This is now done via context.evaluated_depsgraph_get().
The call will ensure both relations and datablocks are updated.
This way we don't allow access to some known bad state of the graph,
and also making explicit that getting update dependency graph is not
cheap.
- Access to evaluated ID is now possible via id.evaluated_get().
It was already possible to get evaluated ID via dependency graph,
but that was a bit confusing why access to original is done via ID
and to evaluated via depsgraph.
If datablock is not covered by dependency graph it will be returned
as-is.
- Similarly, request for original from an ID which is not evaluated
will return ID as-is.
- Removed scene.update().
This is very expensive to update all the view layers.
- Added depsgraph.update().
Now when temporary changes to objects are to be done, this is to
happen on original object and then dependency graph is to be
updated.
- Changed object.to_mesh() to behave the following way:
* When is used for original object modifiers are ignored.
For meshes this acts similar to mesh-copy, not very useful but
allows to keep code paths similar (i.e. for exporter which has
Apply Modifiers option it's only matter choosing between original
and evaluated object, the to_mesh() part can stay the same).
For curves this gives a mesh which is constructed from displist
without taking own modifiers and modifiers of bevel/taper objects
into account.
For metaballs this gives empty mesh.
Polygonization of metaball is not possible from a single object.
* When is used for evaluated object modifiers are always applied.
In fact, no evaluation is happening, the mesh is either copied
as-is, or constructed from current state of curve cache.
Arguments to apply modifiers and calculate original coordinates (ORCO,
aka undeformed coordinates) are removed. The ORCO is to be calculated
as part of dependency graph evaluation.
File used to regression-test (a packed Python script into .blend):
{F7033464}
Patch to make addons tests to pass:
{F7033466}
NOTE: I've included changes to FBX exporter, and those are addressing
report T63689.
NOTE: All the enabled-by-default addons are to be ported still, but
first want to have agreement on this part of changes.
NOTE: Also need to work on documentation for Python API, but, again,
better be done after having agreement on this work.
Reviewers: brecht, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D4834
2019-05-09 11:26:49 +02:00
|
|
|
}
|
|
|
|
|
|
2017-06-06 13:58:40 +02:00
|
|
|
/* Iteration over objects, simple version */
|
|
|
|
|
|
2017-04-21 12:31:48 +02:00
|
|
|
static void rna_Depsgraph_objects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
2017-04-20 17:21:06 +02:00
|
|
|
{
|
2017-05-18 16:16:23 +02:00
|
|
|
iter->internal.custom = MEM_callocN(sizeof(BLI_Iterator), __func__);
|
2017-12-15 08:11:19 -02:00
|
|
|
DEGObjectIterData *data = MEM_callocN(sizeof(DEGObjectIterData), __func__);
|
2017-06-01 15:26:47 +02:00
|
|
|
|
|
|
|
|
data->graph = (Depsgraph *)ptr->data;
|
2017-12-15 07:51:16 -02:00
|
|
|
data->flag = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | DEG_ITER_OBJECT_FLAG_VISIBLE |
|
|
|
|
|
DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET;
|
2017-06-01 15:26:47 +02:00
|
|
|
|
2017-11-07 14:06:55 -02:00
|
|
|
((BLI_Iterator *)iter->internal.custom)->valid = true;
|
2017-11-30 16:44:35 +01:00
|
|
|
DEG_iterator_objects_begin(iter->internal.custom, data);
|
2017-05-18 16:16:23 +02:00
|
|
|
iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
|
2017-04-21 12:31:48 +02:00
|
|
|
}
|
2017-04-20 17:21:06 +02:00
|
|
|
|
2017-04-21 12:31:48 +02:00
|
|
|
static void rna_Depsgraph_objects_next(CollectionPropertyIterator *iter)
|
|
|
|
|
{
|
2017-11-30 16:44:35 +01:00
|
|
|
DEG_iterator_objects_next(iter->internal.custom);
|
2017-05-18 16:16:23 +02:00
|
|
|
iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
|
2017-04-20 17:21:06 +02:00
|
|
|
}
|
|
|
|
|
|
2017-04-21 12:31:48 +02:00
|
|
|
static void rna_Depsgraph_objects_end(CollectionPropertyIterator *iter)
|
2017-04-20 17:21:06 +02:00
|
|
|
{
|
2017-11-30 16:44:35 +01:00
|
|
|
DEG_iterator_objects_end(iter->internal.custom);
|
2017-06-01 15:26:47 +02:00
|
|
|
MEM_freeN(((BLI_Iterator *)iter->internal.custom)->data);
|
2017-04-21 12:31:48 +02:00
|
|
|
MEM_freeN(iter->internal.custom);
|
2017-04-20 17:21:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PointerRNA rna_Depsgraph_objects_get(CollectionPropertyIterator *iter)
|
|
|
|
|
{
|
2017-05-18 16:16:23 +02:00
|
|
|
Object *ob = ((BLI_Iterator *)iter->internal.custom)->current;
|
2017-04-20 17:21:06 +02:00
|
|
|
return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ob);
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-06 13:58:40 +02:00
|
|
|
/* Iteration over objects, extended version
|
|
|
|
|
*
|
|
|
|
|
* Contains extra information about duplicator and persistent ID.
|
|
|
|
|
*/
|
|
|
|
|
|
2018-11-14 17:04:10 +01:00
|
|
|
/* XXX Ugly python seems to query next item of an iterator before using current one (see T57558).
|
2019-04-22 02:48:05 +10:00
|
|
|
* This forces us to use that nasty ping-pong game between two sets of iterator data,
|
|
|
|
|
* so that previous one remains valid memory for python to access to. Yuck.
|
2018-11-14 17:04:10 +01:00
|
|
|
*/
|
|
|
|
|
typedef struct RNA_Depsgraph_Instances_Iterator {
|
|
|
|
|
BLI_Iterator iterators[2];
|
|
|
|
|
DEGObjectIterData deg_data[2];
|
2019-02-06 20:59:29 +01:00
|
|
|
DupliObject dupli_object_current[2];
|
2018-11-14 17:04:10 +01:00
|
|
|
int counter;
|
|
|
|
|
} RNA_Depsgraph_Instances_Iterator;
|
|
|
|
|
|
2018-05-30 15:21:21 +02:00
|
|
|
static void rna_Depsgraph_object_instances_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
2017-06-06 13:58:40 +02:00
|
|
|
{
|
2018-11-14 17:04:10 +01:00
|
|
|
RNA_Depsgraph_Instances_Iterator *di_it = iter->internal.custom = MEM_callocN(sizeof(*di_it),
|
|
|
|
|
__func__);
|
2017-06-06 13:58:40 +02:00
|
|
|
|
2018-11-14 17:04:10 +01:00
|
|
|
DEGObjectIterData *data = &di_it->deg_data[0];
|
2017-06-06 13:58:40 +02:00
|
|
|
data->graph = (Depsgraph *)ptr->data;
|
2017-12-15 07:51:16 -02:00
|
|
|
data->flag = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET |
|
|
|
|
|
DEG_ITER_OBJECT_FLAG_VISIBLE | DEG_ITER_OBJECT_FLAG_DUPLI;
|
2017-06-06 13:58:40 +02:00
|
|
|
|
2018-11-14 17:04:10 +01:00
|
|
|
di_it->iterators[0].valid = true;
|
|
|
|
|
DEG_iterator_objects_begin(&di_it->iterators[0], data);
|
|
|
|
|
iter->valid = di_it->iterators[0].valid;
|
2017-06-06 13:58:40 +02:00
|
|
|
}
|
|
|
|
|
|
2018-05-30 15:21:21 +02:00
|
|
|
static void rna_Depsgraph_object_instances_next(CollectionPropertyIterator *iter)
|
2017-06-06 13:58:40 +02:00
|
|
|
{
|
2018-11-14 17:04:10 +01:00
|
|
|
RNA_Depsgraph_Instances_Iterator *di_it = (RNA_Depsgraph_Instances_Iterator *)
|
|
|
|
|
iter->internal.custom;
|
|
|
|
|
|
2019-08-01 13:53:25 +10:00
|
|
|
/* We need to copy current iterator status to next one being worked on. */
|
2018-11-14 17:04:10 +01:00
|
|
|
di_it->iterators[(di_it->counter + 1) % 2] = di_it->iterators[di_it->counter % 2];
|
|
|
|
|
di_it->deg_data[(di_it->counter + 1) % 2] = di_it->deg_data[di_it->counter % 2];
|
|
|
|
|
di_it->counter++;
|
|
|
|
|
|
|
|
|
|
di_it->iterators[di_it->counter % 2].data = &di_it->deg_data[di_it->counter % 2];
|
|
|
|
|
DEG_iterator_objects_next(&di_it->iterators[di_it->counter % 2]);
|
2019-02-06 20:59:29 +01:00
|
|
|
/* Dupli_object_current is also temp memory generated during the iterations,
|
2019-04-22 02:48:05 +10:00
|
|
|
* it may be freed when last item has been iterated,
|
|
|
|
|
* so we have same issue as with the iterator itself:
|
|
|
|
|
* we need to keep a local copy, which memory remains valid a bit longer,
|
|
|
|
|
* for Python accesses to work. */
|
2019-02-06 20:59:29 +01:00
|
|
|
if (di_it->deg_data[di_it->counter % 2].dupli_object_current != NULL) {
|
|
|
|
|
di_it->dupli_object_current[di_it->counter % 2] =
|
|
|
|
|
*di_it->deg_data[di_it->counter % 2].dupli_object_current;
|
|
|
|
|
di_it->deg_data[di_it->counter % 2].dupli_object_current =
|
|
|
|
|
&di_it->dupli_object_current[di_it->counter % 2];
|
|
|
|
|
}
|
2018-11-14 17:04:10 +01:00
|
|
|
iter->valid = di_it->iterators[di_it->counter % 2].valid;
|
2017-06-06 13:58:40 +02:00
|
|
|
}
|
|
|
|
|
|
2018-05-30 15:21:21 +02:00
|
|
|
static void rna_Depsgraph_object_instances_end(CollectionPropertyIterator *iter)
|
2017-06-06 13:58:40 +02:00
|
|
|
{
|
2018-11-14 17:04:10 +01:00
|
|
|
RNA_Depsgraph_Instances_Iterator *di_it = (RNA_Depsgraph_Instances_Iterator *)
|
|
|
|
|
iter->internal.custom;
|
|
|
|
|
DEG_iterator_objects_end(&di_it->iterators[0]);
|
|
|
|
|
DEG_iterator_objects_end(&di_it->iterators[1]);
|
|
|
|
|
MEM_freeN(di_it);
|
2017-06-06 13:58:40 +02:00
|
|
|
}
|
|
|
|
|
|
2018-05-30 15:21:21 +02:00
|
|
|
static PointerRNA rna_Depsgraph_object_instances_get(CollectionPropertyIterator *iter)
|
2017-06-06 13:58:40 +02:00
|
|
|
{
|
2018-11-14 17:04:10 +01:00
|
|
|
RNA_Depsgraph_Instances_Iterator *di_it = (RNA_Depsgraph_Instances_Iterator *)
|
|
|
|
|
iter->internal.custom;
|
|
|
|
|
BLI_Iterator *iterator = &di_it->iterators[di_it->counter % 2];
|
2018-05-30 15:21:21 +02:00
|
|
|
return rna_pointer_inherit_refine(&iter->parent, &RNA_DepsgraphObjectInstance, iterator);
|
2017-06-06 13:58:40 +02:00
|
|
|
}
|
|
|
|
|
|
2018-05-29 15:57:14 +02:00
|
|
|
/* Iteration over evaluated IDs */
|
|
|
|
|
|
|
|
|
|
static void rna_Depsgraph_ids_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
iter->internal.custom = MEM_callocN(sizeof(BLI_Iterator), __func__);
|
|
|
|
|
DEGIDIterData *data = MEM_callocN(sizeof(DEGIDIterData), __func__);
|
|
|
|
|
|
|
|
|
|
data->graph = (Depsgraph *)ptr->data;
|
|
|
|
|
|
|
|
|
|
((BLI_Iterator *)iter->internal.custom)->valid = true;
|
|
|
|
|
DEG_iterator_ids_begin(iter->internal.custom, data);
|
|
|
|
|
iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_Depsgraph_ids_next(CollectionPropertyIterator *iter)
|
|
|
|
|
{
|
|
|
|
|
DEG_iterator_ids_next(iter->internal.custom);
|
|
|
|
|
iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_Depsgraph_ids_end(CollectionPropertyIterator *iter)
|
|
|
|
|
{
|
|
|
|
|
DEG_iterator_ids_end(iter->internal.custom);
|
|
|
|
|
MEM_freeN(((BLI_Iterator *)iter->internal.custom)->data);
|
|
|
|
|
MEM_freeN(iter->internal.custom);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PointerRNA rna_Depsgraph_ids_get(CollectionPropertyIterator *iter)
|
|
|
|
|
{
|
|
|
|
|
ID *id = ((BLI_Iterator *)iter->internal.custom)->current;
|
|
|
|
|
return rna_pointer_inherit_refine(&iter->parent, &RNA_ID, id);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-30 15:21:21 +02:00
|
|
|
static void rna_Depsgraph_updates_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
iter->internal.custom = MEM_callocN(sizeof(BLI_Iterator), __func__);
|
|
|
|
|
DEGIDIterData *data = MEM_callocN(sizeof(DEGIDIterData), __func__);
|
|
|
|
|
|
|
|
|
|
data->graph = (Depsgraph *)ptr->data;
|
|
|
|
|
data->only_updated = true;
|
|
|
|
|
|
|
|
|
|
((BLI_Iterator *)iter->internal.custom)->valid = true;
|
|
|
|
|
DEG_iterator_ids_begin(iter->internal.custom, data);
|
|
|
|
|
iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PointerRNA rna_Depsgraph_updates_get(CollectionPropertyIterator *iter)
|
|
|
|
|
{
|
|
|
|
|
ID *id = ((BLI_Iterator *)iter->internal.custom)->current;
|
|
|
|
|
return rna_pointer_inherit_refine(&iter->parent, &RNA_DepsgraphUpdate, id);
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-25 10:13:09 +02:00
|
|
|
static ID *rna_Depsgraph_id_eval_get(Depsgraph *depsgraph, ID *id_orig)
|
Depsgraph: Initial groundwork for copy-on-write support
< Dependency graph Copy-on-Write >
--------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
This is an initial commit of Copy-on-write support added to dependency graph.
Main priority for now: get playback (Alt-A) and all operators (selection,
transform etc) to work with the new concept of clear separation between
evaluated data coming from dependency graph and original data coming from
.blend file (and stored in bmain).
= How does this work? =
The idea is to support Copy-on-Write on the ID level. This means, we duplicate
the whole ID before we cann it's evaluaiton function. This is currently done
in the following way:
- At the depsgraph construction time we create "shallow" copy of the ID
datablock, just so we know it's pointer in memory and can use for function
bindings.
- At the evaluaiton time, the copy of ID get's "expanded" (needs a better
name internally, so it does not conflict with expanding datablocks during
library linking), which means the content of the datablock is being
copied over and all IDs are getting remapped to the copied ones.
Currently we do the whole copy, in the future we will support some tricks
here to prevent duplicating geometry arrays (verts, edges, loops, faces
and polys) when we don't need that.
- Evaluation functions are operating on copied datablocks and never touching
original datablock.
- There are some cases when we need to know non-ID pointers for function
bindings. This mainly applies to scene collections and armatures. The
idea of dealing with this is to "expand" copy-on-write datablock at
the dependency graph build time. This might introduce some slowdown to the
dependency graph construction time, but allows us to have minimal changes
in the code and avoid any hash look-up from evaluation function (one of
the ideas to avoid using pointers as function bindings is to pass name
of layer or a bone to the evaluation function and look up actual data based
on that name).
Currently there is a special function in depsgraph which does such a
synchronization, in the future we might want to make it more generic.
At some point we need to synchronize copy-on-write version of datablock with
the original version. This happens, i.e., when we change active object or
change selection. We don't want any actual evaluation of update flush happening
for such thins, so now we have a special update tag:
DEG_id_tag_update((id, DEG_TAG_COPY_ON_WRITE)
- For the render engines we now have special call for the dependency graph to
give evaluated datablock for the given original one. This isn't fully ideal
but allows to have Cycles viewport render.
This is definitely a subject for further investigation / improvement.
This call will tag copy-on-write component tagged for update without causing
updates to be flushed to any other objects, causing chain reaction of updates.
This tag is handy when selection in the scene changes.
This basically summarizes ideas underneath this commit. The code should be
reasonably documented.
Here is a demo of dependency graph with all copy-on-write stuff in it:
https://developer.blender.org/F635468
= What to expect to (not) work? =
- Only meshes are properly-ish aware of copy-on-write currently, Non-mesh
geometry will probably crash or will not work at all.
- Armatures will need similar depsgraph built-time expansion of the copied
datablock.
- There are some extra tags / relations added, to keep things demo-able but
which are slowing things down for evaluation.
- Edit mode works for until click selection is used (due to the selection
code using EditDerivedMesh created ad-hoc).
- Lots of tools will lack tagging synchronization of copied datablock for
sync with original ID.
= How to move forward? =
There is some tedious work related on going over all the tools, checking
whether they need to work with original or final evaluated object and make
the required changes.
Additionally, there need synchronization tag done in fair amount of tools
and operators as well. For example, currently it's not possible to change
render engine without re-opening the file or forcing dependency graph for
re-build via python console.
There is also now some thoughts required about copying evaluated properties
between objects or from collection to a new object. Perhaps easiest way
would be to move base flag flush to Object ID node and tag new objects for
update instead of doing manual copy.
here is some WIP patch which moves such evaluaiton / flush:
https://developer.blender.org/F635479
Lots of TODOs in the code, with possible optimization.
= How to test? =
This is a feature under heavy development, so obviously it is disabled by
default. The only reason it goes to 2.8 branch is to avoid possible merge
hell.
In order to enable this feature use WITH_DEPSGRAPH_COPY_ON_WRITE CMake
configuration option.
2017-06-14 10:26:24 +02:00
|
|
|
{
|
|
|
|
|
return DEG_get_evaluated_id(depsgraph, id_orig);
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-01 16:22:06 +02:00
|
|
|
static bool rna_Depsgraph_id_type_updated(Depsgraph *depsgraph, int id_type)
|
2018-05-29 15:57:14 +02:00
|
|
|
{
|
|
|
|
|
return DEG_id_type_updated(depsgraph, id_type);
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-25 10:13:09 +02:00
|
|
|
static PointerRNA rna_Depsgraph_scene_get(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
Depsgraph *depsgraph = (Depsgraph *)ptr->data;
|
|
|
|
|
Scene *scene = DEG_get_input_scene(depsgraph);
|
2020-09-13 15:28:41 +10:00
|
|
|
PointerRNA newptr;
|
|
|
|
|
RNA_pointer_create(&scene->id, &RNA_Scene, scene, &newptr);
|
|
|
|
|
return newptr;
|
2018-04-25 10:13:09 +02:00
|
|
|
}
|
|
|
|
|
|
2018-02-23 09:22:35 -03:00
|
|
|
static PointerRNA rna_Depsgraph_view_layer_get(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
Depsgraph *depsgraph = (Depsgraph *)ptr->data;
|
2020-09-13 15:28:41 +10:00
|
|
|
Scene *scene = DEG_get_input_scene(depsgraph);
|
2018-04-25 10:13:09 +02:00
|
|
|
ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
|
2020-09-13 15:28:41 +10:00
|
|
|
PointerRNA newptr;
|
|
|
|
|
RNA_pointer_create(&scene->id, &RNA_ViewLayer, view_layer, &newptr);
|
|
|
|
|
return newptr;
|
2018-02-23 09:22:35 -03:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 10:13:09 +02:00
|
|
|
static PointerRNA rna_Depsgraph_scene_eval_get(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
Depsgraph *depsgraph = (Depsgraph *)ptr->data;
|
|
|
|
|
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
|
2020-09-13 15:28:41 +10:00
|
|
|
PointerRNA newptr;
|
|
|
|
|
RNA_pointer_create(&scene_eval->id, &RNA_Scene, scene_eval, &newptr);
|
|
|
|
|
return newptr;
|
2018-04-25 10:13:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PointerRNA rna_Depsgraph_view_layer_eval_get(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
Depsgraph *depsgraph = (Depsgraph *)ptr->data;
|
2020-09-13 15:28:41 +10:00
|
|
|
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
|
2018-04-25 10:13:09 +02:00
|
|
|
ViewLayer *view_layer_eval = DEG_get_evaluated_view_layer(depsgraph);
|
2020-09-13 15:28:41 +10:00
|
|
|
PointerRNA newptr;
|
|
|
|
|
RNA_pointer_create(&scene_eval->id, &RNA_ViewLayer, view_layer_eval, &newptr);
|
|
|
|
|
return newptr;
|
2018-04-25 10:13:09 +02:00
|
|
|
}
|
|
|
|
|
|
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
|
|
|
#else
|
|
|
|
|
|
2018-05-30 15:21:21 +02:00
|
|
|
static void rna_def_depsgraph_instance(BlenderRNA *brna)
|
2017-06-06 13:58:40 +02:00
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-30 15:21:21 +02:00
|
|
|
srna = RNA_def_struct(brna, "DepsgraphObjectInstance", NULL);
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna,
|
|
|
|
|
"Dependency Graph Object Instance",
|
2018-10-02 14:11:59 +02:00
|
|
|
"Extended information about dependency graph object iterator "
|
|
|
|
|
"(WARNING: all data here is *evaluated* one, not original .blend IDs...)");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-06-06 13:58:40 +02:00
|
|
|
prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Object");
|
2018-10-02 14:11:59 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Object", "Evaluated object the iterator points to");
|
2017-06-06 13:58:40 +02:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
2018-05-30 15:21:21 +02:00
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_DepsgraphObjectInstance_object_get", NULL, NULL, NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-18 18:18:00 +01:00
|
|
|
prop = RNA_def_property(srna, "show_self", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Show Self", "The object geometry itself should be visible in the render");
|
|
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_DepsgraphObjectInstance_show_self_get", NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-18 18:18:00 +01:00
|
|
|
prop = RNA_def_property(srna, "show_particles", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Show Particles", "Particles part of the object should be visible in the render");
|
|
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_DepsgraphObjectInstance_show_particles_get", NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-09-19 15:44:10 +02:00
|
|
|
prop = RNA_def_property(srna, "is_instance", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
2018-12-18 18:18:00 +01:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Is Instance", "Denotes if the object is generated by another object");
|
2018-09-19 15:44:10 +02:00
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_DepsgraphObjectInstance_is_instance_get", NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-06-06 16:27:02 +02:00
|
|
|
prop = RNA_def_property(srna, "instance_object", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Object");
|
2018-10-02 14:11:59 +02:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Instance Object", "Evaluated object which is being instanced by this iterator");
|
2017-06-06 16:27:02 +02:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
2018-05-30 15:21:21 +02:00
|
|
|
RNA_def_property_pointer_funcs(
|
|
|
|
|
prop, "rna_DepsgraphObjectInstance_instance_object_get", NULL, NULL, NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-06-06 13:58:40 +02:00
|
|
|
prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Object");
|
2018-12-18 18:18:00 +01:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Parent", "If the object is an instance, the parent object that generated it");
|
2017-06-06 13:58:40 +02:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
2018-05-30 15:21:21 +02:00
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_DepsgraphObjectInstance_parent_get", NULL, NULL, NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-04 13:16:56 +02:00
|
|
|
prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "ParticleSystem");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
2018-10-02 14:11:59 +02:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Particle System", "Evaluated particle system that this object was instanced from");
|
2018-05-30 15:21:21 +02:00
|
|
|
RNA_def_property_pointer_funcs(
|
|
|
|
|
prop, "rna_DepsgraphObjectInstance_particle_system_get", NULL, NULL, NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-06-06 13:58:40 +02:00
|
|
|
prop = RNA_def_property(srna, "persistent_id", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Persistent ID",
|
|
|
|
|
"Persistent identifier for inter-frame matching of objects with motion blur");
|
2020-07-06 16:52:28 +02:00
|
|
|
RNA_def_property_array(prop, MAX_DUPLI_RECUR);
|
2017-06-06 13:58:40 +02:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
2018-05-30 15:21:21 +02:00
|
|
|
RNA_def_property_int_funcs(prop, "rna_DepsgraphObjectInstance_persistent_id_get", NULL, NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-09-19 15:44:10 +02:00
|
|
|
prop = RNA_def_property(srna, "random_id", PROP_INT, PROP_UNSIGNED);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
2018-12-18 18:18:00 +01:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Dupli random id", "Random id for this instance, typically for randomized shading");
|
2018-09-19 15:44:10 +02:00
|
|
|
RNA_def_property_int_funcs(prop, "rna_DepsgraphObjectInstance_random_id_get", NULL, NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-09-19 15:44:10 +02:00
|
|
|
prop = RNA_def_property(srna, "matrix_world", PROP_FLOAT, PROP_MATRIX);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Generated Matrix", "Generated transform matrix in world space");
|
2018-09-19 16:09:52 +02:00
|
|
|
RNA_def_property_float_funcs(prop, "rna_DepsgraphObjectInstance_matrix_world_get", NULL, NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-06-06 13:58:40 +02:00
|
|
|
prop = RNA_def_property(srna, "orco", PROP_FLOAT, PROP_TRANSLATION);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_array(prop, 3);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Generated Coordinates", "Generated coordinates in parent object space");
|
2018-05-30 15:21:21 +02:00
|
|
|
RNA_def_property_float_funcs(prop, "rna_DepsgraphObjectInstance_orco_get", NULL, NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-06-06 13:58:40 +02:00
|
|
|
prop = RNA_def_property(srna, "uv", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "UV Coordinates", "UV coordinates in parent object space");
|
|
|
|
|
RNA_def_property_array(prop, 2);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
2018-05-30 15:21:21 +02:00
|
|
|
RNA_def_property_float_funcs(prop, "rna_DepsgraphObjectInstance_uv_get", NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_depsgraph_update(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "DepsgraphUpdate", NULL);
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Dependency Graph Update", "Information about ID that was updated");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "ID");
|
2020-12-24 13:11:22 -06:00
|
|
|
RNA_def_property_ui_text(prop, "ID", "Updated data-block");
|
2018-05-30 15:21:21 +02:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_DepsgraphUpdate_id_get", NULL, NULL, NULL);
|
|
|
|
|
|
2018-12-13 23:15:15 +11:00
|
|
|
/* Use term 'is_updated' instead of 'is_dirty' here because this is a signal
|
|
|
|
|
* that users of the depsgraph may want to update their data (render engines for eg). */
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "is_updated_transform", PROP_BOOLEAN, PROP_NONE);
|
2018-05-30 15:21:21 +02:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
2018-12-13 23:15:15 +11:00
|
|
|
RNA_def_property_ui_text(prop, "Transform", "Object transformation is updated");
|
|
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_DepsgraphUpdate_is_updated_transform_get", NULL);
|
2018-05-30 15:21:21 +02:00
|
|
|
|
2018-12-13 23:15:15 +11:00
|
|
|
prop = RNA_def_property(srna, "is_updated_geometry", PROP_BOOLEAN, PROP_NONE);
|
2018-05-30 15:21:21 +02:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
2018-12-13 23:15:15 +11:00
|
|
|
RNA_def_property_ui_text(prop, "Geometry", "Object geometry is updated");
|
|
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_DepsgraphUpdate_is_updated_geometry_get", NULL);
|
2020-04-22 13:50:21 +02:00
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "is_updated_shading", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Shading", "Object shading is updated");
|
|
|
|
|
RNA_def_property_boolean_funcs(prop, "rna_DepsgraphUpdate_is_updated_shading_get", NULL);
|
2017-06-06 13:58:40 +02:00
|
|
|
}
|
|
|
|
|
|
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
|
|
|
static void rna_def_depsgraph(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
PropertyRNA *parm;
|
2017-04-20 17:21:06 +02:00
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-06 16:38:10 +02:00
|
|
|
static EnumPropertyItem enum_depsgraph_mode_items[] = {
|
|
|
|
|
{DAG_EVAL_VIEWPORT, "VIEWPORT", 0, "Viewport", "Viewport non-rendered mode"},
|
|
|
|
|
{DAG_EVAL_RENDER, "RENDER", 0, "Render", "Render"},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2018-06-06 16:38:10 +02:00
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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
|
|
|
srna = RNA_def_struct(brna, "Depsgraph", NULL);
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Dependency Graph", "");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-06 16:38:10 +02:00
|
|
|
prop = RNA_def_enum(srna, "mode", enum_depsgraph_mode_items, 0, "Mode", "Evaluation mode");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_enum_funcs(prop, "rna_Depsgraph_mode_get", NULL, NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-25 10:13:09 +02:00
|
|
|
/* Debug helpers. */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-12-21 12:56:44 +01:00
|
|
|
func = RNA_def_function(
|
|
|
|
|
srna, "debug_relations_graphviz", "rna_Depsgraph_debug_relations_graphviz");
|
2019-05-22 08:39:15 +10:00
|
|
|
parm = RNA_def_string_file_path(
|
|
|
|
|
func, "filename", NULL, FILE_MAX, "File Name", "Output path for the graphviz debug file");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-12-21 16:14:15 +01:00
|
|
|
func = RNA_def_function(srna, "debug_stats_gnuplot", "rna_Depsgraph_debug_stats_gnuplot");
|
2019-05-22 08:39:15 +10:00
|
|
|
parm = RNA_def_string_file_path(
|
|
|
|
|
func, "filename", NULL, FILE_MAX, "File Name", "Output path for the gnuplot debug file");
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2017-12-21 16:14:15 +01:00
|
|
|
parm = RNA_def_string_file_path(func,
|
|
|
|
|
"output_filename",
|
|
|
|
|
NULL,
|
|
|
|
|
FILE_MAX,
|
|
|
|
|
"Output File Name",
|
|
|
|
|
"File name where gnuplot script will save the result");
|
|
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-25 12:11:49 +02:00
|
|
|
func = RNA_def_function(srna, "debug_tag_update", "rna_Depsgraph_debug_tag_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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
|
|
|
func = RNA_def_function(srna, "debug_stats", "rna_Depsgraph_debug_stats");
|
|
|
|
|
RNA_def_function_ui_description(func, "Report the number of elements in the Dependency Graph");
|
2017-10-25 12:06:56 +02:00
|
|
|
/* weak!, no way to return dynamic string type */
|
|
|
|
|
parm = RNA_def_string(func, "result", NULL, STATS_MAX_SIZE, "result", "");
|
|
|
|
|
RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */
|
|
|
|
|
RNA_def_function_output(func, parm);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Dependency graph API changes
Main goal here is to make it obvious and predictable about
what is going on.
Summary of changes.
- Access to dependency graph is now only possible to a fully evaluated
graph. This is now done via context.evaluated_depsgraph_get().
The call will ensure both relations and datablocks are updated.
This way we don't allow access to some known bad state of the graph,
and also making explicit that getting update dependency graph is not
cheap.
- Access to evaluated ID is now possible via id.evaluated_get().
It was already possible to get evaluated ID via dependency graph,
but that was a bit confusing why access to original is done via ID
and to evaluated via depsgraph.
If datablock is not covered by dependency graph it will be returned
as-is.
- Similarly, request for original from an ID which is not evaluated
will return ID as-is.
- Removed scene.update().
This is very expensive to update all the view layers.
- Added depsgraph.update().
Now when temporary changes to objects are to be done, this is to
happen on original object and then dependency graph is to be
updated.
- Changed object.to_mesh() to behave the following way:
* When is used for original object modifiers are ignored.
For meshes this acts similar to mesh-copy, not very useful but
allows to keep code paths similar (i.e. for exporter which has
Apply Modifiers option it's only matter choosing between original
and evaluated object, the to_mesh() part can stay the same).
For curves this gives a mesh which is constructed from displist
without taking own modifiers and modifiers of bevel/taper objects
into account.
For metaballs this gives empty mesh.
Polygonization of metaball is not possible from a single object.
* When is used for evaluated object modifiers are always applied.
In fact, no evaluation is happening, the mesh is either copied
as-is, or constructed from current state of curve cache.
Arguments to apply modifiers and calculate original coordinates (ORCO,
aka undeformed coordinates) are removed. The ORCO is to be calculated
as part of dependency graph evaluation.
File used to regression-test (a packed Python script into .blend):
{F7033464}
Patch to make addons tests to pass:
{F7033466}
NOTE: I've included changes to FBX exporter, and those are addressing
report T63689.
NOTE: All the enabled-by-default addons are to be ported still, but
first want to have agreement on this part of changes.
NOTE: Also need to work on documentation for Python API, but, again,
better be done after having agreement on this work.
Reviewers: brecht, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D4834
2019-05-09 11:26:49 +02:00
|
|
|
/* Updates. */
|
|
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "update", "rna_Depsgraph_update");
|
|
|
|
|
RNA_def_function_ui_description(
|
|
|
|
|
func,
|
|
|
|
|
"Re-evaluate any modified data-blocks, for example for animation or modifiers. "
|
|
|
|
|
"This invalidates all references to evaluated data-blocks from this dependency graph.");
|
2019-10-10 12:25:23 +02:00
|
|
|
RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
|
Dependency graph API changes
Main goal here is to make it obvious and predictable about
what is going on.
Summary of changes.
- Access to dependency graph is now only possible to a fully evaluated
graph. This is now done via context.evaluated_depsgraph_get().
The call will ensure both relations and datablocks are updated.
This way we don't allow access to some known bad state of the graph,
and also making explicit that getting update dependency graph is not
cheap.
- Access to evaluated ID is now possible via id.evaluated_get().
It was already possible to get evaluated ID via dependency graph,
but that was a bit confusing why access to original is done via ID
and to evaluated via depsgraph.
If datablock is not covered by dependency graph it will be returned
as-is.
- Similarly, request for original from an ID which is not evaluated
will return ID as-is.
- Removed scene.update().
This is very expensive to update all the view layers.
- Added depsgraph.update().
Now when temporary changes to objects are to be done, this is to
happen on original object and then dependency graph is to be
updated.
- Changed object.to_mesh() to behave the following way:
* When is used for original object modifiers are ignored.
For meshes this acts similar to mesh-copy, not very useful but
allows to keep code paths similar (i.e. for exporter which has
Apply Modifiers option it's only matter choosing between original
and evaluated object, the to_mesh() part can stay the same).
For curves this gives a mesh which is constructed from displist
without taking own modifiers and modifiers of bevel/taper objects
into account.
For metaballs this gives empty mesh.
Polygonization of metaball is not possible from a single object.
* When is used for evaluated object modifiers are always applied.
In fact, no evaluation is happening, the mesh is either copied
as-is, or constructed from current state of curve cache.
Arguments to apply modifiers and calculate original coordinates (ORCO,
aka undeformed coordinates) are removed. The ORCO is to be calculated
as part of dependency graph evaluation.
File used to regression-test (a packed Python script into .blend):
{F7033464}
Patch to make addons tests to pass:
{F7033466}
NOTE: I've included changes to FBX exporter, and those are addressing
report T63689.
NOTE: All the enabled-by-default addons are to be ported still, but
first want to have agreement on this part of changes.
NOTE: Also need to work on documentation for Python API, but, again,
better be done after having agreement on this work.
Reviewers: brecht, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D4834
2019-05-09 11:26:49 +02:00
|
|
|
|
2018-04-25 10:13:09 +02:00
|
|
|
/* Queries for original datablockls (the ones depsgraph is built for). */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-25 10:13:09 +02:00
|
|
|
prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Scene");
|
|
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_Depsgraph_scene_get", NULL, NULL, NULL);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Scene", "Original scene dependency graph is built for");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-25 10:13:09 +02:00
|
|
|
prop = RNA_def_property(srna, "view_layer", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "ViewLayer");
|
|
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_Depsgraph_view_layer_get", NULL, NULL, NULL);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "View Layer", "Original view layer dependency graph is built for");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-25 10:13:09 +02:00
|
|
|
/* Queries for evaluated datablockls (the ones depsgraph is evaluating). */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-25 10:13:09 +02:00
|
|
|
func = RNA_def_function(srna, "id_eval_get", "rna_Depsgraph_id_eval_get");
|
|
|
|
|
parm = RNA_def_pointer(
|
|
|
|
|
func, "id", "ID", "", "Original ID to get evaluated complementary part for");
|
|
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
|
|
|
|
parm = RNA_def_pointer(func, "id_eval", "ID", "", "Evaluated ID for the given original one");
|
|
|
|
|
RNA_def_function_return(func, parm);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-29 15:57:14 +02:00
|
|
|
func = RNA_def_function(srna, "id_type_updated", "rna_Depsgraph_id_type_updated");
|
|
|
|
|
parm = RNA_def_enum(func, "id_type", rna_enum_id_type_items, 0, "ID Type", "");
|
|
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
|
|
|
|
parm = RNA_def_boolean(func,
|
|
|
|
|
"updated",
|
|
|
|
|
false,
|
|
|
|
|
"Updated",
|
|
|
|
|
"True if any datablock with this type was added, updated or removed");
|
|
|
|
|
RNA_def_function_return(func, parm);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-25 10:13:09 +02:00
|
|
|
prop = RNA_def_property(srna, "scene_eval", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Scene");
|
|
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_Depsgraph_scene_eval_get", NULL, NULL, NULL);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Scene", "Original scene dependency graph is built for");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-25 10:13:09 +02:00
|
|
|
prop = RNA_def_property(srna, "view_layer_eval", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "ViewLayer");
|
|
|
|
|
RNA_def_property_pointer_funcs(prop, "rna_Depsgraph_view_layer_eval_get", NULL, NULL, NULL);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "View Layer", "Original view layer dependency graph is built for");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-25 10:13:09 +02:00
|
|
|
/* Iterators. */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-30 15:21:21 +02:00
|
|
|
prop = RNA_def_property(srna, "ids", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "ID");
|
|
|
|
|
RNA_def_property_collection_funcs(prop,
|
|
|
|
|
"rna_Depsgraph_ids_begin",
|
|
|
|
|
"rna_Depsgraph_ids_next",
|
|
|
|
|
"rna_Depsgraph_ids_end",
|
|
|
|
|
"rna_Depsgraph_ids_get",
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL);
|
2020-12-24 13:11:22 -06:00
|
|
|
RNA_def_property_ui_text(prop, "IDs", "All evaluated data-blocks");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-04-20 17:21:06 +02:00
|
|
|
prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Object");
|
2017-06-06 13:58:40 +02:00
|
|
|
RNA_def_property_collection_funcs(prop,
|
|
|
|
|
"rna_Depsgraph_objects_begin",
|
|
|
|
|
"rna_Depsgraph_objects_next",
|
|
|
|
|
"rna_Depsgraph_objects_end",
|
|
|
|
|
"rna_Depsgraph_objects_get",
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL);
|
2018-05-30 15:21:21 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Objects", "Evaluated objects in the dependency graph");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-30 15:21:21 +02:00
|
|
|
prop = RNA_def_property(srna, "object_instances", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "DepsgraphObjectInstance");
|
2018-05-29 15:57:14 +02:00
|
|
|
RNA_def_property_collection_funcs(prop,
|
2018-05-30 15:21:21 +02:00
|
|
|
"rna_Depsgraph_object_instances_begin",
|
|
|
|
|
"rna_Depsgraph_object_instances_next",
|
|
|
|
|
"rna_Depsgraph_object_instances_end",
|
|
|
|
|
"rna_Depsgraph_object_instances_get",
|
2018-05-29 15:57:14 +02:00
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL);
|
2019-01-17 11:56:56 +01:00
|
|
|
RNA_def_property_ui_text(prop,
|
|
|
|
|
"Object Instances",
|
|
|
|
|
"All object instances to display or render "
|
|
|
|
|
"(WARNING: only use this as an iterator, never as a sequence, "
|
|
|
|
|
"and do not keep any references to its items)");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-30 15:21:21 +02:00
|
|
|
prop = RNA_def_property(srna, "updates", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "DepsgraphUpdate");
|
2018-05-29 15:57:14 +02:00
|
|
|
RNA_def_property_collection_funcs(prop,
|
2018-05-30 15:21:21 +02:00
|
|
|
"rna_Depsgraph_updates_begin",
|
2018-05-29 15:57:14 +02:00
|
|
|
"rna_Depsgraph_ids_next",
|
|
|
|
|
"rna_Depsgraph_ids_end",
|
2018-05-30 15:21:21 +02:00
|
|
|
"rna_Depsgraph_updates_get",
|
2018-05-29 15:57:14 +02:00
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL);
|
2020-12-24 13:11:22 -06:00
|
|
|
RNA_def_property_ui_text(prop, "Updates", "Updates to data-blocks");
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RNA_def_depsgraph(BlenderRNA *brna)
|
|
|
|
|
{
|
2018-05-30 15:21:21 +02:00
|
|
|
rna_def_depsgraph_instance(brna);
|
|
|
|
|
rna_def_depsgraph_update(brna);
|
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
|
|
|
rna_def_depsgraph(brna);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|