Age | Commit message (Collapse) | Author |
|
Add the following macros for enums as support for these features wasn't
all that obvious and there were some inconsistencies in their use.
- RNA_ENUM_ITEM_HEADING(name, description)
- RNA_ENUM_ITEM_SEPR
- RNA_ENUM_ITEM_SEPR_COLUMN
|
|
When launching Blender with a script creating a screenshot, the Outliner
tree wasn't initialized and built properly. That is because at this
stage, all visible regions were only tagged for a non-rebuild redraw,
not a full redraw. So ensure all regions are tagged for a full redraw
immediately after file reading. Usually the full redraw would be caused
by a file-read notifier, but the Python expression/script is executed
before notifiers are handled.
Note that even before this was crashing, the Outliner would be empty in
the created screenshot.
Additionally adds an assert to the Outliner to note assumptions
explicitly, rather than crashing later.
|
|
Uses the macro introduced in b45f410b315 where it makes sense.
|
|
|
|
IPO data-block types are deprecated since 2.5. Don't show them in the
Outliner at all.
Differential Revision: https://developer.blender.org/D15049
|
|
(Not meant to cause user visible changes.)
Makes use of the new iterators introduced in the previous commit. Some
benefits:
- Shorter, simpler, easier to read & understand
- Deduplicates logic
- Centralizes iteration logic, making it easier to replace tree storage
(as planned), see previous commit.
- Avoids having to pass (sub-)tree to iterate around (often redundant
since it's just `SpaceOutliner.tree`, even though `SpaceOutliner` is
already passed).
- Function arguments that are only passed to the recursive call are
recognized as unused (found and removed a few).
Also does some general cleanups while refactoring the code for the
iterators. Use `const`, use references (signals null is not expected),
early-exit (see 16fd5fa656af), remove redundant arguments, etc.
|
|
(Not meant to cause user visible changes.)
Adds some first new iterators to traverse over tree elements with a
functional syntax. Functional because it meant to be used with C++
lambdas.
For example, this common pattern:
```lang=cpp
void some_recursive_function(SpaceOutliner *space_outliner, ListBase *tree, ...)
{
LISTBASE_FOREACH (TreeElement *, te, tree) {
/* ... do something with the element ... */
/* Recurse into open children. */
if (TSELEM_OPEN(TREESTORE(te), space_outliner) {
some_recursive_function(&te->subtree, ...);
}
}
}
```
Gets simplified to this:
```lang=cpp
void some_function(SpaceOutliner &space_outliner, ...)
{
tree_iterator::all_open(space_outliner, [&](TreeElement *te) {
/* ... do something with the element ... */
});
}
```
We can add more iterators, e.g. some that support early exiting or
skipping children, returning a custom type, only act on selected
elements, etc.
The following commit will convert a bunch of code to use these. Some
further benefits will become visible there. Not all cases are straight
forward to convert, but hopefully more and more code can be refactored
to work with this. This deduplicates and centralizes the iteration
logic, which will later make it much easier to refactor how the tree
storage is done (e.g. move it to `SpaceOutliner_Runtime` and use a
better container than `ListBase`).
|
|
Design is to have warnings in the sub-tree of a collapsed element show
up next to the collapsed element. But if inside the collapsed element,
there was a uncollapsed one containing yet another element with a
warning, that warning wouldn't "bubble up" to the collapsed parent.
Issue was that the warning lookup would only recurse into collapsed
elements, rather than all elements inside of a collapsed element.
While the actual fix for this could've been simpler, I decided to rework
this code entirely. Recursively querying the warning message is now done
separately from drawing the message once found, which makes the code
easier to follow and implements the single responsibility principle
better.
|
|
Library overrides were basically using their own system to display
warnings for tree elements, even though for other display elements we
have a more general solution. With the previous commit this has been
generalized further and made trivial to extend.
|
|
Uses a inheritance based approach for querying warning of tree elements
and the mode column support of display modes.
For the warnings, tree elements can override the
`AbstractTreeElement::getWarning()` method and return a warning string.
The UI will draw the warning column with warning icons. This makes the
warning column more generalized and easier to extend to more use-cases.
E.g. library override elements will use this after a followup commit.
To support mode toggles a display mode can now just return true in the
`AbstractTreeDisplay::supportsModeColumn()` method. This makes it
trivial to add mode columns to other display modes, and less error prone
because there's no need to hunt down a bunch of display mode checks in
different places.
|
|
by default.
Avoids having to manually enable data-blocks for user-edition when you
do not care about what should be edited by whom. Similar to default
behavior before introduction of system overrides (aka non-user-editable
overrides).
|
|
This reverts commit 30534deced8dad16c566dd82db3edd462283de13.
After discussion and feedback from users, it's better to keep this tool
available until there is time to properly re-think the whole Outliner's
contextual menu.
|
|
Replace some `if/else if` chains by proper `switch` statement.
Replace some `BLI_assert(0)` calls by `BLI_assert_unreachable()` ones.
|
|
|
|
|
|
We cannot try to get RNA info when the rna path of an override property
is invalid.
|
|
This feature is very advanced, and the way it was exposed in the
Outliner was very confusing at best.
It remains available through the Python API (`ID.user_remap`) e.g.
|
|
This was historically the only way to change/fix paths of library files
in Blender. However, only changing the path then required a manual
reload of the library, which could be skipped by user, or a save/reload
of the working .blend file, which could lead to corruption of advanced
library usages like overrides.
Prefferred, modern way to change path of a library is to use the
Relocate operation instead. Direct path modification remains possible
through RNA (python console or the Data API view in the Outliner.
|
|
These were missing in "Blender File" view.
before
{F13053175}
after
{F13053176}
Differential Revision: https://developer.blender.org/D14859
|
|
|
|
While the reference would never be used in case of NULL pointer, this
bit of code was not really clear and nice, so make it less ambiguous
now. Also add early return in case a NULL idv pointeris actually passed.
|
|
Adds a column to the right in the Library Overrides Hierarchies view
mode to toggle editability of library overrides.
Note that making a library override non-editable currently involves
clearing all overridden properties. This is an arguable design choice,
we should probably at least warn the user before doing this.
Part of T95802.
Reviewed by: Bastien Montagne
Differential Revision: https://developer.blender.org/D14653
|
|
|
|
Animation would still play in the viewport.
There are two ways to unlink an action from the Outliner:
[1] `Unlink Action` on the Animation Data context menu.
This does `outliner_do_data_operation` / `unlinkact_animdata_fn` and has
the correct DEG update.
[2] `Unlink` on the Action context menu
This does `outliner_do_libdata_operation` / `unlink_action_fn` and was
missing the DEG update.
Now add the missing DEG update to the second case.
Maniphest Tasks: T95679
Differential Revision: https://developer.blender.org/D14089
|
|
This adds missing cases to detect edit mode for Curves objects.
Unlike other object types, Curves do not have specific edit data,
rather we edit the original data directly, and rely on `Object.mode`.
For this, `BKE_object_data_is_in_editmode` had to be modified to
take a pointer to the object. This affects two places: the outliner
and the dependency graph. For the former place, the object pointer
is readily available, and we can use it. For the latter, the object
pointer is not available, however since it is used to update edit
mode pointers, and since Curves do not have such data, we can
safely pass null to the function here.
This also fixes the assertion failure that happens when closing a file
in edit mode.
Differential Revision: https://developer.blender.org/D14330
|
|
Kudos to Aaron Carlisle (@Blendify) for noticing it!
|
|
|
|
Add blank lines after file references to avoid them being interpreted as
doc-strings the following declarations.
|
|
Add ccl_gpu_kernel_postfix as a statement macro to prevent the following
declarations from being indented.
|
|
Adds a dropdown for the Library Overrides display mode that lets users
choose between a "Properties" and a "Hierachies" view mode. The former
is what was previously there (a mode that displays all overridden
properties with buttons to edit the values), the latter is new. It
displays the hierarchical relationships between library overridden
data-blocks. E.g. to override the mesh of an object inside a linked
collection, the entire collection > object > mesh hierarchy needs to be
overridden (whereby the former two will be automatically overridden
using system overrides).
The Hierarchies mode will also show the override hierarchies of
data-blocks that were linked and are overridden in the source file. This
information is useful to have, especially for debugging scenes.
Part of T95802.
Differential Revision: https://developer.blender.org/D14440
Reviewed by: Bastien Montagne
|
|
Add new `BKE_id_is_editable` helper in `BKE_lib_id.h`, that supercedes
previous check (simple `ID_IS_LINKED()` macro) for many editing cases.
This allows to also take into account 'system override' (aka
non-editable override) case.
Ref: {T95707}.
|
|
single' operations.
'Delete' was a confusing name, even though it would delete the overrides
it would replace them by linked data.
Adding the 'single' version of that operation made it even more
confusing, since often it has to keep the override ID for sakes of
hierarchy, and just reset it and turn it back into a non-editable system
override.
Ref: {T95707}.
|
|
Implement default behavior to decide which overrides remain 'system'
ones, and which become 'user editable' ones, when creating hierarchy
override from 3DView or the Outliner.
3DView:
If from an Empty-instanced collection, only Armature objects in
that collection are user overrides.
If from a set of selected objects, all overrides created from selected
objects are user overrides.
Outliner:
All override IDs created from selected elements in the Outliner are user
overrides.
There is one special case: When a collection is selected, and is
'closed' in the outliner, all its inner armature objects are also user
overrides.
Ref: {T95707}.
|
|
Error exposed by ba49345705a3. Code just assumed that the tree-element
pointed to a real ID, but this is often not the case, and the ID pointer
contains completely different data. E.g. before ba49345705a3, it would
be a pointer to one of the `Main` listbases, so this code would have
undefined behavior. Now the pointer is null for elements in the "Current
File" element, causing a null-pointer dereference rather than undefined
behavior (that just happened to virtually always result in the intended
code path).
|
|
The Library Overrides display mode is meant to show overridden
properties from the current file only, not library overrides in
data-blocks that just were linked in. The upcoming Hierarchies view mode
for Library Overrides will also display linked in data-blocks that have
overrides in the source file (but not the individual overridden
properties), see T95802.
|
|
In the Blender File display mode of the Outliner, mouse hovering a
"base" element (e.g. "Objects", "Materials", ...) would also highlight
that same base element in other libraries linked into the scene. In fact
operations like (un)collapsing would be applied to both too.
Issue was that we'd always use the listbase containing the data-blocks
from the current main as a way to identify the tree element. So for the
same data-block types we'd use the same listbase pointers. Instead use
the the library pointer + a per library index.
|
|
In the library overrides mode, in some situations there would be empty
base elements like "Collections" or "Objects". Don't show them, it's
confusing wihout use. Code just failed to consider that case.
|
|
All the buttons in the Library Overrides display mode would be shown in cyan,
indicating that they are library overrides. Given that this is solely what this
display mode is about, the indicator is just redundant, confusing (why are the
buttons purple?) and looks weird.
Part of T95802.
Reviewed by: Bastien Montagne
Differential Revision: https://developer.blender.org/D14416
|
|
There is a dedicated Library Override display mode now, and showing
these elsewhere just adds noise and makes the code problematic to
maintain (since the same element hierarchy will be used in two entirely
different contexts). The corresponding filter settings are removed too.
Part of T95802.
Reviewed by: Bastien Montagne
Differential Revision: https://developer.blender.org/D14411
|
|
Instead of having the "Current File" and then the individual libraries
containing indirect library overrides in the Library Overrides display
mode, only show what's in the current file. Agreement was that this
isn't very useful in this view, we may want to add it to the Hierarchy
view though (see T95802).
Part of T95802.
Also expands the top level ID type items ("Objects", "Materials", ...)
by default. See D14410 for details.
Reviewed by: Bastien Montagne
Differential Revision: https://developer.blender.org/D14410
|
|
Essentially, we only allow deletion of hierarchy roots of liboverrides,
when hierarchy deletion option is enabled.
Also add some checking code in the generic, non-object/collection ID
delete code, to prevent any deletion of liboverrides that would be part
of a hierarchy.
|
|
- Deprecated headers
- Else after return
- Inconsistent parameter names (I used the most recently modified)
- Raw string literals
|
|
Tweaks:
- Increase horizontal padding for the buttons from 1 point to 2, looked like an
unintentional placement error before.
Fixes:
- Missing horizontal padding for array buttons
- Small gap between separator line and right column when using a high interface
scale
- Properly center buttons vertically.
|
|
Solved by introducing introducing a variant of MEM_cnew which behaves
as a copy-constructor for a trivial types.
Alternative approach would be to surround DNA structs with clang/gcc
diagnostics push/modify/pop so that implicitly defined constructors
and copy operators are allowed to access deprecated fields.
The downside of the DNA approach is that it will require some way to
easily apply diagnostics modifications to many structs, which is not
possible currently.
The newly added MEM_cnew has other good usecases, so is easiest to
use this route, at least for now.
Differential Revision: https://developer.blender.org/D14356
|
|
As proposed in T95802, this adds buttons to a new column on the right to modify
the override in the Library Override display mode. Some further usability
improvements are planned. E.g. this does not yet expand collections (modifiers,
constraints, etc) nicely or group modified properties of a modifier together.
Vector properties with more than 3 items or matrices aren't displayed nicely
yet, they are just squeezed into the column. If this actually becomes a problem
there are some ideas to address this.
Differential Revision: https://developer.blender.org/D14268
|
|
So far it was needed to declare a new RNA struct to `RNA_access.h` manually.
Since 9b298cf3dbec we generate a `RNA_prototypes.h` for RNA property
declarations. Now this also includes the RNA struct declarations, so they don't
have to be added manually anymore.
Differential Revision: https://developer.blender.org/D13862
Reviewed by: brecht, campbellbarton
|
|
Lets `makesrna` generate a `RNA_prototypes.h` header with declarations for all
RNA properties. This can be included in regular source files when needing to
reference RNA properties statically.
This solves an issue on MSVC with adding such declarations in functions, like
we used to do. See 800fc1736748. Removes any such declarations and the related
FIXME comments.
Reviewed By: campbellbarton, LazyDodo, brecht
Differential Revision: https://developer.blender.org/D13837
|
|
Activating a gizmo used the windows eventstate which may have values
newer than the event used to activate the gizmo.
This meant transforms check for the key that activated transform
could be incorrect.
Support passing an event when calling operators to avoid this problem.
|
|
|
|
Regression in b8960267dd51f9108b3b49e9b762e6b4d35ae1dc,
it's important for box-select to use the drag start to check
if the cursor is over an icon.
|