[Bf-blender-cvs] [eb1feb9f4a6] blender2.8: Merge branch 'master' into blender2.8
Bastien Montagne
noreply at git.blender.org
Thu May 31 16:22:05 CEST 2018
Commit: eb1feb9f4a62e3caca4b72964c9fdd8187df53e5
Author: Bastien Montagne
Date: Thu May 31 16:21:47 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBeb1feb9f4a62e3caca4b72964c9fdd8187df53e5
Merge branch 'master' into blender2.8
Conflicts:
source/blender/editors/object/object_add.c
source/blender/editors/object/object_select.c
source/blender/editors/space_outliner/outliner_edit.c
===================================================================
===================================================================
diff --cc source/blender/editors/object/object_add.c
index 4c90336dc0c,5d5d1190775..958b656d323
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@@ -1047,11 -963,12 +1047,12 @@@ void OBJECT_OT_lamp_add(wmOperatorType
ED_object_add_generic_props(ot, false);
}
-/********************* Add Group Instance Operator ********************/
+/********************* Add Collection Instance Operator ********************/
-static int group_instance_add_exec(bContext *C, wmOperator *op)
+static int collection_instance_add_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
- Group *group;
+ Collection *collection;
unsigned int layer;
float loc[3], rot[3];
@@@ -1059,7 -976,7 +1060,7 @@@
char name[MAX_ID_NAME - 2];
RNA_string_get(op->ptr, "name", name);
- collection = (Collection *)BKE_libblock_find_name(ID_GR, name);
- group = (Group *)BKE_libblock_find_name(bmain, ID_GR, name);
++ collection = (Collection *)BKE_libblock_find_name(bmain, ID_GR, name);
if (0 == RNA_struct_property_is_set(op->ptr, "location")) {
const wmEvent *event = CTX_wm_window(C)->eventstate;
@@@ -1077,25 -994,15 +1078,24 @@@
if (!ED_object_add_generic_get_opts(C, op, 'Z', loc, rot, NULL, &layer, NULL))
return OPERATOR_CANCELLED;
- if (group) {
+ if (collection) {
- Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
- Object *ob = ED_object_add_type(C, OB_EMPTY, group->id.name + 2, loc, rot, false, layer);
- ob->dup_group = group;
- ob->transflag |= OB_DUPLIGROUP;
- id_us_plus(&group->id);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+
+ /* Avoid dependency cycles. */
+ LayerCollection *active_lc = BKE_layer_collection_get_active(view_layer);
+ while (BKE_collection_find_cycle(active_lc->collection, collection)) {
+ active_lc = BKE_layer_collection_activate_parent(view_layer, active_lc);
+ }
+
+ Object *ob = ED_object_add_type(C, OB_EMPTY, collection->id.name + 2, loc, rot, false, layer);
+ ob->dup_group = collection;
+ ob->transflag |= OB_DUPLICOLLECTION;
+ id_us_plus(&collection->id);
/* works without this except if you try render right after, see: 22027 */
- DAG_relations_tag_update(bmain);
+ DEG_relations_tag_update(bmain);
+ DEG_id_tag_update(&collection->id, 0);
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
diff --cc source/blender/editors/object/object_select.c
index d5e6f08352f,440c9d01487..9746e4af714
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@@ -901,21 -1072,22 +901,22 @@@ void OBJECT_OT_select_all(wmOperatorTyp
WM_operator_properties_select_all(ot);
}
-/**************************** Select In The Same Group ****************************/
+/**************************** Select In The Same Collection ****************************/
-static int object_select_same_group_exec(bContext *C, wmOperator *op)
+static int object_select_same_collection_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
- Group *group;
- char group_name[MAX_ID_NAME];
+ Collection *collection;
+ char collection_name[MAX_ID_NAME];
/* passthrough if no objects are visible */
if (CTX_DATA_COUNT(C, visible_bases) == 0) return OPERATOR_PASS_THROUGH;
- RNA_string_get(op->ptr, "group", group_name);
+ RNA_string_get(op->ptr, "collection", collection_name);
- collection = (Collection *)BKE_libblock_find_name(ID_GR, collection_name);
- group = (Group *)BKE_libblock_find_name(bmain, ID_GR, group_name);
++ collection = (Collection *)BKE_libblock_find_name(bmain, ID_GR, collection_name);
- if (!group) {
+ if (!collection) {
return OPERATOR_PASS_THROUGH;
}
@@@ -955,8 -1124,8 +956,9 @@@ void OBJECT_OT_select_same_collection(w
/**************************** Select Mirror ****************************/
static int object_select_mirror_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
bool extend;
extend = RNA_boolean_get(op->ptr, "extend");
@@@ -968,12 -1137,12 +970,12 @@@
BLI_string_flip_side_name(name_flip, primbase->object->id.name + 2, true, sizeof(name_flip));
if (!STREQ(name_flip, primbase->object->id.name + 2)) {
- Object *ob = (Object *)BKE_libblock_find_name(ID_OB, name_flip);
+ Object *ob = (Object *)BKE_libblock_find_name(bmain, ID_OB, name_flip);
if (ob) {
- Base *secbase = BKE_scene_base_find(scene, ob);
+ Base *secbase = BKE_view_layer_base_find(view_layer, ob);
if (secbase) {
- ED_base_object_select(secbase, BA_SELECT);
+ ED_object_base_select(secbase, BA_SELECT);
}
}
}
diff --cc source/blender/editors/space_outliner/outliner_edit.c
index ca26c9be9f2,27c14096e1e..aae855a7da4
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@@ -2135,11 -2233,13 +2135,11 @@@ static int scene_drop_invoke(bContext *
te = outliner_dropzone_find(soops, fmval, false);
if (te) {
- Base *base;
-
RNA_string_set(op->ptr, "scene", te->name);
- scene = (Scene *)BKE_libblock_find_name(ID_SCE, te->name);
+ scene = (Scene *)BKE_libblock_find_name(bmain, ID_SCE, te->name);
RNA_string_get(op->ptr, "object", obname);
- ob = (Object *)BKE_libblock_find_name(ID_OB, obname);
+ ob = (Object *)BKE_libblock_find_name(bmain, ID_OB, obname);
if (ELEM(NULL, ob, scene) || ID_IS_LINKED(scene)) {
return OPERATOR_CANCELLED;
@@@ -2298,38 -2360,44 +2298,38 @@@ static int collection_drop_invoke(bCont
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
/* Find object hovered over */
- te = outliner_dropzone_find(soops, fmval, true);
-
- if (te) {
- group = (Group *)BKE_libblock_find_name(bmain, ID_GR, te->name);
+ TreeElement *te = outliner_dropzone_find(soops, fmval, true);
- RNA_string_get(op->ptr, "object", ob_name);
- ob = (Object *)BKE_libblock_find_name(bmain, ID_OB, ob_name);
-
- if (ELEM(NULL, group, ob)) {
- return OPERATOR_CANCELLED;
- }
- if (BKE_group_object_exists(group, ob)) {
- return OPERATOR_FINISHED;
- }
+ if (!te || !outliner_is_collection_tree_element(te)) {
+ return OPERATOR_CANCELLED;
+ }
- if (BKE_group_object_cyclic_check(bmain, ob, group)) {
- BKE_report(op->reports, RPT_ERROR, "Could not add the group because of dependency cycle detected");
- return OPERATOR_CANCELLED;
- }
+ Collection *collection = outliner_collection_from_tree_element(te);
- BKE_group_object_add(group, ob, scene, NULL);
- WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ // TODO: don't use scene, makes no sense anymore
+ // TODO: move rather than link, change hover text
+ Scene *scene = BKE_scene_find_from_collection(bmain, collection);
+ BLI_assert(scene);
+ RNA_string_get(op->ptr, "child", childname);
- Object *ob = (Object *)BKE_libblock_find_name(ID_OB, childname);
++ Object *ob = (Object *)BKE_libblock_find_name(bmain, ID_OB, childname);
+ BKE_collection_object_add(bmain, collection, ob);
- return OPERATOR_FINISHED;
- }
+ DEG_relations_tag_update(bmain);
+ WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene);
- return OPERATOR_CANCELLED;
+ return OPERATOR_FINISHED;
}
-void OUTLINER_OT_group_link(wmOperatorType *ot)
+void OUTLINER_OT_collection_drop(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Link Object to Group";
- ot->description = "Link Object to Group in Outliner";
- ot->idname = "OUTLINER_OT_group_link";
+ ot->name = "Link to Collection"; // TODO: rename to move?
+ ot->description = "Drag to move to collection in Outliner";
+ ot->idname = "OUTLINER_OT_collection_drop";
/* api callbacks */
- ot->invoke = group_link_invoke;
+ ot->invoke = collection_drop_invoke;
+ ot->exec = collection_drop_exec;
ot->poll = ED_operator_outliner_active;
diff --cc source/blender/windowmanager/intern/wm_toolsystem.c
index 0ea933a852b,00000000000..508713c9096
mode 100644,000000..100644
--- a/source/blender/windowmanager/intern/wm_toolsystem.c
+++ b/source/blender/windowmanager/intern/wm_toolsystem.c
@@@ -1,605 -1,0 +1,605 @@@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/windowmanager/intern/wm_toolsystem.c
+ * \ingroup wm
+ *
+ * Experimental tool-system>
+ */
+
+#include <string.h>
+
+#include "CLG_log.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_utildefines.h"
+#include "BLI_string.h"
+#include "BLI_listbase.h"
+
+#include "DNA_ID.h"
+#include "DNA_scene_types.h"
+#include "DNA_space_types.h"
+#include "DNA_windowmanager_types.h"
+#include "DNA_workspace_types.h"
+#include "DNA_object_types.h"
+
+#include "BKE_context.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
+#include "BKE_paint.h"
+#include "BKE_idprop.h"
+#include "BKE_workspace.h"
+
+#include "RNA_access.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+#include "WM_message.h"
+#include "WM_toolsystem.h" /* own include */
+
+static void toolsystem_reinit_with_toolref(
+ bContext *C, WorkSpace *UNUSED(workspace), bToolRef *tref);
+static void toolsystem_reinit_ensure_toolref(
+ bContext *C, WorkSpace *workspace, const bToolK
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list