A flag was not enough for this, we actually need to pass along the MIS weight,
so we can compute the direct contribution without the MIS weight.
Pull Request: blender/blender#108195
The practical problem this change addresses is ability to have base
flag dependent functionality in Cycles without re-setting the render
on selection. This problem initially arose during the Cycles light
linking project.
The original review happened there:
blender/blender#105837
Pull Request: blender/blender#108182
Move the instancing related code to a dedicated function, leaving
the generic `build_collection()` dedicated to the building of the
collection itself.
Should be no functional changes: the code paths should effectively
still be the same. This is because non-instancing cases were passing
object as a null pointer, disabling the non-generic code path.
In previous implementation the first available render surface was
selected. For NVIDIA platform this was the correct one, but for
AMD and Intel GPUs this was incorrect. This PR goes over all the
available render surfaces and selects a compatible one.
For now when no compatible render surface is found it will still select
the first available one. With the expectation that the screen is drawn
incorrectly and users would report a bug so we can investigate.
Pull Request: blender/blender#108169
Covers the macro ARRAY_SIZE() and STRNCPY.
The problem this change is aimed to solve it to provide cross-platform
compiler-independent safe way pf ensuring that the functions are used
correctly.
The type safety was only ensured for GCC and only for C. The C++
language and Clang compiler would not have detected issues of passing
bare pointer to neither of those macros.
Now the STRNCPY() will only accept a bounded array as the destination
argument, on any compiler.
The ARRAY_SIZE as well, but there are a bit more complications to it
in terms of transparency of the change.
In one place the ARRAY_SIZE was used on float3 type. This worked in the
old code because the type implements subscript operator, and the type
consists of 3 floats. One would argue this is somewhat hidden/implicit
behavior, which better be avoided. So an in-lined value of 3 is used now
there.
Another place is the ARRAY_SIZE used to define a bounded array of the
size which matches bounded array which is a member of a struct. While
the ARRAY_SIZE provides proper size in this case, the compiler does not
believe that the value is known at compile time and errors out with a
message that construction of variable-size arrays is not supported.
Solved by converting the field to std::array<> and adding dedicated
utility to get size of std::array at compile time. There might be a
better way of achieving the same result, or maybe the approach is
fine and just need to find a better place for such utility.
Surely, more macro from the BLI_string.h can be covered with the C++
inlined functions, but need to start somewhere.
There are also quite some changes to ensure the C linkage is not
enforced by code which includes the headers.
Pull Request: blender/blender#108041
Allows to share buffer data between the render result and image buffers.
The storage of the passes and buffers in the render result have been
wrapped into utility structures, with functions to operate on them.
Currently only image buffers which are sharing buffers with the render
results are using the implicit sharing. This allows proper decoupling of
the image buffers from the lifetime of the underlying render result.
Fixes#107248: Compositor ACCESS VIOLATION when updating datablocks from handlers
Additionally, this lowers the memory usage of multi-layer EXR sequences
by avoiding having two copies of render passes in memory.
It is possible to use implicit sharing in more places, but needs
some API to ensure the render result is the only owner of data before
writing to its pixels.
Pull Request: blender/blender#108045
This hard-coded assumption meant that operators would behave as if
bl_property = "type" was assigned in the operator - when the variable
wasn't found.
Remove the hard coded name. Operators that depended on this now need
to assign bl_property = "type" in the operator class explicitly.
Remove this because it wasn't documented as means operator behavior
could change unexpectedly when renaming a property.
While in practice an overflow seems unlikely in this particular case,
internal path manipulation assume FILE_MAX_LIBEXTRA so passing in
smaller buffer sizes is error prone.
Many "UV island" style operations internally use #UvElementMap, including:
- Transform tools
- Smart-Stitch
- UV Pinch, UV Grab and UV Relax sculpt tools.
Normally, every UV in the mesh is included in the #UvElementMap.
However, with hidden geometry, only the visible geometry is included in the map. [0]
This change enforces stricter usage, reducing the chance of crashes in other areas.
Regression from [0] which was a fix for "UV Island calculation doesn't ignore hidden faces" [1].
[0]: 8f543a73ab
[1]: #99659
Pull Request: blender/blender#108130
Adds stencil texture view support for Metal, allowing reading of
stencil component during texture sample/read.
Stencil view creation refactored to use additional parameter in
textureview creation function, due to deferred stencil parameter
causing double texture view creation in Metal, when this should
ideally be provided upfront.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#107971
When light-linked mesh emitter has raytrace dependent node (such as
bevel) OptiX render would have failed with an invalid address.
Pull Request: blender/blender#108154
Only Embree CPU BVH was built in the multi-device case. However, one
Embree GPU BVH is needed per GPU, so we now reuse the same logic as in
the other backends.
Pull Request: blender/blender#107992
Similar to other screen options, add one for Spreadsheet editors that
makes them update when playing animation.
NOTE: there are some editors that always update when playback was
invoked from an animation editor while others only do this when their
respective option is specifically set (think the later behavior fits the
spreadsheet better).
Pull Request: #108002
In the DrawManager a dummy texture was attached to the a, au, c, ac
binding points. In the shader those binding points are actual texture
buffers.
The reason for the dummy texture was to work around some OpenGL driver
bugs. In Vulkan (and expected also in Metal) it is not allowed to attach
a texture as a texel buffer. Fixing this would require copying buffers into a
buffer during binding.
This patch will remove the binding of the textures and use the vbos
instead. Also it fixes an issue where a platform does support compute
shaders, but don't support transform feedback. This is currently the
case for the Vulkan backend.
Pull Request: blender/blender#108139
In dd32dac60f, the "A" and "B" input socket from the Mix node were
disambiguated, so as not to confuse them with Alpha and Blue.
These messages are used in other nodes and elsewhere in the same
sense, so this commit adds translation contexts to these occurrences
as well.
Pull Request: blender/blender#108051
After 22f641e7f8, translation macros were removed and thus in many
files inclusion of the translation header is no longer needed.
Pull Request: blender/blender#107986
After 22f641e7f8, translation macros were removed and thus in many
files inclusion of the translation header is no longer needed.
Pull Request: blender/blender#107986
The Vector Math node's label has a special function used to compute
its label based on the currently selected operation. This operation,
like that of the Math node, is extracted using the "NodeTree"
translation context.
Therefore, in this function it must also use the same context to
translate the label.
In addition, a few node types can have an "Unknown" label if there is
a problem with their internal state (operation, filter type, blending
type). This message can also be translated.
Pull Request: blender/blender#108029
Some property labels need a context to disambiguate them from others
which have the same name.
The only way to show the proper text currently for such properties is
to override it in the UI code with a translation context, like:
```python
layout.prop(obj, "area", text="Area",
context=i18n_contexts.amount)
```
Python properties already store a translation context though, but this
context cannot be chosen from a Python script.
For instance, typing:
```python
bpy.types.Scene.test_area = bpy.props.BoolProperty(name="Area")
print(bpy.context.scene.bl_rna.properties['test_area'].translation_context)
```
will print `*`, the default context for Python props.
This commit allows specifying a context in this manner:
```python
from bpy.app.translations import contexts as i18n_contexts
bpy.types.Scene.test_number_area = bpy.props.BoolProperty(
name="Area", translation_context=i18n_contexts.amount
)
print(bpy.context.scene.bl_rna.properties['test_number_area'].translation_context)
```
will now print `Amount` and can be translated differently from other
labels. In this instance, the word for a surface area measurement,
instead of a UI area.
-----
This is what translated properties look like using the existing ("Area", "") and ("Area", "Amount") messages:

The panel can be generated with this script:
[python_prop_contexts_test.py](/attachments/ab613cdc-8eba-46bc-8f3c-ad0a97e7a6e5)
Pull Request: blender/blender#107150
Some property labels need a context to disambiguate them from others
which have the same name.
The only way to show the proper text currently for such properties is
to override it in the UI code with a translation context, like:
```python
layout.prop(obj, "area", text="Area",
context=i18n_contexts.amount)
```
Python properties already store a translation context though, but this
context cannot be chosen from a Python script.
For instance, typing:
```python
bpy.types.Scene.test_area = bpy.props.BoolProperty(name="Area")
print(bpy.context.scene.bl_rna.properties['test_area'].translation_context)
```
will print `*`, the default context for Python props.
This commit allows specifying a context in this manner:
```python
from bpy.app.translations import contexts as i18n_contexts
bpy.types.Scene.test_number_area = bpy.props.BoolProperty(
name="Area", translation_context=i18n_contexts.amount
)
print(bpy.context.scene.bl_rna.properties['test_number_area'].translation_context)
```
will now print `Amount` and can be translated differently from other
labels. In this instance, the word for a surface area measurement,
instead of a UI area.
-----
This is what translated properties look like using the existing ("Area", "") and ("Area", "Amount") messages:

The panel can be generated with this script:
[python_prop_contexts_test.py](/attachments/ab613cdc-8eba-46bc-8f3c-ad0a97e7a6e5)
Pull Request: blender/blender#107150
The node socket extraction regexes introduced in 6d39ba7b41 suffered
from two issues:
1. the contextless name extraction would also extract socket names
which did have a context. To solve, this, use a negative lookahead
at the end of the regex, containing ".translation_context(".
2. the number of characters in a message was limited to 1, because the
_str_base component would match one or more chars after the first
one, while it should have matched zero or more.
This last issues existed before, and the fix allows the extraction of
three new messages.
Pull Request: blender/blender#108052
Mark `NlaStrip.frame_{start,end}` and `NlaStrip.frame_{start,end}_ui` as
to-be-ignored for the library override system, and add a new set of RNA
properties `frame_{start,end}_raw` that the library override system can
use.
Versioning code ensures that overrides on `frame_{start,end}` are
altered to be applied to the `..._raw` counterpart instead.
The override system uses RNA to update properties one-by-one, and the
RNA code trying its best to keep things consistent / valid. This is very
much desired behaviour while a human is editing the data.
However, when the library override system is doing this, it is not
replaying the individual steps (that each end in a valid configuration),
but just setting each property one by one. As a result, the intermediate
state can be invalid (for example moving one strip into another) even
when the end result is perfectly fine.
This is what the `..._raw` properties do -- they set the values without
doing any validation, so they allow the library overrides system to move
strips around.
This assumes that the result of the override is still valid. Logic to
detect invalid situations, and reshuffle the NLA strips if necessary, is
left for a future commit as it is related to #107990 (NLA Vertical
Reorder).
Additionally, this commit adds functions
`BKE_lib_override_library_property_rna_path_change()` and
`BKE_lib_override_library_property_search_and_delete()` to the library
override API. The former is used to change RNA paths of property
overrides, and the latter is used to remove a property override
identified by its RNA path.
Hardware Raytracing wasn't properly disabled or enabled in the
subdevices of the multi-device.
This construct:
foreach ( DeviceInfo &info,
(device.multi_devices.size() != 0 ?
device.multi_devices : vector<DeviceInfo>({device}))
)
was a nice trap - it was giving a copy to iterate on.
Pull Request: blender/blender#107989
This is necessary for correctness of the code to avoid duplicate symbols.
In practice, this wasn't necessary yet, because usually we pass lambdas
into these functions which cause every instantiation to have a different
signature.
Alignment here means that the size of the range passed into callback
is a multiple of the alignment value (which has to be a power of two).
This can help with performance when loops in the callback are are
unrolled and/or vectorized. Otherwise, it can potentially reduce
performance by splitting work into more unequally sized chunks.
For example, chunk sizes might be 4 and 8 instead of 6 and 6 when
alignment is 4.
This is useful when debugging how much memory a particular function
allocates from this allocator. The change also reduces the size of
`LinearAllocator`.
When using edit mode with a mesh, if you have the retopology overlay active,
the selection of vertices, edges, or faces is occluded by the other objects.
However, if local view is on or collections with objects are hidden,
these non-visible objects can occlude the selection.
This patch discards objects that are not visible in the viewport so they
do not occlude selection.
During packing, some combinations of `Fraction` margin method, and
various locking options, interact with situations where all or none
of the islands are pinned.
Previously, the settings were queried to choose the best packing method.
Now, the islands themselves are queried if they can translate or scale,
and the packing method is chosen based on the input, rather than the
parameters.
Fixes unreported crash with "Locked Position" when all islands are pinned.
Reported as #108037 "3. In some case locked position is not respected"
When rotation is enabled and doing a scale line-search (locked islands
or "fraction" margin method), if the `rotate_inside_square` would
result in a a tighter packing, the wrong scale value was being used,
resulting in UVs outside of the unit square.
Reported as #108037 "1. Use locked scale on after scaling UV..."
If an island overlaps a pinned island, and that pinned island has
locked scale, then the pinning information must be copied to the
first island so it can be scaled correctly.
Reported in #108037 as "2. Use with Merge Overlapped"
Increase precision of some rotational inputs so that they all show the
same precision. And have the arrows change in full degrees.
Pull Request: #106515
For File Browser "System" and "Volumes" lists, the item names cannot be
changed by users yet the tooltip says "Double click to rename". This PR
just removes that text for these non-editable lists.
Pull Request: #106873
In 80feb13665, preference for extend channel selection is changed to
ctrl-click. But some channel type invokes rename operation due to key
conflicts. Since double-click is also used for renaming, remove
ctrl-click keys for renaming.
Pull Request: blender/blender#107719
Defining `operator-` for the iterator allows it to be used in more generic
iterator code. The `index_range` method is the same that exists on many
other containers like `Vector`.
Previously, `tbb::parallel_for` was instantiated every time `threading::parallel_for`
is used. However, when actual parallelism is used, the overhead of a function
call is negilible. Therefor it is possible to move that part out of the header
without causing noticable performance regressions.
This reduces the size of the Blender binary from 308.2 to 303.5 MB, which is
a reduction of about 1.5%.
xdg_surface_ack_configure must run once the events have been handled
which is not the case configure runs from the event handling thread.
In practice this could lead to glitches resizing windows, although some
flickering on startup remains on KDE which would be good to resolve.
Change display name of OBJECT_OT_vertex_group_copy to "Duplicate Vertex
Group" from "Copy Vertex Group". The word "duplicate" is a better
unambiguous descriptor of this operation.
Pull Request: blender/blender#107691
Implements a new option in keymap settings:
- "Navigate during Transform"
Note that with the option enabled, the keymap changes as follows:
|Modal Map (Blender):| Conflict: | Current: | New:
|---|---|---|---
| Increase Proportional Influence | VIEW3D_OT_zoom | Wheel Down | Alt Wheel Down
| Decrease Proportional Influence | VIEW3D_OT_zoom | Wheel Up | Alt Wheel Up
| Adjust Proportional Influence | VIEW3D_OT_rotate | Mouse/Trackpad Pan | Alt Mouse/Trackpad Pan
| Increase Max AutoIK Chain Length | VIEW3D_OT_zoom | Wheel Down | Alt Wheel Down
| Decrease Max AutoIK Chain Length | VIEW3D_OT_zoom | Wheel Up | Alt Wheel Up
| Automatic Constraint | VIEW3D_OT_rotate | Middle Mouse | Alt Middle Mouse
| Automatic Constraint Plane | VIEW3D_OT_move | Shift Middle Mouse | Shift Alt Middle Mouse
Design Task: #106008
Pull Request: blender/blender#105764
Implements a new API consisting of:
- `ED_view3d_navigation_init`,
- `ED_view3d_navigation_do` and
- `ED_view3d_navigation_free`,
With these functions, any operator can create their own navigation
context and navigate in the 3D View without having to use
`PASS_THROUGH`.
Texture clearing is done using framebuffer clear.
To avoid adding the flag everywhere we add it as part
of the texture creation process.
This should have no performance impact.
This forces the max thread count to be inlined with what
blender expects. While this will make some shaders less
eficient it avoid crashes / assert on shaders that
could not compile. The performance impacts can be fixed
by tackling the individual cases.
AutoMerge is a property of transform operations, so it seems more
convenient to have this option bundled with transform settings.
Another thing is that the 'Live Unwrap' option has no real relation to
Transform.
Therefore, remove the 'AutoMerge' sub-panel and create two sub-panels
for the Options Panel:
- Transform
- UVs
Merge the 'AutoMerge' settings into the 'Transform' sub-panel.
Move 'Live Unwrap' to the 'UVs' sub-panel.
Pull Request: blender/blender#108056
The failure happens since the recent changes in the make_orthonormals.
The only difference is the underwater caustics test file, and the
difference seems to be a noise floor.
There seems to be nothing wrong with the math in the function itself:
the return values are all without quite small epsilon when comparing
Linux with M2 macOS. The thing is: the very first input is already a
bit different on different platforms. So the difference is already
somewhere else.
For now increase the threshold to avoid confusion of the rest of the
team, and to allow builds to be deployed.
Pull Request: blender/blender#108080
Object transforms were already respected, issue was just pre vs. post
matrix multiplication when local axis were used.
Should go into LTS as well I guess.
Pull Request: blender/blender#108076
Store bevel weights in two new named float attributes:
- `bevel_weight_vert`
- `bevel_weight_edge`
These attributes are naming conventions. Blender doesn't enforce
their data type or domain at all, but some editing features and
modifiers use the hard-coded name. Eventually those tools should
become more generic, but this is a simple change to allow more
flexibility in the meantime.
The largest user-visible changes are that the attributes populate the
attribute list, and are propagated by geometry nodes. The method of
removing this data is now the attribute list as well.
This is a breaking change. Forward compatibility is not preserved, and
the vertex and edge `bevel_weight` properties are removed. Python API
users are expected to use the attribute API to get and set the values.
Fixes#106949
Pull Request: blender/blender#108023
A mistake in the recent ImBuf API refactor: the Libmv image accessor
was copying destination to destination (possibly using the wrong
number of channels as well).
Pull Request: blender/blender#108070
Resolves z-fighting blocking artifacts on faces due to limited
depth precision at certain camera positions. Depth bias
offsets the calculation enough without affecting display.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#108048
Exiting with multiple overlapping windows (a file selector for e.g.)
reliably crashes.
Closing the windows on exit caused the the keyboard enter handler to be
called with a NULL window surface (wl_surface).
While this doesn't look to be documented anywhere, SDL's code-comments
note this happens when windows have just been closed.
GTK also check surfaces for NULL.
While strcpy is safe in this case, it's use requires extra scrutiny
and can cause problems if the strings are later translated.
Also move the ID code assignment into material_init_data
as the ID-code is more of an internal detail.
If there are no loose vertices or edges, it's basically free to
propagate that information to the result and save calculating
it later in case it's necessary. I observed a peformance increase
from 3.6 to 4.1 FPS when extruding a 1 million face grid.
Add a ensure_utf8 argument to WM_clipboard_text_get so callers don't
have to handle validation themselves.
Copying non-utf8 text into the Python console and buttons was possible,
causing invalid cursor position and a UnicodeDecodeError accessing
ConsoleLine.body from Python.
For File Browser "System" and "Volumes" lists, the item names cannot be
changed by users yet the tooltip says "Double click to rename". This PR
just removes that text for these non-editable lists.
Pull Request: blender/blender#106873
Increase precision of some rotational inputs so that they all show the
same precision. And have the arrows change in full degrees.
Pull Request: blender/blender#106515
Used to be https://archive.blender.org/developer/D17123.
Internally these are already using the same code path anyways, there's no point in maintaining two distinct nodes.
The obvious approach would be to add Anisotropy controls to the Glossy BSDF node and remove the Anisotropic BSDF node. However, that would break forward compability, since older Blender versions don't know how to handle the Anisotropy input on the Glossy BSDF node.
Therefore, this commit technically removes the Glossy BSDF node, uses versioning to replace them with an Anisotropic BSDF node, and renames that node to "Glossy BSDF".
That way, when you open a new file in an older version, all the nodes show up as Anisotropic BSDF nodes and render correctly.
This is a bit ugly internally since we need to preserve the old `idname` which now no longer matches the UI name, but that's not too bad.
Also removes the "Sharp" distribution option and replaces it with GGX, sets Roughness to zero and disconnects any input to the Roughness socket.
Pull Request: blender/blender#104445
Since 44e4f077a9 and related commits, geometry nodes doesn't
try to hide the difference between real geometry data and instances from
the user. Other nodes were updated to only support real geometry, but
the "Mesh Boolean" node was never updated and still implicitly gathered
all the instances. This commit removes the special instance behavior in the
boolean node and adds realize instances nodes to keep existing behavior
in most cases. Typically this doesn't make a difference in the result,
though it could in the union mode for instance inputs. Shifting more of
the work to realizing instances should generally be better for
performance, since it's much faster.
Before 9f78530d80, the -1 coarse_edge_index values in the
foreach_edge calls would return false in BLI_BITMAP_TEST_BOOL,
which made them look like loose edges. BitSpan doesn't have this
problem, so the return for negative indices must be explicit.
The goal is to make it more explicit and centralized operation to
assign and steal buffer data, with proper ownership tracking.
The buffers and ownership flags are wrapped into their dedicated
structures now.
There should be no functional changes currently, it is a preparation
for allowing implicit sharing of the ImBuf buffers. Additionally, in
the future it is possible to more buffer-specific information (such
as color space) next to the buffer data itself. It is also possible
to clean up the allocation flags (IB_rect, ...) to give them more
clear naming and not have stored in the ImBuf->flags as they are only
needed for allocation.
The most dangerous part of this change is the change of byte buffer
data from `int*` to `uint8_t*`. In a lot of cases the byte buffer was
cast to `uchar*`, so those casts are now gone. But some code is
operating on `int*` so now there are casts in there. In practice this
should be fine, since we only support 64bit platforms, so allocations
are aligned. The real things to watch out for here is the fact that
allocation and offsetting from the byte buffer now need an explicit 4
channel multiplier.
Once everything is C++ it will be possible to simplify public
functions even further.
Pull Request: blender/blender#107609
Originally this function expanded to the home however on WIN32
functionality changed to return the default Documents directory & the
function was renamed. Always expand "~" to the users home directory
since that's what it represents when used at the beginning of a path.
Only make libdecor a hard-requirement for using Wayland in gnome-shell
when X11 is available, as it's possible to disable Xwayland.
This also fixes window-borders not being used in gnome-shell when
WITH_GHOST_X11 is off.
Now it's possible to test Blender under gnome without libdecor by
uninstalling libdecor & running with DISPLAY environment variable
set to an empty string - useful for troubleshooting issues which
could be caused by libdecor.
Code gen bugs can happen, ad usually they can be worked around
MSVC 17.6 is not one of those cases:
59% tests passed, 120 tests failed out of 296
There really is no other choice than to refuse to build with this
compiler. Alternates that CAN be used are both 17.5 and the current
17.7 preview builds.
Upstream tracking ticket kindly submitted by @deadpin :
https://developercommunity.visualstudio.com/t/vs176/10293729
If a compiler is released in the 17.6.x series that has the bug
fixed, we can contract the range of blacklisted compiler versions
to cover just the affected range, for now however all of 17.6 marked
bad
Remove six collection properties from Mesh that are redundant
with the attribute API which has a nicer API and more features.
- `vertex_layers_float`
- `vertex_layers_int`
- `vertex_layers_string`
- `polygon_layers_float`
- `polygon_layers_int`
- `polygon_layers_string`
Finish the transition from #95966 and fe38715600 by
writing files with the new format for meshes and some movie clip fields.
This removes overhead when saving files, and makes meshes saved in
files smaller (a file with a 1 million face grid changed from 32 to 28 MB).
3.6 can still read files saved with this format, but older versions will
crash. Older files are automatically converted by versioning code when
opened.
This also allows removing all the code that converts from the new
format to the legacy format, previously used when saving files.
Pull Request: blender/blender#108015
If there is a default blocker at the path to the distant light
the code did not ignore distant lights.
The blockers from the default set were already leading to the
other light types from being ignored because of the assignment
of the ray->tmax.
Pull Request: blender/blender#108022
No user visible changes expected (since grid-views are only used in
branches right now).
This just makes grid view UIs feel more "stable" while scaling areas,
since things don't move around as much anymore. The tradeoff is that
there may be some empty space on the right, if there's not enough space
for a full column. This is how the file browser already behaves, and can
be mitigated by a smaller preview size.
The text under previews would be quite close to the preview, so that
there was more space below it than above. Center it vertically in the
available space now. Also, the horizontal padding was only applied to
the right side of the text rectangle, meaning horizontally centered text
would be too far left. Apply the padding equally, this doesn't affect
available space for the text too much.
See #108018 for before/after pictures.
Pull Request: blender/blender#108018
The highlighting of preview tiles would be too strong in asset view
templates and grid views (only used in branches so far). This is because
two buttons are overlayed on top of each other, and both would
highlight. Ensure the overlayed preview tile button doesn't use any
highlighting.
The UI list and asset view preview size calculations were out of sync,
so the UI list made more space than the preview actually used. Making
them match made the previews quite large though, so compensate that by
scaling the layout down.
Remove the related TODO comment, since this uses a common function for
getting the preview size now.
Before/after:
 
