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.
This commit is contained in:
2010-11-24 14:05:53 +00:00
parent 40d7da495e
commit c7c034fedb
3 changed files with 27 additions and 9 deletions

View File

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

View File

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

View File

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