Age | Commit message (Collapse) | Author |
|
Modifier stack evaluation would copy mesh settings other than mesh topology
automatically, outside of the individual modifier evaluation. This leads to hard
to understand code, and makes it unclear which settings are available in following
modifiers, and which only after the entire stack is evaluated.
Now every modifier is responsible to ensure the mesh it outputs preserves materials,
texture space and other settings, or alters them as needed.
Fixes T64739: incorrect texture space for various modifiers
Differential Revision: https://developer.blender.org/D5808
|
|
|
|
Forward declare structs where possible.
|
|
This reduce memory usage by about 25% in object mode for multires meshes.
|
|
|
|
MTFace's on the mesh are now only used for conversion.
There is no need to keep both UV layers in sync at once.
|
|
Use consistent terminology.
|
|
This was used for versioning, now normals are calculated after
initializing MPoly data.
|
|
|
|
Currently supports mesh, armature, lattice, curve & metaballs.
Access from pivot popover.
|
|
This also splits vertex access and allocation so it's possible
to copy coordinates into an existing array without allocating it.
|
|
|
|
For clarity sake, the batch cache now uses exclusively per Loop attributes.
While this is a bit of a waste of VRAM (for the few case where per vert
attribs are enough) it reduces the complexity and amount of overall VBO
to update in general situations.
This patch also makes the VertexBuffers filling multithreaded. This make
the update of dense meshes a bit faster. The main bottleneck is the
IndexBuffers update which cannot be multithreaded efficiently (have to
increment a counter and/or do a final sorting pass).
We introduce the concept of "extract" functions/step.
All extract functions are executed in one thread each and if possible,
using multiple thread for looping over all elements.
Reviewed By: brecht
Differential Revision: http://developer.blender.org/D5424
|
|
Does not make sense in the use-cases of that function, especially since
we don't know whether it is actually due to an error, or some glitch
(like an empty curve).
Think we always want to get a mesh when using either operator
conversion, or the `bpy.data.meshes.new_from_object` function.
Note that an assert was also added to ensure we do try to convert from a
valid 'geometry' object type.
|
|
Reviewers: campbellbarton, brecht
Reviewed By: brecht
Subscribers: brecht
Differential Revision: https://developer.blender.org/D4991
|
|
This function makes it possible to clear/remove/nuke all the geometry in
a mesh, allowing functions like `Mesh.from_python()` to construct a new
mesh in its place. Without this function, code like in T67627 have to
allocate a new Mesh datablock, fill that, and swap out the old Mesh for
the new one. This introduces issues when exporting, as the new mesh
could be seen by an exporter as unrelated to the old one.
Shape keys are not freed by this function. Freeing those would require
tagging the depsgraph for relations update, which is an expensive
operation. They should be removed explicitly if necessary.
Material slots are also not cleared by this function, in the same way
that they are not cleared when manually removing all geometry from a
mesh.
The `BKE_mesh_clear_geometry()` function is available in Python as
`mesh.clear_geometry()`.
Reviewed by: mont29, brecht
Differential Revision: https://developer.blender.org/D5373
|
|
Mode crashes Blender.
Main issue in that report was that meshes generated from
`mesh_create_eval_final_view()` and the like need some
special freeing handling (as, among other things, they borrow and do not
own their potential editmesh data...).
Factorized that into a helper func also used by
`BKE_object_free_derived_caches()`.
|
|
This commit extends dependency graph API with an argument which
denotes that all custom data layers are to be preserved. This
forces modifier stack re-evaluation with more inclusive mask.
Far from ideal, since this might fail in certain configurations
with indirectly used objects which might be missing layers needed
for the current object evaluation. But this is how it worked for
a long time, so should be good enough for until more sophisticated
solution is found.
In order to use this new behavior two things are to be passed:
- Pass keep_all_data_layers=True
- Pass a valid dependency graph.
The dependency graph is only needed if keep_all_data_layers=True
and is NOT to be passed if keep_all_data_layers=False.
If keep_all_data_layers=True the dependency graph MUST be passed.
Reviewers: mont29, brecht
Reviewed By: mont29
Maniphest Tasks: T64994, T64794
Differential Revision: https://developer.blender.org/D4940
|
|
One of the usecases is to create mesh from an object is a manner similar to
how Apply Modifiers does it, and have it in the bmain so it can be referenced
by other objects.
This usecase is something what went unnoticed in the previous API changes, so
here is a followup.
Summary of changes:
* bpy.meshes.new_from_object() behaves almost the same as before this change.
The difference now is that it now ensures all referenced data-blocks are
original (for example, materials referenced by the mesh).
* object.to_mesh() now creates free-standing Mesh data-block which is outside
of any bmain. The object owns it, which guarantees the memory never leaks.
It is possible to force free memory by calling object.to_mesh_clear().
Reviewers: brecht
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D4875
|
|
Main goal here is to make it obvious and predictable about
what is going on.
Summary of changes.
- Access to dependency graph is now only possible to a fully evaluated
graph. This is now done via context.evaluated_depsgraph_get().
The call will ensure both relations and datablocks are updated.
This way we don't allow access to some known bad state of the graph,
and also making explicit that getting update dependency graph is not
cheap.
- Access to evaluated ID is now possible via id.evaluated_get().
It was already possible to get evaluated ID via dependency graph,
but that was a bit confusing why access to original is done via ID
and to evaluated via depsgraph.
If datablock is not covered by dependency graph it will be returned
as-is.
- Similarly, request for original from an ID which is not evaluated
will return ID as-is.
- Removed scene.update().
This is very expensive to update all the view layers.
- Added depsgraph.update().
Now when temporary changes to objects are to be done, this is to
happen on original object and then dependency graph is to be
updated.
- Changed object.to_mesh() to behave the following way:
* When is used for original object modifiers are ignored.
For meshes this acts similar to mesh-copy, not very useful but
allows to keep code paths similar (i.e. for exporter which has
Apply Modifiers option it's only matter choosing between original
and evaluated object, the to_mesh() part can stay the same).
For curves this gives a mesh which is constructed from displist
without taking own modifiers and modifiers of bevel/taper objects
into account.
For metaballs this gives empty mesh.
Polygonization of metaball is not possible from a single object.
* When is used for evaluated object modifiers are always applied.
In fact, no evaluation is happening, the mesh is either copied
as-is, or constructed from current state of curve cache.
Arguments to apply modifiers and calculate original coordinates (ORCO,
aka undeformed coordinates) are removed. The ORCO is to be calculated
as part of dependency graph evaluation.
File used to regression-test (a packed Python script into .blend):
{F7033464}
Patch to make addons tests to pass:
{F7033466}
NOTE: I've included changes to FBX exporter, and those are addressing
report T63689.
NOTE: All the enabled-by-default addons are to be ported still, but
first want to have agreement on this part of changes.
NOTE: Also need to work on documentation for Python API, but, again,
better be done after having agreement on this work.
Reviewers: brecht, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D4834
|
|
|
|
|
|
Unfortunately it does not concern paint mode.
Related to T63946
|
|
and object.
|
|
|
|
Comments after code can cause awkward line breaks.
|
|
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
|
|
We already have different storages for cddata of verts, edges etc.,
'simply' do the same for the mask flags we use all around Blender code
to request some data, or limit some operation to some layers, etc.
Reason we need this is that some cddata types (like Normals) are
actually shared between verts/polys/loops, and we don’t want to generate
clnors everytime we request vnors!
As a side note, this also does final fix to T59338, which was the
trigger for this patch (need to request computed loop normals for
another mesh than evaluated one).
Reviewers: brecht, campbellbarton, sergey
Differential Revision: https://developer.blender.org/D4407
|
|
Now it will be simpler for code jsut wanting to preserve custom normals
around to set them, without having to add same boiler plate code all the
time around actual code.
|
|
Quiet undeclared variable warning.
|
|
While \file doesn't need an argument, it can't have another doxy
command after it.
|
|
Move \ingroup onto same line to be more compact and
make it clear the file is in the group.
|
|
BF-admins agree to remove header information that isn't useful,
to reduce noise.
- BEGIN/END license blocks
Developers should add non license comments as separate comment blocks.
No need for separator text.
- Contributors
This is often invalid, outdated or misleading
especially when splitting files.
It's more useful to git-blame to find out who has developed the code.
See P901 for script to perform these edits.
|
|
Done using:
source/tools/utils_maintenance/c_sort_blocks.py
|
|
Needed for context menu checks.
|
|
|
|
Our mesh validation was only checking cd layout so far, not their actual
data. While this might only be needed for a few types, this is a
required addition for things like imported UVs, else we have no way to
avoid nasty things like NANs & co.
Note that more layer types may need that callback, time will say. For
now added it to some obvious missing cases...
|
|
to avoid confusion."
This reverts commit e6322abad23a8ae71b72e54befffc17ae35e30d9.
|
|
avoid confusion.
|
|
snap to meshes in edit mode.
Before a value for bound box was stored in a local cache.
|
|
Needed for D3966
|
|
|
|
Not all three sides of a tesselated mesh triangle are guaranteed
to be original mesh edges, so a somewhat complicated check is
required to detect which ones are real. It seems that until now
there was no utility function for that, only some example code.
|
|
|
|
|
|
|
|
|
|
If the caller wants loop-tris, there is a function to calculate them.
|
|
Loop triangles are tessellated triangles create from polygons, for renderers
or exporters that need to match Blender's polygon tesselation exactly. These
are a read-only runtime cache.
Tessfaces are a legacy data structure from before Blender supported n-gons,
and were already mostly removed from the C code.
Details on porting code to loop triangles is in the release notes.
Differential Revision: https://developer.blender.org/D3539
|
|
Copied from CDDM_from_bmesh, the modifier stack doesn't
need to handle shape keys, vertex parents or selection history
(needed for mode switching).
|