-
-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UPBGE: Use CValue for VideoTexture Texture class.
Previously none of the classes with a python proxy in the VideoTexture part was using the PyObjectPlus or CValue classes. These both class are a standard in the way to define a python proxy in the source of the game engine. The power of PyObjectPlus is to use a second proxy called PyObjectPlus_Proxy which can be invalidate when the target object is freed. For example when a game object is freed the python proxy is invalidated to avoid acces to any functions of the game object. The problem solved by PyObjectPlus_Proxy is found in the VideoTexture part but in a more deeper way: None Texture object are freed when restarting the game or a scene, worse when the module owning these instance is freed at the end of the game the restore of the original bind code is made too late because the RAS_Texture is a dangling pointer. To solve this issue Texture now inherite of CValue. Texture python functions and attributes are converted to follow PyObjectPlus standard. But as Texture is instatiated from python via a python constructor we have to keep Texture_init and Texture_new because PyObjectPlus is not managing it. When Texture_new is called the create Texture instance is added in a global list name "textures". This list is used to track existing instance to freed at game or scene reload. When the game or the scene reload the global function Texture::FreeAllTextures is called with a scene as argument. The function iterate on all instances and delete them if theirs game object scene match with the scene passed. At this time the python proxy is still existing but invalidated. In the case where the instacne is directly freed from python the function DestructFromPython is overrided in Texture and remove itself form the textures list. As Texture isntance are python owned and internally owned a little issue was noticed in the function PyObjectPlus::InvalidateProxy: The python proxy is always deferenced even if it is python owned. In this case we steal a reference from an other object. To solve this issue a simple check is made to avoid deferencing the python proxy. In the same way inheriting Texture of CValue, the workaround of BlendType template is replaced by function for game object, camera: ConvertPythonToGameObject ConvertPythonToCamera Only scene is still using: PyObject_TypeCheck(scene, &KX_Scene::Type)
- Loading branch information
1 parent
1bb42eb
commit ef7fbd8
Showing
19 changed files
with
295 additions
and
332 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,7 +77,6 @@ set(SRC | |
VideoDeckLink.cpp | ||
blendVideoTex.cpp | ||
|
||
BlendType.h | ||
Common.h | ||
Exception.h | ||
FilterBase.h | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,6 @@ | |
#include "DeckLinkAPI.h" | ||
|
||
#include "ImageBase.h" | ||
#include "BlendType.h" | ||
#include "Exception.h" | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,8 @@ extern "C" { | |
#include "bgl.h" | ||
} | ||
|
||
#include "glew-mx.h" | ||
|
||
#include <vector> | ||
#include <string.h> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.