forked from bartvdbraak/blender
Fix for bug #10475: added more dependencies for physics systems
with deflectors and fields for proper dependency graph updates.
This commit is contained in:
parent
6a97a2ab33
commit
7e93f5569d
@ -346,6 +346,24 @@ static void dag_add_driver_relation(Ipo *ipo, DagForest *dag, DagNode *node, int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void dag_add_collision_field_relation(DagForest *dag, Object *ob, DagNode *node)
|
||||||
|
{
|
||||||
|
Base *base;
|
||||||
|
DagNode *node2;
|
||||||
|
|
||||||
|
// would be nice to have a list of colliders here
|
||||||
|
// so for now walk all objects in scene check 'same layer rule'
|
||||||
|
for(base = G.scene->base.first; base; base= base->next) {
|
||||||
|
if((base->lay & ob->lay) && base->object->pd) {
|
||||||
|
Object *ob1= base->object;
|
||||||
|
if((ob1->pd->deflect || ob1->pd->forcefield) && (ob1 != ob)) {
|
||||||
|
node2 = dag_get_node(dag, ob1);
|
||||||
|
dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Field Collision");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int mask)
|
static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int mask)
|
||||||
{
|
{
|
||||||
bConstraint *con;
|
bConstraint *con;
|
||||||
@ -523,22 +541,9 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* softbody collision */
|
/* softbody collision */
|
||||||
if((ob->type==OB_MESH) || (ob->type==OB_CURVE) || (ob->type==OB_LATTICE)) {
|
if((ob->type==OB_MESH) || (ob->type==OB_CURVE) || (ob->type==OB_LATTICE))
|
||||||
Base *base;
|
if(modifiers_isSoftbodyEnabled(ob) || modifiers_isClothEnabled(ob))
|
||||||
if(modifiers_isSoftbodyEnabled(ob)){
|
dag_add_collision_field_relation(dag, ob, node);
|
||||||
// would be nice to have a list of colliders here
|
|
||||||
// so for now walk all objects in scene check 'same layer rule'
|
|
||||||
for(base = G.scene->base.first; base; base= base->next) {
|
|
||||||
if( (base->lay & ob->lay) && base->object->pd) {
|
|
||||||
Object *ob1= base->object;
|
|
||||||
if((ob1->pd->deflect) && (ob1 != ob)) {
|
|
||||||
node2 = dag_get_node(dag, ob1);
|
|
||||||
dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Softbody Collision");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ob->type==OB_MBALL) {
|
if (ob->type==OB_MBALL) {
|
||||||
Object *mom= find_basis_mball(ob);
|
Object *mom= find_basis_mball(ob);
|
||||||
|
@ -3208,6 +3208,7 @@ static void object_collision__enabletoggle ( void *ob_v, void *arg2 )
|
|||||||
{
|
{
|
||||||
md = modifier_new ( eModifierType_Collision );
|
md = modifier_new ( eModifierType_Collision );
|
||||||
BLI_addtail ( &ob->modifiers, md );
|
BLI_addtail ( &ob->modifiers, md );
|
||||||
|
DAG_scene_sort(G.scene);
|
||||||
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
|
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
|
||||||
allqueue(REDRAWBUTSEDIT, 0);
|
allqueue(REDRAWBUTSEDIT, 0);
|
||||||
allqueue(REDRAWVIEW3D, 0);
|
allqueue(REDRAWVIEW3D, 0);
|
||||||
@ -3215,8 +3216,10 @@ static void object_collision__enabletoggle ( void *ob_v, void *arg2 )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
|
||||||
BLI_remlink ( &ob->modifiers, md );
|
BLI_remlink ( &ob->modifiers, md );
|
||||||
modifier_free ( md );
|
modifier_free ( md );
|
||||||
|
DAG_scene_sort(G.scene);
|
||||||
allqueue(REDRAWBUTSEDIT, 0);
|
allqueue(REDRAWBUTSEDIT, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user