Added PoseMode CTRL+C copy menu. Does loc/rot/size and constraints.

This commit is contained in:
2005-07-26 19:51:15 +00:00
parent eadfd13123
commit b0065e3451
3 changed files with 56 additions and 1 deletions

View File

@@ -54,6 +54,7 @@ void pose_special_editmenu(void);
void pose_add_IK(void); void pose_add_IK(void);
void pose_clear_IK(void); void pose_clear_IK(void);
void pose_clear_constraints(void); void pose_clear_constraints(void);
void pose_copy_menu(void);
#endif #endif

View File

@@ -48,6 +48,7 @@
#include "BKE_displist.h" #include "BKE_displist.h"
#include "BKE_global.h" #include "BKE_global.h"
#include "BKE_object.h" #include "BKE_object.h"
#include "BKE_utildefines.h"
#include "BIF_editconstraint.h" #include "BIF_editconstraint.h"
#include "BIF_gl.h" #include "BIF_gl.h"
@@ -326,3 +327,53 @@ void pose_clear_constraints(void)
} }
void pose_copy_menu(void)
{
Object *ob= OBACT;
bPoseChannel *pchan, *pchanact;
short nr;
/* paranoia checks */
if(!ob && !ob->pose) return;
if(ob==G.obedit || (ob->flag & OB_POSEMODE)==0) return;
/* find active */
for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
if(pchan->bone->flag & BONE_ACTIVE) break;
}
if(pchan==NULL) return;
pchanact= pchan;
nr= pupmenu("Copy Pose Attributes %t|Location%x1|Rotation%x2|Size%x3|Constraints");
for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
if(pchan->bone->flag & BONE_SELECTED) {
if(pchan!=pchanact) {
if(nr==1) {
VECCOPY(pchan->loc, pchanact->loc);
}
else if(nr==2) {
QUATCOPY(pchan->quat, pchanact->quat);
}
else if(nr==3) {
VECCOPY(pchan->size, pchanact->size);
}
else if(nr==4) {
free_constraints(&pchan->constraints);
copy_constraints(&pchan->constraints, &pchanact->constraints);
pchan->constflag = pchanact->constflag;
}
}
}
}
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); // and all its relations
allqueue (REDRAWVIEW3D, 0);
allqueue (REDRAWBUTSOBJECT, 0);
BIF_undo_push("Copy Pose Attributes");
}

View File

@@ -1120,7 +1120,10 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
break; break;
case CKEY: case CKEY:
if(G.qual==LR_CTRLKEY) { if(G.qual==LR_CTRLKEY) {
copy_attr_menu(); if(ob && (ob->flag & OB_POSEMODE))
pose_copy_menu(); /* poseobject.c */
else
copy_attr_menu();
} }
else if(G.qual==LR_ALTKEY) { else if(G.qual==LR_ALTKEY) {
if(ob && (ob->flag & OB_POSEMODE)) if(ob && (ob->flag & OB_POSEMODE))