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:
authorSebastian Parborg <darkdefende@gmail.com>2019-05-09 12:19:38 +0300
committerSebastian Parborg <darkdefende@gmail.com>2019-05-09 12:21:34 +0300
commit5ab57f7ba41dff3d4554d1cb47db2b2868efe710 (patch)
tree84fefd90ab7b498fc1542eebc2f009ca8986f42d
parentffb3226d276fd0af584431bc86ab25fa79c44a37 (diff)
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
-rw-r--r--release/scripts/startup/bl_ui/space_view3d_toolbar.py10
-rw-r--r--source/blender/blenloader/intern/versioning_280.c5
-rw-r--r--source/blender/editors/transform/transform.h2
-rw-r--r--source/blender/editors/transform/transform_conversions.c29
-rw-r--r--source/blender/editors/transform/transform_generics.c5
-rw-r--r--source/blender/makesdna/DNA_action_types.h6
-rw-r--r--source/blender/makesdna/DNA_armature_types.h4
-rw-r--r--source/blender/makesrna/intern/rna_armature.c14
-rw-r--r--source/blender/makesrna/intern/rna_pose.c30
9 files changed, 61 insertions, 44 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 9610c16e344..bf38e65ff99 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -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 ****************
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 96dc96d9cc5..f1c92dedd33 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -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);
+ }
}
}
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 0e2d6dcc493..b0f720bfdf7 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -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;
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index a4971ef24a9..4037fab2b68 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -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;
-
- if (tc->obedit) {
- arm = tc->obedit->data;
- }
- else {
- BLI_assert(tc->poseobj != NULL);
- arm = tc->poseobj->data;
- }
+ bPose *pose = tc->poseobj->pose;
- if (!(arm->flag & ARM_MIRROR_EDIT)) {
+ if (!(pose->flag & POSE_MIRROR_EDIT)) {
return;
}
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 87be60531cc..ddd8a1d19e4 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -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);
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index c524f50ff52..c8a76791cef 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -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 ------------------------------------ */
diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h
index fd40459503e..8ae9aa5a041 100644
--- a/source/blender/makesdna/DNA_armature_types.h
+++ b/source/blender/makesdna/DNA_armature_types.h
@@ -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 */
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c
index fe197faecce..d1e3cb1c860 100644
--- a/source/blender/makesrna/intern/rna_armature.c
+++ b/source/blender/makesrna/intern/rna_armature.c
@@ -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(
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index 1b4a7efbdd8..7babbbdc8c7 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -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);