4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * Contributor(s): Blender Foundation (2008), Roland Hess, Joshua Leung
22 * ***** END GPL LICENSE BLOCK *****
25 /** \file blender/makesrna/intern/rna_action.c
32 #include "RNA_define.h"
34 #include "rna_internal.h"
36 #include "DNA_anim_types.h"
37 #include "DNA_action_types.h"
38 #include "DNA_scene_types.h"
40 #include "MEM_guardedalloc.h"
42 #include "BKE_action.h"
49 #include "ED_keyframing.h"
50 #include "BKE_fcurve.h"
52 static void rna_ActionGroup_channels_next(CollectionPropertyIterator *iter)
54 ListBaseIterator *internal= iter->internal;
55 FCurve *fcu= (FCurve*)internal->link;
56 bActionGroup *grp= fcu->grp;
58 /* only continue if the next F-Curve (if existant) belongs in the same group */
59 if ((fcu->next) && (fcu->next->grp == grp))
60 internal->link= (Link*)fcu->next;
64 iter->valid= (internal->link != NULL);
67 static bActionGroup *rna_Action_groups_new(bAction *act, const char name[])
69 return action_groups_add_new(act, name);
72 static void rna_Action_groups_remove(bAction *act, ReportList *reports, bActionGroup *agrp)
76 /* try to remove the F-Curve from the action */
77 if (!BLI_remlink_safe(&act->groups, agrp)) {
78 BKE_reportf(reports, RPT_ERROR, "ActionGroup '%s' not found in action '%s'", agrp->name, act->id.name+2);
82 /* move every one one of the group's F-Curves out into the Action again */
83 for (fcu= agrp->channels.first; (fcu) && (fcu->grp==agrp); fcu=fcn) {
86 /* remove from group */
87 action_groups_remove_channel(act, fcu);
89 /* tack onto the end */
90 BLI_addtail(&act->curves, fcu);
93 /* XXX, invalidates PyObject */
97 static FCurve *rna_Action_fcurve_new(bAction *act, ReportList *reports, const char *data_path, int index, const char *group)
99 if(group && group[0]=='\0') group= NULL;
101 if(data_path[0] == '\0') {
102 BKE_report(reports, RPT_ERROR, "FCurve data path empty, invalid argument");
106 /* annoying, check if this exists */
107 if(verify_fcurve(act, group, data_path, index, 0)) {
108 BKE_reportf(reports, RPT_ERROR, "FCurve '%s[%d]' already exists in action '%s'", data_path, index, act->id.name+2);
111 return verify_fcurve(act, group, data_path, index, 1);
114 static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, FCurve *fcu)
117 if (BLI_findindex(&act->groups, fcu->grp) == -1) {
118 BKE_reportf(reports, RPT_ERROR, "FCurve's ActionGroup '%s' not found in action '%s'", fcu->grp->name, act->id.name+2);
122 action_groups_remove_channel(act, fcu);
126 if (BLI_findindex(&act->curves, fcu) == -1) {
127 BKE_reportf(reports, RPT_ERROR, "FCurve not found in action '%s'", act->id.name+2);
131 BLI_remlink(&act->curves, fcu);
136 static TimeMarker *rna_Action_pose_markers_new(bAction *act, ReportList *reports, const char name[])
138 TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
141 BLI_strncpy(marker->name, name, sizeof(marker->name));
142 BLI_addtail(&act->markers, marker);
146 static void rna_Action_pose_markers_remove(bAction *act, ReportList *reports, TimeMarker *marker)
148 if (!BLI_remlink_safe(&act->markers, marker)) {
149 BKE_reportf(reports, RPT_ERROR, "TimelineMarker '%s' not found in Action '%s'", marker->name, act->id.name+2);
153 /* XXX, invalidates PyObject */
157 static PointerRNA rna_Action_active_pose_marker_get(PointerRNA *ptr)
159 bAction *act= (bAction*)ptr->data;
160 return rna_pointer_inherit_refine(ptr, &RNA_TimelineMarker, BLI_findlink(&act->markers, act->active_marker-1));
163 static void rna_Action_active_pose_marker_set(PointerRNA *ptr, PointerRNA value)
165 bAction *act= (bAction*)ptr->data;
166 act->active_marker= BLI_findindex(&act->markers, value.data) + 1;
169 static int rna_Action_active_pose_marker_index_get(PointerRNA *ptr)
171 bAction *act= (bAction*)ptr->data;
172 return MAX2(act->active_marker-1, 0);
175 static void rna_Action_active_pose_marker_index_set(PointerRNA *ptr, int value)
177 bAction *act= (bAction*)ptr->data;
178 act->active_marker= value+1;
181 static void rna_Action_active_pose_marker_index_range(PointerRNA *ptr, int *min, int *max)
183 bAction *act= (bAction*)ptr->data;
186 *max= BLI_countlist(&act->markers)-1;
192 static void rna_Action_frame_range_get(PointerRNA *ptr,float *values)
194 calc_action_range(ptr->id.data, values, values+1, 1);
199 static void rna_def_dopesheet(BlenderRNA *brna)
204 srna= RNA_def_struct(brna, "DopeSheet", NULL);
205 RNA_def_struct_sdna(srna, "bDopeSheet");
206 RNA_def_struct_ui_text(srna, "DopeSheet", "Settings for filtering the channels shown in Animation Editors");
208 /* Source of DopeSheet data */
209 prop= RNA_def_property(srna, "source", PROP_POINTER, PROP_NONE);
210 RNA_def_property_struct_type(prop, "ID");
211 RNA_def_property_ui_text(prop, "Source", "ID-Block representing source data, currently ID_SCE (for Dopesheet), and ID_SC (for Grease Pencil)");
213 /* General Filtering Settings */
214 prop= RNA_def_property(srna, "show_only_selected", PROP_BOOLEAN, PROP_NONE);
215 RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_ONLYSEL);
216 RNA_def_property_ui_text(prop, "Only Selected", "Only include channels relating to selected objects and data");
217 RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 0);
218 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
220 prop= RNA_def_property(srna, "show_hidden", PROP_BOOLEAN, PROP_NONE);
221 RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_INCL_HIDDEN);
222 RNA_def_property_ui_text(prop, "Display Hidden", "Include channels from objects/bone that aren't visible");
223 RNA_def_property_ui_icon(prop, ICON_GHOST_ENABLED, 0);
224 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
226 /* Object Group Filtering Settings */
227 prop= RNA_def_property(srna, "show_only_group_objects", PROP_BOOLEAN, PROP_NONE);
228 RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_ONLYOBGROUP);
229 RNA_def_property_ui_text(prop, "Only Objects in Group", "Only include channels from Objects in the specified Group");
230 RNA_def_property_ui_icon(prop, ICON_GROUP, 0);
231 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
233 prop= RNA_def_property(srna, "filter_group", PROP_POINTER, PROP_NONE);
234 RNA_def_property_pointer_sdna(prop, NULL, "filter_grp");
235 RNA_def_property_flag(prop, PROP_EDITABLE);
236 RNA_def_property_ui_text(prop, "Filtering Group", "Group that included Object should be a member of");
237 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
239 /* NLA Specific Settings */
240 prop= RNA_def_property(srna, "show_missing_nla", PROP_BOOLEAN, PROP_NONE);
241 RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NLA_NOACT);
242 RNA_def_property_ui_text(prop, "Include Missing NLA", "Include Animation Data blocks with no NLA data. (NLA Editor only)");
243 RNA_def_property_ui_icon(prop, ICON_ACTION, 0);
244 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
246 /* Summary Settings (DopeSheet editors only) */
247 prop= RNA_def_property(srna, "show_summary", PROP_BOOLEAN, PROP_NONE);
248 RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_SUMMARY);
249 RNA_def_property_ui_text(prop, "Display Summary", "Display an additional 'summary' line. (DopeSheet Editors only)");
250 RNA_def_property_ui_icon(prop, ICON_BORDERMOVE, 0);
251 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
253 prop= RNA_def_property(srna, "show_expanded_summary", PROP_BOOLEAN, PROP_NONE);
254 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ADS_FLAG_SUMMARY_COLLAPSED);
255 RNA_def_property_ui_text(prop, "Collapse Summary", "Collapse summary when shown, so all other channels get hidden. (DopeSheet Editors Only)");
256 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
259 /* General DataType Filtering Settings */
260 prop= RNA_def_property(srna, "show_transforms", PROP_BOOLEAN, PROP_NONE);
261 RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOOBJ);
262 RNA_def_property_ui_text(prop, "Display Transforms", "Include visualization of Object-level Animation data (mostly Transforms)");
263 RNA_def_property_ui_icon(prop, ICON_MANIPUL, 0); // XXX?
264 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
266 prop= RNA_def_property(srna, "show_shapekeys", PROP_BOOLEAN, PROP_NONE);
267 RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOSHAPEKEYS);
268 RNA_def_property_ui_text(prop, "Display Shapekeys", "Include visualization of ShapeKey related Animation data");
269 RNA_def_property_ui_icon(prop, ICON_SHAPEKEY_DATA, 0);
270 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
272 prop= RNA_def_property(srna, "show_meshes", PROP_BOOLEAN, PROP_NONE);
273 RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOMESH);
274 RNA_def_property_ui_text(prop, "Display Meshes", "Include visualization of Mesh related Animation data");
275 RNA_def_property_ui_icon(prop, ICON_MESH_DATA, 0);
276 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
278 prop= RNA_def_property(srna, "show_lattices", PROP_BOOLEAN, PROP_NONE);
279 RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOLAT);
280 RNA_def_property_ui_text(prop, "Display Lattices", "Include visualization of Lattice related Animation data");
281 RNA_def_property_ui_icon(prop, ICON_LATTICE_DATA, 0);
282 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
284 prop= RNA_def_property(srna, "show_cameras", PROP_BOOLEAN, PROP_NONE);
285 RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOCAM);
286 RNA_def_property_ui_text(prop, "Display Camera", "Include visualization of Camera related Animation data");
287 RNA_def_property_ui_icon(prop, ICON_CAMERA_DATA, 0);
288 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
290 prop= RNA_def_property(srna, "show_materials", PROP_BOOLEAN, PROP_NONE);
291 RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOMAT);
292 RNA_def_property_ui_text(prop, "Display Material", "Include visualization of Material related Animation data");
293 RNA_def_property_ui_icon(prop, ICON_MATERIAL_DATA, 0);
294 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
296 prop= RNA_def_property(srna, "show_lamps", PROP_BOOLEAN, PROP_NONE);
297 RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOLAM);
298 RNA_def_property_ui_text(prop, "Display Lamp", "Include visualization of Lamp related Animation data");
299 RNA_def_property_ui_icon(prop, ICON_LAMP_DATA, 0);
300 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
302 prop= RNA_def_property(srna, "show_textures", PROP_BOOLEAN, PROP_NONE);
303 RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOTEX);
304 RNA_def_property_ui_text(prop, "Display Texture", "Include visualization of Texture related Animation data");
305 RNA_def_property_ui_icon(prop, ICON_TEXTURE_DATA, 0);
306 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
308 prop= RNA_def_property(srna, "show_curves", PROP_BOOLEAN, PROP_NONE);
309 RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOCUR);
310 RNA_def_property_ui_text(prop, "Display Curve", "Include visualization of Curve related Animation data");
311 RNA_def_property_ui_icon(prop, ICON_CURVE_DATA, 0);
312 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
314 prop= RNA_def_property(srna, "show_worlds", PROP_BOOLEAN, PROP_NONE);
315 RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOWOR);
316 RNA_def_property_ui_text(prop, "Display World", "Include visualization of World related Animation data");
317 RNA_def_property_ui_icon(prop, ICON_WORLD_DATA, 0);
318 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
320 prop= RNA_def_property(srna, "show_scenes", PROP_BOOLEAN, PROP_NONE);
321 RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOSCE);
322 RNA_def_property_ui_text(prop, "Display Scene", "Include visualization of Scene related Animation data");
323 RNA_def_property_ui_icon(prop, ICON_SCENE_DATA, 0);
324 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
326 prop= RNA_def_property(srna, "show_particles", PROP_BOOLEAN, PROP_NONE);
327 RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOPART);
328 RNA_def_property_ui_text(prop, "Display Particle", "Include visualization of Particle related Animation data");
329 RNA_def_property_ui_icon(prop, ICON_PARTICLE_DATA, 0);
330 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
332 prop= RNA_def_property(srna, "show_metaballs", PROP_BOOLEAN, PROP_NONE);
333 RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOMBA);
334 RNA_def_property_ui_text(prop, "Display Metaball", "Include visualization of Metaball related Animation data");
335 RNA_def_property_ui_icon(prop, ICON_META_DATA, 0);
336 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
338 prop= RNA_def_property(srna, "show_armatures", PROP_BOOLEAN, PROP_NONE);
339 RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOARM);
340 RNA_def_property_ui_text(prop, "Display Armature", "Include visualization of Armature related Animation data");
341 RNA_def_property_ui_icon(prop, ICON_ARMATURE_DATA, 0);
342 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
344 prop= RNA_def_property(srna, "show_nodes", PROP_BOOLEAN, PROP_NONE);
345 RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NONTREE);
346 RNA_def_property_ui_text(prop, "Display Node", "Include visualization of Node related Animation data");
347 RNA_def_property_ui_icon(prop, ICON_NODETREE, 0);
348 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
351 static void rna_def_action_group(BlenderRNA *brna)
356 srna= RNA_def_struct(brna, "ActionGroup", NULL);
357 RNA_def_struct_sdna(srna, "bActionGroup");
358 RNA_def_struct_ui_text(srna, "Action Group", "Groups of F-Curves");
360 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
361 RNA_def_property_ui_text(prop, "Name", "");
362 RNA_def_struct_name_property(srna, prop);
363 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
365 /* WARNING: be very careful when working with this list, since the endpoint is not
366 * defined like a standard ListBase. Adding/removing channels from this list needs
367 * extreme care, otherwise the F-Curve list running through adjacent groups does
368 * not match up with the one stored in the Action, resulting in curves which do not
369 * show up in animation editors. In extreme cases, animation may also selectively
370 * fail to play back correctly.
372 * If such changes are required, these MUST go through the API functions for manipulating
373 * these F-Curve groupings. Also, note that groups only apply in actions ONLY.
375 prop= RNA_def_property(srna, "channels", PROP_COLLECTION, PROP_NONE);
376 RNA_def_property_collection_sdna(prop, NULL, "channels", NULL);
377 RNA_def_property_struct_type(prop, "FCurve");
378 RNA_def_property_collection_funcs(prop, 0, "rna_ActionGroup_channels_next", 0, 0, 0, 0, 0);
379 RNA_def_property_ui_text(prop, "Channels", "F-Curves in this group");
381 prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
382 RNA_def_property_boolean_sdna(prop, NULL, "flag", AGRP_SELECTED);
383 RNA_def_property_ui_text(prop, "Select", "Action Group is selected");
384 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_SELECTED, NULL);
386 prop= RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
387 RNA_def_property_boolean_sdna(prop, NULL, "flag", AGRP_PROTECTED);
388 RNA_def_property_ui_text(prop, "Lock", "Action Group is locked");
389 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
391 prop= RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
392 RNA_def_property_boolean_sdna(prop, NULL, "flag", AGRP_EXPANDED);
393 RNA_def_property_ui_text(prop, "Expanded", "Action Group is expanded");
394 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
396 prop= RNA_def_property(srna, "custom_color", PROP_INT, PROP_NONE);
397 RNA_def_property_int_sdna(prop, NULL, "customCol");
398 RNA_def_property_ui_text(prop, "Custom Color", "Index of custom color set");
399 RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
402 /* fcurve.keyframe_points */
403 static void rna_def_action_groups(BlenderRNA *brna, PropertyRNA *cprop)
410 RNA_def_property_srna(cprop, "ActionGroups");
411 srna= RNA_def_struct(brna, "ActionGroups", NULL);
412 RNA_def_struct_sdna(srna, "bAction");
413 RNA_def_struct_ui_text(srna, "Action Groups", "Collection of action groups");
415 func= RNA_def_function(srna, "new", "rna_Action_groups_new");
416 RNA_def_function_ui_description(func, "Add a keyframe to the curve.");
417 parm= RNA_def_string(func, "name", "Group", 0, "", "New name for the action group.");
418 RNA_def_property_flag(parm, PROP_REQUIRED);
420 parm= RNA_def_pointer(func, "action_group", "ActionGroup", "", "Newly created action group");
421 RNA_def_function_return(func, parm);
424 func= RNA_def_function(srna, "remove", "rna_Action_groups_remove");
425 RNA_def_function_ui_description(func, "Remove action group.");
426 RNA_def_function_flag(func, FUNC_USE_REPORTS);
427 parm= RNA_def_pointer(func, "action_group", "ActionGroup", "", "Action group to remove.");
428 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
431 static void rna_def_action_fcurves(BlenderRNA *brna, PropertyRNA *cprop)
438 RNA_def_property_srna(cprop, "ActionFCurves");
439 srna= RNA_def_struct(brna, "ActionFCurves", NULL);
440 RNA_def_struct_sdna(srna, "bAction");
441 RNA_def_struct_ui_text(srna, "Action FCurves", "Collection of action fcurves");
443 func= RNA_def_function(srna, "new", "rna_Action_fcurve_new");
444 RNA_def_function_ui_description(func, "Add a keyframe to the curve.");
445 RNA_def_function_flag(func, FUNC_USE_REPORTS);
446 parm= RNA_def_string(func, "data_path", "", 0, "Data Path", "FCurve data path to use.");
447 RNA_def_property_flag(parm, PROP_REQUIRED);
448 RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Array index.", 0, INT_MAX);
449 RNA_def_string(func, "action_group", "", 0, "Action Group", "Acton group to add this fcurve into.");
451 parm= RNA_def_pointer(func, "fcurve", "FCurve", "", "Newly created fcurve");
452 RNA_def_function_return(func, parm);
455 func= RNA_def_function(srna, "remove", "rna_Action_fcurve_remove");
456 RNA_def_function_ui_description(func, "Remove action group.");
457 RNA_def_function_flag(func, FUNC_USE_REPORTS);
458 parm= RNA_def_pointer(func, "fcurve", "FCurve", "", "FCurve to remove.");
459 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
462 static void rna_def_action_pose_markers(BlenderRNA *brna, PropertyRNA *cprop)
470 RNA_def_property_srna(cprop, "ActionPoseMarkers");
471 srna= RNA_def_struct(brna, "ActionPoseMarkers", NULL);
472 RNA_def_struct_sdna(srna, "bAction");
473 RNA_def_struct_ui_text(srna, "Action Pose Markers", "Collection of timeline markers");
475 func= RNA_def_function(srna, "new", "rna_Action_pose_markers_new");
476 RNA_def_function_ui_description(func, "Add a pose marker to the action.");
477 RNA_def_function_flag(func, FUNC_USE_REPORTS);
478 parm= RNA_def_string(func, "name", "Marker", 0, "", "New name for the marker (not unique).");
479 RNA_def_property_flag(parm, PROP_REQUIRED);
481 parm= RNA_def_pointer(func, "marker", "TimelineMarker", "", "Newly created marker");
482 RNA_def_function_return(func, parm);
484 func= RNA_def_function(srna, "remove", "rna_Action_pose_markers_remove");
485 RNA_def_function_ui_description(func, "Remove a timeline marker.");
486 RNA_def_function_flag(func, FUNC_USE_REPORTS);
487 parm= RNA_def_pointer(func, "marker", "TimelineMarker", "", "Timeline marker to remove.");
488 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
490 prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
491 RNA_def_property_struct_type(prop, "TimelineMarker");
492 RNA_def_property_flag(prop, PROP_EDITABLE);
493 RNA_def_property_pointer_funcs(prop, "rna_Action_active_pose_marker_get", "rna_Action_active_pose_marker_set", NULL, NULL);
494 RNA_def_property_ui_text(prop, "Active Pose Marker", "Active pose marker for this Action");
496 prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
497 RNA_def_property_int_sdna(prop, NULL, "active_marker");
498 RNA_def_property_int_funcs(prop, "rna_Action_active_pose_marker_index_get", "rna_Action_active_pose_marker_index_set", "rna_Action_active_pose_marker_index_range");
499 RNA_def_property_ui_text(prop, "Active Pose Marker Index", "Index of active pose marker");
502 static void rna_def_action(BlenderRNA *brna)
507 srna= RNA_def_struct(brna, "Action", "ID");
508 RNA_def_struct_sdna(srna, "bAction");
509 RNA_def_struct_ui_text(srna, "Action", "A collection of F-Curves for animation");
510 RNA_def_struct_ui_icon(srna, ICON_ACTION);
512 prop= RNA_def_property(srna, "fcurves", PROP_COLLECTION, PROP_NONE);
513 RNA_def_property_collection_sdna(prop, NULL, "curves", NULL);
514 RNA_def_property_struct_type(prop, "FCurve");
515 RNA_def_property_ui_text(prop, "F-Curves", "The individual F-Curves that make up the Action");
516 rna_def_action_fcurves(brna, prop);
518 prop= RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
519 RNA_def_property_collection_sdna(prop, NULL, "groups", NULL);
520 RNA_def_property_struct_type(prop, "ActionGroup");
521 RNA_def_property_ui_text(prop, "Groups", "Convenient groupings of F-Curves");
522 rna_def_action_groups(brna, prop);
524 prop= RNA_def_property(srna, "pose_markers", PROP_COLLECTION, PROP_NONE);
525 RNA_def_property_collection_sdna(prop, NULL, "markers", NULL);
526 RNA_def_property_struct_type(prop, "TimelineMarker");
527 RNA_def_property_ui_text(prop, "Pose Markers", "Markers specific to this Action, for labeling poses");
528 rna_def_action_pose_markers(brna, prop);
530 prop= RNA_def_float_vector(srna, "frame_range" , 2 , NULL , 0, 0, "Frame Range" , "The final frame range of all fcurves within this action" , 0 , 0);
531 RNA_def_property_float_funcs(prop, "rna_Action_frame_range_get" , NULL, NULL);
532 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
534 RNA_api_action(srna);
539 void RNA_def_action(BlenderRNA *brna)
541 rna_def_action(brna);
542 rna_def_action_group(brna);
543 rna_def_dopesheet(brna);