diff options
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r-- | source/blender/editors/armature/armature_ops.c | 10 | ||||
-rw-r--r-- | source/blender/editors/armature/editarmature.c | 2 | ||||
-rw-r--r-- | source/blender/editors/armature/meshlaplacian.c | 10 | ||||
-rw-r--r-- | source/blender/editors/armature/poselib.c | 15 | ||||
-rw-r--r-- | source/blender/editors/armature/poseobject.c | 57 |
5 files changed, 52 insertions, 42 deletions
diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index 4384e2c5f98..9de46231b17 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -256,7 +256,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf) /* special transforms: */ /* 1) envelope/b-bone size */ - kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0); + kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_CTRL|KM_ALT, 0); RNA_enum_set(kmi->ptr, "mode", TFM_BONESIZE); /* 2) set roll */ kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", RKEY, KM_PRESS, KM_CTRL, 0); @@ -277,9 +277,9 @@ void ED_keymap_armature(wmKeyConfig *keyconf) kmi= WM_keymap_add_item(keymap, "POSE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0); RNA_boolean_set(kmi->ptr, "unselected", 1); WM_keymap_add_item(keymap, "POSE_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0); - + WM_keymap_add_menu(keymap, "VIEW3D_MT_pose_apply", AKEY, KM_PRESS, KM_CTRL, 0); - + // TODO: clear pose WM_keymap_add_item(keymap, "POSE_OT_rot_clear", RKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "POSE_OT_loc_clear", GKEY, KM_PRESS, KM_ALT, 0); @@ -333,10 +333,10 @@ void ED_keymap_armature(wmKeyConfig *keyconf) /* special transforms: */ /* 1) envelope/b-bone size */ - kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0); + kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_CTRL|KM_ALT, 0); RNA_enum_set(kmi->ptr, "mode", TFM_BONESIZE); - // XXX this should probably be in screen instead... here for testing purposes in the meantime... - Aligorith + /* keyframes management */ WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_insert_menu", IKEY, KM_PRESS, 0, 0); WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_delete_v3d", IKEY, KM_PRESS, KM_ALT, 0); WM_keymap_verify_item(keymap, "ANIM_OT_keying_set_active_set", IKEY, KM_PRESS, KM_CTRL|KM_SHIFT|KM_ALT, 0); diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 5f0c2e3d4be..2db86d70734 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -5075,7 +5075,7 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op) VECCOPY(pchan->eul, eul); } } - } + } // Duplicated in source/blender/editors/object/object_transform.c else { if (pchan->rotmode == ROT_MODE_QUAT) { pchan->quat[1]=pchan->quat[2]=pchan->quat[3]= 0.0f; diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index c5e96dd5fd4..4f0805cd0d6 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -523,10 +523,8 @@ static void heat_set_H(LaplacianSystem *sys, int vertex) /* compute H entry */ if(numclosest > 0) { - if(mindist > 1e-5) - h= numclosest*C_WEIGHT/(mindist*mindist); - else - h= 1e10f; + mindist= maxf(mindist, 1e-4f); + h= numclosest*C_WEIGHT/(mindist*mindist); } else h= 0.0f; @@ -1766,7 +1764,7 @@ static void harmonic_coordinates_bind(Scene *scene, MeshDeformModifierData *mmd, else mdb->weights= MEM_callocN(sizeof(float)*mdb->totvert*mdb->totcagevert, "MDefWeights"); - mdb->memarena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE); + mdb->memarena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "harmonic coords arena"); BLI_memarena_use_calloc(mdb->memarena); /* make bounding box equal size in all directions, add padding, and compute @@ -1806,7 +1804,7 @@ static void harmonic_coordinates_bind(Scene *scene, MeshDeformModifierData *mmd, /* free temporary MDefBoundIsects */ BLI_memarena_free(mdb->memarena); - mdb->memarena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE); + mdb->memarena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "harmonic coords arena"); /* start with all cells untyped */ for(a=0; a<mdb->size3; a++) diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index e2ceb534066..71033fbe3ec 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -769,12 +769,19 @@ static void poselib_keytag_pose (bContext *C, Scene *scene, tPoseLib_PreviewData if (pchan) { if (autokeyframe_cfra_can_key(scene, &pld->ob->id)) { ListBase dsources = {NULL, NULL}; + KeyingSet *ks = NULL; - /* get KeyingSet to use */ - // TODO: for getting the KeyingSet used, we should really check which channels were affected - // TODO: this should get modified so that custom props are taken into account too! + /* get KeyingSet to use + * - use the active KeyingSet if defined (and user wants to use it for all autokeying), + * or otherwise key transforms only + */ if (poselib_ks_locrotscale == NULL) poselib_ks_locrotscale= ANIM_builtin_keyingset_get_named(NULL, "LocRotScale"); + + if (IS_AUTOKEY_FLAG(ONLYKEYINGSET) && (scene->active_keyingset)) + ks = ANIM_scene_get_active_keyingset(scene); + else + ks = ANIM_builtin_keyingset_get_named(NULL, "LocRotScale"); /* now insert the keyframe(s) using the Keying Set * 1) add datasource override for the PoseChannel @@ -782,7 +789,7 @@ static void poselib_keytag_pose (bContext *C, Scene *scene, tPoseLib_PreviewData * 3) free the extra info */ ANIM_relative_keyingset_add_source(&dsources, &pld->ob->id, &RNA_PoseBone, pchan); - ANIM_apply_keyingset(C, &dsources, NULL, poselib_ks_locrotscale, MODIFYKEY_MODE_INSERT, (float)CFRA); + ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); BLI_freelistN(&dsources); /* clear any unkeyed tags */ diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 102fbe2eafd..a3d2c454d23 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -892,9 +892,6 @@ void POSE_OT_copy (wmOperatorType *ot) /* ---- */ -/* Pointers to the builtin KeyingSets that we want to use */ -static KeyingSet *posePaste_ks_locrotscale = NULL; /* the only keyingset we'll need */ - static int pose_paste_exec (bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); @@ -937,6 +934,10 @@ static int pose_paste_exec (bContext *C, wmOperator *op) if (pchan->rotmode > 0) { VECCOPY(pchan->eul, chan->eul); } + else if (pchan->rotmode == ROT_MODE_AXISANGLE) { + VECCOPY(pchan->rotAxis, chan->rotAxis); + pchan->rotAngle = chan->rotAngle; + } else { QUATCOPY(pchan->quat, chan->quat); } @@ -979,13 +980,6 @@ static int pose_paste_exec (bContext *C, wmOperator *op) eul[1]*= -1; eul[2]*= -1; eulO_to_axis_angle(pchan->rotAxis, &pchan->rotAngle, eul, EULER_ORDER_DEFAULT); - - // experimental method (uncomment to test): -#if 0 - /* experimental method: just flip the orientation of the axis on x/y axes */ - pchan->quat[1] *= -1; - pchan->quat[2] *= -1; -#endif } else { float eul[3]; @@ -997,25 +991,36 @@ static int pose_paste_exec (bContext *C, wmOperator *op) } } - /* ID property */ - if (pchan->prop) { - IDP_FreeProperty(pchan->prop); - MEM_freeN(pchan->prop); - pchan->prop= NULL; + /* ID properties + * - only free the existing properties if the channel we're copying from has them + * NOTE: this means that if the pose depends on some pchan property, the pose may not be ok, + * but this is better than loosing all the setting you've painstakingly added... + */ + if (chan->prop) { + /* free the old properties since we want to replace them now */ + if (pchan->prop) { + IDP_FreeProperty(pchan->prop); + MEM_freeN(pchan->prop); + pchan->prop= NULL; + } + + /* now copy over the new copy of the properties */ + pchan->prop= IDP_CopyProperty(chan->prop); } - if (chan->prop) - pchan->prop= IDP_CopyProperty(chan->prop); - /* keyframing tagging */ - if (autokeyframe_cfra_can_key(scene, &ob->id)) { + if (autokeyframe_cfra_can_key(scene, &ob->id)) { ListBase dsources = {NULL, NULL}; + KeyingSet *ks = NULL; - /* get KeyingSet to use */ - // TODO: for getting the KeyingSet used, we should really check which channels were affected - // TODO: this should get modified so that custom props are taken into account too! - if (posePaste_ks_locrotscale == NULL) - posePaste_ks_locrotscale= ANIM_builtin_keyingset_get_named(NULL, "LocRotScale"); + /* get KeyingSet to use + * - use the active KeyingSet if defined (and user wants to use it for all autokeying), + * or otherwise key transforms only + */ + if (IS_AUTOKEY_FLAG(ONLYKEYINGSET) && (scene->active_keyingset)) + ks = ANIM_scene_get_active_keyingset(scene); + else + ks = ANIM_builtin_keyingset_get_named(NULL, "LocRotScale"); /* now insert the keyframe(s) using the Keying Set * 1) add datasource override for the PoseChannel @@ -1023,7 +1028,7 @@ static int pose_paste_exec (bContext *C, wmOperator *op) * 3) free the extra info */ ANIM_relative_keyingset_add_source(&dsources, &ob->id, &RNA_PoseBone, pchan); - ANIM_apply_keyingset(C, &dsources, NULL, posePaste_ks_locrotscale, MODIFYKEY_MODE_INSERT, (float)CFRA); + ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); BLI_freelistN(&dsources); /* clear any unkeyed tags */ @@ -1454,7 +1459,7 @@ void pose_activate_flipped_bone(Scene *scene) if(ob==NULL) return; - if(ob->mode && OB_MODE_WEIGHT_PAINT) { + if(ob->mode & OB_MODE_WEIGHT_PAINT) { ob= modifiers_isDeformedByArmature(ob); } if(ob && (ob->mode & OB_MODE_POSE)) { |