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-05-17Cleanup: use term 'filepath' for full file pathsCampbell Barton
2022-05-16Fix std::optional value() build error on older macOS SDKBrecht Van Lommel
No longer happens on the buildbot, but for users building with an older Xcode, still need to avoid using value(). Differential Revision: https://developer.blender.org/D14883
2022-05-14Fix: Build error due to previous commitHans Goudey
2022-05-14Cleanup: Further use of const for retrieved custom data layersHans Goudey
Similar to cf69652618fefcd22b2cde9a2.
2022-05-13Cleanup: Use const when retrieving custom data layersHans Goudey
Knowing when layers are retrieved for write access will be essential when adding proper copy-on-write support. This commit makes that clearer by adding `const` where the retrieved data is not modified. Ref T95842
2022-05-13Cleanup: spelling in comments, capitalize tagsCampbell Barton
Also add missing task-ID reference & remove colon after \note as it doesn't render properly in doxygen.
2022-05-12OBJ: improve new importer file parsing performance on windowsAras Pranckevicius
The OBJ parser was primarily using StringRef for convenience, with functions like "skip whitespace" or "parse a number" taking an input stringref, representing an input line, and returning a new stringref, representing the remainder of the line. This is convenient, but does more work than strictly needed -- while parsing, only the "beginning" of the line ever changes by moving forward; the end of the line always stays the same. We can change the code to take a pair of pointers (begin of line, end of line) as input, and make the functions return the new begin of line pointer. This makes the return value neatly fit into a processor register, which StringRef did not. On Windows, this does result in non-trivial speedups in the actual OBJ file parsing part, due to Windows calling convention where return values larger than 64 bits are returned via memory. Does not measurably affect performance on Mac/Linux, because the calling convention there uses a pair of 64-bit registers to return a StringRef. End-to-end times of importing several test files, on Windows (VS2022 build, Ryzen 5950X): - Monkey subdivided to level 6, no normals (220MB file): 1.25s -> 0.85s - Rungholt minecraft level (270MB file): 7.0s -> 5.8s - Blender 3 splash scene (2.4GB file): 49.1s -> 45.5s The full import process has a lot of other overhead besides actual OBJ file parsing (mostly creating actual blender objects out of parsed data). In pure parsing, in the monkey test scene above, the parsing part goes 1.0s -> 0.6s. Reviewed By: Howard Trickey Differential Revision: https://developer.blender.org/D14936
2022-05-12Merge branch 'blender-v3.2-release'Campbell Barton
2022-05-11Cleanup: fix compiler warnings on macOSLoren Osborn
Differential Revision: https://developer.blender.org/D14917
2022-05-11Cleanup: formatCampbell Barton
2022-05-10Merge branch 'blender-v3.2-release'Aras Pranckevicius
2022-05-10Fix T96399: New 3.1 OBJ exporter is missing Path Mode settingAras Pranckevicius
New OBJ exporter is missing "Path Mode" setting for exporting .mtl files. The options that used to be available were: Auto, Absolute, Relative, Match, Strip Path, Copy. All of them are important. The new behavior (without any UI option to control it) curiously does not match any of the previous setting. New behavior is like "Relative, but to the source blender file, and not the destination export file". Most of the previous logic was only present in Python based code (bpy_extras.io_utils.path_reference and friends). The bulk of this commit is porting that to C++. Reviewed By: Howard Trickey Differential Revision: https://developer.blender.org/D14906
2022-05-06obj: move parsing utilities out of io_common, since they are fairly obj specificAras Pranckevicius
As pointed out in https://developer.blender.org/rB213cd39b6db387bd88f12589fd50ff0e6563cf56#341113, the utilities are quite OBJ specific due to treating backslash as a line continuation character. It's unlikely that other formats need that. No functionality changes, just pure code move (and renamed tests so that their names reflect obj). Reviewed By: Campbell Barton Differential Revision: https://developer.blender.org/D14871
2022-05-06USD: add volume/VDB exportPiotr Makal
Add support for volume (OpenVDB) USD export: - Allows to export both static and animated volumes. - Supports volumes that have OpenVDB data from files or are generated in Blender with 'Mesh to Volume' modifier. - For volumes that have generated data in Blender it also exports corresponding .vdb files. Those files are saved in a new folder named "volumes". - Slightly changes the USD export UI panel. "Relative Texture Paths" becomes "Relative Paths" (and has separate UI box) as the functionality will now apply to both textures and volumes. Disabling of this option due to "Materials" checkbox being turned off has been removed. Reviewed By: sybren, makowalski Differential Revision: https://developer.blender.org/D14193 Manifest Task: T95407
2022-05-05Merge branch 'blender-v3.2-release'Aras Pranckevicius
2022-05-05Fix T97863: new OBJ importer issues with extra whitespace after "f" keywordsAras Pranckevicius
While possible extra whitespace after all OBJ/MTL keywords was properly skipped, it was not done for the "f" (face definition) keyword. While at it, also support indented keywords, i.e. extra whitespace at the beginning of the line. There's a tiny bit of performance drop while importing (e.g. importing blender 3.0 splash scene: 53.38sec -> 54.21sec on my machine). But correctness is more important. Reviewed By: Howard Trickey Differential Revision: https://developer.blender.org/D14854
2022-05-05Cleanup: sort cmake file listsCampbell Barton
2022-05-04Merge branch 'blender-v3.2-release'Aras Pranckevicius
2022-05-04Fix T97794: new OBJ importer does not handle quoted MTL pathsAras Pranckevicius
Fixes T97794 (which is a reintroduction of an older issue T67266 that has been fixed in the python importer, but the fix was not in the C++ one). Some software produces OBJ files with mtllib statements like mtllib "file name in quotes.mtl", and the new importer was not stripping the quotes away. While at it, I noticed that MTLParser constructor was taking a StringRef and treating it as a zero-terminated string, which is not necessarily the case. Fixed that by explicitly using a StringRefNull type. Reviewed By: Howard Trickey Differential Revision: https://developer.blender.org/D14838
2022-05-03Merge branch 'blender-v3.2-release'Aras Pranckevicius
2022-05-03Fix T97793, Fix T97795: Use correct defaults for missing values in new OBJ ↵Aras Pranckevicius
importer - Fix T97793: when a UV coordinate after vt is missing, use zero. While at it, also use zeroes for positions & normals, since "maximum possible float" is very likely to cause issues in imported meshes. - Fix T97795: use 1.0 default if -bm value is missing, instead of zero. Reviewed By: Howard Trickey Differential Revision: https://developer.blender.org/D14826
2022-05-03Fix T97757: Some MTL import correctness issues in the new OBJ importerAras Pranckevicius
Fix several correctness issues where the new OBJ/MTL importer was not producing the same results as the old one, mostly because the code for some reason had slightly different logic. Fixes T97757: - When .obj file tries to use a material that does not exist, the code was continuing to use the previous material, instead of creating new default one, as the previous importer did. - Previous importer was always searching/parsing "foo.mtl" for a "foo.obj" file, even if the file itself does not contain "mtllib foo.mtl" statement. One file from T97757 repros happens to depend on that, so resurrect that behavior. - When IOR (Ni) or Alpha (d) are not specified in .mtl file, do not wrongly set -1 values to the blender material. - When base (Kd) or emissive (Ke) colors are not specified in the .mtl file, do not set them on the blender material. - Roughness and metallic values used by viewport shading were not set onto blender material. - The logic for when metallic was set to zero was incorrect; it should be set to zero when "not using reflection", not when "mtl file does not contain metallic". - Do not produce a warning when illum value is not spelled out in .mtl file, treat as default (1). - Parse illum as a float just like python importer does, as to not reintroduce part of T60135. Reviewed By: Howard Trickey Differential Revision: https://developer.blender.org/D14822
2022-05-03Cleanup: spelling in commentsCampbell Barton
2022-05-01Fix T97644: new 3.2 obj importer does not set blend mode for eeveeAras Pranckevicius
The old python importer had a "if do_transparency, set blend_method to BLEND" type of logic. This bit was missing in the new importer; it was only setting the eevee blend method when a transparency texture was present, but not in other cases of transparency (as driven by MTL "illum" mode). Reviewd By: Howard Trickey Differential Revision: https://developer.blender.org/D14783
2022-05-01Fix T97417: OBJ: support tab and other whitespace characters after obj/mtl ↵Aras Pranckevicius
keywords Even if available OBJ/MTL format documentations don't explicitly specify which characters can possibly separate keywords & arguments, turns out some files out there in the wild use TAB character after the line keywords. Which is something the new 3.2 importer was not quite expecting (T97417). Fix this by factoring out a utility function that checks if line starts with a keyword followed by any whitespace, and using that across the importer. Also fix some other "possible whitespace around name-like parts" of obj/mtl parser as pointed out by the repro files in T97417. Reviewed By: Howard Trickey Differential Revision: https://developer.blender.org/D14782
2022-04-29Cleanup: missing declaration warnings & spelling in commentsCampbell Barton
2022-04-28Cleanup: Improve const correctness of shape key functionsHans Goudey
2022-04-22Cleanup: spelling in commentsCampbell Barton
2022-04-20Cleanup: Rename CD_MLOOPCOL to CD_PROP_BYTE_COLORHans Goudey
The "PROP" in the name reflects its generic status, and removing "LOOP" makes sense because it is no longer associated with just mesh face corners. In general the goal is to remove extra semantic meaning from the custom data types.
2022-04-20Cleanup: spelling in commentsCampbell Barton
2022-04-20Mesh: Avoid unnecessary normal calculation and dirty tagsHans Goudey
This is mostly a cleanup to avoid hardcoding the eager calculation of normals it isn't necessary, by reducing calls to `BKE_mesh_calc_normals` and by removing calls to `BKE_mesh_normals_tag_dirty` when the mesh is newly created and already has dirty normals anyway. This reduces boilerplate code and makes the "dirty by default" state more clear. Any regressions from this commit should be easy to fix, though the lazy calculation is solid enough that none are expected.
2022-04-19Cleanup: Use correct capitalization of "F-Curve"Aaron Carlisle
2022-04-18Cleanup: Clang tidyHans Goudey
- Inconsistent parameter names - Else after return - Braces around statements - Qualified auto - Also (not clang tidy): Pass StringRef by value, unused parameter
2022-04-17OBJ: further optimize, cleanup and harden the new C++ importerAras Pranckevicius
Continued improvements to the new C++ based OBJ importer. Performance: about 2x faster. - Rungholt.obj (several meshes, 263MB file): Windows 12.7s -> 5.9s, Mac 7.7s -> 3.1s. - Blender 3.0 splash (24k meshes, 2.4GB file): Windows 97.3s -> 53.6s, Mac 137.3s -> 80.0s. - "Windows" is VS2022, AMD Ryzen 5950X (32 threads), "Mac" is Xcode/clang 13, M1Max (10 threads). - Slightly reduced memory usage during import as well. The performance gains are a combination of several things: - Replacing `std::stof` / `std::stoi` with C++17 `from_chars`. - Stop reading input file char-by-char using `std::getline`, and instead read in 64kb chunks, and parse from there (taking care of possibly handling lines split mid-way due to chunk boundaries). - Removing abstractions for splitting a line by some char, - Avoid tiny memory allocations: instead of storing a vector of polygon corners in each face, store all the corners in one big array, and per-face only store indices "where do corners start, and how many". Likewise, don't store full string names of material/group names for each face; only store indices into overall material/group names arrays. - Stop always doing mesh validation, which is slow. Do it just like the Alembic importer does: only do validation if found some invalid faces during import, or if requested by the user via an import setting checkbox (which defaults to off). - Stop doing "collection sync" for each object being added; instead do the collection sync right after creating all the objects. Cleanup / Robustness: This reworking of parser (see "removing abstractions" point above) means that all the functions that were in `parser_string_utils` file are gone, and replaced with different set of functions. However they are not OBJ specific, so as pointed out during review of the previous differential, they are now in `source/blender/io/common` library. Added gtest coverage for said functions as well; something that was only indirectly covered by obj tests previously. Rework of some bits of parsing made the parser actually better able to deal with invalid syntax. E.g. previously, if a face corner were a `/123` string, it would have incorrectly treated that as a vertex index (since it would get "hey that's one number" after splitting a string by a slash), instead of properly marking it as invalid syntax. Added gtest coverage for .mtl parsing; something that was not covered by any tests at all previously. Reviewed By: Howard Trickey Differential Revision: https://developer.blender.org/D14586
2022-04-17Fix T97095: export of Poly curves, export crash when object contains ↵Aras Pranckevicius
multiple curve types - Was not exporting "Poly" curves at all, - Had a crash when a single object contains multiple curves of different types -- it had a check for "is this nurbs compatible?" only for the first curve, and then proceeded to treat the other curves as nurbs as well, without checking for validity. Fixed both issues by doing the same logic as in the old python exporter: - Poly curves are supported, - Treat object as "nurbs compatible" only if all the curves within it are nurbs compatible. Added test coverage in the gtest suite. While at it, made "all_curves" test use the "golden obj file template" style test, instead of a manually coded test that checks intermediate objects but does not check the final exported result. Reviewed By: Howard Trickey Differential Revision: https://developer.blender.org/D14611
2022-04-17Fix T96824: New 3.1 OBJ exporter writes incorrect polygon/vertex groups in ↵Aras Pranckevicius
some cases The new 3.1 OBJ exporter code had incorrect code to determine which vertex group a polygon belongs to -- for each vertex, it was only looking at the first vertex group it has, and not using the group weight either. This 99% fixes T96824, but not 100% on the user's submitted mesh -- exactly two faces from that mesh get assigned a different group compared to the old exporter. Either choice is "correct" given that on these two faces there are two vertex groups with equal contribution. The old Python exporter was picking the group based on internal python group name map order, whereas the new C++ exporter is picking the group with the lowest index, in case of ties. I'm not sure if it's possible to fix this TBH, will have to wait until the importer is also C++. While at it, the new vertex group calculation code was doing a lot of redundant work for each and every face (traversing group lists several times, allocating & freeing memory), so I fixed that. Exporting a 6-level subdivided Monkey mesh with 30 vertex groups was taking 810ms, now takes 330ms. Reviewed By: Howard Trickey Differential Revision: https://developer.blender.org/D14500
2022-04-17USD/Ctest: Add basic USD-Imaging test.Michael Kowalski
This adds a basic unit test to check USD has been correctly build with imaging components to support building both with the old and new libs, it automatically adds the test when it detects a library with imaging enabled. (platform devs will have to pay attention it runs the test to validate the libs build correctly) For future use in the code it also defines a USD_HAS_IMAGING define one could check if we're building against an USD lib that has it (just because we build/ship with it, doesn't mean downstream builds will ship with it, so we'll have to be a little pro-active there) Reviewed By: sybren Differential Revision:https://developer.blender.org/D14456
2022-04-14Cleanup: Alembic, use a structure to pass parametersKévin Dietrich
This adds a structure, `ABCReadParams`, to store some parameters passed to `ABC_read_mesh` so we avoid passing too many parameters, and makes it easier to add more parameters in the future without worrying about argument order. Differential Revision: https://developer.blender.org/D14484
2022-04-11Cleanup: malformed C-style comment blocks, spellingCampbell Barton
- Missing star prefix. - Unnecessary indentation. - Blank line after dot-points (otherwise doxygen merges with the previous dot-point). - Use back-slash for doxygen commands. - Correct spelling.
2022-04-08Cleanup: quiet a couple more compilation warnings on MSVCKévin Dietrich
2022-04-08Alembic: fix clamping of frame offset during exportsKévin Dietrich
The `frame_offset` used for creating `TimeSamplings` when exporting was being clamped, which would make subframe sampling potentially fail, or get out of sync.
2022-04-08Cleanup: CacheFile, use double precision for timeKévin Dietrich
Both the Alembic and USD libraries use double precision floating point numbers internally to store time. However the Alembic I/O code defaulted to floats even though Blender's Scene FPS, which is generally used for look ups, is stored using a double type. Such downcasts could lead to imprecise lookups, and would cause compilation warnings (at least on MSVC). This modifies the Alembic exporter and importer to make use of doubles for the current scene time, and only downcasting to float at the very last steps (e.g. for vertex interpolation). For the importer, doubles are also used for computing interpolation weights, as it is based on a time offset. Although the USD code already used doubles internally, floats were used at the C API level. Those were replaced as well. Differential Revision: https://developer.blender.org/D13855
2022-04-08I/O tests: change all_geometry scene to not have subd surface, and always ↵Aras Pranckevicius
print obj failure output diff details The all_objects.blend test scene (in subversion tests repo) contained an object with a subdivision surface. Which changes vertex positions slightly, depending on used OpenSubDiv version and the compile flags. It seems that the intent of the test was "test export of meshes that use modifiers", so I changed that object to be a cube with a simple "taper" modifier instead. While at it, changed OBJ exporter test code to always print the "expected and what we got" text difference details, when a test fails. Much easier to see than just "the files are different" output. The code to print that was behind an off by default flag for some reason. This diff should get comitted together with updated all_objects templates in subversion tests repo. Reviewed By: Sebastian Parborg Differential Revision: https://developer.blender.org/D14597
2022-04-07Cleanup: spelling in comments, minor reformatting changesCampbell Barton
2022-04-06Cleanup: spelling & poor wording in code & commentsCampbell Barton
2022-04-05Refactor: Evaluate surface objects as mesh componentsHans Goudey
This commit furthers some of the changes that were started in rBb9febb54a492 and subsequent commits by changing the way surface objects are presented to render engines and other users of evaluated objects in the same way. Instead of presenting evaluated surface objects as an `OB_SURF` object with an evaluated mesh, `OB_SURF` objects can now have an evaluated geometry set, which uses the same system as other object types to deal with multi-type evaluated data. This clarification makes it more obvious that lots of code that dealt with the `DispList` type isn't used. It wasn't before either, now it's just *by design*. Over 1100 lines can be removed. The legacy curve draw cache code is much simpler now too. The idea behind the further removal of `DispList` is that it's better to focus optimization efforts on a single mesh data structure. One expected functional change is that the evaluated mesh from surface objects can now be used in geometry nodes with the object info node. Cycles and the OBJ IO tests had to be tweaked to avoid using evaluated surface objects instead of the newly exposed mesh objects. Differential Revision: https://developer.blender.org/D14550
2022-04-05Cleanup: move doc-strings into headersCampbell Barton
- The comment for create_normals was moved into an inline note as it's not related to the public API. - Use a colon after parameters. Ref T92709
2022-04-05Cleanup: spelling in commentsCampbell Barton
2022-04-04OBJ: fix printf specifier compile warning on some compilersAras Pranckevicius
2022-04-04OBJ: fix mac/linux tests and compile warnings in the new obj importerAras Pranckevicius
Related to D13958