Age | Commit message (Collapse) | Author |
|
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
|
|
The HIG mentions that redundant words like "Enables" or "Activates"
shouldn't be used for tooltips of boolean properties. In this case
"When checked" was the redundant language that was implied by
the checkbox itself-- convention is to just state what the property
does when it's on.
Also change a few conjugations to the imperative and simplify
wording slightly, in order to be more consistent with language
elsewhere in Blender, and to be a bit more direct.
Differential Revision: https://developer.blender.org/D14644
|
|
|
|
color attribute system.
This commit removes sculpt colors from experimental
status and unifies it with vertex colors. It
introduces the concept of "color attributes", which
are any attributes that represents colors. Color
attributes can be represented with byte or floating-point
numbers and can be stored in either vertices or
face corners.
Color attributes share a common namespace
(so you can no longer have a floating-point
sculpt color attribute and a byte vertex color
attribute with the same name).
Note: this commit does not include vertex paint mode,
which is a separate patch, see:
https://developer.blender.org/D14179
Differential Revision: https://developer.blender.org/D12587
Ref D12587
|
|
This takes state of soc-2020-io-performance branch as it was at
e9bbfd0c8c7 (2021 Oct 31), merges latest master (2022 Apr 4),
adds a bunch of tests, and fixes a bunch of stuff found by said
tests. The fixes are detailed in the differential.
Timings on my machine (Windows, VS2022 release build, AMD Ryzen
5950X 32 threads):
- Rungholt minecraft level (269MB file, 1 mesh): 54.2s -> 14.2s
(memory usage: 7.0GB -> 1.9GB).
- Blender 3.0 splash scene: "I waited for 90 minutes and gave up"
-> 109s. Now, this time is not great, but at least 20% of the
time is spent assigning unique names for the imported objects
(the scene has 24 thousand objects). This is not specific to obj
importer, but rather a general issue across blender overall.
Test suite file updates done in Subversion tests repository.
Reviewed By: @howardt, @sybren
Differential Revision: https://developer.blender.org/D13958
|
|
Exporting USD cannot be undone, but importing should be undo'able.
|
|
This is patch D14349 from Aras Pranckevicius.
The logic in the code was _completely different_ from the documentation
and what the python exporter in 3.0 did. The new code assumed that
"export material groups" meant "append material name to the object name",
and was only ever kicking in when the "export object groups" option was
also checked. But the proper behavior (as in 3.0 exporter & the online docs),
is to emit g objectname_materialname before each usemtl line. Which is something entirely else.
|
|
Only formatting changes found by running "make format", no functional
changes
Committed without review, but with verbal approval by Hans Goudey
|
|
Mainly -Wset-but-unused-variable.
Makes default compilation on macOS way less noisy.
Differential Revision: https://developer.blender.org/D14357
|
|
This patch, D14303, from Aras Pranckevicius adds presets to the OBJ exporter,
and also adds a checkbox (default on) to apply modifiers before export.
|
|
This adds maintence overhead and it is not that useful when we have reset to default.
If this is something that we want it should be added dynamically.
Reviewed By: HooglyBoogly, Severin, #user_interface
Differential Revision: https://developer.blender.org/D14151
|
|
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
|
|
Previously, macros were ifdefed using the cmake option `WITH_INTERNATIONAL`
However, the is unnecessary as withen the functions themselves have checks for building without internationalization.
This also means that many `add_definitions(-DWITH_INTERNATIONAL)` are also unnecessary.
Reviewed By: mont29, LazyDodo
Differential Revision: https://developer.blender.org/D13929
|
|
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
|
|
Override layers are a standard feature of Alembic, where archives can override
data from other archives, provided that the hierarchies match.
This is useful for modifying a UV map, updating an animation, or even creating
some sort of LOD system where low resolution meshes are swapped by high resolution
versions.
It is possible to add UV maps and vertex colors using this system, however, they
will only appear in the spreadsheet editor when viewing evaluated data, as the UV
map and Vertex color UI only show data present on the original mesh.
Implementation wise, this adds a `CacheFileLayer` data structure to the `CacheFile`
DNA, as well as some operators and UI to present and manage the layers. For both
the Alembic importer and the Cycles procedural, the main change is creating an
archive from a list of filepaths, instead of a single one.
After importing the base file through the regular import operator, layers can be added
to or removed from the `CacheFile` via the UI list under the `Override Layers` panel
located in the Mesh Sequence Cache modifier. Layers can also be moved around or
hidden.
See differential page for tests files and demos.
Reviewed by: brecht, sybren
Differential Revision: https://developer.blender.org/D13603
|
|
|
|
|
|
SRC was being assigned invalid values then overwritten.
|
|
|
|
|
|
This was originally written by Ankit Meel as a GSoC 2020 project.
Howard Trickey added some tests and made some corrections/modifications.
See D13046 for more details.
This commit inserts a new menu item into the export menu called
"Wavefront OBJ (.obj) - New".
For now the old Python exporter remains in the menu, along with
the Python importer, but we plan to remove it soon (leaving the
old addon bundled with Blender but not enabled by default).
|
|
This new mode export all frames of the scene.
Reviewed By: pepeland
Differential Revision: https://developer.blender.org/D13055
|
|
|
|
The current behavior of the Alembic importer is to only create a
`MeshSequenceCache` modifier or a `Transform Cache` constraint to imported
objects if they have some animated properties.
Since static objects do not have a cache reader, when reloading files those
objects are not updated. Currently, the only way to properly reload a file
because of this is to reimport it.
This adds an option to the importer to always add a cache reader, even if
there is no animated data, to ensure that all objects coming from Alembic
archive are linked to them and updated properly upon reloads.
Reviewed by: brecht, sybren
Ref D10197.
|
|
This is an initial implementation of a USD importer.
This work is comprised of Tangent Animation's open source USD importer,
combined with features @makowalski had implemented.
The design is very similar to the approach taken in the Alembic
importer. The core functionality resides in a collection of "reader"
classes, each of which is responsible for converting an instance of a
USD prim to the corresponding Blender Object representation.
The flow of control for the conversion can be followed in the
`import_startjob()` and `import_endjob()` functions in `usd_capi.cc`.
The `USDStageReader` class is responsible for traversing the USD stage
and instantiating the appropriate readers.
Reviewed By: sybren, HooglyBoogly
Differential Revision: https://developer.blender.org/D10700
|
|
|
|
|
|
This option will determine visibility on either render or the viewport
visibility. Same for modifer settings. So it will either evaluate the
depsgrah with DAG_EVAL_RENDER or DAG_EVAL_VIEWPORT.
This not only makes it more flexible, it is also a lot
clearer which visibility / modfier setting is taken into account (up
until now, this was always considered to be DAG_EVAL_RENDER)
This option was always present in the USD exporter, this just brings
Alembic in line with that.
ref. T89594
Maniphest Tasks: T89594
Differential Revision: https://developer.blender.org/D11820
|
|
When introduced in {rB61050f75b13e} this was actually working (meaning
it checked the Outliner OB_RESTRICT_RENDER flag and skipped the object if
desired).
Behavior has since then been commented in rBae6e9401abb7 and apparently
refactored out in rB2917df21adc8.
If checked, it seemed to be working (objects marked non-renderable in
the Outliner were pruned from the export), however unchecking that
option did not include them in the export.
Now it changed - for the worse if you like - in rBa95f86359673 which
made it so if "Renderable Objects" only is checked, it will still export
objects invisible in renders. So since we now have the non-functional
option with a broken/misleading default, it is better to just remove it
entirely.
In fact it has been superseeded by the "Visible Objects" option (this
does the same thing: depsgraph is evaluated in render mode) and as a
second step (and to make this even clearer) a choice whether
Render or Viewport evaluation is used can be added (just like the USD
exporter has). When that choice is explicit, it's also clear which
visibility actually matters.
This is breaking API usage, should be in release notes.
ref. T89594
Maniphest Tasks: T89594
Differential Revision: https://developer.blender.org/D11808
|
|
Read and write generated coordinates (also known as "original
coordinates", "reference coordinates", or "orcos") from and to Alembic.
A custom geometry property named "Pref" is used for (hopefully)
interoperability with Maya and Houdini. For now it's only guaranteed for
Blender-to-Blender.
Export: writing generated coordinates is optional (on by default).
Import: generated coordinates are always read whenever the reading of
vertex data is enabled.
Manifest Task: T88081
|
|
Draw functions used RNA_pointer_create to create the pointer,
however this already exists in the operator.
|
|
Any dynamic enum access would not use the callback.
Always set the owner_id to avoid this causing problems.
Oversight in 919558854d624f5db40acfa9f5674ac8c94873b6
|
|
|
|
|
|
The function only must be included if Haru or Pugixml is enabled.
|
|
Due a code cleanup it was using .PDF all times.
|
|
This patch adds support to export and import grease pencil in several formats.
Inlude:
* Export SVG
* Export PDF (always from camera view)
* Import SVG
The import and export only support solid colors and not gradients or textures.
Requires libharu and pugixml.
For importing SVG, the NanoSVG lib is used, but this does not require installation (just a .h file embedded in the project folder)
Example of PDF export: https://youtu.be/BMm0KeMJsI4
Reviewed By: #grease_pencil, HooglyBoogly
Maniphest Tasks: T83190, T79875, T83191, T83192
Differential Revision: https://developer.blender.org/D10482
|
|
This was reported as opening alembic caches ignoring the
'use_relative_paths' preference, but this operator just did not have
this setting. Fortunately, adding this is just a simple switch.
Maniphest Tasks: T86063
Differential Revision: https://developer.blender.org/D10568
|
|
Pass `FILE_OPENFILE` instead of `FILE_SAVE` when selecting a file for
reading.
|
|
Remove redundant headers using
`./source/tools/utils_maintenance/code_clean.py`
Reviewed By: jmonteath
Ref D10364
|
|
This was reported for the Triangulate geometry node, but was also true
for the triangulate modifier and in exporters.
Note the modifier was introduced with "Ngon Method" in rBa7b44c82e5b9 but
was renamed to "Polygon Method" in rBf4762eb12ba5.
Since quads are also polygons (and quads have their own method), the
term "N-gon" is more appropriate here and is also described in the
glossary https://docs.blender.org/manual/en/2.92/glossary/
index.html#term-N-gon
Docs have been updated in rBM7539 (partially - the method would also
have to be renamed once this patch lands).
Note this also fixes the wrong enum used for the alembic exporter.
Fixes T83907
Maniphest Tasks: T83907
Differential Revision: https://developer.blender.org/D10022
|
|
Approximately 138 changes in the spelling of compound words
and proper names like "Light Probe", "Shrink/Fatten", "Face Map".
In many cases, hyphens were used where they aren't correct, like
"re-fit". Other common changes include:
- "Datablock" -> "data-block"
- "Floating point" -> "floating-point"
- "Ngons" -> "n-gons"
These changes help give the language used in the interface
a consistent, more professional feel.
Differential Revision: https://developer.blender.org/D9923
|
|
Approximately 195 changes of capitalization to conform to MLA title style.
UI labels and property names should use MLA title case, while descriptions
should be capitalized like regular prose, generally with only the start of
a sentence capitalized.
Differential Revision: https://developer.blender.org/D9922
|
|
`WM_operator_properties_filesel()` allows C operators to set a display or sort
type for the File Browser to use. But the File Browser would always override
that because of an invalid `_is_set()` check. (The operators don't actually set
the value, they only set the property's default value.)
The only operator affected by this is "Recover Auto Save". It is supposed to
show a vertical list ordered chronologically. It used settings from the
previous File Browser usage before this patch.
Operators using the File Browser should generally use
`FILE_DEFAULTDISPLAY`/`FILE_SORT_DEFAULT` now, except if they have a reason not
to. See comments at their definition.
----
This makes it so operators that set a different display or sort type
don't change the sort or display type for the next File Browser operation.
So using "Recover Auto Save" entirely isolates display and sort type from other
operations.
Differential Revision: https://developer.blender.org/D8598
Reviewed by: Bastien Montagne
|
|
Follow our code style guide by using C-comments for text descriptions.
|
|
Write custom properties (aka ID properties) to Alembic, to the
`.userProperties` compound property.
Manifest Task: https://developer.blender.org/T50725
Scalar properties (so single-value/non-array properties) are written as
single-element array properties to Alembic. This is also what's done by
Houdini and Maya exporters, so it seems to be the standard way of doing
things. It also simplifies the implementation.
Two-dimensional arrays are flattened by concatenating all the numbers
into a single array. This is because ID properties have a limited type
system. This means that a 3x3 "matrix" could just as well be a list of
three 3D vectors.
Alembic has two container properties to store custom data:
- `.userProperties`, which is meant for properties that aren't
necessarily understood by other software packages, and
- `.arbGeomParams`, which can contain the same kind of data as
`.userProperties`, but can also specify that these vary per face of a
mesh. This property is mostly intended for renderers.
Most industry packages write their custom data to `.arbGeomParams`.
However, given their goals I feel that `.userProperties` is the more
appropriate one for Blender's ID Properties.
The code is a bit more involved than I would have liked. An
`ABCAbstractWriter` has a `uniqueptr` to its `CustomPropertiesExporter`,
but the `CustomPropertiesExporter` also has a pointer back to its owning
`ABCAbstractWriter`. It's the latter pointer that I'm not too happy
with, but it has a reason. Getting the aforementioned `.userProperties`
from the Alembic library will automatically create it if it doesn't
exist already. If it's not used to actually add custom properties to, it
will crash the Alembic CLI tools (and maybe others too). This is what
the pointer back to the `ABCAbstractWriter` is used for: to get the
`.userProperties` at the last moment, when it's 100% sure at least one
custom property will be written.
Differential Revision: https://developer.blender.org/D8869
Reviewed by: sergey, dbystedt
|
|
Add support for object data instancing. This is used when the objects
are instances, for example when duplicated by a particle system, or
instanced by the duplication system (collection-duplicating empties,
vertex/face duplis, etc.)
Since Alembic already deduplicates data, this doesn't make the resulting
Alembic files any smaller. They will be faster to write, though, when
there is a lot of instanced geometry, as the deduplication system won't
have to do any comparisons.
This instancing support is still limited, in the sense that only object
data is instanced and all transforms are still written explicitly. A
future improvement could be to support instancing entire collection
hierarchies.
Blender's Alembic importer has no understanding of these Alembic
instances yet, and will thus happily duplicate the data on import.
The USD Alembic plugin seems to have problems understanding the
instancing. There might also be other software with similar issues.
Because of this, instancing can be turned off in the exporter (it's on
by default).
|
|
Use `FILE_OPENFILE` when importing, rather than `FILE_SAVE`.
Reviewed By: sybren
Differential Revision: https://developer.blender.org/D8715
|
|
The fix for T75936 made it possible to export invisible objects to
Alembic. This commit applies the same approach to the USD exporter.
The USD and Alembic code is slightly different in terms of where in the
exported file the visibility attribute is stored. In USD the visibility
is used to prune the scene graph, and thus there are only two options:
"hidden" and "inherited". Setting the visiblity of a node in the scene
graph to "hidden" immediately hides all its children. To allow hidden
parents with visible children, the visibility is stored on the object
data (so the geometry/camera/lamp/etc) instead.
|
|
This replaces header include guards with `#pragma once`.
A couple of include guards are not removed yet (e.g. `__RNA_TYPES_H__`),
because they are used in other places.
This patch has been generated by P1561 followed by `make format`.
Differential Revision: https://developer.blender.org/D8466
|