diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-11-04 06:22:56 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-11-04 06:22:56 +0400 |
commit | dd8e83606776d1d3c51cd8f5c89bf6d1a7e05f74 (patch) | |
tree | 710d8682910d03d019ca0f4a1cb86fcf2b268c2e /source/blender/makesrna/intern/rna_action.c | |
parent | 6dfa1601092b9aa4de88420ce1e60371cd6aed69 (diff) | |
parent | 2f2c0a51a5b108213004dcda3da6defda82e6e41 (diff) |
Merged changes in the trunk up to revision 51853.
Conflicts resolved:
source/blender/blenloader/intern/readfile.c
source/blender/bmesh/operators/bmo_utils.c
This commit also includes a fix of a bug identified during the merge and committed in revision 51853.
Thanks Thomas (dingto) for the timely fix!
Diffstat (limited to 'source/blender/makesrna/intern/rna_action.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_action.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 739b02ef042..07b8072076e 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -27,6 +27,7 @@ #include <stdlib.h> +#include "RNA_access.h" #include "RNA_define.h" #include "RNA_enum_types.h" @@ -68,12 +69,13 @@ static bActionGroup *rna_Action_groups_new(bAction *act, const char name[]) return action_groups_add_new(act, name); } -static void rna_Action_groups_remove(bAction *act, ReportList *reports, bActionGroup *agrp) +static void rna_Action_groups_remove(bAction *act, ReportList *reports, PointerRNA *agrp_ptr) { + bActionGroup *agrp = agrp_ptr->data; FCurve *fcu, *fcn; /* try to remove the F-Curve from the action */ - if (!BLI_remlink_safe(&act->groups, agrp)) { + if (BLI_remlink_safe(&act->groups, agrp) == FALSE) { BKE_reportf(reports, RPT_ERROR, "Action group '%s' not found in action '%s'", agrp->name, act->id.name + 2); return; } @@ -81,16 +83,16 @@ static void rna_Action_groups_remove(bAction *act, ReportList *reports, bActionG /* move every one one of the group's F-Curves out into the Action again */ for (fcu = agrp->channels.first; (fcu) && (fcu->grp == agrp); fcu = fcn) { fcn = fcu->next; - + /* remove from group */ action_groups_remove_channel(act, fcu); - + /* tack onto the end */ BLI_addtail(&act->curves, fcu); } - - /* XXX, invalidates PyObject */ + MEM_freeN(agrp); + RNA_POINTER_INVALIDATE(agrp_ptr); } static FCurve *rna_Action_fcurve_new(bAction *act, ReportList *reports, const char *data_path, @@ -112,8 +114,9 @@ static FCurve *rna_Action_fcurve_new(bAction *act, ReportList *reports, const ch return verify_fcurve(act, group, NULL, data_path, index, 1); } -static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, FCurve *fcu) +static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, PointerRNA *fcu_ptr) { + FCurve *fcu = fcu_ptr->data; if (fcu->grp) { if (BLI_findindex(&act->groups, fcu->grp) == -1) { BKE_reportf(reports, RPT_ERROR, "F-Curve's action group '%s' not found in action '%s'", @@ -123,6 +126,7 @@ static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, FCurve * action_groups_remove_channel(act, fcu); free_fcurve(fcu); + RNA_POINTER_INVALIDATE(fcu_ptr); } else { if (BLI_findindex(&act->curves, fcu) == -1) { @@ -132,6 +136,7 @@ static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, FCurve * BLI_remlink(&act->curves, fcu); free_fcurve(fcu); + RNA_POINTER_INVALIDATE(fcu_ptr); } } @@ -145,15 +150,16 @@ static TimeMarker *rna_Action_pose_markers_new(bAction *act, const char name[]) return marker; } -static void rna_Action_pose_markers_remove(bAction *act, ReportList *reports, TimeMarker *marker) +static void rna_Action_pose_markers_remove(bAction *act, ReportList *reports, PointerRNA *marker_ptr) { - if (!BLI_remlink_safe(&act->markers, marker)) { + TimeMarker *marker = marker_ptr->data; + if (BLI_remlink_safe(&act->markers, marker) == FALSE) { BKE_reportf(reports, RPT_ERROR, "Timeline marker '%s' not found in action '%s'", marker->name, act->id.name + 2); return; } - /* XXX, invalidates PyObject */ MEM_freeN(marker); + RNA_POINTER_INVALIDATE(marker_ptr); } static PointerRNA rna_Action_active_pose_marker_get(PointerRNA *ptr) @@ -522,7 +528,8 @@ static void rna_def_action_groups(BlenderRNA *brna, PropertyRNA *cprop) 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); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); + RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); } static void rna_def_action_fcurves(BlenderRNA *brna, PropertyRNA *cprop) @@ -553,7 +560,8 @@ static void rna_def_action_fcurves(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove action group"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "fcurve", "FCurve", "", "F-Curve to remove"); - RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); + RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); } static void rna_def_action_pose_markers(BlenderRNA *brna, PropertyRNA *cprop) @@ -581,7 +589,8 @@ static void rna_def_action_pose_markers(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove a timeline marker"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "marker", "TimelineMarker", "", "Timeline marker to remove"); - RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); + RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "TimelineMarker"); |