Readded Objects::updatePtr

c++11
scrawl 10 years ago
parent bc237ee1fe
commit b7258c8d23

@ -274,7 +274,7 @@ public:
void removeEffect (int effectId);
void getLoopingEffects (std::vector<int>& out);
void updatePtr(const MWWorld::Ptr &ptr);
virtual void updatePtr(const MWWorld::Ptr &ptr);
bool hasAnimation(const std::string &anim);

@ -76,6 +76,11 @@ HeadAnimationTime::HeadAnimationTime(MWWorld::Ptr reference)
resetBlinkTimer();
}
void HeadAnimationTime::updatePtr(const MWWorld::Ptr &updated)
{
mReference = updated;
}
void HeadAnimationTime::setEnabled(bool enabled)
{
mEnabled = enabled;
@ -901,6 +906,12 @@ void NpcAnimation::setVampire(bool vampire)
}
}
void NpcAnimation::updatePtr(const MWWorld::Ptr &updated)
{
Animation::updatePtr(updated);
mHeadAnimationTime->updatePtr(updated);
}
/*
void NpcAnimation::setHeadPitch(Ogre::Radian pitch)
{

@ -34,6 +34,8 @@ private:
public:
HeadAnimationTime(MWWorld::Ptr reference);
void updatePtr(const MWWorld::Ptr& updated);
void update(float dt);
void setEnabled(bool enabled);
@ -176,6 +178,8 @@ public:
virtual void setAlpha(float alpha);
virtual void setVampire(bool vampire);
virtual void updatePtr(const MWWorld::Ptr& updated);
};
}

@ -198,30 +198,33 @@ void Objects::removeCell(const MWWorld::CellStore* store)
}
}
void Objects::updateObjectCell(const MWWorld::Ptr &old, const MWWorld::Ptr &cur)
void Objects::updatePtr(const MWWorld::Ptr &old, const MWWorld::Ptr &cur)
{
/*
Ogre::SceneNode *node;
MWWorld::CellStore *newCell = cur.getCell();
osg::Group* cellnode;
if(mCellSceneNodes.find(newCell) == mCellSceneNodes.end()) {
node = mRootNode->createChildSceneNode();
mCellSceneNodes[newCell] = node;
cellnode = new osg::Group;
mRootNode->addChild(cellnode);
mCellSceneNodes[newCell] = cellnode;
} else {
node = mCellSceneNodes[newCell];
cellnode = mCellSceneNodes[newCell];
}
node->addChild(cur.getRefData().getBaseNode());
osg::Node* objectNode = cur.getRefData().getBaseNode();
if (objectNode->getNumParents())
objectNode->getParent(0)->removeChild(objectNode);
cellnode->addChild(objectNode);
PtrAnimationMap::iterator iter = mObjects.find(old);
if(iter != mObjects.end())
{
ObjectAnimation *anim = iter->second;
Animation *anim = iter->second;
mObjects.erase(iter);
anim->updatePtr(cur);
mObjects[cur] = anim;
}
*/
}
Animation* Objects::getAnimation(const MWWorld::Ptr &ptr)

@ -72,7 +72,7 @@ public:
void removeCell(const MWWorld::CellStore* store);
/// Updates containing cell for object rendering data
void updateObjectCell(const MWWorld::Ptr &old, const MWWorld::Ptr &cur);
void updatePtr(const MWWorld::Ptr &old, const MWWorld::Ptr &cur);
private:
void operator = (const Objects&);

@ -271,6 +271,11 @@ namespace MWRender
ptr.getRefData().getBaseNode()->setScale(scale);
}
void RenderingManager::updatePtr(const MWWorld::Ptr &old, const MWWorld::Ptr &updated)
{
mObjects->updatePtr(old, updated);
}
void RenderingManager::spawnEffect(const std::string &model, const std::string &texture, const osg::Vec3f &worldPosition, float scale)
{
mEffectManager->addEffect(model, texture, worldPosition, scale);

@ -62,6 +62,8 @@ namespace MWRender
void addCell(const MWWorld::CellStore* store);
void removeCell(const MWWorld::CellStore* store);
void updatePtr(const MWWorld::Ptr& old, const MWWorld::Ptr& updated);
// TODO rename to setRotation/setPosition/setScale, along with the World equivalents
void rotateObject(const MWWorld::Ptr& ptr, const osg::Quat& rot);
void moveObject(const MWWorld::Ptr& ptr, const osg::Vec3f& pos);

@ -1181,7 +1181,7 @@ namespace MWWorld
MWWorld::Ptr copy =
ptr.getClass().copyToCell(ptr, *newCell, pos);
//mRendering->updateObjectCell(ptr, copy);
mRendering->updatePtr(ptr, copy);
ptr.getRefData().setBaseNode(NULL);
MWBase::Environment::get().getSoundManager()->updatePtr (ptr, copy);
mPhysics->updatePtr(ptr, copy);

Loading…
Cancel
Save