Added: #1469 Factory used in the CCameraAnimationManager class when parsing animations

--HG--
branch : gsoc2012-fabien
hg/feature/gsoc2012-fabien
Fabien_HENON 13 years ago
parent 072d2e0385
commit 0af5c0518b

@ -86,8 +86,19 @@ bool CCameraAnimationManager::parseCameraAnimations(const IPrimitive* prim, cons
prim->getChild(child, 1); prim->getChild(child, 1);
// We tell the factory to load the instructions in function of the type of instruction we have // We tell the factory to load the instructions in function of the type of instruction we have
string stepType;
if (!prim->getPropertyByName("class", stepType))
{
nlwarning("<CCameraAnimationManager parseCameraAnimations> Error while getting the class of a camera animation step in primitive number '%s'", filename.c_str());
continue;
}
ICameraAnimationStep* step = ICameraAnimationStepFactory::parseStep(child, filename, stepType);
// We add the instruction to the list // We add the instruction to the list
if (step)
{
}
} }
// We add the camera animation to the list // We add the camera animation to the list

@ -19,12 +19,12 @@
std::vector<std::pair<std::string, ICameraAnimationStepFactory*> >* ICameraAnimationStepFactory::Entries; std::vector<std::pair<std::string, ICameraAnimationStepFactory*> >* ICameraAnimationStepFactory::Entries;
ICameraAnimationStep* ICameraAnimationStepFactory::parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename, const std::string& name) ICameraAnimationStep* ICameraAnimationStepFactory::parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename, const std::string& stepType)
{ {
// We search the correct step type in our entries // We search the correct step type in our entries
for (uint i = 0; i < Entries->size(); i++) for (uint i = 0; i < Entries->size(); i++)
{ {
if (name == (*Entries)[i].first) if (stepType == (*Entries)[i].first)
{ {
ICameraAnimationStep * ret = (*Entries)[i].second->instanciate(); ICameraAnimationStep * ret = (*Entries)[i].second->instanciate();
if (!ret) if (!ret)

@ -44,7 +44,7 @@ class ICameraAnimationStepFactory
{ {
public: public:
/// Function that will instanciate the correct camera animation step /// Function that will instanciate the correct camera animation step
static ICameraAnimationStep* parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename, const std::string& name); static ICameraAnimationStep* parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename, const std::string& stepType);
protected: protected:
/// Functions used to be able to create the camera animation steps /// Functions used to be able to create the camera animation steps

Loading…
Cancel
Save