mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-08 20:05:19 -04:00
Merge branch 'harvest' into 'master'
Do not recreate animation object when harvesting a plant See merge request OpenMW/openmw!4744
This commit is contained in:
commit
abbbeefdbd
@ -2096,12 +2096,17 @@ namespace MWRender
|
||||
if (Settings::game().mGraphicHerbalism && ptr.getRefData().getCustomData() != nullptr
|
||||
&& ObjectAnimation::canBeHarvested())
|
||||
{
|
||||
const MWWorld::ContainerStore& store = ptr.getClass().getContainerStore(ptr);
|
||||
if (!store.hasVisibleItems())
|
||||
{
|
||||
HarvestVisitor visitor;
|
||||
mObjectRoot->accept(visitor);
|
||||
}
|
||||
harvest(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectAnimation::harvest(const MWWorld::Ptr& ptr)
|
||||
{
|
||||
const MWWorld::ContainerStore& store = ptr.getClass().getContainerStore(ptr);
|
||||
if (!store.hasVisibleItems())
|
||||
{
|
||||
HarvestVisitor visitor;
|
||||
mObjectRoot->accept(visitor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -483,6 +483,7 @@ namespace MWRender
|
||||
|
||||
virtual void setAccurateAiming(bool enabled) {}
|
||||
virtual bool canBeHarvested() const { return false; }
|
||||
virtual void harvest(const MWWorld::Ptr& ptr) {}
|
||||
|
||||
virtual void removeFromScene();
|
||||
|
||||
@ -498,6 +499,7 @@ namespace MWRender
|
||||
bool animated, bool allowLight);
|
||||
|
||||
bool canBeHarvested() const override;
|
||||
void harvest(const MWWorld::Ptr& ptr) override;
|
||||
};
|
||||
|
||||
class UpdateVfxCallback : public SceneUtil::NodeCallback<UpdateVfxCallback>
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
#include "../mwrender/animation.hpp"
|
||||
|
||||
#include "class.hpp"
|
||||
#include "containerstore.hpp"
|
||||
|
||||
@ -89,8 +91,9 @@ namespace MWWorld
|
||||
MWBase::Environment::get().getWindowManager()->messageBox(tooltip);
|
||||
}
|
||||
|
||||
// Update animation object
|
||||
MWBase::Environment::get().getWorld()->disable(target);
|
||||
MWBase::Environment::get().getWorld()->enable(target);
|
||||
auto world = MWBase::Environment::get().getWorld();
|
||||
MWRender::Animation* anim = world->getAnimation(target);
|
||||
if (anim != nullptr)
|
||||
anim->harvest(target);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user