Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/modifiers/intern/MOD_smoke.c')
-rw-r--r--source/blender/modifiers/intern/MOD_smoke.c107
1 files changed, 107 insertions, 0 deletions
diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c
index 74409498ca3..657c4e09d96 100644
--- a/source/blender/modifiers/intern/MOD_smoke.c
+++ b/source/blender/modifiers/intern/MOD_smoke.c
@@ -53,6 +53,7 @@
#include "BKE_smoke.h"
#include "depsgraph_private.h"
+#include "DEG_depsgraph_build.h"
static void initData(ModifierData *md)
{
@@ -227,6 +228,111 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
}
}
+static void update_depsgraph_flow_coll_object_new(struct DepsNodeHandle *node,
+ Object *object2)
+{
+ SmokeModifierData *smd;
+ if ((object2->id.flag & LIB_DOIT) == 0) {
+ return;
+ }
+ object2->id.flag &= ~LIB_DOIT;
+ 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)
+{
+ if ((object2->id.flag & LIB_DOIT) == 0) {
+ return;
+ }
+ object2->id.flag &= ~LIB_DOIT;
+ 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 {
+ BKE_main_id_tag_listbase(&bmain->object, true);
+ 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;
+ BKE_main_id_tag_listbase(&bmain->object, true);
+ for (; base; base = base->next) {
+ update_depsgraph_field_source_object_new(node, ob, base->object);
+ }
+ }
+}
+
static void foreachIDLink(ModifierData *md, Object *ob,
IDWalkFunc walk, void *userData)
{
@@ -268,6 +374,7 @@ ModifierTypeInfo modifierType_Smoke = {
/* freeData */ freeData,
/* isDisabled */ NULL,
/* updateDepgraph */ updateDepgraph,
+ /* updateDepsgraph */ updateDepsgraph,
/* dependsOnTime */ dependsOnTime,
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ NULL,