diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-01-13 17:39:08 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-01-13 17:39:08 +0300 |
commit | 75ec61d128071f0646bfedbf900908a08b538e19 (patch) | |
tree | ea0ab795ec7bf8679a46d73c7e3b0ebe3a3b54d0 /source/blender/editors | |
parent | 574049782a34dcdc0f67b6c3077dc1e99db0d09e (diff) |
link markers to another scene, Currently in Ctrl+L menu (which isnt ideal but no menu in timeline for this)
needed for linking in scenes and copying markers about
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/animation/anim_markers.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 7d1ddda1c6d..4f7a02bb688 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -41,6 +41,7 @@ #include "RNA_access.h" #include "RNA_define.h" +#include "RNA_enum_types.h" #include "BLI_blenlib.h" @@ -48,6 +49,8 @@ #include "BKE_global.h" #include "BKE_fcurve.h" #include "BKE_utildefines.h" +#include "BKE_main.h" +#include "BKE_report.h" #include "WM_api.h" #include "WM_types.h" @@ -985,6 +988,56 @@ static void MARKER_OT_delete(wmOperatorType *ot) } +static int ed_marker_make_links_scene_exec(bContext *C, wmOperator *op) +{ + ListBase *markers= context_get_markers(C); + Scene *scene_to= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "type")); + TimeMarker *marker, *marker_new; + + if(scene_to==NULL) { + BKE_report(op->reports, RPT_ERROR, "Scene not found"); + return OPERATOR_CANCELLED; + } + + if(scene_to == CTX_data_scene(C)) { + BKE_report(op->reports, RPT_ERROR, "Can't link objects into the same scene"); + return OPERATOR_CANCELLED; + } + + /* copy markers */ + for (marker= markers->first; marker; marker= marker->next) { + if(marker->flag & SELECT) { + marker_new= MEM_dupallocN(marker); + BLI_addtail(&scene_to->markers, marker_new); + } + } + + /* one day multiple scenes will be visible, then we should have some update function for them */ + return OPERATOR_FINISHED; +} + +static void MARKER_OT_make_links_scene(wmOperatorType *ot) +{ + PropertyRNA *prop; + + /* identifiers */ + ot->name= "Make Links to Scene"; + ot->description= "Link markers to another scene."; + ot->idname= "MARKER_OT_make_links_scene"; + + /* api callbacks */ + ot->exec= ed_marker_make_links_scene_exec; + ot->poll= ED_operator_areaactive; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + /* properties */ + prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, 0, "Type", ""); + RNA_def_enum_funcs(prop, RNA_scene_itemf); + +} + #ifdef DURIAN_CAMERA_SWITCH /* ******************************* camera bind marker ***************** */ @@ -1039,6 +1092,7 @@ void ED_operatortypes_marker(void) WM_operatortype_append(MARKER_OT_select_border); WM_operatortype_append(MARKER_OT_select_all); WM_operatortype_append(MARKER_OT_delete); + WM_operatortype_append(MARKER_OT_make_links_scene); #ifdef DURIAN_CAMERA_SWITCH WM_operatortype_append(MARKER_OT_camera_bind); #endif |