mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-09 20:35:48 -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
@ -2095,6 +2095,12 @@ namespace MWRender
|
|||||||
|
|
||||||
if (Settings::game().mGraphicHerbalism && ptr.getRefData().getCustomData() != nullptr
|
if (Settings::game().mGraphicHerbalism && ptr.getRefData().getCustomData() != nullptr
|
||||||
&& ObjectAnimation::canBeHarvested())
|
&& ObjectAnimation::canBeHarvested())
|
||||||
|
{
|
||||||
|
harvest(ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectAnimation::harvest(const MWWorld::Ptr& ptr)
|
||||||
{
|
{
|
||||||
const MWWorld::ContainerStore& store = ptr.getClass().getContainerStore(ptr);
|
const MWWorld::ContainerStore& store = ptr.getClass().getContainerStore(ptr);
|
||||||
if (!store.hasVisibleItems())
|
if (!store.hasVisibleItems())
|
||||||
@ -2103,7 +2109,6 @@ namespace MWRender
|
|||||||
mObjectRoot->accept(visitor);
|
mObjectRoot->accept(visitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool ObjectAnimation::canBeHarvested() const
|
bool ObjectAnimation::canBeHarvested() const
|
||||||
{
|
{
|
||||||
|
@ -483,6 +483,7 @@ namespace MWRender
|
|||||||
|
|
||||||
virtual void setAccurateAiming(bool enabled) {}
|
virtual void setAccurateAiming(bool enabled) {}
|
||||||
virtual bool canBeHarvested() const { return false; }
|
virtual bool canBeHarvested() const { return false; }
|
||||||
|
virtual void harvest(const MWWorld::Ptr& ptr) {}
|
||||||
|
|
||||||
virtual void removeFromScene();
|
virtual void removeFromScene();
|
||||||
|
|
||||||
@ -498,6 +499,7 @@ namespace MWRender
|
|||||||
bool animated, bool allowLight);
|
bool animated, bool allowLight);
|
||||||
|
|
||||||
bool canBeHarvested() const override;
|
bool canBeHarvested() const override;
|
||||||
|
void harvest(const MWWorld::Ptr& ptr) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class UpdateVfxCallback : public SceneUtil::NodeCallback<UpdateVfxCallback>
|
class UpdateVfxCallback : public SceneUtil::NodeCallback<UpdateVfxCallback>
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
|
|
||||||
|
#include "../mwrender/animation.hpp"
|
||||||
|
|
||||||
#include "class.hpp"
|
#include "class.hpp"
|
||||||
#include "containerstore.hpp"
|
#include "containerstore.hpp"
|
||||||
|
|
||||||
@ -89,8 +91,9 @@ namespace MWWorld
|
|||||||
MWBase::Environment::get().getWindowManager()->messageBox(tooltip);
|
MWBase::Environment::get().getWindowManager()->messageBox(tooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update animation object
|
auto world = MWBase::Environment::get().getWorld();
|
||||||
MWBase::Environment::get().getWorld()->disable(target);
|
MWRender::Animation* anim = world->getAnimation(target);
|
||||||
MWBase::Environment::get().getWorld()->enable(target);
|
if (anim != nullptr)
|
||||||
|
anim->harvest(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user