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:
authorAlexander Gavrilov <angavrilov@gmail.com>2020-12-11 19:17:39 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2021-06-18 18:56:03 +0300
commit682a74e0909ba4e669a3f282b3bc5da0ae81e4da (patch)
tree85aecf8652ddc680973a8cf9eed3a5b60b8a36d7 /source/blender/makesdna
parentaee04d496035c2b11b640a91b2e7eca86e878cf2 (diff)
Armature: add B-Bone Y scale channel and extra flag fields to DNA.
In addition to the base bone transformation itself, B-Bones have controls that affect transformation of its segments. For rotation the features are quite complete, allowing to both reorient the Bezier handles via properties, and to control them using custom handle bones. However for scaling there are two deficiencies. First, there are only X and Y scale factors (actually X and Z), while lengthwise all segments have the same scaling. The ease option merely affects the shape of the curve, and does not cause actual scaling. Second, scaling can only be controlled via properties, thus requiring up to 6 drivers per joint between B-Bones to transfer scaling factors from the handle bone. This is very inefficient. Finally, the Z channels are confusingly called Y. This commit adds a B-Bone Y Scale channel and extra B-Bone flag fields to DNA with appropriate versioning (including for F-Curves and drivers) in preparation to addressing these limitations. Functionality is not changed, so the new fields are not used until the following commits. Differential Revision: https://developer.blender.org/D9870
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r--source/blender/makesdna/DNA_action_types.h9
-rw-r--r--source/blender/makesdna/DNA_armature_types.h21
-rw-r--r--source/blender/makesdna/intern/dna_rename_defs.h12
3 files changed, 30 insertions, 12 deletions
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index 583e56de9c2..a5ed870ee78 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -328,11 +328,12 @@ typedef struct bPoseChannel {
* and are applied on top of the copies in pchan->bone
*/
float roll1, roll2;
- float curve_in_x, curve_in_y;
- float curve_out_x, curve_out_y;
+ float curve_in_x, curve_in_z;
+ float curve_out_x, curve_out_z;
float ease1, ease2;
- float scale_in_x, scale_in_y;
- float scale_out_x, scale_out_y;
+ float scale_in_x DNA_DEPRECATED, scale_in_z DNA_DEPRECATED;
+ float scale_out_x DNA_DEPRECATED, scale_out_z DNA_DEPRECATED;
+ float scale_in[3], scale_out[3];
/** B-Bone custom handles; set on read file or rebuild pose based on pchan->bone data. */
struct bPoseChannel *bbone_prev;
diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h
index 85780bc33c5..f5574b36602 100644
--- a/source/blender/makesdna/DNA_armature_types.h
+++ b/source/blender/makesdna/DNA_armature_types.h
@@ -86,12 +86,13 @@ typedef struct Bone {
/** Curved bones settings - these define the "rest-pose" for a curved bone. */
float roll1, roll2;
- float curve_in_x, curve_in_y;
- float curve_out_x, curve_out_y;
+ float curve_in_x, curve_in_z;
+ float curve_out_x, curve_out_z;
/** Length of bezier handles. */
float ease1, ease2;
- float scale_in_x, scale_in_y;
- float scale_out_x, scale_out_y;
+ float scale_in_x DNA_DEPRECATED, scale_in_z DNA_DEPRECATED;
+ float scale_out_x DNA_DEPRECATED, scale_out_z DNA_DEPRECATED;
+ float scale_in[3], scale_out[3];
/** Patch for upward compatibility, UNUSED! */
float size[3];
@@ -103,6 +104,10 @@ typedef struct Bone {
/** Type of next/prev bone handles. */
char bbone_prev_type;
char bbone_next_type;
+ /** B-Bone flags. */
+ int bbone_flag;
+ short bbone_prev_flag;
+ short bbone_next_flag;
/** Next/prev bones to use as handle references when calculating bbones (optional). */
struct Bone *bbone_prev;
struct Bone *bbone_next;
@@ -259,8 +264,10 @@ typedef enum eBone_Flag {
BONE_NO_LOCAL_LOCATION = (1 << 22),
/** object child will use relative transform (like deform) */
BONE_RELATIVE_PARENTING = (1 << 23),
+#ifdef DNA_DEPRECATED_ALLOW
/** it will add the parent end roll to the inroll */
BONE_ADD_PARENT_END_ROLL = (1 << 24),
+#endif
/** this bone was transformed by the mirror function */
BONE_TRANSFORM_MIRROR = (1 << 25),
/** this bone is associated with a locked vertex group, ONLY USE FOR DRAWING */
@@ -291,6 +298,12 @@ typedef enum eBone_BBoneHandleType {
BBONE_HANDLE_TANGENT = 3, /* Custom handle in tangent mode (use direction, not location). */
} eBone_BBoneHandleType;
+/* bone->bbone_flag */
+typedef enum eBone_BBoneFlag {
+ /** Add the parent Out roll to the In roll. */
+ BBONE_ADD_PARENT_END_ROLL = (1 << 0),
+} eBone_BBoneFlag;
+
#define MAXBONENAME 64
#ifdef __cplusplus
diff --git a/source/blender/makesdna/intern/dna_rename_defs.h b/source/blender/makesdna/intern/dna_rename_defs.h
index 34413730eb3..84120a54da4 100644
--- a/source/blender/makesdna/intern/dna_rename_defs.h
+++ b/source/blender/makesdna/intern/dna_rename_defs.h
@@ -59,11 +59,13 @@ DNA_STRUCT_RENAME(SpaceOops, SpaceOutliner)
DNA_STRUCT_RENAME_ELEM(BPoint, alfa, tilt)
DNA_STRUCT_RENAME_ELEM(BezTriple, alfa, tilt)
DNA_STRUCT_RENAME_ELEM(Bone, curveInX, curve_in_x)
-DNA_STRUCT_RENAME_ELEM(Bone, curveInY, curve_in_y)
+DNA_STRUCT_RENAME_ELEM(Bone, curveInY, curve_in_z)
DNA_STRUCT_RENAME_ELEM(Bone, curveOutX, curve_out_x)
-DNA_STRUCT_RENAME_ELEM(Bone, curveOutY, curve_out_y)
+DNA_STRUCT_RENAME_ELEM(Bone, curveOutY, curve_out_z)
DNA_STRUCT_RENAME_ELEM(Bone, scaleIn, scale_in_x)
+DNA_STRUCT_RENAME_ELEM(Bone, scale_in_y, scale_in_z)
DNA_STRUCT_RENAME_ELEM(Bone, scaleOut, scale_out_x)
+DNA_STRUCT_RENAME_ELEM(Bone, scale_out_y, scale_out_z)
DNA_STRUCT_RENAME_ELEM(BrushGpencilSettings, gradient_f, hardeness)
DNA_STRUCT_RENAME_ELEM(BrushGpencilSettings, gradient_s, aspect_ratio)
DNA_STRUCT_RENAME_ELEM(Camera, YF_dofdist, dof_distance)
@@ -101,11 +103,13 @@ DNA_STRUCT_RENAME_ELEM(View3D, ob_centre_cursor, ob_center_cursor)
DNA_STRUCT_RENAME_ELEM(bGPDstroke, gradient_f, hardeness)
DNA_STRUCT_RENAME_ELEM(bGPDstroke, gradient_s, aspect_ratio)
DNA_STRUCT_RENAME_ELEM(bPoseChannel, curveInX, curve_in_x)
-DNA_STRUCT_RENAME_ELEM(bPoseChannel, curveInY, curve_in_y)
+DNA_STRUCT_RENAME_ELEM(bPoseChannel, curveInY, curve_in_z)
DNA_STRUCT_RENAME_ELEM(bPoseChannel, curveOutX, curve_out_x)
-DNA_STRUCT_RENAME_ELEM(bPoseChannel, curveOutY, curve_out_y)
+DNA_STRUCT_RENAME_ELEM(bPoseChannel, curveOutY, curve_out_z)
DNA_STRUCT_RENAME_ELEM(bPoseChannel, scaleIn, scale_in_x)
+DNA_STRUCT_RENAME_ELEM(bPoseChannel, scale_in_y, scale_in_z)
DNA_STRUCT_RENAME_ELEM(bPoseChannel, scaleOut, scale_out_x)
+DNA_STRUCT_RENAME_ELEM(bPoseChannel, scale_out_y, scale_out_z)
DNA_STRUCT_RENAME_ELEM(bSameVolumeConstraint, flag, free_axis)
DNA_STRUCT_RENAME_ELEM(bSound, name, filepath)
DNA_STRUCT_RENAME_ELEM(bTheme, tact, space_action)