Skip to content

Commit 7b9d27d

Browse files
committed
UPBGE: Remove SG_QList from PyObjectPlus.
Previously this class was used only for implicit list maagement for logic bricks and armature channels/contraints. This class already caused a lot of issue due to it's destructor, also since it's plan to replace it by std::vector at the end, reduce it's power in the code is the best. For the moment logic bricks and armatures contraints/channels stil inherite from SG_QList but not though PyObjectPlus.
1 parent b353e62 commit 7b9d27d

File tree

6 files changed

+10
-18
lines changed

6 files changed

+10
-18
lines changed

source/gameengine/Converter/BL_ArmatureChannel.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
#include "DNA_action_types.h"
3636
#include "EXP_PyObjectPlus.h"
3737

38+
#include "SG_QList.h"
39+
3840
class SCA_IObject;
3941
class KX_GameObject;
4042
class BL_ArmatureObject;
@@ -43,7 +45,7 @@ struct bPoseChannel;
4345
struct Object;
4446
struct bPose;
4547

46-
class BL_ArmatureChannel : public PyObjectPlus
48+
class BL_ArmatureChannel : public SG_QList, public PyObjectPlus
4749
{
4850
// use Py_HeaderPtr since we use generic pointer in proxy
4951
Py_HeaderPtr;

source/gameengine/Converter/BL_ArmatureConstraint.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "DNA_constraint_types.h"
3636
#include "EXP_PyObjectPlus.h"
3737

38+
#include "SG_QList.h"
3839
#include <map>
3940

4041
class SCA_IObject;
@@ -50,7 +51,7 @@ struct bPose;
5051
* head = BL_ArmatureObject::m_controlledConstraints
5152
* SG_QList : not used
5253
*/
53-
class BL_ArmatureConstraint : public PyObjectPlus
54+
class BL_ArmatureConstraint : public SG_QList, public PyObjectPlus
5455
{
5556
Py_Header
5657

source/gameengine/Expressions/EXP_PyObjectPlus.h

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
#include "EXP_Python.h"
4444
#include "STR_String.h"
4545
#include "MT_Vector3.h"
46-
#include "SG_QList.h"
4746
#include <stddef.h>
4847

4948
#ifdef WITH_PYTHON
@@ -554,19 +553,7 @@ public: \
554553

555554
#endif
556555

557-
558-
// By making SG_QList the ultimate parent for PyObjectPlus objects, it
559-
// allows to put them in 2 different dynamic lists at the same time
560-
// The use of these links is interesting because they free of memory allocation
561-
// but it's very important not to mess up with them. If you decide that
562-
// the SG_QList or SG_DList component is used for something for a certain class,
563-
// they cannot can be used for anything else at a parent level!
564-
// What these lists are and what they are used for must be carefully documented
565-
// at the level where they are used.
566-
// DON'T MAKE ANY USE OF THESE LIST AT THIS LEVEL, they are already used
567-
// at SCA_IActuator, SCA_ISensor, SCA_IController level which rules out the
568-
// possibility to use them at SCA_ILogicBrick, CValue and PyObjectPlus level.
569-
class PyObjectPlus : public SG_QList
556+
class PyObjectPlus
570557
{ // The PyObjectPlus abstract class
571558
Py_Header // Always start with Py_Header
572559

source/gameengine/Expressions/intern/PyObjectPlus.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ PyObjectPlus::~PyObjectPlus()
6363
#endif
6464
}
6565

66-
PyObjectPlus::PyObjectPlus() : SG_QList() // constructor
66+
PyObjectPlus::PyObjectPlus() // constructor
6767
{
6868
#ifdef WITH_PYTHON
6969
m_proxy= NULL;

source/gameengine/GameLogic/SCA_ILogicBrick.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class KX_NetworkMessageScene;
4040
class SCA_IScene;
4141
class SCA_LogicManager;
4242

43-
class SCA_ILogicBrick : public CValue
43+
class SCA_ILogicBrick : public SG_QList, public CValue
4444
{
4545
Py_Header
4646
protected:

source/gameengine/GameLogic/SCA_IObject.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
#define __SCA_IOBJECT_H__
3636

3737
#include "EXP_Value.h"
38+
39+
#include "SG_QList.h"
3840
#include <vector>
3941

4042
class SCA_IObject;

0 commit comments

Comments
 (0)