From 7e0f9229d6e9133338c6e5170699722989b1b8d5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 16 Nov 2010 01:19:37 +0000 Subject: fix for fix, r33086. - incorrect range check broke ZYX euler rotations, use MIN/MAX constants so this doesn't happen again. - BGE Armature PyAPI also wasn't using correct min/max with rotation modes. - clamp on file read rather then when calling the rotation functions, so developers don't use invalid args without realizing it. - added assert() checks for debug builds so invalid axis constants don't slip through. --- source/blender/blenloader/intern/readfile.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/blender/blenloader') diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 37181cb3a06..fd474e169b2 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3705,6 +3705,9 @@ static void direct_link_pose(FileData *fd, bPose *pose) pchan->iktree.first= pchan->iktree.last= NULL; pchan->path= NULL; + + /* incase this value changes in future, clamp else we get undefined behavior */ + CLAMP(pchan->rotmode, ROT_MODE_MIN, ROT_MODE_MAX); } pose->ikdata = NULL; if (pose->ikparam != NULL) { @@ -4111,6 +4114,9 @@ static void direct_link_object(FileData *fd, Object *ob) ob->gpulamp.first= ob->gpulamp.last= NULL; link_list(fd, &ob->pc_ids); + /* incase this value changes in future, clamp else we get undefined behavior */ + CLAMP(ob->rotmode, ROT_MODE_MIN, ROT_MODE_MAX); + if(ob->sculpt) { ob->sculpt= MEM_callocN(sizeof(SculptSession), "reload sculpt session"); ob->sculpt->ob= ob; -- cgit v1.2.3