Przeglądaj źródła

Removed "has" functions from AnimationClip

Rcmaniac25 11 lat temu
rodzic
commit
7f70d59b17

+ 0 - 85
gameplay/src/AnimationClip.cpp

@@ -348,28 +348,6 @@ void AnimationClip::removeListener(AnimationClip::Listener* listener, unsigned l
 	}
 }
 
-bool AnimationClip::hasListener(AnimationClip::Listener* listener, unsigned long eventTime, bool triggedValid) const
-{
-	if (_listeners)
-	{
-		GP_ASSERT(listener);
-		GP_ASSERT(eventTime < _activeDuration);
-		std::list<ListenerEvent*>::iterator iter = std::find_if(_listeners->begin(), _listeners->end(), [&](ListenerEvent* lst){ return lst->_eventTime == eventTime && lst->_listener == listener; });
-		if (iter != _listeners->end())
-		{
-			// If we don't care if the listener was triggered already, then we can exit.
-			// Otherwise, we need to check the time to determine if it's past the trigger time yet.
-			if (triggedValid || !isClipStateBitSet(CLIP_IS_PLAYING_BIT))
-			{
-				return true;
-			}
-			float currentTime = fmodf(_elapsedTime, (float)_duration);
-			return (_speed >= 0.0f && currentTime < eventTime) || (_speed <= 0 && currentTime > eventTime);
-		}
-	}
-	return false;
-}
-
 void AnimationClip::addBeginListener(AnimationClip::Listener* listener)
 {
     if (!_beginListeners)
@@ -392,16 +370,6 @@ void AnimationClip::removeBeginListener(AnimationClip::Listener* listener)
 	}
 }
 
-bool AnimationClip::hasBeginListener(AnimationClip::Listener* listener) const
-{
-	if (_beginListeners)
-	{
-		GP_ASSERT(listener);
-		return std::find(_beginListeners->begin(), _beginListeners->end(), listener) != _beginListeners->end();
-	}
-	return false;
-}
-
 void AnimationClip::addEndListener(AnimationClip::Listener* listener)
 {
     if (!_endListeners)
@@ -424,16 +392,6 @@ void AnimationClip::removeEndListener(AnimationClip::Listener* listener)
 	}
 }
 
-bool AnimationClip::hasEndListener(AnimationClip::Listener* listener) const
-{
-	if (_endListeners)
-	{
-		GP_ASSERT(listener);
-		return std::find(_endListeners->begin(), _endListeners->end(), listener) != _endListeners->end();
-	}
-	return false;
-}
-
 void AnimationClip::addBeginListener(const char* function)
 {
     if (!_scriptListeners)
@@ -461,20 +419,6 @@ void AnimationClip::removeBeginListener(const char* function)
 	}
 }
 
-bool AnimationClip::hasBeginListener(const char* function) const
-{
-	if (_scriptListeners)
-	{
-		std::string functionRef = Game::getInstance()->getScriptController()->loadUrl(function);
-		std::vector<ScriptListener*>::iterator iter = std::find_if(_scriptListeners->begin(), _scriptListeners->end(), [&](ScriptListener* listener){ return listener->function == functionRef; });
-		if (iter != _scriptListeners->end())
-		{
-			return hasBeginListener(*iter);
-		}
-	}
-	return false;
-}
-
 void AnimationClip::addEndListener(const char* function)
 {
     if (!_scriptListeners)
@@ -502,20 +446,6 @@ void AnimationClip::removeEndListener(const char* function)
 	}
 }
 
-bool AnimationClip::hasEndListener(const char* function) const
-{
-	if (_scriptListeners)
-	{
-		std::string functionRef = Game::getInstance()->getScriptController()->loadUrl(function);
-		std::vector<ScriptListener*>::iterator iter = std::find_if(_scriptListeners->begin(), _scriptListeners->end(), [&](ScriptListener* listener){ return listener->function == functionRef; });
-		if (iter != _scriptListeners->end())
-		{
-			return hasEndListener(*iter);
-		}
-	}
-	return false;
-}
-
 void AnimationClip::addListener(const char* function, unsigned long eventTime)
 {
     if (!_scriptListeners)
@@ -544,21 +474,6 @@ void AnimationClip::removeListener(const char* function, unsigned long eventTime
 	}
 }
 
