2010-04-11 22:12:30 +00:00
|
|
|
/*
|
2011-10-23 17:52:20 +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.
|
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2005 by the Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s): Daniel Dunbar
|
|
|
|
* Ton Roosendaal,
|
|
|
|
* Ben Batt,
|
|
|
|
* Brecht Van Lommel,
|
|
|
|
* Campbell Barton
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
*/
|
2010-04-11 22:12:30 +00:00
|
|
|
|
2011-02-25 13:57:17 +00:00
|
|
|
/** \file blender/modifiers/intern/MOD_smoke.c
|
|
|
|
* \ingroup modifiers
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-03-09 01:25:59 +00:00
|
|
|
#include <stddef.h>
|
2010-04-11 22:12:30 +00:00
|
|
|
|
2010-05-14 07:09:15 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
2010-12-15 17:05:34 +00:00
|
|
|
#include "DNA_group_types.h"
|
2010-08-04 04:01:27 +00:00
|
|
|
#include "DNA_object_types.h"
|
2010-12-15 17:05:34 +00:00
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
#include "DNA_smoke_types.h"
|
2011-06-08 16:00:52 +00:00
|
|
|
#include "DNA_object_force.h"
|
2010-08-04 04:01:27 +00:00
|
|
|
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
2011-01-07 19:18:31 +00:00
|
|
|
|
2010-04-11 22:12:30 +00:00
|
|
|
#include "BKE_cdderivedmesh.h"
|
2015-03-10 16:51:29 +05:00
|
|
|
#include "BKE_library.h"
|
2015-10-08 14:21:11 +02:00
|
|
|
#include "BKE_library_query.h"
|
2015-03-10 16:51:29 +05:00
|
|
|
#include "BKE_main.h"
|
2010-04-11 22:12:30 +00:00
|
|
|
#include "BKE_modifier.h"
|
|
|
|
#include "BKE_smoke.h"
|
|
|
|
|
|
|
|
#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"
|
2010-04-11 22:12:30 +00:00
|
|
|
|
|
|
|
static void initData(ModifierData *md)
|
|
|
|
{
|
2012-05-06 13:38:33 +00:00
|
|
|
SmokeModifierData *smd = (SmokeModifierData *) md;
|
2010-04-11 22:12:30 +00:00
|
|
|
|
|
|
|
smd->domain = NULL;
|
|
|
|
smd->flow = NULL;
|
|
|
|
smd->coll = NULL;
|
|
|
|
smd->type = 0;
|
|
|
|
smd->time = -1;
|
|
|
|
}
|
|
|
|
|
2010-05-14 07:09:15 +00:00
|
|
|
static void copyData(ModifierData *md, ModifierData *target)
|
|
|
|
{
|
2012-05-06 13:38:33 +00:00
|
|
|
SmokeModifierData *smd = (SmokeModifierData *)md;
|
|
|
|
SmokeModifierData *tsmd = (SmokeModifierData *)target;
|
2010-05-14 07:09:15 +00:00
|
|
|
|
|
|
|
smokeModifier_copy(smd, tsmd);
|
|
|
|
}
|
|
|
|
|
2010-04-11 22:12:30 +00:00
|
|
|
static void freeData(ModifierData *md)
|
|
|
|
{
|
2012-05-06 13:38:33 +00:00
|
|
|
SmokeModifierData *smd = (SmokeModifierData *) md;
|
2010-04-11 22:12:30 +00:00
|
|
|
|
2012-05-06 13:38:33 +00:00
|
|
|
smokeModifier_free(smd);
|
2010-04-11 22:12:30 +00:00
|
|
|
}
|
|
|
|
|
2012-10-10 13:18:07 +00:00
|
|
|
static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
|
2010-04-11 22:12:30 +00:00
|
|
|
{
|
2012-10-10 13:18:07 +00:00
|
|
|
SmokeModifierData *smd = (SmokeModifierData *)md;
|
|
|
|
CustomDataMask dataMask = 0;
|
|
|
|
|
|
|
|
if (smd && (smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow) {
|
|
|
|
if (smd->flow->source == MOD_SMOKE_FLOW_SOURCE_MESH) {
|
|
|
|
/* vertex groups */
|
|
|
|
if (smd->flow->vgroup_density)
|
|
|
|
dataMask |= CD_MASK_MDEFORMVERT;
|
|
|
|
/* uv layer */
|
|
|
|
if (smd->flow->texture_type == MOD_SMOKE_FLOW_TEXTURE_MAP_UV)
|
|
|
|
dataMask |= CD_MASK_MTFACE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return dataMask;
|
|
|
|
}
|
2010-04-11 22:12:30 +00:00
|
|
|
|
2012-10-10 13:18:07 +00:00
|
|
|
static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
|
|
|
|
DerivedMesh *dm,
|
2013-12-19 18:25:14 +01:00
|
|
|
ModifierApplyFlag flag)
|
2012-10-10 13:18:07 +00:00
|
|
|
{
|
|
|
|
SmokeModifierData *smd = (SmokeModifierData *) md;
|
2010-04-11 22:12:30 +00:00
|
|
|
|
2013-12-19 18:52:26 +01:00
|
|
|
if (flag & MOD_APPLY_ORCO)
|
2013-12-19 18:25:14 +01:00
|
|
|
return dm;
|
|
|
|
|
2016-01-09 04:37:53 +01:00
|
|
|
return smokeModifier_do(smd, md->scene, ob, dm);
|
2010-04-11 22:12:30 +00:00
|
|
|
}
|
|
|
|
|
2013-06-02 03:59:19 +00:00
|
|
|
static bool dependsOnTime(ModifierData *UNUSED(md))
|
2010-04-11 22:12:30 +00:00
|
|
|
{
|
2013-06-02 03:59:19 +00:00
|
|
|
return true;
|
2010-04-11 22:12:30 +00:00
|
|
|
}
|
|
|
|
|
2015-03-10 16:51:29 +05:00
|
|
|
static void update_depsgraph_flow_coll_object(DagForest *forest,
|
|
|
|
DagNode *obNode,
|
|
|
|
Object *object2)
|
|
|
|
{
|
|
|
|
SmokeModifierData *smd;
|
Split id->flag in two, persistent flags and runtime tags.
This is purely internal sanitizing/cleanup, no change in behavior is expected at all.
This change was also needed because we were getting short on ID flags, and
future enhancement of 'user_one' ID behavior requires two new ones.
id->flag remains for persistent data (fakeuser only, so far!), this also allows us
100% backward & forward compatibility.
New id->tag is used for most flags. Though written in .blend files, its content
is cleared at read time.
Note that .blend file version was bumped, so that we can clear runtimeflags from
old .blends, important in case we add new persistent flags in future.
Also, behavior of tags (either status ones, or whether they need to be cleared before/after use)
has been added as comments to their declaration.
Reviewers: sergey, campbellbarton
Differential Revision: https://developer.blender.org/D1683
2015-12-27 11:53:50 +01:00
|
|
|
if ((object2->id.tag & LIB_TAG_DOIT) == 0) {
|
2015-03-10 16:51:29 +05:00
|
|
|
return;
|
|
|
|
}
|
Split id->flag in two, persistent flags and runtime tags.
This is purely internal sanitizing/cleanup, no change in behavior is expected at all.
This change was also needed because we were getting short on ID flags, and
future enhancement of 'user_one' ID behavior requires two new ones.
id->flag remains for persistent data (fakeuser only, so far!), this also allows us
100% backward & forward compatibility.
New id->tag is used for most flags. Though written in .blend files, its content
is cleared at read time.
Note that .blend file version was bumped, so that we can clear runtimeflags from
old .blends, important in case we add new persistent flags in future.
Also, behavior of tags (either status ones, or whether they need to be cleared before/after use)
has been added as comments to their declaration.
Reviewers: sergey, campbellbarton
Differential Revision: https://developer.blender.org/D1683
2015-12-27 11:53:50 +01:00
|
|
|
object2->id.tag &= ~LIB_TAG_DOIT;
|
2015-03-10 16:51:29 +05:00
|
|
|
smd = (SmokeModifierData *)modifiers_findByType(object2, eModifierType_Smoke);
|
|
|
|
if (smd && (((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow) ||
|
|
|
|
((smd->type & MOD_SMOKE_TYPE_COLL) && smd->coll)))
|
|
|
|
{
|
|
|
|
DagNode *curNode = dag_get_node(forest, object2);
|
|
|
|
dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Smoke Flow/Coll");
|
|
|
|
}
|
|
|
|
if ((object2->transflag & OB_DUPLIGROUP) && object2->dup_group) {
|
|
|
|
GroupObject *go;
|
|
|
|
for (go = object2->dup_group->gobject.first;
|
|
|
|
go != NULL;
|
|
|
|
go = go->next)
|
|
|
|
{
|
|
|
|
if (go->ob == NULL) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
update_depsgraph_flow_coll_object(forest, obNode, go->ob);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void update_depsgraph_field_source_object(DagForest *forest,
|
|
|
|
DagNode *obNode,
|
|
|
|
Object *object,
|
|
|
|
Object *object2)
|
|
|
|
{
|
Split id->flag in two, persistent flags and runtime tags.
This is purely internal sanitizing/cleanup, no change in behavior is expected at all.
This change was also needed because we were getting short on ID flags, and
future enhancement of 'user_one' ID behavior requires two new ones.
id->flag remains for persistent data (fakeuser only, so far!), this also allows us
100% backward & forward compatibility.
New id->tag is used for most flags. Though written in .blend files, its content
is cleared at read time.
Note that .blend file version was bumped, so that we can clear runtimeflags from
old .blends, important in case we add new persistent flags in future.
Also, behavior of tags (either status ones, or whether they need to be cleared before/after use)
has been added as comments to their declaration.
Reviewers: sergey, campbellbarton
Differential Revision: https://developer.blender.org/D1683
2015-12-27 11:53:50 +01:00
|
|
|
if ((object2->id.tag & LIB_TAG_DOIT) == 0) {
|
2015-03-10 16:51:29 +05:00
|
|
|
return;
|
|
|
|
}
|
Split id->flag in two, persistent flags and runtime tags.
This is purely internal sanitizing/cleanup, no change in behavior is expected at all.
This change was also needed because we were getting short on ID flags, and
future enhancement of 'user_one' ID behavior requires two new ones.
id->flag remains for persistent data (fakeuser only, so far!), this also allows us
100% backward & forward compatibility.
New id->tag is used for most flags. Though written in .blend files, its content
is cleared at read time.
Note that .blend file version was bumped, so that we can clear runtimeflags from
old .blends, important in case we add new persistent flags in future.
Also, behavior of tags (either status ones, or whether they need to be cleared before/after use)
has been added as comments to their declaration.
Reviewers: sergey, campbellbarton
Differential Revision: https://developer.blender.org/D1683
2015-12-27 11:53:50 +01:00
|
|
|
object2->id.tag &= ~LIB_TAG_DOIT;
|
2015-03-10 16:51:29 +05:00
|
|
|
if (object2->pd && object2->pd->forcefield == PFIELD_SMOKEFLOW && object2->pd->f_source == object) {
|
|
|
|
DagNode *node2 = dag_get_node(forest, object2);
|
|
|
|
dag_add_relation(forest, obNode, node2, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Field Source Object");
|
|
|
|
}
|
|
|
|
if ((object2->transflag & OB_DUPLIGROUP) && object2->dup_group) {
|
|
|
|
GroupObject *go;
|
|
|
|
for (go = object2->dup_group->gobject.first;
|
|
|
|
go != NULL;
|
|
|
|
go = go->next)
|
|
|
|
{
|
|
|
|
if (go->ob == NULL) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
update_depsgraph_field_source_object(forest, obNode, object, go->ob);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-15 17:05:34 +00:00
|
|
|
static void updateDepgraph(ModifierData *md, DagForest *forest,
|
2015-03-13 11:48:04 +05:00
|
|
|
struct Main *bmain,
|
2012-10-10 13:18:07 +00:00
|
|
|
struct Scene *scene, struct Object *ob,
|
2012-05-06 13:38:33 +00:00
|
|
|
DagNode *obNode)
|
2010-04-11 22:12:30 +00:00
|
|
|
{
|
2010-12-15 17:05:34 +00:00
|
|
|
SmokeModifierData *smd = (SmokeModifierData *) md;
|
2012-10-10 13:18:07 +00:00
|
|
|
Base *base;
|
2010-12-15 17:05:34 +00:00
|
|
|
|
2012-03-06 18:40:15 +00:00
|
|
|
if (smd && (smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) {
|
2012-03-20 17:51:14 +00:00
|
|
|
if (smd->domain->fluid_group || smd->domain->coll_group) {
|
2010-04-11 22:12:30 +00:00
|
|
|
GroupObject *go = NULL;
|
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (smd->domain->fluid_group)
|
2012-03-20 17:51:14 +00:00
|
|
|
for (go = smd->domain->fluid_group->gobject.first; go; go = go->next) {
|
|
|
|
if (go->ob) {
|
|
|
|
SmokeModifierData *smd2 = (SmokeModifierData *)modifiers_findByType(go->ob, eModifierType_Smoke);
|
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* check for initialized smoke object */
|
2012-03-20 17:51:14 +00:00
|
|
|
if (smd2 && (smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow) {
|
|
|
|
DagNode *curNode = dag_get_node(forest, go->ob);
|
2012-05-06 13:38:33 +00:00
|
|
|
dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Smoke Flow");
|
2012-03-20 17:51:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (smd->domain->coll_group)
|
2012-03-20 17:51:14 +00:00
|
|
|
for (go = smd->domain->coll_group->gobject.first; go; go = go->next) {
|
|
|
|
if (go->ob) {
|
|
|
|
SmokeModifierData *smd2 = (SmokeModifierData *)modifiers_findByType(go->ob, eModifierType_Smoke);
|
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* check for initialized smoke object */
|
2012-03-20 17:51:14 +00:00
|
|
|
if (smd2 && (smd2->type & MOD_SMOKE_TYPE_COLL) && smd2->coll) {
|
|
|
|
DagNode *curNode = dag_get_node(forest, go->ob);
|
2012-05-06 13:38:33 +00:00
|
|
|
dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Smoke Coll");
|
2012-03-20 17:51:14 +00:00
|
|
|
}
|
2010-04-11 22:12:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-12-15 17:05:34 +00:00
|
|
|
else {
|
2016-02-15 19:35:35 +01:00
|
|
|
BKE_main_id_tag_listbase(&bmain->object, LIB_TAG_DOIT, true);
|
2012-10-10 13:18:07 +00:00
|
|
|
base = scene->base.first;
|
2012-05-06 13:38:33 +00:00
|
|
|
for (; base; base = base->next) {
|
2015-03-10 16:51:29 +05:00
|
|
|
update_depsgraph_flow_coll_object(forest, obNode, base->object);
|
2010-12-15 17:05:34 +00:00
|
|
|
}
|
|
|
|
}
|
2012-10-10 13:18:07 +00:00
|
|
|
/* add relation to all "smoke flow" force fields */
|
|
|
|
base = scene->base.first;
|
2016-02-15 19:35:35 +01:00
|
|
|
BKE_main_id_tag_listbase(&bmain->object, LIB_TAG_DOIT, true);
|
2012-10-10 13:18:07 +00:00
|
|
|
for (; base; base = base->next) {
|
2015-03-10 16:51:29 +05:00
|
|
|
update_depsgraph_field_source_object(forest, obNode, ob, base->object);
|
2012-10-10 13:18:07 +00:00
|
|
|
}
|
2010-04-11 22:12:30 +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 update_depsgraph_flow_coll_object_new(struct DepsNodeHandle *node,
|
|
|
|
Object *object2)
|
|
|
|
{
|
|
|
|
SmokeModifierData *smd;
|
Split id->flag in two, persistent flags and runtime tags.
This is purely internal sanitizing/cleanup, no change in behavior is expected at all.
This change was also needed because we were getting short on ID flags, and
future enhancement of 'user_one' ID behavior requires two new ones.
id->flag remains for persistent data (fakeuser only, so far!), this also allows us
100% backward & forward compatibility.
New id->tag is used for most flags. Though written in .blend files, its content
is cleared at read time.
Note that .blend file version was bumped, so that we can clear runtimeflags from
old .blends, important in case we add new persistent flags in future.
Also, behavior of tags (either status ones, or whether they need to be cleared before/after use)
has been added as comments to their declaration.
Reviewers: sergey, campbellbarton
Differential Revision: https://developer.blender.org/D1683
2015-12-27 11:53:50 +01:00
|
|
|
if ((object2->id.tag & LIB_TAG_DOIT) == 0) {
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
return;
|
|
|
|
}
|
Split id->flag in two, persistent flags and runtime tags.
This is purely internal sanitizing/cleanup, no change in behavior is expected at all.
This change was also needed because we were getting short on ID flags, and
future enhancement of 'user_one' ID behavior requires two new ones.
id->flag remains for persistent data (fakeuser only, so far!), this also allows us
100% backward & forward compatibility.
New id->tag is used for most flags. Though written in .blend files, its content
is cleared at read time.
Note that .blend file version was bumped, so that we can clear runtimeflags from
old .blends, important in case we add new persistent flags in future.
Also, behavior of tags (either status ones, or whether they need to be cleared before/after use)
has been added as comments to their declaration.
Reviewers: sergey, campbellbarton
Differential Revision: https://developer.blender.org/D1683
2015-12-27 11:53:50 +01:00
|
|
|
object2->id.tag &= ~LIB_TAG_DOIT;
|
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
|
|
|
smd = (SmokeModifierData *)modifiers_findByType(object2, eModifierType_Smoke);
|
|
|
|
if (smd && (((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow) ||
|
|
|
|
((smd->type & MOD_SMOKE_TYPE_COLL) && smd->coll)))
|
|
|
|
{
|
|
|
|
DEG_add_object_relation(node, object2, DEG_OB_COMP_TRANSFORM, "Smoke Flow/Coll");
|
|
|
|
DEG_add_object_relation(node, object2, DEG_OB_COMP_GEOMETRY, "Smoke Flow/Coll");
|
|
|
|
}
|
|
|
|
if ((object2->transflag & OB_DUPLIGROUP) && object2->dup_group) {
|
|
|
|
GroupObject *go;
|
|
|
|
for (go = object2->dup_group->gobject.first;
|
|
|
|
go != NULL;
|
|
|
|
go = go->next)
|
|
|
|
{
|
|
|
|
if (go->ob == NULL) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
update_depsgraph_flow_coll_object_new(node, go->ob);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void update_depsgraph_field_source_object_new(struct DepsNodeHandle *node,
|
|
|
|
Object *object,
|
|
|
|
Object *object2)
|
|
|
|
{
|
Split id->flag in two, persistent flags and runtime tags.
This is purely internal sanitizing/cleanup, no change in behavior is expected at all.
This change was also needed because we were getting short on ID flags, and
future enhancement of 'user_one' ID behavior requires two new ones.
id->flag remains for persistent data (fakeuser only, so far!), this also allows us
100% backward & forward compatibility.
New id->tag is used for most flags. Though written in .blend files, its content
is cleared at read time.
Note that .blend file version was bumped, so that we can clear runtimeflags from
old .blends, important in case we add new persistent flags in future.
Also, behavior of tags (either status ones, or whether they need to be cleared before/after use)
has been added as comments to their declaration.
Reviewers: sergey, campbellbarton
Differential Revision: https://developer.blender.org/D1683
2015-12-27 11:53:50 +01:00
|
|
|
if ((object2->id.tag & LIB_TAG_DOIT) == 0) {
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
return;
|
|
|
|
}
|
Split id->flag in two, persistent flags and runtime tags.
This is purely internal sanitizing/cleanup, no change in behavior is expected at all.
This change was also needed because we were getting short on ID flags, and
future enhancement of 'user_one' ID behavior requires two new ones.
id->flag remains for persistent data (fakeuser only, so far!), this also allows us
100% backward & forward compatibility.
New id->tag is used for most flags. Though written in .blend files, its content
is cleared at read time.
Note that .blend file version was bumped, so that we can clear runtimeflags from
old .blends, important in case we add new persistent flags in future.
Also, behavior of tags (either status ones, or whether they need to be cleared before/after use)
has been added as comments to their declaration.
Reviewers: sergey, campbellbarton
Differential Revision: https://developer.blender.org/D1683
2015-12-27 11:53:50 +01:00
|
|
|
object2->id.tag &= ~LIB_TAG_DOIT;
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
if (object2->pd && object2->pd->forcefield == PFIELD_SMOKEFLOW && object2->pd->f_source == object) {
|
|
|
|
DEG_add_object_relation(node, object2, DEG_OB_COMP_TRANSFORM, "Field Source Object");
|
|
|
|
DEG_add_object_relation(node, object2, DEG_OB_COMP_GEOMETRY, "Field Source Object");
|
|
|
|
}
|
|
|
|
if ((object2->transflag & OB_DUPLIGROUP) && object2->dup_group) {
|
|
|
|
GroupObject *go;
|
|
|
|
for (go = object2->dup_group->gobject.first;
|
|
|
|
go != NULL;
|
|
|
|
go = go->next)
|
|
|
|
{
|
|
|
|
if (go->ob == NULL) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
update_depsgraph_field_source_object_new(node, object, go->ob);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void updateDepsgraph(ModifierData *md,
|
|
|
|
struct Main *bmain,
|
|
|
|
struct Scene *scene,
|
|
|
|
Object *ob,
|
|
|
|
struct DepsNodeHandle *node)
|
|
|
|
{
|
|
|
|
SmokeModifierData *smd = (SmokeModifierData *)md;
|
|
|
|
Base *base;
|
|
|
|
if (smd && (smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) {
|
|
|
|
if (smd->domain->fluid_group || smd->domain->coll_group) {
|
|
|
|
GroupObject *go = NULL;
|
|
|
|
if (smd->domain->fluid_group != NULL) {
|
|
|
|
for (go = smd->domain->fluid_group->gobject.first; go; go = go->next) {
|
|
|
|
if (go->ob != NULL) {
|
|
|
|
SmokeModifierData *smd2 = (SmokeModifierData *)modifiers_findByType(go->ob, eModifierType_Smoke);
|
|
|
|
/* Check for initialized smoke object. */
|
|
|
|
if (smd2 && (smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow) {
|
|
|
|
DEG_add_object_relation(node, go->ob, DEG_OB_COMP_TRANSFORM, "Smoke Flow");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (smd->domain->coll_group != NULL) {
|
|
|
|
for (go = smd->domain->coll_group->gobject.first; go; go = go->next) {
|
|
|
|
if (go->ob != NULL) {
|
|
|
|
SmokeModifierData *smd2 = (SmokeModifierData *)modifiers_findByType(go->ob, eModifierType_Smoke);
|
|
|
|
/* Check for initialized smoke object. */
|
|
|
|
if (smd2 && (smd2->type & MOD_SMOKE_TYPE_COLL) && smd2->coll) {
|
|
|
|
DEG_add_object_relation(node, go->ob, DEG_OB_COMP_TRANSFORM, "Smoke Coll");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2016-02-15 19:35:35 +01:00
|
|
|
BKE_main_id_tag_listbase(&bmain->object, LIB_TAG_DOIT, true);
|
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
|
|
|
base = scene->base.first;
|
|
|
|
for (; base; base = base->next) {
|
|
|
|
update_depsgraph_flow_coll_object_new(node, base->object);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* add relation to all "smoke flow" force fields */
|
|
|
|
base = scene->base.first;
|
2016-02-15 19:35:35 +01:00
|
|
|
BKE_main_id_tag_listbase(&bmain->object, LIB_TAG_DOIT, true);
|
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
|
|
|
for (; base; base = base->next) {
|
|
|
|
update_depsgraph_field_source_object_new(node, ob, base->object);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-31 11:21:21 +00:00
|
|
|
static void foreachIDLink(ModifierData *md, Object *ob,
|
2012-05-06 13:38:33 +00:00
|
|
|
IDWalkFunc walk, void *userData)
|
2011-03-31 11:21:21 +00:00
|
|
|
{
|
2012-05-06 13:38:33 +00:00
|
|
|
SmokeModifierData *smd = (SmokeModifierData *) md;
|
2011-03-31 11:21:21 +00:00
|
|
|
|
2012-05-06 13:38:33 +00:00
|
|
|
if (smd->type == MOD_SMOKE_TYPE_DOMAIN && smd->domain) {
|
2015-10-08 14:21:11 +02:00
|
|
|
walk(userData, ob, (ID **)&smd->domain->coll_group, IDWALK_NOP);
|
|
|
|
walk(userData, ob, (ID **)&smd->domain->fluid_group, IDWALK_NOP);
|
|
|
|
walk(userData, ob, (ID **)&smd->domain->eff_group, IDWALK_NOP);
|
2011-06-08 16:00:52 +00:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (smd->domain->effector_weights) {
|
2015-10-08 14:21:11 +02:00
|
|
|
walk(userData, ob, (ID **)&smd->domain->effector_weights->group, IDWALK_NOP);
|
2011-06-08 16:00:52 +00:00
|
|
|
}
|
2011-03-31 11:21:21 +00:00
|
|
|
}
|
2012-10-10 13:18:07 +00:00
|
|
|
|
|
|
|
if (smd->type == MOD_SMOKE_TYPE_FLOW && smd->flow) {
|
2015-10-08 14:21:11 +02:00
|
|
|
walk(userData, ob, (ID **)&smd->flow->noise_texture, IDWALK_USER);
|
2012-10-10 13:18:07 +00:00
|
|
|
}
|
2011-03-31 11:21:21 +00:00
|
|
|
}
|
2010-04-11 22:12:30 +00:00
|
|
|
|
|
|
|
ModifierTypeInfo modifierType_Smoke = {
|
|
|
|
/* name */ "Smoke",
|
|
|
|
/* structName */ "SmokeModifierData",
|
|
|
|
/* structSize */ sizeof(SmokeModifierData),
|
2012-10-10 13:18:07 +00:00
|
|
|
/* type */ eModifierTypeType_Constructive,
|
2012-05-06 13:38:33 +00:00
|
|
|
/* flags */ eModifierTypeFlag_AcceptsMesh |
|
|
|
|
eModifierTypeFlag_UsesPointCache |
|
|
|
|
eModifierTypeFlag_Single,
|
2010-04-11 22:12:30 +00:00
|
|
|
|
2010-05-14 07:09:15 +00:00
|
|
|
/* copyData */ copyData,
|
2012-10-10 13:18:07 +00:00
|
|
|
/* deformVerts */ NULL,
|
2011-03-05 10:29:10 +00:00
|
|
|
/* deformMatrices */ NULL,
|
|
|
|
/* deformVertsEM */ NULL,
|
|
|
|
/* deformMatricesEM */ NULL,
|
2012-10-10 13:18:07 +00:00
|
|
|
/* applyModifier */ applyModifier,
|
2011-03-05 10:29:10 +00:00
|
|
|
/* applyModifierEM */ NULL,
|
2010-04-11 22:12:30 +00:00
|
|
|
/* initData */ initData,
|
2012-10-10 13:18:07 +00:00
|
|
|
/* requiredDataMask */ requiredDataMask,
|
2010-04-11 22:12:30 +00:00
|
|
|
/* freeData */ freeData,
|
2011-03-05 10:29:10 +00:00
|
|
|
/* isDisabled */ NULL,
|
2010-04-11 22:12:30 +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,
|
2010-04-11 22:12:30 +00:00
|
|
|
/* dependsOnTime */ dependsOnTime,
|
2011-03-05 10:29:10 +00:00
|
|
|
/* dependsOnNormals */ NULL,
|
|
|
|
/* foreachObjectLink */ NULL,
|
2011-03-31 11:21:21 +00:00
|
|
|
/* foreachIDLink */ foreachIDLink,
|
2011-08-12 18:11:22 +00:00
|
|
|
/* foreachTexLink */ NULL
|
2010-04-11 22:12:30 +00:00
|
|
|
};
|