Animation layering

Everything about development and the OpenMW source code.
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Animation layering

Post by jhooks1 » 13 May 2013, 14:20

Is the old weapon being removed with removeIndividualPart()?

User avatar
raevol
Posts: 3076
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: Animation layering

Post by raevol » 13 May 2013, 17:42

Chris wrote:Have a treat.
You, my friend, are awesome. 8-)

LizTail
Posts: 27
Joined: 31 Oct 2012, 21:50

Re: Animation layering

Post by LizTail » 13 May 2013, 19:24

Chris wrote:Have a treat.
Congrats! Looks good!

Glorfdev
Posts: 77
Joined: 02 Mar 2013, 19:55
Location: Poznań, Poland

Re: Animation layering

Post by Glorfdev » 13 May 2013, 19:41

Amazing work!

Chris
Posts: 1579
Joined: 04 Sep 2011, 08:33

Re: Animation layering

Post by Chris » 14 May 2013, 01:50

jhooks1 wrote:Is the old weapon being removed with removeIndividualPart()?
It should be. The weapon is added with

Code: Select all

addOrReplaceIndividualPart(ESM::PRT_Weapon, MWWorld::InventoryStore::Slot_CarriedRight, 1, mesh);
and then in updateParts is removed with

Code: Select all

removePartGroup(slotlist[i].mSlot);
(where mSlot is MWWorld::InventoryStore::Slot_CarriedRight) which calls removeIndividualPart.

jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Animation layering

Post by jhooks1 » 14 May 2013, 20:53

Not sure what is wrong then. The algorithm looks very different than what I originally committed. Might want to add a remove in showWeapons() before the addOrReplace()

removePartGroup(slotlist.mSlot); could be placed in the forceupdate loop (you would have to get rid of the break statement though). Only the part groups that have changed need to be removed. That is how it was originally (more efficient I think, rather than removing slots that have not changed). Did you guys run into problems with the original approach? I made the updateParts() function priority based so you would not have to remove every part group.

Layering looks great though :)

EDIT:
I would do this

Code: Select all

void NpcAnimation::showWeapons(bool showWeapon)
{
    mShowWeapons = showWeapon;
    removeIndividualPart(ESM::PRT_Weapon);
    if(showWeapon)
    {
        MWWorld::InventoryStore &inv = MWWorld::Class::get(mPtr).getInventoryStore(mPtr);
        mWeapon = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
        if(mWeapon != inv.end()) // special case for weapons
        {
            std::string mesh = MWWorld::Class::get(*mWeapon).getModel(*mWeapon);
            addOrReplaceIndividualPart(ESM::PRT_Weapon, MWWorld::InventoryStore::Slot_CarriedRight, 1, mesh);
        }
    }
}
Again, I don't know if it will help anything.

EDIT2: Not sure why priority is based on number of reserved slots either. Originally it was - 5 for Robes, 4 for Skirts, 3 for Armor, 2 for other clothing, and 1 for skin.

Post Reply