mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-03 07:09:40 +00:00
Merge pull request #1704 from akortunov/per_group_animation
[Feedback needed] Support for per-group KF-animation files
This commit is contained in:
commit
6c04cecab1
5 changed files with 63 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
||||||
Bug #4293: Faction members are not aware of faction ownerships in barter
|
Bug #4293: Faction members are not aware of faction ownerships in barter
|
||||||
Bug #4426: RotateWorld behavior is incorrect
|
Bug #4426: RotateWorld behavior is incorrect
|
||||||
Bug #4433: Guard behaviour is incorrect with Alarm = 0
|
Bug #4433: Guard behaviour is incorrect with Alarm = 0
|
||||||
|
Feature #4444: Per-group KF-animation files support
|
||||||
|
|
||||||
0.44.0
|
0.44.0
|
||||||
------
|
------
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
#include <components/sceneutil/skeleton.hpp>
|
#include <components/sceneutil/skeleton.hpp>
|
||||||
#include <components/sceneutil/positionattitudetransform.hpp>
|
#include <components/sceneutil/positionattitudetransform.hpp>
|
||||||
|
|
||||||
|
#include <components/settings/settings.hpp>
|
||||||
|
|
||||||
#include <components/fallback/fallback.hpp>
|
#include <components/fallback/fallback.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
|
@ -466,6 +468,8 @@ namespace MWRender
|
||||||
mAnimationTimePtr[i].reset(new AnimationTime);
|
mAnimationTimePtr[i].reset(new AnimationTime);
|
||||||
|
|
||||||
mLightListCallback = new SceneUtil::LightListCallback;
|
mLightListCallback = new SceneUtil::LightListCallback;
|
||||||
|
|
||||||
|
mUseAdditionalSources = Settings::Manager::getBool ("use additional anim sources", "Game");
|
||||||
}
|
}
|
||||||
|
|
||||||
Animation::~Animation()
|
Animation::~Animation()
|
||||||
|
@ -536,6 +540,35 @@ namespace MWRender
|
||||||
return mKeyframes->mTextKeys;
|
return mKeyframes->mTextKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Animation::loadAllAnimationsInFolder(const std::string &model, const std::string &baseModel)
|
||||||
|
{
|
||||||
|
const std::map<std::string, VFS::File*>& index = mResourceSystem->getVFS()->getIndex();
|
||||||
|
|
||||||
|
std::string animationPath = model;
|
||||||
|
if (animationPath.find("meshes") == 0)
|
||||||
|
{
|
||||||
|
animationPath.replace(0, 6, "animations");
|
||||||
|
}
|
||||||
|
animationPath.replace(animationPath.size()-3, 3, "/");
|
||||||
|
|
||||||
|
mResourceSystem->getVFS()->normalizeFilename(animationPath);
|
||||||
|
|
||||||
|
std::map<std::string, VFS::File*>::const_iterator found = index.lower_bound(animationPath);
|
||||||
|
while (found != index.end())
|
||||||
|
{
|
||||||
|
const std::string& name = found->first;
|
||||||
|
if (name.size() >= animationPath.size() && name.substr(0, animationPath.size()) == animationPath)
|
||||||
|
{
|
||||||
|
size_t pos = name.find_last_of('.');
|
||||||
|
if (pos != std::string::npos && name.compare(pos, name.size()-pos, ".kf") == 0)
|
||||||
|
addSingleAnimSource(name, baseModel);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
++found;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Animation::addAnimSource(const std::string &model, const std::string& baseModel)
|
void Animation::addAnimSource(const std::string &model, const std::string& baseModel)
|
||||||
{
|
{
|
||||||
std::string kfname = model;
|
std::string kfname = model;
|
||||||
|
@ -546,6 +579,14 @@ namespace MWRender
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
addSingleAnimSource(kfname, baseModel);
|
||||||
|
|
||||||
|
if (mUseAdditionalSources)
|
||||||
|
loadAllAnimationsInFolder(kfname, baseModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Animation::addSingleAnimSource(const std::string &kfname, const std::string& baseModel)
|
||||||
|
{
|
||||||
if(!mResourceSystem->getVFS()->exists(kfname))
|
if(!mResourceSystem->getVFS()->exists(kfname))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -275,6 +275,8 @@ protected:
|
||||||
|
|
||||||
osg::ref_ptr<SceneUtil::LightListCallback> mLightListCallback;
|
osg::ref_ptr<SceneUtil::LightListCallback> mLightListCallback;
|
||||||
|
|
||||||
|
bool mUseAdditionalSources;
|
||||||
|
|
||||||
const NodeMap& getNodeMap() const;
|
const NodeMap& getNodeMap() const;
|
||||||
|
|
||||||
/* Sets the appropriate animations on the bone groups based on priority.
|
/* Sets the appropriate animations on the bone groups based on priority.
|
||||||
|
@ -309,12 +311,15 @@ protected:
|
||||||
*/
|
*/
|
||||||
void setObjectRoot(const std::string &model, bool forceskeleton, bool baseonly, bool isCreature);
|
void setObjectRoot(const std::string &model, bool forceskeleton, bool baseonly, bool isCreature);
|
||||||
|
|
||||||
|
void loadAllAnimationsInFolder(const std::string &model, const std::string &baseModel);
|
||||||
|
|
||||||
/** Adds the keyframe controllers in the specified model as a new animation source.
|
/** Adds the keyframe controllers in the specified model as a new animation source.
|
||||||
* @note Later added animation sources have the highest priority when it comes to finding a particular animation.
|
* @note Later added animation sources have the highest priority when it comes to finding a particular animation.
|
||||||
* @param model The file to add the keyframes for. Note that the .nif file extension will be replaced with .kf.
|
* @param model The file to add the keyframes for. Note that the .nif file extension will be replaced with .kf.
|
||||||
* @param baseModel The filename of the mObjectRoot, only used for error messages.
|
* @param baseModel The filename of the mObjectRoot, only used for error messages.
|
||||||
*/
|
*/
|
||||||
void addAnimSource(const std::string &model, const std::string& baseModel);
|
void addAnimSource(const std::string &model, const std::string& baseModel);
|
||||||
|
void addSingleAnimSource(const std::string &model, const std::string& baseModel);
|
||||||
|
|
||||||
/** Adds an additional light to the given node using the specified ESM record. */
|
/** Adds an additional light to the given node using the specified ESM record. */
|
||||||
void addExtraLight(osg::ref_ptr<osg::Group> parent, const ESM::Light *light);
|
void addExtraLight(osg::ref_ptr<osg::Group> parent, const ESM::Light *light);
|
||||||
|
|
|
@ -157,3 +157,16 @@ Otherwise they wait for the enemies or the player to do an attack first.
|
||||||
Please note this setting has not been extensively tested and could have side effects with certain quests.
|
Please note this setting has not been extensively tested and could have side effects with certain quests.
|
||||||
|
|
||||||
This setting can only be configured by editing the settings configuration file.
|
This setting can only be configured by editing the settings configuration file.
|
||||||
|
|
||||||
|
use additional anim sources
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
:Type: boolean
|
||||||
|
:Range: True/False
|
||||||
|
:Default: False
|
||||||
|
|
||||||
|
Allow to load additional animation sources when enabled.
|
||||||
|
For example, if the main animation mesh has name Meshes/x.nif, an engine will load all KF-files from Animations/x folder and its child folders.
|
||||||
|
Can be useful if you want to use several animation replacers without merging them.
|
||||||
|
Attention: animations from AnimKit have own format and are not supposed to be directly loaded in-game!
|
||||||
|
This setting can only be configured by editing the settings configuration file.
|
||||||
|
|
|
@ -219,6 +219,9 @@ can loot during death animation = true
|
||||||
# Makes the value of filled soul gems dependent only on soul magnitude (with formula from the Morrowind Code Patch)
|
# Makes the value of filled soul gems dependent only on soul magnitude (with formula from the Morrowind Code Patch)
|
||||||
rebalance soul gem values = false
|
rebalance soul gem values = false
|
||||||
|
|
||||||
|
# Allow to load per-group KF-files from Animations folder
|
||||||
|
use additional anim sources = false
|
||||||
|
|
||||||
[General]
|
[General]
|
||||||
|
|
||||||
# Anisotropy reduces distortion in textures at low angles (e.g. 0 to 16).
|
# Anisotropy reduces distortion in textures at low angles (e.g. 0 to 16).
|
||||||
|
|
Loading…
Reference in a new issue