mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-03 18:15:35 +00:00
Create three bone groups
This still won't work as expected. Currently there is only one priority level, and only one animation state per priority level can be active at a time. It's close, though.
This commit is contained in:
parent
abc676eedd
commit
6605aa7dec
2 changed files with 29 additions and 12 deletions
|
@ -145,17 +145,24 @@ void Animation::setRenderProperties(const NifOgre::ObjectList &objlist, Ogre::ui
|
|||
|
||||
size_t Animation::detectAnimGroup(const Ogre::Node *node)
|
||||
{
|
||||
static const char sGroupRoots[sNumGroups][32] = {
|
||||
"", /* Lower body / character root */
|
||||
"Bip01 Spine1", /* Upper body */
|
||||
"Bip01 L Clavicle", /* Left arm */
|
||||
};
|
||||
|
||||
while(node)
|
||||
{
|
||||
#if 0
|
||||
const Ogre::String &name = node->getName();
|
||||
if(name == "Bip01 L Clavicle")
|
||||
return 2;
|
||||
if(name == "Bip01 Spine1")
|
||||
return 1;
|
||||
#endif
|
||||
for(size_t i = 1;i < sNumGroups;i++)
|
||||
{
|
||||
if(name == sGroupRoots[i])
|
||||
return i;
|
||||
}
|
||||
|
||||
node = node->getParent();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -482,14 +489,21 @@ bool Animation::play(const std::string &groupname, Priority priority, int groups
|
|||
if(groupname.empty())
|
||||
return resetActiveGroups();
|
||||
|
||||
AnimStateMap::iterator stateiter = mStates.find(groupname);
|
||||
AnimStateMap::iterator stateiter = mStates.begin();
|
||||
while(stateiter != mStates.end())
|
||||
{
|
||||
if(stateiter->second.mPriority == priority)
|
||||
mStates.erase(stateiter++);
|
||||
else
|
||||
stateiter++;
|
||||
}
|
||||
|
||||
stateiter = mStates.find(groupname);
|
||||
if(stateiter != mStates.end())
|
||||
{
|
||||
stateiter->second.mPriority = priority;
|
||||
return resetActiveGroups();
|
||||
}
|
||||
// HACK: Don't clear all active animations
|
||||
mStates.clear();
|
||||
|
||||
/* Look in reverse; last-inserted source has priority. */
|
||||
AnimSourceList::reverse_iterator iter(mAnimSources.rbegin());
|
||||
|
|
|
@ -23,12 +23,15 @@ public:
|
|||
};
|
||||
|
||||
enum Group {
|
||||
Group_Default = 1<<0,
|
||||
Group_All = Group_Default
|
||||
Group_LowerBody = 1<<0,
|
||||
Group_UpperBody = 1<<1,
|
||||
Group_LeftArm = 1<<2,
|
||||
|
||||
Group_All = Group_LowerBody | Group_UpperBody | Group_LeftArm
|
||||
};
|
||||
|
||||
protected:
|
||||
static const size_t sNumGroups = 1;
|
||||
static const size_t sNumGroups = 3;
|
||||
|
||||
class AnimationValue : public Ogre::ControllerValue<Ogre::Real>
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue