Fix(CS): Scale actors according to their race's stats

BindlessTest
Dave Corley 4 months ago
parent 5271241ea6
commit b31664a78f

@ -133,6 +133,7 @@
Bug #7724: Guards don't help vs werewolves
Bug #7733: Launcher shows incorrect data paths when there's two plugins with the same name
Bug #7742: Governing attribute training limit should use the modified attribute
Bug #7753: Editor: Actors Don't Scale According to Their Race
Bug #7758: Water walking is not taken into account to compute path cost on the water
Bug #7761: Rain and ambient loop sounds are mutually exclusive
Bug #7765: OpenMW-CS: Touch Record option is broken

@ -163,6 +163,11 @@ namespace CSMWorld
return it->second.first;
}
const ESM::RefId& ActorAdapter::ActorData::getActorRaceName() const
{
return mRaceData->getId();
}
bool ActorAdapter::ActorData::hasDependency(const ESM::RefId& id) const
{
return mDependencies.find(id) != mDependencies.end();

@ -96,6 +96,8 @@ namespace CSMWorld
std::string getSkeleton() const;
/// Retrieves the associated actor part
ESM::RefId getPart(ESM::PartReferenceType index) const;
const ESM::RefId& getActorRaceName() const;
/// Checks if the actor has a data dependency
bool hasDependency(const ESM::RefId& id) const;

@ -7,6 +7,7 @@
#include <osg/Group>
#include <osg/MatrixTransform>
#include <osg/Node>
#include <osg/Vec3d>
#include <apps/opencs/model/world/actoradapter.hpp>
#include <apps/opencs/model/world/idcollection.hpp>
@ -20,6 +21,7 @@
#include <components/sceneutil/attach.hpp>
#include <components/sceneutil/skeleton.hpp>
#include "../../model/world/columns.hpp"
#include "../../model/world/data.hpp"
namespace CSVRender
@ -29,7 +31,7 @@ namespace CSVRender
Actor::Actor(const ESM::RefId& id, CSMWorld::Data& data)
: mId(id)
, mData(data)
, mBaseNode(new osg::Group())
, mBaseNode(new osg::PositionAttitudeTransform())
, mSkeleton(nullptr)
{
mActorData = mData.getActorAdapter()->getActorData(mId);
@ -60,6 +62,16 @@ namespace CSVRender
// Attach parts to skeleton
loadBodyParts();
const CSMWorld::IdCollection<ESM::Race>& races = mData.getRaces();
const auto& targetRace = races.getRecord(mActorData->getActorRaceName()).get().mData;
osg::Vec3d scale;
mActorData.get()->isFemale()
? scale = osg::Vec3(targetRace.mFemaleWeight, targetRace.mFemaleWeight, targetRace.mFemaleHeight)
: scale = osg::Vec3(targetRace.mMaleWeight, targetRace.mMaleWeight, targetRace.mMaleHeight);
mBaseNode->setScale(scale);
}
else
{

@ -5,6 +5,7 @@
#include <string_view>
#include <osg/Group>
#include <osg/PositionAttitudeTransform>
#include <osg/ref_ptr>
#include <QObject>
@ -59,7 +60,7 @@ namespace CSVRender
CSMWorld::Data& mData;
CSMWorld::ActorAdapter::ActorDataPtr mActorData;
osg::ref_ptr<osg::Group> mBaseNode;
osg::ref_ptr<osg::PositionAttitudeTransform> mBaseNode;
SceneUtil::Skeleton* mSkeleton;
SceneUtil::NodeMapVisitor::NodeMap mNodeMap;
};

Loading…
Cancel
Save