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>2018-03-28 20:54:17 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-03-28 23:14:51 +0300
commitf167226b793e5dd39816f0b250771177d088dc54 (patch)
tree96b569a678b998f4f8b869192bd4bedf19219663 /source/blender/editors/object/object_ops.c
parent205fe8afd7011ca8db2dc14579dec6a088b9086f (diff)
Move to Collection - initial operator
How to use: Select a few objects, and press "M" in the viewport. If you hold ctrl the objects will be added to the selected collection. Otherwise they are removed from all their original collections and moved to the selected one instead. Development Notes ================= The ideal solution would be to implement an elegant generic multi-level menu system similar to toolbox_generic() in 2.49. Instead I used `uiItemMenuF` to acchieve the required nesting of the menus. The downside is that `uiItemMenuF` requires the data its callback uses to be always valid until the menu is discarded. But since there is no callback we can call when the menu is discarded for operators that exited with `OPERATOR_INTERFACE`. That means we are using static allocated data, that is only freed next time the operator is called. Which also means there will always be some memory leakage. Reviewers: campbellbarton Differential Revision: https://developer.blender.org/D3117
Diffstat (limited to 'source/blender/editors/object/object_ops.c')
-rw-r--r--source/blender/editors/object/object_ops.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 59ba92eb1bf..9c198e996af 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -219,6 +219,8 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_logic_bricks_copy);
WM_operatortype_append(OBJECT_OT_game_physics_copy);
+ WM_operatortype_append(OBJECT_OT_move_to_collection);
+
WM_operatortype_append(OBJECT_OT_shape_key_add);
WM_operatortype_append(OBJECT_OT_shape_key_remove);
WM_operatortype_append(OBJECT_OT_shape_key_clear);
@@ -423,6 +425,8 @@ void ED_keymap_object(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", ZEROKEY + i, KM_PRESS, KM_CTRL, 0);
RNA_int_set(kmi->ptr, "level", i);
}
+
+ WM_keymap_add_item(keymap, "OBJECT_OT_move_to_collection", MKEY, KM_PRESS, 0, 0);
}
void ED_keymap_proportional_cycle(struct wmKeyConfig *UNUSED(keyconf), struct wmKeyMap *keymap)