bugfix [#23795] Insert Visual Loc/Rot Keyframe of Armature Bones Broken

- converted 3 options in keying sets to use bl_options like panels & operators
- removed function arguments for new keying sets, better adjust these after to avoid duplicating properties in function arguments (they were not used).
This commit is contained in:
Campbell Barton 2010-09-23 08:15:53 +00:00
parent dab69c01a1
commit 1c3f2354f8
4 changed files with 25 additions and 46 deletions

@ -141,7 +141,7 @@ class BUILTIN_KSI_VisualLoc(bpy.types.KeyingSetInfo):
class BUILTIN_KSI_VisualRot(bpy.types.KeyingSetInfo):
bl_label = "Visual Rotation"
insertkey_visual = True
bl_options = {'INSERTKEY_VISUAL'}
# poll - use predefined callback for selected bones/objects
poll = RKS_POLL_selected_items
@ -156,7 +156,7 @@ class BUILTIN_KSI_VisualRot(bpy.types.KeyingSetInfo):
class BUILTIN_KSI_VisualLocRot(bpy.types.KeyingSetInfo):
bl_label = "Visual LocRot"
insertkey_visual = True
bl_options = {'INSERTKEY_VISUAL'}
# poll - use predefined callback for selected bones/objects
poll = RKS_POLL_selected_items

@ -96,9 +96,7 @@ class SCENE_PT_keying_sets(SceneButtonsPanel, bpy.types.Panel):
col = row.column()
col.label(text="Keyframing Settings:")
col.prop(ks, "use_insertkey_needed", text="Needed")
col.prop(ks, "use_insertkey_visual", text="Visual")
col.prop(ks, "use_insertkey_xyz_to_rgb", text="XYZ to RGB")
col.prop(ks, "bl_options")
class SCENE_PT_keying_set_paths(SceneButtonsPanel, bpy.types.Panel):
@ -234,7 +232,7 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
f.write("# Keying Set: %s\n" % ks.name)
f.write("import bpy\n\n")
f.write("scene= bpy.data.scenes[0]\n\n")
f.write("scene= bpy.data.scenes[0]\n\n") # XXX, why not use the current scene?
# Add KeyingSet and set general settings
f.write("# Keying Set Level declarations\n")
@ -243,10 +241,8 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
if not ks.is_path_absolute:
f.write("ks.is_path_absolute = False\n")
f.write("\n")
f.write("ks.use_insertkey_needed = %s\n" % ks.use_insertkey_needed)
f.write("ks.use_insertkey_visual = %s\n" % ks.use_insertkey_visual)
f.write("ks.use_insertkey_xyz_to_rgb = %s\n" % ks.use_insertkey_xyz_to_rgb)
f.write("ks.bl_options = %r\n" % ks.bl_options)
f.write("\n")
# generate and write set of lookups for id's used in paths

@ -394,21 +394,18 @@ static void rna_KeyingSet_paths_clear(KeyingSet *keyingset, ReportList *reports)
static void rna_def_common_keying_flags(StructRNA *srna, short reg)
{
PropertyRNA *prop;
prop= RNA_def_property(srna, "use_insertkey_needed", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "keyingflag", INSERTKEY_NEEDED);
RNA_def_property_ui_text(prop, "Insert Keyframes - Only Needed", "Only insert keyframes where they're needed in the relevant F-Curves");
if (reg) RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
prop= RNA_def_property(srna, "use_insertkey_visual", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "keyingflag", INSERTKEY_MATRIX);
RNA_def_property_ui_text(prop, "Insert Keyframes - Visual", "Insert keyframes based on 'visual transforms'");
if (reg) RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
prop= RNA_def_property(srna, "use_insertkey_xyz_to_rgb", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "keyingflag", INSERTKEY_XYZ2RGB);
RNA_def_property_ui_text(prop, "F-Curve Colors - XYZ to RGB", "Color for newly added transformation F-Curves (Location, Rotation, Scale) and also Color is based on the transform axis");
if (reg) RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
static EnumPropertyItem keying_flag_items[] = {
{INSERTKEY_NEEDED, "INSERTKEY_NEEDED", 0, "Insert Keyframes - Only Needed", "Only insert keyframes where they're needed in the relevant F-Curves"},
{INSERTKEY_MATRIX, "INSERTKEY_VISUAL", 0, "Insert Keyframes - Visual", "Insert keyframes based on 'visual transforms'"},
{INSERTKEY_XYZ2RGB, "INSERTKEY_XYZ_TO_RGB", 0, "F-Curve Colors - XYZ to RGB", "Color for newly added transformation F-Curves (Location, Rotation, Scale) and also Color is based on the transform axis"},
{0, NULL, 0, NULL, NULL}};
prop= RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "keyingflag");
RNA_def_property_enum_items(prop, keying_flag_items);
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL|PROP_ENUM_FLAG);
RNA_def_property_ui_text(prop, "Options", "Keying set options");
}
/* --- */

@ -939,22 +939,12 @@ static void rna_TimeLine_remove(Scene *scene, ReportList *reports, TimeMarker *m
MEM_freeN(marker);
}
static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports,
char name[], int absolute, int insertkey_needed, int insertkey_visual)
static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, char name[])
{
KeyingSet *ks= NULL;
short flag=0, keyingflag=0;
/* validate flags */
if (absolute)
flag |= KEYINGSET_ABSOLUTE;
if (insertkey_needed)
keyingflag |= INSERTKEY_NEEDED;
if (insertkey_visual)
keyingflag |= INSERTKEY_MATRIX;
/* call the API func, and set the active keyingset index */
ks= BKE_keyingset_add(&sce->keyingsets, name, flag, keyingflag);
ks= BKE_keyingset_add(&sce->keyingsets, name, KEYINGSET_ABSOLUTE, 0);
if (ks) {
sce->active_keyingset= BLI_countlist(&sce->keyingsets);
@ -3010,17 +3000,13 @@ static void rna_def_scene_keying_sets(BlenderRNA *brna, PropertyRNA *cprop)
func= RNA_def_function(srna, "new", "rna_Scene_keying_set_new");
RNA_def_function_ui_description(func, "Add a new Keying Set to Scene.");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
/* name */
RNA_def_string(func, "name", "KeyingSet", 64, "Name", "Name of Keying Set");
/* returns the new KeyingSet */
parm= RNA_def_pointer(func, "keyingset", "KeyingSet", "", "Newly created Keying Set.");
RNA_def_function_return(func, parm);
/* name */
RNA_def_string(func, "name", "KeyingSet", 64, "Name", "Name of Keying Set");
/* flags */
RNA_def_boolean(func, "absolute", 1, "Absolute", "Keying Set defines specific paths/settings to be keyframed (i.e. is not reliant on context info)");
/* keying flags */
RNA_def_boolean(func, "insertkey_needed", 0, "Insert Keyframes - Only Needed", "Only insert keyframes where they're needed in the relevant F-Curves.");
RNA_def_boolean(func, "insertkey_visual", 0, "Insert Keyframes - Visual", "Insert keyframes based on 'visual transforms'.");
prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "KeyingSet");
RNA_def_property_flag(prop, PROP_EDITABLE);