-bool AnimationClip::hasListener(const char* function, unsigned long eventTime, bool triggedValid) const
-{
-	if (_scriptListeners)
-	{
-		GP_ASSERT(eventTime < _activeDuration);
-		std::string functionRef = Game::getInstance()->getScriptController()->loadUrl(function);
-		std::vector<ScriptListener*>::iterator iter = std::find_if(_scriptListeners->begin(), _scriptListeners->end(), [&](ScriptListener* listener){ return listener->function == functionRef; });
-		if (iter != _scriptListeners->end())
-		{
-			return hasListener(*iter, eventTime, triggedValid);
-		}
-	}
-	return false;
-}
-
 bool AnimationClip::update(float elapsedTime)
 {
     if (isClipStateBitSet(CLIP_IS_PAUSED_BIT))

+ 0 - 58
gameplay/src/AnimationClip.h

@@ -238,15 +238,6 @@ public:
 	 */
 	void removeBeginListener(AnimationClip::Listener* listener);
 
-	/**
-	 * Determine if a animation begin listener is registered to be called.
-	 *
-	 * @param listener The listener to lookup.
-	 *
-	 * @return true if the listener is registered to be called, false if it is not registered.
-	 */
-	bool hasBeginListener(AnimationClip::Listener* listener) const;
-
     /**
      * Adds an animation end listener.
      *
@@ -261,15 +252,6 @@ public:
 	 */
 	void removeEndListener(AnimationClip::Listener* listener);
 
-	/**
-	 * Determine if a animation end listener is registered to be called.
-	 *
-	 * @param listener The listener to lookup.
-	 *
-	 * @return true if the listener is registered to be called, false if it is not registered.
-	 */
-	bool hasEndListener(AnimationClip::Listener* listener) const;
-
     /**
      * Adds an animation listener to be called back at the specified eventTime during the playback 
      * of the AnimationClip.
@@ -289,17 +271,6 @@ public:
 	 */
 	void removeListener(AnimationClip::Listener* listener, unsigned long eventTime);
 
-	/**
-	 * Determine if a animation listener is registered to be called.
-	 *
-	 * @param listener The listener to lookup.
-	 * @param eventTime The time of the listener to lookup.
-	 * @param triggedValid Return true if the listener is registered, even if it has already been called.
-	 *
-	 * @return true if the listener is registered to be called, false if it is not registered.
-	 */
-	bool hasListener(AnimationClip::Listener* listener, unsigned long eventTime, bool triggedValid = true) const;
-
     /**
      * Adds an animation begin listener.
      * 
@@ -316,15 +287,6 @@ public:
 	 */
 	void removeBeginListener(const char* function);
 
-	/**
-	 * Determine if a animation begin listener is registered to be called.
-	 *
-	 * @param function The Lua script function to lookup.
-	 *
-	 * @return true if the listener is registered to be called, false if it is not registered.
-	 */
-	bool hasBeginListener(const char* function) const;
-
     /**
      * Adds an animation end listener.
      * 
@@ -341,15 +303,6 @@ public:
 	 */
 	void removeEndListener(const char* function);
 
-	/**
-	 * Determine if a animation end listener is registered to be called.
-	 *
-	 * @param function The Lua script function to lookup.
-	 *
-	 * @return true if the listener is registered to be called, false if it is not registered.
-	 */
-	bool hasEndListener(const char* function) const;
-
     /**
      * Adds an animation listener to be called back at the specified eventTime during the playback 
      * of the AnimationClip.
@@ -371,17 +324,6 @@ public:
 	 */
 	void removeListener(const char* function, unsigned long eventTime);
 
-	/**
-	 * Determine if a animation listener is registered to be called.
-	 *
-	 * @param function The Lua script function to lookup.
-	 * @param eventTime The time of the listener to lookup.
-	 * @param triggedValid Return true if the listener is registered, even if it has already been called.
-	 *
-	 * @return true if the listener is registered to be called, false if it is not registered.
-	 */
-	bool hasListener(const char* function, unsigned long eventTime, bool triggedValid = true) const;
-
 private:
     
     static const unsigned char CLIP_IS_PLAYING_BIT = 0x01;             // Bit representing whether AnimationClip is a running clip in AnimationController

+ 0 - 261
gameplay/src/lua/lua_AnimationClip.cpp

@@ -35,9 +35,6 @@ void luaRegister_AnimationClip()
         {"getRepeatCount", lua_AnimationClip_getRepeatCount},
         {"getSpeed", lua_AnimationClip_getSpeed},
         {"getStartTime", lua_AnimationClip_getStartTime},
-        {"hasBeginListener", lua_AnimationClip_hasBeginListener},
-        {"hasEndListener", lua_AnimationClip_hasEndListener},
-        {"hasListener", lua_AnimationClip_hasListener},
         {"isPlaying", lua_AnimationClip_isPlaying},
         {"pause", lua_AnimationClip_pause},
         {"play", lua_AnimationClip_play},
@@ -794,264 +791,6 @@ int lua_AnimationClip_getStartTime(lua_State* state)
     return 0;
 }
 
-int lua_AnimationClip_hasBeginListener(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 2:
-        {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1Valid;
-                    gameplay::ScriptUtil::LuaArray<AnimationClip::Listener> param1 = gameplay::ScriptUtil::getObjectPointer<AnimationClip::Listener>(2, "AnimationClipListener", false, &param1Valid);
-                    if (!param1Valid)
-                        break;
-
-                    AnimationClip* instance = getInstance(state);
-                    bool result = instance->hasBeginListener(param1);
-
-                    // Push the return value onto the stack.
-                    lua_pushboolean(state, result);
-
-                    return 1;
-                }
-            } while (0);
-
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    const char* param1 = gameplay::ScriptUtil::getString(2, false);
-
-                    AnimationClip* instance = getInstance(state);
-                    bool result = instance->hasBeginListener(param1);
-
-                    // Push the return value onto the stack.
-                    lua_pushboolean(state, result);
-
-                    return 1;
-                }
-            } while (0);
-
-            lua_pushstring(state, "lua_AnimationClip_hasBeginListener - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_AnimationClip_hasEndListener(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 2:
-        {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1Valid;
-                    gameplay::ScriptUtil::LuaArray<AnimationClip::Listener> param1 = gameplay::ScriptUtil::getObjectPointer<AnimationClip::Listener>(2, "AnimationClipListener", false, &param1Valid);
-                    if (!param1Valid)
-                        break;
-
-                    AnimationClip* instance = getInstance(state);
-                    bool result = instance->hasEndListener(param1);
-
-                    // Push the return value onto the stack.
-                    lua_pushboolean(state, result);
-
-                    return 1;
-                }
-            } while (0);
-
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    const char* param1 = gameplay::ScriptUtil::getString(2, false);
-
-                    AnimationClip* instance = getInstance(state);
-                    bool result = instance->hasEndListener(param1);
-
-                    // Push the return value onto the stack.
-                    lua_pushboolean(state, result);
-
-                    return 1;
-                }
-            } while (0);
-
-            lua_pushstring(state, "lua_AnimationClip_hasEndListener - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_AnimationClip_hasListener(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 3:
-        {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
-                    lua_type(state, 3) == LUA_TNUMBER)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1Valid;
-                    gameplay::ScriptUtil::LuaArray<AnimationClip::Listener> param1 = gameplay::ScriptUtil::getObjectPointer<AnimationClip::Listener>(2, "AnimationClipListener", false, &param1Valid);
-                    if (!param1Valid)
-                        break;
-
-                    // Get parameter 2 off the stack.
-                    unsigned long param2 = (unsigned long)luaL_checkunsigned(state, 3);
-
-                    AnimationClip* instance = getInstance(state);
-                    bool result = instance->hasListener(param1, param2);
-
-                    // Push the return value onto the stack.
-                    lua_pushboolean(state, result);
-
-                    return 1;
-                }
-            } while (0);
-
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                    lua_type(state, 3) == LUA_TNUMBER)
-                {
-                    // Get parameter 1 off the stack.
-                    const char* param1 = gameplay::ScriptUtil::getString(2, false);
-
-                    // Get parameter 2 off the stack.
-                    unsigned long param2 = (unsigned long)luaL_checkunsigned(state, 3);
-
-                    AnimationClip* instance = getInstance(state);
-                    bool result = instance->hasListener(param1, param2);
-
-                    // Push the return value onto the stack.
-                    lua_pushboolean(state, result);
-
-                    return 1;
-                }
-            } while (0);
-
-            lua_pushstring(state, "lua_AnimationClip_hasListener - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        case 4:
-        {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
-                    lua_type(state, 3) == LUA_TNUMBER &&
-                    lua_type(state, 4) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1Valid;
-                    gameplay::ScriptUtil::LuaArray<AnimationClip::Listener> param1 = gameplay::ScriptUtil::getObjectPointer<AnimationClip::Listener>(2, "AnimationClipListener", false, &param1Valid);
-                    if (!param1Valid)
-                        break;
-
-                    // Get parameter 2 off the stack.
-                    unsigned long param2 = (unsigned long)luaL_checkunsigned(state, 3);
-
-                    // Get parameter 3 off the stack.
-                    bool param3 = gameplay::ScriptUtil::luaCheckBool(state, 4);
-
-                    AnimationClip* instance = getInstance(state);
-                    bool result = instance->hasListener(param1, param2, param3);
-
-                    // Push the return value onto the stack.
-                    lua_pushboolean(state, result);
-
-                    return 1;
-                }
-            } while (0);
-
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                    lua_type(state, 3) == LUA_TNUMBER &&
-                    lua_type(state, 4) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    const char* param1 = gameplay::ScriptUtil::getString(2, false);
-
-                    // Get parameter 2 off the stack.
-                    unsigned long param2 = (unsigned long)luaL_checkunsigned(state, 3);
-
-                    // Get parameter 3 off the stack.
-                    bool param3 = gameplay::ScriptUtil::luaCheckBool(state, 4);
-
-                    AnimationClip* instance = getInstance(state);
-                    bool result = instance->hasListener(param1, param2, param3);
-
-                    // Push the return value onto the stack.
-                    lua_pushboolean(state, result);
-
-                    return 1;
-                }
-            } while (0);
-
-            lua_pushstring(state, "lua_AnimationClip_hasListener - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 3 or 4).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_AnimationClip_isPlaying(lua_State* state)
 {
     // Get the number of parameters.

+ 0 - 3
gameplay/src/lua/lua_AnimationClip.h

@@ -23,9 +23,6 @@ int lua_AnimationClip_getRefCount(lua_State* state);
 int lua_AnimationClip_getRepeatCount(lua_State* state);
 int lua_AnimationClip_getSpeed(lua_State* state);
 int lua_AnimationClip_getStartTime(lua_State* state);
-int lua_AnimationClip_hasBeginListener(lua_State* state);
-int lua_AnimationClip_hasEndListener(lua_State* state);
-int lua_AnimationClip_hasListener(lua_State* state);
 int lua_AnimationClip_isPlaying(lua_State* state);
 int lua_AnimationClip_pause(lua_State* state);
 int lua_AnimationClip_play(lua_State* state);