Commit 7543da63 authored by bitplane's avatar bitplane

Added ISceneManager::createSceneNodeAnimator to create an animator by name, so...

Added ISceneManager::createSceneNodeAnimator to create an animator by name, so scene loaders don't need to worry about how the animator factories are used.



git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3579 dfc29bdd-3216-0410-991c-e03cc46cb475
parent b25ed6a9
Changes in 1.8 (??.??.2011) 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. - 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 - 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) ...@@ -1832,6 +1834,7 @@ Changes in version 1.4.1 (04 Jun 2008)
- Avoid a crash when passing setSkin the current skin - Avoid a crash when passing setSkin the current skin
- Fixed current frame calculation for non-looped animations. Bug reported by greenya. - Fixed current frame calculation for non-looped animations. Bug reported by greenya.
- Fixed bug in CBillboardSceneNode::setColor, reported by rogerborg - Fixed bug in CBillboardSceneNode::setColor, reported by rogerborg
......
...@@ -1489,6 +1489,13 @@ namespace scene ...@@ -1489,6 +1489,13 @@ namespace scene
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual ISceneNode* addSceneNode(const char* sceneNodeTypeName, ISceneNode* parent=0) = 0; 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. //! Creates a new scene manager.
/** This can be used to easily draw and/or store two /** This can be used to easily draw and/or store two
independent scenes at the same time. The mesh cache will be independent scenes at the same time. The mesh cache will be
......
...@@ -218,12 +218,7 @@ void CSceneLoaderIrr::readAnimators(io::IXMLReader* reader, ISceneNode* node) ...@@ -218,12 +218,7 @@ void CSceneLoaderIrr::readAnimators(io::IXMLReader* reader, ISceneNode* node)
if (node) if (node)
{ {
core::stringc typeName = attr->getAttributeAsString("Type"); core::stringc typeName = attr->getAttributeAsString("Type");
ISceneNodeAnimator* anim = 0; ISceneNodeAnimator* anim = SceneManager->createSceneNodeAnimator(typeName.c_str(), node);
// 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);
if (anim) if (anim)
{ {
......
...@@ -2335,7 +2335,7 @@ const c8* CSceneManager::getSceneNodeTypeName(ESCENE_NODE_TYPE type) ...@@ -2335,7 +2335,7 @@ const c8* CSceneManager::getSceneNodeTypeName(ESCENE_NODE_TYPE type)
{ {
const char* name = 0; 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); name = SceneNodeFactoryList[i]->getCreateableSceneNodeTypeName(type);
return name; return name;
...@@ -2346,12 +2346,22 @@ ISceneNode* CSceneManager::addSceneNode(const char* sceneNodeTypeName, ISceneNod ...@@ -2346,12 +2346,22 @@ ISceneNode* CSceneManager::addSceneNode(const char* sceneNodeTypeName, ISceneNod
{ {
ISceneNode* node = 0; 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); node = SceneNodeFactoryList[i]->addSceneNode(sceneNodeTypeName, parent);
return node; 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 //! Returns a typename from a scene node animator type or null if not found
const c8* CSceneManager::getAnimatorTypeName(ESCENE_NODE_ANIMATOR_TYPE type) const c8* CSceneManager::getAnimatorTypeName(ESCENE_NODE_ANIMATOR_TYPE type)
......
...@@ -458,6 +458,9 @@ namespace scene ...@@ -458,6 +458,9 @@ namespace scene
//! Adds a scene node to the scene by name //! Adds a scene node to the scene by name
virtual ISceneNode* addSceneNode(const char* sceneNodeTypeName, ISceneNode* parent=0); 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 //! Returns the default scene node animator factory which can create all built-in scene node animators
virtual ISceneNodeAnimatorFactory* getDefaultSceneNodeAnimatorFactory(); virtual ISceneNodeAnimatorFactory* getDefaultSceneNodeAnimatorFactory();
......
...@@ -6,9 +6,9 @@ the Irrlicht Engine. Instead, please use the .dll in the \bin directory, the ...@@ -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. .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 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 debug the engine.
- To let developers be able to make changes to the engine. - To let developers be able to make changes to the engine.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment