LibOverride: tweak log messages, fix crash in log code.
One of the log call could use freed memory.
This commit is contained in:
parent
b71b1ae384
commit
18371f2780
|
@ -1024,13 +1024,13 @@ bool BKE_lib_override_library_resync(
|
|||
/* If user never edited them, we can delete them. */
|
||||
id->tag |= LIB_TAG_DOIT;
|
||||
id->tag &= ~LIB_TAG_MISSING;
|
||||
CLOG_INFO(&LOG, 3, "Old override %s is being deleted", id->name);
|
||||
CLOG_INFO(&LOG, 2, "Old override %s is being deleted", id->name);
|
||||
}
|
||||
else {
|
||||
/* Otherwise, keep them, user needs to decide whether what to do with them. */
|
||||
BLI_assert((id->tag & LIB_TAG_DOIT) == 0);
|
||||
id_fake_user_set(id);
|
||||
CLOG_INFO(&LOG, 3, "Old override %s is being kept around as it was user-edited", id->name);
|
||||
CLOG_INFO(&LOG, 2, "Old override %s is being kept around as it was user-edited", id->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1158,8 +1158,9 @@ void BKE_lib_override_library_main_resync(Main *bmain, Scene *scene, ViewLayer *
|
|||
continue;
|
||||
}
|
||||
do_continue = true;
|
||||
CLOG_INFO(&LOG, 2, "Resyncing %s...", id->name);
|
||||
const bool success = BKE_lib_override_library_resync(bmain, scene, view_layer, id, false);
|
||||
CLOG_INFO(&LOG, 2, "Resynced %s, success: %d", id->name, success);
|
||||
CLOG_INFO(&LOG, 2, "\tSuccess: %d", success);
|
||||
break;
|
||||
}
|
||||
FOREACH_MAIN_LISTBASE_ID_END;
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \ingroup spoutliner
|
||||
*/
|
||||
|
||||
#include "BKE_collection.h"
|
||||
#include "BKE_lib_override.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLI_listbase_wrapper.hh"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "../outliner_intern.h"
|
||||
#include "tree_display.h"
|
||||
|
||||
#include "tree_element_overrides.hh"
|
||||
|
||||
namespace blender::ed::outliner {
|
||||
|
||||
TreeElementOverridesBase::TreeElementOverridesBase(TreeElement &legacy_te, ID &id)
|
||||
: AbstractTreeElement(legacy_te), id_(id)
|
||||
{
|
||||
BLI_assert(legacy_te.store_elem->type == TSE_LIBRARY_OVERRIDE_BASE);
|
||||
legacy_te.name = IFACE_("Library Overrides");
|
||||
}
|
||||
|
||||
void TreeElementOverridesBase::expand(SpaceOutliner &space_outliner) const
|
||||
{
|
||||
if (!id_.override_library) {
|
||||
return;
|
||||
}
|
||||
|
||||
PointerRNA idpoin;
|
||||
RNA_id_pointer_create(&id_, &idpoin);
|
||||
|
||||
PointerRNA override_rna_ptr;
|
||||
PropertyRNA *override_rna_prop;
|
||||
short index = 0;
|
||||
|
||||
for (auto *override_prop :
|
||||
ListBaseWrapper<IDOverrideLibraryProperty>(id_.override_library->properties)) {
|
||||
if (!BKE_lib_override_rna_property_find(
|
||||
&idpoin, override_prop, &override_rna_ptr, &override_rna_prop)) {
|
||||
/* This is fine, override properties list is not always fully up-to-date with current
|
||||
* RNA/IDProps etc., this gets cleaned up when re-generating the overrides rules,
|
||||
* no error here. */
|
||||
continue;
|
||||
}
|
||||
|
||||
TreeElementOverridesData data = {id_, *override_prop};
|
||||
outliner_add_element(
|
||||
&space_outliner, &legacy_te_.subtree, &data, &legacy_te_, TSE_LIBRARY_OVERRIDE, index++);
|
||||
}
|
||||
}
|
||||
|
||||
TreeElementOverridesProperty::TreeElementOverridesProperty(TreeElement &legacy_te,
|
||||
TreeElementOverridesData &override_data)
|
||||
: AbstractTreeElement(legacy_te),
|
||||
id_(override_data.id),
|
||||
override_prop_(override_data.override_property)
|
||||
{
|
||||
BLI_assert(legacy_te.store_elem->type == TSE_LIBRARY_OVERRIDE);
|
||||
|
||||
legacy_te.name = override_prop_.rna_path;
|
||||
}
|
||||
|
||||
} // namespace blender::ed::outliner
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \ingroup spoutliner
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tree_element.hh"
|
||||
|
||||
namespace blender::ed::outliner {
|
||||
|
||||
struct TreeElementOverridesData {
|
||||
ID &id;
|
||||
IDOverrideLibraryProperty &override_property;
|
||||
};
|
||||
|
||||
class TreeElementOverridesBase final : public AbstractTreeElement {
|
||||
ID &id_;
|
||||
|
||||
public:
|
||||
TreeElementOverridesBase(TreeElement &legacy_te, ID &id);
|
||||
|
||||
void expand(SpaceOutliner &) const override;
|
||||
};
|
||||
|
||||
class TreeElementOverridesProperty final : public AbstractTreeElement {
|
||||
ID &id_;
|
||||
IDOverrideLibraryProperty &override_prop_;
|
||||
|
||||
public:
|
||||
TreeElementOverridesProperty(TreeElement &legacy_te, TreeElementOverridesData &override_data);
|
||||
|
||||
void expand(SpaceOutliner &) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::ed::outliner
|
|
@ -1107,7 +1107,7 @@ static void rna_property_override_apply_ex(Main *bmain,
|
|||
ptr_item_storage,
|
||||
opop)) {
|
||||
CLOG_INFO(&LOG,
|
||||
2,
|
||||
4,
|
||||
"Failed to apply '%s' override operation on %s\n",
|
||||
op->rna_path,
|
||||
ptr_src->owner_id->name);
|
||||
|
@ -1211,7 +1211,7 @@ void RNA_struct_override_apply(Main *bmain,
|
|||
|
||||
if (id_dst != NULL) {
|
||||
CLOG_INFO(&LOG,
|
||||
3,
|
||||
4,
|
||||
"%s: Ignoring local override on ID pointer property '%s', as requested by "
|
||||
"RNA_OVERRIDE_APPLY_FLAG_IGNORE_ID_POINTERS flag",
|
||||
ptr_dst->owner_id->name,
|
||||
|
@ -1236,7 +1236,7 @@ void RNA_struct_override_apply(Main *bmain,
|
|||
}
|
||||
else {
|
||||
CLOG_INFO(&LOG,
|
||||
2,
|
||||
4,
|
||||
"Failed to apply library override operation to '%s.%s' "
|
||||
"(could not resolve some properties, local: %d, override: %d)",
|
||||
((ID *)ptr_src->owner_id)->name,
|
||||
|
|
Loading…
Reference in New Issue