Age | Commit message (Collapse) | Author |
|
Amendment to 7a5216497cc3.
Removed this before committing, because I thought it wasn't needed. Of
course it was...
|
|
For some reason the asset preview isn't created or loaded correctly in
some instances. This could be addressed with D9974, but hard to tell
since I only have a failing .blend file, no steps to recreate it from
scratch.
Would crash when opening an Asset Browser, selecting an object asset
(that has an invalid preview stored) and opening the Asset Browser
sidebar, so that the preview is visible there.
|
|
Context members of the file space would not be shown in the context API
docs.
|
|
Since recently it's possible to query the active file (as object, not
just the name), but it's quite useful for scripting to have access to
all selected files.
This introduces `bpy.context.selected_files`, returning a list of file
objects representing files in the File Browser.
|
|
|
|
|
|
|
|
This patch removes the "Kerning Style" option for UI widget font
drawing and uses only the current default of "Fitted", since the other
option of "Unfitted" is just the result of truncation errors.
see D12231 for much more information.
Differential Revision: https://developer.blender.org/D12231
Reviewed by Campbell Barton
|
|
|
|
|
|
Idea for 3.0 is to disable all functionality that isn't well polished
and focus on those parts first. Starting with poses.
* Adds a new experimental option "Extended Asset Browser", replacing
"Asset Browser".
* Unlike the previous option, this isn't enabled by default anymore.
This didn't work well in practice and caused plenty of confusion.
* "Mark as Asset" and "Clear Asset" are hidden if the option is
disabled.
* Same for the category selection in the Asset Browser.
* Always show display the "Only Assets" option in the File Browser while
browing inside .blend files. That way you can hide data-blocks that
are not pose assets.
* The Asset Library setup UI in the Preferences is always visible now,
it's needed for pose library access.
Addresses T90181, T90180 and T90300.
Differential Revision: https://developer.blender.org/D12120
|
|
Right clicking would spawn the context menu under the cursor, but some
operators would actually act on the active asset/file which wasn't
the one clicked on.
When multiple files are selected and one of them is right-clicked on,
selection is not changed to allow operations on multiple files. E.g.
deletion.
This makes the File/Asset Browser match the Outliner (in behavior, not
implementation).
For the right-click selection keymap:
* The context menu still only spawns on W.
* Bonus: Right click now does something, it actually selects files!
I could have done additional changes here to avoid this, but it seems
like a good addition.
This is also a better alternative to rB5edfde58fe60, which didn't work
properly either. Using rename from the context menu would only work if
the clicked on file was also active...
Differential Revision: https://developer.blender.org/D12065
Reviewed by: Campbell Barton
|
|
When blender starts and the mouse is over a file/asset browser it
crashes. This is because blender wants to highlight a file, but the
layout isn't initialized yet.
|
|
Pass `FileListReadJob` to the `read_job_fn` callback, instead of exploding
the struct into its individual fields, passing those as parameters, and
marking a bunch of those as unused again.
No functional changes.
|
|
Add a comment to document what `FileListReadJob::tmp_filelist` is for,
and how it's freed.
No functional changes.
|
|
In the `FileList` struct, rename the `AssetLibraryReference
*asset_library` field to `asset_library_ref` -- it's a description of
which asset library is used, and not the asset library itself.
This is to make space for a future `AssetLibrary *asset_library` field,
which will point to an actual asset library struct/class.
No functional changes.
Reviewed by: Severin
Differential Revision: https://developer.blender.org/D12151
|
|
|
|
|
|
The file selection parameters (e.g. `context.space_data.params`) are
expected to be unset in certain cases. Reading 2.4 files seems to be one
of them. Hence, code using it should check it's set first. Also added an
assert to a File Browser UI template printing a message when the
parameters are unset, to help debugging the issue.
|
|
Add a context menu dedicated to asset operations to the Asset Browser.
There are two separate context menus to keep things separated well and
avoid confusing if-else logic (similar to D12057 & D12059). Their polls
make sure they are displayed for the right contexts only.
Also (to be committed as followup cleanup): Remove now unused special
handling for assets in file delete operator.
Differential Revision: https://developer.blender.org/D12062
|
|
Originally the operator name was drawn next to the dragging content.
After that there was an option to add custom, static text with the
dragging content. This patch allows dynamic text to be drawn.
The custom text was implemented as out parameter of the poll function
what made the code unclear. This patch introduces a tooltip function
that separates tooltip generation from the poll function.
NOTE: the text should always be returned in its own memory block. This
block will be freed after it is copied in the drag struct.
Reviewed By: Severin
Differential Revision: https://developer.blender.org/D12104
|
|
These operators shouldn't be available in the Asset Browser.
https://developer.blender.org/T83556
Added a comment to each operator poll assignment to explicitly mention
the intention. That should also remind devs to decide if the operator
should apply for both file & asset browsing when copy & pasting operator
definition code.
|
|
The operator to drop file paths into the File Browser was just checking
if there's an active window. This wasn't really an issue since the
operator was only used as drop-operator for the File Browser. But the
operator would show up in the operator search. Plus, for asset browsing,
we'll also have to check the file browsing mode, so the more specific
poll function will be needed.
|
|
* Early exit instead of complex if-else blocks.
* Avoid iterating over entire file list.
* Use `true`/`false` for boolean values.
* Declare variables in smaller scopes.
|
|
The operator was register as a "file" operator, which are by convention
used for File Browser operators only. Move it to the "preferences"
operators, where it's displayed in the UI too.
|
|
This isn't used at all in the current File and Asset Browser design.
|
|
When viewing font files in the File Manager, this patch uses the font's
family and style names to show the same type of string shown to users
in operating system lists. For example "Book Antiqua Regular" instead
of "BKANT.ttf"
see D12020 for details and examples.
Differential Revision: https://developer.blender.org/D12020
Reviewed by Campbell Barton and Julian Eisel
|
|
Since recently it's possible to access assets from outside the
File/Asset Browser, via the asset view template. So we are slowly
moving away from file space specific code to dedicated asset system
code. I introduced `AssetLibraryReference` as a duplicate of
`FileSelectAssetLibraryUID`, with a plan to delete the latter in a
separate cleanup commit. That's exactly what this commit is.
This will cause Asset Browsers to open with the default "Current File"
Asset Library. We could avoid that, but it's a minor issue really.
|
|
|
|
Would previously pass a few properties that are available via the
asset-handle now. This asset-handle is also required for some of the
asset API, e.g. the temporary ID loading. This will probably be needed
before too long.
|
|
Implements a basic, WIP version of the asset list. This is needed to
give the asset view UI template asset reading and displaying
functionality.
See:
* Asset System: Data Storage, Reading & UI Access - https://developer.blender.org/T88184
Especially the asset list internals should change. It uses the
File/Asset Browser's `FileList` API, which isn't really meant for access
from outside the File Browser. But as explained in T88184, it does a lot
of the stuff we currently need, so we (Sybren Stüvel and I) decided to
go this route for now. Work on a file-list rewrite which integrates well
with the asset system started in the `asset-system-filelist` branch.
Further includes:
* Operator to reload the asset list.
* New `bpy.types.AssetHandle.get_full_library_path()` function, which
gets the full path of the asset via the asset-list.
* Changes to preview loading to prevent the preview loading job to run
eternally for asset views. File Browsers have this issue too, but
should be fixed separately.
|
|
For the Asset Browser, this returns the active asset library of the
Asset Browser, otherwise it returns the one active in the workspace.
This gives simple access to the active asset library from UI code and
Python scripts. For example the upcoming Pose Library add-on uses this,
as well as the upcoming asset view template.
|
|
This per-workspace active asset library will be used by the asset views
later. Note that Asset Browsers have their own active asset library,
overriding the one from the workspace.
As part of this the `FileSelectAssetLibraryUID` type gets replaced by
`AssetLibraryReference` which is on the asset level now, not the
File/Asset Browser level. But some more work is needed to complete that,
which is better done in a separate commit.
This also moves the asset library from/to enum-value logic from RNA to
the editor asset level, which will later be used by the asset view.
|
|
This shows the text as part of the assertion message.
|
|
Accidentally included this in rB01e1944cd455, it came from a merge
conflict.
|
|
Comment was based on an older version of the patch.
|
|
When renaming an ID somewhere in the UI after marking it as asset, it would
often get lost in the Asset Browser (scrolled out of view). It would also get
deactivated.
This patch makes sure that if an asset is active whose ID gets renamed, it is
kept active and visible. That is important for a fast, uninterrupted asset
creation workflow, where users often rename assets while working in the asset
browser.
Old code stored the new file-name to identify a file after re-reading the
file-list after the rename. For assets that doesn't work because there may be
multiple assets with the same name. Here the simple solution of just storing
the pointer to the renamed ID is chosen, rather than relying on the file-name
in this case. (Should be fine with undo, since the ID * reference is short
lived, it's not stored over possible undo steps. If it turns out to have
issues, I rather switch to a rename_id_uuid, but keep that separate from the
file->uid).
Reviewed by: Sybren Stüvel
Differential Revision: https://developer.blender.org/D11119
|
|
(Note: This is an alternative version for D9994 by @Schiette. The commit
message is based on his description.)
Currently, when a new directory is created it is not selected.
Similarly, when renaming an existing file or directory, it does not
remain active/highlighted blue after renaming.
This change makes sure the file or directory is always selected after
renaming, even if the renaming failed or was cancelled.
This has some usability advantages:
- Open the newly created directory without having to select it (ENTER).
- If you make a naming mistake, you can immediately fix that (F2)
without having to click it again.
- If you create a directory and forget to name it, you can fix that
(F2) without having to select it.
- This is consistent with many common File Browsers.
Further, selecting the item even after renaming failed or was cancelled
helps keeping the file in focus, so the user doesn't have to look for it
(especially if the renaming just failed which the user may not notice).
In other words, it avoids disorienting the user.
Also see D11119 which requires this behavior.
We could also always select the file/directory on mouse press. This
would make some hacks unnecessary, but may have further implications. I
think eventually that's what we should do though.
|
|
`filesel.c` seems like the place that should contain file selection
functions. Previously it was in `file_ops.c` because that was the only
file that actually used it. But a followup commit needs it from a
different file.
|
|
|
|
File Browser code uses the term "params" for its file selection parameters a
lot. Avoid confusion/ambiguity by calling the notifier listener parameters
"listener_params".
|
|
This operator only works with renaming files, not assets.
|
|
|
|
Code would manually do the same things in a couple of places, obvious case of
unnecessary code duplication.
|
|
|
|
Also use doxy style function reference `#` prefix chars when
referencing identifiers.
|
|
This code was written for the File Browser together with the Asset Engine
design, that is not part of the Asset Browser/System design anymore. Updated
comments accordingly.
`FileDirEntryRevision` was actually used, but I removed it and moved the used
members to the parent `FileDirEntry`, since there is no concept of revisions
currently.
There should be no functional changes.
|
|
To some degree these are changes in preparation of further Asset Browser
related changes, see D11119. But also, the current UUID design was written for
the old Asset Engine design, which isn't part of the current Asset
Browser/System design anymore.
And lastly, "UUID" are a well established standard
(https://en.wikipedia.org/wiki/Universally_unique_identifier) which this
implementation didn't follow. What we have here is more of an index, or a
unique identifier (https://en.wikipedia.org/wiki/Unique_identifier).
So this does the following changes:
* Renames "UUID" to "UID"
* Changes the type of the UID to (a typedef'ed) `uint32_t`, which is more than
enough for our current asset system design and simplifies things.
* Due to the new type, we can avoid allocations for hash-table storage.
* Add/use functions for UID handling
Note that I am working on a major rewrite of the file-list code. Meanwhile we
want to keep things sensible.
|
|
When multiple File or Asset Browsers would load at once (e.g. when loading a
file with two File Browsers open) and they would load multiple directories or
.blend files (using the Recursions option in the File Browser or loading an
asset library with multiple .blends), often only one File/Asset Browser would
correctly load all files. Others would be incomplete or entirely empty. That
was because of a race condition, where the directories or .blend files would be
loaded concurrently and the first one that finished would cancel the other
ones. This again happened because they used the job system with the same
"owner", which by design makes all jobs with the same owner cancel as soon as
the first is finished.
Address this by making sure they have different owners. That is, not the scene
anymore, but the filelist the job belongs to. Doesn't make much sense to use
the scene as owner for scene-unrelated file loading anyway.
Steps to reproduce were:
* Open two File Browsers as regular editors.
* In the Display Settings popover, set "Recursions" to 2 or 3 levels.
* Navigate to a directory with plenty of subdirectories in both File Browsers.
* Save the file.
* Reload the file, one of the File Browsers likely has an incomplete file list.
Alternatively, use Asset Browsers and open an asset library containing multiple
.blends.
|
|
This changes `UI_but_func_tooltip_set` so that it allows passing a custom free function, which has two benefits:
* The caller can pass `null` to indicate that the value should not be freed.
* Arbitrary c++ data can be passed to the callback (before the struct had to be trivially destructible).
I added `uiFreeArgFunc` and used it in other places where appropriate.
Differential Revision: https://developer.blender.org/D11738
|