/* This following macro should be used for all standard single-target *_get_tars functions * to save typing and reduce maintainance woes. * (Hopefully all compilers will be happy with the lines with just a space on them. Those are * really just to help this code easier to read) */ #define SINGLETARGET_GET_TARS(con, datatar, datasubtarget, ct, list) \ { \ ct= MEM_callocN(sizeof(bConstraintTarget), "tempConstraintTarget"); \ \ ct->tar= datatar; \ strcpy(ct->subtarget, datasubtarget); \ ct->space= con->tarspace; \ ct->flag= CONSTRAINT_TAR_TEMP; \ \ if (ct->tar) { \ if ((ct->tar->type==OB_ARMATURE) && (ct->subtarget[0])) ct->type = CONSTRAINT_OBTYPE_BONE; \ else if (ELEM(ct->tar->type, OB_MESH, OB_LATTICE) && (ct->subtarget[0])) ct->type = CONSTRAINT_OBTYPE_VERT; \ else ct->type = CONSTRAINT_OBTYPE_OBJECT; \ } \ \ BLI_addtail(list, ct); \ } /* This following macro should be used for all standard single-target *_get_tars functions * to save typing and reduce maintainance woes. It does not do the subtarget related operations * (Hopefully all compilers will be happy with the lines with just a space on them. Those are * really just to help this code easier to read) */ #define SINGLETARGETNS_GET_TARS(con, datatar, ct, list) \ { \ ct= MEM_callocN(sizeof(bConstraintTarget), "tempConstraintTarget"); \ \ ct->tar= datatar; \ ct->space= con->tarspace; \ ct->flag= CONSTRAINT_TAR_TEMP; \ \ if (ct->tar) ct->type = CONSTRAINT_OBTYPE_OBJECT; \ \ BLI_addtail(list, ct); \ } /* This following macro should be used for all standard single-target *_flush_tars functions * to save typing and reduce maintainance woes. * (Hopefully all compilers will be happy with the lines with just a space on them. Those are * really just to help this code easier to read) */ #define SINGLETARGET_FLUSH_TARS(con, datatar, datasubtarget, ct, list, nocopy) \ { \ if (ct) { \ if (nocopy == 0) { \ datatar= ct->tar; \ strcpy(datasubtarget, ct->subtarget); \ con->tarspace= ct->space; \ } \ \ BLI_freelinkN(list, ct); \ } \ } /* This following macro should be used for all standard single-target *_flush_tars functions * to save typing and reduce maintainance woes. It does not do the subtarget related operations * (Hopefully all compilers will be happy with the lines with just a space on them. Those are * really just to help this code easier to read) */ #define SINGLETARGETNS_FLUSH_TARS(con, datatar, ct, list, nocopy) \ { \ if (ct) { \ if (nocopy == 0) { \ datatar= ct->tar; \ con->tarspace= ct->space; \ } \ \ BLI_freelinkN(list, ct); \ } \ }