48 void ensure_entire_collection(
TreeElement &te_to_expand,
50 const char *coll_prop_path,
66 if (legacy_te.
parent !=
nullptr &&
72 legacy_te.
name =
id.name + 2;
79 return RPT_(
"This override data-block is not needed anymore, but was detected as user-edited");
83 return RPT_(
"This override data-block is unused");
90 const bool show_system_overrides,
101 int rnaprop_index = 0;
103 &idpoin, override_prop, &override_rna_ptr, &override_rna_prop, &rnaprop_index);
107 if (is_rna_path_valid && !show_system_overrides) {
109 bool is_system_override =
false;
122 is_system_override =
true;
128 &
id, override_prop, override_rna_prop, rnaprop_index))
139 id, *override_prop, override_rna_ptr, *override_rna_prop, is_rna_path_valid};
172 return &override_data.
id;
177 return &override_data.
id;
198 "This override property does not exist in current data, it will be removed on "
199 "next .blend file save");
226 "Override operations are only supported for collections right now");
230 throw std::invalid_argument(
"missing operation");
233 operation_ = std::make_unique<IDOverrideLibraryPropertyOperation>(*override_data.
operation);
235 operation_->next = operation_->prev =
nullptr;
237 if (std::optional<PointerRNA> col_item_ptr = get_collection_ptr()) {
240 legacy_te.
name = dyn_name;
251 if (operation_->label) {
252 return operation_->label;
257 return RPT_(
"Added through override");
264 return RPT_(
"Protected from override");
266 return RPT_(
"Additive override");
268 return RPT_(
"Subtractive override");
270 return RPT_(
"Multiplicative override");
272 return RPT_(
"Custom override");
274 return RPT_(
"Unknown override");
279 if (operation_->tooltip) {
280 return operation_->tooltip;
287 if (
const std::optional<PointerRNA> col_item_ptr = get_collection_ptr()) {
296 return operation_->operation;
305 if (*operation_ == opop) {
312std::optional<PointerRNA> TreeElementOverridesPropertyOperation::get_collection_ptr()
const
317 operation_->subitem_local_index,
352 : tree_display_(tree_display)
367 const char *elem_path =
nullptr;
369 char name_buf[128], *name;
375 const char *previous_path = elem_path;
378 te_to_expand = &ensure_label_element_for_prop(
389 previous_path, &elem.
ptr, elem.
prop, coll_item_idx, name);
390 if (name && (name != name_buf)) {
394 te_to_expand = &ensure_label_element_for_ptr(
395 *te_to_expand, coll_item_path, next_elem.
ptr,
index);
397 MEM_delete(new_path);
398 new_path = coll_item_path;
402 MEM_delete(elem_path);
403 elem_path = new_path;
414 te_to_expand = &ensure_label_element_for_prop(*te_to_expand,
420 ensure_entire_collection(*te_to_expand, override_data, elem_path,
index);
427 {.parent = te_to_expand, .
index =
index++}, override_data);
430 MEM_delete(elem_path);
433void OverrideRNAPathTreeBuilder::ensure_entire_collection(
437 const char *coll_prop_path,
444 char name_buf[128], *name;
452 if (name && (name != name_buf)) {
467 TreeElement *existing_te = path_te_map.lookup_default(coll_item_path,
nullptr);
474 current_te = existing_te;
479 else if (item_operation) {
481 override_op_data.
operation = item_operation;
485 {.parent = &te_to_expand, .
index =
index++}, override_op_data);
492 MEM_delete(coll_item_path);
495 previous_te = current_te;
513 if (icon != ICON_DOT) {
521TreeElement &OverrideRNAPathTreeBuilder::ensure_label_element_for_prop(
524 return *path_te_map.lookup_or_add_cb(elem_path, [&]() {
539 return *path_te_map.lookup_or_add_cb(elem_path, [&]() {
542 TreeElement *new_te = tree_display_.add_element<TreeElementLabel>(
547 MEM_delete(dyn_name);
#define ID_IS_OVERRIDE_LIBRARY_REAL(_id)
#define ID_REAL_USERS(id)
#define RNA_PROP_BEGIN(sptr, itemptr, prop)
#define UNUSED_VARS_NDEBUG(...)
#define BLI_assert_msg(a, msg)
constexpr IndexRange drop_back(int64_t n) const
constexpr const char * c_str() const
IndexRange index_range() const
Base Class For Tree-Displays.
TreeElement * add_element(const TreeElementAddParams ¶ms, Args &&...args)
AbstractTreeDisplay * display_
AbstractTreeElement(TreeElement &legacy_te)
void build_path(TreeElement &parent, TreeElementOverridesData &override_data, short &index)
OverrideRNAPathTreeBuilder(AbstractTreeDisplay &tree_display)
TreeElementOverridesBase(TreeElement &legacy_te, ID &id)
void expand(SpaceOutliner &) const override
StringRefNull get_warning() const override
short get_operation_type() const
TreeElementOverridesPropertyOperation(TreeElement &legacy_te, TreeElementOverridesData &override_data)
static ID * owner_id(TreeElementOverridesData &override_data)
std::optional< BIFIconID > get_icon() const override
StringRefNull get_override_operation_label() const
StringRefNull get_override_operation_tooltip() const
IDOverrideLibraryPropertyOperation * get_override_operation_from_id(ID &id, IDOverrideLibraryProperty &override_property) const
TreeElementOverridesProperty(TreeElement &legacy_te, TreeElementOverridesData &override_data)
PointerRNA override_rna_ptr
IDOverrideLibraryProperty * get_override_property_from_id(ID &id) const
static ID * owner_id(TreeElementOverridesData &override_data)
PropertyRNA & override_rna_prop
StringRefNull get_warning() const override
static void iterate_properties_to_display(ID &id, const bool show_system_overrides, FunctionRef< void(TreeElementOverridesData &data)> fn)
TreeElementT * tree_element_cast(const TreeElement *te)
static BIFIconID get_property_icon(PointerRNA &ptr, PropertyRNA &prop)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
@ SO_FILTER_SHOW_SYSTEM_OVERRIDES
IDOverrideLibraryPropertyOperation * BKE_lib_override_library_property_operation_find(IDOverrideLibraryProperty *liboverride_property, const char *subitem_refname, const char *subitem_locname, const std::optional< const ID * > &subitem_refid, const std::optional< const ID * > &subitem_locid, int subitem_refindex, int subitem_locindex, bool strict, bool *r_strict)
PointerRNA RNA_id_pointer_create(ID *id)
int RNA_property_collection_lookup_index(PointerRNA *ptr, PropertyRNA *prop, const PointerRNA *t_ptr)
char * RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen, int *r_len)
const char * RNA_struct_ui_name(const StructRNA *type)
@ LIBOVERRIDE_OP_INSERT_AFTER
@ LIBOVERRIDE_OP_SUBTRACT
@ LIBOVERRIDE_OP_MULTIPLY
@ LIBOVERRIDE_OP_INSERT_BEFORE
@ TSE_LIBRARY_OVERRIDE_BASE
@ TSE_LIBRARY_OVERRIDE_OPERATION
PropertyType RNA_property_type(PropertyRNA *prop)
StructRNA * RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
ListBaseWrapperTemplate< ListBase, T > ListBaseWrapper
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
BMesh const char void * data
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
bool RNA_path_resolve_elements(PointerRNA *ptr, const char *path, Vector< PropertyElemRNA > *r_elements)
IDOverrideLibraryProperty * BKE_lib_override_library_property_find(IDOverrideLibrary *liboverride, const char *rna_path)
int RNA_struct_ui_icon(const StructRNA *type)
bool RNA_struct_is_ID(const StructRNA *type)
bool BKE_lib_override_rna_property_find(PointerRNA *idpoin, const IDOverrideLibraryProperty *library_prop, PointerRNA *r_override_poin, PropertyRNA **r_override_prop, int *r_index)
char * RNA_path_append(const char *path, const PointerRNA *, PropertyRNA *prop, int intkey, const char *strkey)
bool RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int key, PointerRNA *r_ptr)
@ ID_FLAG_LIB_OVERRIDE_RESYNC_LEFTOVER
int RNA_property_ui_icon(const PropertyRNA *prop)
bool BKE_lib_override_library_property_is_animated(const ID *id, const IDOverrideLibraryProperty *liboverride_prop, const PropertyRNA *override_rna_prop, const int rnaprop_index)
@ LIBOVERRIDE_OP_FLAG_IDPOINTER_MATCH_REFERENCE
const char * RNA_property_ui_name(const PropertyRNA *prop, const PointerRNA *ptr)
#define SUPPORT_FILTER_OUTLINER(space_outliner_)
ListBaseT< IDOverrideLibraryPropertyOperation > operations
eSpaceOutliner_Filter filter
PointerRNA & override_rna_ptr
PropertyRNA & override_rna_prop
IDOverrideLibraryProperty & override_property
IDOverrideLibraryPropertyOperation * operation
TreeStoreElem * store_elem
ListBaseT< TreeElement > subtree
Establish and manage Outliner trees for different display modes.