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:
-rw-r--r--source/blender/python/api2_2x/Armature.c2
-rw-r--r--source/blender/python/api2_2x/Curve.c2
-rw-r--r--source/blender/python/api2_2x/Font.c2
-rwxr-xr-xsource/blender/python/api2_2x/Group.c2
-rw-r--r--source/blender/python/api2_2x/Image.c2
-rw-r--r--source/blender/python/api2_2x/Ipo.c2
-rw-r--r--source/blender/python/api2_2x/Key.c2
-rw-r--r--source/blender/python/api2_2x/Lamp.c2
-rw-r--r--source/blender/python/api2_2x/Lattice.c2
-rw-r--r--source/blender/python/api2_2x/Main.c29
-rw-r--r--source/blender/python/api2_2x/Material.c2
-rw-r--r--source/blender/python/api2_2x/Mesh.c2
-rw-r--r--source/blender/python/api2_2x/Metaball.c2
-rw-r--r--source/blender/python/api2_2x/NLA.c2
-rw-r--r--source/blender/python/api2_2x/Object.c2
-rw-r--r--source/blender/python/api2_2x/Scene.c2
-rw-r--r--source/blender/python/api2_2x/Sound.c2
-rw-r--r--source/blender/python/api2_2x/SurfNurb.c2
-rw-r--r--source/blender/python/api2_2x/Text.c4
-rw-r--r--source/blender/python/api2_2x/Text3d.c4
-rw-r--r--source/blender/python/api2_2x/Texture.c2
-rw-r--r--source/blender/python/api2_2x/World.c2
-rw-r--r--source/blender/python/api2_2x/doc/Bpy.py11
-rw-r--r--source/blender/python/api2_2x/doc/id_generics.py3
-rw-r--r--source/blender/python/api2_2x/gen_library.c40
-rw-r--r--source/blender/python/api2_2x/gen_library.h9
26 files changed, 113 insertions, 25 deletions
diff --git a/source/blender/python/api2_2x/Armature.c b/source/blender/python/api2_2x/Armature.c
index 2603ad0c1ac..d4d687f7306 100644
--- a/source/blender/python/api2_2x/Armature.c
+++ b/source/blender/python/api2_2x/Armature.c
@@ -1087,7 +1087,7 @@ PyTypeObject Armature_Type = {
0, //tp_as_number
0, //tp_as_sequence
0, //tp_as_mapping
- 0, //tp_hash
+ ( hashfunc ) GenericLib_hash, //tp_hash
0, //tp_call
0, //tp_str
0, //tp_getattro
diff --git a/source/blender/python/api2_2x/Curve.c b/source/blender/python/api2_2x/Curve.c
index 83435a1da7a..b107992f77e 100644
--- a/source/blender/python/api2_2x/Curve.c
+++ b/source/blender/python/api2_2x/Curve.c
@@ -1557,7 +1557,7 @@ PyTypeObject Curve_Type = {
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
NULL, /* getattrofunc tp_getattro; */
diff --git a/source/blender/python/api2_2x/Font.c b/source/blender/python/api2_2x/Font.c
index 6c46e54cfd8..667dc6d4e0d 100644
--- a/source/blender/python/api2_2x/Font.c
+++ b/source/blender/python/api2_2x/Font.c
@@ -288,7 +288,7 @@ PyTypeObject Font_Type = {
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
NULL, /* getattrofunc tp_getattro; */
diff --git a/source/blender/python/api2_2x/Group.c b/source/blender/python/api2_2x/Group.c
index d9a5fe7e7d9..fa43bed58cc 100755
--- a/source/blender/python/api2_2x/Group.c
+++ b/source/blender/python/api2_2x/Group.c
@@ -285,7 +285,7 @@ PyTypeObject Group_Type = {
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
NULL, /* getattrofunc tp_getattro; */
diff --git a/source/blender/python/api2_2x/Image.c b/source/blender/python/api2_2x/Image.c
index 5aa8def8abb..fed54aaed5b 100644
--- a/source/blender/python/api2_2x/Image.c
+++ b/source/blender/python/api2_2x/Image.c
@@ -1324,7 +1324,7 @@ PyTypeObject Image_Type = {
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
NULL, /* getattrofunc tp_getattro; */
diff --git a/source/blender/python/api2_2x/Ipo.c b/source/blender/python/api2_2x/Ipo.c
index 4c1865d72b1..8ef4babb415 100644
--- a/source/blender/python/api2_2x/Ipo.c
+++ b/source/blender/python/api2_2x/Ipo.c
@@ -379,7 +379,7 @@ PyTypeObject Ipo_Type = {
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
#ifdef CURVEATTRS
diff --git a/source/blender/python/api2_2x/Key.c b/source/blender/python/api2_2x/Key.c
index 27a92e8c17e..07112c62e17 100644
--- a/source/blender/python/api2_2x/Key.c
+++ b/source/blender/python/api2_2x/Key.c
@@ -149,7 +149,7 @@ PyTypeObject Key_Type = {
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
NULL, /* getattrofunc tp_getattro; */
diff --git a/source/blender/python/api2_2x/Lamp.c b/source/blender/python/api2_2x/Lamp.c
index f497dd7ae18..26c3bd39ca6 100644
--- a/source/blender/python/api2_2x/Lamp.c
+++ b/source/blender/python/api2_2x/Lamp.c
@@ -538,7 +538,7 @@ PyTypeObject Lamp_Type = {
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
NULL, /* getattrofunc tp_getattro; */
diff --git a/source/blender/python/api2_2x/Lattice.c b/source/blender/python/api2_2x/Lattice.c
index fc32d215895..7b2ed57bf75 100644
--- a/source/blender/python/api2_2x/Lattice.c
+++ b/source/blender/python/api2_2x/Lattice.c
@@ -754,7 +754,7 @@ PyTypeObject Lattice_Type = {
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
NULL, /* getattrofunc tp_getattro; */
diff --git a/source/blender/python/api2_2x/Main.c b/source/blender/python/api2_2x/Main.c
index ef0804a9bb4..3531a6a4427 100644
--- a/source/blender/python/api2_2x/Main.c
+++ b/source/blender/python/api2_2x/Main.c
@@ -350,6 +350,31 @@ static int MainSeq_setActive(BPy_MainSeq *self, PyObject *value)
"Only Scene and Image types have the active attribute" );
}
+static int MainSeq_setTag(BPy_MainSeq *self, PyObject *value)
+{
+ int param = PyObject_IsTrue( value );
+ ID *id;
+
+ if( param == -1 )
+ return EXPP_ReturnIntError( PyExc_TypeError,
+ "expected int argument in range [0,1]" );
+
+ id = (ID *)wich_libbase(G.main, self->type)->first;
+
+ if (param) {
+ for (; id; id = id->next) {
+ id->flag |= LIB_DOIT;
+ }
+ } else {
+ for (; id; id = id->next) {
+ id->flag &= ~LIB_DOIT;
+ }
+ }
+
+ return 0;
+}
+
+
/* New Data, internal functions */
Mesh *add_mesh__internal(char *name)
{
@@ -640,6 +665,10 @@ static PyGetSetDef MainSeq_getseters[] = {
(getter)MainSeq_getActive, (setter)MainSeq_setActive,
"active object",
NULL},
+ {"tag",
+ (getter)NULL, (setter)MainSeq_setTag,
+ "tag all data in True or False (write only)",
+ NULL},
{NULL,NULL,NULL,NULL,NULL} /* Sentinel */
};
diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c
index fbe9e69af28..038ab5b4394 100644
--- a/source/blender/python/api2_2x/Material.c
+++ b/source/blender/python/api2_2x/Material.c
@@ -1102,7 +1102,7 @@ PyTypeObject Material_Type = {
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
NULL, /* getattrofunc tp_getattro; */
diff --git a/source/blender/python/api2_2x/Mesh.c b/source/blender/python/api2_2x/Mesh.c
index 7e8f51f5002..27f53cedd95 100644
--- a/source/blender/python/api2_2x/Mesh.c
+++ b/source/blender/python/api2_2x/Mesh.c
@@ -7739,7 +7739,7 @@ PyTypeObject Mesh_Type = {
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
NULL, /* getattrofunc tp_getattro; */
diff --git a/source/blender/python/api2_2x/Metaball.c b/source/blender/python/api2_2x/Metaball.c
index baf8ae27ec6..aeb935c72e1 100644
--- a/source/blender/python/api2_2x/Metaball.c
+++ b/source/blender/python/api2_2x/Metaball.c
@@ -243,7 +243,7 @@ PyTypeObject Metaball_Type = {
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
NULL, /* getattrofunc tp_getattro; */
diff --git a/source/blender/python/api2_2x/NLA.c b/source/blender/python/api2_2x/NLA.c
index 2c5011f94fc..be15e24d193 100644
--- a/source/blender/python/api2_2x/NLA.c
+++ b/source/blender/python/api2_2x/NLA.c
@@ -439,7 +439,7 @@ PyTypeObject Action_Type = {
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
NULL, /* getattrofunc tp_getattro; */
diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c
index 42133c6192f..beeb42af96c 100644
--- a/source/blender/python/api2_2x/Object.c
+++ b/source/blender/python/api2_2x/Object.c
@@ -5027,7 +5027,7 @@ PyTypeObject Object_Type = {
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
NULL, /* getattrofunc tp_getattro; */
diff --git a/source/blender/python/api2_2x/Scene.c b/source/blender/python/api2_2x/Scene.c
index ff0eb3ff20d..ea470a32911 100644
--- a/source/blender/python/api2_2x/Scene.c
+++ b/source/blender/python/api2_2x/Scene.c
@@ -474,7 +474,7 @@ PyTypeObject Scene_Type = {
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
NULL, /* getattrofunc tp_getattro; */
diff --git a/source/blender/python/api2_2x/Sound.c b/source/blender/python/api2_2x/Sound.c
index ed366429ce3..75e67f94aae 100644
--- a/source/blender/python/api2_2x/Sound.c
+++ b/source/blender/python/api2_2x/Sound.c
@@ -563,7 +563,7 @@ PyTypeObject Sound_Type = {
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
NULL, /* getattrofunc tp_getattro; */
diff --git a/source/blender/python/api2_2x/SurfNurb.c b/source/blender/python/api2_2x/SurfNurb.c
index 895e3e031ba..0cac359dcf9 100644
--- a/source/blender/python/api2_2x/SurfNurb.c
+++ b/source/blender/python/api2_2x/SurfNurb.c
@@ -762,7 +762,7 @@ PyTypeObject SurfNurb_Type = {
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
NULL, /* getattrofunc tp_getattro; */
diff --git a/source/blender/python/api2_2x/Text.c b/source/blender/python/api2_2x/Text.c
index 23db85f7b36..8741cab1a7f 100644
--- a/source/blender/python/api2_2x/Text.c
+++ b/source/blender/python/api2_2x/Text.c
@@ -532,7 +532,7 @@ PyTypeObject Text_Type = {
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
NULL, /* getattrofunc tp_getattro; */
@@ -540,7 +540,7 @@ PyTypeObject Text_Type = {
/* Functions to access object as input/output buffer */
NULL, /* PyBufferProcs *tp_as_buffer; */
-
+
/*** Flags to define presence of optional/expanded features ***/
Py_TPFLAGS_DEFAULT, /* long tp_flags; */
diff --git a/source/blender/python/api2_2x/Text3d.c b/source/blender/python/api2_2x/Text3d.c
index cf825bd242c..df152217524 100644
--- a/source/blender/python/api2_2x/Text3d.c
+++ b/source/blender/python/api2_2x/Text3d.c
@@ -31,7 +31,7 @@
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-
+
#include "Text3d.h" /*This must come first*/
#include "DNA_object_types.h"
@@ -372,7 +372,7 @@ PyTypeObject Text3d_Type = {
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
NULL, /* getattrofunc tp_getattro; */
diff --git a/source/blender/python/api2_2x/Texture.c b/source/blender/python/api2_2x/Texture.c
index 8d980ddf988..d1636c3d405 100644
--- a/source/blender/python/api2_2x/Texture.c
+++ b/source/blender/python/api2_2x/Texture.c
@@ -811,7 +811,7 @@ PyTypeObject Texture_Type = {
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
NULL, /* getattrofunc tp_getattro; */
diff --git a/source/blender/python/api2_2x/World.c b/source/blender/python/api2_2x/World.c
index c16d4c3fc97..580bb3efcc3 100644
--- a/source/blender/python/api2_2x/World.c
+++ b/source/blender/python/api2_2x/World.c
@@ -281,7 +281,7 @@ PyTypeObject World_Type = {
/* More standard operations (here for binary compatibility) */
- NULL, /* hashfunc tp_hash; */
+ ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
NULL, /* ternaryfunc tp_call; */
NULL, /* reprfunc tp_str; */
NULL, /* getattrofunc tp_getattro; */
diff --git a/source/blender/python/api2_2x/doc/Bpy.py b/source/blender/python/api2_2x/doc/Bpy.py
index 7bf3afe8249..25eca7ab6a8 100644
--- a/source/blender/python/api2_2x/doc/Bpy.py
+++ b/source/blender/python/api2_2x/doc/Bpy.py
@@ -188,6 +188,17 @@ class dataIterator:
>>> ipo_list = list(bpy.ipos)
+ @type tag: Bool
+ @ivar tag: A fast way to set the tag value of every member of the sequence to True or False
+
+ For example
+
+ >>> bpy.meshes.tag = True
+
+ Is the same as...
+
+ >>> for me in bpy.meshes: me.tag = True
+
@type active: Datablock or None
@ivar active: The active member of the datatype
diff --git a/source/blender/python/api2_2x/doc/id_generics.py b/source/blender/python/api2_2x/doc/id_generics.py
index 1d1f52df9cb..30c7e5d6a3c 100644
--- a/source/blender/python/api2_2x/doc/id_generics.py
+++ b/source/blender/python/api2_2x/doc/id_generics.py
@@ -18,6 +18,9 @@ attributes = """
@ivar fakeUser: When set to True, this datablock wont be removed, even if nothing is using it.
All data has this disabled by default except for Actions.
@type fakeUser: bool
+ @ivar tag: A temporary tag that to flag data as being used within a loop.
+ always set all tags to True or False before using since blender uses this flag for its own internal operations.
+ @type tag: bool
@ivar users: The number of users this datablock has. (readonly)
Zero user datablocks are de-allocated after reloading and saving.
@type users: int
diff --git a/source/blender/python/api2_2x/gen_library.c b/source/blender/python/api2_2x/gen_library.c
index af7b031f0fc..a93bb2f879a 100644
--- a/source/blender/python/api2_2x/gen_library.c
+++ b/source/blender/python/api2_2x/gen_library.c
@@ -91,6 +91,35 @@ int GenericLib_setFakeUser( void *self, PyObject *value )
return 0;
}
+PyObject *GenericLib_getTag( void *self )
+{
+ ID *id = ((BPy_GenericLib *)self)->id;
+ if (!id) return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, "data has been removed" ) );
+ if (id->flag & LIB_DOIT)
+ Py_RETURN_TRUE;
+ else
+ Py_RETURN_FALSE;
+}
+
+int GenericLib_setTag( void *self, PyObject *value )
+{
+ int param;
+ ID *id = ((BPy_GenericLib *)self)->id;
+ if (!id) return ( EXPP_ReturnIntError( PyExc_RuntimeError, "data has been removed" ) );
+
+ param = PyObject_IsTrue( value );
+ if( param == -1 )
+ return EXPP_ReturnIntError( PyExc_TypeError,
+ "expected int argument in range [0,1]" );
+
+ if (param)
+ id->flag |= LIB_DOIT;
+ else
+ id->flag &= ~LIB_DOIT;
+ return 0;
+}
+
+
/* read only */
PyObject *GenericLib_getLib( void *self )
{
@@ -306,3 +335,14 @@ PyObject *GetPyObjectFromID( ID * id )
Py_RETURN_NONE;
}
+/* return a unique tuple for this libdata*/
+long GenericLib_hash(PyObject * pydata)
+{
+ ID *id = ((BPy_GenericLib *)pydata)->id;
+ PyObject *pyhash = PyTuple_New( 2 );
+ PyTuple_SetItem( pyhash, 0, PyString_FromString(id->name) );
+ if (id->lib) PyTuple_SetItem( pyhash, 0, PyString_FromString(id->lib->name) );
+ else PyTuple_SetItem( pyhash, 1, Py_None );
+ return PyObject_Hash(pyhash);
+}
+
diff --git a/source/blender/python/api2_2x/gen_library.h b/source/blender/python/api2_2x/gen_library.h
index 5f81424ca3a..74f34fd0019 100644
--- a/source/blender/python/api2_2x/gen_library.h
+++ b/source/blender/python/api2_2x/gen_library.h
@@ -59,9 +59,12 @@
{"properties",\
(getter)GenericLib_getProperties, (setter)NULL,\
"properties",\
+ NULL},\
+ {"tag",\
+ (getter)GenericLib_getTag, (setter)GenericLib_setTag,\
+ "temproary tag",\
NULL}
-
/* Dummy struct for getting the ID from a libdata BPyObject */
typedef struct {
PyObject_HEAD /* required python macro */
@@ -72,6 +75,8 @@ int GenericLib_setName( void *self, PyObject *value );
PyObject *GenericLib_getName( void *self );
PyObject *GenericLib_getFakeUser( void *self );
int GenericLib_setFakeUser( void *self, PyObject *value );
+PyObject *GenericLib_getTag( void *self );
+int GenericLib_setTag( void *self, PyObject *value );
PyObject *GenericLib_getLib( void *self );
PyObject *GenericLib_getUsers( void *self );
PyObject *GenericLib_getProperties( void *self );
@@ -85,5 +90,5 @@ short GenericLib_getType(PyObject * pydata);
/* Other ID functions */
ID *GetIdFromList( ListBase * list, char *name );
PyObject *GetPyObjectFromID( ID * id );
-
+long GenericLib_hash(PyObject * pydata);
#endif /* EXPP_gen_library_h */