Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/armature/pose_edit.c')
-rw-r--r--source/blender/editors/armature/pose_edit.c290
1 files changed, 145 insertions, 145 deletions
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index 01ff436fa1e..da328ee485f 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -85,7 +85,7 @@ bool ED_object_posemode_enter_ex(Object *ob)
{
BLI_assert(!ID_IS_LINKED(ob));
bool ok = false;
-
+
switch (ob->type) {
case OB_ARMATURE:
ob->restore_mode = ob->mode;
@@ -170,11 +170,11 @@ static bool pose_has_protected_selected(Object *ob, short warn)
void ED_pose_recalculate_paths(Scene *scene, Object *ob)
{
ListBase targets = {NULL, NULL};
-
+
/* set flag to force recalc, then grab the relevant bones to target */
ob->pose->avs.recalc |= ANIMVIZ_RECALC_PATHS;
animviz_get_object_motionpaths(ob, &targets);
-
+
/* recalculate paths, then free */
animviz_calc_motionpaths(scene, &targets);
BLI_freelistN(&targets);
@@ -183,52 +183,52 @@ void ED_pose_recalculate_paths(Scene *scene, Object *ob)
/* show popup to determine settings */
static int pose_calculate_paths_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
-{
+{
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
-
+
if (ELEM(NULL, ob, ob->pose))
return OPERATOR_CANCELLED;
-
+
/* set default settings from existing/stored settings */
{
bAnimVizSettings *avs = &ob->pose->avs;
PointerRNA avs_ptr;
-
+
RNA_int_set(op->ptr, "start_frame", avs->path_sf);
RNA_int_set(op->ptr, "end_frame", avs->path_ef);
-
+
RNA_pointer_create(NULL, &RNA_AnimVizMotionPaths, avs, &avs_ptr);
RNA_enum_set(op->ptr, "bake_location", RNA_enum_get(&avs_ptr, "bake_location"));
}
-
+
/* show popup dialog to allow editing of range... */
// FIXME: hardcoded dimensions here are just arbitrary
return WM_operator_props_dialog_popup(C, op, 10 * UI_UNIT_X, 10 * UI_UNIT_Y);
}
-/* For the object with pose/action: create path curves for selected bones
+/* For the object with pose/action: create path curves for selected bones
* This recalculates the WHOLE path within the pchan->pathsf and pchan->pathef range
*/
static int pose_calculate_paths_exec(bContext *C, wmOperator *op)
{
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
Scene *scene = CTX_data_scene(C);
-
+
if (ELEM(NULL, ob, ob->pose))
return OPERATOR_CANCELLED;
-
+
/* grab baking settings from operator settings */
{
bAnimVizSettings *avs = &ob->pose->avs;
PointerRNA avs_ptr;
-
+
avs->path_sf = RNA_int_get(op->ptr, "start_frame");
avs->path_ef = RNA_int_get(op->ptr, "end_frame");
-
+
RNA_pointer_create(NULL, &RNA_AnimVizMotionPaths, avs, &avs_ptr);
RNA_enum_set(&avs_ptr, "bake_location", RNA_enum_get(op->ptr, "bake_location"));
}
-
+
/* set up path data for bones being calculated */
CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones)
{
@@ -244,7 +244,7 @@ static int pose_calculate_paths_exec(bContext *C, wmOperator *op)
/* notifiers for updates */
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
- return OPERATOR_FINISHED;
+ return OPERATOR_FINISHED;
}
void POSE_OT_paths_calculate(wmOperatorType *ot)
@@ -253,23 +253,23 @@ void POSE_OT_paths_calculate(wmOperatorType *ot)
ot->name = "Calculate Bone Paths";
ot->idname = "POSE_OT_paths_calculate";
ot->description = "Calculate paths for the selected bones";
-
+
/* api callbacks */
ot->invoke = pose_calculate_paths_invoke;
ot->exec = pose_calculate_paths_exec;
ot->poll = ED_operator_posemode_exclusive;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* properties */
- RNA_def_int(ot->srna, "start_frame", 1, MINAFRAME, MAXFRAME, "Start",
+ RNA_def_int(ot->srna, "start_frame", 1, MINAFRAME, MAXFRAME, "Start",
"First frame to calculate bone paths on", MINFRAME, MAXFRAME / 2.0);
- RNA_def_int(ot->srna, "end_frame", 250, MINAFRAME, MAXFRAME, "End",
+ RNA_def_int(ot->srna, "end_frame", 250, MINAFRAME, MAXFRAME, "End",
"Last frame to calculate bone paths on", MINFRAME, MAXFRAME / 2.0);
-
- RNA_def_enum(ot->srna, "bake_location", rna_enum_motionpath_bake_location_items, 0,
- "Bake Location",
+
+ RNA_def_enum(ot->srna, "bake_location", rna_enum_motionpath_bake_location_items, 0,
+ "Bake Location",
"Which point on the bones is used when calculating paths");
}
@@ -281,7 +281,7 @@ static int pose_update_paths_poll(bContext *C)
Object *ob = CTX_data_active_object(C);
return (ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS) != 0;
}
-
+
return false;
}
@@ -289,17 +289,17 @@ static int pose_update_paths_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
Scene *scene = CTX_data_scene(C);
-
+
if (ELEM(NULL, ob, scene))
return OPERATOR_CANCELLED;
/* calculate the bones that now have motionpaths... */
/* TODO: only make for the selected bones? */
ED_pose_recalculate_paths(scene, ob);
-
+
/* notifiers for updates */
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
-
+
return OPERATOR_FINISHED;
}
@@ -309,11 +309,11 @@ void POSE_OT_paths_update(wmOperatorType *ot)
ot->name = "Update Bone Paths";
ot->idname = "POSE_OT_paths_update";
ot->description = "Recalculate paths for bones that already have them";
-
+
/* api callbakcs */
ot->exec = pose_update_paths_exec;
ot->poll = pose_update_paths_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -325,10 +325,10 @@ static void ED_pose_clear_paths(Object *ob, bool only_selected)
{
bPoseChannel *pchan;
bool skipped = false;
-
+
if (ELEM(NULL, ob, ob->pose))
return;
-
+
/* free the motionpath blocks for all bones - This is easier for users to quickly clear all */
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
if (pchan->mpath) {
@@ -341,7 +341,7 @@ static void ED_pose_clear_paths(Object *ob, bool only_selected)
}
}
}
-
+
/* if nothing was skipped, there should be no paths left! */
if (skipped == false)
ob->pose->avs.path_bakeflag &= ~MOTIONPATH_BAKE_HAS_PATHS;
@@ -352,18 +352,18 @@ static int pose_clear_paths_exec(bContext *C, wmOperator *op)
{
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
bool only_selected = RNA_boolean_get(op->ptr, "only_selected");
-
+
/* only continue if there's an object */
if (ELEM(NULL, ob, ob->pose))
return OPERATOR_CANCELLED;
-
+
/* use the backend function for this */
ED_pose_clear_paths(ob, only_selected);
-
+
/* notifiers for updates */
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
-
- return OPERATOR_FINISHED;
+
+ return OPERATOR_FINISHED;
}
/* operator callback/wrapper */
@@ -381,17 +381,17 @@ void POSE_OT_paths_clear(wmOperatorType *ot)
ot->name = "Clear Bone Paths";
ot->idname = "POSE_OT_paths_clear";
ot->description = "Clear path caches for all bones, hold Shift key for selected bones only";
-
+
/* api callbacks */
ot->invoke = pose_clear_paths_invoke;
ot->exec = pose_clear_paths_exec;
ot->poll = ED_operator_posemode_exclusive;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* properties */
- ot->prop = RNA_def_boolean(ot->srna, "only_selected", false, "Only Selected",
+ ot->prop = RNA_def_boolean(ot->srna, "only_selected", false, "Only Selected",
"Only clear paths from selected bones");
RNA_def_property_flag(ot->prop, PROP_SKIP_SAVE);
}
@@ -406,13 +406,13 @@ static void pose_copy_menu(Scene *scene)
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;
@@ -434,10 +434,10 @@ static void pose_copy_menu(Scene *scene)
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)
+
+ if (nr <= 0)
return;
-
+
if (nr != 5) {
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
if ((arm->layer & pchan->bone->layer) &&
@@ -458,23 +458,23 @@ static void pose_copy_menu(Scene *scene)
case 4: /* All Constraints */
{
ListBase tmp_constraints = {NULL, NULL};
-
- /* copy constraints to tmpbase and apply 'local' tags before
+
+ /* 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);
}
@@ -505,12 +505,12 @@ static void pose_copy_menu(Scene *scene)
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);
@@ -524,7 +524,7 @@ static void pose_copy_menu(Scene *scene)
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);
@@ -537,20 +537,20 @@ static void pose_copy_menu(Scene *scene)
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 */
@@ -562,7 +562,7 @@ static void pose_copy_menu(Scene *scene)
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) &&
@@ -570,8 +570,8 @@ static void pose_copy_menu(Scene *scene)
(pchan != pchanact) )
{
ListBase tmp_constraints = {NULL, NULL};
-
- /* copy constraints to tmpbase and apply 'local' tags before
+
+ /* 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);
@@ -581,22 +581,22 @@ static void pose_copy_menu(Scene *scene)
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);
}
-
+
DAG_id_tag_update(&ob->id, OB_RECALC_DATA); // and all its relations
-
+
BIF_undo_push("Copy Pose Attributes");
-
+
}
#endif
@@ -608,7 +608,7 @@ static int pose_flip_names_exec(bContext *C, wmOperator *op)
bArmature *arm;
/* paranoia checks */
- if (ELEM(NULL, ob, ob->pose))
+ if (ELEM(NULL, ob, ob->pose))
return OPERATOR_CANCELLED;
const bool do_strip_numbers = RNA_boolean_get(op->ptr, "do_strip_numbers");
@@ -626,13 +626,13 @@ static int pose_flip_names_exec(bContext *C, wmOperator *op)
ED_armature_bones_flip_names(arm, &bones_names, do_strip_numbers);
BLI_freelistN(&bones_names);
-
+
/* since we renamed stuff... */
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
-
+
return OPERATOR_FINISHED;
}
@@ -642,11 +642,11 @@ void POSE_OT_flip_names(wmOperatorType *ot)
ot->name = "Flip Names";
ot->idname = "POSE_OT_flip_names";
ot->description = "Flips (and corrects) the axis suffixes of the names of selected bones";
-
+
/* api callbacks */
ot->exec = pose_flip_names_exec;
ot->poll = ED_operator_posemode_local;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -663,12 +663,12 @@ static int pose_autoside_names_exec(bContext *C, wmOperator *op)
bArmature *arm;
char newname[MAXBONENAME];
short axis = RNA_enum_get(op->ptr, "axis");
-
+
/* paranoia checks */
- if (ELEM(NULL, ob, ob->pose))
+ if (ELEM(NULL, ob, ob->pose))
return OPERATOR_CANCELLED;
arm = ob->data;
-
+
/* loop through selected bones, auto-naming them */
CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones)
{
@@ -677,13 +677,13 @@ static int pose_autoside_names_exec(bContext *C, wmOperator *op)
ED_armature_bone_rename(arm, pchan->name, newname);
}
CTX_DATA_END;
-
+
/* since we renamed stuff... */
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
-
+
return OPERATOR_FINISHED;
}
@@ -695,20 +695,20 @@ void POSE_OT_autoside_names(wmOperatorType *ot)
{2, "ZAXIS", 0, "Z-Axis", "Top/Bottom"},
{0, NULL, 0, NULL, NULL}
};
-
+
/* identifiers */
ot->name = "AutoName by Axis";
ot->idname = "POSE_OT_autoside_names";
ot->description = "Automatically renames the selected bones according to which side of the target axis they fall on";
-
+
/* api callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = pose_autoside_names_exec;
ot->poll = ED_operator_posemode;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* settings */
ot->prop = RNA_def_enum(ot->srna, "axis", axis_items, 0, "Axis", "Axis tag names with");
}
@@ -719,18 +719,18 @@ static int pose_bone_rotmode_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_active_object(C);
int mode = RNA_enum_get(op->ptr, "type");
-
+
/* set rotation mode of selected bones */
CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones)
{
pchan->rotmode = mode;
}
CTX_DATA_END;
-
+
/* notifiers and updates */
DAG_id_tag_update((ID *)ob, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, ob);
-
+
return OPERATOR_FINISHED;
}
@@ -740,15 +740,15 @@ void POSE_OT_rotation_mode_set(wmOperatorType *ot)
ot->name = "Set Rotation Mode";
ot->idname = "POSE_OT_rotation_mode_set";
ot->description = "Set the rotation representation used by selected bones";
-
+
/* callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = pose_bone_rotmode_exec;
ot->poll = ED_operator_posemode;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_posebone_rotmode_items, 0, "Rotation Mode", "");
}
@@ -790,25 +790,25 @@ static int pose_armature_layers_showall_exec(bContext *C, wmOperator *op)
int maxLayers = (RNA_boolean_get(op->ptr, "all")) ? 32 : 16;
int layers[32] = {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
int i;
-
+
/* sanity checking */
if (arm == NULL)
return OPERATOR_CANCELLED;
-
+
/* use RNA to set the layers
* although it would be faster to just set directly using bitflags, we still
* need to setup a RNA pointer so that we get the "update" callbacks for free...
*/
RNA_id_pointer_create(&arm->id, &ptr);
-
+
for (i = 0; i < maxLayers; i++)
layers[i] = 1;
-
+
RNA_boolean_set_array(&ptr, "layers", layers);
-
+
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
-
+
/* done */
return OPERATOR_FINISHED;
}
@@ -819,14 +819,14 @@ void ARMATURE_OT_layers_show_all(wmOperatorType *ot)
ot->name = "Show All Layers";
ot->idname = "ARMATURE_OT_layers_show_all";
ot->description = "Make all armature layers visible";
-
+
/* callbacks */
ot->exec = pose_armature_layers_showall_exec;
ot->poll = armature_layers_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* properties */
ot->prop = RNA_def_boolean(ot->srna, "all", 1, "All Layers", "Enable all layers or just the first 16 (top row)");
}
@@ -840,16 +840,16 @@ static int armature_layers_invoke(bContext *C, wmOperator *op, const wmEvent *ev
bArmature *arm = armature_layers_get_data(&ob);
PointerRNA ptr;
int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
-
+
/* sanity checking */
if (arm == NULL)
return OPERATOR_CANCELLED;
-
+
/* get RNA pointer to armature data to use that to retrieve the layers as ints to init the operator */
RNA_id_pointer_create((ID *)arm, &ptr);
RNA_boolean_get_array(&ptr, "layers", layers);
RNA_boolean_set_array(op->ptr, "layers", layers);
-
+
/* part to sync with other similar operators... */
return WM_operator_props_popup(C, op, event);
}
@@ -885,15 +885,15 @@ void ARMATURE_OT_armature_layers(wmOperatorType *ot)
ot->name = "Change Armature Layers";
ot->idname = "ARMATURE_OT_armature_layers";
ot->description = "Change the visible armature layers";
-
+
/* callbacks */
ot->invoke = armature_layers_invoke;
ot->exec = armature_layers_exec;
ot->poll = armature_layers_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* properties */
RNA_def_boolean_layer_member(ot->srna, "layers", 32, NULL, "Layer", "Armature layers to make visible");
}
@@ -904,22 +904,22 @@ void ARMATURE_OT_armature_layers(wmOperatorType *ot)
static int pose_bone_layers_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
-
+
/* get layers that are active already */
CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones)
{
short bit;
-
+
/* loop over the bits for this pchan's layers, adding layers where they're needed */
for (bit = 0; bit < 32; bit++) {
layers[bit] = (pchan->bone->layer & (1u << bit)) != 0;
}
}
CTX_DATA_END;
-
+
/* copy layers to operator */
RNA_boolean_set_array(op->ptr, "layers", layers);
-
+
/* part to sync with other similar operators... */
return WM_operator_props_popup(C, op, event);
}
@@ -959,15 +959,15 @@ void POSE_OT_bone_layers(wmOperatorType *ot)
ot->name = "Change Bone Layers";
ot->idname = "POSE_OT_bone_layers";
ot->description = "Change the layers that the selected bones belong to";
-
+
/* callbacks */
ot->invoke = pose_bone_layers_invoke;
ot->exec = pose_bone_layers_exec;
ot->poll = ED_operator_posemode_exclusive;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* properties */
RNA_def_boolean_layer_member(ot->srna, "layers", 32, NULL, "Layer", "Armature layers that bone belongs to");
}
@@ -978,12 +978,12 @@ void POSE_OT_bone_layers(wmOperatorType *ot)
static int armature_bone_layers_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
int layers[32] = {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
-
+
/* get layers that are active already */
CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones)
{
short bit;
-
+
/* loop over the bits for this pchan's layers, adding layers where they're needed */
for (bit = 0; bit < 32; bit++) {
if (ebone->layer & (1u << bit)) {
@@ -992,10 +992,10 @@ static int armature_bone_layers_invoke(bContext *C, wmOperator *op, const wmEven
}
}
CTX_DATA_END;
-
+
/* copy layers to operator */
RNA_boolean_set_array(op->ptr, "layers", layers);
-
+
/* part to sync with other similar operators... */
return WM_operator_props_popup(C, op, event);
}
@@ -1007,10 +1007,10 @@ static int armature_bone_layers_exec(bContext *C, wmOperator *op)
bArmature *arm = (ob) ? ob->data : NULL;
PointerRNA ptr;
int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
-
+
/* get the values set in the operator properties */
RNA_boolean_get_array(op->ptr, "layers", layers);
-
+
/* set layers of pchans based on the values set in the operator props */
CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones)
{
@@ -1019,10 +1019,10 @@ static int armature_bone_layers_exec(bContext *C, wmOperator *op)
RNA_boolean_set_array(&ptr, "layers", layers);
}
CTX_DATA_END;
-
+
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
-
+
return OPERATOR_FINISHED;
}
@@ -1032,15 +1032,15 @@ void ARMATURE_OT_bone_layers(wmOperatorType *ot)
ot->name = "Change Bone Layers";
ot->idname = "ARMATURE_OT_bone_layers";
ot->description = "Change the layers that the selected bones belong to";
-
+
/* callbacks */
ot->invoke = armature_bone_layers_invoke;
ot->exec = armature_bone_layers_exec;
ot->poll = ED_operator_editarmature;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* properties */
RNA_def_boolean_layer_member(ot->srna, "layers", 32, NULL, "Layer", "Armature layers that bone belongs to");
}
@@ -1048,10 +1048,10 @@ void ARMATURE_OT_bone_layers(wmOperatorType *ot)
/* ********************************************** */
/* Show/Hide Bones */
-static int hide_selected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr))
+static int hide_selected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr))
{
bArmature *arm = ob->data;
-
+
if (arm->layer & bone->layer) {
if (bone->flag & BONE_SELECTED) {
bone->flag |= BONE_HIDDEN_P;
@@ -1063,10 +1063,10 @@ static int hide_selected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr))
return 0;
}
-static int hide_unselected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr))
+static int hide_unselected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr))
{
bArmature *arm = ob->data;
-
+
if (arm->layer & bone->layer) {
/* hrm... typo here? */
if ((bone->flag & BONE_SELECTED) == 0) {
@@ -1079,7 +1079,7 @@ static int hide_unselected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr
}
/* active object is armature in posemode, poll checked */
-static int pose_hide_exec(bContext *C, wmOperator *op)
+static int pose_hide_exec(bContext *C, wmOperator *op)
{
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm = ob->data;
@@ -1092,10 +1092,10 @@ static int pose_hide_exec(bContext *C, wmOperator *op)
bone_looper(ob, arm->bonebase.first, NULL, hide_unselected_pose_bone_cb);
else
bone_looper(ob, arm->bonebase.first, NULL, hide_selected_pose_bone_cb);
-
+
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
-
+
return OPERATOR_FINISHED;
}
@@ -1105,24 +1105,24 @@ void POSE_OT_hide(wmOperatorType *ot)
ot->name = "Hide Selected";
ot->idname = "POSE_OT_hide";
ot->description = "Tag selected bones to not be visible in Pose Mode";
-
+
/* api callbacks */
ot->exec = pose_hide_exec;
ot->poll = ED_operator_posemode;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* props */
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "");
}
-static int show_pose_bone_cb(Object *ob, Bone *bone, void *data)
+static int show_pose_bone_cb(Object *ob, Bone *bone, void *data)
{
const bool select = GET_INT_FROM_POINTER(data);
bArmature *arm = ob->data;
-
+
if (arm->layer & bone->layer) {
if (bone->flag & BONE_HIDDEN_P) {
if (!(bone->flag & BONE_UNSELECTABLE)) {
@@ -1131,19 +1131,19 @@ static int show_pose_bone_cb(Object *ob, Bone *bone, void *data)
bone->flag &= ~BONE_HIDDEN_P;
}
}
-
+
return 0;
}
/* active object is armature in posemode, poll checked */
-static int pose_reveal_exec(bContext *C, wmOperator *op)
+static int pose_reveal_exec(bContext *C, wmOperator *op)
{
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm = ob->data;
const bool select = RNA_boolean_get(op->ptr, "select");
-
+
bone_looper(ob, arm->bonebase.first, SET_INT_IN_POINTER(select), show_pose_bone_cb);
-
+
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
@@ -1156,11 +1156,11 @@ void POSE_OT_reveal(wmOperatorType *ot)
ot->name = "Reveal Selected";
ot->idname = "POSE_OT_reveal";
ot->description = "Reveal all bones hidden in Pose Mode";
-
+
/* api callbacks */
ot->exec = pose_reveal_exec;
ot->poll = ED_operator_posemode;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -1175,7 +1175,7 @@ static int pose_flip_quats_exec(bContext *C, wmOperator *UNUSED(op))
Scene *scene = CTX_data_scene(C);
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOC_ROT_SCALE_ID);
-
+
/* loop through all selected pchans, flipping and keying (as needed) */
CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones)
{
@@ -1188,11 +1188,11 @@ static int pose_flip_quats_exec(bContext *C, wmOperator *UNUSED(op))
}
}
CTX_DATA_END;
-
+
/* notifiers and updates */
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, ob);
-
+
return OPERATOR_FINISHED;
}
@@ -1202,11 +1202,11 @@ void POSE_OT_quaternions_flip(wmOperatorType *ot)
ot->name = "Flip Quats";
ot->idname = "POSE_OT_quaternions_flip";
ot->description = "Flip quaternion values to achieve desired rotations, while maintaining the same orientations";
-
+
/* callbacks */
ot->exec = pose_flip_quats_exec;
ot->poll = ED_operator_posemode;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}