| 532 | } |
| 533 | |
| 534 | void afxConstraintMgr::set_ref_shape(afxConstraintID id, ShapeBase* shape) |
| 535 | { |
| 536 | id.sub_index = 0; |
| 537 | |
| 538 | afxShapeConstraint* shape_cons = dynamic_cast<afxShapeConstraint*>(CONS_BY_ID(id)); |
| 539 | |
| 540 | // need to change type |
| 541 | if (!shape_cons) |
| 542 | { |
| 543 | afxConstraint* cons = CONS_BY_ID(id); |
| 544 | shape_cons = newShapeCons(this, cons->mCons_def.mHistory_time > 0.0f); |
| 545 | shape_cons->mCons_def = cons->mCons_def; |
| 546 | CONS_BY_ID(id) = shape_cons; |
| 547 | delete cons; |
| 548 | } |
| 549 | |
| 550 | // set new shape on root |
| 551 | shape_cons->set(shape); |
| 552 | |
| 553 | // update all subnodes |
| 554 | for (S32 j = 1; j < (*mConstraints_v[id.index]).size(); j++) |
| 555 | { |
| 556 | afxConstraint* cons = CONS_BY_IJ(id.index,j); |
| 557 | if (cons) |
| 558 | { |
| 559 | if (dynamic_cast<afxShapeNodeConstraint*>(cons)) |
| 560 | ((afxShapeNodeConstraint*)cons)->set(shape); |
| 561 | else if (dynamic_cast<afxShapeConstraint*>(cons)) |
| 562 | ((afxShapeConstraint*)cons)->set(shape); |
| 563 | else if (dynamic_cast<afxObjectConstraint*>(cons)) |
| 564 | ((afxObjectConstraint*)cons)->set(shape); |
| 565 | else |
| 566 | cons->unset(); |
| 567 | } |
| 568 | } |
| 569 | } |
| 570 | |
| 571 | void afxConstraintMgr::set_ref_shape(afxConstraintID id, U16 scope_id) |
| 572 | { |
nothing calls this directly
no test coverage detected