static int apply_armature_pose2bones_exec (bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); // must be active object, not edit-object
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C)); // must be active object, not edit-object
bArmature *arm= get_armature(ob);
bPose *pose;
bPoseChannel *pchan;
/* set the current pose as the restpose */
static int pose_visual_transform_apply_exec (bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); // must be active object, not edit-object
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C)); // must be active object, not edit-object
/* don't check if editmode (should be done by caller) */
if (ob->type!=OB_ARMATURE)
void (*clear_func)(bPoseChannel*), const char default_ksName[])
{
Scene *scene= CTX_data_scene(C);
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
short autokey = 0;
/* sanity checks */
static int pose_select_parent_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
bPoseChannel *pchan,*parent;
/* Determine if there is an active bone */
/* active object is armature in posemode, poll checked */
static int pose_hide_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm= ob->data;
if(RNA_boolean_get(op->ptr, "unselected"))
/* active object is armature in posemode, poll checked */
static int pose_reveal_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm= ob->data;
bone_looper(ob, arm->bonebase.first, NULL, show_pose_bone_cb);
#include "BKE_depsgraph.h"
#include "BKE_fcurve.h"
#include "BKE_modifier.h"
+#include "BKE_object.h"
#include "BKE_report.h"
#include "armature_intern.h"
-static int object_pose_context(Object *ob)
-{
- if( (ob) &&
- (ob->type == OB_ARMATURE) &&
- (ob->pose) &&
- (ob->mode & OB_MODE_POSE)
- ) {
- return 1;
- }
- else {
- return 0;
- }
-}
-
-Object *ED_object_pose_armature(Object *ob)
-{
- if(ob==NULL)
- return NULL;
-
- if(object_pose_context(ob))
- return ob;
-
- ob= modifiers_isDeformedByArmature(ob);
-
- if(object_pose_context(ob))
- return ob;
-
- return NULL;
-}
-
/* This function is used to process the necessary updates for */
void ED_armature_enter_posemode(bContext *C, Base *base)
{
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= ED_object_pose_armature(CTX_data_active_object(C));
+ ob= object_pose_armature_get(CTX_data_active_object(C));
if (ELEM(NULL, ob, ob->pose))
return OPERATOR_CANCELLED;
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= ED_object_pose_armature(CTX_data_active_object(C));
+ ob= object_pose_armature_get(CTX_data_active_object(C));
/* only continue if there's an object */
if ELEM(NULL, ob, ob->pose)
static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
bConstraint *con;
int found= 0;
static int pose_select_hierarchy_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm= ob->data;
Bone *curbone, *pabone, *chbone;
int direction = RNA_enum_get(op->ptr, "direction");
static int pose_select_grouped_exec (bContext *C, wmOperator *op)
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
short extend= RNA_boolean_get(op->ptr, "extend");
short changed = 0;
static int pose_bone_flip_active_exec (bContext *C, wmOperator *UNUSED(op))
{
Object *ob_act= CTX_data_active_object(C);
- Object *ob= ED_object_pose_armature(ob_act);
+ Object *ob= object_pose_armature_get(ob_act);
if(ob && (ob->mode & OB_MODE_POSE)) {
bArmature *arm= ob->data;
static int pose_copy_exec (bContext *C, wmOperator *op)
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
/* sanity checking */
if ELEM(NULL, ob, ob->pose) {
static int pose_paste_exec (bContext *C, wmOperator *op)
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
Scene *scene= CTX_data_scene(C);
bPoseChannel *chan;
int flip= RNA_boolean_get(op->ptr, "flipped");
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= ED_object_pose_armature(CTX_data_active_object(C));
+ ob= object_pose_armature_get(CTX_data_active_object(C));
/* only continue if there's an object */
if (ob == NULL)
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= ED_object_pose_armature(CTX_data_active_object(C));
+ ob= object_pose_armature_get(CTX_data_active_object(C));
/* only continue if there's an object */
if (ob == NULL)
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= ED_object_pose_armature(CTX_data_active_object(C));
+ ob= object_pose_armature_get(CTX_data_active_object(C));
/* only continue if there's an object, and a pose there too */
if (ELEM(NULL, ob, ob->pose))
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= ED_object_pose_armature(CTX_data_active_object(C));
+ ob= object_pose_armature_get(CTX_data_active_object(C));
/* only continue if there's an object, and a pose there too */
if (ELEM(NULL, ob, ob->pose))
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= ED_object_pose_armature(CTX_data_active_object(C));
+ ob= object_pose_armature_get(CTX_data_active_object(C));
/* only continue if there's an object, and a pose there too */
if (ELEM(NULL, ob, ob->pose))
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= ED_object_pose_armature(CTX_data_active_object(C));
+ ob= object_pose_armature_get(CTX_data_active_object(C));
/* only continue if there's an object, and a pose there too */
if (ELEM(NULL, ob, ob->pose))
if (sa->spacetype == SPACE_BUTS)
ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
else
- ob= ED_object_pose_armature(CTX_data_active_object(C));
+ ob= object_pose_armature_get(CTX_data_active_object(C));
/* only continue if there's an object, and a pose there too */
if (ELEM(NULL, ob, ob->pose))
static int pose_flip_names_exec (bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm;
/* paranoia checks */
static int pose_autoside_names_exec (bContext *C, wmOperator *op)
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm;
char newname[32];
short axis= RNA_enum_get(op->ptr, "axis");
static int pose_armature_layers_showall_exec (bContext *C, wmOperator *op)
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm = (ob)? ob->data : NULL;
PointerRNA ptr;
int maxLayers = (RNA_boolean_get(op->ptr, "all"))? 32 : 16;
/* Present a popup to get the layers that should be used */
static int pose_armature_layers_invoke (bContext *C, wmOperator *op, wmEvent *evt)
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
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... */
/* Set the visible layers for the active armature (edit and pose modes) */
static int pose_armature_layers_exec (bContext *C, wmOperator *op)
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
PointerRNA ptr;
int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
/* Set the visible layers for the active armature (edit and pose modes) */
static int pose_bone_layers_exec (bContext *C, wmOperator *op)
{
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
PointerRNA ptr;
int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
static int pose_flip_quats_exec (bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
- Object *ob= ED_object_pose_armature(CTX_data_active_object(C));
+ Object *ob= object_pose_armature_get(CTX_data_active_object(C));
KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, "LocRotScale");
/* loop through all selected pchans, flipping and keying (as needed) */