Move out pose edit options into the pose data
Move pose edit mode booleans out of the armature data into the pose data Reviewed By: Brecht Differential Revision: http://developer.blender.org/D4832
This commit is contained in:
@@ -191,14 +191,14 @@ class VIEW3D_PT_tools_posemode_options(View3DPanel, Panel):
|
||||
bl_label = "Pose Options"
|
||||
|
||||
def draw(self, context):
|
||||
arm = context.active_object.data
|
||||
pose = context.active_object.pose
|
||||
layout = self.layout
|
||||
|
||||
layout.prop(arm, "use_auto_ik")
|
||||
layout.prop(arm, "use_mirror_x")
|
||||
layout.prop(pose, "use_auto_ik")
|
||||
layout.prop(pose, "use_mirror_x")
|
||||
col = layout.column()
|
||||
col.active = arm.use_mirror_x
|
||||
col.prop(arm, "use_mirror_relative")
|
||||
col.active = pose.use_mirror_x
|
||||
col.prop(pose, "use_mirror_relative")
|
||||
|
||||
# ********** default tools for paint modes ****************
|
||||
|
||||
|
||||
@@ -3039,7 +3039,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
}
|
||||
|
||||
LISTBASE_FOREACH (bArmature *, arm, &bmain->armatures) {
|
||||
arm->flag &= ~(ARM_FLAG_UNUSED_1 | ARM_FLAG_UNUSED_5 | ARM_MIRROR_RELATIVE |
|
||||
arm->flag &= ~(ARM_FLAG_UNUSED_1 | ARM_FLAG_UNUSED_5 | ARM_FLAG_UNUSED_7 |
|
||||
ARM_FLAG_UNUSED_12);
|
||||
}
|
||||
|
||||
@@ -3396,5 +3396,8 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
}
|
||||
|
||||
/* Versioning code until next subversion bump goes here. */
|
||||
LISTBASE_FOREACH (bArmature *, arm, &bmain->armatures) {
|
||||
arm->flag &= ~(ARM_FLAG_UNUSED_7 | ARM_FLAG_UNUSED_9);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ typedef struct PoseInitData_Mirror {
|
||||
} orig;
|
||||
/**
|
||||
* An extra offset to apply after mirroring.
|
||||
* Use with #ARM_MIRROR_RELATIVE.
|
||||
* Use with #POSE_MIRROR_RELATIVE.
|
||||
*/
|
||||
float offset_mtx[4][4];
|
||||
} PoseInitData_Mirror;
|
||||
|
||||
@@ -1286,17 +1286,18 @@ static void createTransPose(TransInfo *t)
|
||||
|
||||
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
||||
Object *ob = tc->poseobj;
|
||||
bPose *pose = ob->pose;
|
||||
|
||||
bArmature *arm;
|
||||
short ik_on = 0;
|
||||
|
||||
/* check validity of state */
|
||||
arm = BKE_armature_from_object(tc->poseobj);
|
||||
if ((arm == NULL) || (ob->pose == NULL)) {
|
||||
if ((arm == NULL) || (pose == NULL)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const bool mirror = ((arm->flag & ARM_MIRROR_EDIT) != 0);
|
||||
const bool mirror = ((pose->flag & POSE_MIRROR_EDIT) != 0);
|
||||
|
||||
/* set flags and count total */
|
||||
tc->data_len = count_set_pose_transflags(ob, t->mode, t->around, has_translate_rotate);
|
||||
@@ -1313,7 +1314,7 @@ static void createTransPose(TransInfo *t)
|
||||
}
|
||||
|
||||
/* do we need to add temporal IK chains? */
|
||||
if ((arm->flag & ARM_AUTO_IK) && t->mode == TFM_TRANSLATION) {
|
||||
if ((pose->flag & POSE_AUTO_IK) && t->mode == TFM_TRANSLATION) {
|
||||
ik_on = pose_grab_with_ik(bmain, ob);
|
||||
if (ik_on) {
|
||||
t->flag |= T_AUTOIK;
|
||||
@@ -1363,16 +1364,14 @@ static void createTransPose(TransInfo *t)
|
||||
|
||||
PoseInitData_Mirror *pid = tc->custom.type.data;
|
||||
int pid_index = 0;
|
||||
bArmature *arm;
|
||||
bPose *pose = ob->pose;
|
||||
|
||||
/* check validity of state */
|
||||
arm = BKE_armature_from_object(tc->poseobj);
|
||||
if ((arm == NULL) || (ob->pose == NULL)) {
|
||||
if (pose == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const bool mirror = ((arm->flag & ARM_MIRROR_EDIT) != 0);
|
||||
const bool is_mirror_relative = ((arm->flag & ARM_MIRROR_RELATIVE) != 0);
|
||||
const bool mirror = ((pose->flag & POSE_MIRROR_EDIT) != 0);
|
||||
const bool is_mirror_relative = ((pose->flag & POSE_MIRROR_RELATIVE) != 0);
|
||||
|
||||
tc->poseobj = ob; /* we also allow non-active objects to be transformed, in weightpaint */
|
||||
|
||||
@@ -1420,17 +1419,9 @@ static void createTransPose(TransInfo *t)
|
||||
|
||||
void restoreMirrorPoseBones(TransDataContainer *tc)
|
||||
{
|
||||
bArmature *arm;
|
||||
bPose *pose = tc->poseobj->pose;
|
||||
|
||||
if (tc->obedit) {
|
||||
arm = tc->obedit->data;
|
||||
}
|
||||
else {
|
||||
BLI_assert(tc->poseobj != NULL);
|
||||
arm = tc->poseobj->data;
|
||||
}
|
||||
|
||||
if (!(arm->flag & ARM_MIRROR_EDIT)) {
|
||||
if (!(pose->flag & POSE_MIRROR_EDIT)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1030,11 +1030,12 @@ static void recalcData_objects(TransInfo *t)
|
||||
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
||||
Object *ob = tc->poseobj;
|
||||
bArmature *arm = ob->data;
|
||||
bPose *pose = ob->pose;
|
||||
|
||||
if (arm->flag & ARM_MIRROR_EDIT) {
|
||||
if (pose->flag & POSE_MIRROR_EDIT) {
|
||||
if (t->state != TRANS_CANCEL) {
|
||||
PoseInitData_Mirror *pid = NULL;
|
||||
if (arm->flag & ARM_MIRROR_RELATIVE) {
|
||||
if (pose->flag & POSE_MIRROR_RELATIVE) {
|
||||
pid = tc->custom.type.data;
|
||||
}
|
||||
pose_transform_mirror_update(ob, pid);
|
||||
|
||||
@@ -512,6 +512,12 @@ typedef enum ePose_Flags {
|
||||
POSE_FLAG_DEPRECATED = (1 << 6), /* deprecated. */
|
||||
/* pose constraint flags needs to be updated */
|
||||
POSE_CONSTRAINTS_NEED_UPDATE_FLAGS = (1 << 7),
|
||||
/* Use auto IK in pose mode */
|
||||
POSE_AUTO_IK = (1 << 8),
|
||||
/* Use x-axis mirror in pose mode */
|
||||
POSE_MIRROR_EDIT = (1 << 9),
|
||||
/* Use relative mirroring in mirror mode */
|
||||
POSE_MIRROR_RELATIVE = (1 << 10),
|
||||
} ePose_Flags;
|
||||
|
||||
/* IK Solvers ------------------------------------ */
|
||||
|
||||
@@ -144,9 +144,9 @@ typedef enum eArmature_Flag {
|
||||
ARM_POSEMODE = (1 << 4),
|
||||
ARM_FLAG_UNUSED_5 = (1 << 5), /* cleared */
|
||||
ARM_DELAYDEFORM = (1 << 6),
|
||||
ARM_MIRROR_RELATIVE = (1 << 7),
|
||||
ARM_FLAG_UNUSED_7 = (1 << 7),
|
||||
ARM_MIRROR_EDIT = (1 << 8),
|
||||
ARM_AUTO_IK = (1 << 9),
|
||||
ARM_FLAG_UNUSED_9 = (1 << 9),
|
||||
/** made option negative, for backwards compat */
|
||||
ARM_NO_CUSTOM = (1 << 10),
|
||||
/** draw custom colors */
|
||||
|
||||
@@ -1359,20 +1359,6 @@ static void rna_def_armature(BlenderRNA *brna)
|
||||
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
|
||||
RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
|
||||
|
||||
prop = RNA_def_property(srna, "use_mirror_relative", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_MIRROR_RELATIVE);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Relative Mirror", "Apply relative transformations in X-mirror mode");
|
||||
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
|
||||
|
||||
RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
|
||||
prop = RNA_def_property(srna, "use_auto_ik", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_AUTO_IK);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Auto IK", "Add temporary IK constraints while grabbing bones in Pose Mode");
|
||||
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
|
||||
RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
|
||||
|
||||
prop = RNA_def_property(srna, "show_bone_custom_shapes", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ARM_NO_CUSTOM);
|
||||
RNA_def_property_ui_text(
|
||||
|
||||
@@ -122,6 +122,11 @@ static void rna_Pose_IK_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Pointe
|
||||
BIK_clear_data(ob->pose);
|
||||
}
|
||||
|
||||
static char *rna_Pose_path(PointerRNA *UNUSED(ptr))
|
||||
{
|
||||
return BLI_strdup("pose");
|
||||
}
|
||||
|
||||
static char *rna_PoseBone_path(PointerRNA *ptr)
|
||||
{
|
||||
bPoseChannel *pchan = ptr->data;
|
||||
@@ -1551,6 +1556,31 @@ static void rna_def_pose(BlenderRNA *brna)
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "IK Param", "Parameters for IK solver");
|
||||
|
||||
/* pose edit options */
|
||||
prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", POSE_MIRROR_EDIT);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "X-Axis Mirror", "Apply changes to matching bone on opposite side of X-Axis");
|
||||
RNA_def_struct_path_func(srna, "rna_Pose_path");
|
||||
RNA_def_property_update(prop, 0, "rna_Pose_update");
|
||||
RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
|
||||
|
||||
prop = RNA_def_property(srna, "use_mirror_relative", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", POSE_MIRROR_RELATIVE);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Relative Mirror", "Apply relative transformations in X-mirror mode");
|
||||
RNA_def_struct_path_func(srna, "rna_Pose_path");
|
||||
RNA_def_property_update(prop, 0, "rna_Pose_update");
|
||||
RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
|
||||
|
||||
prop = RNA_def_property(srna, "use_auto_ik", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", POSE_AUTO_IK);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Auto IK", "Add temporary IK constraints while grabbing bones in Pose Mode");
|
||||
RNA_def_struct_path_func(srna, "rna_Pose_path");
|
||||
RNA_def_property_update(prop, 0, "rna_Pose_update");
|
||||
RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
|
||||
|
||||
/* animviz */
|
||||
rna_def_animviz_common(srna);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user