Age | Commit message (Collapse) | Author |
|
This implements the initial core framework for fields and anonymous
attributes (also see T91274).
The new functionality is hidden behind the "Geometry Nodes Fields"
feature flag. When enabled in the user preferences, the following
new nodes become available: `Position`, `Index`, `Normal`,
`Set Position` and `Attribute Capture`.
Socket inspection has not been updated to work with fields yet.
Besides these changes at the user level, this patch contains the
ground work for:
* building and evaluating fields at run-time (`FN_fields.hh`) and
* creating and accessing anonymous attributes on geometry
(`BKE_anonymous_attribute.h`).
For evaluating fields we use a new so called multi-function procedure
(`FN_multi_function_procedure.hh`). It allows composing multi-functions
in arbitrary ways and supports efficient evaluation as is required by
fields. See `FN_multi_function_procedure.hh` for more details on how
this evaluation mechanism can be used.
A new `AttributeIDRef` has been added which allows handling named
and anonymous attributes in the same way in many places.
Hans and I worked on this patch together.
Differential Revision: https://developer.blender.org/D12414
|
|
rB8cc3d2d6f51f introduced option to force make_local code to either copy
or actually make a linked ID local, but logic of boolean options
handling was broken.
This commit simplifies logic here and fixes the issue.
NOTE: Since those new options were not used yet this was a harmless bug.
|
|
Seems like an oversight in {rB86635402d516}?
Stumbled over this while investigating another report, but this line in
its current form does not make sense (was taking derivedFinal - not
derivedDeform - prior so I assume this has to be
BKE_object_get_evaluated_mesh now).
(it is now only used for vertex parenting where this should not be an
issue, but best keep this generic).
Differential Revision: https://developer.blender.org/D12425
|
|
Makes naming consistent with image_gpu.c
|
|
Improve texture painting/uv editing performance when limited scale is active.
Cause of the slow down is that the image editor draws the image in maximum resolution,
but the 3d viewport uses the limited scale. The variation reuses the same GPU texture
and needed to be uploaded/scaled twice to the GPU.
This patch will adds texture slots that can hold the scaled down and the maximum
resolution image. This would allow better cache hits and reuse of existing caches.
Maximum resolution textures are reused for limited scale when they fit to reduce memory
and CPU footprint.
Reviewed By: fclem
Differential Revision: https://developer.blender.org/D12388
|
|
This patch allows dropping material assets from material slot under the mouse
cursor. Before this change the material slot had to be hand-picked from the
properties panel.
For consistency it is chosen to do this in any shading mode as the tooltip shows
what is exactly going to happen during release.
The feature also works for other object types than Meshes as it uses the drawn surface on the
GPU to detect the material slots. Performance of this patch has been tested with AMD GCN3.0
cards and are very responsive.
Reviewed By: fclem, Severin
Differential Revision: https://developer.blender.org/D12190
|
|
Caused by {rB5a9a16334c57}
Linking/appending an asset made from a collection containing certain
types of objects lacking bounding boxes (camera, light) would crash.
Add simple bbox check to prevent the crash.
Maniphest Tasks: T91236
Differential Revision: https://developer.blender.org/D12415
|
|
them local.
This is to be used when calling code already knows whether the 'made
local' linked ID should be copied, or can directly be converted to a
local one.
Currently unused , this is preparation for rewrite of append code.
|
|
Previously, the Point Instance node in geometry nodes could only instance
existing objects or collections. The reason was that large parts of Blender
worked under the assumption that objects are the main unit of instancing.
Now we also want to instance geometry within an object, so a slightly larger
refactor was necessary.
This should not affect files that do not use the new kind of instances.
The main change is a redefinition of what "instanced data" is. Now, an
instances is a cow-object + object-data (the geometry). This can be nicely
seen in `struct DupliObject`. This allows the same object to generate
multiple geometries of different types which can be instanced individually.
A nice side effect of this refactor is that having multiple geometry components
is not a special case in the depsgraph object iterator anymore, because those
components are integrated with the `DupliObject` system.
Unfortunately, different systems that work with instances in Blender (e.g.
render engines and exporters) often work under the assumption that objects are
the main unit of instancing. So those have to be updated as well to be able to
handle the new instances. This patch updates Cycles, EEVEE and other viewport
engines. Exporters have not been updated yet. Some minimal (not master-ready)
changes to update the obj and alembic exporters can be found in P2336 and P2335.
Different file formats may want to handle these new instances in different ways.
For users, the only thing that changed is that the Point Instance node now
has a geometry mode.
This also fixes T88454.
Differential Revision: https://developer.blender.org/D11841
|
|
Avoids duplicating the image buffer when saving thumbnails.
|
|
Also remove IB_metadata flag from the resulting imbuf as this image
has no meta-data.
|
|
This adds an option to use a capture of the entire main window as the
blend file preview thumbnail.
See D10492 for details and examples.
Differential Revision: https://developer.blender.org/D10492
Reviewed by Campbell Barton
|
|
The posterize node limits the number of colors per channel.
This is useful to generate masks or to generate stylized images
Both the tiled and full-frame implementation are included in this patch
{F10314012}
Reviewed By: manzanilla, jbakker
Differential Revision: https://developer.blender.org/D12304
|
|
Support extracting identifiers RNA paths into fixed size buffer
since the maximum size of the identifier is known all cases.
- Add BLI_str_unescape_ex to support limiting the destination buffer.
- Add BLI_str_quoted_substr to copy values into a fixed size buffer.
|
|
- lower to warning (might be debatable, but this is not really
malfunctioning and e.g. constraints/modifiers dont spit out errors if
targets are not specified)
- clarify _what_ of the two actualy does not exist
ref. T91101
Maniphest Tasks: T91101
Differential Revision: https://developer.blender.org/D12389
|
|
When joining two strokes in paint mode using the auto merge option, the join was very hard if the thickness was too different.
This patch adds a smooth to the join in order to get better transition.
Also fixed the problem to join existing strokes very far from actual stroke.
Some cleanup and rename of old code is included in order to make code more readable.
Reviewed By: pepeland
Differential Revision: https://developer.blender.org/D12362
|
|
The parameter wa sin the UI but was not used because it was replaced by Use Thickness.
|
|
Adding a mirror modifier in edit-mode crashed.
Freeing meshes that hold a shallow copy happens in multiple places
while calculating modifiers, making it impractical to clear the
edit-mode pointer before freeing the mesh (as done in
BKE_editmesh_free_derived_caches).
Add a struct member to the edit-mesh struct so evaluated copies
don't free the edit-mesh contents.
|
|
This memory was only duplicated to satisfy mesh_data_free
which was incorrectly freeing the pointer (but nothing else).
|
|
No longer free the edit-mesh pointer while in edit-mode since this
isn't reliable to keep the object in edit-mode while freeing it's
edit-mesh data.
Users who want to exit edit-mode should do so explicitly.
Caused by 6d2f9b1dfa98502e9e9f1a73e3dded2ded1f1ce6.
|
|
Freeing the edit-mesh pointer wasn't free the edit-mesh data it's self.
Unlinking from the outliner or through the Python API leaked memory.
This didn't often cause leaks in practice since ED_editors_exit
exits edit-mode for all objects.
Now freeing mesh data frees the edit-mode data as well,
this matches the behavior of other object types that support edit-mode.
|
|
|
|
Rely on BLI_str_quoted_substrN to detect if the prefix exists since
this function exists early there is no need to check before calling.
|
|
Caused by {rBf3bf87e5887c}.
When using a GPencil Time Offset Modifier, the bGPDlayer>actframe can be
NULL. This can be determined though, but above optimization commit
skipped getting the active frame in this case entirely (with the
intention to only get it if framenumbers did not match).
Now also call BKE_gpencil_layer_frame_get() if actframe is NULL in order
to fetch a valid one if present.
Maniphest Tasks: T91060
Differential Revision: https://developer.blender.org/D12355
|
|
|
|
Many callers expanded a PointerRNA argument,
so add a version of these functions that takes a PointerRNA.
|
|
Previously, built-in nodes had to implement "socket templates"
(`bNodeSocketTemplate`) to tell Blender which sockets they have.
It was nice that this was declarative, but this approach was way
too rigid and was cumbersome to use in many cases.
This commit starts to move us away from this rigid structure
by letting nodes implement a function that declares the sockets
the node has. Right now this is used as a direct replacement
of the "socket template" approach to keep the refactor smaller.
It's just a bit easier to read and write.
In the future we want to support more complex features like
dynamic numbers of sockets and type inferencing. Those features
will be easier to build on this new approach.
This new approach can live side by side with `bNodeSocketTemplate`
for a while. That makes it easier to update nodes one by one.
Note: In `bNodeSocketTemplate` socket identifiers were made
unique automatically. In this new approach, one has to specify
unique identifiers manually (unless the name is unique already).
Differential Revision: https://developer.blender.org/D12335
|
|
This node takes a curve geometry input and creates a filled mesh at Z=0
using a constrained Delaunay triangulation algorithm. Because of the
choice of algorithm, the results should be higher quality than the
filling for 2D curve objects.
This commit adds an initial fairly simple version of the node, but more
features may be added in the future, like transferring attributes when
necessary, or an index attribute input to break up the calculations
into smaller chunks to improve performance.
Differential Revision: https://developer.blender.org/D11846
|
|
This mesh primitive enhances the Cube mesh primitive and allows the
creation of a cuboid with a configurable size and number of vertices
in all 3 directions. The Cube primitive is now similar to the Grid
primitive except that it works in 3 dimensions.
Previously it was possible to create a cube and scale it arbitrarily
along each axis. You could also subdivide the mesh, but the number of
subdivisions was equal along all axes. This meant that making the basic
frame for something like modular buildings wasn't trivial.
Inspired by tutorials and files for modular building creation.
The cuboid is created as a `Mesh` so that large meshes with millions of
faces are created quickly. Though edge calculation could be faster if
implemented here, edges are calculated using `BKE_mesh_calc_edges`
to reduce complexity, and in hopes that they may be calculated lazily
for `Mesh` in the future like vertex normals.
See the differential revision for more information.
Differential Revision: https://developer.blender.org/D11810
|
|
Besides helping to avoid buffer overflow errors this reduces complexity
of BLI_str_utf32_as_utf8 which needed a special loop for the last 6
characters to avoid writing past the buffer bounds.
Also add BLI_str_utf8_from_unicode_len which only returns the length.
|
|
The default float IDProperty min value rB8b9a3b94fc148d19 for when there
is no UI data was FLT_MIN instead of -FLT_MAX, which meant that animated
custom property values couldn't be less than zero unless they had their
UI data values edited previously.
That's a mistake I won't make again! Also change the int minimums from
-INT_MAX to INT_MIN to sanitize the whole situation.
|
|
The storage of IDProperty UI data (min, max, default value, etc) is
quite complicated. For every property, retrieving a single one of these
values involves three string lookups. First for the "_RNA_UI" group
property, then another for a group with the property's name, then for
the data value name. Not only is this inefficient, it's hard to reason
about, unintuitive, and not at all self-explanatory.
This commit replaces that system with a UI data struct directly in the
IDProperty. If it's not used, the only cost is of a NULL pointer. Beyond
storing the description, name, and RNA subtype, derived structs are used
to store type specific UI data like min and max.
Note that this means that addons using (abusing) the `_RNA_UI` custom
property will have to be changed. A few places in the addons repository
will be changed after this commit with D9919.
**Before**
Before, first the _RNA_UI subgroup is retrieved the _RNA_UI group,
then the subgroup for the original property, then specific UI data
is accessed like any other IDProperty.
```
prop = rna_idprop_ui_prop_get(idproperties_owner, "prop_name", create=True)
prop["min"] = 1.0
```
**After**
After, the `id_properties_ui` function for RNA structs returns a python
object specifically for managing an IDProperty's UI data.
```
ui_data = idproperties_owner.id_properties_ui("prop_name")
ui_data.update(min=1.0)
```
In addition to `update`, there are now other functions:
- `as_dict`: Returns a dictionary of the property's UI data.
- `clear`: Removes the property's UI data.
- `update_from`: Copy UI data between properties,
even if they have different owners.
Differential Revision: https://developer.blender.org/D9697
|
|
Add mode to overwrite strips on overlap instead of resolving overlap.
When overlap is created, 3 things can happen:
- On partial overlap, handles of overlapped strip are moved
- On complete overlap with smaller strip, overlapped strip is split
- On complete overlap with larger strip, overlapped strip is removed
This mode can be enabled in header.
Reviewed By: fsiddi, mano-wii
Differential Revision: https://developer.blender.org/D11805
|
|
Various changes to reduce risk of out of bounds errors in utf8 seeking.
- Remove BLI_str_prev_char_utf8
This function could potentially scan past the beginning of a string.
Use BLI_str_find_prev_char_utf8 instead which takes a limiting
string start argument.
- Swap arguments for BLI_str_find_prev_char_utf8 so the stepping
argument is first and the limiting argument is last.
This matches BLI_str_find_next_char_utf8.
- Change behavior of these functions to return it the start or end
pointers instead of NULL, which complicated use of these functions
to calculate offsets.
Callers that need to check if the limits were reached can compare
the return value with the start/end pointers.
- Return 'const char *' from these functions
so they don't remove const from the input arguments.
|
|
|
|
|
|
|
|
|
|
We now use a for_each function with callback to iterate through all sequences in the scene.
This has the benefit that we now only loop over the sequences in the scene once.
Before we would loop over them twice and allocate memory to store temporary data.
The allocation of temporary data lead to unintentional memory leaks if the code used returns to exit out of the iteration loop.
The new for_each callback method doesn't allocate any temporary data and only iterates though all sequences once.
Reviewed By: Richard Antalik, Bastien Montagne
Differential Revision: http://developer.blender.org/D12278
|
|
Code mentions that ID_* were defined in DNA_ID.h but are actually defined
in DNA_ID_enums.h.
|
|
Remove BLI_str_utf8_as_unicode_and_size and
BLI_str_utf8_as_unicode_and_size_safe.
Use BLI_str_utf8_as_unicode_step instead since it takes
a buffer bounds argument to prevent buffer over-reading.
|
|
The comment for data_eval mentions that it should contain a mesh for
curve objects, however with geometry nodes, objects can evaluate to
curves as well (though they are only containers for the `CurveEval`.
That is a larger issue, but with the upcoming geometry instancing patch
the situation changes, so this commit does not correct that. I also hope
to remove this code in favor of the new curve to mesh code soon.
Instead, just check the evaluated data type in this case, which prevents
the crash, though it is hacky.
|
|
|
|
Before this patch attempting to remove a particle modifier programmatically
through Python would fail, because it deleted the modifier associated with
the currently active particle system instead of the one passed as an argument
to `bpy.types.ObjectModifiers.remove()`.
This fix adds an additional argument for the particle system to
`object_remove_particle_system`. This allows to specify which particle system
and its associated modifier shall be removed. In case of
`particle_system_remove_exec` it will remain the currently active particle
system, whereas `object_remove_particle_system` passes the particle system
of the modifier. Hence, the correct modifier will be removed.
Reviewed By: mont29
Differential Revision: https://developer.blender.org/D12234
|
|
`BKE_lib_id_clear_library_data`.
This static internal `_ex` function was not doing anything extra, just
move back whole code to public API `BKE_lib_id_clear_library_data`.
|
|
Not sure why this one was still there, probably just escaped a previous
cleanup somehow.
|
|
|
|
FFMPEG_USE_DURATION_WORKAROUND
|
|
We need to separate the flag telling duplicate code to not handle
remapping to new IDs etc., from the one telling the code that we are
currently duplicating a 'root' ID (i.e. not a dependency of another
duplicated ID).
This whole duplicate code/logic is still fairly unsatisfying, think it
will need further refactor, or maybe even re-design, at some point...
|
|
Add a string length argument to BLI_str_utf8_as_unicode_step to prevent
reading past the buffer bounds or the intended range since some callers
of this function take a string length to operate on part of the string.
Font drawing for example didn't respect the length argument,
potentially causing a buffer over-read with multi-byte characters
that could read past the end of the string.
The following command would read 5 bytes past the end of the input.
`BLF_draw(font_id, (char[]){252}, 1);`
In practice strings are typically null terminated so this didn't crash
reading past buffer bounds.
Nevertheless, this wasn't correct and could cause bugs in the future.
Clamping by the length now has the same behavior as a null byte.
Add test to ensure this is working as intended.
|