diff options
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 4 | ||||
-rw-r--r-- | source/blender/editors/armature/poseobject.c | 26 | ||||
-rw-r--r-- | source/blender/editors/include/ED_armature.h | 7 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_buttons.c | 27 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_armature_types.h | 12 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_armature.c | 46 |
7 files changed, 54 insertions, 73 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index cb6fef0bc30..ace1292f813 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -456,6 +456,8 @@ bPoseChannel *verify_pose_channel(bPose* pose, const char* name) chan->ikrotweight = chan->iklinweight = 0.0f; unit_m4(chan->constinv); + chan->protectflag = OB_LOCK_ROT4D; /* lock by components by default */ + BLI_addtail(&pose->chanbase, chan); return chan; @@ -1083,7 +1085,10 @@ void copy_pose_result(bPose *to, bPose *from) VECCOPY(pchanto->pose_head, pchanfrom->pose_head); VECCOPY(pchanto->pose_tail, pchanfrom->pose_tail); + + pchanto->rotmode= pchanfrom->rotmode; pchanto->flag= pchanfrom->flag; + pchanto->protectflag= pchanfrom->protectflag; } } } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index c537f9f57b0..73a1d2023a2 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1044,6 +1044,10 @@ Object *add_object(struct Scene *scene, int type) ob->rotmode= ROT_MODE_EUL; /* axis-angle must not have a 0,0,0 axis, so set y-axis as default... */ ob->rotAxis[1]= ob->drotAxis[1]= 1.0f; + /* quaternions should be 1,0,0,0 by default.... */ + ob->quat[0]= 1.0f; + /* rotation locks should be 4D for 4 component rotations by default... */ + ob->protectflag = OB_LOCK_ROT4D; base= scene_add_base(scene, ob); scene_select_base(scene, base); diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index f415eeb421f..aeb42142abd 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -1464,7 +1464,7 @@ static short pose_select_same_layer (Object *ob) bPose *pose= (ob)? ob->pose : NULL; bArmature *arm= (ob)? ob->data : NULL; bPoseChannel *pchan; - short layers= 0, changed= 0; + int layers= 0, changed= 0; if (ELEM3(NULL, ob, pose, arm)) return 0; @@ -1670,7 +1670,7 @@ static int pose_armature_layers_invoke (bContext *C, wmOperator *op, wmEvent *ev Object *ob= CTX_data_active_object(C); bArmature *arm= (ob)? ob->data : NULL; PointerRNA ptr; - int layers[16]; /* hardcoded for now - we can only have 16 armature layers, so this should be fine... */ + int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ /* sanity checking */ if (arm == NULL) @@ -1691,7 +1691,7 @@ static int pose_armature_layers_exec (bContext *C, wmOperator *op) Object *ob= CTX_data_active_object(C); bArmature *arm= (ob)? ob->data : NULL; PointerRNA ptr; - int layers[16]; /* hardcoded for now - we can only have 16 armature layers, so this should be fine... */ + int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ /* get the values set in the operator properties */ RNA_boolean_get_array(op->ptr, "layers", layers); @@ -1723,7 +1723,7 @@ void POSE_OT_armature_layers (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_boolean_layer_member(ot->srna, "layers", 16, NULL, "Layer", "Armature layers to make visible"); + RNA_def_boolean_layer_member(ot->srna, "layers", 32, NULL, "Layer", "Armature layers to make visible"); } void ARMATURE_OT_armature_layers (wmOperatorType *ot) @@ -1742,7 +1742,7 @@ void ARMATURE_OT_armature_layers (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_boolean_layer_member(ot->srna, "layers", 16, NULL, "Layer", "Armature layers to make visible"); + RNA_def_boolean_layer_member(ot->srna, "layers", 32, NULL, "Layer", "Armature layers to make visible"); } /* ------------------- */ @@ -1750,7 +1750,7 @@ void ARMATURE_OT_armature_layers (wmOperatorType *ot) /* Present a popup to get the layers that should be used */ static int pose_bone_layers_invoke (bContext *C, wmOperator *op, wmEvent *evt) { - int layers[16]; /* hardcoded for now - we can only have 16 armature layers, so this should be fine... */ + int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ /* get layers that are active already */ memset(&layers, 0, sizeof(layers)); /* set all layers to be off by default */ @@ -1760,7 +1760,7 @@ static int pose_bone_layers_invoke (bContext *C, wmOperator *op, wmEvent *evt) short bit; /* loop over the bits for this pchan's layers, adding layers where they're needed */ - for (bit= 0; bit < 16; bit++) { + for (bit= 0; bit < 32; bit++) { if (pchan->bone->layer & (1<<bit)) layers[bit]= 1; } @@ -1780,7 +1780,7 @@ static int pose_bone_layers_exec (bContext *C, wmOperator *op) Object *ob= CTX_data_active_object(C); bArmature *arm= (ob)? ob->data : NULL; PointerRNA ptr; - int layers[16]; /* hardcoded for now - we can only have 16 armature layers, so this should be fine... */ + int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ /* get the values set in the operator properties */ RNA_boolean_get_array(op->ptr, "layers", layers); @@ -1816,7 +1816,7 @@ void POSE_OT_bone_layers (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_boolean_layer_member(ot->srna, "layers", 16, NULL, "Layer", "Armature layers that bone belongs to"); + RNA_def_boolean_layer_member(ot->srna, "layers", 32, NULL, "Layer", "Armature layers that bone belongs to"); } /* ------------------- */ @@ -1824,7 +1824,7 @@ void POSE_OT_bone_layers (wmOperatorType *ot) /* Present a popup to get the layers that should be used */ static int armature_bone_layers_invoke (bContext *C, wmOperator *op, wmEvent *evt) { - int layers[16]; /* hardcoded for now - we can only have 16 armature layers, so this should be fine... */ + int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ /* get layers that are active already */ memset(&layers, 0, sizeof(layers)); /* set all layers to be off by default */ @@ -1834,7 +1834,7 @@ static int armature_bone_layers_invoke (bContext *C, wmOperator *op, wmEvent *ev short bit; /* loop over the bits for this pchan's layers, adding layers where they're needed */ - for (bit= 0; bit < 16; bit++) { + for (bit= 0; bit < 32; bit++) { if (ebone->layer & (1<<bit)) layers[bit]= 1; } @@ -1854,7 +1854,7 @@ static int armature_bone_layers_exec (bContext *C, wmOperator *op) Object *ob= CTX_data_edit_object(C); bArmature *arm= (ob)? ob->data : NULL; PointerRNA ptr; - int layers[16]; /* hardcoded for now - we can only have 16 armature layers, so this should be fine... */ + int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ /* get the values set in the operator properties */ RNA_boolean_get_array(op->ptr, "layers", layers); @@ -1890,7 +1890,7 @@ void ARMATURE_OT_bone_layers (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_boolean_layer_member(ot->srna, "layers", 16, NULL, "Layer", "Armature layers that bone belongs to"); + RNA_def_boolean_layer_member(ot->srna, "layers", 32, NULL, "Layer", "Armature layers that bone belongs to"); } /* ********************************************** */ diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index f054e229147..083884336d2 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -65,17 +65,16 @@ typedef struct EditBone their parents. Therefore any rotations specified during the animation are automatically relative to the bones' rest positions*/ int flag; - - int parNr; /* Used for retrieving values from the menu system */ + int layer; float dist, weight; float xwidth, length, zwidth; /* put them in order! transform uses this as scale */ float ease1, ease2; float rad_head, rad_tail; - short layer, segments; float oldlength; /* for envelope scaling */ - + + short segments; } EditBone; #define BONESEL_ROOT 0x10000000 diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 0eddeba6ff9..a988ceb50e7 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -521,40 +521,35 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr) split = uiLayoutSplit(layout, 0.8); switch(RNA_enum_get(ptr, "rotation_mode")) { - case ROT_MODE_XYZ: - case ROT_MODE_XZY: - case ROT_MODE_YXZ: - case ROT_MODE_YZX: - case ROT_MODE_ZXY: - case ROT_MODE_ZYX: - colsub = uiLayoutColumn(split, 1); - uiItemR(colsub, "Rotation", 0, ptr, "rotation_euler", 0); - colsub = uiLayoutColumn(split, 1); - uiItemL(colsub, "", 0); - uiItemR(colsub, "", ICON_LOCKED, ptr, "lock_rotation", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY); - break; - case ROT_MODE_QUAT: + case ROT_MODE_QUAT: /* quaternion */ colsub = uiLayoutColumn(split, 1); uiItemR(colsub, "Rotation", 0, ptr, "rotation_quaternion", 0); colsub = uiLayoutColumn(split, 1); - uiItemR(colsub, "W", 0, ptr, "lock_rotations_4d", UI_ITEM_R_TOGGLE); + uiItemR(colsub, "4L", 0, ptr, "lock_rotations_4d", UI_ITEM_R_TOGGLE); if (RNA_boolean_get(ptr, "lock_rotations_4d")) uiItemR(colsub, "", ICON_LOCKED, ptr, "lock_rotation_w", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY); else uiItemL(colsub, "", 0); uiItemR(colsub, "", ICON_LOCKED, ptr, "lock_rotation", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY); break; - case ROT_MODE_AXISANGLE: + case ROT_MODE_AXISANGLE: /* axis angle */ colsub = uiLayoutColumn(split, 1); uiItemR(colsub, "Rotation", 0, ptr, "rotation_axis_angle", 0); colsub = uiLayoutColumn(split, 1); - uiItemR(colsub, "W", 0, ptr, "lock_rotations_4d", UI_ITEM_R_TOGGLE); + uiItemR(colsub, "4L", 0, ptr, "lock_rotations_4d", UI_ITEM_R_TOGGLE); if (RNA_boolean_get(ptr, "lock_rotations_4d")) uiItemR(colsub, "", ICON_LOCKED, ptr, "lock_rotation_w", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY); else uiItemL(colsub, "", 0); uiItemR(colsub, "", ICON_LOCKED, ptr, "lock_rotation", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY); break; + default: /* euler rotations */ + colsub = uiLayoutColumn(split, 1); + uiItemR(colsub, "Rotation", 0, ptr, "rotation_euler", 0); + colsub = uiLayoutColumn(split, 1); + uiItemL(colsub, "", 0); + uiItemR(colsub, "", ICON_LOCKED, ptr, "lock_rotation", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY); + break; } uiItemR(layout, "", 0, ptr, "rotation_mode", 0); diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h index 0f0da7fe807..ea549f9aeba 100644 --- a/source/blender/makesdna/DNA_armature_types.h +++ b/source/blender/makesdna/DNA_armature_types.h @@ -66,8 +66,9 @@ typedef struct Bone { float rad_head, rad_tail; /* radius for head/tail sphere, defining deform as well, parent->rad_tip overrides rad_head*/ float size[3]; /* patch for upward compat, UNUSED! */ - short layer; + int layer; /* layers that bone appears on */ short segments; /* for B-bones */ + short pad[3]; } Bone; typedef struct bArmature { @@ -78,8 +79,8 @@ typedef struct bArmature { ListBase chainbase; ListBase *edbo; /* editbone listbase, we use pointer so we can check state */ - Bone *act_bone; - void *act_edbone; + Bone *act_bone; /* active bone (when not in editmode) */ + void *act_edbone; /* active editbone (in editmode) */ void *sketch; /* sketch struct for etch-a-ton */ @@ -87,7 +88,10 @@ typedef struct bArmature { int drawtype; short deformflag; short pathflag; - short layer, layer_protected; /* for buttons to work, both variables in this order together */ + + int pad; + + int layer, layer_protected; /* for buttons to work, both variables in this order together */ short ghostep, ghostsize; /* number of frames to ghosts to show, and step between them */ short ghosttype, pathsize; /* ghost drawing options and number of frames between points of path */ int ghostsf, ghostef; /* start and end frames of ghost-drawing range */ diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index a5b21d5447d..7986da818c8 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -139,19 +139,19 @@ static IDProperty *rna_EditBone_idproperties(PointerRNA *ptr, int create) return ebone->prop; } -static void rna_bone_layer_set(short *layer, const int *values) +static void rna_bone_layer_set(int *layer, const int *values) { int i, tot= 0; /* ensure we always have some layer selected */ - for(i=0; i<16; i++) + for(i=0; i<32; i++) if(values[i]) tot++; if(tot==0) return; - for(i=0; i<16; i++) { + for(i=0; i<32; i++) { if(values[i]) *layer |= (1<<i); else *layer &= ~(1<<i); } @@ -169,14 +169,14 @@ static void rna_Armature_layer_set(PointerRNA *ptr, const int *values) int i, tot= 0; /* ensure we always have some layer selected */ - for(i=0; i<20; i++) + for(i=0; i<32; i++) if(values[i]) tot++; if(tot==0) return; - for(i=0; i<20; i++) { + for(i=0; i<32; i++) { if(values[i]) arm->layer |= (1<<i); else arm->layer &= ~(1<<i); } @@ -236,28 +236,7 @@ static void rna_Bone_name_set(PointerRNA *ptr, const char *value) ED_armature_bone_rename(arm, oldname, newname); } -static void rna_EditBone_layer_get(PointerRNA *ptr, int values[16]) -{ - EditBone *data= (EditBone*)(ptr->data); - values[0]= ((data->layer & (1<<0)) != 0); - values[1]= ((data->layer & (1<<1)) != 0); - values[2]= ((data->layer & (1<<2)) != 0); - values[3]= ((data->layer & (1<<3)) != 0); - values[4]= ((data->layer & (1<<4)) != 0); - values[5]= ((data->layer & (1<<5)) != 0); - values[6]= ((data->layer & (1<<6)) != 0); - values[7]= ((data->layer & (1<<7)) != 0); - values[8]= ((data->layer & (1<<8)) != 0); - values[9]= ((data->layer & (1<<9)) != 0); - values[10]= ((data->layer & (1<<10)) != 0); - values[11]= ((data->layer & (1<<11)) != 0); - values[12]= ((data->layer & (1<<12)) != 0); - values[13]= ((data->layer & (1<<13)) != 0); - values[14]= ((data->layer & (1<<14)) != 0); - values[15]= ((data->layer & (1<<15)) != 0); -} - -static void rna_EditBone_layer_set(PointerRNA *ptr, const int values[16]) +static void rna_EditBone_layer_set(PointerRNA *ptr, const int values[]) { EditBone *data= (EditBone*)(ptr->data); rna_bone_layer_set(&data->layer, values); @@ -405,8 +384,8 @@ static void rna_def_bone_common(StructRNA *srna, int editbone) /* flags */ prop= RNA_def_property(srna, "layer", PROP_BOOLEAN, PROP_LAYER_MEMBER); RNA_def_property_boolean_sdna(prop, NULL, "layer", 1); - RNA_def_property_array(prop, 16); - if(editbone) RNA_def_property_boolean_funcs(prop, "rna_EditBone_layer_get", "rna_EditBone_layer_set"); + RNA_def_property_array(prop, 32); + if(editbone) RNA_def_property_boolean_funcs(prop, NULL, "rna_EditBone_layer_set"); else RNA_def_property_boolean_funcs(prop, NULL, "rna_Bone_layer_set"); RNA_def_property_ui_text(prop, "Layers", "Layers bone exists in"); RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); @@ -763,11 +742,6 @@ static void rna_def_armature(BlenderRNA *brna) rna_def_armature_edit_bones(brna, prop); /* Enum values */ -// prop= RNA_def_property(srna, "rest_position", PROP_BOOLEAN, PROP_NONE); -// RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_RESTPOS); -// RNA_def_property_ui_text(prop, "Rest Position", "Show Armature in Rest Position. No posing possible."); -// RNA_def_property_update(prop, 0, "rna_Armature_update_data"); - prop= RNA_def_property(srna, "pose_position", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); RNA_def_property_enum_items(prop, prop_pose_position_items); @@ -801,7 +775,7 @@ static void rna_def_armature(BlenderRNA *brna) /* layer */ prop= RNA_def_property(srna, "layer", PROP_BOOLEAN, PROP_LAYER_MEMBER); RNA_def_property_boolean_sdna(prop, NULL, "layer", 1); - RNA_def_property_array(prop, 16); + 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"); @@ -810,7 +784,7 @@ static void rna_def_armature(BlenderRNA *brna) /* layer protection */ prop= RNA_def_property(srna, "layer_protection", PROP_BOOLEAN, PROP_LAYER); RNA_def_property_boolean_sdna(prop, NULL, "layer_protected", 1); - RNA_def_property_array(prop, 16); + RNA_def_property_array(prop, 32); RNA_def_property_ui_text(prop, "Layer Proxy Protection", "Protected layers in Proxy Instances are restored to Proxy settings on file reload and undo."); RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); |