Removed AnimationOffset and improved BlendTree

This commit is contained in:
viktorljung
2016-02-29 15:51:37 +01:00
parent 5c3b472a4d
commit 5bc0483f49
10 changed files with 847 additions and 459 deletions
+17 -3
View File
@@ -34,7 +34,16 @@ void AnimationSystem::CreateBlendTrees()
continue;
}
skeleton->BlendTrees[entity] = std::shared_ptr<BlendTree>(new BlendTree(entity, skeleton));
if (entity.HasComponent("Blend") || entity.HasComponent("BlendOverride") ||
entity.HasComponent("BlendAdditive") || entity.HasComponent("Animation"))
{
std::shared_ptr<BlendTree> blendTree = std::shared_ptr<BlendTree>(new BlendTree(entity, skeleton));
if(blendTree->IsValid()) {
skeleton->BlendTrees[entity] = blendTree;
}
}
}
}
@@ -47,11 +56,16 @@ void AnimationSystem::UpdateAnimations(double dt)
for (auto& animationC : *animationComponents) {
EntityWrapper entity = EntityWrapper(m_World, animationC.EntityID);
EntityWrapper parent = entity.FirstParentWithComponent("Model");
EntityWrapper modelEntity;
if(!entity.HasComponent("Model")) {
modelEntity = entity.FirstParentWithComponent("Model");
} else {
modelEntity = entity;
}
Model* model;
try {
model = ResourceManager::Load<::Model, true>(parent["Model"]["Resource"]);
model = ResourceManager::Load<::Model, true>(modelEntity["Model"]["Resource"]);
} catch (const std::exception&) {
return;
}