148
149
if(protectflag & OB_LOCK_ROTZ)
149
150
*drawflags &= ~MAN_ROT_Z;
151
if(protectflag & OB_LOCK_SIZEX)
152
if(protectflag & OB_LOCK_SCALEX)
152
153
*drawflags &= ~MAN_SCALE_X;
153
if(protectflag & OB_LOCK_SIZEY)
154
if(protectflag & OB_LOCK_SCALEY)
154
155
*drawflags &= ~MAN_SCALE_Y;
155
if(protectflag & OB_LOCK_SIZEZ)
156
if(protectflag & OB_LOCK_SCALEZ)
156
157
*drawflags &= ~MAN_SCALE_Z;
176
/* only counts the parent selection, and tags transform flag */
177
/* bad call... should re-use method from transform_conversion once */
178
static void count_bone_select(TransInfo *t, bArmature *arm, ListBase *lb, int do_it)
183
for(bone= lb->first; bone; bone= bone->next) {
184
bone->flag &= ~BONE_TRANSFORM;
187
if(bone->layer & arm->layer) {
188
if (bone->flag & BONE_SELECTED) {
189
/* We don't let connected children get "grabbed" */
190
if ( (t->mode!=TFM_TRANSLATION) || (bone->flag & BONE_CONNECTED)==0 ) {
191
bone->flag |= BONE_TRANSFORM;
193
do_next= 0; // no transform on children if one parent bone is selected
198
count_bone_select(t, arm, &bone->childbase, do_next);
175
202
/* centroid, boundbox, of selection */
176
203
/* returns total items selected */
177
204
int calc_manipulator_stats(ScrArea *sa)
203
230
if(G.obedit->type==OB_MESH) {
204
231
EditMesh *em = G.editMesh;
233
float vec[3]= {0,0,0};
209
if(v3d->twmode == V3D_MANIP_NORMAL) {
212
for(efa= em->faces.first; efa; efa= efa->next) {
213
if(efa->f & SELECT) {
215
VECADD(normal, normal, efa->n);
216
VecSubf(vec, efa->v2->co, efa->v1->co);
217
VECADD(plane, plane, vec);
222
/* do vertices for center, and if still no normal found, use vertex normals */
223
for(eve= em->verts.first; eve; eve= eve->next) {
224
if(eve->f & SELECT) {
225
if(no_faces) VECADD(normal, normal, eve->no);
228
calc_tw_center(eve->co);
231
/* the edge case... */
232
if(no_faces && v3d->twmode == V3D_MANIP_NORMAL) {
235
for(eed= em->edges.first; eed; eed= eed->next) {
236
if(eed->f & SELECT) {
237
/* ok we got an edge, only use one, and as normal */
238
VECCOPY(plane, normal);
239
VecSubf(normal, eed->v2->co, eed->v1->co);
236
/* USE LAST SELECTE WITH ACTIVE */
237
if (G.vd->around==V3D_ACTIVE && em->selected.last) {
238
EM_editselection_center(vec, em->selected.last);
241
if (v3d->twmode == V3D_MANIP_NORMAL) {
242
EM_editselection_normal(normal, em->selected.last);
243
EM_editselection_plane(plane, em->selected.last);
244
} /* NORMAL OPERATION */
246
if(v3d->twmode == V3D_MANIP_NORMAL) {
249
for(efa= em->faces.first; efa; efa= efa->next) {
250
if(efa->f & SELECT) {
252
VECADD(normal, normal, efa->n);
253
VecSubf(vec, efa->v2->co, efa->v1->co);
254
VECADD(plane, plane, vec);
259
/* do vertices for center, and if still no normal found, use vertex normals */
260
for(eve= em->verts.first; eve; eve= eve->next) {
261
if(eve->f & SELECT) {
262
if(no_faces) VECADD(normal, normal, eve->no);
265
calc_tw_center(eve->co);
268
/* the edge case... */
269
if(no_faces && v3d->twmode == V3D_MANIP_NORMAL) {
272
for(eed= em->edges.first; eed; eed= eed->next) {
273
if(eed->f & SELECT) {
274
/* ok we got an edge, only use one, and as normal */
275
VECCOPY(plane, normal);
276
VecSubf(normal, eed->v2->co, eed->v1->co);
245
283
else if (G.obedit->type==OB_ARMATURE){
284
bArmature *arm= G.obedit->data;
247
286
for (ebo=G.edbo.first;ebo;ebo=ebo->next){
248
if (ebo->flag & BONE_TIPSEL) {
249
calc_tw_center(ebo->tail);
252
if (ebo->flag & BONE_ROOTSEL) {
253
calc_tw_center(ebo->head);
287
if(ebo->layer & arm->layer) {
288
if (ebo->flag & BONE_TIPSEL) {
289
calc_tw_center(ebo->tail);
292
if (ebo->flag & BONE_ROOTSEL) {
293
calc_tw_center(ebo->head);