Cleanup: remove unused copy menu code

Unused since 2.4x.
This commit is contained in:
Campbell Barton
2019-01-10 12:52:20 +11:00
parent b389bb5ef8
commit 002d0bd344
2 changed files with 0 additions and 530 deletions

View File

@@ -531,210 +531,6 @@ void POSE_OT_paths_range_update(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ********************************************** */
#if 0 /* UNUSED 2.5 */
static void pose_copy_menu(Scene *scene)
{
Object *obedit = scene->obedit; // XXX context
Object *ob = OBACT;
bArmature *arm;
bPoseChannel *pchan, *pchanact;
short nr = 0;
int i = 0;
/* paranoia checks */
if (ELEM(NULL, ob, ob->pose)) return;
if ((ob == obedit) || (ob->mode & OB_MODE_POSE) == 0) return;
pchan = BKE_pose_channel_active(ob);
if (pchan == NULL) return;
pchanact = pchan;
arm = ob->data;
/* if proxy-protected bones selected, some things (such as locks + displays) shouldn't be changeable,
* but for constraints (just add local constraints)
*/
if (pose_has_protected_selected(ob, 0)) {
i = BLI_listbase_count(&(pchanact->constraints)); /* if there are 24 or less, allow for the user to select constraints */
if (i < 25)
nr = pupmenu("Copy Pose Attributes %t|Local Location %x1|Local Rotation %x2|Local Size %x3|%l|Visual Location %x9|Visual Rotation %x10|Visual Size %x11|%l|Constraints (All) %x4|Constraints... %x5");
else
nr = pupmenu("Copy Pose Attributes %t|Local Location %x1|Local Rotation %x2|Local Size %x3|%l|Visual Location %x9|Visual Rotation %x10|Visual Size %x11|%l|Constraints (All) %x4");
}
else {
i = BLI_listbase_count(&(pchanact->constraints)); /* if there are 24 or less, allow for the user to select constraints */
if (i < 25)
nr = pupmenu("Copy Pose Attributes %t|Local Location %x1|Local Rotation %x2|Local Size %x3|%l|Visual Location %x9|Visual Rotation %x10|Visual Size %x11|%l|Constraints (All) %x4|Constraints... %x5|%l|Transform Locks %x6|IK Limits %x7|Bone Shape %x8");
else
nr = pupmenu("Copy Pose Attributes %t|Local Location %x1|Local Rotation %x2|Local Size %x3|%l|Visual Location %x9|Visual Rotation %x10|Visual Size %x11|%l|Constraints (All) %x4|%l|Transform Locks %x6|IK Limits %x7|Bone Shape %x8");
}
if (nr <= 0)
return;
if (nr != 5) {
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
if ((arm->layer & pchan->bone->layer) &&
(pchan->bone->flag & BONE_SELECTED) &&
(pchan != pchanact) )
{
switch (nr) {
case 1: /* Local Location */
copy_v3_v3(pchan->loc, pchanact->loc);
break;
case 2: /* Local Rotation */
copy_qt_qt(pchan->quat, pchanact->quat);
copy_v3_v3(pchan->eul, pchanact->eul);
break;
case 3: /* Local Size */
copy_v3_v3(pchan->size, pchanact->size);
break;
case 4: /* All Constraints */
{
ListBase tmp_constraints = {NULL, NULL};
/* copy constraints to tmpbase and apply 'local' tags before
* appending to list of constraints for this channel
*/
BKE_constraints_copy(&tmp_constraints, &pchanact->constraints, true);
if ((ob->proxy) && (pchan->bone->layer & arm->layer_protected)) {
bConstraint *con;
/* add proxy-local tags */
for (con = tmp_constraints.first; con; con = con->next)
con->flag |= CONSTRAINT_PROXY_LOCAL;
}
BLI_movelisttolist(&pchan->constraints, &tmp_constraints);
/* update flags (need to add here, not just copy) */
pchan->constflag |= pchanact->constflag;
if (ob->pose)
BKE_pose_tag_recalc(bmain, ob->pose);
}
break;
case 6: /* Transform Locks */
pchan->protectflag = pchanact->protectflag;
break;
case 7: /* IK (DOF) settings */
{
pchan->ikflag = pchanact->ikflag;
copy_v3_v3(pchan->limitmin, pchanact->limitmin);
copy_v3_v3(pchan->limitmax, pchanact->limitmax);
copy_v3_v3(pchan->stiffness, pchanact->stiffness);
pchan->ikstretch = pchanact->ikstretch;
pchan->ikrotweight = pchanact->ikrotweight;
pchan->iklinweight = pchanact->iklinweight;
}
break;
case 8: /* Custom Bone Shape */
pchan->custom = pchanact->custom;
if (pchan->custom) {
id_us_plus(&pchan->custom->id);
}
break;
case 9: /* Visual Location */
BKE_armature_loc_pose_to_bone(pchan, pchanact->pose_mat[3], pchan->loc);
break;
case 10: /* Visual Rotation */
{
float delta_mat[4][4];
BKE_armature_mat_pose_to_bone(pchan, pchanact->pose_mat, delta_mat);
if (pchan->rotmode == ROT_MODE_AXISANGLE) {
float tmp_quat[4];
/* need to convert to quat first (in temp var)... */
mat4_to_quat(tmp_quat, delta_mat);
quat_to_axis_angle(pchan->rotAxis, &pchan->rotAngle, tmp_quat);
}
else if (pchan->rotmode == ROT_MODE_QUAT)
mat4_to_quat(pchan->quat, delta_mat);
else
mat4_to_eulO(pchan->eul, pchan->rotmode, delta_mat);
}
break;
case 11: /* Visual Size */
{
float delta_mat[4][4], size[4];
BKE_armature_mat_pose_to_bone(pchan, pchanact->pose_mat, delta_mat);
mat4_to_size(size, delta_mat);
copy_v3_v3(pchan->size, size);
}
}
}
}
}
else { /* constraints, optional (note: max we can have is 24 constraints) */
bConstraint *con, *con_back;
int const_toggle[24] = {0}; /* XXX, initialize as 0 to quiet errors */
ListBase const_copy = {NULL, NULL};
BLI_duplicatelist(&const_copy, &(pchanact->constraints));
/* build the puplist of constraints */
for (con = pchanact->constraints.first, i = 0; con; con = con->next, i++) {
const_toggle[i] = 1;
// add_numbut(i, UI_BTYPE_TOGGLE|INT, con->name, 0, 0, &(const_toggle[i]), "");
}
// if (!do_clever_numbuts("Select Constraints", i, REDRAW)) {
// BLI_freelistN(&const_copy);
// return;
// }
/* now build a new listbase from the options selected */
for (i = 0, con = const_copy.first; con; i++) {
/* if not selected, free/remove it from the list */
if (!const_toggle[i]) {
con_back = con->next;
BLI_freelinkN(&const_copy, con);
con = con_back;
}
else
con = con->next;
}
/* Copy the temo listbase to the selected posebones */
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
if ((arm->layer & pchan->bone->layer) &&
(pchan->bone->flag & BONE_SELECTED) &&
(pchan != pchanact) )
{
ListBase tmp_constraints = {NULL, NULL};
/* copy constraints to tmpbase and apply 'local' tags before
* appending to list of constraints for this channel
*/
BKE_constraints_copy(&tmp_constraints, &const_copy, true);
if ((ob->proxy) && (pchan->bone->layer & arm->layer_protected)) {
/* add proxy-local tags */
for (con = tmp_constraints.first; con; con = con->next)
con->flag |= CONSTRAINT_PROXY_LOCAL;
}
BLI_movelisttolist(&pchan->constraints, &tmp_constraints);
/* update flags (need to add here, not just copy) */
pchan->constflag |= pchanact->constflag;
}
}
BLI_freelistN(&const_copy);
BKE_pose_update_constraint_flags(ob->pose); /* we could work out the flags but its simpler to do this */
if (ob->pose)
BKE_pose_tag_recalc(bmain, ob->pose);
}
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); // and all its relations
BIF_undo_push("Copy Pose Attributes");
}
#endif
/* ********************************************** */
static int pose_flip_names_exec(bContext *C, wmOperator *op)

