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-08Merge branch 'blender-v3.4-release'Sergey Sharybin
2022-11-08Fix deprecation warnings about printf() on macOSSergey Sharybin
The new Xcode 14.1 brings the new Apple Clang compiler which considers sprintf unsafe and geenrates deprecation warnings suggesting to sue snprintf instead. This only happens for C++ code by default, and C code can still use sprintf without any warning. This changes does the following: - Whenever is trivial replace sprintf() with BLI_snprintf. - For all other cases use the newly introduced BLI_sprintf which is a wrapper around sprintf() but without warning. There is a discouragement note in the BLI_sprintf comment to suggest use of BLI_snprintf when the size is known. Differential Revision: https://developer.blender.org/D16410
2022-11-04BLI_path: remove use of BLI_path_normalize in BLI_path_parent_dirCampbell Barton
Normalize is no longer necessary as BLI_path_name_at_index skips redundant path components such as "//" and "/./". This has the advantage that the path length isn't limited to FILE_MAX.
2022-11-03BLI_path: skip "/./" and "/." in BLI_path_name_at_indexCampbell Barton
This avoids having to run BLI_path_normalize before calling BLI_path_name_at_index.
2022-11-02Fix BLI_path_parent_dir returning success with a single period as inputCampbell Barton
While relatively harmless, BLI_path_parent_dir wasn't returning failure when passed in "./" which wouldn't succeed. Instead of adding a ".." and normalizing, normalize the path and remove the last directly. This is simpler than inspecting the resulting path to see if normalize removed it or not. Add additional tests which failed previously.
2022-11-02Fix T102201: File selector shows "\" before folder names on WIN32Campbell Barton
Regression in [0] on WIN32 caused joining paths {"//", "path"} to result in "//\path". This made the file selector show paths with a "\" prefix. Add an exception for WIN32 where an initial path of forward slashes is joined without a back-slash. [0]: 8f7ab1bf46d5e8610b167180b7631ff62e718a08
2022-11-01Fix BLI_path_parent_dir failing on paths ending with ".."Campbell Barton
The check for BLI_path_normalize having succeeded only checked for a trailing "../" which isn't correct. This caused going up a directory in the file selector to do nothing on directories ending with "..". This also caused an empty path to expand into "../" because BLI_path_extension_check didn't account for this case. Resolve using BLI_path_name_at_index which extracts the last component of the path without having to match the the surrounding slashes.
2022-11-01Fix BLI_path_normalize failing with "." and ".." in the pathCampbell Barton
The logic to go up a directory (using "..") ran before stripping "/./" from the path. This caused "/a/b/./../" to result in "/a/b/" instead of "/a/". Now redundant characters are removed before before checking for ".." in paths. Include test to ensure this works as expected.
2022-10-31BLI_path: only operate on native path slashes for BLI_path_name_at_indexCampbell Barton
Prefer using the native path separator for low level path functions.
2022-10-31BLI_path: only operate on native path slashes for BLI_path_joinCampbell Barton
Previously both slashes were considered when joining paths, meaning slashes that were part of the path name could be stripped before joining the path. Prefer using the native path separator for low level path functions, callers can always convert slashes into the expected direction if they need. This also matches BLI_path_append behavior.
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-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-10-07Cleanup: redundant parenthesisCampbell Barton
2022-09-25Cleanup: use 'u' prefixed integer types for brevity & cast styleCampbell Barton
To use function style cast '(unsigned char)x' can't be replaced by 'unsigned char(x)'.
2022-09-17Cleanup: spelling, punctuation & repeated words in commentsCampbell Barton
2022-09-12Tests: add tests for leading (relative) slashes for BLI_path_joinCampbell Barton
Also note that leading slashes are kept in the doc-string.
2022-09-09Cleanup: remove BLI_make_file_stringCampbell Barton
This function did multiple things making it difficult to know what was intended by the caller: - Directory & file join. - Expand relative '//' prefix to an optional directory. - Expand drive letters on windows (guessing with fall-backs). - Switch slashes to native direction. This functionality wasn't needed as the full directory was always passed in, so guessing the drive letter wasn't needed. If functionality to add drive letters onto paths is needed in the future a function that only does this can be added.
2022-09-09Cleanup: remove paranoid NULL checksCampbell Barton
2022-08-27Cleanup: rename filename to filepath when used for full pathsCampbell Barton
2022-03-30Cleanup: use "num" as a suffix in: source/blender/blenlibCampbell Barton
Also replace "num" with: - "number" when it's not used to denote the number of items. - "digits" when digits in a string are being manipulated.
2022-03-17Cleanup: spelling in commentsCampbell Barton
Use <pre>..</pre> for pseudo-code.
2022-03-09Cleanup: use ELEM macroCampbell Barton
2022-03-08Cleanup: spelling in commentsCampbell Barton
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-02-09Cleanup: move file descriptions into doxygen file sectionCampbell Barton
Continuation of 19100aa57d847699d17527b76c2fab1f4ab88885.
2022-01-28BLI_path: assert passing relative paths to BLI_path_cmp_normalizedCampbell Barton
Assert when "//" prefixed relative paths are passed to BLI_path_cmp_normalized as this can't be expanded and it's possible the paths come from different blend files.
2022-01-28Cleanup: rename BLI_paths_equal to BLI_path_cmp_normalizedCampbell Barton
Changes to recent addition: c85c52f2ce478ab0e30c5e93fd5a5cb812db232f. Having both BLI_paths_equal and BLI_path_cmp made it ambiguous which should be used, as `BLI_paths_equal` wasn't the equivalent to `BLI_path_cmp(..) == 0` as it is for string equals macro `STREQ(..)`. It's also a more specialized function which is not used for path comparison throughout Blender's internal path handling logic. Instead rename this `BLI_path_cmp_normalized` and return the result of `BLI_path_cmp` to make it clear paths are modified before comparison. Also add comments about the conventions for Blender's path comparison as well as a possible equivalent to Python's `os.path.samefile` for checking if two paths point to the same location on the file-system.
2022-01-27USD Preview Surface material export.Michael Kowalski
Add `USD Preview Surface From Nodes` export option, to convert a Principled BSDF material node network to an approximate USD Preview Surface shader representation. If this option is disabled, the original material export behavior is maintained, where viewport setting are saved to the Preview Surface shader. Also added the following options for texture export. - `Export Textures`: If converting Preview Surface, export textures referenced by shader nodes to a 'textures' directory which is a sibling of the USD file. - `Overwrite Textures`: Allow overwriting existing texture files when exporting textures (this option is off by default). - `Relative Texture Paths`: Make texture asset paths relative to the USD. The entry point for the new functionality is `create_usd_preview_surface_material()`, called from `USDAbstractWriter::ensure_usd_material()`. The material conversion currently handles a small subset of Blender shading nodes, `BSDF_DIFFUSE`, `BSDF_PRINCIPLED`, `TEX_IMAGE` and `UVMAP`. Texture export is handled by copying texture files from their original location to a `textures` folder in the same directory as the USD. In-memory and packed textures are saved directly to the textures folder. This patch is based, in part, on code in Tangent Animation's USD exporter branch. Reviewed By: sybren, HooglyBoogly Differential Revision: https://developer.blender.org/D13647
2022-01-24Cleanup: spelling in commentsCampbell Barton
2022-01-06Cleanup: spelling in commentsCampbell Barton
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-16Docs: add doc-strings for BLI_path functionsCampbell Barton
2021-12-16Fix compile error on Windows.Thomas Dinges
2021-12-16WM: various changes to file writing behaviorCampbell Barton
Saving with only a filename (from Python) wasn't being prevented, while it would successfully write the file to the working-directory, path remapping and setting relative paths wouldn't work afterwards as `Main.filepath` would have no directory component. Disallow this since it's a corner case which only ever occurs when path names without any directories are used from Python, the overhead of expanding the working-directory for all data saving operations isn't worthwhile. The following changes have been made: - bpy.ops.wm.save_mainfile() without a filepath argument fails & reports and error when the file hasn't been saved. Previously it would write to "untitled.blend" and set the `G.main->filepath` to this as well. - bpy.ops.wm.save_mainfile(filepath="untitled.blend") fails & reports and error as the filename has no directory component. - `BLI_path_is_abs_from_cwd` was added to check if the path would attempt to expand to the CWD.
2021-12-09Cleanup: move public doc-strings into headers for 'blenlib'Campbell Barton
- Added space below non doc-string comments to make it clear these aren't comments for the symbols directly below them. - Use doxy sections for some headers. - Minor improvements to doc-strings. Ref T92709
2021-11-01BLI_path_util: assert to ensure BLI_join_dirfile is used correctlyCampbell Barton
2021-10-04Cleanup: use system includesCampbell Barton
2021-09-29Cleanup: spelling in commentsCampbell Barton
2021-09-28Path util: BLI_path_contains() case-insensitive on WindowsSybren A. Stüvel
Make `BLI_path_contains()` case-insensitive on Windows. This behaviour is dependent on the platform Blender is running on, like the rest of BLI_path, and not on the style of paths (Windows-style paths will be treated case-sensitively when Blender is running on Linux/macOS).
2021-09-27BLI Path: add function `BLI_path_contains()`Sybren A. Stüvel
Add function `BLI_path_contains(container, containee)` that returns true if and only `container` contains `containee`. Paths are normalised and converted to native path separators before comparing. Relative paths are *not* made absolute, to simplify the function call; if this is necessary the caller has to do this conversion first.
2021-08-04Cleanup: use C comments for descriptive textCampbell Barton
2021-08-03Cleanup: use C++ comments or 'if 0' for commented codeCampbell Barton
2021-07-13Cleanup: Use correct _WIN32/64 defines for MSVCJesse Yurkovich
Docs: https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros Differential Revision: https://developer.blender.org/D11460
2021-07-07Cleanup: spelling in commentsCampbell Barton
2021-07-03Cleanup: consistent use of tags: NOTE/TODO/FIXME/XXXCampbell Barton
Also use doxy style function reference `#` prefix chars when referencing identifiers.
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-10Cleanup: BLI_path_slash_native: use separator defines instead of literal values.Bastien Montagne
Even though this function is alredy using system-specific code, it's still cleaner to use `SEP` and `ALTSEP` here.
2021-04-01Cleanup: spellingCampbell Barton