diff options
Diffstat (limited to 'source/blender/modifiers/intern/MOD_particleinstance.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_particleinstance.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c index 853790e7eb9..218a74ec9fb 100644 --- a/source/blender/modifiers/intern/MOD_particleinstance.c +++ b/source/blender/modifiers/intern/MOD_particleinstance.c @@ -52,7 +52,7 @@ #include "BKE_pointcache.h" #include "depsgraph_private.h" - +#include "DEG_depsgraph_build.h" static void initData(ModifierData *md) { @@ -117,6 +117,7 @@ static bool isDisabled(ModifierData *md, int useRenderParams) static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Main *UNUSED(bmain), struct Scene *UNUSED(scene), Object *UNUSED(ob), DagNode *obNode) @@ -132,6 +133,18 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, } } +static void updateDepsgraph(ModifierData *md, + struct Main *UNUSED(bmain), + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + struct DepsNodeHandle *node) +{ + ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData *) md; + if (pimd->ob != NULL) { + DEG_add_object_relation(node, pimd->ob, DEG_OB_COMP_TRANSFORM, "Particle Instance Modifier"); + } +} + static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk, void *userData) { @@ -399,6 +412,15 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* to quaternion */ mat3_to_quat(frame, mat); + if (pimd->rotation > 0.0f || pimd->random_rotation > 0.0f) { + float angle = 2.0f*M_PI * (pimd->rotation + pimd->random_rotation * (psys_frand(psys, 19957323 + p) - 0.5f)); + float eul[3] = { 0.0f, 0.0f, angle }; + float rot[4]; + + eul_to_quat(rot, eul); + mul_qt_qtqt(frame, frame, rot); + } + /* note: direction is same as normal vector currently, * but best to keep this separate so the frame can be * rotated later if necessary @@ -506,6 +528,7 @@ ModifierTypeInfo modifierType_ParticleInstance = { /* freeData */ NULL, /* isDisabled */ isDisabled, /* updateDepgraph */ updateDepgraph, + /* updateDepsgraph */ updateDepsgraph, /* dependsOnTime */ NULL, /* dependsOnNormals */ NULL, /* foreachObjectLink */ foreachObjectLink, |