From d128e1656169db09efb6cc11208cc98f5bbc54bc Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 18 May 2009 02:25:33 +0000 Subject: [PATCH] 2.5 - Bones can now have custom properties (as ID-Props) Still need to find a way to enable RNA access for these though, since RNA access to ID-Props stored in data seems to be broken... --- source/blender/blenloader/intern/readfile.c | 11 ++++++++++- source/blender/blenloader/intern/writefile.c | 5 +++++ source/blender/makesdna/DNA_action_types.h | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index fd9da2059e1..67887769d38 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2176,9 +2176,12 @@ static void direct_link_constraints(FileData *fd, ListBase *lb) if (cons->type == CONSTRAINT_TYPE_PYTHON) { bPythonConstraint *data= cons->data; + link_list(fd, &data->targets); + data->prop = newdataadr(fd, data->prop); - IDP_DirectLinkProperty(data->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); + if (data->prop) + IDP_DirectLinkProperty(data->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); } } } @@ -3417,7 +3420,13 @@ static void direct_link_pose(FileData *fd, bPose *pose) pchan->bone= NULL; pchan->parent= newdataadr(fd, pchan->parent); pchan->child= newdataadr(fd, pchan->child); + direct_link_constraints(fd, &pchan->constraints); + + pchan->prop = newdataadr(fd, pchan->prop); + if (pchan->prop) + IDP_DirectLinkProperty(pchan->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); + pchan->iktree.first= pchan->iktree.last= NULL; pchan->path= NULL; } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index b690c708dc3..943e23861ad 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -956,6 +956,11 @@ static void write_pose(WriteData *wd, bPose *pose) /* Write channels */ for (chan=pose->chanbase.first; chan; chan=chan->next) { + /* Write ID Properties -- and copy this comment EXACTLY for easy finding + of library blocks that implement this.*/ + if (chan->prop) + IDP_WriteProperty(chan->prop, wd); + write_constraints(wd, &chan->constraints); /* prevent crashes with autosave, when a bone duplicated in editmode has not yet been assigned to its posechannel */ diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index cf54d69bb8b..7e54045b5e4 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -52,6 +52,9 @@ struct Object; */ typedef struct bPoseChannel { struct bPoseChannel *next, *prev; + + IDProperty *prop; /* User-Defined Properties on this PoseChannel */ + ListBase constraints;/* Constraints that act on this PoseChannel */ char name[32]; /* Channels need longer names than normal blender objects */ @@ -419,3 +422,4 @@ typedef enum ACHAN_FLAG { #endif +