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:
Diffstat (limited to 'source/blender/makesrna/intern/rna_animation.c')
-rw-r--r--source/blender/makesrna/intern/rna_animation.c52
1 files changed, 38 insertions, 14 deletions
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index ac30c615438..c3d1070b8c2 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -45,7 +45,7 @@
#include "ED_keyframing.h"
/* exported for use in API */
-EnumPropertyItem keyingset_path_grouping_items[] = {
+EnumPropertyItem rna_enum_keyingset_path_grouping_items[] = {
{KSP_GROUP_NAMED, "NAMED", 0, "Named Group", ""},
{KSP_GROUP_NONE, "NONE", 0, "None", ""},
{KSP_GROUP_KSNAME, "KEYINGSET", 0, "Keying Set Name", ""},
@@ -55,7 +55,7 @@ EnumPropertyItem keyingset_path_grouping_items[] = {
/* It would be cool to get rid of this 'INSERTKEY_' prefix in 'py strings' values, but it would break existing
* exported keyingset... :/
*/
-EnumPropertyItem keying_flag_items[] = {
+EnumPropertyItem rna_enum_keying_flag_items[] = {
{INSERTKEY_NEEDED, "INSERTKEY_NEEDED", 0, "Only Needed",
"Only insert keyframes where they're needed in the relevant F-Curves"},
{INSERTKEY_MATRIX, "INSERTKEY_VISUAL", 0, "Visual Keying",
@@ -97,7 +97,7 @@ static int rna_AnimData_action_editable(PointerRNA *ptr)
if ((adt->flag & ADT_NLA_EDIT_ON) || (adt->actstrip) || (adt->tmpact))
return 0;
else
- return 1;
+ return PROP_EDITABLE;
}
static void rna_AnimData_action_set(PointerRNA *ptr, PointerRNA value)
@@ -381,7 +381,7 @@ static int rna_KeyingSet_active_ksPath_editable(PointerRNA *ptr)
KeyingSet *ks = (KeyingSet *)ptr->data;
/* only editable if there are some paths to change to */
- return (BLI_listbase_is_empty(&ks->paths) == false);
+ return (BLI_listbase_is_empty(&ks->paths) == false) ? PROP_EDITABLE : 0;
}
static PointerRNA rna_KeyingSet_active_ksPath_get(PointerRNA *ptr)
@@ -552,6 +552,17 @@ static FCurve *rna_Driver_from_existing(AnimData *adt, bContext *C, FCurve *src_
}
}
+static FCurve *rna_Driver_find(AnimData *adt, ReportList *reports, const char *data_path, int index)
+{
+ if (data_path[0] == '\0') {
+ BKE_report(reports, RPT_ERROR, "F-Curve data path empty, invalid argument");
+ return NULL;
+ }
+
+ /* Returns NULL if not found. */
+ return list_find_fcurve(&adt->drivers, data_path, index);
+}
+
#else
/* helper function for Keying Set -> keying settings */
@@ -652,7 +663,7 @@ static void rna_def_keyingset_info(BlenderRNA *brna)
*/
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_enum_items(prop, rna_enum_keying_flag_items);
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG);
RNA_def_property_ui_text(prop, "Options", "Keying Set options to use when inserting keyframes");
@@ -710,7 +721,7 @@ static void rna_def_keyingset_path(BlenderRNA *brna)
prop = RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "idtype");
- RNA_def_property_enum_items(prop, id_type_items);
+ RNA_def_property_enum_items(prop, rna_enum_id_type_items);
RNA_def_property_enum_default(prop, ID_OB);
RNA_def_property_enum_funcs(prop, NULL, "rna_ksPath_id_type_set", NULL);
RNA_def_property_ui_text(prop, "ID Type", "Type of ID-block that can be used");
@@ -724,7 +735,7 @@ static void rna_def_keyingset_path(BlenderRNA *brna)
/* Grouping */
prop = RNA_def_property(srna, "group_method", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "groupmode");
- RNA_def_property_enum_items(prop, keyingset_path_grouping_items);
+ RNA_def_property_enum_items(prop, rna_enum_keyingset_path_grouping_items);
RNA_def_property_ui_text(prop, "Grouping Method", "Method used to define which Group-name to use");
RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
@@ -789,7 +800,7 @@ static void rna_def_keyingset_paths(BlenderRNA *brna, PropertyRNA *cprop)
"The index of the destination property (i.e. axis of Location/Rotation/etc.), "
"or -1 for the entire array", 0, INT_MAX);
/* grouping */
- RNA_def_enum(func, "group_method", keyingset_path_grouping_items, KSP_GROUP_KSNAME,
+ RNA_def_enum(func, "group_method", rna_enum_keyingset_path_grouping_items, KSP_GROUP_KSNAME,
"Grouping Method", "Method used to define which Group-name to use");
RNA_def_string(func, "group_name", NULL, 64, "Group Name",
"Name of Action Group to assign destination to (only if grouping mode is to use this name)");
@@ -936,6 +947,7 @@ static void rna_api_animdata_drivers(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_struct_sdna(srna, "AnimData");
RNA_def_struct_ui_text(srna, "Drivers", "Collection of Driver F-Curves");
+ /* AnimData.drivers.from_existing(...) */
func = RNA_def_function(srna, "from_existing", "rna_Driver_from_existing");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
RNA_def_function_ui_description(func, "Add a new driver given an existing one");
@@ -943,6 +955,18 @@ static void rna_api_animdata_drivers(BlenderRNA *brna, PropertyRNA *cprop)
/* return type */
parm = RNA_def_pointer(func, "driver", "FCurve", "", "New Driver F-Curve");
RNA_def_function_return(func, parm);
+
+ /* AnimData.drivers.find(...) */
+ func = RNA_def_function(srna, "find", "rna_Driver_find");
+ RNA_def_function_ui_description(func, "Find a driver F-Curve. Note that this function performs a linear scan "
+ "of all driver F-Curves.");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_string(func, "data_path", NULL, 0, "Data Path", "F-Curve data path");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Array index", 0, INT_MAX);
+ /* return type */
+ parm = RNA_def_pointer(func, "fcurve", "FCurve", "", "The found F-Curve, or None if it doesn't exist");
+ RNA_def_function_return(func, parm);
}
void rna_def_animdata_common(StructRNA *srna)
@@ -952,7 +976,7 @@ void rna_def_animdata_common(StructRNA *srna)
prop = RNA_def_property(srna, "animation_data", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "adt");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Animation Data", "Animation data for this datablock");
+ RNA_def_property_ui_text(prop, "Animation Data", "Animation data for this data-block");
}
static void rna_def_animdata(BlenderRNA *brna)
@@ -961,7 +985,7 @@ static void rna_def_animdata(BlenderRNA *brna)
PropertyRNA *prop;
srna = RNA_def_struct(brna, "AnimData", NULL);
- RNA_def_struct_ui_text(srna, "Animation Data", "Animation data for datablock");
+ RNA_def_struct_ui_text(srna, "Animation Data", "Animation data for data-block");
RNA_def_struct_ui_icon(srna, ICON_ANIM_DATA);
/* NLA */
@@ -978,20 +1002,20 @@ static void rna_def_animdata(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
RNA_def_property_pointer_funcs(prop, NULL, "rna_AnimData_action_set", NULL, "rna_Action_id_poll");
RNA_def_property_editable_func(prop, "rna_AnimData_action_editable");
- RNA_def_property_ui_text(prop, "Action", "Active Action for this datablock");
+ RNA_def_property_ui_text(prop, "Action", "Active Action for this data-block");
RNA_def_property_update(prop, NC_ANIMATION | ND_NLA_ACTCHANGE, "rna_AnimData_update");
/* Active Action Settings */
prop = RNA_def_property(srna, "action_extrapolation", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "act_extendmode");
- RNA_def_property_enum_items(prop, nla_mode_extend_items);
+ RNA_def_property_enum_items(prop, rna_enum_nla_mode_extend_items);
RNA_def_property_ui_text(prop, "Action Extrapolation",
"Action to take for gaps past the Active Action's range (when evaluating with NLA)");
RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL);
prop = RNA_def_property(srna, "action_blend_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "act_blendmode");
- RNA_def_property_enum_items(prop, nla_mode_blend_items);
+ RNA_def_property_enum_items(prop, rna_enum_nla_mode_blend_items);
RNA_def_property_ui_text(prop, "Action Blending",
"Method used for combining Active Action's result with result of NLA stack");
RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */
@@ -1008,7 +1032,7 @@ static void rna_def_animdata(BlenderRNA *brna)
prop = RNA_def_property(srna, "drivers", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "drivers", NULL);
RNA_def_property_struct_type(prop, "FCurve");
- RNA_def_property_ui_text(prop, "Drivers", "The Drivers/Expressions for this datablock");
+ RNA_def_property_ui_text(prop, "Drivers", "The Drivers/Expressions for this data-block");
rna_api_animdata_drivers(brna, prop);