[Bf-blender-cvs] [14655418d16] blender2.8: Add 'Add static override' to outliner's menus.

Bastien Montagne noreply at git.blender.org
Mon Dec 11 12:07:29 CET 2017


Commit: 14655418d16b2b3d96e46514bc89a2752abfb1e2
Author: Bastien Montagne
Date:   Mon Dec 11 12:06:38 2017 +0100
Branches: blender2.8
https://developer.blender.org/rB14655418d16b2b3d96e46514bc89a2752abfb1e2

Add 'Add static override' to outliner's menus.

===================================================================

M	source/blender/editors/space_outliner/outliner_tools.c

===================================================================

diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 99fd539293f..81e80843f1d 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -57,6 +57,7 @@
 #include "BKE_group.h"
 #include "BKE_layer.h"
 #include "BKE_library.h"
+#include "BKE_library_override.h"
 #include "BKE_library_query.h"
 #include "BKE_library_remap.h"
 #include "BKE_main.h"
@@ -454,6 +455,19 @@ static void id_local_cb(
 	}
 }
 
+static void id_static_override_cb(
+        bContext *C, ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *UNUSED(te),
+        TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data))
+{
+	if (ID_IS_LINKED(tselem->id) && (tselem->id->tag & LIB_TAG_EXTERN)) {
+		Main *bmain = CTX_data_main(C);
+		ID *override_id = BKE_override_static_create_from(bmain, tselem->id);
+		if (override_id != NULL) {
+			BKE_main_id_clear_newpoins(bmain);
+		}
+	}
+}
+
 static void id_fake_user_set_cb(
         bContext *UNUSED(C), ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *UNUSED(te),
         TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data))
@@ -1117,6 +1131,7 @@ void OUTLINER_OT_object_operation(wmOperatorType *ot)
 typedef enum eOutliner_PropGroupOps {
 	OL_GROUPOP_UNLINK = 1,
 	OL_GROUPOP_LOCAL,
+	OL_GROUPOP_STATIC_OVERRIDE,
 	OL_GROUPOP_LINK,
 	OL_GROUPOP_DELETE,
 	OL_GROUPOP_REMAP,
@@ -1130,6 +1145,8 @@ typedef enum eOutliner_PropGroupOps {
 static const EnumPropertyItem prop_group_op_types[] = {
 	{OL_GROUPOP_UNLINK, "UNLINK",     0, "Unlink Group", ""},
 	{OL_GROUPOP_LOCAL, "LOCAL",       0, "Make Local Group", ""},
+	{OL_GROUPOP_STATIC_OVERRIDE, "STATIC_OVERRIDE",
+	 0, "Add Static Override", "Add a local static override of that group"},
 	{OL_GROUPOP_LINK, "LINK",         0, "Link Group Objects to Scene", ""},
 	{OL_GROUPOP_DELETE, "DELETE",     0, "Delete Group", ""},
 	{OL_GROUPOP_REMAP, "REMAP",       0, "Remap Users",
@@ -1161,6 +1178,9 @@ static int outliner_group_operation_exec(bContext *C, wmOperator *op)
 		case OL_GROUPOP_LOCAL:
 			outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_local_cb, NULL);
 			break;
+		case OL_GROUPOP_STATIC_OVERRIDE:
+			outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_static_override_cb, NULL);
+			break;
 		case OL_GROUPOP_LINK:
 			outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, group_linkobs2scene_cb, NULL);
 			break;
@@ -1213,6 +1233,7 @@ typedef enum eOutlinerIdOpTypes {
 	
 	OUTLINER_IDOP_UNLINK,
 	OUTLINER_IDOP_LOCAL,
+	OUTLINER_IDOP_STATIC_OVERRIDE,
 	OUTLINER_IDOP_SINGLE,
 	OUTLINER_IDOP_DELETE,
 	OUTLINER_IDOP_REMAP,
@@ -1228,6 +1249,8 @@ typedef enum eOutlinerIdOpTypes {
 static const EnumPropertyItem prop_id_op_types[] = {
 	{OUTLINER_IDOP_UNLINK, "UNLINK", 0, "Unlink", ""},
 	{OUTLINER_IDOP_LOCAL, "LOCAL", 0, "Make Local", ""},
+	{OUTLINER_IDOP_STATIC_OVERRIDE, "STATIC_OVERRIDE",
+	 0, "Add Static Override", "Add a local static override of this data-block"},
 	{OUTLINER_IDOP_SINGLE, "SINGLE", 0, "Make Single User", ""},
 	{OUTLINER_IDOP_DELETE, "DELETE", 0, "Delete", "WARNING: no undo"},
 	{OUTLINER_IDOP_REMAP, "REMAP", 0, "Remap Users",
@@ -1297,6 +1320,13 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
 			ED_undo_push(C, "Localized Data");
 			break;
 		}
+		case OUTLINER_IDOP_STATIC_OVERRIDE:
+		{
+			/* make local */
+			outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_static_override_cb, NULL);
+			ED_undo_push(C, "Overrided Data");
+			break;
+		}
 		case OUTLINER_IDOP_SINGLE:
 		{
 			/* make single user */



More information about the Bf-blender-cvs mailing list