[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25965] trunk/blender: link markers to another scene, Currently in Ctrl+L menu ( which isnt ideal but no menu in timeline for this)

Campbell Barton ideasman42 at gmail.com
Wed Jan 13 15:39:08 CET 2010


Revision: 25965
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25965
Author:   campbellbarton
Date:     2010-01-13 15:39:08 +0100 (Wed, 13 Jan 2010)

Log Message:
-----------
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

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_view3d.py
    trunk/blender/source/blender/editors/animation/anim_markers.c

Modified: trunk/blender/release/scripts/ui/space_view3d.py
===================================================================
--- trunk/blender/release/scripts/ui/space_view3d.py	2010-01-13 12:51:07 UTC (rev 25964)
+++ trunk/blender/release/scripts/ui/space_view3d.py	2010-01-13 14:39:08 UTC (rev 25965)
@@ -777,7 +777,7 @@
         layout = self.layout
 
         layout.operator_menu_enum("object.make_links_scene", "type", text="Objects to Scene...")
-
+        layout.operator_menu_enum("marker.make_links_scene", "type", text="Markers to Scene...")
         layout.operator_enums("object.make_links_data", property="type") # inline
 
 

Modified: trunk/blender/source/blender/editors/animation/anim_markers.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_markers.c	2010-01-13 12:51:07 UTC (rev 25964)
+++ trunk/blender/source/blender/editors/animation/anim_markers.c	2010-01-13 14:39:08 UTC (rev 25965)
@@ -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 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 @@
 	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





More information about the Bf-blender-cvs mailing list