diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-11-24 17:05:53 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-11-24 17:05:53 +0300 |
commit | c7c034fedb87e0ff3cf80f4f388bacad51434617 (patch) | |
tree | 29fcd52b87612075e63632b7c5c5523883505ba1 | |
parent | 40d7da495e67b9230354a217d8ec0f36f86b5685 (diff) |
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.
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 4 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 16 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_armature.c | 16 |
3 files changed, 27 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index b5fde5329df..1943c82766e 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1456,10 +1456,6 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected 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); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 0e1bd6cc5e6..419ef90ab3a 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2213,13 +2213,21 @@ static void lib_link_pose(FileData *fd, Object *ob, bPose *pose) 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) { diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 71e4f0fdfe3..444c2be67cf 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -117,6 +117,20 @@ void rna_Armature_edit_bone_remove(bArmature *arm, ReportList *reports, EditBone 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 @@ static void rna_def_armature(BlenderRNA *brna) 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 */ |