[Bf-blender-cvs] [1c572b74126] blender2.8: Fix T55161: outliner Blender File with filter showing irrelevant libraries.
Brecht Van Lommel
noreply at git.blender.org
Wed May 23 14:44:32 CEST 2018
Commit: 1c572b741262504882f0112d237ef9eedb1a019d
Author: Brecht Van Lommel
Date: Wed May 23 14:37:43 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB1c572b741262504882f0112d237ef9eedb1a019d
Fix T55161: outliner Blender File with filter showing irrelevant libraries.
===================================================================
M source/blender/editors/space_outliner/outliner_draw.c
M source/blender/editors/space_outliner/outliner_tree.c
M source/blender/windowmanager/intern/wm_event_system.c
===================================================================
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 827034cd13d..7d200c904cd 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -320,7 +320,6 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
{
bArmature *arm = (bArmature *)tselem->id;
if (arm->edbo) {
- ViewLayer *view_layer = CTX_data_view_layer(C);
EditBone *ebone = te->directdata;
char newname[sizeof(ebone->name)];
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 393b40d1097..f42addb30bf 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -1286,9 +1286,9 @@ static bool outliner_library_id_show(Library *lib, ID *id, short filter_id_type)
return true;
}
-static void outliner_add_library_contents(Main *mainvar, SpaceOops *soops, TreeElement *te, Library *lib)
+static TreeElement *outliner_add_library_contents(Main *mainvar, SpaceOops *soops, ListBase *lb, Library *lib)
{
- TreeElement *ten;
+ TreeElement *ten, *tenlib = NULL;
ListBase *lbarray[MAX_LIBARRAY];
int a, tot;
short filter_id_type = (soops->filter & SO_FILTER_ID_TYPE) ? soops->filter_id_type : 0;
@@ -1311,11 +1311,23 @@ static void outliner_add_library_contents(Main *mainvar, SpaceOops *soops, TreeE
break;
if (id) {
+ if (!tenlib) {
+ /* Create library tree element on demand, depending if there are any datablocks. */
+ if (lib) {
+ tenlib = outliner_add_element(soops, lb, lib, NULL, 0, 0);
+ }
+ else {
+ tenlib = outliner_add_element(soops, lb, mainvar, NULL, TSE_ID_BASE, 0);
+ tenlib->name = IFACE_("Current File");
+ }
+ }
+
+ /* Create datablock list parent element on demand. */
if (filter_id_type) {
- ten = te;
+ ten = tenlib;
}
else {
- ten = outliner_add_element(soops, &te->subtree, lbarray[a], NULL, TSE_ID_BASE, 0);
+ ten = outliner_add_element(soops, &tenlib->subtree, lbarray[a], NULL, TSE_ID_BASE, 0);
ten->directdata = lbarray[a];
ten->name = outliner_idcode_to_plural(GS(id->name));
}
@@ -1328,6 +1340,8 @@ static void outliner_add_library_contents(Main *mainvar, SpaceOops *soops, TreeE
}
}
}
+
+ return tenlib;
}
static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOops *soops)
@@ -2125,20 +2139,18 @@ void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, Spa
Library *lib;
/* current file first - mainvar provides tselem with unique pointer - not used */
- ten = outliner_add_element(soops, &soops->tree, mainvar, NULL, TSE_ID_BASE, 0);
- ten->name = IFACE_("Current File");
-
- tselem = TREESTORE(ten);
- if (!tselem->used)
- tselem->flag &= ~TSE_CLOSED;
-
- outliner_add_library_contents(mainvar, soops, ten, NULL);
+ ten = outliner_add_library_contents(mainvar, soops, &soops->tree, NULL);
+ if (ten) {
+ tselem = TREESTORE(ten);
+ if (!tselem->used)
+ tselem->flag &= ~TSE_CLOSED;
+ }
for (lib = mainvar->library.first; lib; lib = lib->id.next) {
- ten = outliner_add_element(soops, &soops->tree, lib, NULL, 0, 0);
- lib->id.newid = (ID *)ten;
-
- outliner_add_library_contents(mainvar, soops, ten, lib);
+ ten = outliner_add_library_contents(mainvar, soops, &soops->tree, lib);
+ if (ten) {
+ lib->id.newid = (ID *)ten;
+ }
}
/* make hierarchy */
@@ -2158,9 +2170,10 @@ void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, Spa
}
else {
/* Else, make a new copy of the libtree for our parent. */
- TreeElement *dupten = outliner_add_element(soops, &par->subtree, lib, NULL, 0, 0);
- outliner_add_library_contents(mainvar, soops, dupten, lib);
- dupten->parent = par;
+ TreeElement *dupten = outliner_add_library_contents(mainvar, soops, &par->subtree, lib);
+ if (dupten) {
+ dupten->parent = par;
+ }
}
}
ten = nten;
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 7004416517d..c2fbd0aa558 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1980,7 +1980,7 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
if (ot && wm_operator_check_locked_interface(C, ot)) {
bool use_last_properties = true;
- PointerRNA tool_properties = {0};
+ PointerRNA tool_properties = {{0}};
bool use_tool_properties = (handler->keymap_tool != NULL);
if (use_tool_properties) {
More information about the Bf-blender-cvs
mailing list