~ubuntu-branches/ubuntu/utopic/blender/utopic-proposed

« back to all changes in this revision

Viewing changes to source/blender/editors/armature/poseobject.c

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-04-28 12:11:12 UTC
  • mto: (14.1.6 experimental) (1.5.1)
  • mto: This revision was merged to the branch mainline in revision 34.
  • Revision ID: package-import@ubuntu.com-20120428121112-2zi0vp8b6vejda8i
Tags: upstream-2.63
ImportĀ upstreamĀ versionĀ 2.63

Show diffs side-by-side

added added

removed removed

Lines of Context:
109
109
 
110
110
void ED_armature_exit_posemode(bContext *C, Base *base)
111
111
{
112
 
        if(base) {
 
112
        if (base) {
113
113
                Object *ob= base->object;
114
114
                
115
115
                ob->restore_mode = ob->mode;
154
154
        
155
155
        /* No need to check if constraint is active (has influence),
156
156
         * since all constraints with CONSTRAINT_IK_AUTO are active */
157
 
        for(con= pchan->constraints.first; con; con= con->next) {
158
 
                if(con->type==CONSTRAINT_TYPE_KINEMATIC) {
 
157
        for (con= pchan->constraints.first; con; con= con->next) {
 
158
                if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
159
159
                        bKinematicConstraint *data= con->data;
160
 
                        if(data->rootbone == 0 || data->rootbone > level) {
161
 
                                if((data->flag & CONSTRAINT_IK_AUTO)==0)
 
160
                        if (data->rootbone == 0 || data->rootbone > level) {
 
161
                                if ((data->flag & CONSTRAINT_IK_AUTO)==0)
162
162
                                        return 1;
163
163
                        }
164
164
                }
165
165
        }
166
 
        for(bone= pchan->bone->childbase.first; bone; bone= bone->next) {
 
166
        for (bone= pchan->bone->childbase.first; bone; bone= bone->next) {
167
167
                pchan= get_pose_channel(ob->pose, bone->name);
168
 
                if(pchan && pose_channel_in_IK_chain(ob, pchan, level + 1))
 
168
                if (pchan && pose_channel_in_IK_chain(ob, pchan, level + 1))
169
169
                        return 1;
170
170
        }
171
171
        return 0;
236
236
void POSE_OT_paths_calculate (wmOperatorType *ot)
237
237
{
238
238
        /* identifiers */
239
 
        ot->name= "Calculate Bone Paths";
240
 
        ot->idname= "POSE_OT_paths_calculate";
241
 
        ot->description= "Calculate paths for the selected bones";
 
239
        ot->name = "Calculate Bone Paths";
 
240
        ot->idname = "POSE_OT_paths_calculate";
 
241
        ot->description = "Calculate paths for the selected bones";
242
242
        
243
243
        /* api callbacks */
244
 
        ot->exec= pose_calculate_paths_exec;
245
 
        ot->poll= ED_operator_posemode;
 
244
        ot->exec = pose_calculate_paths_exec;
 
245
        ot->poll = ED_operator_posemode;
246
246
        
247
247
        /* flags */
248
 
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 
248
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
249
249
}
250
250
 
251
251
/* --------- */
256
256
        bPoseChannel *pchan;
257
257
        short skipped = 0;
258
258
        
259
 
        if ELEM(NULL, ob, ob->pose)
 
259
        if (ELEM(NULL, ob, ob->pose))
260
260
                return;
261
261
        
262
262
        /* free the motionpath blocks, but also take note of whether we skipped some... */
289
289
                ob= object_pose_armature_get(CTX_data_active_object(C));
290
290
                
291
291
        /* only continue if there's an object */
292
 
        if ELEM(NULL, ob, ob->pose)
 
292
        if (ELEM(NULL, ob, ob->pose))
293
293
                return OPERATOR_CANCELLED;
294
294
        
295
295
        /* use the backend function for this */
304
304
void POSE_OT_paths_clear (wmOperatorType *ot)
305
305
{
306
306
        /* identifiers */
307
 
        ot->name= "Clear Bone Paths";
308
 
        ot->idname= "POSE_OT_paths_clear";
309
 
        ot->description= "Clear path caches for selected bones";
 
307
        ot->name = "Clear Bone Paths";
 
308
        ot->idname = "POSE_OT_paths_clear";
 
309
        ot->description = "Clear path caches for selected bones";
310
310
        
311
311
        /* api callbacks */
312
 
        ot->exec= pose_clear_paths_exec;
313
 
        ot->poll= ED_operator_posemode;
 
312
        ot->exec = pose_clear_paths_exec;
 
313
        ot->poll = ED_operator_posemode;
314
314
        
315
315
        /* flags */
316
316
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
338
338
                                        for (ct= targets.first; ct; ct= ct->next) {
339
339
                                                if ((ct->tar == ob) && (ct->subtarget[0])) {
340
340
                                                        bPoseChannel *pchanc= get_pose_channel(ob->pose, ct->subtarget);
341
 
                                                        if((pchanc) && !(pchanc->bone->flag & BONE_UNSELECTABLE)) {
 
341
                                                        if ((pchanc) && !(pchanc->bone->flag & BONE_UNSELECTABLE)) {
342
342
                                                                pchanc->bone->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
343
343
                                                                found= 1;
344
344
                                                        }
364
364
void POSE_OT_select_constraint_target(wmOperatorType *ot)
365
365
{
366
366
        /* identifiers */
367
 
        ot->name= "Select Constraint Target";
368
 
        ot->idname= "POSE_OT_select_constraint_target";
369
 
        ot->description= "Select bones used as targets for the currently selected bones";
 
367
        ot->name = "Select Constraint Target";
 
368
        ot->idname = "POSE_OT_select_constraint_target";
 
369
        ot->description = "Select bones used as targets for the currently selected bones";
370
370
        
371
371
        /* api callbacks */
372
 
        ot->exec= pose_select_constraint_target_exec;
373
 
        ot->poll= ED_operator_posemode;
 
372
        ot->exec = pose_select_constraint_target_exec;
 
373
        ot->poll = ED_operator_posemode;
374
374
        
375
375
        /* flags */
376
 
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 
376
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
377
377
}
378
378
 
379
379
/* ******************* select hierarchy operator ************* */
407
407
                                        }
408
408
                                } 
409
409
                                else { /* direction == BONE_SELECT_CHILD */
 
410
 
 
411
                                        /* the child member is only assigned to connected bones, see [#30340] */
 
412
#if 0
410
413
                                        if (pchan->child == NULL) continue;
411
414
                                        else chbone = pchan->child->bone;
 
415
#else
 
416
                                        /* instead. find _any_ visible child bone, using the first one is a little arbitrary  - campbell */
 
417
                                        chbone = pchan->child ? pchan->child->bone : NULL;
 
418
                                        if (chbone == NULL) {
 
419
                                                bPoseChannel *pchan_child;
 
420
 
 
421
                                                for (pchan_child = ob->pose->chanbase.first; pchan_child; pchan_child = pchan_child->next) {
 
422
                                                        /* possible we have multiple children, some invisible */
 
423
                                                        if (PBONE_VISIBLE(arm, pchan_child->bone)) {
 
424
                                                                if (pchan_child->parent == pchan) {
 
425
                                                                        chbone = pchan_child->bone;
 
426
                                                                        break;
 
427
                                                                }
 
428
                                                        }
 
429
                                                }
 
430
                                        }
 
431
 
 
432
                                        if (chbone == NULL) continue;
 
433
#endif
412
434
                                        
413
435
                                        if (PBONE_VISIBLE(arm, chbone)) {
414
436
                                                if (!add_to_sel) curbone->flag &= ~BONE_SELECTED;
441
463
        };
442
464
        
443
465
        /* identifiers */
444
 
        ot->name= "Select Hierarchy";
445
 
        ot->idname= "POSE_OT_select_hierarchy";
446
 
        ot->description= "Select immediate parent/children of selected bones";
 
466
        ot->name = "Select Hierarchy";
 
467
        ot->idname = "POSE_OT_select_hierarchy";
 
468
        ot->description = "Select immediate parent/children of selected bones";
447
469
        
448
470
        /* api callbacks */
449
 
        ot->exec= pose_select_hierarchy_exec;
450
 
        ot->poll= ED_operator_posemode;
 
471
        ot->exec = pose_select_hierarchy_exec;
 
472
        ot->poll = ED_operator_posemode;
451
473
        
452
474
        /* flags */
453
 
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 
475
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
454
476
        
455
477
        /* props */
456
 
        ot->prop= RNA_def_enum(ot->srna, "direction", direction_items, BONE_SELECT_PARENT, "Direction", "");
 
478
        ot->prop = RNA_def_enum(ot->srna, "direction", direction_items, BONE_SELECT_PARENT, "Direction", "");
457
479
        RNA_def_boolean(ot->srna, "extend", 0, "Add to Selection", "");
458
480
        
459
481
}
497
519
        }
498
520
        CTX_DATA_END;
499
521
        
500
 
        /* small optimisation: only loop through bones a second time if there are any groups tagged */
 
522
        /* small optimization: only loop through bones a second time if there are any groups tagged */
501
523
        if (tagged) {
502
524
                /* only if group matches (and is not selected or current bone) */
503
525
                CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones) 
661
683
        };
662
684
 
663
685
        /* identifiers */
664
 
        ot->name= "Select Grouped";
 
686
        ot->name = "Select Grouped";
665
687
        ot->description = "Select all visible bones grouped by similar properties";
666
 
        ot->idname= "POSE_OT_select_grouped";
 
688
        ot->idname = "POSE_OT_select_grouped";
667
689
        
668
690
        /* api callbacks */
669
 
        ot->invoke= WM_menu_invoke;
670
 
        ot->exec= pose_select_grouped_exec;
671
 
        ot->poll= ED_operator_posemode;
 
691
        ot->invoke = WM_menu_invoke;
 
692
        ot->exec = pose_select_grouped_exec;
 
693
        ot->poll = ED_operator_posemode;
672
694
        
673
695
        /* flags */
674
 
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 
696
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
675
697
        
676
698
        /* properties */
677
699
        RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first");
678
 
        ot->prop= RNA_def_enum(ot->srna, "type", prop_select_grouped_types, 0, "Type", "");
 
700
        ot->prop = RNA_def_enum(ot->srna, "type", prop_select_grouped_types, 0, "Type", "");
679
701
}
680
702
 
681
703
 
687
709
        Object *ob_act= CTX_data_active_object(C);
688
710
        Object *ob= object_pose_armature_get(ob_act);
689
711
 
690
 
        if(ob && (ob->mode & OB_MODE_POSE)) {
 
712
        if (ob && (ob->mode & OB_MODE_POSE)) {
691
713
                bArmature *arm= ob->data;
692
714
 
693
 
                if(arm->act_bone) {
 
715
                if (arm->act_bone) {
694
716
                        bPoseChannel *pchanf;
695
717
                        char name[MAXBONENAME];
696
718
                        flip_side_name(name, arm->act_bone->name, TRUE);
697
719
 
698
720
                        pchanf= get_pose_channel(ob->pose, name);
699
 
                        if(pchanf && pchanf->bone != arm->act_bone) {
 
721
                        if (pchanf && pchanf->bone != arm->act_bone) {
700
722
                                arm->act_bone->flag &= ~BONE_SELECTED;
701
723
                                pchanf->bone->flag |= BONE_SELECTED;
702
724
 
703
725
                                arm->act_bone= pchanf->bone;
704
726
 
705
727
                                /* in weightpaint we select the associated vertex group too */
706
 
                                if(ob_act->mode & OB_MODE_WEIGHT_PAINT) {
 
728
                                if (ob_act->mode & OB_MODE_WEIGHT_PAINT) {
707
729
                                        ED_vgroup_select_by_name(ob_act, name);
708
730
                                        DAG_id_tag_update(&ob_act->id, OB_RECALC_DATA);
709
731
                                }
721
743
void POSE_OT_select_flip_active(wmOperatorType *ot)
722
744
{
723
745
        /* identifiers */
724
 
        ot->name= "Flip Selected Active Bone";
725
 
        ot->idname= "POSE_OT_select_flip_active";
726
 
        ot->description= "Activate the bone with a flipped name";
 
746
        ot->name = "Flip Selected Active Bone";
 
747
        ot->idname = "POSE_OT_select_flip_active";
 
748
        ot->description = "Activate the bone with a flipped name";
727
749
        
728
750
        /* api callbacks */
729
 
        ot->exec= pose_bone_flip_active_exec;
730
 
        ot->poll= ED_operator_posemode;
 
751
        ot->exec = pose_bone_flip_active_exec;
 
752
        ot->poll = ED_operator_posemode;
731
753
        
732
754
        /* flags */
733
755
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
755
777
        pchanact= pchan;
756
778
        arm= ob->data;
757
779
 
758
 
        /* if proxy-protected bones selected, some things (such as locks + displays) shouldn't be changable, 
 
780
        /* if proxy-protected bones selected, some things (such as locks + displays) shouldn't be changeable,
759
781
         * but for constraints (just add local constraints)
760
782
         */
761
783
        if (pose_has_protected_selected(ob, 0)) {
776
798
        if (nr <= 0) 
777
799
                return;
778
800
        
779
 
        if (nr != 5)  {
 
801
        if (nr != 5) {
780
802
                for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
781
803
                        if ( (arm->layer & pchan->bone->layer) &&
782
804
                                 (pchan->bone->flag & BONE_SELECTED) &&
876
898
                BLI_duplicatelist(&const_copy, &(pchanact->constraints));
877
899
                
878
900
                /* build the puplist of constraints */
879
 
                for (con = pchanact->constraints.first, i=0; con; con=con->next, i++){
 
901
                for (con = pchanact->constraints.first, i=0; con; con=con->next, i++) {
880
902
                        const_toggle[i]= 1;
881
903
//                      add_numbut(i, TOG|INT, con->name, 0, 0, &(const_toggle[i]), "");
882
904
                }
946
968
                bPoseChannel *pchan;
947
969
                
948
970
                for (pchan= g_posebuf->chanbase.first; pchan; pchan= pchan->next) {
949
 
                        if(pchan->prop) {
 
971
                        if (pchan->prop) {
950
972
                                IDP_FreeProperty(pchan->prop);
951
973
                                MEM_freeN(pchan->prop);
952
974
                        }
968
990
        bArmature *arm= ob->data;
969
991
        bPoseChannel *chan;
970
992
 
971
 
        if (ob->pose){
972
 
                for (chan=ob->pose->chanbase.first; chan; chan=chan->next){
 
993
        if (ob->pose) {
 
994
                for (chan=ob->pose->chanbase.first; chan; chan=chan->next) {
973
995
                        Bone *bone= chan->bone;
974
996
                        if ((bone) && (bone->flag & BONE_SELECTED) && (arm->layer & bone->layer))
975
997
                                chan->flag |= POSE_KEY; 
1110
1132
        Object *ob= object_pose_armature_get(CTX_data_active_object(C));
1111
1133
        
1112
1134
        /* sanity checking */
1113
 
        if ELEM(NULL, ob, ob->pose) {
 
1135
        if (ELEM(NULL, ob, ob->pose)) {
1114
1136
                BKE_report(op->reports, RPT_ERROR, "No Pose to Copy");
1115
1137
                return OPERATOR_CANCELLED;
1116
1138
        }
1129
1151
void POSE_OT_copy (wmOperatorType *ot) 
1130
1152
{
1131
1153
        /* identifiers */
1132
 
        ot->name= "Copy Pose";
1133
 
        ot->idname= "POSE_OT_copy";
1134
 
        ot->description= "Copies the current pose of the selected bones to copy/paste buffer";
 
1154
        ot->name = "Copy Pose";
 
1155
        ot->idname = "POSE_OT_copy";
 
1156
        ot->description = "Copies the current pose of the selected bones to copy/paste buffer";
1135
1157
        
1136
1158
        /* api callbacks */
1137
 
        ot->exec= pose_copy_exec;
1138
 
        ot->poll= ED_operator_posemode;
 
1159
        ot->exec = pose_copy_exec;
 
1160
        ot->poll = ED_operator_posemode;
1139
1161
        
1140
1162
        /* flag */
1141
 
        ot->flag= OPTYPE_REGISTER;
 
1163
        ot->flag = OPTYPE_REGISTER;
1142
1164
}
1143
1165
 
1144
1166
/* ---- */
1155
1177
        KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_LOC_ROT_SCALE_ID);
1156
1178
 
1157
1179
        /* sanity checks */
1158
 
        if ELEM(NULL, ob, ob->pose)
 
1180
        if (ELEM(NULL, ob, ob->pose))
1159
1181
                return OPERATOR_CANCELLED;
1160
1182
 
1161
1183
        if (g_posebuf == NULL) {
1164
1186
        }
1165
1187
        
1166
1188
        /* if selOnly option is enabled, if user hasn't selected any bones, 
1167
 
         * just go back to default behaviour to be more in line with other pose tools
 
1189
         * just go back to default behavior to be more in line with other pose tools
1168
1190
         */
1169
1191
        if (selOnly) {
1170
1192
                if (CTX_DATA_COUNT(C, selected_pose_bones) == 0)
1195
1217
 
1196
1218
void POSE_OT_paste (wmOperatorType *ot)
1197
1219
{
 
1220
        PropertyRNA *prop;
 
1221
 
1198
1222
        /* identifiers */
1199
 
        ot->name= "Paste Pose";
1200
 
        ot->idname= "POSE_OT_paste";
1201
 
        ot->description= "Paste the stored pose on to the current pose";
 
1223
        ot->name = "Paste Pose";
 
1224
        ot->idname = "POSE_OT_paste";
 
1225
        ot->description = "Paste the stored pose on to the current pose";
1202
1226
        
1203
1227
        /* api callbacks */
1204
 
        ot->exec= pose_paste_exec;
1205
 
        ot->poll= ED_operator_posemode;
 
1228
        ot->exec = pose_paste_exec;
 
1229
        ot->poll = ED_operator_posemode;
1206
1230
        
1207
1231
        /* flag */
1208
 
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 
1232
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
1209
1233
        
1210
1234
        /* properties */
1211
 
        RNA_def_boolean(ot->srna, "flipped", FALSE, "Flipped on X-Axis", "Paste the stored pose flipped on to current pose");
 
1235
        prop = RNA_def_boolean(ot->srna, "flipped", FALSE, "Flipped on X-Axis", "Paste the stored pose flipped on to current pose");
 
1236
        RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 
1237
 
1212
1238
        RNA_def_boolean(ot->srna, "selected_mask", FALSE, "On Selected Only", "Only paste the stored pose on to selected bones in the current pose");
1213
1239
}
1214
1240
 
1242
1268
void POSE_OT_group_add (wmOperatorType *ot)
1243
1269
{
1244
1270
        /* identifiers */
1245
 
        ot->name= "Add Bone Group";
1246
 
        ot->idname= "POSE_OT_group_add";
1247
 
        ot->description= "Add a new bone group";
 
1271
        ot->name = "Add Bone Group";
 
1272
        ot->idname = "POSE_OT_group_add";
 
1273
        ot->description = "Add a new bone group";
1248
1274
        
1249
1275
        /* api callbacks */
1250
 
        ot->exec= pose_group_add_exec;
1251
 
        ot->poll= ED_operator_posemode;
 
1276
        ot->exec = pose_group_add_exec;
 
1277
        ot->poll = ED_operator_posemode;
1252
1278
        
1253
1279
        /* flags */
1254
1280
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
1282
1308
void POSE_OT_group_remove (wmOperatorType *ot)
1283
1309
{
1284
1310
        /* identifiers */
1285
 
        ot->name= "Remove Bone Group";
1286
 
        ot->idname= "POSE_OT_group_remove";
1287
 
        ot->description= "Removes the active bone group";
 
1311
        ot->name = "Remove Bone Group";
 
1312
        ot->idname = "POSE_OT_group_remove";
 
1313
        ot->description = "Removes the active bone group";
1288
1314
        
1289
1315
        /* api callbacks */
1290
 
        ot->exec= pose_group_remove_exec;
1291
 
        ot->poll= ED_operator_posemode;
 
1316
        ot->exec = pose_group_remove_exec;
 
1317
        ot->poll = ED_operator_posemode;
1292
1318
        
1293
1319
        /* flags */
1294
1320
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
1397
1423
void POSE_OT_group_assign (wmOperatorType *ot)
1398
1424
{
1399
1425
        /* identifiers */
1400
 
        ot->name= "Add Selected to Bone Group";
1401
 
        ot->idname= "POSE_OT_group_assign";
1402
 
        ot->description= "Add selected bones to the chosen bone group";
 
1426
        ot->name = "Add Selected to Bone Group";
 
1427
        ot->idname = "POSE_OT_group_assign";
 
1428
        ot->description = "Add selected bones to the chosen bone group";
1403
1429
        
1404
1430
        /* api callbacks */
1405
 
        ot->invoke= pose_groups_menu_invoke;
1406
 
        ot->exec= pose_group_assign_exec;
1407
 
        ot->poll= ED_operator_posemode;
 
1431
        ot->invoke = pose_groups_menu_invoke;
 
1432
        ot->exec = pose_group_assign_exec;
 
1433
        ot->poll = ED_operator_posemode;
1408
1434
        
1409
1435
        /* flags */
1410
1436
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
1453
1479
void POSE_OT_group_unassign (wmOperatorType *ot)
1454
1480
{
1455
1481
        /* identifiers */
1456
 
        ot->name= "Remove Selected from Bone Groups";
1457
 
        ot->idname= "POSE_OT_group_unassign";
1458
 
        ot->description= "Remove selected bones from all bone groups";
 
1482
        ot->name = "Remove Selected from Bone Groups";
 
1483
        ot->idname = "POSE_OT_group_unassign";
 
1484
        ot->description = "Remove selected bones from all bone groups";
1459
1485
        
1460
1486
        /* api callbacks */
1461
 
        ot->exec= pose_group_unassign_exec;
1462
 
        ot->poll= ED_operator_posemode;
 
1487
        ot->exec = pose_group_unassign_exec;
 
1488
        ot->poll = ED_operator_posemode;
1463
1489
        
1464
1490
        /* flags */
1465
1491
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
1534
1560
        };
1535
1561
 
1536
1562
        /* identifiers */
1537
 
        ot->name= "Move Bone Group";
1538
 
        ot->idname= "POSE_OT_group_move";
1539
 
        ot->description= "Change position of active Bone Group in list of Bone Groups";
 
1563
        ot->name = "Move Bone Group";
 
1564
        ot->idname = "POSE_OT_group_move";
 
1565
        ot->description = "Change position of active Bone Group in list of Bone Groups";
1540
1566
 
1541
1567
        /* api callbacks */
1542
 
        ot->exec= group_move_exec;
1543
 
        ot->poll= ED_operator_posemode;
 
1568
        ot->exec = group_move_exec;
 
1569
        ot->poll = ED_operator_posemode;
1544
1570
 
1545
1571
        /* flags */
1546
 
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 
1572
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
1547
1573
 
1548
1574
        RNA_def_enum(ot->srna, "direction", group_slot_move, 0, "Direction", "Direction to move, UP or DOWN");
1549
1575
}
1618
1644
void POSE_OT_group_sort(wmOperatorType *ot)
1619
1645
{
1620
1646
        /* identifiers */
1621
 
        ot->name= "Sort Bone Groups";
1622
 
        ot->idname= "POSE_OT_group_sort";
1623
 
        ot->description= "Sort Bone Groups by their names in ascending order";
 
1647
        ot->name = "Sort Bone Groups";
 
1648
        ot->idname = "POSE_OT_group_sort";
 
1649
        ot->description = "Sort Bone Groups by their names in ascending order";
1624
1650
 
1625
1651
        /* api callbacks */
1626
 
        ot->exec= group_sort_exec;
1627
 
        ot->poll= ED_operator_posemode;
 
1652
        ot->exec = group_sort_exec;
 
1653
        ot->poll = ED_operator_posemode;
1628
1654
 
1629
1655
        /* flags */
1630
 
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 
1656
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
1631
1657
}
1632
1658
 
1633
1659
static void pose_group_select(bContext *C, Object *ob, int select)
1676
1702
void POSE_OT_group_select (wmOperatorType *ot)
1677
1703
{
1678
1704
        /* identifiers */
1679
 
        ot->name= "Select Bones of Bone Group";
1680
 
        ot->idname= "POSE_OT_group_select";
1681
 
        ot->description= "Select bones in active Bone Group";
 
1705
        ot->name = "Select Bones of Bone Group";
 
1706
        ot->idname = "POSE_OT_group_select";
 
1707
        ot->description = "Select bones in active Bone Group";
1682
1708
        
1683
1709
        /* api callbacks */
1684
 
        ot->exec= pose_group_select_exec;
1685
 
        ot->poll= ED_operator_posemode;
 
1710
        ot->exec = pose_group_select_exec;
 
1711
        ot->poll = ED_operator_posemode;
1686
1712
        
1687
1713
        /* flags */
1688
1714
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
1714
1740
void POSE_OT_group_deselect (wmOperatorType *ot)
1715
1741
{
1716
1742
        /* identifiers */
1717
 
        ot->name= "Deselect Bone Group";
1718
 
        ot->idname= "POSE_OT_group_deselect";
1719
 
        ot->description= "Deselect bones of active Bone Group";
 
1743
        ot->name = "Deselect Bone Group";
 
1744
        ot->idname = "POSE_OT_group_deselect";
 
1745
        ot->description = "Deselect bones of active Bone Group";
1720
1746
        
1721
1747
        /* api callbacks */
1722
 
        ot->exec= pose_group_deselect_exec;
1723
 
        ot->poll= ED_operator_posemode;
 
1748
        ot->exec = pose_group_deselect_exec;
 
1749
        ot->poll = ED_operator_posemode;
1724
1750
        
1725
1751
        /* flags */
1726
1752
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
1759
1785
void POSE_OT_flip_names (wmOperatorType *ot)
1760
1786
{
1761
1787
        /* identifiers */
1762
 
        ot->name= "Flip Names";
1763
 
        ot->idname= "POSE_OT_flip_names";
1764
 
        ot->description= "Flips (and corrects) the axis suffixes of the the names of selected bones";
 
1788
        ot->name = "Flip Names";
 
1789
        ot->idname = "POSE_OT_flip_names";
 
1790
        ot->description = "Flips (and corrects) the axis suffixes of the the names of selected bones";
1765
1791
        
1766
1792
        /* api callbacks */
1767
 
        ot->exec= pose_flip_names_exec;
1768
 
        ot->poll= ED_operator_posemode;
 
1793
        ot->exec = pose_flip_names_exec;
 
1794
        ot->poll = ED_operator_posemode;
1769
1795
        
1770
1796
        /* flags */
1771
 
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 
1797
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
1772
1798
}
1773
1799
 
1774
1800
/* ------------------ */
1789
1815
        CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
1790
1816
        {
1791
1817
                BLI_strncpy(newname, pchan->name, sizeof(newname));
1792
 
                if(bone_autoside_name(newname, 1, axis, pchan->bone->head[axis], pchan->bone->tail[axis]))
 
1818
                if (bone_autoside_name(newname, 1, axis, pchan->bone->head[axis], pchan->bone->tail[axis]))
1793
1819
                        ED_armature_bone_rename(arm, pchan->name, newname);
1794
1820
        }
1795
1821
        CTX_DATA_END;
1812
1838
                {0, NULL, 0, NULL, NULL}};
1813
1839
        
1814
1840
        /* identifiers */
1815
 
        ot->name= "AutoName by Axis";
1816
 
        ot->idname= "POSE_OT_autoside_names";
1817
 
        ot->description= "Automatically renames the selected bones according to which side of the target axis they fall on";
 
1841
        ot->name = "AutoName by Axis";
 
1842
        ot->idname = "POSE_OT_autoside_names";
 
1843
        ot->description = "Automatically renames the selected bones according to which side of the target axis they fall on";
1818
1844
        
1819
1845
        /* api callbacks */
1820
 
        ot->invoke= WM_menu_invoke;
1821
 
        ot->exec= pose_autoside_names_exec;
1822
 
        ot->poll= ED_operator_posemode;
 
1846
        ot->invoke = WM_menu_invoke;
 
1847
        ot->exec = pose_autoside_names_exec;
 
1848
        ot->poll = ED_operator_posemode;
1823
1849
        
1824
1850
        /* flags */
1825
 
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 
1851
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
1826
1852
        
1827
1853
        /* settings */
1828
 
        ot->prop= RNA_def_enum(ot->srna, "axis", axis_items, 0, "Axis", "Axis tag names with");
 
1854
        ot->prop = RNA_def_enum(ot->srna, "axis", axis_items, 0, "Axis", "Axis tag names with");
1829
1855
}
1830
1856
 
1831
1857
/* ********************************************** */
1852
1878
void POSE_OT_rotation_mode_set (wmOperatorType *ot)
1853
1879
{
1854
1880
        /* identifiers */
1855
 
        ot->name= "Set Rotation Mode";
1856
 
        ot->idname= "POSE_OT_rotation_mode_set";
1857
 
        ot->description= "Set the rotation representation used by selected bones";
 
1881
        ot->name = "Set Rotation Mode";
 
1882
        ot->idname = "POSE_OT_rotation_mode_set";
 
1883
        ot->description = "Set the rotation representation used by selected bones";
1858
1884
        
1859
1885
        /* callbacks */
1860
 
        ot->invoke= WM_menu_invoke;
1861
 
        ot->exec= pose_bone_rotmode_exec;
1862
 
        ot->poll= ED_operator_posemode;
 
1886
        ot->invoke = WM_menu_invoke;
 
1887
        ot->exec = pose_bone_rotmode_exec;
 
1888
        ot->poll = ED_operator_posemode;
1863
1889
        
1864
1890
        /* flags */
1865
 
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 
1891
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
1866
1892
        
1867
1893
        /* properties */
1868
 
        ot->prop= RNA_def_enum(ot->srna, "type", posebone_rotmode_items, 0, "Rotation Mode", "");
 
1894
        ot->prop = RNA_def_enum(ot->srna, "type", posebone_rotmode_items, 0, "Rotation Mode", "");
1869
1895
}
1870
1896
 
1871
1897
/* ********************************************** */
1911
1937
void ARMATURE_OT_layers_show_all (wmOperatorType *ot)
1912
1938
{
1913
1939
        /* identifiers */
1914
 
        ot->name= "Show All Layers";
1915
 
        ot->idname= "ARMATURE_OT_layers_show_all";
1916
 
        ot->description= "Make all armature layers visible";
 
1940
        ot->name = "Show All Layers";
 
1941
        ot->idname = "ARMATURE_OT_layers_show_all";
 
1942
        ot->description = "Make all armature layers visible";
1917
1943
        
1918
1944
        /* callbacks */
1919
 
        ot->exec= pose_armature_layers_showall_exec;
1920
 
        ot->poll= pose_armature_layers_showall_poll;
 
1945
        ot->exec = pose_armature_layers_showall_exec;
 
1946
        ot->poll = pose_armature_layers_showall_poll;
1921
1947
        
1922
1948
        /* flags */
1923
 
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 
1949
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
1924
1950
        
1925
1951
        /* properties */
1926
1952
        ot->prop = RNA_def_boolean(ot->srna, "all", 1, "All Layers", "Enable all layers or just the first 16 (top row)");
1977
2003
void POSE_OT_armature_layers (wmOperatorType *ot)
1978
2004
{
1979
2005
        /* identifiers */
1980
 
        ot->name= "Change Armature Layers";
1981
 
        ot->idname= "POSE_OT_armature_layers";
1982
 
        ot->description= "Change the visible armature layers";
 
2006
        ot->name = "Change Armature Layers";
 
2007
        ot->idname = "POSE_OT_armature_layers";
 
2008
        ot->description = "Change the visible armature layers";
1983
2009
        
1984
2010
        /* callbacks */
1985
 
        ot->invoke= pose_armature_layers_invoke;
1986
 
        ot->exec= pose_armature_layers_exec;
1987
 
        ot->poll= ED_operator_posemode;
 
2011
        ot->invoke = pose_armature_layers_invoke;
 
2012
        ot->exec = pose_armature_layers_exec;
 
2013
        ot->poll = ED_operator_posemode;
1988
2014
        
1989
2015
        /* flags */
1990
 
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 
2016
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
1991
2017
        
1992
2018
        /* properties */
1993
2019
        RNA_def_boolean_layer_member(ot->srna, "layers", 32, NULL, "Layer", "Armature layers to make visible");
1996
2022
void ARMATURE_OT_armature_layers (wmOperatorType *ot)
1997
2023
{
1998
2024
        /* identifiers */
1999
 
        ot->name= "Change Armature Layers";
2000
 
        ot->idname= "ARMATURE_OT_armature_layers";
2001
 
        ot->description= "Change the visible armature layers";
 
2025
        ot->name = "Change Armature Layers";
 
2026
        ot->idname = "ARMATURE_OT_armature_layers";
 
2027
        ot->description = "Change the visible armature layers";
2002
2028
        
2003
2029
        /* callbacks */
2004
 
        ot->invoke= pose_armature_layers_invoke;
2005
 
        ot->exec= pose_armature_layers_exec;
2006
 
        ot->poll= ED_operator_editarmature;
 
2030
        ot->invoke = pose_armature_layers_invoke;
 
2031
        ot->exec = pose_armature_layers_exec;
 
2032
        ot->poll = ED_operator_editarmature;
2007
2033
        
2008
2034
        /* flags */
2009
 
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 
2035
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
2010
2036
        
2011
2037
        /* properties */
2012
2038
        RNA_def_boolean_layer_member(ot->srna, "layers", 32, NULL, "Layer", "Armature layers to make visible");
2046
2072
        PointerRNA ptr;
2047
2073
        int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
2048
2074
 
2049
 
        if(ob==NULL || ob->data==NULL) {
 
2075
        if (ob==NULL || ob->data==NULL) {
2050
2076
                return OPERATOR_CANCELLED;
2051
2077
        }
2052
2078
 
2071
2097
void POSE_OT_bone_layers (wmOperatorType *ot)
2072
2098
{
2073
2099
        /* identifiers */
2074
 
        ot->name= "Change Bone Layers";
2075
 
        ot->idname= "POSE_OT_bone_layers";
2076
 
        ot->description= "Change the layers that the selected bones belong to";
 
2100
        ot->name = "Change Bone Layers";
 
2101
        ot->idname = "POSE_OT_bone_layers";
 
2102
        ot->description = "Change the layers that the selected bones belong to";
2077
2103
        
2078
2104
        /* callbacks */
2079
 
        ot->invoke= pose_bone_layers_invoke;
2080
 
        ot->exec= pose_bone_layers_exec;
2081
 
        ot->poll= ED_operator_posemode;
 
2105
        ot->invoke = pose_bone_layers_invoke;
 
2106
        ot->exec = pose_bone_layers_exec;
 
2107
        ot->poll = ED_operator_posemode;
2082
2108
        
2083
2109
        /* flags */
2084
 
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 
2110
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
2085
2111
        
2086
2112
        /* properties */
2087
2113
        RNA_def_boolean_layer_member(ot->srna, "layers", 32, NULL, "Layer", "Armature layers that bone belongs to");
2143
2169
void ARMATURE_OT_bone_layers (wmOperatorType *ot)
2144
2170
{
2145
2171
        /* identifiers */
2146
 
        ot->name= "Change Bone Layers";
2147
 
        ot->idname= "ARMATURE_OT_bone_layers";
2148
 
        ot->description= "Change the layers that the selected bones belong to";
 
2172
        ot->name = "Change Bone Layers";
 
2173
        ot->idname = "ARMATURE_OT_bone_layers";
 
2174
        ot->description = "Change the layers that the selected bones belong to";
2149
2175
        
2150
2176
        /* callbacks */
2151
 
        ot->invoke= armature_bone_layers_invoke;
2152
 
        ot->exec= armature_bone_layers_exec;
2153
 
        ot->poll= ED_operator_editarmature;
 
2177
        ot->invoke = armature_bone_layers_invoke;
 
2178
        ot->exec = armature_bone_layers_exec;
 
2179
        ot->poll = ED_operator_editarmature;
2154
2180
        
2155
2181
        /* flags */
2156
 
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 
2182
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
2157
2183
        
2158
2184
        /* properties */
2159
2185
        RNA_def_boolean_layer_member(ot->srna, "layers", 32, NULL, "Layer", "Armature layers that bone belongs to");
2192
2218
{
2193
2219
        /* identifiers */
2194
2220
        ot->name = "Flip Quats";
2195
 
        ot->idname= "POSE_OT_quaternions_flip";
2196
 
        ot->description= "Flip quaternion values to achieve desired rotations, while maintaining the same orientations";
 
2221
        ot->idname = "POSE_OT_quaternions_flip";
 
2222
        ot->description = "Flip quaternion values to achieve desired rotations, while maintaining the same orientations";
2197
2223
        
2198
2224
        /* callbacks */
2199
 
        ot->exec= pose_flip_quats_exec;
2200
 
        ot->poll= ED_operator_posemode;
 
2225
        ot->exec = pose_flip_quats_exec;
 
2226
        ot->poll = ED_operator_posemode;
2201
2227
        
2202
2228
        /* flags */
2203
 
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 
2229
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
2204
2230
}
2205
2231
 
2206
2232
/* ********************************************** */
2268
2294
{
2269
2295
        /* identifiers */
2270
2296
        ot->name = "Clear User Transforms";
2271
 
        ot->idname= "POSE_OT_user_transforms_clear";
2272
 
        ot->description= "Reset pose on selected bones to keyframed state";
 
2297
        ot->idname = "POSE_OT_user_transforms_clear";
 
2298
        ot->description = "Reset pose on selected bones to keyframed state";
2273
2299
        
2274
2300
        /* callbacks */
2275
 
        ot->exec= pose_clear_user_transforms_exec;
2276
 
        ot->poll= ED_operator_posemode;
 
2301
        ot->exec = pose_clear_user_transforms_exec;
 
2302
        ot->poll = ED_operator_posemode;
2277
2303
        
2278
2304
        /* flags */
2279
 
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 
2305
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
2280
2306
}
2281
2307