Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-11-07Fix File Browser Move Bookmark malfunction if no item is selectedPhilipp Oeser
The operator was acting on non selected items (wasnt checking SpaceFile bookmarknr for being -1) which could end up removing items even. Now sanatize this by introducing proper poll (which returns false if nothing is selected). Fixes T102014. Maniphest Tasks: T102014 Differential Revision: https://developer.blender.org/D16385
2022-10-30BLI_path: add BLI_path_append_dir (appends and ensures trailing slash)Campbell Barton
Avoid copying the string then calling BLI_path_slash_ensure afterwards.
2022-10-30Fix potential buffer overflow with BLI_path_slash_ensure useCampbell Barton
BLI_path_slash_ensure was appending to fixed sized buffers without a size check.
2022-10-30Fix T102132: Directory selection fails to add trailing slashCampbell Barton
Regression in [0], accessing the path from the file selector relied on BLI_join_dirfile adding a trailing "/" when the filename was empty. [0]: 9f6a045e23cf4ab132ef78eeaf070bd53d0c509f
2022-10-17Cleanup: replace BLI_join_dirfile with BLI_path_joinCampbell Barton
These functions are almost identical, the main difference being BLI_join_dirfile didn't trim existing slashes when joining paths however this isn't an important difference that warrants a separate function.
2022-10-17BLI_path: remove trailing NULL argument to BLI_path_joinCampbell Barton
Using varargs had the disadvantages, replace with a macro which has some advantages. - Arguments are type checked. - Less verbose. - Unintended NULL arguments would silently terminate joining paths. - Passing in a NULL argument warns with GCC.
2022-09-25Cleanup: remove redundant double parenthesisCampbell Barton
2022-09-16Cleanup: formatCampbell Barton
2022-09-16Make File Select dialog update operator's file & path propertiesColin Basnett
When an operator is attached to a file select dialog, the update callback function for the operator's directory, filename and filepath properties will be called as the user navigates through the dialog. This will allow add-on authors to make more interactive import operators. Differential Revision: https://developer.blender.org/D15543
2022-09-10Fix possible NULL pointer dereference in bookmark operatorsCampbell Barton
Although unlikely, the result of BKE_appdir_folder_id_create may be NULL. Check this for bookmark operators & move writing bookmarks into a shared utility function.
2022-09-10Cleanup: remove redundant NULL checksCampbell Barton
Checking if a property exists only makes sense for generic callbacks that apply to multiple operators.
2022-07-11Cleanup: spelling in commentsCampbell Barton
2022-06-16UI: Add file browser operator to edit directory fieldDamien Picard
This allows using a shortcut from the file browser to edit the directory path. The shortcut Ctrl + L is quite standard and used in multiple GNU/Linux desktop desktop environments, Windows, as well as most web browsers. Safari on macOS uses Cmd + L. Reviewed by: Jacques Lucke, Julian Eisel Differential Revision: https://developer.blender.org/D15196
2022-06-16Cleanup: Use const in File Browser filtering operatorJulian Eisel
2022-03-11Fix out of order event handling when calling operators from gizmosCampbell Barton
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.
2022-02-11File headers: SPDX License migrationCampbell Barton
Use a shorter/simpler license convention, stops the header taking so much space. Follow the SPDX license specification: https://spdx.org/licenses - C/C++/objc/objc++ - Python - Shell Scripts - CMake, GNUmakefile While most of the source tree has been included - `./extern/` was left out. - `./intern/cycles` & `./intern/atomic` are also excluded because they use different header conventions. doc/license/SPDX-license-identifiers.txt has been added to list SPDX all used identifiers. See P2788 for the script that automated these edits. Reviewed By: brecht, mont29, sergey Ref D14069
2022-01-03UDIM: Support virtual filenamesJesse Yurkovich
This implements the design detailed in T92696 to support virtual filenames for UDIM textures. Currently, the following 2 substitution tokens are supported: | Token | Meaning | | ----- | ---- | | <UDIM> | 1001 + u-tile + v-tile * 10 | | <UVTILE> | Equivalent to u<u-tile + 1>_v<v-tile + 1> | Example for u-tile of 3 and v-tile of 1: filename.<UDIM>_ver0023.png --> filename.1014_ver0023.png filename.<UVTILE>_ver0023.png --> filename.u4_v2_ver0023.png For image loading, the existing workflow is unchanged. A user can select one or more image files, belonging to one or more UDIM tile sets, and have Blender load them all as it does today. Now the <UVTILE> format is "guessed" just as the <UDIM> format was guessed before. If guessing fails, the user can simply go into the Image Editor and type the proper substitution in the filename. Once typing is complete, Blender will reload the files and correctly fill the tiles. This workflow is new as attempting to fix the guessing in current versions did not really work, and the user was often stuck with a confusing situation. For image saving, the existing workflow is changed slightly. Currently, when saving, a user has to be sure to type the filename of the first tile (e.g. filename.1001.png) to save the entire UDIM set. The number could differ if they start at a different tile etc. This is confusing. Now, the user should type a filename containing the appropriate substitution token. By default Blender will fill in a default name using the <UDIM> token but the user is free to save out images using <UVTILE> if they wish. Differential Revision: https://developer.blender.org/D13057
2021-12-16Remove G.relbase_validCampbell Barton
In almost all cases there is no difference between `G.relbase_valid` and checking `G.main->filepath` isn't an empty string. In many places a non-empty string is already being used instead of `G.relbase_valid`. The only situation where this was needed was when saving from `wm_file_write` where they temporarily became out of sync. This has been replaced by adding a new member to `BlendFileWriteParams` to account for saving an unsaved file for the first time. Reviewed By: brecht Ref D13564
2021-12-08Cleanup: move public doc-strings into headers for 'editors'Campbell Barton
Ref T92709
2021-11-30Merge remote-tracking branch 'origin/blender-v3.0-release'Sybren A. Stüvel
2021-11-30Fix T93508: Shift+F1 to switch to asset browser randomly crashesJulian Eisel
2021-11-30Fix T92577: Cannot open shortcut folders on WindowsJulian Eisel
`file.select()` wasn't handling redirects as it should when it also opens directories. This was only uncovered by a change in the keymap. Reviewed By: Bastien Montagne, Harley Acheson Differential Revision: https://developer.blender.org/D13388
2021-11-23Asset: Merge asset library/list refresh operatorsJulian Eisel
In rBdcdbaf89bd11, I introduced a new operator (`file.asset_library_refresh()`) to handle Asset Browser refreshing more separate from File Browser refreshing. However, there already was `asset.asset_list_refresh()`, which at this point only works for asset view templates, but was intended to cover the Asset Browser case in future too. This would happen once the Asset Browser uses the asset list design of the asset view template. So rather than having two operators for refreshing asset library data, have one that just handles both cases, until they converge into one. This avoids changes to the Python API in future (deprecating/changing operators). Differential Revision: https://developer.blender.org/D13239
2021-11-23Asset: Merge asset library/list refresh operatorsJulian Eisel
In rBdcdbaf89bd11, I introduced a new operator (`file.asset_library_refresh()`) to handle Asset Browser refreshing more separate from File Browser refreshing. However, there already was `asset.asset_list_refresh()`, which at this point only works for asset view templates, but was intended to cover the Asset Browser case in future too. This would happen once the Asset Browser uses the asset list design of the asset view template. So rather than having two operators for refreshing asset library data, have one that just handles both cases, until they converge into one. This avoids changes to the Python API in future (deprecating/changing operators). Differential Revision: https://developer.blender.org/D13239
2021-11-01Asset Browser: Correct name & tooltip for asset list refresh operatorJulian Eisel
The name and tooltip were talking about file-lists, which exposes the fact that the Asset Browser uses the File Browser code in the UI, which we shouldn't do. This can confuse users. Instead have a dedicated operator for the Asset Browser with a proper name and tooltip.
2021-11-01Merge branch 'blender-v3.0-release'Campbell Barton
2021-11-01Fix crash when "HOME" environment variable isn't definedCampbell Barton
Accessing the default directory in the file selector would crash if HOME was undefined. Add BKE_appdir_folder_default_or_root which never returns NULL.
2021-10-29Asset Browser: Correct name & tooltip for asset list refresh operatorJulian Eisel
The name and tooltip were talking about file-lists, which exposes the fact that the Asset Browser uses the File Browser code in the UI, which we shouldn't do. This can confuse users. Instead have a dedicated operator for the Asset Browser with a proper name and tooltip.
2021-10-20Cleanup: use an array for wmEvent cursor position variablesAaron Carlisle
Use arrays for wmEvent coordinates, this quiets warnings with GCC11. - `x, y` -> `xy`. - `prevx, prevy` -> `prev_xy`. - `prevclickx, prevclicky` -> `prev_click_xy`. There is still some cleanup such as using `copy_v2_v2_int()`, this can be done separately. Reviewed By: campbellbarton, Severin Ref D12901
2021-09-27File/Asset Browser: Don't deselect other items when draggingJulian Eisel
Basically this enables the select-tweaking behavior as per the guidelines: https://wiki.blender.org/wiki/Human_Interface_Guidelines/Selection#Select-tweaking. We use this in most other other editors that allow selecting and dragging multiple items. But besides the consistency improvement, this is important if we want to support dragging multiple assets (or files) in future. We want to support this at least for dragging multiple assets into an asset catalog for the upcoming asset catalog UI.
2021-08-12Cleanup: spelling in commentsCampbell Barton
2021-08-12Cleanup: use C++ style comments for disabled codeCampbell Barton
2021-08-10File/Asset Browser: Select/Activate File on Right Click for Context MenuJulian Eisel
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
2021-08-10Fix crash: mouse is over file space during startup.Jeroen Bakker
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.
2021-08-02Asset Browser: Proper context menu for assetsJulian Eisel
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
2021-07-30Assets: Disable File Browser only operators for asset browsingJulian Eisel
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.
2021-07-30Fix incorrect poll function used for file path droppingJulian Eisel
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.
2021-07-30Cleanup: Refactor logic of file deletion poll callbackJulian Eisel
* 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.
2021-07-30Preferences: Move "Register File Association" to preferences levelJulian Eisel
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.
2021-07-21Cleanup: replace BLI_assert(test || !"text") with BLI_assert_msg(test, text)Campbell Barton
2021-07-07Assets: Keep assets active after renaming, ensure they are scrolled into viewJulian Eisel
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
2021-07-07Cleanup: Move file deselection function to more appropriate fileJulian Eisel
`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.
2021-07-07Cleanup: spelling in commentsCampbell Barton
2021-07-05Assets: Disable file renaming operator for Asset BrowsersJulian Eisel
This operator only works with renaming files, not assets.
2021-07-05Cleanup: Move common File Browser renaming code into functionsJulian Eisel
Code would manually do the same things in a couple of places, obvious case of unnecessary code duplication.
2021-07-03Cleanup: consistent use of tags: NOTE/TODO/FIXME/XXXCampbell Barton
Also use doxy style function reference `#` prefix chars when referencing identifiers.
2021-07-01Fix race condition when loading multiple File/Asset Browsers at onceJulian Eisel
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.
2021-06-24Cleanup: comment blocks, trailing space in commentsCampbell Barton
2021-06-22Cleanup: Spelling MistakesLeon Zandman
This patch fixes many minor spelling mistakes, all in comments or console output. Mostly contractions like can't, won't, don't, its/it's, etc. Differential Revision: https://developer.blender.org/D11663 Reviewed by Harley Acheson
2021-06-14Fix Build WarningHarley Acheson
Marking unused function argument. Introduced in bcff0ef9cabc Differential Revision: https://developer.blender.org/D10887