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:
authorCampbell Barton <ideasman42@gmail.com>2010-04-01 00:39:08 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-04-01 00:39:08 +0400
commitc19725b2667cfcec64135901ccb40b3c9ec37e00 (patch)
treead97abf53127e70559bc21f0696a91b65f7c0fe7 /source/blender/makesrna/intern/rna_action.c
parent3c6a0274b94709e4b9767de5054c8a5402a97db3 (diff)
svn merge https://svn.blender.org/svnroot/bf-blender/branches/render25 -r27895:27901; svn merge https://svn.blender.org/svnroot/bf-blender/branches/render25 -r27902:27907, skipping 27902
Diffstat (limited to 'source/blender/makesrna/intern/rna_action.c')
-rw-r--r--source/blender/makesrna/intern/rna_action.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index 2f0f9f40b85..c1a74f21fa2 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -54,6 +54,35 @@ static void rna_ActionGroup_channels_next(CollectionPropertyIterator *iter)
iter->valid= (internal->link != NULL);
}
+static bActionGroup *rna_Action_groups_add(bAction *act, char *name)
+{
+ bActionGroup *agrp= MEM_callocN(sizeof(bActionGroup), "bActionGroup");
+ strncpy(agrp->name, name, sizeof(agrp->name));
+ BLI_addtail(&act->groups, agrp);
+ BLI_uniquename(&act->groups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name));
+ return agrp;
+}
+
+static void rna_Action_groups_remove(bAction *act, ReportList *reports, bActionGroup *agrp)
+{
+ FCurve *fcu;
+
+ if(!BLI_remlink_safe(&act->groups, agrp)) {
+ BKE_reportf(reports, RPT_ERROR, "ActionGroup '%s' not found in action '%s'", agrp->name, act->id.name);
+ return;
+ }
+
+ for(fcu= act->curves.first; fcu; fcu= fcu->next) {
+ if(fcu->grp==agrp)
+ fcu->grp= NULL;
+ }
+
+ /* XXX, can these be added to drivers??? */
+
+ MEM_freeN(agrp); /* XXX, invalidate PyObject */
+}
+
+
#else
static void rna_def_dopesheet(BlenderRNA *brna)
@@ -244,6 +273,35 @@ static void rna_def_action_group(BlenderRNA *brna)
RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN_EDIT, NULL);
}
+/* fcurve.keyframe_points */
+static void rna_def_action_groups(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "ActionGroups");
+ srna= RNA_def_struct(brna, "ActionGroups", NULL);
+ RNA_def_struct_sdna(srna, "bAction");
+ RNA_def_struct_ui_text(srna, "Action Points", "Collection of action groups");
+
+ func= RNA_def_function(srna, "add", "rna_Action_groups_add");
+ RNA_def_function_ui_description(func, "Add a keyframe to the curve.");
+ parm= RNA_def_string(func, "name", "Group", 0, "", "New name for the action group.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ parm= RNA_def_pointer(func, "action_group", "ActionGroup", "", "Newly created action group");
+ RNA_def_function_return(func, parm);
+
+
+ func= RNA_def_function(srna, "remove", "rna_Action_groups_remove");
+ RNA_def_function_ui_description(func, "Remove action group.");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm= RNA_def_pointer(func, "action_group", "ActionGroup", "", "Action group to remove.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
+}
+
static void rna_def_action(BlenderRNA *brna)
{
StructRNA *srna;
@@ -263,6 +321,7 @@ static void rna_def_action(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "groups", NULL);
RNA_def_property_struct_type(prop, "ActionGroup");
RNA_def_property_ui_text(prop, "Groups", "Convenient groupings of F-Curves");
+ rna_def_action_groups(brna, prop);
prop= RNA_def_property(srna, "pose_markers", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "markers", NULL);