Ejemplo n.º 1
0
void EC_WaterPlane::DetachEntity()
{
    if (!attached_ || entity_ == 0)
        return;

    EC_Placeable* placeable = dynamic_cast<EC_Placeable*>(FindPlaceable().get());
    if (placeable != 0 && !attachedToRoot_)
    {
        Ogre::SceneNode* node = placeable->GetSceneNode();
        node_->detachObject(entity_);
        node->removeChild(node_); 
    }
    else
    {
        // Attached to root.
        // Sanity check..
        if (entity_->isAttached() )
        {
            Ogre::SceneManager* sceneMgr = world_.lock()->GetSceneManager();
            node_->detachObject(entity_);
            sceneMgr->getRootSceneNode()->removeChild(node_);
            attachedToRoot_ = false;
        }
    }

    attached_ = false;
}
Ejemplo n.º 2
0
void Entity::removeFromScene() {
    Ogre::SceneNode *oldParent = mSceneNode->getParentSceneNode();
    if (oldParent) {
        oldParent->removeChild(mSceneNode);
    }
    setStatic(true);
}
Ejemplo n.º 3
0
VOID CFairyObject::SetVisible(BOOL bVisible)
{
	if(m_bVisible == bVisible) return;

	//确认是人物模型
	if(m_pFairyObj->getType() != EOBJ_TYPE_ACTOR) return;
	
	//确认资源已经Load
	Fairy::Actor* pActor = ((Fairy::ActorObject*)m_pFairyObj.get())->getActor();
	if(!pActor) return;

	Ogre::SceneNode* pParentNode = ((Fairy::ActorObject*)m_pFairyObj.get())->getSceneNode();
	Ogre::SceneNode* pActorNode = (((Fairy::ActorObject*)m_pFairyObj.get())->getActor())->getSceneNode();

	if(bVisible)
	{
		pParentNode->addChild(pActorNode);
	}
	else
	{
		pParentNode->removeChild(pActorNode);
	}

	m_bVisible = bVisible;
}
Ejemplo n.º 4
0
void EC_OgreMovableTextOverlay::DetachNode()
{
    if ((node_) && (attached_) && (placeable_))
    {
        Ogre::SceneNode* parent = checked_static_cast<EC_OgrePlaceable*>(placeable_.get())->GetLinkSceneNode();
        parent->removeChild(node_);
        attached_ = false;
    }
}
Ejemplo n.º 5
0
void EC_Mesh::DetachEntity()
{
    if ((!attached_) || (!entity_) || (!placeable_))
        return;
    
    EC_Placeable* placeable = checked_static_cast<EC_Placeable*>(placeable_.get());
    Ogre::SceneNode* node = placeable->GetSceneNode();
    adjustment_node_->detachObject(entity_);
    node->removeChild(adjustment_node_);
    attached_ = false;
}
Ejemplo n.º 6
0
void
RenderingManager::updateObjectCell(const MWWorld::Ptr &old, const MWWorld::Ptr &cur)
{
    Ogre::SceneNode *child =
        mRendering.getScene()->getSceneNode(old.getRefData().getHandle());

    Ogre::SceneNode *parent = child->getParentSceneNode();
    parent->removeChild(child);

    if (old.getClass().isActor()) {
        mActors->updateObjectCell(old, cur);
    } else {
        mObjects->updateObjectCell(old, cur);
    }
}
Ejemplo n.º 7
0
void OGRE3DPointRenderable::removeSceneNode(const Ogre::String& name)
{
 if (mRenderSystem->getSceneManager()->hasSceneNode(name) == false)
  return;

 Ogre::SceneNode* node = mRenderSystem->getSceneManager()->getSceneNode(name);
 Ogre::SceneNode* pnode = node->getParentSceneNode();

 if (pnode == 0)
  return;

 if (pnode == mNode)
  pnode->removeChild(node);

}
Ejemplo n.º 8
0
void OGRE3DPointRenderable::removeSceneNode(Ogre::SceneNode* node)
{

 if (node == 0)
  return;

 Ogre::SceneNode* pnode = node->getParentSceneNode();

 if (pnode == 0)
  return;

 if (pnode == mNode)
  pnode->removeChild(node);

}
Ejemplo n.º 9
0
void Camera::onSetTarget(const GameHandle& target)
{
	//! \hack const offset for camera
	v3 offset(0.0f, 3.0f, -14);

	Ogre::SceneManager* sceneMgr = Ogre::Root::getSingleton().getSceneManager(BFG_SCENEMANAGER);

	if (!sceneMgr->hasSceneNode(stringify(target)))
	{
		errlog << "Target (" << stringify(target) << ") for camera (" << mHandle << ") does not exist!";
		return;
	}

	Ogre::SceneNode* newParent = sceneMgr->getSceneNode(stringify(target));
	Ogre::SceneNode* oldParent = mCameraNode->getParentSceneNode();
	oldParent->removeChild(mCameraNode);
	newParent->addChild(mCameraNode);

	mCameraNode->setPosition(toOgre(offset));
}
Ejemplo n.º 10
0
void NxNode::DetachFromParent()
{
	Ogre::SceneNode * parent = mSceneNode->getParentSceneNode();
	if(parent) parent->removeChild( mSceneNode->getName() );
}