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:
authorMiika Hamalainen <blender@miikah.org>2011-12-05 17:36:41 +0400
committerMiika Hamalainen <blender@miikah.org>2011-12-05 17:36:41 +0400
commitc9eb206c060b3f2221b223b5cb0730e055c04bab (patch)
treefc1bcb466c3e66e5b807573e6c91db9d536ef1b5 /source/blender/blenkernel/intern/dynamicpaint.c
parent45c1ccd65b279653f3cb0c2394fefb27efa1952d (diff)
Fix: Dynamic Paint sub-steps didn't work for constraint controlled brush objects.
Diffstat (limited to 'source/blender/blenkernel/intern/dynamicpaint.c')
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 59139886fe6..b592e078db3 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -24,6 +24,7 @@
#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
+#include "DNA_constraint_types.h"
#include "DNA_dynamicpaint_types.h"
#include "DNA_group_types.h" /*GroupObject*/
#include "DNA_material_types.h"
@@ -39,6 +40,7 @@
#include "BKE_bvhutils.h" /* bvh tree */
#include "BKE_blender.h"
#include "BKE_cdderivedmesh.h"
+#include "BKE_constraint.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_colortools.h"
@@ -453,15 +455,35 @@ static void object_cacheIgnoreClear(Object *ob, int state)
static void subframe_updateObject(Scene *scene, Object *ob, int flags, float frame)
{
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint);
+ bConstraint *con;
/* if other is dynamic paint canvas, dont update */
if (pmd && pmd->canvas)
return;
- /* if object has parent, update it too */
- if ((flags & UPDATE_PARENTS) && ob->parent) subframe_updateObject(scene, ob->parent, 0, frame);
- if ((flags & UPDATE_PARENTS) && ob->track) subframe_updateObject(scene, ob->track, 0, frame);
-
+ /* if object has parents, update them too */
+ if (flags & UPDATE_PARENTS) {
+ if (ob->parent) subframe_updateObject(scene, ob->parent, 0, frame);
+ if (ob->track) subframe_updateObject(scene, ob->track, 0, frame);
+
+ /* also update constraint targets */
+ for (con = ob->constraints.first; con; con=con->next) {
+ bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
+ ListBase targets = {NULL, NULL};
+
+ if (cti && cti->get_constraint_targets) {
+ bConstraintTarget *ct;
+ cti->get_constraint_targets(con, &targets);
+ for (ct= targets.first; ct; ct= ct->next) {
+ if (ct->tar)
+ subframe_updateObject(scene, ct->tar, 0, frame);
+ }
+ /* free temp targets */
+ if (cti->flush_constraint_targets)
+ cti->flush_constraint_targets(con, &targets, 0);
+ }
+ }
+ }
/* for curve following objects, parented curve has to be updated too */
if(ob->type==OB_CURVE) {
Curve *cu= ob->data;