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:
authorJoseph Eagar <joeedh@gmail.com>2007-07-27 10:14:25 +0400
committerJoseph Eagar <joeedh@gmail.com>2007-07-27 10:14:25 +0400
commit3031f1f2bd13d0265e3214bf9f17a8bdd1b1dc2f (patch)
tree9a115cd7208a560949d600cb4cc38139d69df140 /source/blender/python/BPY_extern.h
parentc540888f727f4a7ae703c1e07da85c620a2b656c (diff)
=Draw Module Fixed=
This commit fixes the Draw module. All buttons/widgets created via the Draw module in a SpaceScript area are now inserted into a global list attached to the SpaceScript data. This list is cleared before each draw, when freeing the space, and when the area is switched to another space.c This is necessary to prevent Blender's internal UI code from getting invalid pointers to python data. In addition, it allows storing widget tooltips inside the python Button objects, which solves that little bit of stupidity. Note that this reverts the previous weaklist solution. In fact, I had to go over each previous commit by Campbell after this code originally branched before the weaklist commit and re-add each commit. So if anything is missing, just tell me, or feel free to re-add it.
Diffstat (limited to 'source/blender/python/BPY_extern.h')
-rw-r--r--source/blender/python/BPY_extern.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h
index 0d466d5af7e..ee7afe7dcf6 100644
--- a/source/blender/python/BPY_extern.h
+++ b/source/blender/python/BPY_extern.h
@@ -51,6 +51,25 @@ struct bPythonConstraint; /* DNA_constraint_types.h */
extern "C" {
#endif
+ /*These two next functions are important for making sure the Draw module
+ works correctly. Before calling any gui callback using the Draw module,
+ the following code must be executed:
+
+ if (some_drawspace_pylist) {
+ BPy_Set_DrawButtonsList(some_drawspace_pylist->but_refs);
+ BPy_Free_DrawButtonsList();
+ }
+ some_drawspace_pylist = PyList_New(0);
+ BPy_Set_DrawButtonsList(some_drawspace_pylist);
+
+ Also, BPy_Free_DrawButtonsList() must be called as necassary when a drawspace
+ with python callbacks is destroyed.
+
+ This is necassary to avoid blender buttons storing invalid pointers to freed
+ python data.*/
+ void BPy_Set_DrawButtonsList(void *list);
+ void BPy_Free_DrawButtonsList(void);
+
void BPY_pyconstraint_eval(struct bPythonConstraint *con, float ownermat[][4], float targetmat[][4]);
void BPY_pyconstraint_settings(void *arg1, void *arg2);
int BPY_pyconstraint_targets(struct bPythonConstraint *con, float targetmat[][4]);