[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33284] trunk/blender/source/blender: Fix #24782: proxy armature Layer state not saved with file.

Brecht Van Lommel brechtvanlommel at pandora.be
Wed Nov 24 15:05:53 CET 2010


Revision: 33284
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33284
Author:   blendix
Date:     2010-11-24 15:05:53 +0100 (Wed, 24 Nov 2010)

Log Message:
-----------
Fix #24782: proxy armature Layer state not saved with file. Was in 2.4x but
not ported to 2.5x, implemented a bit different now to fit RNA better.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/armature.c
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/makesrna/intern/rna_armature.c

Modified: trunk/blender/source/blender/blenkernel/intern/armature.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/armature.c	2010-11-24 14:05:09 UTC (rev 33283)
+++ trunk/blender/source/blender/blenkernel/intern/armature.c	2010-11-24 14:05:53 UTC (rev 33284)
@@ -1456,10 +1456,6 @@
 	if(error)
 		return;
 	
-	/* exception, armature local layer should be proxied too */
-	if (pose->proxy_layer)
-		((bArmature *)ob->data)->layer= pose->proxy_layer;
-	
 	/* clear all transformation values from library */
 	rest_pose(frompose);
 	

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2010-11-24 14:05:09 UTC (rev 33283)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2010-11-24 14:05:53 UTC (rev 33284)
@@ -2213,13 +2213,21 @@
 	if (!pose || !arm)
 		return;
 	
+
 	/* always rebuild to match proxy or lib changes */
 	rebuild= ob->proxy || (ob->id.lib==NULL && arm->id.lib);
 
-	if (ob->proxy && pose->proxy_act_bone[0]) {
-		Bone *bone = get_named_bone(arm, pose->proxy_act_bone);
-		if (bone)
-			arm->act_bone = bone;
+	if(ob->proxy) {
+		/* sync proxy layer */
+		if(pose->proxy_layer)
+			arm->layer = pose->proxy_layer;
+		
+		/* sync proxy active bone */
+		if(pose->proxy_act_bone[0]) {
+			Bone *bone = get_named_bone(arm, pose->proxy_act_bone);
+			if (bone)
+				arm->act_bone = bone;
+		}
 	}
 
 	for (pchan = pose->chanbase.first; pchan; pchan=pchan->next) {

Modified: trunk/blender/source/blender/makesrna/intern/rna_armature.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_armature.c	2010-11-24 14:05:09 UTC (rev 33283)
+++ trunk/blender/source/blender/makesrna/intern/rna_armature.c	2010-11-24 14:05:53 UTC (rev 33284)
@@ -117,6 +117,20 @@
 	ED_armature_edit_bone_remove(arm, ebone);
 }
 
+static void rna_Armature_update_layers(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+	bArmature *arm= ptr->id.data;
+	Object *ob;
+
+	/* proxy lib exception, store it here so we can restore layers on file
+	   load, since it would otherwise get lost due to being linked data */
+	for(ob = bmain->object.first; ob; ob=ob->id.next)
+		if(ob->data == arm && ob->pose)
+			ob->pose->proxy_layer = arm->layer;
+
+	WM_main_add_notifier(NC_GEOM|ND_DATA, arm);
+}
+
 static void rna_Armature_redraw_data(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
 	ID *id= ptr->id.data;
@@ -810,7 +824,7 @@
 	RNA_def_property_array(prop, 32);
 	RNA_def_property_ui_text(prop, "Visible Layers", "Armature layer visibility");
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_Armature_layer_set");
-	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Armature_redraw_data");
+	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Armature_update_layers");
 	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
 	
 		/* layer protection */





More information about the Bf-blender-cvs mailing list