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...
This commit is contained in:
Joshua Leung
2009-05-18 02:25:33 +00:00
parent e67e7049f9
commit d128e16561
3 changed files with 19 additions and 1 deletions

View File

@@ -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;
}

View File

@@ -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 */

View File

@@ -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