View File

@@ -125,7 +125,6 @@ static void move_to_collection_menus_items(struct uiLayout *layout, struct MoveT
/* ************* XXX **************** */
static void error(const char *UNUSED(arg)) {}
static void waitcursor(int UNUSED(val)) {}
static int pupmenu(const char *UNUSED(msg)) { return 0; }
/* port over here */
static void error_libdata(void) {}
@@ -845,331 +844,6 @@ void OBJECT_OT_posemode_toggle(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* both pointers should exist */
static void copy_texture_space(Object *to, Object *ob)
{
float *poin1 = NULL, *poin2 = NULL;
short texflag = 0;
if (ob->type == OB_MESH) {
texflag = ((Mesh *)ob->data)->texflag;
poin2 = ((Mesh *)ob->data)->loc;
}
else if (ELEM(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
texflag = ((Curve *)ob->data)->texflag;
poin2 = ((Curve *)ob->data)->loc;
}
else if (ob->type == OB_MBALL) {
texflag = ((MetaBall *)ob->data)->texflag;
poin2 = ((MetaBall *)ob->data)->loc;
}
else
return;
if (to->type == OB_MESH) {
((Mesh *)to->data)->texflag = texflag;
poin1 = ((Mesh *)to->data)->loc;
}
else if (ELEM(to->type, OB_CURVE, OB_SURF, OB_FONT)) {
((Curve *)to->data)->texflag = texflag;
poin1 = ((Curve *)to->data)->loc;
}
else if (to->type == OB_MBALL) {
((MetaBall *)to->data)->texflag = texflag;
poin1 = ((MetaBall *)to->data)->loc;
}
else
return;
memcpy(poin1, poin2, 9 * sizeof(float)); /* this was noted in DNA_mesh, curve, mball */
if (to->type == OB_MESH) {
/* pass */
}
else if (to->type == OB_MBALL) {
BKE_mball_texspace_calc(to);
}
else {
BKE_curve_texspace_calc(to->data);
}
}
/* UNUSED, keep in case we want to copy functionality for use elsewhere */
static void copy_attr(Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, short event)
{
Object *ob;
Base *base;
Curve *cu, *cu1;
Nurb *nu;
if (ID_IS_LINKED(scene)) return;
if (!(ob = OBACT(view_layer))) return;
if (BKE_object_is_in_editmode(ob)) {
/* obedit_copymenu(); */
return;
}
if (event == 24) {
/* moved to BKE_object_link_modifiers */
/* copymenu_modifiers(bmain, scene, v3d, ob); */
return;
}
for (base = FIRSTBASE(view_layer); base; base = base->next) {
if (base != BASACT(view_layer)) {
if (BASE_SELECTED_EDITABLE(v3d, base)) {
DEG_id_tag_update(&base->object->id, ID_RECALC_GEOMETRY);
if (event == 1) { /* loc */
copy_v3_v3(base->object->loc, ob->loc);
copy_v3_v3(base->object->dloc, ob->dloc);
}
else if (event == 2) { /* rot */
copy_v3_v3(base->object->rot, ob->rot);
copy_v3_v3(base->object->drot, ob->drot);
copy_qt_qt(base->object->quat, ob->quat);
copy_qt_qt(base->object->dquat, ob->dquat);
}
else if (event == 3) { /* size */
copy_v3_v3(base->object->size, ob->size);
copy_v3_v3(base->object->dscale, ob->dscale);
}
else if (event == 4) { /* drawtype */
base->object->dt = ob->dt;
base->object->dtx = ob->dtx;
base->object->empty_drawtype = ob->empty_drawtype;
base->object->empty_drawsize = ob->empty_drawsize;
}
else if (event == 5) { /* time offs */
base->object->sf = ob->sf;
}
else if (event == 6) { /* dupli */
base->object->dupon = ob->dupon;
base->object->dupoff = ob->dupoff;
base->object->dupsta = ob->dupsta;
base->object->dupend = ob->dupend;
base->object->transflag &= ~OB_DUPLI;
base->object->transflag |= (ob->transflag & OB_DUPLI);
base->object->dup_group = ob->dup_group;
if (ob->dup_group)
id_us_plus(&ob->dup_group->id);
}
else if (event == 17) { /* tex space */
copy_texture_space(base->object, ob);
}
else if (event == 18) { /* font settings */
if (base->object->type == ob->type) {
cu = ob->data;
cu1 = base->object->data;
cu1->spacemode = cu->spacemode;
cu1->align_y = cu->align_y;
cu1->spacing = cu->spacing;
cu1->linedist = cu->linedist;
cu1->shear = cu->shear;
cu1->fsize = cu->fsize;
cu1->xof = cu->xof;
cu1->yof = cu->yof;
cu1->textoncurve = cu->textoncurve;
cu1->wordspace = cu->wordspace;
cu1->ulpos = cu->ulpos;
cu1->ulheight = cu->ulheight;
if (cu1->vfont)
id_us_min(&cu1->vfont->id);
cu1->vfont = cu->vfont;
id_us_plus((ID *)cu1->vfont);
if (cu1->vfontb)
id_us_min(&cu1->vfontb->id);
cu1->vfontb = cu->vfontb;
id_us_plus((ID *)cu1->vfontb);
if (cu1->vfonti)
id_us_min(&cu1->vfonti->id);
cu1->vfonti = cu->vfonti;
id_us_plus((ID *)cu1->vfonti);
if (cu1->vfontbi)
id_us_min(&cu1->vfontbi->id);
cu1->vfontbi = cu->vfontbi;
id_us_plus((ID *)cu1->vfontbi);
BLI_strncpy(cu1->family, cu->family, sizeof(cu1->family));
DEG_id_tag_update(&base->object->id, ID_RECALC_GEOMETRY);
}
}
else if (event == 19) { /* bevel settings */
if (ELEM(base->object->type, OB_CURVE, OB_FONT)) {
cu = ob->data;
cu1 = base->object->data;
cu1->bevobj = cu->bevobj;
cu1->taperobj = cu->taperobj;
cu1->width = cu->width;
cu1->bevresol = cu->bevresol;
cu1->ext1 = cu->ext1;
cu1->ext2 = cu->ext2;
DEG_id_tag_update(&base->object->id, ID_RECALC_GEOMETRY);
}
}
else if (event == 25) { /* curve resolution */
if (ELEM(base->object->type, OB_CURVE, OB_FONT)) {
cu = ob->data;
cu1 = base->object->data;
cu1->resolu = cu->resolu;
cu1->resolu_ren = cu->resolu_ren;
nu = cu1->nurb.first;
while (nu) {
nu->resolu = cu1->resolu;
nu = nu->next;
}
DEG_id_tag_update(&base->object->id, ID_RECALC_GEOMETRY);
}
}
else if (event == 21) {
if (base->object->type == OB_MESH) {
ModifierData *md = modifiers_findByType(ob, eModifierType_Subsurf);
if (md) {
ModifierData *tmd = modifiers_findByType(base->object, eModifierType_Subsurf);
if (!tmd) {
tmd = modifier_new(eModifierType_Subsurf);
BLI_addtail(&base->object->modifiers, tmd);
}
modifier_copyData(md, tmd);
DEG_id_tag_update(&base->object->id, ID_RECALC_GEOMETRY);
}
}
}
else if (event == 22) {
/* Copy the constraint channels over */
BKE_constraints_copy(&base->object->constraints, &ob->constraints, true);
DEG_id_tag_update(&base->object->id, ID_RECALC_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
}
else if (event == 23) {
sbFree(base->object);
BKE_object_copy_softbody(base->object, ob, 0);
if (!modifiers_findByType(base->object, eModifierType_Softbody)) {
BLI_addhead(&base->object->modifiers, modifier_new(eModifierType_Softbody));
}
DEG_id_tag_update(&base->object->id, ID_RECALC_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
}
else if (event == 26) {
#if 0 // XXX old animation system
BKE_nlastrip_copy(s(&base->object->nlastrips, &ob->nlastrips);
#endif // XXX old animation system
}
else if (event == 27) { /* autosmooth */
if (base->object->type == OB_MESH) {
Mesh *me = ob->data;
Mesh *cme = base->object->data;
cme->smoothresh = me->smoothresh;
if (me->flag & ME_AUTOSMOOTH)
cme->flag |= ME_AUTOSMOOTH;
else
cme->flag &= ~ME_AUTOSMOOTH;
}
}
else if (event == 28) { /* UV orco */
if (ELEM(base->object->type, OB_CURVE, OB_SURF)) {
cu = ob->data;
cu1 = base->object->data;
if (cu->flag & CU_UV_ORCO)
cu1->flag |= CU_UV_ORCO;
else
cu1->flag &= ~CU_UV_ORCO;
}
}
else if (event == 29) { /* protected bits */
base->object->protectflag = ob->protectflag;
}
else if (event == 30) { /* index object */
base->object->index = ob->index;
}
else if (event == 31) { /* object color */
copy_v4_v4(base->object->col, ob->col);
}
}
}
}
}
static void UNUSED_FUNCTION(copy_attr_menu) (Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, Object *obedit)
{
Object *ob;
short event;
char str[512];
if (!(ob = OBACT(view_layer))) return;
if (obedit) {
/* if (ob->type == OB_MESH) */
/* XXX mesh_copy_menu(); */
return;
}
/* Object Mode */
/* If you change this menu, don't forget to update the menu in header_view3d.c
* view3d_edit_object_copyattrmenu() and in toolbox.c
*/
strcpy(str,
"Copy Attributes %t|Location %x1|Rotation %x2|Size %x3|Draw Options %x4|"
"Time Offset %x5|Dupli %x6|Object Color %x31|%l|Mass %x7|Damping %x8|All Physical Attributes %x11|Properties %x9|"
"Logic Bricks %x10|Protected Transform %x29|%l");
strcat(str, "|Object Constraints %x22");
strcat(str, "|NLA Strips %x26");
/* XXX if (OB_TYPE_SUPPORT_MATERIAL(ob->type)) { */
/* strcat(str, "|Texture Space %x17"); */
/* } */
if (ob->type == OB_FONT) strcat(str, "|Font Settings %x18|Bevel Settings %x19");
if (ob->type == OB_CURVE) strcat(str, "|Bevel Settings %x19|UV Orco %x28");
if ((ob->type == OB_FONT) || (ob->type == OB_CURVE)) {
strcat(str, "|Curve Resolution %x25");
}
if (ob->type == OB_MESH) {
strcat(str, "|Subsurf Settings %x21|AutoSmooth %x27");
}
if (ob->soft) strcat(str, "|Soft Body Settings %x23");
strcat(str, "|Pass Index %x30");
if (ob->type == OB_MESH || ob->type == OB_CURVE || ob->type == OB_LATTICE || ob->type == OB_SURF) {
strcat(str, "|Modifiers ... %x24");
}
event = pupmenu(str);
if (event <= 0) return;
copy_attr(bmain, scene, view_layer, v3d, event);
}
/* ******************* force field toggle operator ***************** */
void ED_object_check_force_modifiers(Main *bmain, Scene *scene, Object *object)