forked from mirror/openmw-tes3mp
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)
|
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)
|
while(node)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
const Ogre::String &name = node->getName();
|
const Ogre::String &name = node->getName();
|
||||||
if(name == "Bip01 L Clavicle")
|
for(size_t i = 1;i < sNumGroups;i++)
|
||||||
return 2;
|
{
|
||||||
if(name == "Bip01 Spine1")
|
if(name == sGroupRoots[i])
|
||||||
return 1;
|
return i;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
node = node->getParent();
|
node = node->getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,14 +489,21 @@ bool Animation::play(const std::string &groupname, Priority priority, int groups
|
||||||
if(groupname.empty())
|
if(groupname.empty())
|
||||||
return resetActiveGroups();
|
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())
|
if(stateiter != mStates.end())
|
||||||
{
|
{
|
||||||
stateiter->second.mPriority = priority;
|
stateiter->second.mPriority = priority;
|
||||||
return resetActiveGroups();
|
return resetActiveGroups();
|
||||||
}
|
}
|
||||||
// HACK: Don't clear all active animations
|
|
||||||
mStates.clear();
|
|
||||||
|
|
||||||
/* Look in reverse; last-inserted source has priority. */
|
/* Look in reverse; last-inserted source has priority. */
|
||||||
AnimSourceList::reverse_iterator iter(mAnimSources.rbegin());
|
AnimSourceList::reverse_iterator iter(mAnimSources.rbegin());
|
||||||
|
|
|
@ -23,12 +23,15 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Group {
|
enum Group {
|
||||||
Group_Default = 1<<0,
|
Group_LowerBody = 1<<0,
|
||||||
Group_All = Group_Default
|
Group_UpperBody = 1<<1,
|
||||||
|
Group_LeftArm = 1<<2,
|
||||||
|
|
||||||
|
Group_All = Group_LowerBody | Group_UpperBody | Group_LeftArm
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static const size_t sNumGroups = 1;
|
static const size_t sNumGroups = 3;
|
||||||
|
|
||||||
class AnimationValue : public Ogre::ControllerValue<Ogre::Real>
|
class AnimationValue : public Ogre::ControllerValue<Ogre::Real>
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue