Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Stokes <mogurijin@gmail.com>2014-05-08 05:14:36 +0400
committerMitchell Stokes <mogurijin@gmail.com>2014-05-08 07:32:50 +0400
commitee5284faf6db96bb5029f6d2ab0b62336ef84e53 (patch)
tree0ac01a140068654cc09762fa9ccb0b7c02929e77 /source/gameengine/Ketsji/BL_ActionManager.h
parent34bc1e528e32e6909b190ee3d2e73bbceb240de2 (diff)
BGE: Dynamically-allocated action layers
This patch removes the limitations on the number of action layers in the BGE. BL_ActionManager currently uses a fixed array to keep track of the action layers. This patch replaces the fixed array with a map which allows for dynamic allocation of action layers. Layers (map items) are automatically removed on BL_ActionManager's update function. The maximum number of layers is roughly the value of a short. Backwards functionality is maintained and there are no changes to the Python API. Task Discussion: https://developer.blender.org/T39572 Author: Kevin Ednalino Reviewers: moguri Differential Revision: https://developer.blender.org/D491
Diffstat (limited to 'source/gameengine/Ketsji/BL_ActionManager.h')
-rw-r--r--source/gameengine/Ketsji/BL_ActionManager.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/source/gameengine/Ketsji/BL_ActionManager.h b/source/gameengine/Ketsji/BL_ActionManager.h
index be9097c3ca3..5b340257881 100644
--- a/source/gameengine/Ketsji/BL_ActionManager.h
+++ b/source/gameengine/Ketsji/BL_ActionManager.h
@@ -31,7 +31,12 @@
#include "MEM_guardedalloc.h"
#endif
-#define MAX_ACTION_LAYERS 8
+#include <map>
+
+// Currently, we use the max value of a short.
+// We should switch to unsigned short; doesn't make sense to support negative layers.
+// This will also give us 64k layers instead of 32k.
+#define MAX_ACTION_LAYERS 32767
class BL_Action;
@@ -41,7 +46,20 @@ class BL_Action;
class BL_ActionManager
{
private:
- BL_Action* m_layers[MAX_ACTION_LAYERS];
+ typedef std::map<short,BL_Action*> BL_ActionMap;
+
+ class KX_GameObject* m_obj;
+ BL_ActionMap m_layers;
+
+ /**
+ * Check if an action exists
+ */
+ BL_Action* GetAction(short layer);
+
+ /**
+ * Add new action with given layer
+ */
+ BL_Action* AddAction(short layer);
public:
BL_ActionManager(class KX_GameObject* obj);