[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20247] branches/blender2.5/blender/source /blender: 2.5 - Bones can now have custom properties (as ID-Props)

Joshua Leung aligorith at gmail.com
Mon May 18 04:25:33 CEST 2009


Revision: 20247
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20247
Author:   aligorith
Date:     2009-05-18 04:25:33 +0200 (Mon, 18 May 2009)

Log Message:
-----------
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...

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
    branches/blender2.5/blender/source/blender/blenloader/intern/writefile.c
    branches/blender2.5/blender/source/blender/makesdna/DNA_action_types.h

Modified: branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c	2009-05-18 02:23:20 UTC (rev 20246)
+++ branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c	2009-05-18 02:25:33 UTC (rev 20247)
@@ -2176,9 +2176,12 @@
 		
 		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 @@
 		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;
 	}

Modified: branches/blender2.5/blender/source/blender/blenloader/intern/writefile.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenloader/intern/writefile.c	2009-05-18 02:23:20 UTC (rev 20246)
+++ branches/blender2.5/blender/source/blender/blenloader/intern/writefile.c	2009-05-18 02:25:33 UTC (rev 20247)
@@ -956,6 +956,11 @@
 
 	/* 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 */

Modified: branches/blender2.5/blender/source/blender/makesdna/DNA_action_types.h
===================================================================
--- branches/blender2.5/blender/source/blender/makesdna/DNA_action_types.h	2009-05-18 02:23:20 UTC (rev 20246)
+++ branches/blender2.5/blender/source/blender/makesdna/DNA_action_types.h	2009-05-18 02:25:33 UTC (rev 20247)
@@ -52,6 +52,9 @@
  */
 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 @@
 
 #endif
 
+





More information about the Bf-blender-cvs mailing list