diff options
7 files changed, 64 insertions, 6 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index a94efa31b4c..ebc61b16e97 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -201,6 +201,11 @@ void BKE_object_eval_uber_data(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); +void BKE_object_eval_cloth(struct EvaluationContext *eval_ctx, + struct Scene *scene, + struct Object *object); + + void BKE_object_handle_data_update(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c index 8345f1a4c4a..c85a91cad68 100644 --- a/source/blender/blenkernel/intern/object_update.c +++ b/source/blender/blenkernel/intern/object_update.c @@ -55,6 +55,7 @@ #include "BKE_editmesh.h" #include "BKE_object.h" #include "BKE_particle.h" +#include "BKE_pointcache.h" #include "BKE_scene.h" #include "BKE_material.h" #include "BKE_image.h" @@ -348,3 +349,9 @@ void BKE_object_eval_uber_data(EvaluationContext *eval_ctx, ob->recalc &= ~(OB_RECALC_DATA | OB_RECALC_TIME); } + +void BKE_object_eval_cloth(EvaluationContext *UNUSED(eval_ctx), Scene *scene, Object *object) +{ + DEBUG_PRINT("%s on %s\n", __func__, object->id.name); + BKE_ptcache_object_reset(scene, object, PTCACHE_RESET_DEPSGRAPH); +} diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index df6fc18c7eb..4c84ac417ef 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -735,7 +735,8 @@ void DepsgraphNodeBuilder::build_particles(Scene *scene, Object *ob) */ /* component for all particle systems */ - ComponentDepsNode *psys_comp = add_component_node(&ob->id, DEPSNODE_TYPE_EVAL_PARTICLES); + ComponentDepsNode *psys_comp = + add_component_node(&ob->id, DEPSNODE_TYPE_EVAL_PARTICLES); /* particle systems */ LINKLIST_FOREACH (ParticleSystem *, psys, &ob->particlesystem) { @@ -748,11 +749,12 @@ void DepsgraphNodeBuilder::build_particles(Scene *scene, Object *ob) /* this particle system */ // TODO: for now, this will just be a placeholder "ubereval" node add_operation_node(psys_comp, - DEPSOP_TYPE_EXEC, function_bind(BKE_particle_system_eval, - _1, - scene, - ob, - psys), + DEPSOP_TYPE_EXEC, + function_bind(BKE_particle_system_eval, + _1, + scene, + ob, + psys), DEG_OPCODE_PSYS_EVAL, psys->name); } @@ -761,6 +763,20 @@ void DepsgraphNodeBuilder::build_particles(Scene *scene, Object *ob) // TODO... } +void DepsgraphNodeBuilder::build_cloth(Scene *scene, Object *object) +{ + ComponentDepsNode *cache_comp = add_component_node(&object->id, + DEPSNODE_TYPE_CACHE); + add_operation_node(cache_comp, + DEPSOP_TYPE_EXEC, + function_bind(BKE_object_eval_cloth, + _1, + scene, + object), + DEG_OPCODE_PLACEHOLDER, + "Cloth Modifier"); +} + /* Shapekeys */ void DepsgraphNodeBuilder::build_shapekeys(Key *key) { @@ -822,6 +838,9 @@ void DepsgraphNodeBuilder::build_obdata_geom(Scene *scene, Object *ob) md), DEG_OPCODE_GEOMETRY_MODIFIER, md->name); + if (md->type == eModifierType_Cloth) { + build_cloth(scene, ob); + } } /* materials */ diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index 2f3f733b8db..c9d1d7dd0f8 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -132,6 +132,7 @@ struct DepsgraphNodeBuilder { void build_pose_constraints(Object *ob, bPoseChannel *pchan); void build_rigidbody(Scene *scene); void build_particles(Scene *scene, Object *ob); + void build_cloth(Scene *scene, Object *object); void build_animdata(ID *id); OperationDepsNode *build_driver(ID *id, FCurve *fcurve); void build_ik_pose(Scene *scene, diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 6d4597fed9d..9ac656fbe26 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -1312,6 +1312,25 @@ void DepsgraphRelationBuilder::build_particles(Scene *scene, Object *ob) // TODO... } +void DepsgraphRelationBuilder::build_cloth(Scene * /*scene*/, + Object *object, + ModifierData *md) +{ + OperationKey cache_key(&object->id, + DEPSNODE_TYPE_CACHE, + DEG_OPCODE_PLACEHOLDER, + "Cloth Modifier"); + /* Cache component affects on modifier. */ + OperationKey modifier_key(&object->id, + DEPSNODE_TYPE_GEOMETRY, + DEG_OPCODE_GEOMETRY_MODIFIER, + md->name); + add_relation(cache_key, + modifier_key, + DEPSREL_TYPE_TIME, + "Cloth Cache -> Cloth"); +} + /* Shapekeys */ void DepsgraphRelationBuilder::build_shapekeys(ID *obdata, Key *key) { @@ -1413,6 +1432,10 @@ void DepsgraphRelationBuilder::build_obdata_geom(Main *bmain, Scene *scene, Obje } } + if (md->type == eModifierType_Cloth) { + build_cloth(scene, ob, md); + } + prev_mod_key = mod_key; } } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h index 2e6fa7b5801..07700b5c267 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h @@ -58,6 +58,7 @@ struct Main; struct Mask; struct Material; struct MTex; +struct ModifierData; struct MovieClip; struct bNodeTree; struct Object; @@ -205,6 +206,7 @@ struct DepsgraphRelationBuilder void build_world(World *world); void build_rigidbody(Scene *scene); void build_particles(Scene *scene, Object *ob); + void build_cloth(Scene *scene, Object *object, ModifierData *md); void build_ik_pose(Object *ob, bPoseChannel *pchan, bConstraint *con, diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index b3ef990d704..09869664d62 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -310,6 +310,7 @@ int WM_operator_confirm(struct bContext *C, struct wmOperator *op, const struct struct MenuType *WM_menutype_find(const char *idname, bool quiet) RET_NULL void WM_operator_stack_clear(struct wmWindowManager *wm) RET_NONE void WM_operator_handlers_clear(wmWindowManager *wm, struct wmOperatorType *ot) RET_NONE +bool WM_operator_is_repeat(const struct bContext *C, const struct wmOperator *op) RET_ZERO; void WM_autosave_init(wmWindowManager *wm) RET_NONE void WM_jobs_kill_all_except(struct wmWindowManager *wm, void *owner) RET_NONE |