Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2017-01-31 15:03:31 +0300
committerDalai Felinto <dfelinto@gmail.com>2017-01-31 15:05:19 +0300
commita0e4ae5d378aa6514108b45fe70bc579c1ff4d8e (patch)
treee12b965edd41f7c307f455720baa60576b391b5f
parent7f498b4bde95455a62043051ac3cd24ed8836959 (diff)
bpy.ops.collections.collection_new()
-rw-r--r--source/blender/editors/space_collections/collections_ops.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/source/blender/editors/space_collections/collections_ops.c b/source/blender/editors/space_collections/collections_ops.c
index ff62696621f..21d6e2e37b8 100644
--- a/source/blender/editors/space_collections/collections_ops.c
+++ b/source/blender/editors/space_collections/collections_ops.c
@@ -129,7 +129,7 @@ static void COLLECTIONS_OT_collection_unlink(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-static int collection_new_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
+static int collection_new_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
SceneLayer *sl = CTX_data_scene_layer(C);
@@ -137,12 +137,8 @@ static int collection_new_invoke(bContext *C, wmOperator *op, const wmEvent *UNU
SceneCollection *sc = BKE_collection_add(scene, NULL, NULL);
BKE_collection_link(sl, sc);
- TODO_LAYER_OPERATORS;
- /* make sure the active element of the editor is correct */
-
- /* add name as part of operator properties ? */
- BKE_report(op->reports, RPT_ERROR, "COLLECTIONS_OT_collection_new not implemented yet");
- return OPERATOR_CANCELLED;
+ WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
+ return OPERATOR_FINISHED;
}
static void COLLECTIONS_OT_collection_new(wmOperatorType *ot)
@@ -153,8 +149,7 @@ static void COLLECTIONS_OT_collection_new(wmOperatorType *ot)
ot->description = "Add a new collection to the scene, and link it to the active layer";
/* api callbacks */
- ot->invoke = collection_new_invoke;
- ot->poll = ED_operator_collections_active;
+ ot->exec = collection_new_exec;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;