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>2006-12-17 02:54:45 +0300
committerJoseph Eagar <joeedh@gmail.com>2006-12-17 02:54:45 +0300
commit3a84791b530ab2fdb5b0e9eccc7b77ac131e93a0 (patch)
tree81b8345fb837bd351d8bf748c7fef6c05d53dcf1 /source/blender/blenkernel/intern/idprop.c
parent47ee194922e8fc071dcb74a703d542c73d47ffff (diff)
=IDProperties Python update=
Updated id properties interface as per discussed in python meeting. Basically, id properties are now entirely accessed through the dict-like interface if IDGroupType. Also, tp_getsetters are used throughout the code now. Using the dict interface allowed for a major cleanup of the wrapping code. The biggest change is that ID properties are no longer wrapped in a structure with .type .name and .data members; instead when you get properties from the group it returns the direct value. Ints, strings and floats return simple python types, while arrays and groups return special wrappers though. This means to detect the type of an ID property, you have to use type(). For string and int types this is easy; for group and array types (which of course have their own wrappers) you use type() with Blender.IDGroupType or Blender.IDArrayType. Update of epydocs plus a temporary gui script will be forthcoming; the gui script will be removed before release as of course by then we'll have a built-in gui for id properties.
Diffstat (limited to 'source/blender/blenkernel/intern/idprop.c')
-rw-r--r--source/blender/blenkernel/intern/idprop.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index d59fdf28c83..ba5332d5dab 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -182,6 +182,19 @@ int IDP_AddToGroup(IDProperty *group, IDProperty *prop)
return 1;
}
+int IDP_InsertToGroup(IDProperty *group, IDProperty *previous, IDProperty *pnew)
+{
+ IDProperty *loop;
+ for (loop=group->data.group.first; loop; loop=loop->next) {
+ if (BSTR_EQ(loop->name, pnew->name)) return 0;
+ }
+
+ group->len++;
+
+ BLI_insertlink(&group->data.group, previous, pnew);
+ return 1;
+}
+
void IDP_RemFromGroup(IDProperty *group, IDProperty *prop)
{
group->len--;