diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index a4a8f254f1d..d7f6a2eb64c 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -43,7 +43,7 @@ struct bContext; struct ReportList; #define BLENDER_VERSION 250 -#define BLENDER_SUBVERSION 12 +#define BLENDER_SUBVERSION 13 #define BLENDER_MINVERSION 250 #define BLENDER_MINSUBVERSION 0 diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 30a5b647fe1..141fcce96ac 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -6497,6 +6497,35 @@ static void do_version_fcurves_radians_degrees_250(ListBase *lb, char *propname) } } } + +static void do_version_constraints_radians_degrees_250(ListBase *lb) +{ + bConstraint *con; + + /* fcurves for this are not converted, assumption is these were unlikely to be used */ + for (con=lb->first; con; con=con->next) { + if(con->type==CONSTRAINT_TYPE_RIGIDBODYJOINT) { + bRigidBodyJointConstraint *data = con->data; + data->axX *= M_PI/180.0; + data->axY *= M_PI/180.0; + data->axZ *= M_PI/180.0; + } + else if(con->type==CONSTRAINT_TYPE_KINEMATIC) { + bKinematicConstraint *data = con->data; + data->poleangle *= M_PI/180.0; + } + else if(con->type==CONSTRAINT_TYPE_ROTLIMIT) { + bRotLimitConstraint *data = con->data; + + data->xmin *= M_PI/180.0; + data->xmax *= M_PI/180.0; + data->ymin *= M_PI/180.0; + data->ymax *= M_PI/180.0; + data->zmin *= M_PI/180.0; + data->zmax *= M_PI/180.0; + } + } +} static void do_versions(FileData *fd, Library *lib, Main *main) { @@ -10552,56 +10581,34 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* put 2.50 compatibility code here until next subversion bump */ if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 13)) { - /* still missing: - Pose channel IK (min x/y/z, max x/y/z) - NOTE: if you do more conversion, be sure to do it outside of this and + /* NOTE: if you do more conversion, be sure to do it outside of this and increase subversion again, otherwise it will not be correct */ - bAction *act; Object *ob; - - float rads_per_deg = M_PI / 180.0; + bAction *act; /* convert degrees to radians for internal use */ for (ob=main->object.first; ob; ob=ob->id.next) { AnimData *adt = BKE_animdata_from_id((ID *)ob); - bConstraint *con; + bPoseChannel *pchan; - if(adt) { + if (adt) { do_version_fcurves_radians_degrees_250(&adt->drivers, "rotation_euler"); do_version_fcurves_radians_degrees_250(&adt->drivers, "delta_rotation_euler"); do_version_fcurves_radians_degrees_250(&adt->drivers, "pole_angle"); } - - for (con=ob->constraints.first; con; con=con->next) { - - if(con->type==CONSTRAINT_TYPE_RIGIDBODYJOINT) { - bRigidBodyJointConstraint *data = con->data; - data->axX *= rads_per_deg; - data->axY *= rads_per_deg; - data->axZ *= rads_per_deg; - } - else if(con->type==CONSTRAINT_TYPE_KINEMATIC) { - bKinematicConstraint *data = con->data; - data->poleangle *= rads_per_deg; - } - else if(con->type==CONSTRAINT_TYPE_ROTLIMIT) { - bRotLimitConstraint *data = con->data; - if(adt) { - do_version_fcurves_radians_degrees_250(&adt->action->curves, "minimum_x"); - do_version_fcurves_radians_degrees_250(&adt->action->curves, "minimum_y"); - do_version_fcurves_radians_degrees_250(&adt->action->curves, "minimum_z"); - do_version_fcurves_radians_degrees_250(&adt->action->curves, "maximum_x"); - do_version_fcurves_radians_degrees_250(&adt->action->curves, "maximum_y"); - do_version_fcurves_radians_degrees_250(&adt->action->curves, "maximum_z"); - } + do_version_constraints_radians_degrees_250(&ob->constraints); - data->xmin *= rads_per_deg; - data->xmax *= rads_per_deg; - data->ymin *= rads_per_deg; - data->ymax *= rads_per_deg; - data->zmin *= rads_per_deg; - data->zmax *= rads_per_deg; + if (ob->pose) { + for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) { + pchan->limitmin[0] *= M_PI/180.0; + pchan->limitmin[1] *= M_PI/180.0; + pchan->limitmin[2] *= M_PI/180.0; + pchan->limitmax[0] *= M_PI/180.0; + pchan->limitmax[1] *= M_PI/180.0; + pchan->limitmax[2] *= M_PI/180.0; + do_version_constraints_radians_degrees_250(&pchan->constraints); } } } diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index b7a656eee1e..9ff90d0c52a 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -37,6 +37,8 @@ #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "BLI_math.h" + #include "WM_types.h" #ifdef RNA_RUNTIME @@ -44,7 +46,6 @@ #include "BIK_api.h" #include "BKE_action.h" #include "BKE_armature.h" -#include "BLI_math.h" #include "DNA_userdef_types.h" @@ -860,44 +861,44 @@ static void rna_def_pose_channel(BlenderRNA *brna) RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update"); - prop= RNA_def_property(srna, "ik_min_x", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "ik_min_x", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "limitmin[0]"); - RNA_def_property_range(prop, -180.0f, 0.0f); + RNA_def_property_range(prop, -M_PI, 0.0f); RNA_def_property_ui_text(prop, "IK X Minimum", "Minimum angles for IK Limit"); RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update"); - prop= RNA_def_property(srna, "ik_max_x", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "ik_max_x", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "limitmax[0]"); - RNA_def_property_range(prop, 0.0f, 180.0f); + RNA_def_property_range(prop, 0.0f, M_PI); RNA_def_property_ui_text(prop, "IK X Maximum", "Maximum angles for IK Limit"); RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update"); - prop= RNA_def_property(srna, "ik_min_y", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "ik_min_y", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "limitmin[1]"); - RNA_def_property_range(prop, -180.0f, 0.0f); + RNA_def_property_range(prop, -M_PI, 0.0f); RNA_def_property_ui_text(prop, "IK Y Minimum", "Minimum angles for IK Limit"); RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update"); - prop= RNA_def_property(srna, "ik_max_y", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "ik_max_y", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "limitmax[1]"); - RNA_def_property_range(prop, 0.0f, 180.0f); + RNA_def_property_range(prop, 0.0f, M_PI); RNA_def_property_ui_text(prop, "IK Y Maximum", "Maximum angles for IK Limit"); RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update"); - prop= RNA_def_property(srna, "ik_min_z", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "ik_min_z", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "limitmin[2]"); - RNA_def_property_range(prop, -180.0f, 0.0f); + RNA_def_property_range(prop, -M_PI, 0.0f); RNA_def_property_ui_text(prop, "IK Z Minimum", "Minimum angles for IK Limit"); RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update"); - prop= RNA_def_property(srna, "ik_max_z", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "ik_max_z", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "limitmax[2]"); - RNA_def_property_range(prop, 0.0f, 180.0f); + RNA_def_property_range(prop, 0.0f, M_PI); RNA_def_property_ui_text(prop, "IK Z Maximum", "Maximum angles for IK Limit"); RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");