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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2008-11-13 00:16:53 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2008-11-13 00:16:53 +0300
commitbdfe7d89e2f1292644577972c716931b4ce3c6c3 (patch)
treed00eb50b749cb001e2b08272c91791e66740b05d /source/blender/blenkernel/intern/idprop.c
parent78a1c27c4a6abe0ed31ca93ad21910f3df04da56 (diff)
parent7e4db234cee71ead34ee81a12e27da4bd548eb4b (diff)
Merge of trunk into blender 2.5:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r12987:17416 Issues: * GHOST/X11 had conflicting changes. Some code was added in 2.5, which was later added in trunk also, but reverted partially, specifically revision 16683. I have left out this reversion in the 2.5 branch since I think it is needed there. http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16683 * Scons had various conflicting changes, I decided to go with trunk version for everything except priorities and some library renaming. * In creator.c, there were various fixes and fixes for fixes related to the -w -W and -p options. In 2.5 -w and -W is not coded yet, and -p is done differently. Since this is changed so much, and I don't think those fixes would be needed in 2.5, I've left them out. * Also in creator.c: there was code for a python bugfix where the screen was not initialized when running with -P. The code that initializes the screen there I had to disable, that can't work in 2.5 anymore but left it commented as a reminder. Further I had to disable some new function calls. using src/ and python/, as was done already in this branch, disabled function calls: * bpath.c: error reporting * BME_conversions.c: editmesh conversion functions. * SHD_dynamic: disabled almost completely, there is no python/. * KX_PythonInit.cpp and Ketsji/ build files: Mathutils is not there, disabled. * text.c: clipboard copy call. * object.c: OB_SUPPORT_MATERIAL. * DerivedMesh.c and subsurf_ccg, stipple_quarttone. Still to be done: * Go over files and functions that were moved to a different location but could still use changes that were done in trunk.
Diffstat (limited to 'source/blender/blenkernel/intern/idprop.c')
-rw-r--r--source/blender/blenkernel/intern/idprop.c40
1 files changed, 30 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index eb633e92cc0..542a1dff651 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -54,7 +54,8 @@ static char idp_size_table[] = {
sizeof(float)*16, /*Matrix type, deprecated*/
0, /*arrays don't have a fixed size*/
sizeof(ListBase), /*Group type*/
- sizeof(void*)
+ sizeof(void*),
+ sizeof(double)
};
@@ -110,6 +111,7 @@ void IDP_ResizeArray(IDProperty *prop, int newlen)
newp->type = prop->type;
newp->flag = prop->flag;
newp->data.val = prop->data.val;
+ newp->data.val2 = prop->data.val2;
return newp;
}
@@ -209,7 +211,8 @@ void IDP_UnlinkID(IDProperty *prop)
IDProperty *IDP_CopyGroup(IDProperty *prop)
{
IDProperty *newp = idp_generic_copy(prop), *link;
-
+ newp->len = prop->len;
+
for (link=prop->data.group.first; link; link=link->next) {
BLI_addtail(&newp->data.group, IDP_CopyProperty(link));
}
@@ -217,6 +220,10 @@ IDProperty *IDP_CopyGroup(IDProperty *prop)
return newp;
}
+/*
+ replaces a property with the same name in a group, or adds
+ it if the propery doesn't exist.
+*/
void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop)
{
IDProperty *loop;
@@ -224,10 +231,10 @@ void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop)
if (BSTR_EQ(loop->name, prop->name)) {
if (loop->next) BLI_insertlinkbefore(&group->data.group, loop->next, prop);
else BLI_addtail(&group->data.group, prop);
+
BLI_remlink(&group->data.group, loop);
IDP_FreeProperty(loop);
- MEM_freeN(loop);
- group->len++;
+ MEM_freeN(loop);
return;
}
}
@@ -259,7 +266,7 @@ int IDP_InsertToGroup(IDProperty *group, IDProperty *previous, IDProperty *pnew)
}
group->len++;
-
+
BLI_insertlink(&group->data.group, previous, pnew);
return 1;
}
@@ -314,7 +321,7 @@ void IDP_FreeIterBeforeEnd(void *vself)
This is because all ID Property freeing functions free only direct data (not the ID Property
struct itself), but for Groups the child properties *are* considered
direct data.*/
-void IDP_FreeGroup(IDProperty *prop)
+static void IDP_FreeGroup(IDProperty *prop)
{
IDProperty *loop, *next;
for (loop=prop->data.group.first; loop; loop=next)
@@ -345,6 +352,10 @@ IDProperty *IDP_GetProperties(ID *id, int create_if_needed)
if (create_if_needed) {
id->properties = MEM_callocN(sizeof(IDProperty), "IDProperty");
id->properties->type = IDP_GROUP;
+ /* dont overwite the data's name and type
+ * some functions might need this if they
+ * dont have a real ID, should be named elsewhere - Campbell */
+ /* strcpy(id->name, "top_level_group");*/
}
return id->properties;
}
@@ -363,10 +374,14 @@ IDProperty *IDP_New(int type, IDPropertyTemplate val, char *name)
prop = MEM_callocN(sizeof(IDProperty), "IDProperty float");
*(float*)&prop->data.val = val.f;
break;
+ case IDP_DOUBLE:
+ prop = MEM_callocN(sizeof(IDProperty), "IDProperty float");
+ *(double*)&prop->data.val = val.d;
+ break;
case IDP_ARRAY:
{
- /*for now, we only support float and int arrays*/
- if (val.array.type == IDP_FLOAT || val.array.type == IDP_INT) {
+ /*for now, we only support float and int and double arrays*/
+ if (val.array.type == IDP_FLOAT || val.array.type == IDP_INT || val.array.type == IDP_DOUBLE) {
prop = MEM_callocN(sizeof(IDProperty), "IDProperty array");
prop->len = prop->totallen = val.array.len;
prop->subtype = val.array.type;
@@ -409,10 +424,14 @@ IDProperty *IDP_New(int type, IDPropertyTemplate val, char *name)
prop->type = type;
strncpy(prop->name, name, MAX_IDPROP_NAME);
+
+ /*security null byte*/
+ prop->name[MAX_IDPROP_NAME-1] = 0;
+
return prop;
}
-/*NOTE: this will free all child properties of list arrays and groups!
+/*NOTE: this will free all child properties including list arrays and groups!
Also, note that this does NOT unlink anything! Plus it doesn't free
the actual IDProperty struct either.*/
void IDP_FreeProperty(IDProperty *prop)
@@ -430,7 +449,8 @@ void IDP_FreeProperty(IDProperty *prop)
}
}
-/*Unlinks any IDProperty<->ID linkage that might be going on.*/
+/*Unlinks any IDProperty<->ID linkage that might be going on.
+ note: currently unused.*/
void IDP_UnlinkProperty(IDProperty *prop)
{
switch (prop->type) {