diff options
author | Ton Roosendaal <ton@blender.org> | 2006-11-16 13:24:26 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-11-16 13:24:26 +0300 |
commit | 24b2e0422e68effb50546c7cdfd6112537612345 (patch) | |
tree | 89e272292245ae18568a469d5a85b84f650ab3c0 | |
parent | 7b71b524ed45dabd9f9ea903f723bc38a892db02 (diff) |
1)
Bugfix: Beziers in curve didn't calculate the tilt values correctly for
the endpoint and not for all handle types. That way deforming curves didn't
extend the tilted deform either. (IRC report by Jahka)
2)
If you setup a Proxy for Armatures, the protected bones now have an error
pupup for buttons and for some of the tools in 3d window (constraint edit
mostly).
Also the Bones Panel shows a note when the bone is not editable.
-rw-r--r-- | source/blender/src/buttons_editing.c | 36 | ||||
-rw-r--r-- | source/blender/src/editconstraint.c | 6 | ||||
-rw-r--r-- | source/blender/src/poseobject.c | 43 |
3 files changed, 80 insertions, 5 deletions
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 094cf9260a4..ce6ff2d56f8 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -3303,17 +3303,35 @@ static void editing_panel_armature_bones(Object *ob, bArmature *arm) } +/* sets warning popup for buttons, and returns 1 for protected proxy posechannels */ +static int ob_arm_bone_pchan_lock(Object *ob, bArmature *arm, Bone *bone, bPoseChannel *pchan) +{ + /* ob lib case is already set globally */ + if(ob->id.lib) + return 0; + if(arm->id.lib) { + if(pchan==NULL) + uiSetButLock(1, "Can't edit library data"); + else if(ob->proxy && bone->layer & arm->layer_protected) { + uiSetButLock(1, "Can't edit protected proxy channel"); + return 1; + } + else + uiClearButLock(); + } + return 0; +} + static void editing_panel_pose_bones(Object *ob, bArmature *arm) { uiBlock *block; uiBut *but; bPoseChannel *pchan; Bone *curBone; - int by=180, a; + int by, a; int index, zerodof, zerolimit; /* Draw the bone name block */ - block= uiNewBlock(&curarea->uiblocks, "editing_panel_pose_bones", UI_EMBOSS, UI_HELV, curarea->win); if(uiNewPanel(curarea, block, "Armature Bones", "Editing", 640, 0, 318, 204)==0) return; @@ -3321,12 +3339,16 @@ static void editing_panel_pose_bones(Object *ob, bArmature *arm) /* so first we make it default height */ uiNewPanelHeight(block, 204); - uiDefBut(block, LABEL, 0, "Selected Bones", 0,by,158,18, 0, 0, 0, 0, 0, "Only show in Armature Editmode/Posemode"); - by-=20; + uiDefBut(block, LABEL, 0, "Selected Bones", 0,180,158,18, 0, 0, 0, 0, 0, "Only show in Armature Editmode/Posemode"); + by= 160; + for (pchan=ob->pose->chanbase.first, index=0; pchan; pchan=pchan->next, index++){ curBone= pchan->bone; if ((curBone->flag & BONE_SELECTED) && (curBone->layer & arm->layer)) { - + + if(ob_arm_bone_pchan_lock(ob, arm, curBone, pchan)) + uiDefBut(block, LABEL, 0, "Proxy Locked", 160, 180,150,18, NULL, 1, 0, 0, 0, ""); + /* Bone naming button */ uiBlockBeginAlign(block); but=uiDefBut(block, TEX, REDRAWVIEW3D, "BO:", -10,by,117,19, curBone->name, 0, 24, 0, 0, "Change the bone name"); @@ -3347,7 +3369,9 @@ static void editing_panel_pose_bones(Object *ob, bArmature *arm) uiDefButBitI(block, TOG, BONE_HINGE, B_ARM_RECALCDATA, "Hinge", -10,by-38,80,19, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Don't inherit rotation or scale from parent Bone"); uiDefButBitI(block, TOGN, BONE_NO_DEFORM, B_ARM_RECALCDATA, "Deform", 70, by-38, 80, 19, &curBone->flag, 0.0, 0.0, 0.0, 0.0, "Indicate if Bone deforms geometry"); uiDefButBitI(block, TOG, BONE_MULT_VG_ENV, B_ARM_RECALCDATA, "Mult", 150,by-38,80,19, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Multiply Bone Envelope with VertexGroup"); + ob_arm_bone_pchan_lock(ob, arm, curBone, pchan); uiDefIDPoinBut(block, test_obpoin_but, ID_OB, REDRAWVIEW3D, "OB:", 230,by-38,100,19, &pchan->custom, "Object that defines custom draw type for this Bone"); + ob_arm_bone_pchan_lock(ob, arm, curBone, NULL); /* layers */ uiBlockBeginAlign(block); @@ -3366,6 +3390,8 @@ static void editing_panel_pose_bones(Object *ob, bArmature *arm) by-= 20; + ob_arm_bone_pchan_lock(ob, arm, curBone, pchan); + /* DOFs only for IK chains */ zerodof = 1; zerolimit = 1; diff --git a/source/blender/src/editconstraint.c b/source/blender/src/editconstraint.c index 10a930b9ebc..178acf51b1d 100644 --- a/source/blender/src/editconstraint.c +++ b/source/blender/src/editconstraint.c @@ -619,6 +619,12 @@ void add_constraint(int only_IK) pchanact= get_active_posechannel(ob); if(pchanact==NULL) return; + /* check protection */ + if(OB_IS_PROXY(ob) && (pchanact->bone->layer & arm->layer_protected)) { + error("Bone is Proxy protected"); + return; + } + /* find selected bone */ for(pchansel= ob->pose->chanbase.first; pchansel; pchansel= pchansel->next) { if(pchansel!=pchanact) diff --git a/source/blender/src/poseobject.c b/source/blender/src/poseobject.c index eb0da136a0c..432c7d9d4f0 100644 --- a/source/blender/src/poseobject.c +++ b/source/blender/src/poseobject.c @@ -171,6 +171,33 @@ bPoseChannel *get_active_posechannel (Object *ob) return NULL; } +/* if a selected or active bone is protected, throw error and return 1 */ +/* only_selected==1 : the active bone is allowed to be protected */ +static int pose_has_protected_selected(Object *ob, int only_selected) +{ + + /* check protection */ + if(OB_IS_PROXY(ob)) { + bPoseChannel *pchan; + bArmature *arm= ob->data; + + for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { + if(pchan->bone && (pchan->bone->layer & arm->layer)) { + if(pchan->bone->layer & arm->layer_protected) { + if(only_selected && (pchan->bone->flag & BONE_ACTIVE)); + else if(pchan->bone->flag & (BONE_ACTIVE|BONE_SELECTED)) + break; + } + } + } + if(pchan) { + error("Cannot change Proxy protected bones"); + return 1; + } + } + return 0; +} + /* only for real IK, not for auto-IK */ int pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan) { @@ -367,6 +394,9 @@ void pose_clear_IK(void) if(!ob && !ob->pose) return; if(ob==G.obedit || (ob->flag & OB_POSEMODE)==0) return; + if(pose_has_protected_selected(ob, 0)) + return; + if(okee("Remove IK constraint(s)")==0) return; for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { @@ -405,6 +435,9 @@ void pose_clear_constraints(void) if(!ob && !ob->pose) return; if(ob==G.obedit || (ob->flag & OB_POSEMODE)==0) return; + if(pose_has_protected_selected(ob, 0)) + return; + if(okee("Remove Constraints")==0) return; /* find active */ @@ -446,6 +479,10 @@ void pose_copy_menu(void) } if(pchan==NULL) return; + + if(pose_has_protected_selected(ob, 1)) + return; + pchanact= pchan; i= BLI_countlist(&(pchanact->constraints)); /* if there are 24 or less, allow for the user to select constraints */ @@ -794,6 +831,9 @@ void pose_flip_names(void) if(!ob && !ob->pose) return; if(ob==G.obedit || (ob->flag & OB_POSEMODE)==0) return; + if(pose_has_protected_selected(ob, 0)) + return; + for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { if(arm->layer & pchan->bone->layer) { if(pchan->bone->flag & (BONE_ACTIVE|BONE_SELECTED)) { @@ -876,6 +916,9 @@ void pose_movetolayer(void) if(ob->flag & OB_POSEMODE) { bPoseChannel *pchan; + if(pose_has_protected_selected(ob, 0)) + return; + for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { if(arm->layer & pchan->bone->layer) { if(pchan->bone->flag & BONE_SELECTED) |