[Bf-blender-cvs] [b911004] id-remap: Merge branch 'master' into id-remap
Bastien Montagne
noreply at git.blender.org
Sat Aug 22 15:45:32 CEST 2015
Commit: b9110048f92099301e2a4a432bdf1e4c71dba8c7
Author: Bastien Montagne
Date: Sat Aug 22 15:38:58 2015 +0200
Branches: id-remap
https://developer.blender.org/rBb9110048f92099301e2a4a432bdf1e4c71dba8c7
Merge branch 'master' into id-remap
===================================================================
===================================================================
diff --cc source/blender/editors/space_outliner/outliner_tools.c
index 0462234,50171d7..3bfa641
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@@ -264,10 -263,93 +264,93 @@@ static void outliner_do_libdata_operati
}
}
- /* */
+ /* ******************************************** */
+ typedef enum eOutliner_PropSceneOps {
+ OL_SCENE_OP_DELETE = 1
+ } eOutliner_PropSceneOps;
+
+ static EnumPropertyItem prop_scene_op_types[] = {
+ {OL_SCENE_OP_DELETE, "DELETE", ICON_X, "Delete", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static bool outliner_do_scene_operation(
+ bContext *C, eOutliner_PropSceneOps event, ListBase *lb,
+ bool (*operation_cb)(bContext *, eOutliner_PropSceneOps, TreeElement *, TreeStoreElem *))
+ {
+ TreeElement *te;
+ TreeStoreElem *tselem;
+ bool success = false;
+
+ for (te = lb->first; te; te = te->next) {
+ tselem = TREESTORE(te);
+ if (tselem->flag & TSE_SELECTED) {
+ if (operation_cb(C, event, te, tselem)) {
+ success = true;
+ }
+ }
+ }
+
+ return success;
+ }
+
+ static bool scene_cb(bContext *C, eOutliner_PropSceneOps event, TreeElement *UNUSED(te), TreeStoreElem *tselem)
+ {
+ Scene *scene = (Scene *)tselem->id;
+
+ if (event == OL_SCENE_OP_DELETE) {
+ if (ED_screen_delete_scene(C, scene)) {
+ WM_event_add_notifier(C, NC_SCENE | NA_REMOVED, scene);
+ }
+ else {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ static int outliner_scene_operation_exec(bContext *C, wmOperator *op)
+ {
+ SpaceOops *soops = CTX_wm_space_outliner(C);
+ const eOutliner_PropSceneOps event = RNA_enum_get(op->ptr, "type");
+
+ if (outliner_do_scene_operation(C, event, &soops->tree, scene_cb) == false) {
+ return OPERATOR_CANCELLED;
+ }
+
+ if (event == OL_SCENE_OP_DELETE) {
+ outliner_cleanup_tree(soops);
+ ED_undo_push(C, "Delete Scene(s)");
+ }
+ else {
+ BLI_assert(0);
+ return OPERATOR_CANCELLED;
+ }
+
+ return OPERATOR_FINISHED;
+ }
+
+ void OUTLINER_OT_scene_operation(wmOperatorType *ot)
+ {
+ /* identifiers */
+ ot->name = "Outliner Scene Operation";
+ ot->idname = "OUTLINER_OT_scene_operation";
+ ot->description = "Context menu for scene operations";
+
+ /* callbacks */
+ ot->invoke = WM_menu_invoke;
+ ot->exec = outliner_scene_operation_exec;
+ ot->poll = ED_operator_outliner_active;
+
+ ot->flag = 0;
+
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_scene_op_types, 0, "Scene Operation", "");
+ }
+ /* ******************************************** */
static void object_select_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te,
- TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
+ TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data))
{
Base *base = (Base *)te->directdata;
More information about the Bf-blender-cvs
mailing list