2011-05-24 07:08:58 +00:00
|
|
|
/*
|
2011-12-28 11:08:38 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* Contributor(s): Miika Hämäläinen
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** \file blender/modifiers/intern/MOD_dynamicpaint.c
|
|
|
|
* \ingroup modifiers
|
|
|
|
*/
|
2011-05-24 07:08:58 +00:00
|
|
|
|
2011-10-22 16:16:14 +00:00
|
|
|
#include <stddef.h>
|
2011-05-24 07:08:58 +00:00
|
|
|
|
2011-10-28 14:46:09 +00:00
|
|
|
#include "DNA_dynamicpaint_types.h"
|
2011-05-24 07:08:58 +00:00
|
|
|
#include "DNA_object_types.h"
|
2016-03-25 13:15:50 +01:00
|
|
|
#include "DNA_object_force.h"
|
2011-06-16 10:41:00 +00:00
|
|
|
#include "DNA_scene_types.h"
|
2011-05-24 07:08:58 +00:00
|
|
|
|
2011-11-10 12:28:26 +00:00
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
2011-05-24 07:08:58 +00:00
|
|
|
#include "BKE_cdderivedmesh.h"
|
|
|
|
#include "BKE_dynamicpaint.h"
|
2017-06-19 12:25:41 +02:00
|
|
|
#include "BKE_library.h"
|
2015-10-08 14:21:11 +02:00
|
|
|
#include "BKE_library_query.h"
|
2011-10-22 16:16:14 +00:00
|
|
|
#include "BKE_modifier.h"
|
2011-05-24 07:08:58 +00:00
|
|
|
|
|
|
|
#include "depsgraph_private.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_build.h"
|
2011-05-24 07:08:58 +00:00
|
|
|
|
2017-08-01 09:06:34 +10:00
|
|
|
#include "MOD_modifiertypes.h"
|
2011-05-24 07:08:58 +00:00
|
|
|
|
|
|
|
static void initData(ModifierData *md)
|
|
|
|
{
|
2012-05-06 13:38:33 +00:00
|
|
|
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *) md;
|
2011-05-24 07:08:58 +00:00
|
|
|
|
|
|
|
pmd->canvas = NULL;
|
2011-06-16 10:41:00 +00:00
|
|
|
pmd->brush = NULL;
|
2011-07-08 11:03:37 +00:00
|
|
|
pmd->type = MOD_DYNAMICPAINT_TYPE_CANVAS;
|
2011-05-24 07:08:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void copyData(ModifierData *md, ModifierData *target)
|
|
|
|
{
|
2012-05-06 13:38:33 +00:00
|
|
|
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
|
|
|
|
DynamicPaintModifierData *tpmd = (DynamicPaintModifierData *)target;
|
2011-05-24 07:08:58 +00:00
|
|
|
|
|
|
|
dynamicPaint_Modifier_copy(pmd, tpmd);
|
2017-06-19 12:25:41 +02:00
|
|
|
|
|
|
|
if (tpmd->canvas) {
|
|
|
|
for (DynamicPaintSurface *surface = tpmd->canvas->surfaces.first; surface; surface = surface->next) {
|
2017-06-19 14:43:44 +02:00
|
|
|
id_us_plus((ID *)surface->init_texture);
|
2017-06-19 12:25:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (tpmd->brush) {
|
2017-06-19 14:43:44 +02:00
|
|
|
id_us_plus((ID *)tpmd->brush->mat);
|
2017-06-19 12:25:41 +02:00
|
|
|
}
|
2011-05-24 07:08:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void freeData(ModifierData *md)
|
|
|
|
{
|
2012-05-06 13:38:33 +00:00
|
|
|
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *) md;
|
2011-10-13 20:00:22 +00:00
|
|
|
dynamicPaint_Modifier_free(pmd);
|
2011-05-24 07:08:58 +00:00
|
|
|
}
|
|
|
|
|
2011-11-10 12:28:26 +00:00
|
|
|
static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
|
2011-05-24 07:08:58 +00:00
|
|
|
{
|
2012-05-06 13:38:33 +00:00
|
|
|
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
|
2011-05-24 07:08:58 +00:00
|
|
|
CustomDataMask dataMask = 0;
|
|
|
|
|
2011-10-22 16:16:14 +00:00
|
|
|
if (pmd->canvas) {
|
|
|
|
DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
|
2012-05-06 13:38:33 +00:00
|
|
|
for (; surface; surface = surface->next) {
|
2011-10-22 16:16:14 +00:00
|
|
|
/* tface */
|
|
|
|
if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ ||
|
2012-05-20 19:49:27 +00:00
|
|
|
surface->init_color_type == MOD_DPAINT_INITIAL_TEXTURE)
|
|
|
|
{
|
2015-07-27 20:59:10 +10:00
|
|
|
dataMask |= CD_MASK_MLOOPUV | CD_MASK_MTEXPOLY;
|
2011-10-22 16:16:14 +00:00
|
|
|
}
|
|
|
|
/* mcol */
|
|
|
|
if (surface->type == MOD_DPAINT_SURFACE_T_PAINT ||
|
2012-05-20 19:49:27 +00:00
|
|
|
surface->init_color_type == MOD_DPAINT_INITIAL_VERTEXCOLOR)
|
|
|
|
{
|
2015-07-27 20:59:10 +10:00
|
|
|
dataMask |= CD_MASK_MLOOPCOL;
|
2011-10-22 16:16:14 +00:00
|
|
|
}
|
|
|
|
/* CD_MDEFORMVERT */
|
|
|
|
if (surface->type == MOD_DPAINT_SURFACE_T_WEIGHT) {
|
2015-07-27 20:59:10 +10:00
|
|
|
dataMask |= CD_MASK_MDEFORMVERT;
|
2011-10-22 16:16:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pmd->brush) {
|
2011-10-31 13:01:06 +00:00
|
|
|
if (pmd->brush->flags & MOD_DPAINT_USE_MATERIAL) {
|
2015-07-27 20:59:10 +10:00
|
|
|
dataMask |= CD_MASK_MLOOPUV | CD_MASK_MTEXPOLY;
|
2011-10-22 16:16:14 +00:00
|
|
|
}
|
|
|
|
}
|
2011-05-24 07:08:58 +00:00
|
|
|
return dataMask;
|
|
|
|
}
|
|
|
|
|
2011-06-16 10:41:00 +00:00
|
|
|
static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
|
2012-05-06 13:38:33 +00:00
|
|
|
DerivedMesh *dm,
|
2013-04-29 15:02:54 +00:00
|
|
|
ModifierApplyFlag flag)
|
2011-05-24 07:08:58 +00:00
|
|
|
{
|
2012-05-06 13:38:33 +00:00
|
|
|
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *) md;
|
2011-06-16 10:41:00 +00:00
|
|
|
|
2013-04-29 15:02:54 +00:00
|
|
|
/* dont apply dynamic paint on orco dm stack */
|
2013-05-02 14:42:05 +00:00
|
|
|
if (!(flag & MOD_APPLY_ORCO)) {
|
2013-04-29 15:02:54 +00:00
|
|
|
return dynamicPaint_Modifier_do(pmd, md->scene, ob, dm);
|
|
|
|
}
|
|
|
|
return dm;
|
2011-06-16 10:41:00 +00:00
|
|
|
}
|
|
|
|
|
Fix depsgraph to compute more accurate links for collision & force.
Current implementation more or less indiscriminately links physics
objects to colliders and forces, ignoring precise details of layer
checks and collider groups. The new depsgraph seemed to lack some
such links at all. The relevant code in modifiers suffers from a
lot of duplication.
Different physics simulations use independent implementations of
collision and similar things, which results in a lot of variance:
* Cloth collides with objects on same or visible layer with dupli.
* Softbody collides with objects on same layer without dupli.
* Non-hair particles collide on same layer with dupli.
* Smoke uses same code as cloth, but needs different modifier.
* Dynamic paint "collides" with brushes on any layer without dupli.
Force fields with absorption also imply dependency on colliders:
* For most systems, colliders are selected from same layer as field.
* For non-hair particles, it uses the same exact set as the particles.
As a special quirk, smoke ignores smoke flow force fields; on the other
hand dependency on such field implies dependency on the smoke domain.
This introduces two utility functions each for old and new depsgraph
that are flexible enough to handle all these variations, and uses them
to handle particles, cloth, smoke, softbody and dynpaint.
One thing to watch out for is that depsgraph code shouldn't rely on
any properties that don't cause a graph rebuild when changed. This
was violated in the original code that was building force field links,
while taking zero field weights into account.
This change may cause new dependency cycles in cases where necessary
dependencies were missing, but may also remove cycles in situations
where unnecessary links were previously created. It's also now possible
to solve some cycles by switching to explicit groups, since they are
now properly taken into account for dependencies.
Differential Revision: https://developer.blender.org/D2141
2016-08-12 18:23:29 +03:00
|
|
|
static bool is_brush_cb(Object *UNUSED(ob), ModifierData *pmd)
|
|
|
|
{
|
2017-03-02 00:16:36 +11:00
|
|
|
return ((DynamicPaintModifierData *)pmd)->brush != NULL;
|
Fix depsgraph to compute more accurate links for collision & force.
Current implementation more or less indiscriminately links physics
objects to colliders and forces, ignoring precise details of layer
checks and collider groups. The new depsgraph seemed to lack some
such links at all. The relevant code in modifiers suffers from a
lot of duplication.
Different physics simulations use independent implementations of
collision and similar things, which results in a lot of variance:
* Cloth collides with objects on same or visible layer with dupli.
* Softbody collides with objects on same layer without dupli.
* Non-hair particles collide on same layer with dupli.
* Smoke uses same code as cloth, but needs different modifier.
* Dynamic paint "collides" with brushes on any layer without dupli.
Force fields with absorption also imply dependency on colliders:
* For most systems, colliders are selected from same layer as field.
* For non-hair particles, it uses the same exact set as the particles.
As a special quirk, smoke ignores smoke flow force fields; on the other
hand dependency on such field implies dependency on the smoke domain.
This introduces two utility functions each for old and new depsgraph
that are flexible enough to handle all these variations, and uses them
to handle particles, cloth, smoke, softbody and dynpaint.
One thing to watch out for is that depsgraph code shouldn't rely on
any properties that don't cause a graph rebuild when changed. This
was violated in the original code that was building force field links,
while taking zero field weights into account.
This change may cause new dependency cycles in cases where necessary
dependencies were missing, but may also remove cycles in situations
where unnecessary links were previously created. It's also now possible
to solve some cycles by switching to explicit groups, since they are
now properly taken into account for dependencies.
Differential Revision: https://developer.blender.org/D2141
2016-08-12 18:23:29 +03:00
|
|
|
}
|
|
|
|
|
2011-06-16 10:41:00 +00:00
|
|
|
static void updateDepgraph(ModifierData *md, DagForest *forest,
|
2015-03-13 11:48:04 +05:00
|
|
|
struct Main *UNUSED(bmain),
|
2012-05-06 13:38:33 +00:00
|
|
|
struct Scene *scene,
|
|
|
|
Object *ob,
|
|
|
|
DagNode *obNode)
|
2011-06-16 10:41:00 +00:00
|
|
|
{
|
2012-05-06 13:38:33 +00:00
|
|
|
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *) md;
|
2011-06-16 10:41:00 +00:00
|
|
|
|
|
|
|
/* add relation from canvases to all brush objects */
|
2012-03-06 18:40:15 +00:00
|
|
|
if (pmd && pmd->canvas) {
|
2017-01-23 18:08:41 +01:00
|
|
|
#ifdef WITH_LEGACY_DEPSGRAPH
|
Fix depsgraph to compute more accurate links for collision & force.
Current implementation more or less indiscriminately links physics
objects to colliders and forces, ignoring precise details of layer
checks and collider groups. The new depsgraph seemed to lack some
such links at all. The relevant code in modifiers suffers from a
lot of duplication.
Different physics simulations use independent implementations of
collision and similar things, which results in a lot of variance:
* Cloth collides with objects on same or visible layer with dupli.
* Softbody collides with objects on same layer without dupli.
* Non-hair particles collide on same layer with dupli.
* Smoke uses same code as cloth, but needs different modifier.
* Dynamic paint "collides" with brushes on any layer without dupli.
Force fields with absorption also imply dependency on colliders:
* For most systems, colliders are selected from same layer as field.
* For non-hair particles, it uses the same exact set as the particles.
As a special quirk, smoke ignores smoke flow force fields; on the other
hand dependency on such field implies dependency on the smoke domain.
This introduces two utility functions each for old and new depsgraph
that are flexible enough to handle all these variations, and uses them
to handle particles, cloth, smoke, softbody and dynpaint.
One thing to watch out for is that depsgraph code shouldn't rely on
any properties that don't cause a graph rebuild when changed. This
was violated in the original code that was building force field links,
while taking zero field weights into account.
This change may cause new dependency cycles in cases where necessary
dependencies were missing, but may also remove cycles in situations
where unnecessary links were previously created. It's also now possible
to solve some cycles by switching to explicit groups, since they are
now properly taken into account for dependencies.
Differential Revision: https://developer.blender.org/D2141
2016-08-12 18:23:29 +03:00
|
|
|
for (DynamicPaintSurface *surface = pmd->canvas->surfaces.first; surface; surface = surface->next) {
|
|
|
|
if (surface->effect & MOD_DPAINT_EFFECT_DO_DRIP) {
|
|
|
|
dag_add_forcefield_relations(forest, scene, ob, obNode, surface->effector_weights, true, 0, "Dynamic Paint Field");
|
2011-06-16 10:41:00 +00:00
|
|
|
}
|
Fix depsgraph to compute more accurate links for collision & force.
Current implementation more or less indiscriminately links physics
objects to colliders and forces, ignoring precise details of layer
checks and collider groups. The new depsgraph seemed to lack some
such links at all. The relevant code in modifiers suffers from a
lot of duplication.
Different physics simulations use independent implementations of
collision and similar things, which results in a lot of variance:
* Cloth collides with objects on same or visible layer with dupli.
* Softbody collides with objects on same layer without dupli.
* Non-hair particles collide on same layer with dupli.
* Smoke uses same code as cloth, but needs different modifier.
* Dynamic paint "collides" with brushes on any layer without dupli.
Force fields with absorption also imply dependency on colliders:
* For most systems, colliders are selected from same layer as field.
* For non-hair particles, it uses the same exact set as the particles.
As a special quirk, smoke ignores smoke flow force fields; on the other
hand dependency on such field implies dependency on the smoke domain.
This introduces two utility functions each for old and new depsgraph
that are flexible enough to handle all these variations, and uses them
to handle particles, cloth, smoke, softbody and dynpaint.
One thing to watch out for is that depsgraph code shouldn't rely on
any properties that don't cause a graph rebuild when changed. This
was violated in the original code that was building force field links,
while taking zero field weights into account.
This change may cause new dependency cycles in cases where necessary
dependencies were missing, but may also remove cycles in situations
where unnecessary links were previously created. It's also now possible
to solve some cycles by switching to explicit groups, since they are
now properly taken into account for dependencies.
Differential Revision: https://developer.blender.org/D2141
2016-08-12 18:23:29 +03:00
|
|
|
|
|
|
|
/* Actual code uses custom loop over group/scene without layer checks in dynamicPaint_doStep */
|
|
|
|
dag_add_collision_relations(forest, scene, ob, obNode, surface->brush_group, -1, eModifierType_DynamicPaint, is_brush_cb, false, "Dynamic Paint Brush");
|
2011-06-16 10:41:00 +00:00
|
|
|
}
|
2017-01-23 18:08:41 +01:00
|
|
|
#else
|
|
|
|
(void)forest;
|
|
|
|
(void)scene;
|
|
|
|
(void)ob;
|
|
|
|
(void)obNode;
|
|
|
|
#endif
|
2011-06-16 10:41:00 +00:00
|
|
|
}
|
2011-05-24 07:08:58 +00: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 updateDepsgraph(ModifierData *md,
|
|
|
|
struct Main *UNUSED(bmain),
|
|
|
|
struct Scene *scene,
|
|
|
|
Object *ob,
|
|
|
|
struct DepsNodeHandle *node)
|
|
|
|
{
|
|
|
|
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
|
|
|
|
/* Add relation from canvases to all brush objects. */
|
|
|
|
if (pmd->canvas != NULL) {
|
Fix depsgraph to compute more accurate links for collision & force.
Current implementation more or less indiscriminately links physics
objects to colliders and forces, ignoring precise details of layer
checks and collider groups. The new depsgraph seemed to lack some
such links at all. The relevant code in modifiers suffers from a
lot of duplication.
Different physics simulations use independent implementations of
collision and similar things, which results in a lot of variance:
* Cloth collides with objects on same or visible layer with dupli.
* Softbody collides with objects on same layer without dupli.
* Non-hair particles collide on same layer with dupli.
* Smoke uses same code as cloth, but needs different modifier.
* Dynamic paint "collides" with brushes on any layer without dupli.
Force fields with absorption also imply dependency on colliders:
* For most systems, colliders are selected from same layer as field.
* For non-hair particles, it uses the same exact set as the particles.
As a special quirk, smoke ignores smoke flow force fields; on the other
hand dependency on such field implies dependency on the smoke domain.
This introduces two utility functions each for old and new depsgraph
that are flexible enough to handle all these variations, and uses them
to handle particles, cloth, smoke, softbody and dynpaint.
One thing to watch out for is that depsgraph code shouldn't rely on
any properties that don't cause a graph rebuild when changed. This
was violated in the original code that was building force field links,
while taking zero field weights into account.
This change may cause new dependency cycles in cases where necessary
dependencies were missing, but may also remove cycles in situations
where unnecessary links were previously created. It's also now possible
to solve some cycles by switching to explicit groups, since they are
now properly taken into account for dependencies.
Differential Revision: https://developer.blender.org/D2141
2016-08-12 18:23:29 +03:00
|
|
|
for (DynamicPaintSurface *surface = pmd->canvas->surfaces.first; surface; surface = surface->next) {
|
|
|
|
if (surface->effect & MOD_DPAINT_EFFECT_DO_DRIP) {
|
|
|
|
DEG_add_forcefield_relations(node, scene, ob, surface->effector_weights, true, 0, "Dynamic Paint Field");
|
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
|
|
|
}
|
Fix depsgraph to compute more accurate links for collision & force.
Current implementation more or less indiscriminately links physics
objects to colliders and forces, ignoring precise details of layer
checks and collider groups. The new depsgraph seemed to lack some
such links at all. The relevant code in modifiers suffers from a
lot of duplication.
Different physics simulations use independent implementations of
collision and similar things, which results in a lot of variance:
* Cloth collides with objects on same or visible layer with dupli.
* Softbody collides with objects on same layer without dupli.
* Non-hair particles collide on same layer with dupli.
* Smoke uses same code as cloth, but needs different modifier.
* Dynamic paint "collides" with brushes on any layer without dupli.
Force fields with absorption also imply dependency on colliders:
* For most systems, colliders are selected from same layer as field.
* For non-hair particles, it uses the same exact set as the particles.
As a special quirk, smoke ignores smoke flow force fields; on the other
hand dependency on such field implies dependency on the smoke domain.
This introduces two utility functions each for old and new depsgraph
that are flexible enough to handle all these variations, and uses them
to handle particles, cloth, smoke, softbody and dynpaint.
One thing to watch out for is that depsgraph code shouldn't rely on
any properties that don't cause a graph rebuild when changed. This
was violated in the original code that was building force field links,
while taking zero field weights into account.
This change may cause new dependency cycles in cases where necessary
dependencies were missing, but may also remove cycles in situations
where unnecessary links were previously created. It's also now possible
to solve some cycles by switching to explicit groups, since they are
now properly taken into account for dependencies.
Differential Revision: https://developer.blender.org/D2141
2016-08-12 18:23:29 +03:00
|
|
|
|
|
|
|
/* Actual code uses custom loop over group/scene without layer checks in dynamicPaint_doStep */
|
|
|
|
DEG_add_collision_relations(node, scene, ob, surface->brush_group, -1, eModifierType_DynamicPaint, is_brush_cb, false, "Dynamic Paint Brush");
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-02 03:59:19 +00:00
|
|
|
static bool dependsOnTime(ModifierData *UNUSED(md))
|
2011-05-24 07:08:58 +00:00
|
|
|
{
|
2013-06-02 03:59:19 +00:00
|
|
|
return true;
|
2011-05-24 07:08:58 +00:00
|
|
|
}
|
|
|
|
|
2011-06-16 10:41:00 +00:00
|
|
|
static void foreachIDLink(ModifierData *md, Object *ob,
|
2012-05-06 13:38:33 +00:00
|
|
|
IDWalkFunc walk, void *userData)
|
2011-06-16 10:41:00 +00:00
|
|
|
{
|
2012-05-06 13:38:33 +00:00
|
|
|
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *) md;
|
2011-06-16 10:41:00 +00:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (pmd->canvas) {
|
2011-06-16 10:41:00 +00:00
|
|
|
DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
|
|
|
|
|
2012-05-06 13:38:33 +00:00
|
|
|
for (; surface; surface = surface->next) {
|
2017-01-31 09:47:59 +01:00
|
|
|
walk(userData, ob, (ID **)&surface->brush_group, IDWALK_CB_NOP);
|
|
|
|
walk(userData, ob, (ID **)&surface->init_texture, IDWALK_CB_USER);
|
2016-03-25 13:15:50 +01:00
|
|
|
if (surface->effector_weights) {
|
2017-01-31 09:47:59 +01:00
|
|
|
walk(userData, ob, (ID **)&surface->effector_weights->group, IDWALK_CB_NOP);
|
2016-03-25 13:15:50 +01:00
|
|
|
}
|
2011-06-16 10:41:00 +00:00
|
|
|
}
|
|
|
|
}
|
2011-07-22 18:37:30 +00:00
|
|
|
if (pmd->brush) {
|
2017-01-31 09:47:59 +01:00
|
|
|
walk(userData, ob, (ID **)&pmd->brush->mat, IDWALK_CB_USER);
|
2011-07-22 18:37:30 +00:00
|
|
|
}
|
2011-06-16 10:41:00 +00:00
|
|
|
}
|
2011-05-24 07:08:58 +00:00
|
|
|
|
2011-11-10 12:28:26 +00:00
|
|
|
static void foreachTexLink(ModifierData *UNUSED(md), Object *UNUSED(ob),
|
2012-05-06 13:38:33 +00:00
|
|
|
TexWalkFunc UNUSED(walk), void *UNUSED(userData))
|
2011-09-05 16:04:15 +00:00
|
|
|
{
|
2011-11-09 15:46:53 +00:00
|
|
|
//walk(userData, ob, md, ""); /* re-enable when possible */
|
2011-09-05 16:04:15 +00:00
|
|
|
}
|
|
|
|
|
2011-05-24 07:08:58 +00:00
|
|
|
ModifierTypeInfo modifierType_DynamicPaint = {
|
|
|
|
/* name */ "Dynamic Paint",
|
|
|
|
/* structName */ "DynamicPaintModifierData",
|
|
|
|
/* structSize */ sizeof(DynamicPaintModifierData),
|
2011-06-16 10:41:00 +00:00
|
|
|
/* type */ eModifierTypeType_Constructive,
|
2012-05-06 13:38:33 +00:00
|
|
|
/* flags */ eModifierTypeFlag_AcceptsMesh |
|
2012-10-24 05:45:54 +00:00
|
|
|
/* eModifierTypeFlag_SupportsMapping |*/
|
|
|
|
eModifierTypeFlag_UsesPointCache |
|
|
|
|
eModifierTypeFlag_Single |
|
|
|
|
eModifierTypeFlag_UsesPreview,
|
2011-05-24 07:08:58 +00:00
|
|
|
|
|
|
|
/* copyData */ copyData,
|
2011-11-14 16:05:44 +00:00
|
|
|
/* deformVerts */ NULL,
|
|
|
|
/* deformMatrices */ NULL,
|
|
|
|
/* deformVertsEM */ NULL,
|
|
|
|
/* deformMatricesEM */ NULL,
|
2011-06-16 10:41:00 +00:00
|
|
|
/* applyModifier */ applyModifier,
|
2011-11-14 16:05:44 +00:00
|
|
|
/* applyModifierEM */ NULL,
|
2011-05-24 07:08:58 +00:00
|
|
|
/* initData */ initData,
|
|
|
|
/* requiredDataMask */ requiredDataMask,
|
|
|
|
/* freeData */ freeData,
|
2011-11-14 16:05:44 +00:00
|
|
|
/* isDisabled */ NULL,
|
2011-06-16 10:41:00 +00:00
|
|
|
/* updateDepgraph */ updateDepgraph,
|
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
|
|
|
/* updateDepsgraph */ updateDepsgraph,
|
2011-05-24 07:08:58 +00:00
|
|
|
/* dependsOnTime */ dependsOnTime,
|
2011-11-14 16:05:44 +00:00
|
|
|
/* dependsOnNormals */ NULL,
|
|
|
|
/* foreachObjectLink */ NULL,
|
2011-06-16 10:41:00 +00:00
|
|
|
/* foreachIDLink */ foreachIDLink,
|
2011-09-05 16:04:15 +00:00
|
|
|
/* foreachTexLink */ foreachTexLink,
|
2011-05-24 07:08:58 +00:00
|
|
|
};
|