From 79c0360e885ae5c167c075600b66431402e340c9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 11 Feb 2008 18:26:19 +0000 Subject: IDP_CopyGroup wasn't copying the length, thanks Caedes for finding this one --- source/blender/blenkernel/intern/idprop.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/idprop.c') diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index bf2a3aae11a..85144a535d3 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -212,7 +212,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)); } -- cgit v1.2.3 From f312611a924304bf7048abbb9f5a4dc7895a9c7f Mon Sep 17 00:00:00 2001 From: Joseph Eagar Date: Sat, 23 Feb 2008 02:12:50 +0000 Subject: =ID Property Bugfix= There was an extraneous line causing ID property groups to have the wrong length, causing crashes in code that relied on it. This commit both fixes that and adds a version check to fix group lengths for older .blends. The subversion was incremented to 15 for this change. --- source/blender/blenkernel/intern/idprop.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/idprop.c') diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 85144a535d3..8ac0ff77832 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -228,10 +228,11 @@ 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++; + return; } } -- cgit v1.2.3 From 5d0a207ecb843c4c73be897cfccbf3a0d2db574b Mon Sep 17 00:00:00 2001 From: Chris Want Date: Wed, 16 Apr 2008 22:40:48 +0000 Subject: Patch from GSR that a) fixes a whole bunch of GPL/BL license blocks that were previously missed; and b) greatly increase my ohloh stats! --- source/blender/blenkernel/intern/idprop.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'source/blender/blenkernel/intern/idprop.c') diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 8ac0ff77832..2ef2f3a1b77 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -1,15 +1,12 @@ /** * $Id: idprop.c * - * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** + * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. The Blender - * Foundation also sells licenses for use in proprietary software under - * the Blender License. See http://www.blender.org/BL/ for information - * about this. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,7 +22,7 @@ * * Contributor(s): Joseph Eagar * - * ***** END GPL/BL DUAL LICENSE BLOCK ***** + * ***** END GPL LICENSE BLOCK ***** */ #include "DNA_listBase.h" -- cgit v1.2.3 From 0118a8237979c42e4d748ce79a8048c4b9382d17 Mon Sep 17 00:00:00 2001 From: Joseph Eagar Date: Thu, 24 Jul 2008 19:22:17 +0000 Subject: added support for doubles to the id property code, and made the python code use them by default --- source/blender/blenkernel/intern/idprop.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'source/blender/blenkernel/intern/idprop.c') diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 2ef2f3a1b77..b16f52571f6 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) }; @@ -365,10 +366,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; @@ -411,6 +416,10 @@ 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; } -- cgit v1.2.3 From 2a331067cc52693aa903a0487be29c93298c4b8b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 29 Sep 2008 17:08:11 +0000 Subject: resolve some compiler warnings with intel c/c++ compiler * subsurf code had a lot of unused variables, removed these where they are obviously not needed. commented if they could be useful later. * some variables declorations hide existing variables (many of these left), but fixed some that could cause confusion. * removed unused vars * obscure python memory leak with colorband. * make_sample_tables had a loop running wasnt used. * if 0'd functions in arithb.c that are not used yet. * made many functions static --- source/blender/blenkernel/intern/idprop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/idprop.c') diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index b16f52571f6..0a140ebaba1 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -317,7 +317,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) -- cgit v1.2.3 From 2ad7aa100dfdfd2e9494db4e5a2961d6d10ec582 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 5 Oct 2008 01:15:58 +0000 Subject: Fix for bug #17762: id property double type did not get copied correct. --- source/blender/blenkernel/intern/idprop.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/blenkernel/intern/idprop.c') diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 0a140ebaba1..dd3e34c51e7 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -111,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; } -- cgit v1.2.3 From 16f199bda3aa6a55218be43a9afc953a1e059e55 Mon Sep 17 00:00:00 2001 From: Joseph Eagar Date: Mon, 6 Oct 2008 10:24:32 +0000 Subject: one-liner fix for id property duplication bug --- source/blender/blenkernel/intern/idprop.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'source/blender/blenkernel/intern/idprop.c') diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index dd3e34c51e7..f83f66daa85 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -220,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; @@ -230,8 +234,7 @@ void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop) BLI_remlink(&group->data.group, loop); IDP_FreeProperty(loop); - MEM_freeN(loop); - + MEM_freeN(loop); return; } } @@ -263,7 +266,7 @@ int IDP_InsertToGroup(IDProperty *group, IDProperty *previous, IDProperty *pnew) } group->len++; - + BLI_insertlink(&group->data.group, previous, pnew); return 1; } @@ -349,6 +352,7 @@ 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; + strcpy(id->name, "top_level_group"); } return id->properties; } @@ -424,7 +428,7 @@ IDProperty *IDP_New(int type, IDPropertyTemplate val, char *name) 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) @@ -442,7 +446,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) { -- cgit v1.2.3 From 53e046157dc38f841f5e879cfc9c766506d4834a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 8 Oct 2008 09:27:26 +0000 Subject: fix for a bug where getting ID props would rename the datablock (including its type), then crash. http://blenderartists.org/forum/showthread.php?p=1228670#post1228670 --- source/blender/blenkernel/intern/idprop.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/idprop.c') diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index f83f66daa85..79ecbf09f55 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -352,7 +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; - strcpy(id->name, "top_level_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; } -- cgit v1.2.3