forked from 0ad/0ad
Update the animation immediately after a varaint is changed, so we don't have sliding issues when we do so.
Differential Revision: https://code.wildfiregames.com/D1322 Reviewed By: temple This was SVN commit r21335.
This commit is contained in:
parent
7908045272
commit
c0349931c0
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2016 Wildfire Games.
|
||||
/* Copyright (C) 2018 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -85,6 +85,12 @@ void CUnitAnimation::AddModel(CModel* model, const CObjectEntry* object)
|
||||
}
|
||||
}
|
||||
|
||||
void CUnitAnimation::ReloadAnimation()
|
||||
{
|
||||
UpdateAnimationID();
|
||||
ReloadUnit(m_Model, m_Object);
|
||||
}
|
||||
|
||||
void CUnitAnimation::ReloadUnit(CModel* model, const CObjectEntry* object)
|
||||
{
|
||||
m_Model = model;
|
||||
@ -108,9 +114,7 @@ void CUnitAnimation::SetAnimationState(const CStr& name, bool once, float speed,
|
||||
if (name != m_State)
|
||||
{
|
||||
m_State = name;
|
||||
UpdateAnimationID();
|
||||
|
||||
ReloadUnit(m_Model, m_Object);
|
||||
ReloadAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2016 Wildfire Games.
|
||||
/* Copyright (C) 2018 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -91,6 +91,11 @@ public:
|
||||
*/
|
||||
void ReloadUnit(CModel* model, const CObjectEntry* object);
|
||||
|
||||
/**
|
||||
* Reload animation so any changes take immediate effect.
|
||||
*/
|
||||
void ReloadAnimation();
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2017 Wildfire Games.
|
||||
/* Copyright (C) 2018 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -418,10 +418,17 @@ public:
|
||||
|
||||
virtual void SetVariant(const CStr& key, const CStr& selection)
|
||||
{
|
||||
if (m_VariantSelections[key] == selection)
|
||||
return;
|
||||
|
||||
m_VariantSelections[key] = selection;
|
||||
|
||||
if (m_Unit)
|
||||
{
|
||||
m_Unit->SetEntitySelection(key, selection);
|
||||
if (m_Unit->GetAnimation())
|
||||
m_Unit->GetAnimation()->ReloadAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
virtual std::string GetAnimationName() const
|
||||
|
Loading…
Reference in New Issue
Block a user