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:
-rw-r--r--release/scripts/modules/keyingsets_utils.py34
-rw-r--r--release/scripts/startup/keyingsets_builtins.py18
-rw-r--r--source/blender/editors/include/ED_keyframing.h1
3 files changed, 53 insertions, 0 deletions
diff --git a/release/scripts/modules/keyingsets_utils.py b/release/scripts/modules/keyingsets_utils.py
index 190f0282339..b7a15bbbc19 100644
--- a/release/scripts/modules/keyingsets_utils.py
+++ b/release/scripts/modules/keyingsets_utils.py
@@ -219,6 +219,40 @@ def RKS_GEN_scaling(_ksi, _context, ks, data):
else:
ks.paths.add(id_block, path)
+
+# Custom Properties
+def RKS_GEN_custom_props(_ksi, _context, ks, data):
+ # get id-block and path info
+ id_block, base_path, grouping = get_transform_generators_base_info(data)
+
+ # Only some RNA types can be animated.
+ prop_type_compat = {bpy.types.BoolProperty,
+ bpy.types.IntProperty,
+ bpy.types.FloatProperty}
+
+ # When working with a pose, 'id_block' is the armature object (which should
+ # get the animation data), whereas 'data' is the bone being keyed.
+ for cprop_name in data.keys():
+ # ignore special "_RNA_UI" used for UI editing
+ if cprop_name == "_RNA_UI":
+ continue
+
+ prop_path = '["%s"]' % bpy.utils.escape_identifier(cprop_name)
+ try:
+ rna_property = data.path_resolve(prop_path, False)
+ except ValueError as ex:
+ # This happens when a custom property is set to None. In that case it cannot
+ # be converted to an FCurve-compatible value, so we can't keyframe it anyway.
+ continue
+ if rna_property.rna_type not in prop_type_compat:
+ continue
+
+ path = "%s%s" % (base_path, prop_path)
+ if grouping:
+ ks.paths.add(id_block, path, group_method='NAMED', group_name=grouping)
+ else:
+ ks.paths.add(id_block, path)
+
# ------
diff --git a/release/scripts/startup/keyingsets_builtins.py b/release/scripts/startup/keyingsets_builtins.py
index 9343c75cd4b..83151a3480c 100644
--- a/release/scripts/startup/keyingsets_builtins.py
+++ b/release/scripts/startup/keyingsets_builtins.py
@@ -44,6 +44,7 @@ ANIM_KS_LOCATION_ID = "Location"
ANIM_KS_ROTATION_ID = "Rotation"
ANIM_KS_SCALING_ID = "Scaling"
ANIM_KS_LOC_ROT_SCALE_ID = "LocRotScale"
+ANIM_KS_LOC_ROT_SCALE_CPROP_ID = "LocRotScaleCProp"
ANIM_KS_AVAILABLE_ID = "Available"
ANIM_KS_WHOLE_CHARACTER_ID = "WholeCharacter"
ANIM_KS_WHOLE_CHARACTER_SELECTED_ID = "WholeCharacterSelected"
@@ -159,6 +160,22 @@ class BUILTIN_KSI_LocRotScale(KeyingSetInfo):
keyingsets_utils.RKS_GEN_scaling(self, context, ks, data)
+# LocRotScaleCProp
+class BUILTIN_KSI_LocRotScaleCProp(KeyingSetInfo):
+ """Key location/rotation/scale as well as custom properties"""
+ bl_idname = ANIM_KS_LOC_ROT_SCALE_CPROP_ID
+ bl_label = "Location, Rotation, Scale & Custom Properties"
+
+ poll = keyingsets_utils.RKS_POLL_selected_items
+ iterator = keyingsets_utils.RKS_ITER_selected_item
+
+ def generate(self, context, ks, data):
+ keyingsets_utils.RKS_GEN_location(self, context, ks, data)
+ keyingsets_utils.RKS_GEN_rotation(self, context, ks, data)
+ keyingsets_utils.RKS_GEN_scaling(self, context, ks, data)
+ keyingsets_utils.RKS_GEN_custom_props(self, context, ks, data)
+
+
# RotScale
class BUILTIN_KSI_RotScale(KeyingSetInfo):
"""Insert a keyframe on each of the rotation and scale channels"""
@@ -651,6 +668,7 @@ classes = (
BUILTIN_KSI_Scaling,
BUILTIN_KSI_LocRot,
BUILTIN_KSI_LocRotScale,
+ BUILTIN_KSI_LocRotScaleCProp,
BUILTIN_KSI_LocScale,
BUILTIN_KSI_RotScale,
BUILTIN_KSI_DeltaLocation,
diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h
index 12d6f1fce54..179c9d5b30d 100644
--- a/source/blender/editors/include/ED_keyframing.h
+++ b/source/blender/editors/include/ED_keyframing.h
@@ -511,6 +511,7 @@ bool ED_autokeyframe_property(struct bContext *C,
#define ANIM_KS_ROTATION_ID "Rotation"
#define ANIM_KS_SCALING_ID "Scaling"
#define ANIM_KS_LOC_ROT_SCALE_ID "LocRotScale"
+#define ANIM_KS_LOC_ROT_SCALE_CPROP_ID "LocRotScaleCProp"
#define ANIM_KS_AVAILABLE_ID "Available"
#define ANIM_KS_WHOLE_CHARACTER_ID "WholeCharacter"
#define ANIM_KS_WHOLE_CHARACTER_SELECTED_ID "WholeCharacterSelected"