| 602 | //----------------------------------------------------------------------------- |
| 603 | |
| 604 | void SceneObject::setHidden( bool hidden ) |
| 605 | { |
| 606 | if( hidden != isHidden() ) |
| 607 | { |
| 608 | // Add/remove the object from the scene. Removing it |
| 609 | // will also cause the NetObject to go out of scope since |
| 610 | // the container query will not find it anymore. However, |
| 611 | // ScopeAlways objects need to be treated separately as we |
| 612 | // do next. |
| 613 | |
| 614 | if( !hidden ) |
| 615 | addToScene(); |
| 616 | else |
| 617 | removeFromScene(); |
| 618 | |
| 619 | // ScopeAlways objects stay in scope no matter what, i.e. even |
| 620 | // if they aren't in the scene query anymore. So, to force ghosts |
| 621 | // to go away, we need to clear ScopeAlways while we are hidden. |
| 622 | |
| 623 | if( hidden && mIsScopeAlways ) |
| 624 | clearScopeAlways(); |
| 625 | else if( !hidden && mIsScopeAlways ) |
| 626 | setScopeAlways(); |
| 627 | |
| 628 | Parent::setHidden( hidden ); |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | //----------------------------------------------------------------------------- |
| 633 | |