Pull Request: blender/blender#108017
`PREFERENCES_OT_copy_prev` handling of versionning was for older release
cycles type (pre-3.0), now that we are in 4.0, we can use a simpler
logic: Just look for startup data from this major release cycle (i.e.
4.x currently) and the previous one (i.e. all 3.x releases).
Fixes the 're-use previous settings' option not showing when first
starting 4.0 build.
The usage of the lib pointer was cryptic to say the least, it was
essentialy used to allow or not local IDs results in the mapping
old_id_pointer -> new_id_pointer lookup result.
Now:
- Explicitely pass a boolean to allow or not local ID as result in
lower-level code.
- Pass the 'self ID' pointer instead of its library to the whole
liblinking code (that was already the case in a few places).
Note that naming of the 'self id' pointer is currently very inconsistent
throughout the readfile liblink code, this will have to be cleaned up in
a separate step later. For now, `self_id` has been chosen for new code
as it matches the terminology in lib_query code.
The later change can also allow finer handling of lookup on undo, based
on how it was re-read (or not), should the need for this arise.
Use timecode.GetValue() to fix warning about passing correct 'double' type to 'WM_reportf'
Co-authored-by: DESKTOP-ON14TH5\Sonny Campbell <sonny.campbell@unity3d.com>
Pull Request: blender/blender#108008
Use timecode.GetValue() to fix warning about passing correct 'double' type to 'WM_reportf'
Co-authored-by: DESKTOP-ON14TH5\Sonny Campbell <sonny.campbell@unity3d.com>
Pull Request: blender/blender#108008
This renderpass pass outputs alpha blender surface
to allow combining them with the opaque passes.
Limitation: This only supports monochromatic opacity.
Colored opacity will show differently than in combined pass.
Pull Request: blender/blender#107890
Caused by 99e5024e97
Above commit changed behavior in that it only flagged the `uiBlock` with
`UI_BLOCK_POPUP_MEMORY` in case a Menu's title was provided to
`ui_popup_menu_create_block`. Now when is the title provided? This
depends on the `bl_label` set in the menu class. But this is not always
the case, there are some menus that have a blank `bl_label` (as seen
with `VIEW3D_MT_edit_mesh_context_menu` for example -- this specifies its
own label inside the draw function depending on vertex/edge/face mode).
Thus the provided title is not really reliable as source information to
do the flagging (also see for example
a38b98478a), flagging should **always** be
done [and only check a title for actually inserting in the puphash].
Choosing an entry in a menu will still handle puphash later (see
`button_activate_exit`) though multiple menus without a label might fight for the
same storage of the menu memory. Using idname instead (or in combination with
the label) for the hash could be looked at to solve this.
Pull Request: blender/blender#107427
This function handles cleaning valid system paths that are functional
when passed to `open(..)` but may be relative to the current working
directory or have redundant slashers that can be normalized.
- Add BLI_path_slash_ensure_ex which takes the string length.
- Normalize functions now return the string length,
so ensuring trailing a trailing slash is a simple check.
This would have avoided the off-by-one error from
761eac2f5d.
This improves the warning messages when make relative/absolute fails to add more context and help in tracking down problems.
Pull Request: blender/blender#107914
NanoVDB headers have unused code using "double" type, which is not supported on Arc GPUs.
Recent DPC++ changes enforced runtime verifications:
7663dc201d
which prevents execution when such type has been present even if unused.
This is a solution to avoid double to be compiled at all, similar as how it is done for Metal.
This feature implements smooth transition between 2 retimed segments.
A transition can be added by dragging retiming handle while holding
shift key. When any handle defining transition is removed, the
transition segment is removed and 2 linear segments are restored to
state before transition was created.
These transitions work with video and sound and changes are reflected
in waveforms with correct seeking, therefore it replaces usage of
`speed_factor` or earlier sound `pitch` property.
Smooth transition is achieved by evaluating Y value of circular arc,
that is tangent to lines of linear retimed segments. Because of this,
when transition length is changed both handles are moved symetrically.
This way it is possible to make transition without affecting content in
linear segments.
When linear segment after transition is further retimed, this shifts
content inside of a transition segment.
To support sound, `SEQ_retiming_sound_animation_data_set` and related
data structures has been updated to build speed table for each smooth
transition segment. Layering of retiming data via meta strips is still
fully supported.
Pull Request: blender/blender#107197
Previous patch location: https://archive.blender.org/developer/D16545
This patch addresses blender/blender#102376
A new writer is added, the usd_writer_curves.cc to handle transforming the new curves system into USD.
The goal was to enable export of the new curves type, but @HooglyBoogly mentioned there is a `curve_legacy_to_curves` utility function that could also handle converting legacy curves to the new Curves type. This very trivially enables the legacy curves for export too so I have included that change in this patch.
Co-authored-by: DESKTOP-ON14TH5\Sonny Campbell <sonny.campbell@unity3d.com>
Pull Request: blender/blender#105375
Update the XYZ Symmetry buttons if they are toggled without mouse
click, for example from a script or keyboard shortcut.
Pull Request: blender/blender#106679
This commit adds a new experimental node "Sample Volume".
It's purpose is to be able to sample values from a volume grid given
a position field.
The 'Grid' input accepts a named attribute input with the name
of the volume grid to sample. Values will be implicitly converted
from the grid type to the specified value type.
Pull Request: #107656
This includes picking up a mesh emitter with the check for a fully
blocked light by a blocker with default linking configuration.
Implemented using an intersection loop, which might not have the
best performance compared to intersect-all behavior, but allows to
use some specialized for the shadow linking ray manipulations and
object flags check.
Ref #104972
Pull Request: blender/blender#107981
Internal private struct was using `owner_id`/`self_id`, while the public
callback data struct was using `id_owner`/`id_self`.
Now using internal naming everywhere in lib_query related code, as
`owner_id` is already used in very low-level 'fundamental' part of the
code, e.g. in the `PointerRNA` struct, or in ID's 'loopback' pointers
for embedded data.
Note that this is only a very small first step toward proper naming
consistency for these type of data, the mismatch is currently spread all
over the code base.
We also need to document more formally the meaning and differences
between `self` and `owner` here.
With simulations integrated into geometry nodes it makes more sense than
ever to have a timeline in the Geometry Nodes workspace by default.
Pull Request: blender/blender#107982
Fixes preview images not showing up in asset-view templates or the in
development asset shelf.
The sliding-window optimization to only load previews that are in view
(or close to it) can't really be used by the asset-list API, since
figuring out what's actually in view is a bit tricky. So we have to
ensure all previews are loaded for now.
This pull request addresses bug blender/blender#107633
Added logic to avoid creating duplicate Blender shader nodes when
converting USD Preview Surface shaders that are connected to more
than one input.
This change adds a `NodePlacementContext::node_cache` map to record
Blender nodes converted for given USD shaders. The node creation
logic has been updated to query this cache to check if a node was
previously created for a given USD shader, before creating a
new node.
Pull Request: blender/blender#107945
Using the topology map gives a constant time lookup, since it has a map
of nodes per type. The collada code used the old function, but had been
ifdef'd for four years, so it's removed here.
Previously the default (affect all) light set would depend on
whether there is light linking in the scene or not: if there is
light linking the set would be set to 0, but when there is light
linking and light is not linked to anything the set would be all
bits set.
This change makes it so the light set is always all bits sets
regardless of whether there is no light linking in the scene at
all, or the light is not explicitly linked to anything.
This simplifies the mental model while working on the kernel
code and should not cause any functional changes. Additionally,
it seems that it will allow to avoid some of the kernel_features
check in the kernel prior to access the bitmask.
Pull Request: blender/blender#107978
Before this change the shadow ray for shadow linking was picking the
closest light. Now a random light on the ray is chosen.
This is more noisy than integrating all lights in the direction of the
main path, but this is the only way to properly support complex
scenarios where there are multiple blockers between the shading point
and the light sources, with different linked settings.
Another unfortunate aspect of this change is increased state size.
This is because the light sample needs to be scaled, so some extra
information is needed. From the intersection kernel it is not yet
possible to write to the shadow path state as this intersection kernel
is marked as not generating shadow rays for the performance reasons.
Perhaps proper solution would be to run profiler to see if the current
dedicated light intersection + shading kernel split actually gives
speedup (by allowing the shadow and main path to run in parallel as
much as possible) or if the speedup is neglectable and it is better to
save memory of the state.
Ref #104972
Pull Request: blender/blender#107739
The light intersection was always using the default receiver set
because the receiver_forward was always set to OBJECT_NONE.
This also fixes the case when there is a scene with a single object,
multiple lights lights linked to it, and one default light: the
render result now matches with the main branch.
This breaks the regression test.
The brighter result in the `light link simple` is expected, but the
`light link simple tree` seems to be too bright.
Pull Request: blender/blender#107973
Functions were moved as part of f7388e3be5, which was
unnecessarily noisy. Instead of reverting, move the definitions back
to their original place in node.cc. Also move a few more things to
the blender::bke namespace.
Since a generic snap cursor was implemented (which can be used by Tools and by DragDrop), the Placement Settings are no longer a settings of the "VIEW3D_OT_interactive_add" Operator.
With that implementation, those properties started to be defined in a
static struct, filled in at runtime and accessed in the UI through
workarrounds.
As they are properties initialized at runtime, they are not saved in
the file.
The solution is to move the Placement Settings to `ToolSettings`.
Co-authored-by: Germano Cavalcante <germano.costa@ig.com.br>
Pull Request: blender/blender#107951
Node group sockets have user-exposed data types, and sometimes
subtypes for some data types (e.g. Percentage or Angle for floats).
The UI to select these types and subtypes use an operator menu with a
text depending on the current type or subtype.
This button needs to be manually translated since its label is
manually defined.
Additionally, some subtypes need to be extracted from the Property
class's RNA_ENUM_PROPERTY_SUBTYPE_NUMBER_ITEMS, so this commit also
removes Property from the extraction blacklist in
bl_extract_messages.py. This has the side effect that it introduces a
few dozens translations, which are probably not used anywhere.
Pull Request: blender/blender#107100
- "Out" meaning "one end of a bone". Same as in 9120c86c3f.
- "Canvas" meaning a painting support for Dynamic Paint.
- "Twist" meaning an action verb, as opposed to an amount.
- "Solid" meaning a textureless, single-color material.
- "Blend mode" meaning material opacity blending, as opposed to color
blending.
- "Pixel Size" meaning "a size measured using pixels as the unit".
- "Light" meaning "not dark", as in "Light Theme".
Ref #43295
The previous two commits introduced new regexes to extract node socket
names and descriptions automatically from the i18n Python module,
including socket labels.
This commit removes the extraction macros from all node files since
they are now redundant.
Pull Request: blender/blender#107258
Some node sockets get their names from a "label", instead of the
declaration. These labels are not necessarily the same as the
declaration, so they need to be extracted to the translation files.
They are always in a `node_sock_label()` function. It has two args,
the second of which is the string we want to extract.
The node socket declarations use the `N_()` macro to extract the name
and description of the socket.
This is quite redundant because since the syntax is always the same,
the extraction can be done automatically from the Python translation
module using regexes.
Four new regexes are introduced in bl_i18n_utils.settings:
- one extracts contextless messages from `add_input()` and
`add_output()`, the basic socket declarations with the names;
- one does the same, but for those sockets which declare a context
through `.translation_context()`;
- one extracts descriptions and error messages;
- one extracts geometry nodes field inputs.
In addition to making the code simpler and more legible, this change
extracts a few dozen messages which were not tagged with the proper
macro.
Add modulo function `mod_f_positive(f, n)` that returns a positive result,
regardless of the sign of `f`.
For example, `mod_f_positive(-0.1, 1.0)` returns `0.9`, whereas the
standard `fmodf()` function would return `-0.1`.
This is useful for rewrapping values to a specific interval.
The Quick Fur operator creates a curves object with hair modifiers and
a material.
These modifiers' and material's names can be translated if the user
chose to translate data in the preferences.
Only the modifier names are translated, the node groups are not
because they may be reused instead of appended again.
Pull Request: blender/blender#107909
Asset tags are data and should not be translated, even if they are
built-in data such as hair nodes.
Issue reported by @SatoshiYamasaki in #43295.
Pull Request: blender/blender#107907
Two new messages are extracted:
- "New" in the context of paint curves. Used for the template_ID to
create a new curve;
- "PaintCurve", the default name of a newly-created paint curve.
Pull Request: blender/blender#107888
A few new messages were extracted.
- "Catalog", the default name when creating a new catalog.
- Tooltips related to drag and dropping catalogs in the asset browser.
Some use `fmt::format()` as a possible solution to messages
currently extracted with string concatenation as mentioned in
#92758.
Pull Request: blender/blender#107710
Include the term "overwrite" so users of this function are aware
this function will delete the destination file (unlike LIBC rename).
- Add BLI_rename_overwrite (previously called BLI_rename).
- BLI_rename is now a wrapper for rename.
Use BLI_rename when renaming in the file selector.
This change was made to prevent renaming files in the file selector from
deleting the file, see: #12255 & [0]. This check is no longer needed as
file selectors now checks the destination doesn't exist before renaming.
Generally, having low level file handling functions behave differently
between platforms is something to avoid with the potential of leading
to unexpected behavior.
Also unify WIN32/UNIX BLI_rename.
[0]: 41ad6f9d0a
When the `from` file didn't exist, BLI_rename returned success,
the in-line doc-string was incorrect - remove in favor of the header's
doc-string. This error existed since the initial revision.
Note that this was fixed [0] for other systems.
[0]: 622019a085
Minor corrections including:
* Fast packer wasn't treating locked islands correctly.
* Pointer aliasing.
* Fix and some assumptions that might not be always true.
* Improve variable names.
* Improved comments.
In some languages, the A and B sockets need to be disambiguated
because because they can have different letters depending on context.
In Spanish, A is used for B (Blue -> Azul), while the greek letter
alpha is used for A, to disambiguate Azul / alpha.
Pull Request: blender/blender#107706
Many messages were no longer needed since Blender 2.80.
Those messages appeared in the operator search menu and described what
category each operator belonged to. After Blender 2.80, this was
replaced by a place in the UI from where the operator can be called.
Pull Request: blender/blender#107700
Some language names were confirmed by native speakers to be
incorrectly spelled (Dutch and Hindi).
Two others were simply capitalized (Vietnamese and Kazakh).
Suspicions remain for other language names, see #105461 for details.
Pull Request: blender/blender#107707
This pull request adds a 'root_prim_path' USD export string parameter. If this option is set to a well-formed prim path (e.g., '/World'), a transform primitive with the given path will be added to the stage as the parent of all exported primitives. This will allow transforming the scene by this root node in other applications and is also required for loading the exported scene as a reference in other USDs.
As part of this change, the '_materials' node, which contains all exported materials, is also created under the root prim. This is required so that materials are imported correctly when the USD is referenced in another stage.
Finally, added an export_params_valid() function to verify that the 'root_prim_path' is valid before starting the export job. This function can be extended in the future to perform additional validation of other export parameters.
This update combines work in pull request
blender/blender#104506
and an implementation in the 'universal-scene-description' branch.
Co-authored-by: Ashley Ruglys <ashley.ruglys@gmail.com>
Pull Request: blender/blender#107855
When adding a new simulation zone, the input and output would be
accessed by their name, however the name can be translated if the user
has enabled translation of data.
Instead, get the first socket of type 'GEOMETRY' in the simulation
input and output nodes.
Pull Request: blender/blender#107819
See: blender/blender#103343
Changes:
1. Added `BKE_node.hh` file. New file includes old one.
2. Functions moved to new file. Redundant `(void)`, `struct` are removed.
3. All cpp includes replaced from `.h` on `.hh`.
4. Everything in `BKE_node.hh` is on `blender::bke` namespace.
5. All implementation functions moved in namespace.
6. Function names (`BKE_node_*`) changed to `blender::bke::node_*`.
7. `eNodeSizePreset` now is a class, with renamed items.
Pull Request: blender/blender#107790
The issue was that in case an ID was only related to its liboverride
hierarchy through a 'to' pointer (e.g. the parent pointer of an object),
it would now be tagged as 'isolated' from its hierarchy, since nothing
in said hierarchy actually points to it. It would then be deleted during
resync process.
This is once again the infamous 'inverted dependency logic of object
parenting' case...
Note that this did not have any consequences on typical liboverride
usages (based on using a hierarchy of collections0, since all objects
would then be referenced by one or more collection.
Reported by @dr.sybren while investigating #102662.
Upgrade to the latest SDK, and enable in daily and release builds where it's
available as an option under Preferences > System.
There are some known limitations, see #104110 and release notes.
Pull Request: blender/blender#105538
Ensure the file path G.main->filepath is always absolute and normalized.
- It was possible to call WM_OT_open_mainfile with only a filename,
if this resolved from the CWD, Blender's internal filepath
would not be absolute as expected.
- It was possible to open files on UNIX with an additional forward slash
causing the blend file path it's self to contain a '//' prefix,
this is error prone as running BLI_path_abs(..) multiple times would
add the blend file prefix each time.
- Remove requirement for "filepath" to be an absolute path when saving.
Instead, expand the path - making it absolute, as this constraint
wasn't applied open opening files, prefer making save/open behave
consistently.
- Assert when BLI_path_abs/BLI_path_rel receive a basepath that has
a "//" (relative) prefix itself.
Add a new flag that determines whether root bones (i.e. bones without a
parent) should be translated to the armature object's origin. This can
be found in the Armature's IK properties panel.
By default this flag is disabled, so new rigs will not see this 'locking
to the origin' behaviour. Versioning code ensures that the flag is
enabled on older files, to preserve the behaviour of existing rigs.
This also bumps the Blender subversion and at the same time fixes an
incorrect bump in ee08b2ddff (where the
'minimum compatible version' was updated instead of the current Blender
version).
Pull request: blender/blender#107869
This patch implements the Convert Color Space node for the realtime
compositor. A custom OCIO GpuShaderCreator was implemented to use the
ShaderCreateInfo in constructing the OCIO GPU processor shader. That
shader is then cached inside the cache manager and is invalidated when
the OCIO configuration changes.
Pull Request: blender/blender#107878
Double-clicking between alpha-numeric & punctuation for e.g.
did nothing instead of selecting the word.
Instead of a special check for white-space, use the enum values as a
priority so alpha-numeric characters are priories above others
in a way that doesn't prevent groups of other character types
from being selected.
Having some arguments be input/output and others output only was
confusing, a function that detects a range from a position
can simply calculate the range - modifying the input position isn't
needed.
Instead, note that word select puts the cursor at the end by convention.
Also use `r_` prefix for output only arguments.
These are now the only two BLI_path functions which assume paths are
FILE_MAX size which makes sense as they're using the `//` file prefix.
Something that's specific to file paths stored in DNA.
Use FILE_MAX in the function signature as a form of documentation.
Add a convenient way to replace a range of text in the middle of a
string that make shrink or grow the string that handles corner cases
and keeps the string null terminated.
Double-clicking to select words/sequences now using the same functions
specifically for this task, rather than boundary-seeking functions.
Pull Request: blender/blender#107927
- "... (matches pythons ...)": capitalize and use possessive ('s).
- "Layer Proxy Protection": replace proxy by override, following 2.80.
- "Enable Plane Trim": expand description.
- "Make curve path children to rotate along the path": remove "to".
- "Option for curve-deform: make deformed child to stretch along
entire path": remove "to".
- "... apply the curve radius with path following it and deforming":
rephrase unclear description.
- "Custom light falloff curve" : unrelated to lights, used in Grease
Pencil modifiers.
- "Grease Pencil layer assigned to the generated strokes": rephrase
because a GP stroke is assigned to a layer, not the other way
around.
- "Attribute domain where the attribute domain is stored in the
simulation state": remove second "domain" (typo).
Pull Request: blender/blender#107916
Mostly some minor renaming of parameters and variables, adding a few
comments...
The only actual behavior change is a more correct handling of the
`LIB_TAG_KEEP_ON_UNDO` on ID tag. This should not have any consequences
in current code though.
So no actual change in behavior is expected from this commit.
Due a limitation in the precission of the thickness
calculation, the result could be wrong.
As the code tried to use the real thickness, in some
cases this was wrong.
Related to old fix for #103061
Pull Request: blender/blender#107835
GCC documented FILENAME_MAX is the maximum length of a file that can
be opened, not to be used for allocation as it may be INT_MAX for e.g.
Even though this wasn't the case on supported systems,
prefer FILE_MAX which is used for full paths in most places.
Regression in [0] which caused the window to be NULL when the load_post
handler was called. While this can be worked around using
context.temp_override, keep the previous behavior as this
change wasn't intentional.
[0]: 46be42f6b1
The file path was 256 bytes, passing in a buffer size of 1792
for string join & making the path absolute could also overflow
as it assumes a size of 1024.
Area light sampling use special techniques to reduce noise with small
spread angles; the change in sampled area was not taken into
consideration when computing the pdf in MNEE.
Pull Request: blender/blender#107897
After the removal of the Shadow pass this no longer worked. Now it works by
marking the object as a shadow catcher and returning the Shadow Catcher pass.
The result is different than before, since it also takes into account indirect
light now and uses a different method to weight the contribution of lights that
is adaptive to the light strength.
Fix an issue when drawing node links that caused gaps, when sockets were
horizontally or vertically aligned.
When the inner and outer points of the node link's bezier control
polygon overlap, the link's tangent can be a zero vector. The shader
didn't check for this before normalizing the tangent leading to an
undefined vector which prevented the outermost segments of the link
from being drawn.
Since this only happens when the end points of the node link are
horizontally or vertically aligned, we can use the vector between the
link's end points instead of the tangent.
Fix#106929Fix#89282
Pull Request: blender/blender#107636
Making the custom data API const correct in 3a3d9488a1 caused
the issue, because it previously relied on non-threadsafe behavior. As a
workaround, just restore the thread-unsafety, and note the issue in a
new comment.
There was even one case in BLI ListBase tests!
Order was opposite of the one expected by the BLI ListBase code... Not
sure how, but this did not cause any issue apparently? But would expect
it to at least affect the order in which items in the list would be
iterated.
The assumption that the left child node follows the parent immediately is
not true in this case. For now just store both the left and right child index
as there is already padding anyway.
Later this could be optimized by storing the left and right child next to
each other, and then ensuring both are always specialized together.
The order of geometry components should match between
the Separate Components node and the spreadsheet editor.
This switches the Curve and Point Cloud outputs.
Resolves#107837
Pull Request: blender/blender#107868
`BKE_library_id_can_use_filter_id` would not handle properly cases where
the ID is a liboverride - it's hierarchy root pointer can point back to
virtually any kind of ID (although typically a Collection or Object).
This was breaking liboverride resync process in some rare cases, by
failing to remap the 'hierarchy root' pointer of some liboverrides.
Without this, support for newer NVIDIA cards will not be compiled with pre-compiling the CUDA binaries.
Includes changes needed for the buildbot building pipeline.
Co-authored-by: Sergey Sharybin <sergey@blender.org>
Pull Request: blender/blender#107585
Generally render engines can do subframe mixing themselves, but the
purpose of subframe mixing in the simulation output node is to support
higher quality motion blur with bakes when there are topology-changing
operations after the simulation output node. Linear mixing can fill the
gaps while maintaining lower memory usage.
All point/instance domain attributes are mixed, but mixing is only
supported when the domain size is unchanged or when an `id` attribute
gives a mapping between elements. Theoretically it may be possible, but
nested instance geometry is not mixed in this commit due to the
difficulty of finding matching geometries across arbitrary instance
hierarchy changes. Attributes that are completely unchanged are ignored
using implicit sharing for better performance.
Pull Request: blender/blender#107599
This makes the URL links to blender.org to have more information than
just utm_source=blender
For example:
* utm_source=blender-3.6.0-alpha
* utm_source=blender-3.3.16-release
Pull Request #107849
This fuctionality allow the Blender project to know if users
are reaching our websites from within Blender:
* User Manual
* Python API
* Release Notes
* Development Fund
Pull Request #107849
This reverts commit 95a114f3ca.
This broke bl_rigging_symmetrize, it seems likely the window was not
NULL on load in this case, setting it to NULL caused the the active
object not to be recognized.
This needs further investigation, reverting for now.
This allows to drop patches and workarounds, and reenable Hardware
Raytracing support for MNEE and Raytrace kernels for oneAPI device.
Pull Request: blender/blender#107853
This makes the Blender binary 350 KB smaller. The largest change comes
from using `FunctionRef` instead of a template when gathering indices to
mix in the extrude node (which has no performance cost). The rest of the
change comes from consolidating uses of code generation for all
attribute types. This brings us a bit further in the direction of
unifying attribute propagation.
Pull Request: blender/blender#107823
Previously, it printed the elements of `PropertyScaleType` as floats which does
not make sense. It also resulted in compile errors when attempting to compile
the generated code as c++ code.
Pull Request: blender/blender#107724
VKVertexAttributeObject was both defined as a class and a struct.
Settled on being a class.
Also removed an assert that is currently failing as workbench has
more attributes defined than actually used.
Pull Request: blender/blender#107874
After uploading the vertex buffer the state got corrupted.
Reason of this corruption is an assign-compare operation that should
just be an compare operation.
Pull Request: blender/blender#107875
Remove some nested `if` statements to improve readablilty. My main
intention has been to improve readability and therefore making it easier
to implement changes in the future.
Seperating the symmetrize operator selection logic from the temp pointer
logic may reduces performance but it seems acceptable in this case. The
change allows focussing on the selection logic without taking care of
the temp pointers at the same time.
No functional changes.
Pull Request: blender/blender#106487
Add support for index buffers as subrange. When an index buffer
is a subrange it should bind the source buffer and use the index start
as an offset in the buffer.
Pull Request: blender/blender#107871
Dummy implementation of the VKDrawList that isn't caching the draw calls
but just execute them when they are appended to the list.
Pull Request: blender/blender#107873
When the the armature doesn't have an active pose bone yet so
`ED_object_pose_constraint_list` returns NULL unhandled during
`edit_constraint_property_get`, now fixed.
Pull Request: blender/blender#107864
Regression in [0] which caused the window to be NULL when the load_post
handler was called. While this can be worked around using
context.temp_override, keep the previous behavior as this
change wasn't intentional.
[0]: 46be42f6b1
When Python is not found, inform developers how they can use a newer
version. Even though it's not officially supported - we typically keep
the latest stable version of Python working.
The same input (original image) was used for all layers. Now the operation correctly assigns the right input to the right output buffer.
Pull Request: blender/blender#107709
Adds an input node Signed Distance that can
be used to refer to the distance-grid of an SDF volume.
Right now it's experimental and can be enabled by enabling
"New Volume Nodes" in the preferences.
It returns a float AttributeFieldInput called 'distance' which
can tell Volume nodes which grid to get.
See #103248.
Preparation for the the 3.6 library update landing.
The filenames for these libs will change a little bit and 3.6 will add
new library for the fp32 version of fftw.
LibOverride resync process would not properly 'make local' newly created
overrides (copied from their linked reference). The main consequence was
that some linked data used by these new liboverrides would not be
properly tagged as directly linked.
While this would not be an issue in current codebase, this was breaking
upcomming readfile undo refactor, since some linked data did not get
their local 'placeholder reference' data written in memfile blendfiles.
NOTE: this is more of a quick fix, whole handling of library data in
complex copying cases like that need some more general work, see #107848
and #107847.
This PR enabled the swapchain to be used with AMD GPUs.
The issue is that we had to separate the swapchain into
2 functions and therefore the rendering is also not
controlled at the same time.
Semaphores were finished, before being used and the
driver stalled when waiting for those Semaphores.
This doesn't solve the issue that renderdoc can still
crash the graphics driver.
Pull Request: blender/blender#107840
Initial graphic pipeline targeting. The goal of this PR is to have an initial
graphics pipeline with missing features. It should help identifying
areas that requires engineering.
Current state is that developers of the GPU module can help with the many
smaller pieces that needs to be engineered in order to get it working. It is not
intended for users or developers from other modules, but your welcome to learn
and give feedback on the code and engineering part.
We do expect that large parts of the code still needs to be re-engineered into
a more future-proof implementation.
**Some highlights**:
- In Vulkan the state is kept in the pipeline. Therefore the state is tracked
per pipeline. In the near future this could be used as a cache. More research
is needed against the default pipeline cache that vulkan already provides.
- This PR is based on the work that Kazashi Yoshioka already did. And include
work from him in the next areas
- Vertex attributes
- Vertex data conversions
- Pipeline state
- Immediate support working.
- This PR modifies the VKCommandBuffer to keep track of the framebuffer and its
binding state(render pass). Some Vulkan commands require no render pass to be
active, other require a render pass. As the order of our commands on API level
can not be separated this PR introduces a state engine to keep track of the
current state and desired state. This is a temporary solution, the final
solution will be proposed when we have a pixel on the screen. At that time
I expect that we can design a command encoder that supports all the cases
we need.
**Notices**:
- This branch works on NVIDIA GPUs and has been validated on a Linux system. AMD
is known not to work (stalls) and Intel GPUs have not been tested at all. Windows might work
but hasn't been validated yet.
- The graphics pipeline is implemented with pixels in mind, not with performance. Currently
when a draw call is scheduled it is flushed and waited until it is finished drawing, before
other draw calls can be scheduled. We expected the performance to be worse that it actually
is, but we expect huge performance gains in the future.
- Any advanced drawing (that is used by the image editor, compositor or 3d viewport) isn't
implemented and might crash when used.
- Using multiple windows or resizing of window isn't supported and will stall the system.
Pull Request: blender/blender#106224
This PR replaces the previous implementation of the swap chain.
The previous implementation was based on a gaming loop where
inside a single function an image is requested, the drawing occurs
and the requested image is presented on screen.
In blender the drawing isn't controlled in a single function and
this approach lead to freezes, missing frames and other
artifacts.
This approach is not be the final approach but a step into a
direction where the acquiring of the next image in the swap chain
is separated from the swapping.
Pull Request: blender/blender#107740
Due to cumulative floating point errors the quaternions produced by
`mat3_normalized_to_quat_fast()` could be non-unit length. This is now
detected, and quaternions are normalised when necessary.
This is a slight roll-back of 756538b4a1,
which removed the normalisation altogether, but did introduce this issue.
Vulkan doesn't have a conversion from uint32_t/int32_t to float. It does
have conversions from 16/8 bits. Main reason is that Vulkan expects that
there is no benefit when converting 32 bits from one type to the other
and should be solved by passing the right data type.
In Blender however this isn't the case as there are benefits on other
GPU backends (OpenGL for example).
This PR adds helper function to check if conversion is needed and
perform any conversions in place. It also implements the function to
upload vertex buffers to the GPU.
NOTE: Test cases have been added to validate this, but they are not
able to run on the Vulkan backend just yet, because they require the
graphics pipeline to be available.
Pull Request: blender/blender#107733
This PR adds several tests to GTest for testing blend states
and immediate mode. The immediate mode test are basic and will
be extended in the near future.
The tests have been developed in order to get the first pixel on
screen for the Vulkan backend. In the first phase of this goal we
had to validate that everything was working as expected without
being able to validate it by starting Blender.
Pull Request: blender/blender#107834
ShaderInput lookup used to be explicit as in we know for sure that the
shader input exists. This was guarded by a assert. During development
of the graphics pipeline we came to the conclusion that this isn't
always the case due to its late bindings of resources.
This PR Makes the shader input lookup return an optional result.
This result can then be checked depending on the area where it is used
to validate the existence.
Pull Request: blender/blender#107735
This patch implements the Plane Track Deform node for the realtime
compositor. The implementation is mostly similar to the Corner Pin node,
but it is generalized to multiple homography matrices to take motion
blur into account.
Pull Request: blender/blender#107811
Adds a generic `is_larger` and `get_aspect_scaled_extent` function to
simplify packing logic.
Migrate several packing functions so that they only improve a layout,
and early-exit packing if a better layout already exists.
Fix a `rotate_inside_square` logic error during xatlas packing.
BLI_strncpy_utf8 didn't check for null bytes within bytes stepped
over by the variable length UTF8 encoding.
While a valid UTF8 string wont include these, it's possible Latin1
encoding or a truncated string includes such characters.
In this case, the entire string is copied as it's not the purpose of
this function to correct or strip invalid/truncated encoding,
only to prevent it from happening in the first place.
Use the offset indices pattern to avoid keeping separate arrays for the
offset of a vertex's neighbors and the number of neighbors. This gave
a 9% speedup for the conversion, from 42.9 ms to 39.3 ms.
In vertex extrusion mode, when there are no edge attributes we can avoid
creating a topology map meant for mixing old values. This makes
simulation caching for a curl noise demo file from user Higgsas 10%
faster (from 44s to 40s to calculate 230 frames).
Adds a `remap_pairing` function for node group operators that ensures
the simulation input nodes' `output_node_id` matches the new node are
creating a group, ungrouping a node group, or separating from a group.
Also fixes a crash in the "Group Separate" operator when group
input/output nodes are included in the selection.
Pull Request: blender/blender#107807
The attributes API does not have the error that a null attribute
does not exist and requires a new layer to be created.
Pull Request: blender/blender#107814
Issue was that, when UI-related code _is_ requested in foreach_id
processing, `ID_SCR` screen ID type can actually use any kind of ID
(through e.g. the Outliner space).
So `BKE_library_id_can_use_filter_id` had to be updated with a new
parameter (whether UI-related data should be taken into account or not).
The root of the issue was that while reading a new blendfile, the
current `G_MAIN` is still the old one, not the one in which new data is
being read.
Since the remapping callback taking care of UI data during ID remapping
is using `G_MAIN`, it is processing the wrong data, so when deleting the
invalid shapekey (from `BLO_main_validate_shapekeys`), the UI data of
the new bmain would not be properly remapped, causing invalid memory
access later when recomputing user counts (calls to
`BKE_main_id_refcount_recompute`).
This is fixed by adding a new `BKE_id_delete_ex` function that takes
extra remapping options parameter, and calling it from
`BLO_main_validate_shapekeys` with extra option to enforce handling of
UI data by remapping code.
NOTE: At some point we have to check if that whole UI-callback thing is
still needed, would be good to get rid of it and systematically process
UI-related ID pointers like any others. Current situation is... fragile
to say the least.
For realtime use cases, storing the geometry's state in memory at every
frame can be prohibitively expensive. This commit adds an option to
disable the caching, stored per object and accessible in the baking
panel. The default is still to enable caching.
Pull Request: blender/blender#107767
Caused by 2fb31f34af.
Since above commit, we are now calling `BKE_mesh_orco_verts_transform`
not only from `psys_face_mat` and `psys_mat_hair_to_orco`, but now also
from `psys_particle_on_dm` > `psys_interpolate_face`, so we get double
transforms with mirror.
Remove the "extra" call in `psys_mat_hair_to_orco`.
Should be backported to 3.3 LTS as well.
Pull Request: blender/blender#107804
Avoid storing redundant and unnecessary data in temporary arrays during
face corner normal calculation with custom normals. Previously we used
96 bytes per normal space (`MLoopNorSpace` (64), `MLoopNorSpace *` (8),
`LinkData` (24)), now we use 36 (`CornerNormalSpace` (32), `int` (4)).
This is achieved with a few changes:
- Avoid sharing the data storage with the BMesh implementation
- Use indices to refer to normal fan spaces rather than pointers
- Only calculate indices of all corners in each fan when necessary
- Don't duplicate automatic normal in space storage
- Avoid storing redundant flags in space struct
Reducing memory usage gives a significant performance improvement in
my test files, which is consistent with findings from previous commits
(see 9fcfba4aae). In my test, the time used to calculate
normals for a character model with 196 thousand faces reduced from
20.2 ms to 14.0 ms, a 44% improvement.
Edit mode isn't affected by this change.
A note about the `reverse_index_array` function added here: this is the
same as the mesh mapping functions (for example for mapping from
vertices to face corners). I'm planning on working this area and hoping
to generalize/reuse the implementation in the near future.
Pull Request: blender/blender#107592
The new theme setting for the dope sheet (timeline) allows changing the
color of the bar that shows which frames are cached/baked. The
invalid/cached/baked status is differentiated by hardcoded transparency
values. In theory, those could be separate theme settings though.
Pull Request: blender/blender#107738
Operations such as assigning or removing weights were simply not
undoable (no previous weights were applied back to the EditLatt). Now
add MDeformVert data to UndoLattice and handle with
appropriate functions during Undo.
Pull Request: blender/blender#107776
Blender would fail to link to USD before MaterialX files were
copied to the install targets lib/ directory.
Resolve by including ${LIBDIR}/materialx/lib in link_directories.
looptris were referred to as both tris & faces, sometimes polygons
were referred to as faces too. Was especially error prone with
callbacks that took both a tri and a tri_i arguments.
Sometimes tri_i represented a looptri index, other times the corner of
the triangle from 0-2. Causing expressions such as:
`args->mlooptri[tri].tri[tri_i]`
- Rename tri & tri_index -> looptri_i.
- Rename faces -> looptris.
- Rename face_index/poly_index/poly -> poly_i.
- Declare looptri_i at the start of the loop and reuse it,
in some cases it was declared with args->prim_indices[i] being
used as well.
Change PBVH normal calculation to also update vertices connected to
vertices with an update tag. This is necessary because vertex normals
are the mixed face normals, so changing any face's normal will change
the normals of all connected faces.
This change requires that the PBVH always have a vertex to face
topology map available. In the future this will likely be cached on
meshes though, which will reduce the delay it adds when entering sculpt
mode.
Now, first all face normals are updated, then the normals for
connected vertices are mixed from the face normals. This is a
significant simplification to the whole process, which previously
worked with atomics and normals at the triangle level. Similar changes
changes for regular non-sculpt normal calculation are being worked on
in #105920.
Pull Request: blender/blender#107458
In some cases strips may end up with speed factor of 0 which causes
offsets and position to be invalid. The exact cause is unknown, but
most likely caused by `do_versions_sequencer_init_retiming_tool_data()`.
This could possibly happen if 3.6 file is saved with 3.5 version and
then opened again with 3.6 version.
To fix strips, retiming data is removed, start offset reset and speed
factor is set to 1. Previous versioning code is fixed, so speed factor
is never set to 0.
Pull Request: blender/blender#107798
Avoid instantiating the templates separately in every translation unit.
This saves 20 KB in my Blender binary. Also remove a timer mistakenly
committed.
After recent Linux library updates. The EMBREE_SYCL_SUPPORT variable that
this relied on was not cached.
Always install the sycl shared libraries regardless of build options, as
we do for other shared libraries.
This saves about 6 ms every update when in edit mode on a 1 million
face grid. For reference, the BMesh to Mesh conversion took 80 ms,
before and after the change.
This starts by building a light tree for all lights in the scene as usual.
Then for every unique light set, a specialized light tree is created. Each
light tree node has a mask with the light sets it is a member of, and for
each specialized light tree only the matching subset of nodes is used.
Subtrees with identical bitmasks are shared between light trees to reduce
memory usage.
Light tree sampling works the same as before, the only difference is that a
different root node is used depending on the receiver object.
Computing the light tree pdf needed a change as the bit trails are not the
same for the specialized light tree. Each light tree node now includes a
bit shift value, to skip nodes that were left out of the specialized light
tree.
Pull Request: blender/blender#107561
This was added temporarily during development.
Loading files created in the geometry-nodes-simulation branch (3.5.4
and older) will remove links from simulation zones, which need to be
added back manually.
Pull Request: blender/blender#107781
Similare to the Metal backend, Vulkan keeps data of the full texture
around as they will be executed by the same submission. So there are
no benefits to splice a texture into smaller parts, but adds overhead
as more commands are required to be processed.
Pull Request: blender/blender#107728
The HSV node in the realtime compositor produces different values from
the CPU compositor in its identity settings.
This happens because the realtime compositor clamped the saturation
value after HSV correction, while the CPU compositor did not, so this
patch unifies that behavior. Additionally, negative values are now
clamped in both the HSV node and Hue correction node to also match the
CPU compositor.
The main goal here is to reduce the number of times thread-local data has
to be looked up using e.g. `EnumerableThreadSpecific.local()`. While this
isn't a bottleneck in many cases, it is when the action performed on the local
data is very short and that happens very often (e.g. logging used sockets
during geometry nodes evaluation).
The solution is to simply pass the thread-local data as parameter to many
functions that use it, instead of looking it up in those functions which
generally is more costly.
The lazy-function graph executor now only looks up the local data if
it knows that it might be on a new thread, otherwise it uses the local data
retrieved earlier.
Alongside with `UserData` there is `LocalUserData` now. This allows users
of the lazy-function evaluation (such as geometry nodes) to have custom
thread-local data that is passed to all the lazy-functions automatically.
This is used for logging now.
The pose library blending code assumed that quaternions would be keyed
in order of `array_index`. This is normally the case when creating a
pose asset, but when manually editing a pose asset Action this
assumption may not hold.
The code still assumes that all FCurves of a single quaternion are
sequential, i.e. are not inter-mixed with other keyed properties. They
just no longer have to be ordered by array index.
Ref: blender-addons/issues#104591
This patch implements the Denoise node for the realtime compositor. The
denoiser executes on the CPU and we pay for the CPU<->GPU round trip to
memory, so this is not realtime, as one might expected. And is just a
temporary implementation until OIDN supports GPU execution.
This is different from the CPU implementation in that it doesn't use the
auxiliary passes if they were not provided, because using an inflated
buffer of an undefined value doesn't make much sense.
Pull Request: blender/blender#107375
In Vulkan it is not allowed to allocate a buffer of zero bytes. This
would generate an error. In Blender it is possible that a buffer is zero
bytes. For example when the draw manager is drawing instances and there
are no instanced in the scene.
This PR ensures that at least a single byte is allocated in order to not
fail later on.
Co-authored-by: Jeroen Bakker <j.bakker@atmind.nl>
Pull Request: blender/blender#107731
Vulkan coordinate system is flipped compared to OpenGL. This PR
flips the drawing when drawn to the on-screen frame buffer.
Offscreen frame buffers are still drawn upside down.
The flipping is done by making the viewport of the framebuffer negative.
Pull Request: blender/blender#107743
Geometry Nodes strives to reduce template usage in code,
to use it only for extremely important loops or for template math
processing on attributes. Due to this, this pull request cleans up
to delete template classes and uses `convert_to_static_type` in
accumulate function directly.
Pull Request: blender/blender#104440
This was set to a higher value than intended, because the actual caching
doubles the size internally. So it would keep up to 512 previews in
memory which is a bit excessive. See discussion in #107711.
79f1cc601c introduces a ray-offset to improve ray tracing precision near
triangle edges, but motion triangles still read the static vertices,
causing incorrect intersection detection
Pull Request: blender/blender#107748
When resyncing linked liboverride data, new IDs may be created that do
not exist in actual library file (since the lib file has not been resynced).
If such 'virtual linked liboverrides' data-blocks are used locally (e.g.
by adding such object to a local collection), on next file read they will be
detected as missing.
Now resync code will list such missing linked IDs that were
liboverrides, and try to re-use them when matching (by root name and
library) with newly generated virtual liboverrides.
The process may not be 100% perfect, especially a perfect one-to-one
remapping cannot be ensured if source data keep being changed over and
over (because of the order in which virtual linked liboverrides
generated by resync may change over time). However, in practice this
should fix the vast majority of issues, especially if sane naming
practices are used on IDs.
---------------
For the record, an attempt was made to write liboverride data together
with the placeholders for linked IDs in .blendfile. In theory, this
should ensure a perfect and fully valid re-usage of such IDs.
However, for this to work, not only the liboverride data of linked IDs need
to be written on disk, but also all ID references in this data has to be
considered as directly linked, to ensure that such liboverride data can
be re-read properly.
Otherwise, these placeholders would get a liboverride data with NULL ID
pointers, which is useless.
Such change feels way to intrusive for the very limited benefit, so for
now would consider current solution as the best option.
Pull Request: blender/blender#107144
Add a notifier when setting `scene.cursor.matrix`. This was already in
place for `cursor.location` and `cursor.rotation`, but was still missing
for `cursor.matrix`, which caused the cursor to remain displayed in its
old transform.
Vulkan test cases uses SRGB conversion. These test cases where failing
as the conversion table wasn't initialized.
This PR initializes the conversion table and fix the Vulkan data
conversion tests.
This would iterate over all files and call the sneaky `filelist_file()`,
meaning each file would be added to the cache for a minor query. That's
plenty of unnecessary work and kinda defeats the purpose of the partial
cache design.
`filelist_file()` is an easy way to do a bunch of unnecessary work and
fill the file browser caching for little reason. Unfortunately the
caching affects too many things to be a mere API implementation detail,
so rather be clear about this and point out alternatives.
The details on the file cache lookup just look confusing and make the
function look daunting. Encapsulate it into a function so it's trivial
to see what's going on
This case was not properly handled by the previous fix in #107621.
The viewer node path function still assumes that the node editor space
has a valid ID pointer (`snode.id`) and that it is an `Object`.
The ID pointer can be null when setting a pinned node tree through the
python API, like so:
```Py
space.pin = True
space.node_tree = some_other_node_tree
```
In this case the `ED_node_tree_start` function is called without and ID
pointer, which is allowed! This patch makes sure that the viewer node
path function is only used with a valid object context.
Pull Request: blender/blender#107737
Fixes crashes in timeline and spreadsheet editors during simulation
nodes baking:
* Timeline tries to access the `states_at_frames_` list of the cache to
determine which frames to draw as baked. This can collide with the
baking thread. Needs a mutex to safely access the cache state.
Note: the old point cache has a pre-allocated flag array
`cached_frames` which the baking thread writes into while timeline is
reading it concurrently - not thread-safe but harmless.
* Spreadsheet keeps a data pointer during drawing, which may become
deallocated when the cache is updated. Common approach here is to use
`G.is_rendering` to lock the editor while baking.
Pull Request: blender/blender#107621
Remove the assumption that quaternions are always fully keyed in a pose
asset. Even though quaternions really should be fully keyed, better not
make Blender crash when this assumption doesn't hold.
If the quaternion is only partially keyed, the other components are taken
to be from the unit quaternion (`[1, 0, 0, 0]`) and the result is
normalized before blending into the existing pose.
This fixesblender/blender-addons#104591, which was reported against the
pose library add-on, but actually was caused by an issue in Blender.
Adds a new operator that resets caches and then iterates from the start
frame to the current frame in order to update caches.
Pull Request: blender/blender#107627
The maximum delta time is still capped to one frame even if multiple
frames are skipped. Passing in a too large delta time is mostly unexpected
and can reduce the stability of the simulation. Also it can be very slow
when the simulation uses the delta time to determine e.g. how many particles
should be added.
Other shared libraries already do this, but for TBB it was off by default.
The conflict would happen when LD_LIBRARY_PATH is set which overrides rpath,
either manually by the user or by the Steam launcher.
Ref #107385, #104895
Pull Request: blender/blender#107587
The `NC_SCENE | ND_FRAME` was originally added so that the sequencer
preview is redrawn so that the fps stops showing (2855485565).
Using this specific notifier has the side effect that it also causes a depsgraph
update in `wm_event_do_notifiers`. However, that is not necessary just to
trigger the redraw. Using the `NC_SPACE | ND_SPACE_SEQUENCER` notifier
also triggers the redraw without causing a depsgraph update.
The sequencer has a feature where it only draws a preview while scrubbing.
This was introduced in 8abdc89912.
When scrubbing ends, the sequencer requires an extra update so that the
non-preview version is shown again.
This is only needed by the sequencer and hence the update should not be
done if the sequencer is not used.
Changing `screen->scrubbing` is moved out of the sequencer specific
functions, because it's used elsewhere as well.
Previously, there was always a depsgraph update when the mouse moves
while scrubbing in the timeline. Even when the mouse movement does
not change the actual frame. This can happen when e.g. the mouse first
hovers over frame 5.2 and then it moves to frame 5.3. In both cases the
actual frame is rounded to 5, so no update is necessary (that is unless
subframes are used).
Part of #59244
This was heavily requested since there are a lot of usages of
`operator_menu_enum` around in our UI [and these menus all cannot be
added to Quick Favorites atm.].
The following are just a small sample from the 3D viewport menus (object
mode), but there are many more.
- Object
-- Set Origin
-- Relations >> Make Local...
-- Convert To
- Add
-- Grease Pencil
-- Empty
-- Force Field
-- Collection Instance
- Select
-- Select All by Type
-- Select Grouped
-- Select Linked
- ...
So in order to make this work, `USER_MENU_TYPE_OPERATOR` /
`bUserMenuItem_Op` is reused (but extended with a string to the property
in question). (Alternatively, a new type could be introduced -- but
would share most of the code with the type that is reused in this
patch).
Depending on being used with an enum or not [detected by the usage of
that new string] we then either call `uiItemFullO_ptr` or
`uiItemMenuEnumFullO_ptr` in `screen_user_menu_draw`.
NOTE: support for other enums (property enums such as pivot point or
transform orientations) will follow in a separate commit (building upon
6a13b6324b, trying to solve the way these draw as menus)
NOTE: opening User Preferences with such "new" Quick Favorites even
works (just not drawn with a menu)
Pull Request: blender/blender#107616
Replace MAXPATHLEN with FILE_MAX, always allocate if the buffer isn't
big enough since creating a truncated directory isn't useful.
Having some code-paths only run in an ifdef complicated the code
and made it more difficult to follow.
Also assert the path doesn't contain ".." directories as they aren't
supported.
Renamed geometry node "Face Is Planar" to "Is Face Planar"
so that the name in the menu and in the node are the same.
Translations now also works as expected.
Pull Request: blender/blender#107713
- The official spelling of FFMPEG is FFmpeg (upper, then lower case).
- The normal vector copy and paste operators shoud be singular because
they can only be used on a single element.
- The "Parent File" file browser operator goes up one level in the
file hierarchy. It should be called "Parent Directory", like the
current description "Go to the parent directory".
- "Mass Vertex Group" used to define the mass, but was reused at some
point and now actually defines cloth pinning so it should be called
"Pin Vertex Group", as in the UI.
- The Transformation constraint's Map To Type suffered from a
typo (probably of -> on).
- "Fall-off" is more commonly spelled "Falloff".
- "Effected" should really be "Affected" in this case.
- Rephrase the descriptions for the curve painting tools drawing
plane, which did not seem to match what the settings do. Namely,
they allow selecting in which plane to draw curves using the Curve
Draw tool.
Reported by @Joan-Pujolar in #43295:
- Force exporting animation on every objects [objects singular]
- Color of the interface widgets text insertion cursor (caret) [delete
interface widgets]
- Index of active aov [AOV in uppercase everywhere else]
- Does this tool use an painting canvas [an]
- This script was written Blender version %d.%d.%d ["for" missing
before "Blender"]
- [fcurve -> F-curve]
- unknown error stating file [statting]
- Offset into each stroke before the beginning of the dashed segment
generation [Two spaces between of and the]
- Find the nearest element in the a group. [either "the" or "a"]
Pull Request: blender/blender#107699
- Don't duplicate/allocate the path on each recursion,
instead make a single copy which is modified in-place.
- Move slash-stepping to a BLI_path utility function that accesses
the end position of the parent directory, handles multiple slashes
and '/./'.
Only use the term len & maxlen when they represent the length & maximum
length of a string. Instead of the available bytes to use.
Also include the data they're referencing as a suffix, otherwise it's
not always clear what the length is in reference to.
Reserve the term `len` for string length, some functions used this for
an string/array length, others a destination buffer size
(even within a single function declaration).
Also improve naming consistency across different functions.
Support string size debug so it can be used for regular development.
It works be writing values into strings, ensuring the buffer size
given is actually available. Developers can use this with memory
checking tools such as ASAN/valgrind to force an error when
the value used for the size of a buffer is larger than the buffer.
Resolve remaining issue with RNA using BLI_strncpy* in generated
callback functions where the size argument didn't represent the
size of the destination buffer.
This is automatically enabled along with ASAN for the
blender_developer.cmake configuration.
Ref PR !107602.
`sinf(float_angle)` is sometimes producing different results on
x86_64 cpus and apple silicon cpus. Convert to double precision
to increase accuracy and consistency.
Partial fix for #104513. More to come.
This addresses the 'liboverrides still tagged for resync after resync
process' error reports.
Turns out, this situation is (unfortunately) normal in some rare cases,
hwne the hierarchies in the liboverride and the reference data have
drastically diverged.Since the detection of liboverrides to resync, and
which one are valid partial resync roots, happens on the 'old' override
hierarchy, it may not match the actual hierarchy recreated from the
reference data, leading to some part of it being ignored by the resync
code.
There is no real way to avoid this situation, the only thing that can be
done is detect it, and re-process the resync code again when it happens.
From quick limited tests in (extremely dirty/outdated) Pets production files,
most of the time only one resync process is needed. Worst case so far
required 5 reprocessing of the same set of data.
There is no error messages from resync anymore in these tests, so at the
very least resync process should now be significantly more reliable than
before...
This issue tackled here is essentially the same as in ac1ac6be9a
(recursive Purge of unused IDs could delete actually used IDs): handling
of dependency loops is extremely delicate...
This commit essentially rewrites from scratch the code that ensures that
all liboverrides and their dependencies that need it are tagged for resync,
and identifies the partial resync roots.
Dependency loops whitin a hierarchy make this process very complex, as
they can lead to having to recursively process more than once some IDs.
Partial resync roots are also a source of complexity, since some IDs may
be detected a potential roots, and later as dependencies of another
partial resync hierarchy.
This new code generates waaaaaayyyyy less error messages when resyncing
nightmare-like production files (i.e. production files which libraries
have been _heavily_ modified). There are still a few error reports in
some cases though, which are the synptoms of another issue that will be
fixed in the next commit.
While in practice this was probably not a big issue (since usually e.g.
objects used by a nodetree would also be used by other objects or
collections in the liboverride hierarchy), in some corner cases it could
have caused missing 'tag for resync' and improper partial resync roots
detection.
Introduces "Optimal" packing, where the layout is a theoretical
best possible for a given input.
e.g. https://erich-friedman.github.io/packing/squinsqu
Also calls multiple packing algorithms, and chooses the best one.
Fix several issues found while investigating missing browser thumbnails.
TIFF, PSD, and PNG now use their old file check code. This is due to
OIIO not having an early-out check within `.open`. Calling `.open`
required a large portion of the file to be available (more than 8192
bytes). The code here can be removed in the future if/when a new API is
available which alleviates this problem.
PSD files often carry along a large blob of ICCProfile metadata.
Attempting to roundtrip this metadata when we cache the thumbnail to
.png was leading to problems. We suppress this metadata now as ICC
profiles are not supported in general and are quite large.
Lastly, even after the mentioned new API is available, OIIO will want to
validate the full header of some file formats. DPX is the largest at a
full 2048 bytes so we must have this as our minimum now too. OS's should
be servicing this read call just as efficiently as when using 64. I
could spot no performance difference here at least.
This was missed during development because Blender will cache thumbnails
into a special .thumbnails directory and the images I was using to test
had already been cached there.
Pull Request: blender/blender#107515
The goal of this change is to make it so the emitters are not forced
to have MIS disabled when shadow linking in used. On the user level
it means that lights sources sources which are behind excluded shadow
blocker will be visible in sharp glossy reflection.
In order to support this an extra shadow ray is traced in the direction
of the main path, to gather contribution of emitters behind shadow
blockers. This is done in the two new kernels.
First kernel performs light intersection to see if the extra shadow
ray is needed. It is not needed if, for example, there are no light
sources in the direction of the main path.
The second kernel shades the light source and generates the actual
shadow path.
Such separation allows to keep kernels small (so that no intersection
and shading happens in the same kernel). It also helps having good
occupancy on the GPU: the main path will not wait for the shadow
kernels to complete before continuing (the main path is needed by the
extra shadow path generation, to have access to direction and shading
reading state).
Current implementation is limited to lights only: there is no support
of mesh lights yet.
The MIS weight of the new shadow ray needs to be double-checked. It was
verified to give same result as the main path when the same light is
hit.
To avoid contribution from the same light source counted by the shadow
ray and the main path the light source which was chosen to trace the
shadow ray to is excluded from intersection via transparent bounces.
This seems unideal and feels that it could be done via some MIS wights
as well. Doing so is an exercise for later.
The kernel naming could be improved. Suggestions are welcome.
There are also quiet some TODOs in the code. Not sure how much of those
must be resolved prior to merge to the cycles-light-linking branch.
Would be cool to have extra eyes on some of the MIS aspects, which is
easier in the shared branch.
Tested on the CPU and Metal on M2 GPU.
Ref #104972
Pull Request: blender/blender#107439
This patch will add support to select all channels between active channel
and last-clicked channel without deselecting previous selection. `Shift` key is
now assigned for the range selection and `ctrl` key to extend the selection. This
changes will make multi-selection similar as outliner tree-elements. New function is
created `animchannel_select_range` to handle the range selection of channels.
Old Differential revision: https://archive.blender.org/developer/D17079
Pull Request: blender/blender#104565
The current implementation goes like this
* default to a 0-1 range
* you can set `is_bidirectional` to get a -1/1 range
* if the slider is bidirectional the overshoot goes both ways, otherwise only on the positive side
The issue is that it is not possible to have a 0-1 range but overshoot both ways.
This is useful for example on the "Blend to Default" operator, where 0 means current position and 1 default.
But overshoot also makes sense for this operator since the other way just scales away from default.
So this patch:
* removes `is_bidirectional`
* adds `float range[2]` to `tSlider` and a setter for it
* rewrite some logic to handle arbitrary ranges
* split the `allow_overshoot` flag into one flag for either side
Pull Request: blender/blender#107406
This will make further changes for light linking easier, where we want to
build multiple trees specialized for each light linking set.
It's also easier to understand than the stack used previously.
Pull Request: blender/blender#107560
* add const where possible
* reduce calls to `ED_slider_factor_get` and instead store that in `const float factor`
* rename variables from camel case to snake case, using full words, to conform to naming convention
* use interpf where possible
no functional changes
Pull Request: blender/blender#107610
Was a mistake in the kernel features check flag.
Noticed when running the regression test suit with forced
shadow linking:
light_linking.runtime.blocker_shadow_set = 1;
light_linking.runtime.shadow_set_membership = 2;
Pull Request: blender/blender#107649
Conditional blocks introduce scopes that need to be kept track of,
linear code is easier to follow. So use early exiting (`continue`s in
this case) to reduce cognitive load, a number of devs consider this good
practice.
There is no advantage in using BLI_strncpy/BLI_strncpy_utf8 when the
destination string has been allocated and won't be concatenated.
Also no need to calloc memory which is filled by strcpy afterwards.
Previously accessing the extension needed to ensure an extension
on an empty path.
This conflicted with DEBUG_STRSIZE as it was assumed the input was
FILE_MAX, where as it was a small buffer with RNA, see: !107602.
Resolve by separating the function that ensures the extension
with the function that finds valid extensions for a format.
Also pass the size of the filepath to functions that ensure the
extension.
To prevent invalid links, simply disable them for this socket type.
Other nodes with such sockets may appear in the future.
Pull Request: blender/blender#107628
Flickering observed when snapping to edge or face with axis constraint.
It was probably introduced in 4eda60c2d8
The snapping code has a timer, so `t->tsnap.snapElem` isn't always set.
So avoid changing the value of `t->tsnap.snapElem`.
Rather than forcing the user to initiate a transform operation to edit the `Proportional Size`, allow editing of the `Proportional Size` through the UI.
The affected headers are:
- View 3D
- Dop Sheet
- Image Editor
- Graph Editor
- Mask Editor
Pull Request: blender/blender#107507
For derived mesh triangulation information, currently the three face
corner indices are stored in the same struct as index of the mesh
polygon the triangle is part of. While those pieces of information are
often used together, they often aren't, and combining them prevents
the indices from being used with generic utilities. It also means that
1/3 more memory has to be written when recalculating the triangulation
after deforming the mesh, and that the entire triangle data has to be
read when only the polygon indices are needed.
This commit splits the polygon index into a separate cache on `Mesh`.
The triangulation data isn't saved to files, so this doesn't affect
.blend files at all.
In a simple test deforming a mesh with geometry nodes, the time used
to recalculate the triangulation reduced from 2.0 ms to 1.6 ms,
increasing overall FPS from 14.6 to 15.
Pull Request: blender/blender#106774
Conditional blocks introduce scopes that need to be kept track of,
linear code is easier to follow. So use early exiting to reduce
cognitive load, a number of devs (including myself) consider this good
practice.
Gesture face set selection (box and lasso selection) didn't respect hidden
faces, causing selection to bleed unexpectedly, now fixed.
Pull Request: blender/blender#107575
* remove "Keyframe" label from the Key menu
* "Jump To Keyframe" -> "Jump to Selected"
* added a new menu "Density" with Decimate, Sample and Clean operators
* removed the "Clean Channels" entry. It does the same as the "Clean" operator but also removes channels IF the remaining keys are at the default value. The feature is still available in the redo panel
* Split the slider operators out by functionality
* Move Euler filter to Channel menu
* Remove "Add F-Curve modifier" from Key menu (it already is in the Channel menu)
* Move Bake/Unbake Curve functions to Channel menu
* Move "Bake Sound to FCurves" to Channel menu
Pull Request: blender/blender#106113
Apple Silicon uses tile rendering and can discard tiles if it
is covered. The retopology overlay made some changes to the
shader that introduced some blocking and striping artifacts when
the overlay was disabled.
This PR changes the minimum used offset to reduce the drawing
artifacts. Tweaking the GLSL shader itself didn't work.
Fix#105830
Pull Request: blender/blender#107611
The simulation cache is allocated lazily during evaluation when the
depsgraph is active. However, during rendering, the depsgraph is not
active, so it's not created.
This is a really rough implementation. Since the MSL sources
do not correspond 1:1 to the GLSL sources, some mapping is
needed to retreive the GLSL source file for a given generated
line. This will be implemented in a later commit.
This addresses #95855 by prioritizing the selection of keys in the following order:
1. Keys on the active curve.
2. Keys on any selected curve.
3. Other keys.
Additionally, this fixes an as-yet unreported issue where you couldn't select the main vertex of a key if it was overlapping with another one and one or more of its handle vertices were already selected. This was due to the selection status of a key and its handles not being properly considered separately.
Pull Request: blender/blender#107223
Previous GHOST_ContextVK would create a logical device for each
context. Blender uses multiple contexts at the same time and wasn't able
to share resources between them as the logical device where different.
This patch will create a single logical device and share them between
multiple contexts. This allows sharing memory/shaders between contexts
and make sure that all memory allocations are freed from the device it
was allocated from.
Some allocations in Blender are freed when there isn't a context, this
was failing in the previous implementation. We didn't noticed it before
as we didn't test multiple contexts.
This patch also moves device specific data structures from VKContext to
VKDevice like the descriptor pools, debug layers etc.
Pull Request: blender/blender#107606
- Names ending with len sometimes referred to the buffer size.
The same names were used for both buffer size and string length
depending on the function in some cases.
- Rename str/string to path for generic path functions.
- Rename BLI_path_rel arguments (file, relfile) to (path, basename)
as it wasn't so clear which is being made relative, `file` can be a
directory so rename to `path` (matches naming for BLI_path_abs).
The size limit used in RNA string access wasn't meaningful as the size
of buffers passed into these functions is defined by the length+1 which
uses strlen, unterminated strings would already cause a buffer overflow.
Note that strcpy for accessing RNA is already widely used,
there were just some cases that used BLI_strncpy too.
This also removes use of BLI_strncpy_utf8 in texture slot access as
names are expected to be utf8, sanitizing when copying in this
particular case doesn't make sense and isn't done elsewhere.
- Avoid inline ifdef checks for DEBUG_STRSIZE
- Add BLI_string_debug_size_after_nil to ensure strings to manipulate
have the expected buffer size after the nil terminator.
- Add checks to more string manipulation functions.
Further changes are required for this to be enabled during regular
development as the RNA currently allocates the strings length but
passes in the buffer size as a limit which conflicts with DEBUG_STRSIZE.
The grab tool in Grease Pencil sculpt mode doesn't work correctly on strokes affected by modifiers.
You had to grab over the original vertex positions to see any effect.
Pull Request: blender/blender#106744
The fact that blenlib doesn't know about the set of attribute types is
actually an important detail right now that can influence how things
are designed. Longer term it would be good to consolidate many of
these attribute propagation algorithms anyway.
The "Evaluate at Index" and "Sample Index" nodes are exactly the same
once they retrieve the values to copy and the indices (apart from the
clamping option anyway). This also allows devirtualizing the index input
in the evaluate at index node like the sample index node.
The logic in the initial commit (97dd107070) was broken in some cases,
and would end up tagging as unused IDs that had valid usages. It is
reverted by this commit..
For this new solution to #98029 (deleting unused archipelagos of data),
the logic handling dependency loops detection is reworked to rely on a
new tag in the relations entry of the relevant IDs, instead of
pre-tagging as unused the ID itself.
Further more, when a dependency loop is detected, the IDs in it cannot
be immediately tagged as unused, since it may be that the entry point
of that loop is later detected as actually used. So their relations
entries are not tagged as processed, and only the entry point of the
potential archipelago can be checked in that case, outside of the
recursive processing of dependencies.
The other IDs of the archipelago will then be processed again later, in
a state where at least one ID in the archipelago has a known state for
sure, which then allows for a safe evaluation of the other related data.
This commit should be backported to 3.3LTS.
Fixed bug where texture alpha was incorrectly remapped to red when exporting material shaders.
Now connecting the UsdPreviewSurface 'opacity' input to the UsdUVTexture 'a' output if the Blender texture image node source socket identifier is 'Alpha'.
Changes include the following:
The InputSpec::source_name struct member was removed, as the connection source name is now determined at runtime based on the Blender node input socket identifier.
The traverse_channel() utility function now returns a bNodeLink*, so that the source socket identifier can be queried from the link.
In create_usd_preview_surface_materia(), the code for creating and connecting a UsdUVTexture shader was reorganized to group it within one conditional block, to make it easier to follow. Also replaced a call to a deprecated version of UsdShadeInput::ConnectToSource().
Pull Request: blender/blender#107022
Change the implementation of the raycast and sample nearest surface
node to split separate loops into separate multi-functions. This
clarifies the task of each function, gives more information to the
field evaluator, and gives more opportunity for memory reuse.
Sampling mesh attributes with triangle barycentric weights is now
implemented in a single place. Two other new multi-functions
handle conversion of sampled positions into barycentric weights.
Normalizing the ray directions for the raycast node is split out
too, so it can be skipped in some cases in the future.
The mesh attribute interpolator helper class is also removed,
since it didn't give much benefit over a more functional approach.
I didn't notice a performance improvement from this change.
Pull Request: blender/blender#107563
This adds support for building simulations with geometry nodes. A new
`Simulation Input` and `Simulation Output` node allow maintaining a
simulation state across multiple frames. Together these two nodes form
a `simulation zone` which contains all the nodes that update the simulation
state from one frame to the next.
A new simulation zone can be added via the menu
(`Simulation > Simulation Zone`) or with the node add search.
The simulation state contains a geometry by default. However, it is possible
to add multiple geometry sockets as well as other socket types. Currently,
field inputs are evaluated and stored for the preceding geometry socket in
the order that the sockets are shown. Simulation state items can be added
by linking one of the empty sockets to something else. In the sidebar, there
is a new panel that allows adding, removing and reordering these sockets.
The simulation nodes behave as follows:
* On the first frame, the inputs of the `Simulation Input` node are evaluated
to initialize the simulation state. In later frames these sockets are not
evaluated anymore. The `Delta Time` at the first frame is zero, but the
simulation zone is still evaluated.
* On every next frame, the `Simulation Input` node outputs the simulation
state of the previous frame. Nodes in the simulation zone can edit that
data in arbitrary ways, also taking into account the `Delta Time`. The new
simulation state has to be passed to the `Simulation Output` node where it
is cached and forwarded.
* On a frame that is already cached or baked, the nodes in the simulation
zone are not evaluated, because the `Simulation Output` node can return
the previously cached data directly.
It is not allowed to connect sockets from inside the simulation zone to the
outside without going through the `Simulation Output` node. This is a necessary
restriction to make caching and sub-frame interpolation work. Links can go into
the simulation zone without problems though.
Anonymous attributes are not propagated by the simulation nodes unless they
are explicitly stored in the simulation state. This is unfortunate, but
currently there is no practical and reliable alternative. The core problem
is detecting which anonymous attributes will be required for the simulation
and afterwards. While we can detect this for the current evaluation, we can't
look into the future in time to see what data will be necessary. We intend to
make it easier to explicitly pass data through a simulation in the future,
even if the simulation is in a nested node group.
There is a new `Simulation Nodes` panel in the physics tab in the properties
editor. It allows baking all simulation zones on the selected objects. The
baking options are intentially kept at a minimum for this MVP. More features
for simulation baking as well as baking in general can be expected to be added
separately.
All baked data is stored on disk in a folder next to the .blend file. #106937
describes how baking is implemented in more detail. Volumes can not be baked
yet and materials are lost during baking for now. Packing the baked data into
the .blend file is not yet supported.
The timeline indicates which frames are currently cached, baked or cached but
invalidated by user-changes.
Simulation input and output nodes are internally linked together by their
`bNode.identifier` which stays the same even if the node name changes. They
are generally added and removed together. However, there are still cases where
"dangling" simulation nodes can be created currently. Those generally don't
cause harm, but would be nice to avoid this in more cases in the future.
Co-authored-by: Hans Goudey <h.goudey@me.com>
Co-authored-by: Lukas Tönne <lukas@blender.org>
Pull Request: blender/blender#104924
Adds support for Storage buffers, including changes to the resource
binding model to ensure explicit resource bind locations are supported
for all resource types.
Storage buffer support also includes required changes for shader
source generation and SSBO wrapper support for other resource
types such as GPUVertBuf, GPUIndexBuf and GPUUniformBuf.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#107175
Loading a font in BLF would search a list of directory presets
however these presets were never used.
Remove them as all callers pass in full paths.
Also rename FontBLF::name to mem_name as it's only needed as an ID
for in-memory fonts (to prevent them being loaded multiple times).
Non-unique font loading now compares against the filepath or mem_name
when loading from files or memory (before both used `name` which was
often the filepath, sometimes the full ID-name).
- Rename name/filename/path to filepath when it's used for full paths.
- Rename name/path to dirpath when it refers to a directory.
- Rename file to filepath or path (when it may be a file or dir).
- Rename ImBuf::name & anim::name to filepath.
Rename BLI_make_existing_file to BLI_file_ensure_parent_dir_exists.
The previous name read as if it would make (touch) the file,
where as it ensures the directory component of the path exists.
Move from BLI_path to BLI_fileops as path utilities should only
manipulate paths and not deal with file IO creation
(this has more in common with BLI_file_touch for e.g.).
A NULL defname would early exit (doing nothing) this isn't good behavior
as this function should always make the name unique and a NULL defname
is likely an error in the code which would allow duplicate names.
This is also inconsistent with BLI_uniquename_cb which always
wrote the defname into the name if it was empty.
Mark this argument as never-NULL.
Explicitly list ATTR_NONNULL indices in most cases so it's explicit
that arguments aren't NULL (and adding new arguments that can be NULL
isn't such a hassle).
The helper function `move_key` did exactly the same things as `BKE_fcurve_keyframe_move_value_with_handles`
It was only created because I wasn't aware that such logic already existed
No functional changes
Pull Request: blender/blender#107402
The slider operators in the Graph Editor were missing operator flags for the cursor wrapping to work.
I've added it to the operators that allow overshoot, because for those it is really important to have no limits on scrolling.
Pull Request: blender/blender#107435
In some cases the Geometry Nodes Volume Cube generates
a Volume grid that doesn't contain any leaf nodes. This can happen
when only tiles are needed to represent the volume.
This PR changes the `empty_grid` check function to also check if
there are any active tiles in the grid before returning `true`.
Pull Request: blender/blender#107551
Allow mouse text selection and cursor positioning to work correctly
when the text box has overflow mode set to "Scale to Fit."
Pull Request: blender/blender#107510
Now, when link drag search is used to create new input value nodes, it
also moves socket values into node storage. This means, by design, that
result of evaluation on node tree will not be changed. For data blocks,
the original value is set to null, thus avoiding the existence of
unused pointers.
Right now a few nodes (in shader in many cases) are implemented without
node storage, but by storing value in socket itself. Float value input
node is unsupported in this way too.
Pull Request: blender/blender#107470
Found investigating #107420.
Steps to reproduce were:
- remove all objects from the scene
- add rigid body world
- bake
- crash
BKE_ptcache_bake would assume a cache can always be found, but with an
empty rigid body world this is not the case -- accessing flags would then
crash.
Now just check if we actually have a cache.
Pull Request: blender/blender#107537
`ptcache_baker_create` falsely assumed the PointCache owner id is always
an **object**, but when baking rigid body world it is a **scene**. Code
would cast the ID to an object and passed that to `BKE_ptcache_id_find` /
`BKE_ptcache_ids_from_object` (which can get terribly wrong -- reading
_something_ on the scene as something from the assumed object).
Prior to f61ff22967 this was less likely to be a problem, but that
commit introduced a `DrawDataList` into the `struct Scene`. In the file
from the report, this would lead to `foreach_object_particle_ptcache`
now recognizing garbage memory as a particle system, accessing its
`ParticleSettings` `phystype` would then crash (buffer-overflow).
Now pass a NULL object to `BKE_ptcache_id_find` in case we are having a
scene, following code still handles rigid bodies just fine (the scene is
actually passed separately as well).
Pull Request: blender/blender#107536
Vulkan spec only wants to have a single aspect bit when a texture
contains both a stencil and a depth part. As for Blender depth
is more used than stencil we standardize to depth aspect.
Pull Request: blender/blender#107542
In some cases, some partial resync roots would be missed during the
partial resync process, leading to incomplete resync of all the needed
data.
This was caused by tagging some liboverrides for resync _after_ they had
already be evaluated as part of parenting hierarchy of other
liboverrides. Fix is simply to split both steps apart, such that all IDs
that need it are tagged to resync first, and then hierarchies are
evaluated to find the required partial resync roots whithin a hierarchy.
This commit mainly addresses issues when a part of an override hierarchy
does not match anymore the linked reference data, and gets isolated form
the hierarchy root (there is no parenting chain to the root anymore).
The typical case being an object or sub-collection being moved to
another subcollection in the linked data.
Case identified while working on some Pets production files.
Note that in some cases this isolated chunk of the hierarchy will be
linked back into the appropriate place, in others it should be fully
removed (instead of staying as unused data). The later will be handled
in a another future commit.
This commit mainly detect and use a new tag for such cases, and correct
the checks to take it into account.
It also does a bit of cleanup, and replaces some asserts by `CLOG_ERROR`
reports.
Due to index-only referencing in insertion of new NLA tracks in
liboverride data, it may happen that the source of an inserted track
cannot be found.
This index-only based handling of NLA tracks in liboverrides is very
weak, in the future this will be solved by ensure uniqueness of their
names, then name-based reference can be used instead, as already done with
modifiers, constraints, etc.
Code was exposing apparently internal functions to the public header, so
it could reuse it in other View2D files. Worse even, a struct was
defined twice in different source files and they would have to be kept
in sync, just because there is no shared header file.
Such internal header files are useful and don't really cause any harm.
This fixes a crash where merging vertices by distance leads to a crash since
0652945dbd. The change did not cause
the bug though, it just made the underlying issue visible.
The issue was that `kdtree_order` assumed that the `KDTreeNode.index` didn't
have gaps, i.e. every index in a certain range is used. However, that is not the
case when only a subset of the vertices of a mesh are added to the kdtree.
Pull Request: blender/blender#107535
This change is required for 0001485365. File version bump was included
in PR but it was behind the main branch. In main, version was updated
by 5d0595fded.
get_index_dir passed in the wrong size, also remove strange use of
BLI_path_split_dir_file which copied the directory into `file`,
only to overwrite it with the `file` afterwards.
Modifier name is being displayed as label in panel header which has restricted
the editing of it. This PR will allow to change the name of F-curve modifier
by exposing string property "name"
Included versioning code for modifier name. This will add suffix to the name if
multiple instances of same modifier exists in modifier stack.
Differential Revision: https://archive.blender.org/developer/D17142
Pull Request: blender/blender#104949
A regression since 2d2f4d9d28: the sculpt session is re-used by the
weight paint, so changes to semantic in one place requires same
changes in another.
Before the change the `original` was intiialized to false (due to the
clear-alloc), but after the change it was the accum with an inverted
meaning which was initialized to false.
Pull Request: blender/blender#107533
The existing tooltip of Clear Constraints modifier in object mode
(`object.constraints_clear`) didn't match its functionality. It said it
works only on the active object, but it affects all selected objects.
Hence, the tooltip has been changed from 'Clear all the constraints for
the active object only' to 'Clear all the constraints for the selected
objects'.
Also the tooltip for 'Clear Pose Constraints' in Pose Mode was updated
for consistency with the above update.
Pull Request: blender/blender#106918
This function is changed by #107059 since my original patch in #106417,
so when merged it caused compilation error. Now fixed.
Pull Request: blender/blender#107529
The length passed to IDP_NewString included the nil terminator
unlike IDP_AssignString. Callers to IDP_AssignString from MOD_nodes.cc
passed in an invalid size for e.g. There where also callers passing in
the strlen(..) of the value unnecessarily.
Resolve with the following changes:
- Add `*MaxSize()` versions of IDP_AssignString & IDP_NewString which
take a size argument.
- Remove the size argument from the existing functions as most callers
don't need to clamp the length of the string, avoid calculating &
passing in length values when they're unnecessary.
- When clamping the size is needed, both functions now include the nil
byte in the size since this is the convention for BLI_string and other
BLI API's dealing with nil terminated strings,
it avoids having to pass in `sizeof(value) - 1`.
In some cases comments at the end of control statements were wrapped
onto new lines which made it read as if they applied to the next line
instead of the (now) previous line.
Relocate comments to the previous line or in some cases the end of the
line (before the brace) to avoid confusion.
Note that in quite a few cases these blocks didn't read well
even before MultiLine was used as comments after the brace caused
wrapping across multiple lines in a way that didn't follow
formatting used everywhere else.
This was the code-style Blender used before switching to clang-format
which did not support this style of brace placement at the time.
Since then support was added, this helps readability as the beginning
of braces isn't as clear in the case of multi-line conditionals.
This implements a proposal from #75956.
In some cases the node didn't reproduce the same results given the
same input. Based on the test results (just 2 very detailed cubes
and a transformation), it doesn't seem to affect performance that
much. Credit to @MMMM who pointed out this option.
Pull Request: blender/blender#107312
cc623ee7b0 did not consider some implications such as the habit of
users initiating transform operations just to change the size of the
Proportional Edit.
Therefore, partially revert the cc623ee7b0.
There were a few issues, but they mostly came from the fact that some
versioning was done in the "after linking" versioning, which came after
the regular legacy mesh conversion. Also, the `MFace` array wasn't
necessarily part of CustomData for some very old files.
The `BKE_mesh_strip_loose_faces` function was moved because it now
uses the deprecated `me->mface` pointer.
This PR addresses issue “USD export does not respect opacity threshold for clip alpha blend mode #107062”
This commit extends the USD Preview Surface material support to author the opacityThreshold attribute of materials on export, when the Alpha Clip blend mode is selected.
When authoring alpha cutouts in Blender, one sets the Blend Mode to "Alpha Clip", and the Clip Threshold to some value greater than zero.
When this case is detected on export, we now author the opacityThreshold attribute to match the specified clip threshold.
Note that opacityThreshold is already handled correctly on import, so this change allows the feature to be fully round-tripped.
Co-authored-by: Matt McLin <mmclin@apple.com>
Pull Request: blender/blender#107149
* Perform rotate_inside_square earler in the pipeline. (improved layout)
* #rotate_inside_square with AABB margin if there is only one island.
* Conservative bounds when using xatlas on non-D4 transforms.
* User simpler API names that accept both PTX and OptiX-IR
* New argument for optixProgramGroupGetStackSize, leave to default
* Remove OptixPipelineLinkOptions::debugLevel that does nothing
Pull Request: blender/blender#107450
This patch implements the Mask node for the realtime compositor. The
evaluation of the mask is not GPU accelerated, but is cached as a form
of temporary implementation until we implement a GPU evaluator for
masks.
One limitation currently is that we do not redraw the viewport while the
mask is getting edited by the user, because always doing that will be
redundant in most situations, and conditioning the redraw requires a lot
of work that should be handled outside of this patch.
This is similar to the Texture node implementation in 151a53110c.
Pull Request: blender/blender#107464
The property value should be reset for the next operator execution, not
remembered. Also hide it from auto-generated UIs, this is an internal
property nothing meant for the user to edit.
Also see discussion in #105872.
Users were confused that "Clear Asset" would only act on the clicked on
asset, not the entire selection. They would have to clear them one by
one, which can be quite annoying. The previous commit prepared the asset
clearing operator for this, so all this commit has to do is expose the
selected IDs to context.
Shouldn't cause user visible changes.
Usually batch operations are more handy, so prefer editing multiple
items over a single one. That is, act on the whole selection not the
active item. Mark and clear will now respect this when retrieving IDs
from context, however right now there's no case where actually both
selected and the active ID are exposed in context. Because of this there
shouldn't be a user visible change until the following commit.
When creating a texture view, Metal may require that the original
GPUTexture state is modified in some way. This may be a result
of deferred creation, or, to cache the texture view against the
source.
As a result, GPUTexture passed into GPU_texture_create_view
cannot be const.
Small fixes have also been made in the Metal texture
implementation to ensure correct function of texture views.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#107167
Detecting when to show warnings about GHOST/XKB modifier
mismatches was rather involved, remove the check as it's
unnecessary for Gnome-Shell >= v43.
Older versions of Gnome-Shell will show warnings on window activation
with modifier keys held.
Reading modifiers from XKB caused a complications in getModifierKeys(..)
when called on a window that was activated, before the keyboard enter
handler had run - because the keys held by GHOST had not yet been
updated by XKB. This caused a problem which Gnome-shell which runs
the keyboard-enter handler after window activation.
This change would have fixed the Super key being stuck, see: #107314.
Keep the previous fix since in the unlikely case GHOST & XKB get out of
sync, stuck modifier keys should still be prevented.
This change means the warning for GHOST & XKB getting out of sync
can be enabled for Gnome-shell again, as it was previously suppressed
as it happened frequently on window activation.
Use bl_run_operators to detect cases when operators would crash
when run in an expected context for the following operators:
- GIZMOGROUP_OT_gizmo_select
- GIZMOGROUP_OT_gizmo_tweak
- GPENCIL_OT_time_segment_move
- OBJECT_OT_add_named
- OBJECT_OT_data_instance_add
- OBJECT_OT_drop_named_material
- SCULPT_OT_mask_by_color
- SEQUENCER_OT_delete
- SEQUENCER_OT_rename_channel
- SEQUENCER_OT_retiming_handle_move
- SPREADSHEET_OT_change_spreadsheet_data_source
- UI_OT_drop_color
Note that some of these situations users were unlikely to encounter,
however there were cases script authors could run into such as deleting
sequence strips without a region or masking by color without a 3D view.
While technically valid, a context without a window set can't access
the active object or view layer, causing object mode setting to fail,
making the checks not all that useful.
Use Context.temp_override(..) to set the context's window.
After primary packing is completed, perform a deep earch for any
rotation of the entire layout which improves efficiency even further.
This can sometime provides *optimal* packing results. e.g. When packing
a single island, the layout will now touch all 4 sides of the unit square.
Transform constraints were being drawn on screen without anti-aliasing,
now fixed to make them look smoother.
See #107038
Adding a comparison of before and after the change
Pull Request: blender/blender#107394
When UV Packing with the `fraction` margin method, if the UVs
overflowed the unit square, the UVs could sometimes overlap.
(island_index was incorrect.)
When `scale_to_fit` is enabled, the existing behavior is used,
UVs will be scaled to fill the unit square.
If disabled, UVs will not be rescaled. They will be packed to the
bottom-left corner, possibly overflowing the unit square, or not
filling space.
There were two issues here preventing the proper display of the IES
files in question.
The primary one was that these lights are actually vertical. Their
profiles actually point upwards from 90deg to 180deg but our parser was
trying hard to adjust it to start at 0deg incorrectly.
Lastly, the files in question ended with the parser in the `eof`
state - they are "missing" the final carriage return that other IES
files tend to have but other viewers don't seem to mind. Change the
`eof` check instead for a better one that will indicate if any parsing
errors occurred along the way.
Pull Request: blender/blender#107320
Commit 5c184525ed improved text cursor
placement when text is on a curve, but when not on a curve it is now
on the baseline. This corrects for that, placing 25% below baseline.
Node socket tooltips suffered from several issues.
- Some could not be translated because they were not properly
extracted, so extraction macros were added.
- Some were extracted but included newlines at the end which did not
get translated, such as `ss << TIP_("Geometry:\n")`, changed to
`ss << TIP_("Geometry:") << "\n"`.
- Some translations were not functional, such as:
`TIP_(attributes_num == 1 ? " Named Attribute" : " Named Attributes");`
because `TIP_()` needs to be around a single string.
- Some extraction macros had no effect and were removed, such as:
`.description(N_(leading_out_description));`
This is a no-op macro which can be used only around a string literal.
Pull Request: blender/blender#107257
It arguably reads easier if simple operations like reading from indices
of an array don't each get their own line. Also the same corner
attribute sampling was repeated in a few places. And add a new
function to sample normals from the corner domain, and use
lower level arguments to the lower level functions (i.e. not just
a mesh pointer, but the necessary data arrays).
Usually anonymous attributes are removed earlier, but otherwise
the extrude node can end up doing extra work.We need to retrieve the
propagation set and remove not-propagated attributes. And also fix
a case where in vertex mode, the offsets array could be freed when
the mesh is resized.
Selecting filter in NLA/Graph Editor causes scrolling in the region
below it. This PR makes `UI_but_ensure_in_view` not occur if the block
has UI_BLOCK_CLIP_EVENTS.
Pull Request: blender/blender#107404
MSVC can't optimize it out and even keeps an external call to CRT
function rintf: https://godbolt.org/z/Ex9vjf8vj
It does translate to a real speedup on windows on some scenes, here are the ratios I had on my 13900K:
classroom 101.53%
junkshop 100.71%
monster 100.76%
attic 107.98%
bistro 113.00%
Pull Request: blender/blender#107371
This brings the following improvements:
- Implementation of _MM_SET_FLUSH_ZERO_MODE and _MM_SET_DENORMALS_ZERO_MODE
- Implementation of _mm_round_ss
Does not seem to be any performance impact with just this upgrade.
Pull Request: blender/blender#107396
Since the version v1.5.0 of sse2neon the functionality for denormals
flushing is implemented in the library. This commit makes it so the
_MM_SET_FLUSH_ZERO_MODE and _MM_SET_DENORMALS_ZERO_MODE are used from
the ss2neon if available.
This solves macro re-definition when a newer sse2neon is used.
The change is implemented in a way that both current and new sse2neon
are supported.
A `BitGroupVector` is a compact data structure that allows storing multiple
bits per element, for example 5 bits per vertex. The implementation is
mostly just a wrapper around `BitVector`. There is some additional logic
to make sure that the bit span of every element is bounded (according
to the `is_bounded_span` function). This makes it more efficient to operate
on groups as a whole (e.g. `or` one group into another). In some sense,
this data structure can also be interpreted as a 2D bit array. Functions
like `append` can be added when they become necessary.
The new data structure is used to replace some `MultiValueMap` in
geometry nodes. This simplifies the code.
This can be useful to allow creating these core attributes with shared
arrays. Otherwise CustomData has to be used directly, which is nice
to avoid. This was done in e45ed69349, but not everywhere.
This is consistent with `Span`, and also allows returning a bounded
bit span when taking the front of an existing bounded span, which
can simplify using optimized bit processing.
Pull Request: blender/blender#107441
These aren't propagated as attributes since interpolating them with the
generic rules often gives strange results, and they're intended to as
an optimization. Though theoretically it would be nice if this
copying became more generic in the future.
Most of this patch is by Jacques Lucke, from the simulation branch.
This commit adds generic expression evaluation for bit spans, helping
to generalize the optimizations that avoid processing a single bit
at a time. Operations like "for each 1 index", "or", and "and" are
already implemented in this pull request. Bits in full integers are
processed 64 at a time, then remaining bits are processed all at once.
The operations allow implementing a `copy_from` method for bit spans.
Currently this optimized evaluation is only implemented for simpler
bounded bit spans. Bounded bit spans have constraints on their bit
ranges that make them more efficient to process. Large spans must start
at the beginning of the first int, and small spans must start and end
within the first int.
Knowing these constraints at compile time reduces the number of edge
cases in the operations, but mainly allows skipping alignment between
multiple spans with different offsets.
Pull Request: blender/blender#107408
The `ED_view3d_grid_steps` function creates steps of units other than
those defined in `unit.c`.
This seems to be used for grid drawing in order to draw a unit after
the miles (in this case it would be something like 10 miles).
But that doesn't seem right as it's an undefined unit.
Therefore, the solution is not to create these different unit values.
The change in the overlay is that the softer grid that used to
correspond to 10 miles now corresponds to mile.
Pull Request: blender/blender#107405
No functional changes.
Merge the modal callbacks of the `VIEW3D_OT_move`, `VIEW3D_OT_rotate`
and `VIEW3D_OT_zoom` operators into a single simplified
`view3d_navigate_modal_fn` callback.
Deduplicate code for initialization, also the code for finalization and
the code to get the `event_code`.
Improve support for operation switching by the existing (but unused)
modal keymap items `VIEWROT_MODAL_SWITCH_ZOOM`,
`VIEWROT_MODAL_SWITCH_MOVE` and
`VIEWROT_MODAL_SWITCH_ROTATE`.
Pull Request: blender/blender#106279
BKE_image_ensure_tile_token took only the file name component but used
FILE_MAX to limit the input buffer.
Split this function in two, one that takes the full path as this is the
most common usage and another which takes only the filename.
Both now take a string size argument.
This simplifies the code that works with the `BLI_serialize.hh` header.
The various `lookup` methods do a linear search. If there are only a
few elements that can even be faster than building the map first.
In the future it might be nice to transparently build and cache the
map internally if necessary.
The main goal of these changes is to support checking if some data has
been changed over time. This is used by the WIP simulation nodes during
baking to detect which attributes have to be stored in every frame because
they have changed.
By using a combination of a weak user count and a version counter, it is
possible to detect that an attribute (or any data controlled by implicit
sharing) has not been changed with O(1) memory and time. It's still
possible that the data has been changed multiple times and is the same
in the end and beginning of course. That wouldn't be detected using this
mechanism.
The `ImplicitSharingInfo` struct has a new weak user count. A weak
reference is one that does not keep the referenced data alive, but makes sure
that the `ImplicitSharingInfo` itself is not deleted. If some piece of
data has one strong and multiple weak users, it is still mutable. If the
strong user count goes down to zero, the referenced data is freed.
Remaining weak users can check for this condition using `is_expired`.
This is a bit similar to `std::weak_ptr` but there is an important difference:
a weak user can not become a strong user while one can create a `shared_ptr`
from a `weak_ptr`. This restriction is necessary, because some code might
be changing the referenced data assuming that it is the only owner. If
another thread suddenly adds a new owner, the data would be shared again
and the first thread would not have been allowed to modify the data in
the first place.
There is also a new integer version counter in `ImplicitSharingInfo`.
It is incremented whenever some code wants to modify the referenced data.
Obviously, this can only be done when the data is not shared because then
it would be immutable. By comparing an old and new version number of the
same sharing info, one can check if the data has been modified. One has
to keep a weak reference to the sharing info together with the old version
number to ensure that the new sharing info is still the same as the old one.
Without this, it can happen that the sharing info was freed and a new
one was allocated at the same pointer address. Using a strong reference
for this purpose does not work, because then the data would never be
modified because it's shared.
This patch changes the priority for choosing the active output to
prioritize viewer nodes as opposed to composite nodes. This is done to
better work with the workflow of using the Connect To Viewer operator
and better match the expected behavior from users.
Tapping the OS key to switch windows could cause the OS key to stick.
On window deactivation the OS key was considered held, activating the
window later read the XKB modifier state before the keyboard_enter &
keyboard_modifier callbacks had run.
When they ran later, the mis-match between XKB and GHOST was not taken
into account, causing the OS key to stick.
This adds the ability for users to assign sub-types to `Float` type custom properties (e.g., distance, angle, time, power etc.)
Pull Request: blender/blender#106700
The grain size depends on the algorithm, it doesn't make sense to use
the same value for multiple areas just because they relate to `Mesh`.
The comment mentions OpenMP which isn't used anymore.
Also remove an unused forward declaration.
- Avoid a separate memmove call for each `..`.
- Avoid ambiguous path stepping, where separator literals
needed to be checked to avoid fence post errors.
- Correct & update the doc-string.
The CPU compositor sanitizes the colors after HSV/HSL conversion by
clamping negative values to zero. The realtime compositor did no such
sanitization. This patch fixes that by introducing similar sanitization.
This is implemented by removing the attribute and adding it again with
a different name. In the expected case though, implicit sharing is used
to avoid copying the array.
For now this doesn't rename UV sublayers or replace active/default color
attribute names. It's not clear where that should happen, but for now
things are clearer if those stay at a higher level.
Avoid many small allocations and just allocate all the structs in one
array, which is 4 times faster. In a test with an armature modifier and
custom normals, corner normal calculation went from 2.7 to 2.3 ms.
The various stacks are just filled and then emptied. We also expect
them to be fairly small. A vector can handle these cases fairly well.
Also store indices rather than pointers. I didn't notice any performance
changes from these changes.
Instead of storing a 24 byte struct for every face corner we must do
calculations for, just gather the face corner index in the first single
threaded loop. And don't fill them in chunks and use the task pool API.
Instead just fill vectors and use standard "parallel_for" threading.
The check that avoided threading for tiny meshes becomes redundant this
way too, which simplifies the code more. Overall this removes over
100 lines of code.
On a Ryzen 7950x, face corner ("split"/"loop") normal calculation in a
small armature modifier setup with custom normals went from 4.1 ms to
2.8 ms. Calculation for a 12 million face mesh generated with curve to
mesh with end caps went from 776 ms to 568 ms.
Similar commits:
- 9e9ebcdd72
- 9338ab1d62
interior cuts"
This reverts commit 129f79debe.
That commit changed the behavior of how booleans handled vertex weights
as well and made the CubeMaskFirst test modifier test fail.
Not entirely clear to me what the desired behavior would be (current
situation is "wrong" in certain situations as well I think), but until
this is further discussed with the #modeling-module , I think reverting
is the better choice.
In most of the operators the code that loops through the FCurve segments and draws the status header were pretty much identical.
To combat that, create abstract helper functions that can be used.
They are not useful in all cases, e.g. the blend to default operator needs a bit of special code.
Pull Request: blender/blender#107170
Using the Knife tool, making cuts that split an edge exactly interpolate
fine for vertex customdata (weights or attributes on the vertex domain)
due to `BM_edge_split` taking care of data layers from the edge and
vertex domain (also mdisps -- which unfortunately dont seem to work
well, but that is for another patch...).
However, making cuts _inside_ a face though dont interpolate at all
(giving default values on new vertices).
With this patch, also interpolate vertex customdata in
`BM_face_split_edgenet`.
Pull Request: blender/blender#107367
This patch implements the Corner Pin node for the realtime compositor.
This is different from the existing compositor in that single value
inputs produce single value outputs, instead of assuming the size of the
render.
Pull Request: blender/blender#107363
Use a grain size for the final tree creation/balancing/lookup that
depends on the average size of each tree. When the trees are larger,
fewer trees are processed on each thread and vice versa. I didn't notice
a difference when there are hundreds of thousands of groups, but
when there are few (i.e. around the number of cores), I noticed a 6x
performance improvement, from over 1 second to around 0.2 s.
Note that generally the performance is better with many small groups,
because the creation and balancing of trees is single threaded.
If the Group ID input isn't a single value, it's likely to be a span,
so making sure that's true should generally be free, at least in
most cases. This brought a test with 1 million points from 37
to 34 ms, roughtly an 8% improvement.
Needed for the simulation zone addition to the add menu search.
Link-drag search isn't supported yet, but a similar change should be
possible there.
Now the search item exposed through the public nodes namespace returns
several items directly, and the "after add function" is just handled as
a sub-case of that for convenience.
Check if the man-page is missing or older than files that generate it
before re-running the generator.
Previously the install target would re-run the man-page generator
every time, even when no other changes to the build were detected.
Use consistent variable names: for example "vert" instead of "mv" and
"edge" instead of "me", etc. Also use helper functions like "edge other
vert" to make the code easier to read.
Some fields reference attributes directly. When the referenced attribute
has the requested type and domain, the captured/stored attribute can
share its array, avoiding the cost of duplication and reducing memory
usage, at least temporarily until either attribute is modified.
This only works when the attribute doesn't need validation and when
the selection input isn't used, since those potentially need to change
values in the arrays.
I saw this save 200MB and 11 ms of copying for a simple grid with
16 million points (creating the grid takes about 60ms).
Pull Request: blender/blender#107357
The intersection distance offset in Cycles could have returned
a denormal floating point value for the input values of 0 (and
for the denormal input value).
This could lead to a situation when ray is unable to be advanced
when it hits an edge between two triangles: the intersection will
keep bouncing between two adjacent triangles. This is because the
ray->tmin is compared inclusively, and 0 >= <denormal zero>.
The solution is to return the smallest possible normalized floating
point value from the intersection_t_offset if the input is zero
or a denormal value (which is covered by the same t == 0 check).
This fix is hard to measure on the user level. The old code did
not cause any infinite traversal loop because of the way how the
integration is organized (some kernels offset ray.P, others check
for the number of bounces). It is possible that this fixes some
corner cases of noise: i.e. if some shadow rays falsefully were
considered occluded due to reached maximum number of bounces.
The actual problematic case was discovered during working on a
prototype which had an in-lined intersection loop with the ray
tmin offset.
Pull Request: blender/blender#107364
This patch adds address sanitizer support to memory pools.
when ASAN is enabled the following happens:
* 32 byte red zones are inserted between pool elements.
* The BLI_mempool struct itself is marked as a red zone.
* Access to the pool goes through a thread mutex (except when compiling makesdna).
This is very useful for finding bugs in code that uses BMesh.
Pull Request: #104668
This triggered an assert during evaluation, because the group inputs
were first requested and later the set unused, which is not allowed.
The issue was likely introduced in 258678916f.
This PR adds support for `GPU_unpack_row_length_set` to the vulkan
backend.
Texture unpacking is used when uploading a part of a texture from
host memory to device memory.
Pull Request: blender/blender#107360
A recent change from [0] added an assert when a string lookup was
performed on a collection item with no name-property,
but silently failed with release builds.
This isn't correct in a couple of ways.
The assert makes it seem like the RNA API needs to be updated when
it's in fact valid to have collection items without a name-property.
It also misleads script authors to silently fail since it implies a
key that exists would return a result.
Raise a TypeError exception when string lookups are attempted on
collections that don't support them.
This change also applies to get() & __contains__().
[0]: 5bb3a3f157
While RMB was canceling, the check for Escape was overridden by the
modal keymap, causing Escape to confirm.
Resolve by:
- Removing Escape binding from the modal keymap, rely on hard coded
check as Escape to cancel is an assumption made in many places.
- Move RMB hard-coded check into the modal keymap since it's non-default
keymaps may use mouse buttons differently.
These operators already check for release events matching the event
that launched them.
Also remove hard-coded model keys (rely on the default key-map).
Linear subdivision or interpolating from a lower multires level gave
spikes at some vertices. Caused by incorrect corner edge indexing.
This was simple to solve by building the old MLoop array on demand
and reverting parts of 16fbadde36.
Currently `Mesh to Volume` creates a volume using
`openvdb::tools::meshToVolume` which is then filled with the specified
density and the class set to Fog Volume. This is wrong because
`meshToVolume` creates a signed distance field by default that needs
to be converted to a Fog Volume with `openvdb::tools::sdfToFogVolume`
to get a proper Fog volume.
Here is the description of what that function does (from OpenVDB):
"The active and negative-valued interior half of the narrow band
becomes a linear ramp from 0 to 1; the inactive interior becomes
active with a constant value of 1; and the exterior, including the
background and the active exterior half of the narrow band, becomes
inactive with a constant value of 0. The interior, though active,
remains sparse."
This means with this commit old files will not look the same.
There is no way to version this as the options for external band width
and not filling the volume is removed (they don't make any sense for a
proper fog volume).
Pull Request: blender/blender#107279
This option is true by default, but it can be changed for
any asset library (that may be using Link as import method).
This also fix "Reset to Default Value" for the Import Method
since this was originally not using the defaults.
Pull Request: blender/blender#107345
HIP RT enables AMD hardware ray tracing on RDNA2 and above, and falls back to a
to shader implementation for older graphics cards. It offers an average 25%
sample rendering rate improvement in Cycles benchmarks, on a W6800 card.
The ray tracing feature functions are accessed through HIP RT SDK, available on
GPUOpen. HIP RT traversal functionality is pre-compiled in bitcode format and
shipped with the SDK.
This is not yet enabled as there are issues to be resolved, but landing the
code now makes testing and further changes easier.
Known limitations:
* Not working yet with current public AMD drivers.
* Visual artifact in motion blur.
* One of the buffers allocated for traversal has a static size. Allocating it
dynamically would reduce memory usage.
* This is for Windows only currently, no Linux support.
Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Ref #105538
* Add HIP-RT API functions and library loading
* Add more HIP API types and functions
* Find HIP linker executable in CMake module
* New CMake module to find HIP-RT SDK
Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Ref #105538
These changes enhance the prim_path_mask USD import option to allow masking on multiple paths.
Changed the prim_path_mask import property to a string of arbitrary size.
Multiple paths may be specified in a list delimited by commas or semicolons.
Reviewed by Bastien and Matt McLin.
Pull Request: blender/blender#106974
The code checking whether old liboverrides which have been resynced into
new ones should be deleted was still assuming it was only working on
local liboverrides.
However, since recursive resync was implemented, this is not true
anymore, it can also handle resynced linked liboverrides.
This could have lead to missing deletion of some old linked liboverrides
after resyncing them.
This addresses an issue here at the Blender studio, where a root
collection of a set was removed by mistake from the set library .blend file.
Since all the other linked data (sub collections, actual objects etc.)
of the set were still available, the liboverride resync code went crazy
trying to resync all these scattered pieces of a set, finding new valid
root IDs for the hierarchies, and so on.
So from now on, do not attempt to resync anything that is part of a
liboverride hierarchy which root ID linked reference has gone missing.
`BKE_collection_object_cache_free` can be called from some points in
code (e.g. during ID remapping) where proper parenting relationships
between collections cannot be ensured.
Would be good to check if recursive cache cleanup is actually needed
from these points, it would almost certainly be better and safer to
instead tag parent collections as dirty too, but this will be for
another time.
For now, just add a NULL-check on the parent collection pointer.
This call should be recursive, only freeing cache of immediate parents
of the collection is not enough, the whole parenting chain needs to be
processed.
The function used to be needed for recursing the tree, as the name
indicated. But it has recently been ported to the new tree iterators
so the recursion isn't necessary anymore.
Changes to the internal workings of the VKCommandBuffer:
- Use state engine to track correct usage.
- Switch between render pass/no render pass automatically.
Eventually the command buffer should be rewritten to use custom command
encoding to improve performance.
Pull Request: blender/blender#107337
Make sure that function style, reinterpret_cast, and static_cast are
used for all type conversions, without of casting to void *. Some other
related minor changes: add temporal variables, lost space, asserts for
case to avoid type conversions by using `->id` way.
Pull Request: blender/blender#107097
Group input/output nodes are not listed in search list
after cc925b9282. Similar to 5b2b114a2a
add these nodes in search list with the help of `gather_add_node_search_ops`.
Reviewed by: deadpin, HooglyBoogly
Pull Request: blender/blender#107323
This patch refactors the static cache manager to be split into multiple
smaller Cached Resources Containers. This is a non factional change, and
was done to simplify future implementations of cached resources as they
become more elaborate.
In the GPU_SHADER_2D_WIDGET_BASE the deriviates were assumed to be
positive. This is not always the case. In Vulkan this leads to
incorrect rendering of the widgets due to incorrect SDF values.
This change will ensure that the shader make the ratio variable
absolute.
Pull Request: blender/blender#107327
e7bea3fb6e disabled this.
I do believe excluding `OB_CURVES_LEGACY` is wrong though. While it
_might_ not have real geometry, it certainly _can_ have real geometry,
so now legacy curves are enabled again in `OB_TYPE_IS_GEOMETRY`.
A more elaborate check for real geo on legacy curves could be set up in
a following commit.
Since `OB_TYPE_IS_GEOMETRY` is also used in depsgraph driver handling,
will seek additional review from more devs.
Pull Request: blender/blender#107214
Caused by 3a1cf838ca.
Smooth view transitions only work when an operator is **invoked** (wont
work from **exec**, see `WM_operator_smooth_viewtx_get`).
Now 3a1cf838ca changed the `operator_context` for some other operators
in the menu to 'EXEC_REGION_WIN' (for good reason). But setting
`operator_context` on a `uiLayout` will set context on the **root**
layout (not the actual sublayout alone), so all following operators
"inherited" the [changed] context.
Now make sure following operators get properly invoked again by giving
the right context.
Pull Request: blender/blender#107296
It seems more clear to store the inclusion flag as an enumeration
internally, but on the interface it is more convenient to use a
single click to toggle the state.
With a bit of code the best of both worlds is achieved!
Pull Request: blender/blender#107222
This patch implements the Texture node for the realtime compositor. The
evaluation of the texture is not GPU accelerated, but is cached as a
form of temporary implementation since the Texture node is deprecated
and will be removed in the future. Furthermore, texture node evaluation
is not supported for now.
This patch also introduces the concept of an ID static cache, which
uses the DrawDataList mechanism to invalidate the cache as needed,
consequently, a DrawDataList was added to the Tex ID structure.
An improvement that should be implemented outside of this patch is to
implement support for proxy textures in results to avoid redundant
copies in the execute method of the texture node. This should be
straightforward bit will be implemented in a separate patch.
Pull Request: blender/blender#107291
Fixes a warning on GCC 13 about `uint` being used in the declaration and
the proper enum type `eDupli_ID_Flags` being used in the definition for
`BKE_id_copy_for_duplicate`.
The coarse positions given to the evaluator are skipped if there are
vertices not attached to faces. Use the cache from 8e967cfeaf
to skip that topology query, or even to tell if there are no such vertices,
so we can skip a copy completely. I observed a 12x improvement for this
step, from 7.5 ms to 0.6 ms on a 1 million vertex grid.
When pressing F3 to bring up the Search Menu, an error appeared
because the MoveModifierToNodes operator's poll method did not
consider the context where no object was selected.
Pull Request: blender/blender#107310
Code was not handling properly the case where the new object that should
replace the old one in given collection is already in the collection. In
such case, remove the old object from the collection, but do not attempt
to add the new one again.
The String to Curves node allows selecting various metrics for the
characters. Size is the absolute height between two lines, and is
correctly marked as a distance. Character, Word and Line Spacing, on
the other hand, do not represent any distance, but are proportional to
the base size and should not have distance units.
This commit simply removes the properties' `PROP_DISTANCE` subtype.
Pull Request: blender/blender#106660
Remove micro optimization that seeks to reuse the active center
alculation.
This operation is lightweight and reusing its result only adds an
unnecessary dependency.
libdecor is not a hard requirement, so only fail the configure phase if
the building in strict mode.
This makes it behave like most other dependencies in Blender.
Pull Request: blender/blender#107304
Fix#107297: Crash on undoing "Use Nodes" step.
Fix (unreported) crash on undoing certain type of data deletion (like
collections) in some specific cases.
Main serious issues were in new handling of embedded IDs in ID swap code
(#107297), and in general in lib_query remapping code from
`BKE_lib_id_swap_full` in readfile code in undo case which could access
other IDs data, when it is not guaranteed to be valid at this point in
code.
Added an option flag to lib_query code to forbid access to the original
ID pointers in such cases.
Load the device capabilities into the context. This makes sure
that GPU framework already takes care of the capabilities.
Pull Request: blender/blender#107302
Currently window manager always tried to create an OpenGL context.
This is incorrect and will fail when using Vulkan. Somehow this
doesn't fail for Metal.
This PR creates a context based on the current selected backend.
Pull Request: blender/blender#107301
Apparently we always constructed a Vulkan 1.0 Context, although we
are targetting Vulkan 1.2. This also lead to incorrect expectations
when using the Vulkan Memory allocator.
Pull Request: blender/blender#107300
This patch fixes the failing shader/bevel unit test when MetalRT is enabled. The ray was being transformed into local object space even when the SD_OBJECT_TRANSFORM_APPLIED flag was set.
Pull Request: blender/blender#107292
This patch adds missing domain priority specifications for the Box and
Ellipse mask. This is a non-functional change because the inputs
happened to be properly ordered anyways.
Introduce `BKE_fcurve_deduplicate_keys()` to merge keys that are on the
same time, or within the time comparison threshold (1/100th of a frame).
When merging two consecutive keys, the last one 'wins' and determines
the final key *value*. The first key's *time* is retained, to ensure the
reference point for the next comparisons is stable. The only exception
here is when there is a key exactly on an integer frame number, in which
case that one is preferred.
The function is exposed in RNA as `fcurve.keyframe_points.deduplicate()`
This commit also introduces a new function `BKE_fcurve_bezt_shrink(fcu,
new_totvert);` that can reallocate the `bezt` array to ensure removed
keys no longer take up memory.
The RNA function `fcurve.update()` currently performs two steps, which
are now exposed to RNA as well, as `keyframe_points.sort()` and
`keyframe_points.handles_recalc()`. This is so that Python code can
sort, deduplicate, and then recalculate the handles only once (calling
`update` + `deduplicate` would do the latter twice).
In Blender 4.0 the deduplication will also be part of `fcurve.update()`,
see #107126.
Reviewed on blender/blender#107089
The `sort_time_fcurve()` function should be stable, i.e. not change the
relative order of keys that have the same X-coordinate. This is now
enforced by a unit test.
I want to build a new function that can deduplicate the keyframes after
sorting, for which it's important that the 'last key wins' to get reliable
results.
The RNA function `fcurve.keyframe_points.add(N)` was purely implemented
in the RNA wrapper. It now sits in `ED_keyframes_add(fcu, N)` where it
can be used by other C code as well.
It's in the editors code, as regular keyframe insertion is there as
well.
No functional changes.
These two didnt check if keywords were passed in, crashed on running
`PyDict_GET_SIZE` on NULL (in case of no keywords).
Oversight in ee292a1d66.
Now just check if keywords are actually passed in.
Pull Request: blender/blender#107285
Many nodes output anonymous attributes (e.g. the top selection in the
Cylinder node). The actual data is only contained in the geometry output
though. The field output just contains a reference to this data (essentially
just the generated name of an attribute). This data can be output even
without computing the geometry itself.
As of right now, this only simplifies the code a bit, but does not have a
bigger impact, because to use the anonymous attribute, you always need
the geometry anyway. However, with the upcoming simulation nodes,
it's possible to create the anonymous attribute in one frame and to access
it in another frame. In the other frame we only need the anonymous
attribute reference and don't have to create the actual geometry again.
Skipping creating the actual attribute on the geometry can have a
significant performance benefit.
Keep these operations separate to simplify path handling logic & docs.
Many callers passed NULL and there were times paths were passed in which
didn't make any sense (where the paths had already been made absolute).
- Don't attempt to skip the WIN32 drive component on relative paths
it's possible this would have unexpected behavior but paths like
are already unlikely to work as expected, e.g. "//C:\".
- Remove early returns for empty paths as there is no need for special
handling.
- Add path normalize NOP tests
Initially, this function was for node data. At Simon's suggestion, it
was extended to a node group inputs as well. However, this overlaps with
another function. It has been missing for a while, but has recently been
fixed by blender/blender#107179. Now this functionality is redundant.
Pull Request: blender/blender#107255
- BLI_path_normalize ran BLI_path_abs on a path that had already
been made absolute.
- BLI_path_slash_ensure was called after BLI_path_normalize_dir
which already ensures a slash.
- Implement mesh creation in GeometrySet agnostic way, with less context
- Remove useless comments
- Use a field to clamp crease values instead of clamping when copying
- Small variable name tweaks
- Use `BKE_subdiv_new_from_mesh` instead of "update"
- Remove crease layers before writing, avoiding potential copy
Avoid possible calculations of loose edges later on if the coarse mesh
doesn't have loose edges or vertices. We expect these counts to be
cached already since `BKE_subdiv_converter_init_for_mesh` calls
`verts_no_face()` and `loose_edges()` already.
Related commits:
- 63689e4756
- 8e967cfeaf
8e967cfeaf only meant to tag the "verts no face" cache
calculated eagerly if both loose edges and loose verts were already
calculated. Instead it caused the calculation of one of the caches.
Follow Python's os.path.normpath's handing on relative paths in more
situations.
- Leading './' is always stripped.
- Relative paths such as `//./a` & `///a` normalize to `//a`.
- Support for trailing `/..` on the end of paths.
- Avoid empty paths for relative paths that would otherwise
resolve to an empty string, e.g: `a/b/c/../../..` resolves to `.`.
- Calculate spans of redundant `//` & `/./` before calling `memmove`.
- Loop backwards when removing path elements for greater efficiency.
- When removing `/../` components, avoid continuously searching from
the start of the path and instead search from the last found '/../'.
The only WIN32 specific behavior the drive or UNC prefix is skipped
(except for it's slash), allowing WIN32 & Unix paths to share the same
code-path.
Note that this changes behavior for WIN32 when there are too many parent
directories, where ".." that move before the root directory are removed
instead of being left in the path. e.g:
`C:\a\..\..\b` resolved to `C:\..\b` whereas now the result is `C:\b`.
This matches Python's `os.path.normpath`.
The socket indices in `bNode` and their corresponding `lf::Node`
don't match exactly, because `lf::Node` does not contain the
unavailable sockets. A simple mapping from `bNodeSocket` index
to `lf::Socket` index is required for future work. For now it
only removes the need for various tempory vectors.
Similar to the cache of loose edges added in 1ea169d90e,
cache the number of loose vertices and which are loose in a bit map.
This can save significant time when drawing large meshes in the
viewport, because recalculations can be avoided when the data doesn't
change, and because many geometry nodes set the loose geometry
caches eagerly when the meshes contain no loose elements.
There are two types of loose vertices:
1. Vertices not used by any edges or faces
`Mesh.loose_verts()`
2. Vertices not used by any faces (may be used by loose edges)
`Mesh.verts_no_face()`
Because both are used by Blender in various places, because the cost
is only a bit per vertex (or constant at best) and for design consistency,
we cache both types of loose elements. The bit maps will only be
allocated when they're actually used, but they are already accessed
in a few important places:
- Attribute domain interpolation
- Subdivision surface modifier
- Viewport drawing
Just skipping viewport drawing calculation after certain geometry
nodes setups can have a large impact. Here is the time taken by
viewport loose geometry extraction before and after the change:
- 4 million vertex grid node: 28 ms to 0 ms
- Large molecular nodes setup (curve to mesh node): 104 ms to 0 ms
- Realize instances with 1 million cubes: 131 ms to 0 ms
Pull Request: blender/blender#105567
The node outputs the index of the closest element to itself. See #102387
for the original design.
This is different from the Sample Nearest node in two important ways:
* It does not have a geometry input, instead the geometry is taken from the
field evaluation context.
* The node can exclude the "current" element from the search.
* The group id input can be used to build subsets of elements that only
consider each other as neighbors and ignore elements with other ids.
Pull Request: blender/blender#104619
The issue happens because the algorithm used to calculate the center of
the selection first needs to create a TransData array. In this array,
the code calculates the "mirrored" elements which can be quite slow in
dense meshes.
The solution is replace this slow algorithm used for calculating the pivot
point with the fast algorithm used to calculate the position of transform
gizmos.
Pull Request: blender/blender#107203
An operator to allow interactive text selection for 3D Text Objects.
This is from the code of Yash Dabhade (yashdabhade) for GSoC 2022
with corrections and simplifications. Also includes double-click for
word selection.
Pull Request: blender/blender#106915
When EEVEE is rendering multiple samples via
eevee_draw_scene, the command submission and in-flight
memory pressure would grow until all samples completed,
due to lack of intermediate flushing of GPU work and memory.
This patch adds a command flush and memory clear for this case
which occurs with high TAA sample counts during saving, similar
to the process in EEVEE_render_draw.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#107221
Function `WM_keymap_guess_opname()` skipped `UI_OT` operator types. In
some cases this is detremental to workflow, see #105371.
To exclude operators from getting keyboard shortcut it was suggested by
Campbell to use flag `OPTYPE_INTERNAL` or make new one.
Pull Request: blender/blender#105383
This patch contains changes needed for retiming sound strips.
`BKE_sound_set_scene_sound_pitch()` is replaced by
`BKE_sound_set_scene_sound_pitch_constant_range()` which uses new
Audaspace interface to set pitch in bulk.
This is done in `SEQ_retiming_sound_animation_data_set()` where retimed
sections are created for each strip. When strip is inside of meta
strip(s), the retimed sections of meta and actual strip are split where
they intersect and pitch is multiplied where they overlap. Each section
will have pitch value that is provided to audaspace.
Waveform overlay now represents retimed audio accurately.
Ref: #100337
Pull Request: blender/blender#105072
Whether the outputs are fields only depends on whether at least one of the
last three inputs is a field. It does not matter whether the `Value` input is
a field.
Pull Request: blender/blender#106007
Patch prefers usage of Transform Feedback for hair refinement
as opposed to compute, as vertex work can be pipelined with
existing rendering work which is in-flight.
This approach is ~20% faster depending on the scene. Note that
the current implementation only uses TF, as storage buffer support
is disabled. Though once storage buffer support is added, we should
still use the TF path.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#107166
This PR uses the VK_EXT_debug_utils extension, but it's only for labeling, so it doesn't rely on the VK_LAYER_KHRONOS_validation functionality.
The functions that do these things are loaded into the runtime as vulkan extensions.
Declare the function pointers in a struct and make them members of vk_context.
Pull Request: blender/blender#106098
This speeds up saving `070_0100.anim.blend` from the Heist project
from ~3s to ~300ms by adding PROPOVERRIDE_IGNORE in a few
places. It's not completely obvious to me when `PROPOVERRIDE_IGNORE`
should be used and when it shouldn't. Given that the same is done for
meshes already, it seems correct.
Pull Request: blender/blender#107196
Add texture usage flags for textures which are used as texture views
or require texture views for backing implementation.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#107163
Apply compilation fixes for Metal compatibility.
This includes explicit type casts, packed data types
where vec3 alignment is inconsistent, constructor replacement
with factory function.
The Metal shader generator also needs knowledge of when bound
resources are fundamental data types, so
SHADOWS_TILE_DATA_PACKED must be described as uint in
ShaderCreateInfo.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#107178
Caused by 6b8cdd5979.
Above commit introduced element tagging for boundary calculations but
only cleared them properly on all faces if the new `Preserve Seams`
option was chosen. We cannot be sure about the state of element tags
from prior operators though, so correct the culprit check to also only
be in effect if the new `Preserve Seams` option was chosen.
Pull Request: blender/blender#107161
Leverage new API call in Metal to increase the number of threads
dedicated to concurrent shader compilation. First step to improve
parallel compilation times when multiple engines are active.
Would also enable an increase in worker threads for shader
compilation jobs within the DRWManager.
Note that this is only available in the latest
version of macOS Ventura (13.3).
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#106625
The result of detecting if a quad should flip the default 0-2 split
when tessellated only used a pre-calculated normal when available,
since the method of detecting the flip was different, the check for a
concave face could change depending on the existence of polygon-normals.
In practice this meant cycles render preview could use a different
tessellation than the GPU display.
While [0] exposed the bug, it's an inherent problem with having 2
methods of detecting concave quads.
Remove is_quad_flip_v3_first_third_fast_with_normal(..) and always
use is_quad_flip_v3_first_third_fast(..), because having to calculate
the normal inline has significant overhead.
Note that "bow-tie" quads may now render with a subdivision in a
different direction although they must be very distorted with both
triangles along the 0-2 split pointing away from each other.
Thanks to @HooglyBoogly for investigating the issue.
[0]: 16fbadde36.
While this didn't cause bugs, initialize members to avoid problems
in the future.
GHOST::SystemX11
- m_keyboard_vector
- m_keycode_last_repeat_key
GHOST::Window
- m_cursorGrabInitPos
- m_userData
Generally, one does not know if the sharing info is currently shared
and should therefore be const. Better keep it const almost all the
time and only remove the constness when absolutely necessary
and the code has checked that it is valid.
The main challenge is to avoid dangling pointers. Currently, the lifetime of socket
declarations is somewhat unbounded (at least we didn't restrict it explicitly yet).
Therefore, storing non-owning pointers in it tricky. For ID pointers one could
potentially use the foreach-id iterator to update pointers in declarations as well,
but that's a bit out of scope and might not be the right solution anyway, since it's
not obvious that all node declarations are reachable from IDs stored in `bmain`.
The solution now is to use a callback that retrieves the right ID pointer when it
is used. The important thing is that the callback does not capture any potentially
dangling pointer either.
Pull Request: blender/blender#107179
When running oneAPI with AoT binaries, on hardware that's not compatible with
these, recompilation could have been missing from the kernels loading phase and
happen during execution instead.
These changes fixes it, any kernel compilation will now happen during the
kernels loading phase.
It was broken in two ways:
- bpy_bmlayercollection_iter passed PY_SSIZE_T_MIN, while
PY_SSIZE_T_MAX was needed.
- bpy_bmlayercollection_subscript_slice() contained an
off-by-one error.
Pull Request: blender/blender#107165
Completes the TODO in GHOST_SystemPathsCocoa::addToSystemRecentFiles
Also renames the filename parameter to the more appropriate filepath.
The recently opened/saved file will now also show up in:
- Blender Dock icon > Right click.
- Three finger swipe down in Open Blender i.e., App Expose
Based on a earlier contribution by @jenkm.
Pull Request: blender/blender#107174
After e45ed69349 we need to remove the existing attribute
when adding the rest position before evaluating modifiers. Also, adding
the rest position attribute was completely skipped in edit mode.
Pull Request: blender/blender#107190
The crash can occur in the following situations:
- Attempt to open a corrupted EXR file
- Attempt to save an EXR file under a non-existing directory.
The root cause is not really clear: for some reason the OpenEXE API on
the Blender side can not catch OpenEXE exceptions by a constant
reference to a std::exception, although it can by a constant reference
to an Iex::BaseExc.
This does not seem to be an issue with the OpenEXR library itself as
the idiff tool from our SVN folder catches the exceptions correctly.
It is also not caused by the symbols_apple.map as erasing it does not
make the problem go away.
It could still be some compiler/visibility flag which we were unable
to nail down yet.
The proposed solution is to add catch-all cases, mimicking the OIIO
tools. This solves the problem with the downside is that there are
no friendly error messages in the terminal. Those messages could be
brought as part of the workaround by additionally catching the
Iex::BaseExc exception. But probably nobody relies on those error
prints anyway, so added complexity in the code is likely does not
worth it.
Pull Request: blender/blender#107184
Animation: Adds a new "Parent Space" Orientation option for the Transformation Gizmo.
---
For child targets (objects, bones, etc) being able to transform in parent space is a desired feature (especially when it comes to rigging / animation).
For objects:
* with a parent, the gizmo orients to it's parents orientation
* without a parent, the gizmo orients to Global space
For Armatures:
* Child bone shows parent's space regardless if "Local Location" is set for parent bone
* For root bone **without** "Local Location" set, use the armature objects space.
* For root bone **with** "Local Location" set, use local bone space.
---
No new transformation orientation code needs to be written, we can achieve the desired results be using the existing `transform_orientations_create_from_axis`, `ED_getTransformOrientationMatrix`, and `unit_m3` methods. To do this, we check to see if the bone has a parent, if so, we use the bones pose matrix (`pose_mat`). This is done similarly for objects using the parent's object matrix (`object_to_world`).
Pull Request: blender/blender#104724
Scene.cpp and Geometry.cpp are large file it can be broken up into smaller easier to handle files. This change has been broken out from #105403 to make understanding the changes easier.
geometry.cpp is broken up into:
1. geometry.cpp
2. geometry_attributes.cpp
3. geometry_bvh.cpp
4. geometry_mesh.cpp
scene.h & scene.cpp is broken into:
1. scene.h
2. scene.cpp
3. devicescene.h
4. devicescene.cpp
Pull Request: blender/blender#107079
When a parent item was renamed, the `TreeView` was doing everything as
expected, however `AssetCatalogService::update_catalog_path` is supposed
to also update the catalog paths of all sub-catalogs [which it does --
but it does not tag sub-catalogs as having unsaved changes, resulting in
wrong saving of catalogs afterwards, meaning the parent item was saved
with the old name and a new item with the new name was created].
Now also tag sub-catalogs for having unsaved changes.
This should also go into 3.3 LTS
Pull Request: blender/blender#107121
The selection (box select, click select...) had an offset when selecting keys in the timeline.
That was because the function to get the NLA mapping ignored the timeline.
Pull Request: blender/blender#106904
The following properties were not library overrideable, but now are
* Line Thickness
* Color
* Custom Color Checkbox
Pull Request: blender/blender#106959
Currently when a baked curve is in the Graph Editor and normalization is enabled, it doesn't work.
It even throws a warning.
This patch adds the missing logic to normalize baked FCurves within a preview range.
Pull Request: blender/blender#106890
When using Xcode version 14.3 on Apple Silicon hardware a number of
regression tests fails. This change fixes this problem.
The root cause comes to the floating point contraction. It was already
disabled for GCC on Linux, but not for Clang on neither of Linux or
macOS.
Also corrected the comment about Clang default, as it as set to on
somewhere in 2021.
Pull Request: blender/blender#107136
Occlusion query buffers not being cleared to zero resulted in
erroneoues selection in certain situations.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#107135
Shader source requires explicit conversions and shader address
space qualifers in certain places in order to compile for Metal.
We also require constructors for a number of default struct types.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#106219
This patch adds several tools and options to the weight paint mode of Grease Pencil.
* Blur tool: smooths out vertex weights, by calculating a gaussian blur of adjacent vertices.
* Average tool: painting the average weight from all weights under the brush.
* Smear tool: smudges weights by grabbing the weights under the brush and 'dragging' them.
* With the + and - icons in the toolbar, the user can easily switch between adding and subtracting weight while drawing weights.
* With shortcut `D` you can toggle between these two.
* The auto-normalize options ensures that all bone-deforming vertex groups add up to 1.0 while weight painting.
* With `Ctrl-F` a radial control for weight is invoked (in addition to the radial controls for brush size and strength).
* With `Ctrl-RMB` the user can sample the weight. This sets the brush Weight from the weight under the cursor.
* When painting weights in vertex groups for bones, the user can quickly switch to another vertex group by clicking on a bone with `Ctrl-LMB`.
For this to work, follow these steps:
* Select the armature and switch to Pose Mode.
* Select your Grease Pencil object and switch immediately to Weight Paint Mode.
* Select a bone in the armature with `Ctrl-LMB`. The corresponding vertex group is automatically activated.
Pull Request: blender/blender#106663
This patch implements the ID Mask node for the realtime compositor.
The node can be implemented as a GPU shader operation when the
anti-aliasing option is disabled, which is something we should do when
the evaluator allows nodes be executed as both standard and GPU shader
operations.
Pull Request: blender/blender#106593
`make format` uses autopep8 to format Python, using a list of paths
specified in `tools/utils_maintenance/autopep8_format_paths.py`. The
scripts folder used to be a submodule inside release, but it is now at
the root of the blender repo.
This commit adds `scripts` to the list of paths to format.
Ref !107143
The comment didn't really make sense, since the removed code did the
same thing as the CustomData function anyway, and that's already done
in `mesh_init_data`.
Some callers that access the extension operated on the end of the path
even when there was no extension. Using this avoids having to assign
the end of the string using a separate check.
The file extension was copied into a buffer without checking it's size.
While large extensions aren't typical, some callers used small fixed
size buffers so an unusually named file could crash.
Runtime this information is stored in the active_color_attribute and
default_color_attribute strings on the mesh, however when saving it
is still saved in the old format with flags on the CustomData layers.
When converting from the strings to the layers not all flags were
properly cleared from the CustomData layers, leading to multiple
layers having the CD_FLAG_COLOR_ACTIVE/RENDER flag.
Implicit sharing means attribute ownership is shared between geometry
data-blocks, and the sharing happens automatically. So it's unnecessary
to choose whether to enable it when copying a mesh.
The typical order is vertex, edge, face(polygon), corner(loop), but in
these three functions polys and loops were reversed. Also use more
typical "num" variable names rather than "len"
Create a "nomain" mesh when converting intermediate representations
to a Mesh, meaning those areas don't have to know about data-block
names or the main database, and also that the boilerplate of adding
attributes individually can be avoided. The attribute arrays aren't
copied here, so the performance should be unaffected.
The nodes for inverting a color are named simply Invert, which begs the question: invert what?
This patch changes the naming for the node in Shading, Texture and Compositing nodes to *Invert Color*
This matches the naming of other color dedicated nodes like Separate Color or Combine Color
Pull Request: blender/blender#106750
Do not show asset metadata "description", "license", "copyright", or
"author" if they are empty AND read-only, since they can't be edited
and contain no useful information to show.
Pull Request: blender/blender#105812
Small fixes to recent file operations changes. FileOperations enum
starting with zero results in bad behavior with EnumPropertyItem. Typo
fix.
Pull Request: blender/blender#107138
Avoid copying the selected edges if all edges are selected, and
parallelize gathering the selection otherwise. Also use `int2` instead
of `std::pair`.
In simple test file I observed an approximate 10% FPS improvement,
though in real world cases the impact is probably much smaller.
Using the new HIP SDK 5.5 that includes a fix for the compiler bug.
This also enables the light tree.
For Linux the binaries are still disabled. ROCm 5.5 is planned to
include the same fix but not released yet. When that happens we
should be able to enable Linux as well.
Ref #104786Fix#104085
Pull Request: blender/blender#107098
Caused by uninitialized `ToolSettings` `GpPaint` [which was later
accessed in `BKE_gpencil_palette_ensure`].
Not 100% sure why `ToolSettings` `GpPaint` is properly initialized in a
default startup fille, but for some files, this was not the case (as in
the report)
See 22462fed00 for a similar commit.
Now initialize `ToolSettings` `GpPaint` (alongside `GpVertexPaint`) when
entering grease pencil vertex paint mode.
Should probably go into LTS releases as well.
Pull Request: blender/blender#107131
Muting a VSE channel does not mute the sound, this is caused by lack
of depsgraph updates for sound when mute state changed for the channel.
Now fixed.
Caused by ad146bd17a
Pull Request: blender/blender#107116
The dpcpp folder grew from 200M to 500M with the last update
due to lld being enabled and having 5 different copies in the bin
folder. We do not need to ship lld so it can be safely removed.
However previous harvest cleaned up the build folder before copying
the libs to their final destination in output, this will no longer
work, since we actually do need lld to build embree.
So copy to the full build folder to output first, then remove the
binaries we do not need. Embree will use the binaries in the build
folder so it will be unaffected by this.
Before the add node search refactor and link-drag-search, nodes were
filtered out based on whether they worked with the active render
engine. For example, the Principled Hair BSDF node doesn't work with
EEVEE, so it isn't displayed in the UI. While we might want to relax
this in the future, we have no better way to show that they don't work
right now, so it's best to keep that behavior.
The filtering is implemented with a new node type callback, mainly
to reduce the boilerplate of implementing many node search callbacks
otherwise. It's also relatively clear this way I think. The only
downside is that now there are three poll functions.
I didn't port the "eevee_cycles_shader_nodes_poll" to the new
searches, since I don't understand the purpose of it.
Pull Request: blender/blender#106829
The resolution of the driver value RNA path was using the wrong
property (it was forced to be referenced relative to the ID).
Pull Request: blender/blender#107129
Change the "displist to mesh" conversion to use the edge calculation
function used everywhere else, to allow removing the old code. This
changes edge vertex and corner edge indices, requiring a test update,
but the visual result should be the same.
Add the ability to retrieve implicit sharing info directly from the
C++ attribute API, which simplifies memory usage and performance
optimizations making use of it. This commit uses the additions to
the API to avoid copies in a few places:
- The "rest_position" attribute in the mesh modifier stack
- Instance on Points node
- Instances to points node
- Mesh to points node
- Points to vertices node
Many files are affected because in order to include the new information
in the API's returned data, I had to switch a bunch of types from
`VArray` to `AttributeReader`. This generally makes sense anyway, since
it allows retrieving the domain, which wasn't possible before in some
cases. I overloaded the `*` deference operator for some syntactic sugar
to avoid the (very ugly) `.varray` that would be necessary otherwise.
Pull Request: blender/blender#107059
Caused by 2eeec49640.
Above commit would early out when falling through the specialized
greasepencil selection operator to view3d_select_exec. But in order to
select posebones in grease pencil weightpaint mode, we still have to
continue with view3d_select_exec.
Now check this special case [with convenient
`BKE_object_pose_armature_get_with_wpaint_check`] and DONT early out in
that case.
Should go into 3.3 LTS as well.
Pull Request: blender/blender#107076
When a node input is connected to a group node input that is unlinked
and is of a different type, no implicit conversion takes place, so the
value is unexpected.
This patch fixes that by considering the types of both sockets and do
implicit conversion if necessary.
Reverts dcb2821292 but handles
the linker error by relying on target_link_libraries deduplication.
Reverts 18a15bafe8 but handles
blender_test linking after dependency change by passing
lib to target_link_libraries itself.
Closes#107033
While replacing the extension with an empty string works,
it required a redundant string-size argument which took a dummy
value in some cases. Avoid having to pass in a redundant string size by
adding a function that strips the extension.
The internal utility get_sequence_len would make it's filename
argument absolute so as to scan it's directory for files.
Perform this on the directory instead so the filename can be const.
Finding the extension included hidden files (starting with a '.'),
now finding the extension matches Python's `os.path.splitext` behavior
which has the advantate a hidden file is not considered one long
extension - with an empty name part.
Also update code to use BLI_path_extension in cases which previously
in-lined this logic.
BLI_path_frame_get path argument is now const,
it was being manipulated unnecessarily.
This adds new movement types TEXT_BEGIN and TEXT_END to allow
FONT_OT_move and FONT_OT_move_select operators move the text
cursor (caret) to the top and bottom of the text.
Pull Request: blender/blender#106196
During createOffscreenContext with VK backend enabled wl_surface
was not stored in the context's user data. This resulted in nullptr
dereference later on during disposeContext. Added a line that sets
user data and additionally added nullptr checks in disposeContext.
Ref !107057.
Updated Embree 4 library with GPU support is required for it to be
compiled - compatiblity with Embree 3 and Embree 4 without GPU support
is maintained.
Enabling hardware raytracing is an opt-in user setting for now.
Pull Request: blender/blender#106266
This allows toggling of text styles of selected text and at the current
mouse cursor position if nothing is selected.
Pull Request: blender/blender#107048
Use the attribute API for domain and type interpolation instead of doing
it manually. I observed a 3.8x improvement in curve selection mode and
an 18x improvement in point selection mode.
Adds a submenu to the File Browser selected item context menu that
allows opening the item or viewing the location in an OS browsing
window. On Win32 also allows other actions like editing, searching,
opening command prompt, etc.
Pull Request: blender/blender#104531
This reverts commit df096eab77.
There is a corner case for when WITH_CYCLES_ONEAPI_BINARIES is set to on
and later turned off during config, in case there is no ocloc.
This happens when the collection's item type doesn't have a
'nameproperty' to index with. For debug builds we error out with an
assert, since in general this shouldn't happen. For release builds
Python will report item not found.
Pull Request: blender/blender#107086
We don't use the callbacks that create virtual arrays from the custom data
anymore, they just add extra indirection. The only non-obvious case was
the crease attribute which had a setter function. Replace that with an
attribute validator like the other similar attributes.
Pull Request: blender/blender#107088
A solution for an older bug was causing it.
Added a special case to avoid an extra relation for context
variables as they do not change during the dependency graph
evaluation,
Pull Request: blender/blender#107082
Make the `remove_if` function for `Vector`, `VectorSet`, `Set`, and `Map` return the number of elements it removed.
Pull Request: blender/blender#107069
Update the RNA and DNA documentation for two bone matrices:
- `PoseBone.matrix_channel` (`bPoseChannel::chan_mat` in DNA) contains
the evaluated loc/rot/scale channels, including constraints and drivers.
- `PoseBone.matrix` (`bPoseChannel::pose_mat` in DNA) contains the same
transform, but then expressed in the armature object space.
No functional changes, just clarifications in comments / tooltips.
While embedded IDs are usually considered as private local data of their
owner ID, some areas of code, like the depsgraph, can consider them as
regular IDs in some aspects.
So when swapping IDs, also properly 'counter-swap' their potential
embedded IDs, such that the pointers to the embedded IDs remain as before
swapping, even though the data of the embedded IDs is swapped.
The main target of this change is memfile undo code. There, newly read
IDs are swapped with their oldder version, so that the old address
contains the new data. This allows to avoid rebuilding some of the
depsgraph. Doing the same thing for embedded IDs should reduce even
further the needs for depsgrah rebuilds on undo steps.
This commit also gives more control over the remapping of 'self' ID
pointers inside themselves.
Pull Request: blender/blender#107044
Two main aspects:
1. Split the light linking collection into two: light and shadow linking.
It is easier to understand than light+shadow state plus the state of
None.
2. Inherit instancer receiver and blocker sets.
This solves usecase when there are multiple rocks (instances of the
same object) and only some of the instances are to be linked to the
light.
There is notable internal difference: the is-linked-id check was removed
from the only function in the blenkernel. This allows to potentially do
python-level overrides in the shot file. Check somewhere else in the
interface might be needed.
Pull Request: blender/blender#106950
- Split out WM_init_splash_on_startup(..) which performs startup checks.
- WM_init_splash(..) now shows the splash (ignoring preferences).
- Avoid calling BLI_exists on an empty string (in some cases).
Recent failures requiring investigation have exposed some shortcomings
that this addresses:
- When creating the diff image for offline comparison, use a higher
threshold to prevent idiff from printing more output which will often
contradict the primary failure output just above it (very confusing)
- For metadata failures, make sure these get printed so it's obvious
what kind of failure we're dealing with
Pull Request: blender/blender#107058
After 17800e0c03, the oneAPI kernels library was still able to find sycl6.dll but that wasn't reliable.
We fix this by moving the oneAPI kernels library also into blender.shared.
Pull Request: blender/blender#106894
Due to floating point differences between importance sampling and
texture evaluation, disagreeing on whether or not a ray lies within
the sun disc.
* Use the same input values for geographical_to_direction() in
sky_radiance_nishita() and kernel_data.background.sun.
* The mathematical operations in pdf_uniform_cone() were adjusted to
match sky_radiance_nishita().
Pull Request: blender/blender#106764
This is the first step for refactoring the lightcache system.
Each probe instance (as in `Object`) will now store its own baked data.
The data is currently stored in uncompressed readable format.
This introduces two new operators for baking to avoid confusion with
the previous light baking pipeline. These do nothing other than
creating empty caches that will be populated by EEVEE later on.
The DNA storage is made to be able to include multiple caches
in case of baked simulation over time but it isn't yet supported.
I prefer to keep the implementation simple for now as the long term
goals for this feature are uncertain.
There is still a type flag (`LightProbeObjectCache.cache_type`) that
will be used for versioning.
The naming convention of structs is a bit weird but that's all I
found in order to avoid interfering with the old scene light cache
that is still used by (old) EEVEE.
Related task #106449.
Pull Request: blender/blender#106808
For non-object parents (so bones & vertices), the parent is now also
explicitly checked for animation. In other words: having an animated
parent will cause the transform of the child to be written to Alembic/USD
on every frame (as if it is animated itself).
Do not read IDs from types flagged as 'no undo', whether they are local
or linked.
This should have no effect currently, since all 'no undo' ID types
currently are supposedly only local data anyways (Screen, WindowManager
and WorkSpace).
These IDs kept their address, but their content has been replaced
(re-read from the memfile undo step). Add an ID tag to identify them.
As a further cleanup, systematically tag these IDs for despgraph COW,
since their data is effectively modified (though in practice all of
these IDs are expected to already have other update tags anyway).
No change in behavior is expected from this commit.
This should not have much effective consequences with current code, but
fixes potential missed remappings for e.g. some nodetree pointers in the
node editor, or the `parent` pointer of collections to a scene's master
collection.
Implements #95966, as the final step of #95965.
This commit changes the storage of mesh edge vertex indices from the
`MEdge` type to the generic `int2` attribute type. This follows the
general design for geometry and the attribute system, where the data
storage type and the usage semantics are separated.
The main benefit of the change is reduced memory usage-- the
requirements of storing mesh edges is reduced by 1/3. For example,
this saves 8MB on a 1 million vertex grid. This also gives performance
benefits to any memory-bound mesh processing algorithm that uses edges.
Another benefit is that all of the edge's vertex indices are
contiguous. In a few cases, it's helpful to process all of them as
`Span<int>` rather than `Span<int2>`. Similarly, the type is more
likely to match a generic format used by a library, or code that
shouldn't know about specific Blender `Mesh` types.
Various Notes:
- The `.edge_verts` name is used to reflect a mapping between domains,
similar to `.corner_verts`, etc. The period means that it the data
shouldn't change arbitrarily by the user or procedural operations.
- `edge[0]` is now used instead of `edge.v1`
- Signed integers are used instead of unsigned to reduce the mixing
of signed-ness, which can be error prone.
- All of the previously used core mesh data types (`MVert`, `MEdge`,
`MLoop`, `MPoly` are now deprecated. Only generic types are used).
- The `vec2i` DNA type is used in the few C files where necessary.
Pull Request: blender/blender#106638
Animation data (including drivers) on inactive view layers now work. The
removal of such view layers was too optimistic; they are now kept
around. The bases are still removed, mostly for safety sake and to keep
the changes to a minimum.
`scene_remove_unused_view_layers()` has been renamed to
`scene_minimize_unused_view_layers()` to reflect its new functionality.
For compatibility with assumptions in other areas of the code, the
function still ensures the input view layer is at index 0.
This also introduces a new function
`BKE_view_layer_free_object_content(view_layer)`, which is a subset of
the functionality of `BKE_view_layer_free()`.
Having a type defined allows the compiler to help with type safety. For
example we can use it in switches to trigger a warning when a new object
type is added but not covered by the switch yet (but probably should).
Currently, when using the python api for offscreen drawing, the
default background will always be rendered into the GPUOffScreen's
framebuffer, rendering the alpha channel essentially useless and
making it difficult to separate objects from the background.
This patch allows offscreen drawing of a 3d view with transparent
background by exposing an optional parameter to the python api,
enabling, for example, compositing the result over another image.
The new parameter to draw_view3d() is optional, with the default
value matching the previous behavior, so this change is fully
Pull Request: blender/blender#105748
Previously, there was a "main" and "tmp" buffer and the final
result was expected to be in the "main" buffer. Now the two buffers
are called a and b and the final result can be in either of those.
This can improve performance especially if the number of iterations is low.
Pull Request: blender/blender#106860
`PyObject_GetBuffer` was used without checking that it was successful.
This could cause the code to access an incompatible or uninitialized
`Py_buffer`.
Add the missing checks, and clears the raised `PyExc_BufferError`
to silently fall back to accessing the PyObject as a sequence.
Using a "//" prefix resolves to the root directory which isn't a good
default as it typically doesn't have write permissions.
Only set the name and let the file selector pick a directory to use
(matches how saving from the text editor works).
Add WM_window_pixels_read & WM_window_pixels_read_sample that
use front-buffer pixel reading when supported.
Note that direct access to reading from the front-buffer is still needed
for writing thumbnails - where redrawing can cause problems
(see code-comments).
Expand on why front-buffer support is always disabled on Wayland &
why viewport orbit around selection offset correction isn't used for
perspective views.
Bezier curve position evaluation expects the handle position attributes
to exist and doesn't handle the case where they don't. Swith to using
a utility function to evaluate each curve type so Bezier evaluation can
stop early in that case.
Fixes a bug introduced in b0b9e746fa.
The volume transformation matrix is multiplied in the wrong order
which means the grid scale is applied on the translation.
Default settings changed for Sculpt mode's
Paint Brush, Smear Brush, and Smear Brush.
~~This includes updates of PR review #105691.~~
Updated to only include commits relevant to this PR.
Reviewed by: Joseph Eagar & Julian Kaspar
Pull Request: #105759
commit 7aa5e65dcbda862dcb17ecfc6727eb241a12c316
Merge: c08a9ec19f 7c9e493da55
Author: Joseph Eagar <joeedh@gmail.com>
Date: Sun Apr 16 15:11:53 2023 -0700
Merge branch 'main' of https://projects.blender.org/ChengduLittleA/blender into ChengduLittleA-main
commit 7c9e493da55a4adbfa2415b711e6d0daa2720ad9
Author: YimingWu <xp8110@outlook.com>
Date: Fri Mar 31 17:46:32 2023 +0800
Fix#106358: Handles null evaluated object when entering sculpting workspace.
The setup where everything in the scene is invisible/not enabled could
trigger a crash when switched to sculpting workspace, triggered when
opening the file.
This patch handles such situation.
Changed the menu operators:
Expand Mask by Topology (hotkey Shift A)
Expand Mask by Normals (hotkey Shift Alt A)
Expand Face Set by Topology (hotkey Shift W)
Expand Active Face Set (hotkey Shift Alt W)
so that their hotkeys would appear in their menu entries.
Resolves#104023
Co-authored-by: DisquietingFridge <30654622+DisquietingFridge@users.noreply.github.com>
Pull Request: #104568
Rebased for main instead of sculpt-dev
Decompose most of the nesting in the code to make the code
more consistent along the line of program execution.
Mainly achieved through:
- Remove redundant else
- Invert condition
- Add temporary variable to redistribute and name conditions
Pull Request: blender/blender#105509
This adds an WM_capabilities_flag to indicate that a platform
implements support for copying and pasting images using a shared
clipboard.
Pull Request: blender/blender#106990
A few fixes included here:
- Use `reserve` properly to add space after the first mesh
- Add to the end of the UVs array instead of replacing it for every mesh
Also, a cleanup/simplification:
- Split face size and face vertex loops, they are independent
Pull Request: blender/blender#106967
- Use off-screen drawing when reading from the front-buffer isn't
supported.
- Add a capabilities flag for reading the front-buffer which is always
disabled on WAYLAND.
- Add GPU_offscreen_read_pixels_region, used for reading a sub-region of
an off-screen buffer - use for color-picking a single pixel.
Orbit around selection didn't work well in orthographic views,
potentially causing viewport offset to drift during navigation
to the point content would be outside the far clipping range.
Resolve by aligning the view offset depth with the dynamic offset
being orbited around.
Currently the Textures used for offscreen rendering don't have
the `GPU_TEXTURE_USAGE_HOST_READ` flag. But some cases it is
needed. This PR adds a parameter when creating an offscreen
buffer.
Other solution could be to add this flag to all textures, but
we chose not to do this as that reduces the amount of fine-tuning
options for Metal/Vulkan backends. GPU can store textures
differently based on its actual usage.
This option isn't available in the python API as we don't expect
add-on developers to fine-tune texture usages to this extent.
For convenience `GPU_TEXTURE_USAGE_ATTACHMENT` is by default
always added.
Pull Request: blender/blender#106899
Cleaned up sculpt code to store lists of `PBVHNodes` with
`blender::Vector` instead of simple pointer arrays. This is much
simpler and eliminates memory leaks caused by forgetting to free
the result of `BKE_pbvh_search_gather`.
Notes:
* `BKE_pbvh_search_gather` is now `blender::pbvh::search_gather`.
* `FilterCache` and `ExpandCache` have ownership over their .nodes
members; as a result they're no longer pure C structs and
are allocated with `MEM_new`/`MEM_delete`.
* The word 'totnode' no longer occurs anywhere in
`source/blender/editors/sculpt_paint`
Todo (not for this PR): create a new properly C++ task API for sculpt
(with lambdas) and use it for brushes.
Pull Request: blender/blender#106884
Re-organize ID tags in a more logical way, and keep their values
strictly increasing, splitting the free available ones in-between the
main groups (to avoid having to edit all tags values when adding a new
one).
Note that shuffling around these ID tags values should not be an issue
anymore, all of these are strictly run-time, and fully cleared in write
code when writing into a .blend file.
This also lead to the second cleanup, which is removing some asserts on
ID tag values in readcode, these are useless since the tag is cleared on
write.
Embedded IDs did not benefit from any of the recent optimizations
(especially for undo case) when writing regular IDs (cleaning up of some
pure runtime data that would generate a lot of fake 'changed on undo'
status).
Now factor out of `write_file_handle` this part of the code generating
temp ID copy with cleaned-up data for writing, and expose it in BLO API
such that IDs owning embedded ones can also use it.
Code there was fairly naive and simple, missing some ID pointers,
sometimes improperly accessing non-ID data as IDs (usual dear Outliner
tree element usages of its 'ID' pointer...).
And code was especially quite severely broken in case these UI ID
usages were processed in a non-readonly context (i.e. if some of these
ID pointers were expected to be modified).
Code has been updated following existing very similar code in
`lib_link_workspace_layout_restore` from `readfile.cc`.
Code re-reading new ID pointers addresses inside readfile process would
not ensure that the 'ID' pointer of the outliner's treestore element is
actually a real ID pointer, and not a 'fake' one.
Probably harmless in practice, though this could have potentially been
the cause of extremely random rare crashes or corruption...
The build seems to complain without this, though theoretically it isn't
meant to be necessary. Though keeping them defined can potentially
avoid quadratic lookups too.
Similar to 7eee378ecc, this change decreases memory usage and
improves performance when copying curves and meshes without changing
their topology. The same change used for custom data layers is applied
to face and curve offset indices, which aren't stored as a custom data
layer.
The implicit sharing info for the offsets is stored in the mesh and
curve runtime structs, since it doesn't need to be written to files
directly. When changing the offsets pointer directly, the sharing info
must be updated accordingly. To make that easier, a few utility
functions take care of common operations like making an array mutable,
resizing an array, and creating sharing info for allocated data.
This commit also clarifies the intention to not allocate the offsets
at all when there are no curves/faces. That slightly complicates some
of the logic, but there's no reason for the single `0` integer to be
allocated.
Pull Request: blender/blender#106907
This commits adds some new, specific flags to further control ID
remapping process (like and option to skip user refcounting completely).
It also adds a new function to do 'raw' remapping, without any extra
post-processing, depsgraph tagging, etc. This is not used currently, but
will soon be needed by readfile post-processing code changes.
There is also some small cleanups and reorganization in that area of code,
the main noticeable change being the switch from a short to an int for
the flags controlling remapping code (using short here does not give
any benefit, and makes it harder to switch to integers when it becomes
necessary).
No change in behaviors are expected from this commit.
This type will be used to store mesh edges in #106638, but it could
be used for anything else too. This commit adds support for:
- The new type in the Python API
- Editing the type in the edit mode "Attribute Set" operator
- Rendering the type in EEVEE and Cycles for all geometry types
- Geometry nodes attribute interpolation and mixing
- Viewing the type in the spreadsheet and using row filters
The attribute uses the `blender::int2` type in most code, and
the `vec2i` DNA type in C code when necessary. The enum names
are based on `INT32_2D` for consistency with `INT8` and `INT32`.
Pull Request: blender/blender#106677
The extrude node resizes an existing mesh, but doesn't initialize new
data for most non-generic data types like shape keys or freestyle tags,
or custom normals. The split edges node doesn't process some
similar vertex data too.
In the future this data can become generic attributes, or it can be
supported in the nodes anyway. But now the new data is un-initialized
after being allocated.
Fixes#106926
When hitting normalize in the Graph Editor, it would frame the y-extents of the visible part of the FCurves.
Now, when a preview range is set, it frames the part of the FCurves in the preview range.
Pull Request: blender/blender#106888
Note, at the moment it is using the last login as a criteria to
whether the person should be listed (comparing it to 2 years past).
However anyone who hasn't logged in in gitea yet shows as last login 1970.
To run this you need to install all the required python packages and
generate a token with scope "read:org" or "admin:org".
See:
infrastructure/blender-projects-platform#55
`BKE_mesh_nomain_to_mesh` expects the object's data to be the mesh.
Also, the curve to mesh conversion can return a null pointer, so use
an empty mesh in that case. Thanks to Falk David for finding these.
This is the case e.g. of the `parent` collection pointer of collections
children of a scene's master collection, or some nodetree pointers in
the UI data (node editor).
Right now handling of this new flag is exactly the same as in owning
embedded case, the distiction between both usages will happen in future
commits.
This commit is expected to have no behavioral change at all.
The built-in brush identifier didn't match the enum name causing
brush assignment not to update the tool-system (clearing the tool).
Resolve by using generate_from_enum_ex(..) to avoid each brush
definition having to manually duplicate enum definitions.
Expose the full enum including separators and section titles,
useful for the tool system so it's possible to read separators
from brush enums (not part of this commit).
Also avoid using a dict as a default argument. While it didn't cause
problems - in general it's bad practice and worth avoiding as any
modifications produce strange behavior.
A buffer is a technical term most often referred to using the metaphor
of a "clipboard" in applications. However, the "clipboard" is usually
the system clipboard, used to carry data accross applications. To
avoid confusion, this replaces "clipboard" by "internal clipboard"
when not dealing with the system clipboard.
In addition, a few places still used the "[copy/paste] buffer"
terminology, so they are replaced with "internal clipboard as well.
The replacement from "[copy/paste] buffer" to "clipboard" was
undertaken in previous commits da6d6f99a8, 14b60c3a1c. This
commit should tackle the remaining occurrences.
Pull Request: blender/blender#106060
Adds "quick tooltips" to quickly see the name of a tab in the Properties
editor. (See patch for visuals.)
From own experience users are often confused about the name of the different
tabs, and I always found the delay to see it in the tooltip annoying. These
quick tooltips have been introduced for the toolshelf and solve this issue
nicely here. There is still a delay so that simple mouse movements won't
trigger the tooltips, but they show up a lot faster than normal tooltips now.
This may have the side-effect that icon only enum-item buttons will show the
enum name when there is no RNA property description. Previously we wouldn't
show this, even if available.
Pull Request: blender/blender#106906
This revision moves the vertex color reading and writing in the USD import and export functions over to the new Mesh Attributes API. I have removed anything else (new features or unnecessary changes) that was present in the prior patches to focus only on this task.
On the import side, I've introduced a class method named read_custom_data. In this function is the call-out for reading mesh colors. As requested, this function is intended to be the starting point for future Attribute reads, with methods like the new read_color_data* methods being called when a USD primvar matches a specific heuristic. UVs will (in the future, not in this revision) also need to be processed here. In a later patch, any primvars that do not match a heuristic can be imported as generic Attributes. There is a matching function on the export side, write_custom_data.
Attached is a .blend file for testing. The plane has five Color Attributes. The colors should be visibly the same when exported and re-imported.
I have also enabled color attribute imports by default. I believe it would be counter intuitive for most users for this feature to be off-- it means that at some point, a person round-tripping with default settings will lose data.
Pull Request: blender/blender#105347
Vulkan uses IMath. IMath on windows requires an option to indicate
it is used as dll file. This option wasn't set for the GPU module.
Thanks to Kazashi Yoshioka for mentioning this.
Pull Request: blender/blender#106932
Previous fix to resolve GPU hang which could occur in the
Metal backend caused additional flickering to occur as
as side effect, due to removal of required execution
dependencies in certain places.
This patch resolves both problems by only removing the
GPU hang dependency stall when additional synchronization
primitives are used along-side the global sync primitive.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#106914
Changes to [0] which worked as intended but used confusing naming.
- The note on using -1 for the active layer causes an assertion.
- The doc-string was above the wrong function.
- The meaning of the `_n()` suffix was flipped,
where the `layer_index_n` refers to an absolute index across all
layer types which is done internally for an index calculated from the
`layer` argument, not the argument it's self which is a UV index.
Rename BM_uv_map_get_offsets_n to BM_uv_map_get_offsets_from_layer.
[0]: 412b6a8f65
Apply the changes suggested at #103782
It includes:
- Draw dot at the origin the active gizmo
- Hide other gizmos while dragging (except the move arrows)
Other changes:
- Draw shadow for the move and scale circle gizmos (while transforming)
Pull Request: blender/blender#104624
Some properties may have the pointer stored in the gizmo structure
itself.
Reading from the struct directly is useful for cases where the value is
accessed frequently but not often required by the caller.
A disadvantage is that the property may not be saved in the file.
If there is not enough space for the Color Picker either above or below
the launching button, adjust the position to fit instead of clipping.
Pull Request: blender/blender#106122
Similar to e35f971da1. We aren't meant to rely on the
zero-initiatialization on creation anyway. I observed a small (a few
percent) decrease in minimum runtime in the geometry nodes points node.
The position attribute has special meaning for point clouds, and
meshes and curves have access methods for the attribute as well.
This saves boilerplate and gives more consistency between types.
The OSL GPU services implementation of noise intrinsics was missing the
overloads for derivatives and therefore OptiX pipeline creation would fail if
those were referenced.
This integrates the new implicit-sharing system (from fbcddfcd68)
with `CustomData`. Now the potentially long arrays referenced by custom
data layers can be shared between different systems but most importantly
between different geometries. This makes e.g. copying a mesh much cheaper
because none of the attributes has to be copied. Only when an attribute
is modified does it have to be copied.
Also see the original design task: #95845.
This reduces memory and improves performance by avoiding unnecessary
data copies. For example, the used memory after loading a highly
subdivided mesh is reduced from 2.4GB to 1.79GB. This is about 25%
less which is the expected amount because in `main` there are 4 copies
of the data:
1. The original data which is allocated when the file is loaded.
2. The copy for the depsgraph allocated during depsgraph evaluation.
3. The copy for the undo system allocated when the first undo step is
created right after loading the file.
4. GPU buffers allocated for drawing.
This patch only gets rid of copy number 2 for the depsgraph. In theory
the other copies can be removed as part of follow up PRs as well though.
-----
The patch has three main components:
* Slightly modified `CustomData` API to make it work better with implicit
sharing:
* `CD_REFERENCE` and `CD_DUPLICATE` have been removed because they are
meaningless when implicit-sharing is used.
* `CD_ASSIGN` has been removed as well because it's not an allocation
type anyway. The functionality of using existing arrays as custom
data layers has not been removed though.
* This can still be done with `CustomData_add_layer_with_data` which
also has a new argument that allows passing in information about
whether the array is shared.
* `CD_FLAG_NOFREE` has been removed because it's no longer necessary. It
only existed because of `CD_REFERENCE`.
* `CustomData_copy` and `CustomData_merge` have been split up into a
functions that do copy the actual attribute values and those that do
not. The latter functions now have the `_layout` suffix
(e.g. `CustomData_copy_layout`).
* Changes in `customdata.cc` to make it actually use implicit-sharing.
* Changes in various other files to adapt to the changes in `BKE_customdata.h`.
Pull Request: blender/blender#106228
This function was not exposed outside of internal GPU module.
Renaming `draw::Texture::depth()` to `is_depth` for consistency
and removing the ambiguity.
Some functions changed slightly for this non beta release.
No functional changes though as we didn't use what was removed.
Pull Request: blender/blender#106861
The fast_float is an external library, so move it to the
system includes which has less strict compiler flags applied.
This matches how other IO module use this library as well.
Pull Request: blender/blender#106892
When WITH_CYCLES_DEBUG is set to ON the following errors are
printed to the console:
E0412 15:51:22.588564 7996345 sync.cpp:737] Unknown pass Guiding Color
E0412 15:51:22.588605 7996345 sync.cpp:737] Unknown pass Guiding Probability
E0412 15:51:22.588613 7996345 sync.cpp:737] Unknown pass Guiding Average Roughness
This change fixes this by treating the guiding passes the same
way as all other passes, solving the errors and making it possible
to visualize guiding passes in the viewport later on.
Pull Request: blender/blender#106863
This PR reverts the breaking part of the #106535. This part doesn't seem
to be required to fix the HD4400-HD5500 issue.
Might also fix#106844.
Pull Request: blender/blender#106887
Changes to viewport state to resolve texture paint color
selection introduced a side effect wherein the correct
attachment size of a framebuffer was reset. This size is
needed when scissor regions are disabled to return the
state to its correct default. When this default was wrong,
certain operators would have incorrect offsets.
To maintain consistency with the OpenGL backend, the
Metal backend independently tracks the raw attachment
size using default_width/height. This will also reset to zero
when attachments are all removed, unlike other state which
may be retained.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#106857
After double clicking a file, user can click on a different app and
Blender will lose focus. Then it stays on splash screen. So fetch any
window instead of relying on active one to open the file.
pull request #106769
This reverts commit 4fe2685615.
Always use the preferred_scale requested by the compositor as this
did not work so well in the intended use case (where the low resolution
monitor text was scaled down and difficult to see).
After discussion with @ZedDB, revert this change since there are cases
where either functionality might be preferred - to ensure Blender's UI
is visible on a low resolution mirrored projector for e.g.
Changing the behavior of the preferred scale makes most sense in the
compositor, instead of controlling it on a per-application basis.
GCC did not support mold when support was initially added,
since then GCC has been updated to add support, removing the need
to point to a binary directory containing an alternative `ld` command.
Support for MOLD_BIN CMake option has been kept as mold may be installed
to standard location.
Use names:
- `tool_settings` instead of `ts`.
- `props` instead of `op` / `prop` / `op_props`
As Python may reference operators, don't confuse the operator
properties with an instance of the operator.
In both cases these names were already used for most scripts.
I cleaned up the cube brush tip code quite a bit; more remains
to be done. There is a new function to initialize cube
tip matrices, SCULPT_cube_tip_init. It's currently only
used by the paint brush, I'll need to do a bit of testing
before using it for clay strips and multiplane scrape.
Note: SCULPT_cube_tip_init uses the brush local matrix code
to avoid code duplication (and to take advantage of the debouncing
that is done there).
Nodes with names separated by a slash / can
not be searched by their initials.
This commit adds the slash character to
the list of separators for this type of
fuzzy search.
Pull Request: blender/blender#106838
The memory saving trick to re-use intersection array to store the ray self
primitives does not work reliably when there are more than 4 transparent
intersections: second time the shadow intersection kernel is invoked the
self primitives are assigned to the intersection result from the previous
kernel execution.
This did not manifest as an issue to artists before because the indices
were from the corresponding entities: self light object was stored in the
object index, and the light primitive was stored in the primitive index.
This would lead to a incorrect render result (worst case), but will not
lead to the off-the-bounds array access.
With the light ID the same trick does lead to the off-the-bounds access
as there is likely to be more objects than lights in the scene.
Likely there was unused `object` field in the `shadow_ray` of the shadow
path state, which seemed to have been always allocated. This field is now
renamed to `self_light` and the light index for the shadow linking is stored
there. This makes it possible to have reliable way of accessing light data
from the intersection kernel, as well as should lower the memory usage for
the scenes where no light linking is used.
It is not really clear what is the best way of solving the rest of the
shadow ray self primitives issue. Perhaps, save more memory in the state
and store those indices explicitly.
Even despite an extra condition added the performance is within a noise
floor different in the benchmark scenes.
The shadow linking is based on the Shadow State settings in the
light linking collection:
- None: the object is not shadow linked to the emitter
- Include: the object casts the shadow when lit by the emitter
(and the emitter does not cast shadows from objects which are
not linked to it).
- Exclude: the object does not cast shadow when is lit by the
emitter (but the emitter casts shadows from other objects).
Linking shadows to the emitter implicitly disables MIS for lamps.
This is because getting MIS+shadow linking to work needs more
time (and it's not that trivial). The MIS for mesh emitters is
not disabled automatically, as it is a bit tricky: the MIS is a
shader setting, not an object setting.
The MIS support will be worked on later.
Another limitation is the Metal RT support which does not support
shadow linking yet, Need to get a development environment where
compilation takes less than 10min per kernel.
Ref #104972
Works similar to the light linking sets, just uses different set of
bit masks and the settings are coming from the collection shadow state.
Ref #104972
This change fixes confusion when a collection is added to
the light linking collection and is excluded, and an object
from that collection is added to the same light linking
collection and is included.
The mental model is: the more detailed object information
wins. IN a case of a tie the latest specification wins.
The current limitation is that it is very hard to re-order
the light linking collection in the list representation.
This will be worked on further after the underlying supports
hinting about items being dropped in-between of elements.
Ref #104972
Pull Request: blender/blender#106389
The idea is to replace the actual sets with corresponding
collection bitmasks during build.
The code generalizes some accessors and moves code around
to hopefully help readability. It fees like some of the
concepts will be needed for the shadow linking, but deeper
generalization is better to happen once we start working
on it.
Ref #104972
Allows to easily exclude specific objects from specific lights by linking
the object to the light ans setting Light State to Exclude.
The dependency graph builder is reworked once more and now it does more
explicit tracking of receiver-centric view.
The downside of this is that it kind of cancels out the memory optimization
from previous change in the builder from Brecht.
The upside is that the code is much easier to follow.
The mitigation for the increased memory consumption during the build is to
clear the receiver-centric view after the light linking has finished building.
This makes it so the overall memory footprint of the dependency graph does not
change that much at all. This is because the extra memory used by the light
linking builder is freed before the relations builder. This means that there
are no relations crated yet, and no temporary memory is used by the relation
builder (and it could be a lot!). So from the overall dependency graph build
process this change is very unlikely to become a problem.
Note that this does not mean optimizations would not happen in the future,
but it will be easier to do them once the shadow linking is laid down, and
thee are automated regression tests to help catching possible issues.
Alternatively, depending on a desired UI representations and the USD
integration we might decide that having the receiver view cached is good
to have.
Ref #104972
This change makes it so the INCLUDE light linking state is handled
the way it is expected to.
The exclusion flags and shadow linking is still not taken into
account.
Ref #104972
The membership in the light linking collection now has two extra options:
light state and shadow state. They define the relation of the emitter such
as inclusion/inclusion to the light reception, and same thing for shadow
casting.
The masks calculated in the dependency graph needs to be adjusted to use
the new logic. Currently they still only consider the membership in the
light linking collection.
Ref #104972
We plan to build specialized light trees for every unique set of light
emitters. This requires knowing unique combinations of lights used by
receiver. However for easier library linking and USD compatibility the
relation is stored in the opposite direction.
This modifies the depsgraph and Cycles code to compute and use a unique
bit for every combination of lights.
Pull Request: blender/blender#106115
It is possible to drop objects and collections onto the receiver collection
list in the shading panel of object to add them to the collection.
Is not as useful yet as it could be: we need to make the list to have some
minimum height to make it possible to drop on the empty collection.
Ref #104972
Pull Request: blender/blender#106101
Need to add a type map to the `SocketType::type_name`, otherwise
the naming of types (used for conversion, i.e.) is off.
Also, added a static assert to help detecting such mismatch early
in in the future.
Pull Request: blender/blender#105984
The goal is to have some list-looking widget where a content of
a light-linking-specific collection can be managed. The imagined
workflow is:
- Add a new collection for the receiving collection
- This will show a list of the top-level elements in the collection
- Drag-drop objects and collections which needs to be linked to the
emitter.
Currently the implementation is limited to creation of the new
receiver collection, and visualization the content.
The practical problem this change fixes is the Cycles render
re-set on object selection.
The described behavior was introduced in the initial light
linking evaluation implementation which was only possible in the
same manner as the base flags evaluation. This is because the
outliner does not provide explicit tag when object or collection
is moved across collections.
This change limits the number of objects which are updating
their receiver mask and are updated on the Cycles side.
Pull Request: blender/blender#105837
The idea is to make it so all pre-computation is done by the
dependency graph, and accessed by render engines without extra
tricky accumulation logic on their side.
Ref #104972
Move the instancing related code to a dedicated function, leaving
the generic `build_collection()` dedicated to the building of the
collection itself.
Should be no functional changes: the code paths should effectively
still be the same. This is because non-instancing cases were passing
object as a null pointer, disabling the non-generic code path.
The light linking is defined by a collection which contains objects
which are receiving light. The collection itself is stored on a light
emitters.
In order to support both lamps and mesh lights the collection is
stored on the Object level.
The collection is referenced: as in, it is not one of those embedded
collections.
The dependency graph needs more work, as it currently designed to
use collections as an instancing entity. So, some refactor is needed.
Ref #104972
Inefficient in many ways, purpose is to first get something working correctly
with multiple importance sampling, transparency, volumes, etc.
Also abuses pass index as a stand-in for proper data from Blender.
Ref #104972
option(WITH_CYCLES_CUDA_BINARIES"Build Cycles NVIDIA CUDA binaries"OFF)
set(CYCLES_CUDA_BINARIES_ARCHsm_30sm_35sm_37sm_50sm_52sm_60sm_61sm_70sm_75sm_86compute_75CACHESTRING"CUDA architectures to build binaries for")
set(CYCLES_CUDA_BINARIES_ARCHsm_30sm_35sm_37sm_50sm_52sm_60sm_61sm_70sm_75sm_86sm_89 compute_75CACHESTRING"CUDA architectures to build binaries for")
option(WITH_CYCLES_CUDA_BUILD_SERIAL"Build cubins one after another (useful on machines with limited RAM)"OFF)
option(WITH_CUDA_DYNLOAD"Dynamically load CUDA libraries at runtime (for developers, makes cuda-gdb work)"ON)
@@ -521,9 +521,16 @@ endif()
if(NOTAPPLE)
option(WITH_CYCLES_DEVICE_HIP"Enable Cycles AMD HIP support"ON)
option(WITH_CYCLES_HIP_BINARIES"Build Cycles AMD HIP binaries"OFF)
set(CYCLES_HIP_BINARIES_ARCHgfx900gfx906gfx90cgfx902gfx1010gfx1011gfx1012gfx1030gfx1031gfx1032gfx1034gfx1035gfx1100gfx1101gfx1102CACHESTRING"AMD HIP architectures to build binaries for")
# Radeon VII (gfx906) not currently working with HIP SDK, so left out of the list.
set(CYCLES_HIP_BINARIES_ARCHgfx900gfx90cgfx902gfx1010gfx1011gfx1012gfx1030gfx1031gfx1032gfx1034gfx1035gfx1100gfx1101gfx1102CACHESTRING"AMD HIP architectures to build binaries for")
message(FATAL_ERROR"Compiler is unsupported, MSVC 2019 16.9.16 or newer is required for building blender.")
endif()
if(CMAKE_CXX_COMPILER_VERSIONVERSION_GREATER_EQUAL19.36.32532AND# MSVC 2022 17.6.0 has a bad codegen
CMAKE_CXX_COMPILER_VERSIONVERSION_LESS19.37.32705)# But it is fixed in 2022 17.7 preview 1
message(FATAL_ERROR"Compiler is unsupported, MSVC 2022 17.6.x has codegen issues and cannot be used to build blender. Please use MSVC 17.5 for the time being.")
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.