diff --git a/changes.txt b/changes.txt index 2f5840a4..72a357b3 100644 --- a/changes.txt +++ b/changes.txt @@ -1,5 +1,7 @@ Changes in 1.8 (??.??.2011) + - Added ISceneManager::createSceneNodeAnimator to create animators by name + - The Makefile now creates a symlink from the soname to the binary name during install. Binary compatibility is only confirmed between minor releases, so the only useful symlink is from libIrrlicht.so.1.8 to libIrrlicht.so.1.8.0; others should rightly fail. - Added SMF mesh loader, loads meshes from 3D World Studio. Originally written by Joseph Ellis @@ -1832,6 +1834,7 @@ Changes in version 1.4.1 (04 Jun 2008) - Avoid a crash when passing setSkin the current skin + - Fixed current frame calculation for non-looped animations. Bug reported by greenya. - Fixed bug in CBillboardSceneNode::setColor, reported by rogerborg diff --git a/include/ISceneManager.h b/include/ISceneManager.h index 83eb9c17..8688f7fc 100644 --- a/include/ISceneManager.h +++ b/include/ISceneManager.h @@ -1489,6 +1489,13 @@ namespace scene This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ virtual ISceneNode* addSceneNode(const char* sceneNodeTypeName, ISceneNode* parent=0) = 0; + //! creates a scene node animator based on its type name + /** \param typeName: Type of the scene node animator to add. + \param target: Target scene node of the new animator. + \return Returns pointer to the new scene node animator or null if not successful. You need to + drop this pointer after calling this, see IReferenceCounted::drop() for details. */ + virtual ISceneNodeAnimator* createSceneNodeAnimator(const char* typeName, ISceneNode* target=0) = 0; + //! Creates a new scene manager. /** This can be used to easily draw and/or store two independent scenes at the same time. The mesh cache will be diff --git a/source/Irrlicht/CSceneLoaderIrr.cpp b/source/Irrlicht/CSceneLoaderIrr.cpp index 4a27947c..3b034bca 100644 --- a/source/Irrlicht/CSceneLoaderIrr.cpp +++ b/source/Irrlicht/CSceneLoaderIrr.cpp @@ -218,12 +218,7 @@ void CSceneLoaderIrr::readAnimators(io::IXMLReader* reader, ISceneNode* node) if (node) { core::stringc typeName = attr->getAttributeAsString("Type"); - ISceneNodeAnimator* anim = 0; - - // todo: need a method to add animator by name in the scene manager. This loader and others like it - // have no business messing with the animator factories! - for (s32 i=SceneManager->getRegisteredSceneNodeAnimatorFactoryCount()-1; i >=0 && !anim; --i) - anim = SceneManager->getSceneNodeAnimatorFactory(i)->createSceneNodeAnimator(typeName.c_str(), node); + ISceneNodeAnimator* anim = SceneManager->createSceneNodeAnimator(typeName.c_str(), node); if (anim) { diff --git a/source/Irrlicht/CSceneManager.cpp b/source/Irrlicht/CSceneManager.cpp index 75b323c1..27794e96 100644 --- a/source/Irrlicht/CSceneManager.cpp +++ b/source/Irrlicht/CSceneManager.cpp @@ -2335,7 +2335,7 @@ const c8* CSceneManager::getSceneNodeTypeName(ESCENE_NODE_TYPE type) { const char* name = 0; - for (int i=(int)SceneNodeFactoryList.size()-1; !name && i>=0; --i) + for (s32 i=(s32)SceneNodeFactoryList.size()-1; !name && i>=0; --i) name = SceneNodeFactoryList[i]->getCreateableSceneNodeTypeName(type); return name; @@ -2346,12 +2346,22 @@ ISceneNode* CSceneManager::addSceneNode(const char* sceneNodeTypeName, ISceneNod { ISceneNode* node = 0; - for (int i=(int)SceneNodeFactoryList.size()-1; i>=0 && !node; --i) + for (s32 i=(s32)SceneNodeFactoryList.size()-1; i>=0 && !node; --i) node = SceneNodeFactoryList[i]->addSceneNode(sceneNodeTypeName, parent); return node; } +ISceneNodeAnimator* CSceneManager::createSceneNodeAnimator(const char* typeName, ISceneNode* target) +{ + ISceneNodeAnimator *animator = 0; + + for (s32 i=(s32)SceneNodeAnimatorFactoryList.size()-1; i>=0 && !animator; --i) + animator = SceneNodeAnimatorFactoryList[i]->createSceneNodeAnimator(typeName, target); + + return animator; +} + //! Returns a typename from a scene node animator type or null if not found const c8* CSceneManager::getAnimatorTypeName(ESCENE_NODE_ANIMATOR_TYPE type) diff --git a/source/Irrlicht/CSceneManager.h b/source/Irrlicht/CSceneManager.h index ea62eb2f..b0838198 100644 --- a/source/Irrlicht/CSceneManager.h +++ b/source/Irrlicht/CSceneManager.h @@ -458,6 +458,9 @@ namespace scene //! Adds a scene node to the scene by name virtual ISceneNode* addSceneNode(const char* sceneNodeTypeName, ISceneNode* parent=0); + //! creates a scene node animator based on its type name + virtual ISceneNodeAnimator* createSceneNodeAnimator(const char* typeName, ISceneNode* target=0); + //! Returns the default scene node animator factory which can create all built-in scene node animators virtual ISceneNodeAnimatorFactory* getDefaultSceneNodeAnimatorFactory(); diff --git a/source/source.txt b/source/source.txt index 2943cc93..55812446 100644 --- a/source/source.txt +++ b/source/source.txt @@ -6,9 +6,9 @@ the Irrlicht Engine. Instead, please use the .dll in the \bin directory, the .lib in the \lib directory and the header files in the \include directory. You will find a good tutorial how to set up your development environment and to -use the engine in the \examples directory. (Try 1.helloworld) +use the engine in the \examples directory. (Try 01.helloworld) -The source of the engine is only included because of the following reasons: +The source of the engine is included because for the following reasons: - To let developers be able to debug the engine. - To let developers be able to make changes to the engine.