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
master
bitplane 2011-02-03 06:56:26 +00:00
parent b25ed6a92f
commit 7543da637a
6 changed files with 28 additions and 10 deletions

View File

@ -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

View File

@ -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

View File

@ -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)
{

View File

@ -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)

View File

@ -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();

View File

@ -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.