Fix T55161: outliner Blender File with filter showing irrelevant libraries.

This commit is contained in:
Brecht Van Lommel 2018-05-23 14:37:43 +02:00
parent c44ccbc518
commit 1c572b7412
Notes: blender-bot 2023-02-14 05:50:11 +01:00
Referenced by issue #55161, Outliner Blender File filter ignores libraries
3 changed files with 33 additions and 21 deletions

View File

@ -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)];

View File

@ -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;

View File

@ -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) {