This data should be initialized when building the mesh. If the arrays
aren't already initialized, there is already a bug. Theoretically this
could improve performance, since we can use `malloc` instead of
`calloc`. In practice I observed less than a 1% difference though.
These aren't used much in current code, but currently they created
offsets on the result curves, then just freed them again when copying
from the source data. In the future it might be better to completely
avoid using the base constructor in the first place.
Swap is commonly used to implement move assignment since it's short
and the logic is relatively simple. Use is here to avoid the need to
spell out the copying and freeing manually. The `BKE_id_free` call
at the end of the function will free whatever data was swapped.
The curve types and the runtime always have to be created when reading
the file from disk, so we might as well do that in `blend_read`, which
will help in the future when the offsets use implicit sharing.
Return null instead of an empty curves data-block, which amounts to
the same thing in geometry nodes, with less potential for error in
the rest of the function.
Change Text Object character `kern` member to float from int, and allow
fractional changes to kerning with Shift-Alt-arrows.
Pull Request: blender/blender#105181
The existing utility cleared vertex group names and active attribute
names, which doesn't always make sense when the geometry is
replaced but the custom data layout remains mainly unchanged.
This code (looking for matching new IDs to restore by name) is called
from `set_app_data` after a .blend file has been read (also in memfile
undo case).
The part handling VSE clipboard to restore ID pointers is not really
needed, since pasting VSE strips already ensures stored ID pointers are
still valid, and tries to find a new matching one otherwise.
The contexts appear twice, in the list of #defines and in the
BLT_I18NCONTEXTS_DESC. Both had gotten out of alphabetical order, and
out of sync.
Pull Request: blender/blender#106718
- "Lens" can be a transparent object used in cameras, or specifically
its property of focal length
- "Empty" can be an adjective meaning void, or an object type. The
latter is already disambiguated using `ID_ID`
- "New" and "Old" are adjectives that can have agreements in some
languages
- "Modified" is an adjective that can have agreement in some languages
- "Clipping" can be a property of a camera, or a behavior of the
mirror modifier
- "Value" in HSV nodes, see #105113
- "Area" in the Face Area geometry node, can mean a measurement or a
window type
- "New" is an adjective that can have agreement
- "Tab" can be a UI element or a whitespace character
- "Volume" can mean a measurement or an object type. The latter is
already disambiguated using `ID_ID`
These changes introduce the new `BLT_I18NCONTEXT_TIME` translation
context.
They also remove `BLT_I18NCONTEXT_VIRTUAL_REALITY`, which I added at
one point but then couldn't find which messages I wanted to fix with
it.
Ref #43295
Pull Request: #106718
This property is not editable after 7966cd16d6,
though doing so didn't seem to give an error. It doesn't have
to be set anymore, since the data is redundant with the
"loop_start" anyway.
Existing code was intrisically wrong, and also potentially very
innefficient.
Now tagging objects for deletion and removal is separated from actual
collection removal and object deletion. This makes the code safer,
simpler and more efficient.
NOTE: There is still an unsolved (already existing in original code)
issue with checks on objects that should not be deleted, noted in code.
Pull Request: blender/blender#106821
Links created through the normal Python API are invalid since
7026096099. Before then, one could create links to or from virtual
sockets from Python (grayed out sockets in Group Input and Group
Output nodes), as is still possible in the GUI.
This is documented as an API change, and it broke at least Node
Wrangler, see blender/blender-addons#104470. Instead of just fixing
that, let's introduce an API to make this operation simpler.
Pull Request: blender/blender#105975
Mistake in ba25023d22, updated the drawing code with the wrong function
call. So when setting the add-ons category to "User", add-ons installed
in the user paths (custom paths configured in Preferences) wouldn't show
up.
`script_paths()` wasn't updated correctly, but that was hidden by some
compabtibility logic that was in the patch earlier. Only with my last
change to the PR before merging it that was removed and the error became
quite visible.
When loading an external file in the text editor, the footer text
stating "File: <file>" or "File: <file> (unsaved)" was not translated,
because the translation happened after string formatting, and the
message was thus not found in the po files.
Pull Request: blender/blender#106716
When trying to search for the Vector Math node with a translated
interface, the node did not come up because it did not use the proper
translation context.
The Vector Math node's RNA had a translation context added in
db87e2a638, in order for the Floor operation to be disambiguated. I
made a mistake and added the context to the entire node struct instead
of just the Operation prop. This had the result that the Vector Math
was searched with an empty context in the search menu, but could not
be found.
Replacing the translation context from the struct to the property
fixes the issue, and actually allows disambiguating operations such as
Floor, which wasn't achieved previously.
Pull Request: blender/blender#106579
The call to `channel_sum` requires that the `weights` array is at least
as large as the number of channels in the originating buffer.
Switch to use the span overload as well since the method that takes a
raw weights array is deprecated.
Thanks to @aras_p for debugging the issue.
Pull Request: blender/blender#106847
f36543c5f5 took care of syncing multiple viewport`s cameras, but wasnt
fully meeting intentions [which was to only do this if both viewports
are locked to the scene camera].
Check was only done for the viewport this was executed in (if this was
locked to the scene camera, it would change all other viewports as
well), now also check if the target viewport prefers to use its own
local camera instead and skip it in that case.
Pull Request: blender/blender#106799
Defer acting on the tag to update scale as it caused the window
to use the wrong scale on startup & exit.
GTK/KDE applications seem to postpone updating scale so use this by
default as glitches with scale tend to be caused by updating the scale
too frequently instead of not quickly enough.
There is no need to postpone these operations when configuring the frame
only postpone committing the surface change.
Deferring these operations caused flickering when moving windows
between monitors of different scale on both GNOME & KDE.
This checkin will use OIIO to replace the image save/load code for BMP,
DDS, DPX, HDR, PNG, TGA, and TIFF.
This simplifies our build environment, reduces binary duplication,
removes large amounts of hard to maintain code, and fixes some bugs
along the way.
It should also help reduce rare differences between Blender and Cycles
which already uses OIIO for most situations. Or potentially makes them
easier to solve once discovered.
This is a continuation of the work for #101413
Pull Request: blender/blender#105785
Freeing ContextEGL would attempt to free the context's EGLSurface,
which was already freed by the native-window, causing 2x bad-surface
errors on exit.
Suppress the warning by clearing the surface from releaseNativeHandles
when the surface was created by a native window.
It was that names of related "combo" operations
like Hue/Saturation/Value, *Dilate/Erode*
and Brightness/Contrast should be separated
by slashes in their names.
This patch changes this for the multiple nodes
and operators concerning Hue/Saturation/Value
across Blender.
Note1: This patch should only touch UI names
which do not need versioning and should not
break scripts.
Note2: This breaks first letter fuzzy search
for "hsv". It was noted by @HooglyBoogly that
the "/" character needs to be added to the
fuzzy search split list. Note however that such
search is already broken in Main for nodes like
Brightness/Contrast and Dilate/Erode which
already use slash separators
Pull Request: blender/blender#106721
Rename *Bright/Contrast* to *Brightness/Contrast* in order to avoid the use of shortened names and improve consistency within Blender and with industry conventions.
Reasoning:
The modified color characteristic is called *brightness*, not *bright*. You don't modify the *bright* of an image.
This also interferes with search in case someone searches for brightness, producing no results.
*Note: This patch should only touch UI names which do not need versioning. It leaves the actual property name in nodes for a future breaking release.*
Pull Request: blender/blender#104998
Before 6c774feba2, the maximum number of UV maps was
enforced throughout Blender. Now it has to be enforced in the few places
that actually have the limit. In the future the limit of the subsurf
could be lifted, but that isn't done now to keep the crash fix simple.
Since the positions of the final mesh are modified rather than a
separate array after d20f992322, the final mesh has
to become the deformed mesh after the deform modifiers, rather
than the input mesh. The arrays can't be shared anymore, but that
performance loss will be solved by implicit sharing shortly.
Give errors in a few cases:
- The mesh has no UV map
- The faces have no area
- The applied modifier has no curve data (it may have been modified)
Use errors instead of cancelling the operator completely so the
operator can still do something useful when many meshes are
selected and only some fail.
Pull Request: blender/blender#106823
The new poly offsets were needed to interpolate attribute to a different
domain, but they were cleared when the legacy MPoly array was built.
Instead just clear the offsets a bit later after the other conversions.
Do not include Fake Draggable button in file lists if the space is so
constrained that they have negative widths. Avoids debug assert.
Pull Request: blender/blender#106777
Blender 3.5 has a performance regression in the image engine
that made the image engine 3-4x slower then 3.4. The cause of
this was the new way how panning was implemented.
This PR disables the new panning for now as a short term fix.
In the future the panning and improvements we did ensured
better performance when dealing with higher resolution images.
But the regression for regular images weren't acceptable.
This fix might introduce other performance regressions on
lower end systems.
In the future we still want to improve the performance to
get back to Blender 3.0 performance, but that requires more
work and has a different priority.
Pull Request: blender/blender#106803
This is mistake in the refactor of the DNA storage which unified
the camera and object storage. The bit which was missed from the
initial logic is that the autosave does not use regular file
write.
Detect this in the do-versioning code and rely on the new data
format when it exists.
A candidate for 3.5.1 release.
Pull Request: blender/blender#106811
Makes it possible to select multiple custom script directories in Preferences >
File Paths, replacing the single Scripts path option. Each of these directories
supports the regular script directory layout with a startup file (or files?),
add-ons, modules and presets.
When installing an add-on, the script directory can be chosen.
NOTE: Deprecates the `bpy.types.PreferencesFilePaths.script_directory`
property, and replaces `bpy.utils.script_path_pref` with
`bpy.utils.script_paths_pref`.
Pull Request: blender/blender#104876
When using ASAN on Clang / Linux, the call to `find_library(... asan ...)`
works against us, as it finds GCC's `libasan.so`. To work with Clang,
we should simply not pass any explicit library, as Clang will figure things
out by itself with the `-fsanitize=xxx` options.
Furthermore, Clang is incompatible with `-fsanitize=object-size`, so that's
now also no longer passed on Linux (mimicking the Apple) configuration.
For the long run, it would be better to rewrite this entire section to
select behaviour on a per-compiler basis, rather than per platform. That's
tracked in #105956
Pull Request: blender/blender#106675
Legacy drivers don't support auto type casting in comparisons.
This PR fixes some comparisons cast.
Thanks to Johannes J. for working/thinking along with the PR.
Pull Request: blender/blender#106789
The shader was compiled without the right define, disabling the world
volume lighting.
This had nothing to do with the light path node as the lighting
was totally disabled.
Pull Request: blender/blender#106787
This came up in #106591 which reported that changing a Light Group would
not work when alt-clicking the property field (which is the usual method
to edit a property for multiple objects at once).
This is because string properties were not supported in
`ui_selectcontext_apply` which is now done.
Similar to 1318660b04 [which added support for pointer properties].
Adding general support for string properties means this method can now
be used for many more things:
- changing all sorts of ID names (objects, meshes, ...)
- many settings in modifiers (e.g. vertexgroups)
- geometry nodes modifier properties (e.g. attribute names)
- ...
Fixes#106591
Pull Request: blender/blender#106599
Updating the buffer scale increased the window size based on the
previous window scale. Since the previous scale (DPI) newly created
windows restored from a `.blend` file isn't known, don't scale the
window size when updating the window's scale for the first time.
When a window overlaps multiple outputs, always use the resolution
on the output with the highest resolution. This means Blender never
shows low resolution content up-scaled.
Share logic between fractional & non-fractional window scaling.
This also enables fractional-scaling without scaling fixed sized buffers
for compositors without support for fractional_scale_manager_v1.
There is a `KeyError` exception when the `install_linux_packages.py` build script is ran with `--distro-id`:
```console
$ ./build_files/build_environment/install_linux_packages.py --distro-id arch
INFO: Distribution identifier forced by user to arch.
Traceback (most recent call last):
File "file:///blender/./build_files/build_environment/install_linux_packages.py", line 1656, in <module>
main()
File "file:///blender/./build_files/build_environment/install_linux_packages.py", line 1646, in main
distro_package_installer = PackageInstaller(settings) if settings.show_deps else get_distro_package_installer(settings)
File "file:///blender/./build_files/build_environment/install_linux_packages.py", line 1570, in get_distro_package_installer
return DISTRO_IDS_INSTALLERS[get_distro(settings)](settings)
KeyError: None
```
This happens because the `get_distro` function returns `None` if the distribution ID is forced with the `--distro-id` option, when it should return the provided value.
Pull Request: blender/blender#106461
This patch implements the Map UV node for the realtime compositor. This
is different from the CPU implementation in that it relies on the
approximate EWA filtering provided by the driver's implementation of
anisotropic filtering to displace the texture. This is easier and faster
than implementing EWA manually in the shader and has identical quality
where it matters.
Pull Request: blender/blender#106765
This patch implements the Fog Glow option in the Glare node. The
implementation does not match the existing implementation in the CPU
compositor, because it is computationally infeasible for the realtime
compositor. Instead, this implementation is similar to how Bloom is
implemented in EEVEE, based on the talk:
"Next Generation Post Processing in Call of Duty: Advanced Warfare".
This is just a temporary solution as requested by users until we either
implement an accurate implementation using FFT, provide a separate
option for EEVEE bloom, or roll out a different solution altogether.
Pull Request: blender/blender#106042
This patch implements the Displace node for the realtime compositor.
This is different from the CPU implementation in that it relies on the
approximate EWA filtering provided by the driver's implementation of
anisotropic filtering to displace the texture. This is easier and faster
than implementing EWA manually in the shader and has identical quality
where it matters.
Pull Request: blender/blender#106681
This patch implements the Z Combine node for the realtime compositor.
The patch also extends the SMAA implementation to work with float
textures as a prerequisite to the Z Combine implementation. Moreover, a
mechanism for computing multi-output operations was implemented, in
which unneeded outputs will allocate a dummy 1x1 texture for a correct
shader invocation, then those dummy textures will be cleaned up by
calling a routine right after evaluation.
This is different from the CPU implementation in that the while combine
mask is anti-aliased, including the alpha mask, which is not considered
in the CPU case.
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#106637
#### Summary
Occlude edit mode selection behind objects in object mode.
#### Problem
When doing retopology, you want to be able to select your edit mesh,
but only when you can see it.
Being able to select geometry behind reference objects is not
desirable.
#### Solution
Make it so reference objects occlude selection, while the edit mesh is
pushed towards the view using retopology offset.
#### Limitations
Poly Build is not supported, because it doesn't use the depth buffer.
It behaves the same as normal, unoccluded by reference meshes.
#### Notes
Selection occlusion is not used when xray is enabled. This is
intentional.
Pull Request: blender/blender#105498
This is necessary for #106228. Without this, `PBVH` might contain pointers to
data that either does not exist anymore or that must not be edited because
it is shared.
Pull Request: blender/blender#106271
There is no point in checking if the allocation of this relatively
small array was successful. We only do that in very few places,
but here it just adds unnecessary complexity.
Allow Text Object operator FONT_OT_case_set to correctly transform the case
of strings written in almost all scripts that differentiate letter case.
Pull Request: blender/blender#106581
Similar to 8d0920ec6d and aef0e72e5a.
In a test case with 2 million curves and 15 million points
I observed a 10x performance improvement, from 2.2s to 0.2s
to copy the data from Blender to Cycles.
Similar to 8d0920ec6d.
In a test case with 8 million points and 3 attributes, I observed
around a 9x performance improvement, from 1.8s to 0.2s to copy
the data from Blender to Cycles. For some attribute types, using
implicit sharing could remove the need to copy entirely, but removing
the overhead from the RNA API makes sense anyway.
Only use the denoised buffer for access of denoised passes, and
access the rest of the passes from the original render buffer.
This allows in-place modification of the guiding passes needed
by the denoiser without affecting the final render result pixels.
Pull Request: blender/blender#106668
Stored `ComponentIDKey` and `OperationIDKey` would still use string
references (char pointers) to data in related IDs, instead of using the
already locally stored std::string name of their matching `ComponentNode`
or `OperationNode` for that.
During undo, to reduce updates and speedup undo steps, a lot of IDs get
'replaced in place', i.e. new data read from the undo memfile is moved
into the existing 'old' ID memory address. And the depsgraph is also
re-used from the old BMain.
Calling `DEG_id_tag_update` and similar on the ID could then cause
depsgraph code to access freed memory from the 'old' data.
Joint effort with @sergey and the rest of the depsgraph team, thanks!
The Exit Group menu entry was mistakenly only whown for nodes who are
themselves also group nodes. It should be show for any node inside a
group.
Pull Request: blender/blender#106643
Issue caused by inconsistency in GPUFramebuffer viewport state
between Metal and OpenGL. The MTLFramebuffer code has been
modified such that framebuffer viewport/scissor state is retained
and only updated if attachments are modified during bind.
This is consistent with OpenGL. Previously, other updates to the
framebuffer in Metal would reset the viewport region, especially
if attachments were temporarily removed. This caused the color
picker selection to be misaligned.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#106619
Introduce a context manager that temporarily overrides a UILayout's
operator context.
Instead of writing this:
```py
default_op_context = layout.context
layout.context = 'OTHER_VALUE'
layout.do_stuff()
layout.context = default_op_context
```
you can now write this:
```py
from bl_ui_utils.layout import operator_context
with operator_context(layout, 'OTHER_VALUE'):
layout.do_stuff()
```
This is also exception-safe; it will always ensure the layout's operator
context is restored when the `with` body is exited, regardless of
whether that's done with an exception or regularly.
Idea in-the-hallway approved by @Sergey.
Autosave files are created from memfile undo, which
doesn't save legacy mesh data. This leads to a crash
on file load.
In addition the mesh code can now add CustomData
layers when saving files, which did not work if
the original domain had no layers. In that case
CustomData.layers is NULL and DNA has nothing to
key off of when loading the file later.
Pull Request: blender/blender#106648
CustomData_get_active_layer_index() was used by accident. But that
returns the CustomData layer index (in all layers) as opposed to
CustomData_get_active_layer(), which returns the active UV layer.
Pull Request: blender/blender#106644
Barycentric coordinate convention was changed at some point, which is
reflected in `motion_triangle_shader.h` (1c2c468abc) but not in
`motion_triangle.h`, this is also fixed by sharing functions between the
two header files.
Pull Request: blender/blender#106629
Check the specific case of `OP_IS_REPEAT_LAST` and recalculate
the orientation.
To that, pass the `OP_IS_REPEAT` and `OP_IS_REPEAT_LAST` flags as
inheritance to macro operators.
Force field absorption allows dampening of force fields by colliders, but it does not currently work when the scene only contains a rigid body simulation. It requires a particle simulation, cloth, dynamic paint, fluid sim, or softbodies for the feature to work correctly.
The reasons is that the effector function computing force field strength uses depsgraph relations to determine which colliders "absorb" the force field. If there are no dependencies between colliders and effectors registered in the depsgraph, the visibility function `eff_calc_visibility` does not add any absorption.
There is a function build_collision_relations which adds a dependency between the absorption object (the one with a collision modifier) and the forcefield object. It's currently only called by
1. Particle systems (DepsgraphRelationBuilder::add_particle_collision_relations)
2. Cloth, DynPaint, Fluid, and Softbody (DEG_add_collision_relations and indirectly through DEG_add_forcefield_relations).
The `DepsgraphRelationsBuilder` now adds the effector relations also when building rigid body relations.
Pull Request: blender/blender#106503
Since e3801a2bd4, we would always respect
hiding for vertex paint and weight paint (drawing code and stroke based
painting), leaving an inconsistency between the different paintmodes.
To rectify this, now also always respect edit mode hiding for projection
painting as well.
Some feedback was gathered in #sculpt-paint-texture-module to ensure
this is desired behavior.
Note: this does not change the (experimental) texture painting in
sculptmode [this already respects hiding via PBVH, albeit in a manner
that bleeds into hidden faces if the brush center is over visible faces]
ref #106354
Pull Request: blender/blender#106544
After investigating the crash logs it looked like the macro
unrolling wasn't working on Windows systems with these GPUs.
Macro unrolling was changed in order to cross compile to Metal and
in the future to Vulkan. The macro unrolling in OpenGL can be removed
by using a different naming scema.
This PR removes the macro unrolling by changing the generated GLSL
code:
**Before**
```
layout(std140) uniform _probe_block
{
ProbeBlock probe_block;
};
```
**After**
```
layout(std140) uniform probe_block
{
ProbeBlock _probe_block;
};
```
Some tweaks had to be done to the Eevee-shaders to make sure that
the macro unrolling is done correctly and could be compiled using
legacy opengl drivers.
Fix: #106278Fix: #106555
(and others)
Pull Request: blender/blender#106535
Python has several different string types [0], each using a prefix to
indicate the type. Presently Blender's Text Editor / syntax highlighting
does not include the prefix as part of the string, which makes the
prefix appear as a syntax error. This patch looks for these prefixes,
and includes them with the string highlighting.
Note: prefixes can appear in either case (ex: f and F mean the same
thing), and some prefixes can be combined (ex: fr is a raw f-string).
[0]: https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals
Ref D14739
Show Splash screen if there are no Preferences found even if we are
launched with a filename, so that users can migrate old settings.
Pull Request: blender/blender#105863
Resolve small indexing issue in Metal implementation
of motion path line rendering.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#106595
The legacy conversion from MLoopUV to generic attributes used the
active and default layer names to copy the active/render status to the
new layers. But sometimes the names can change, and they weren't
updated in that case. Instead, store the active status with an index
into the names array (use an array instead of Vector for clarity).
fa0f295b53 exposed that there was a region missing because of some
faulty versioning.
The `fluid_motion_blur.blend` Cycles test file was crashing. Seems like
this is a pre 2.5 file that was resaved in newer versions, but the
preview region for the Sequencer was missing. Before mentioned commit,
the region would be broken when activating the preview view mode in the
Sequencer, now it would crash even on startup.
Ensure the region exists, as expected.
Introduces *ARegionType.poll()* as a way to dynamically add/remove a region. The region is still there internally, but is not accessible to the user.
Previously editors would to this manually, by either removing/adding regions altogether, or hiding them, unsetting their alignment (so no AZones are added I assume) and removing their event handlers. Polling makes this much simpler.
We plan to use this in #102879.
This patch refactors multiple editors to use region polling:
- File Browser
- Sequencer
- Clip Editor
- Preferences
Notes:
- Previously, editors would lazy-create some of the regions. Versioning is added here to ensure they are always there. Could be a separate patch.
- Some editors reuse a region in different display modes, and so additional work needs to be done to reinit regions they become available or the mode changes. Typically `V2D_IS_INIT` is unset for that, which isn't great. Could be improved, but not a new issue.
Behavior change:
- When the Preferences are opened as a regular editor, the "execution" region in the preferences that displays the *Save Preferences* button would still be there, but empty with a scrollbar.
This patch makes it disappear entirely.
## Implementation
- Introduces `ARegionType.poll()`
- Before a window is drawn, all contained regions have their poll checked, and the result is stored in a flag (`RGN_FLAG_POLL_FAILED` - runtime-only flag).
- If the result of the poll changes, the area is re-initialized and event handlers are added/removed.
- UI code checks the flag as needed.
Pull Request: blender/blender#105088
To prepare for OIDN2 with GPU support, some of the code that was exclusive to the OptiXDenoiser is being moved to the DenoiserGPU superclass.
Co-authored-by: Stefan Werner <stefan.werner@intel.com>
Pull Request: blender/blender#106496
Any errors from calling `bpy.ops.render.render(write_still=True)` would
be suppressed, making it impossible to know what went wrong.
Now the operator now reports errors when run via `exec` which mainly
occurs when the operator is called from scripts.
Interactively rendering via `invoke` is left as-is since users can see
the error in the UI and showing a popup error is disruptive.
The assets are required to build proper Blender release, so they can not be
skipped from packing.
The packing ignores the `working` directory as it seems to be big and sounds
that it is not needed for the release.
The assets are bundled under the `release/datafiles/assets` folder in the
blender sources. This is where they will reside after switch to the Git LFS.
Pull Request: blender/blender#106536
Use the latest Wayland version, resolves inverted track-pad scroll
direction #104272 by adding support for physical scroll direction.
Updates to GHOST/Wayland have already been made.
The "reverse map" of corners to faces and points to curves is the same
for meshes and curves now. Move it to the offset indices header to
reflect this.
This unification can go further in the future, but I'd rather wait
until the design is clearer for now.
Pull Request: blender/blender#106570
Similar to 4bcd59d644. This probably got worse recently with
the generic attribute refactors for `Mesh`, but the final performance is
probably much better than older versions too.
Timings extracting attributes from a 16 million vertex grid (seconds):
- Corner float attribute: 0.72 -> 0.19
- Face float attribute: 0.60 -> 0.07
- UV map: 3.18 -> 0.05
Implements #95967.
Currently the `MPoly` struct is 12 bytes, and stores the index of a
face's first corner and the number of corners/verts/edges. Polygons
and corners are always created in order by Blender, meaning each
face's corners will be after the previous face's corners. We can take
advantage of this fact and eliminate the redundancy in mesh face
storage by only storing a single integer corner offset for each face.
The size of the face is then encoded by the offset of the next face.
The size of a single integer is 4 bytes, so this reduces memory
usage by 3 times.
The same method is used for `CurvesGeometry`, so Blender already has
an abstraction to simplify using these offsets called `OffsetIndices`.
This class is used to easily retrieve a range of corner indices for
each face. This also gives the opportunity for sharing some logic with
curves.
Another benefit of the change is that the offsets and sizes stored in
`MPoly` can no longer disagree with each other. Storing faces in the
order of their corners can simplify some code too.
Face/polygon variables now use the `IndexRange` type, which comes with
quite a few utilities that can simplify code.
Some:
- The offset integer array has to be one longer than the face count to
avoid a branch for every face, which means the data is no longer part
of the mesh's `CustomData`.
- We lose the ability to "reference" an original mesh's offset array
until more reusable CoW from #104478 is committed. That will be added
in a separate commit.
- Since they aren't part of `CustomData`, poly offsets often have to be
copied manually.
- To simplify using `OffsetIndices` in many places, some functions and
structs in headers were moved to only compile in C++.
- All meshes created by Blender use the same order for faces and face
corners, but just in case, meshes with mismatched order are fixed by
versioning code.
- `MeshPolygon.totloop` is no longer editable in RNA. This API break is
necessary here unfortunately. It should be worth it in 3.6, since
that's the best way to allow loading meshes from 4.0, which is
important for an LTS version.
Pull Request: blender/blender#105938
`PLATFORM_BUNDLED_LIBRARIES` was installing right next to the blender
executable rather than the `blender.shared` folder,
`PLATFORM_BUNDLED_LIBRARIES` wasn't used very much on windows, just
by the ONEAPI code which likely wasn't aware this plumbing was
still missing.
This diff adds support for using `PLATFORM_BUNDLED_LIBRARIES` on
windows in both debug and release configurations.
You can differentiate between a .dll being installed for debug/release
or all configurations, by prefixing the library with either `DEBUG`,
`RELEASE` or `All`, if no prefix is given `ALL` is assumed.
Pull Request: blender/blender#106348
When accessing UVmaps from python in BMesh, the UVmap name/index was ignored
and the active UVmap always used. This fixes this by passing the layer index
to the underlying CustomData function.
Pull Request: blender/blender#106537
This was only used in a single place, multires baking, where it's simple
to just retrieve the looptris from the temporary `Mesh` that we already
create to simplify accessing normals. This allows removing a bunch of
complexity from `DerivedMesh`, to help progress towards its complete
removal at some point in the future.
Also use `Span` more instead of raw pointers in multires baking,
and pass around the spans instead of the low-resolution DerivedMesh.
Caused by 16fbadde36. The first mistake was passing a pointer
to a poly to what was meant to be the pointer to the start of the array.
Use Span instead to avoid that confusion. The second was a logic error
in CCGDerivedMesh's lazy initialization of corner data. The data was
copied when the mesh is created so it wasn't initialized.
This PR adds debug information inside the spir-v assembly to enable
step-by-step debugging of Shaders using renderdoc. The debugging
information can be fairly large so are only generated when used
with the `--debug-gpu-renderdoc` feature.
During debugging shader optimizations are turned off.
Pull Request: blender/blender#106546
Regression caused by 98bfa8d458
The `XRAY_ENABLED(v3d)` check was lost during a modification to
`transform_snap_context_project_view3d_mixed_impl` function.
This caused vertex snapping in solid shading to jump between visible
and occluded faces.
Pull Request: blender/blender#106495
This patch refactors the texture samples code by mainly splitting the
eGPUSamplerState enum into multiple smaller enums and packing them
inside a GPUSamplerState struct. This was done because many members of
the enum were mutually exclusive, which was worked around during setting
up the samplers in the various backends, and additionally made the API
confusing, like the GPU_texture_wrap_mode function, which had two
mutually exclusive parameters.
The new structure also improved and clarified the backend sampler cache,
reducing the cache size from 514 samplers to just 130 samplers, which
also slightly improved the initialization time. Further, the
GPU_SAMPLER_MAX signal value was naturally incorporated into the
structure using the GPU_SAMPLER_STATE_TYPE_INTERNAL type.
The only expected functional change is in the realtime compositor, which
now supports per-axis repetition control, utilizing new API functions
for that purpose.
This patch is loosely based on an older patch D14366 by Ethan Hall.
Pull Request: blender/blender#105642
Related to #106535 where a similar fix was done for OpenGL. A small
cleanup that might reduce the complexity during GLSL shader compilation.
Pull Request: blender/blender#106538
Renderdoc requires all calls/updates to originate from the same
context. It also doesn't support multithreading. For now we
enable main context workaround.
The renderdoc integration used to be behind the `--debug-gpu`
command line option. When using `--debug-gpu` outside renderdoc
error messages where displayed that aren't relevant.
This PR adds a specific command line option for the renderdoc
integration. This option will also enable `--debug-gpu`.
Pull Request: blender/blender#106541
This was the case with hidden faces and `Sync Selection` turned ON.
Caused by 8f543a73ab.
Since 8f543a73ab, the UV element map
respects the hidden state of geometry, but stitching [which also
respected this on its own even prior to the culprit commit in its
calculation of connectivity] did this differently [it only skipped
hidden geo when UV_SYNC_SELECTION was OFF -- even though UVs would not
be visible which is probably the real error here, I believe there is
this principle that we "dont act on stuff we dont see"].
To fix this, also skip hidden geo (even with UV_SYNC_SELECTION = ON) in
the stitch calculation of connectivity, just as
`BM_uv_element_map_create` does it.
Should go into 3.3 LTS as well.
Pull Request: blender/blender#106493
Depending on newer API's could cause build failure for existing
builds using wayland-protocols outside of Blender's 'lib' directory.
Now the existence of the most recent XML file is checked on each CMake
execution, resetting the cache when not found so the protocols in
`../lib/linux_x86_64_glibc_228/` will be used instead.
The function which collects files to process in add-on extraction
returned only files that did not start with '_', in the case where the
add-on was a module in a directory. This excluded __init__.py, which
may very well contain UI code, so an exception is added for this case.
This change currently allows the extraction of 42 new messages.
Logic for the recently included fractional scaling support [0] was
difficult to reason about as it depended on two different callbacks
one that listened to a preferred scale, another that tracked which
physical displays the window overlapped.
Checking if fractional scaling was in used depended on the order
the callbacks ran - which is undefined.
In practice - mixing non-fractional and fractional displays would
flicker when the window was moved between monitors.
Resolve this problem with the following changes:
- When the fractional-scale manager is supported,
only respond to the scale from it's preferred_scale callback.
- When no fractional-scale manager is available,
set the scale based on the scale of overlapping outputs.
- Add support for postponing the buffers commit call to prevent
flickering when changing the windows scale.
Other changes:
- Use a lock before setting the pending frame state from
wp_fractional_scale_handle_preferred_scale.
- Ensure pending actions that themselves trigger pending actions
run in the time gwl_window_pending_actions_handle is called.
- Rename GWL_Window::scale -> GWL_WindowFrame::buffer_scale.
[0]: cde99075e8
Depend on fractional-scale when searching for wayland-protocols
This will impact builders that don't use Blender's `../lib/` and
have wayland-protocols older than v1.31.
For some reason, lattice modifier always depend on self object transform.
This fix just move extra dependencies in to if case statement, also some
cleaning of this code area.
Pull Request: blender/blender#105293
Caused by the changes in the submodules configuration.
Can no longer rely on the `git submodule` command to
show list of external references to be packed.
Needs to be backported to 3.5.1.
Pull Request: blender/blender#106502
This happens even though there is only one user.
The Outliner only implements this `Make Single User` for worlds
(`singleuser_world_fn`) and actions (`singleuser_action_fn`) [it is
questionable if the whole functionality could be removed really, but
this is for another report] and it uses `id_single_user` to do so --
this function does not check if we even have more than one user though,
so data gets duplicated resulting in duplicate worlds or actions even if
they only have one user and shouldnt be touched.
Now let `id_single_user` check usercount and only act if we have more
than one real users.
Pull Request: blender/blender#105991
pgettext_tip incorrectly imported as iface_ instead of importing
pgettext_iface. These leads to incorrectly translated attribute text
shown when the user elects to translate only tooltips.
Pull Request: blender/blender#106507
Caused by filebrowser calling space `refresh` function. The intention of
refresh function was mainly to hide channels when view type is changed.
Unhiding channels when view is changed back seems logical, but this
causes issues when region is too thin, which results in hiding side
panel, which is more important.
When creating nodes by dragging a link, it can be convenient to
transfer values from input socket. For reference values, like images,
this may be necessary to avoid unnecessary data-block users. This
patch starts adding such a system. At this moment this only makes sense
for one node (Image Input), but this can be extended to work with other
reference types, different non-reference types and support auto-casting
(if a float is transferred to the Integer Input node).
See task: blender/blender#102854
Original patch: https://archive.blender.org/developer/D16735
Pull Request: blender/blender#105972
Previously the only way to control the subtype was to remove the group
input or output and create it again. This commit adds a dropdown to
change an existing socket, for supported socket types.
Based on a patch by Angus Stanton: https://developer.blender.org/D15715
It was necessary to fix the UI code slightly; the layout's context
wasn't being used in calls to an operator's enum items callback.
Pull Request: blender/blender#105614
The potential optimization in the normal edit modifier when flipping
faces isn't worth the "API impurity" and complexity introduced by
adding poly normal editing as part of the API. This change simplifies
future changes to the ownership of poly normals with a shared cache,
which can prevent recomputing poly normals completely.
Vertex positions and faces aren't changed, so most caches shouldn't
need to be tagged. This removes unnecessary re-computation of bounds,
triangulation, loose edges, etc.
Pull Request: blender/blender#106250
Make it a native Cycles light option instead of counter-acting the inverse
area calculation in Hydra.
Differential Revision: https://developer.blender.org/D16838
HdRenderDelegate got a change with the interface, adding gpuSupported. It
currently is just a dummy implementation without checking for anything
GPU-related.
Differential Revision: https://developer.blender.org/D17207
The problem is that `set_geometry()` otherwise ends up implicitly
casting `Geometry*` to bool. In Blender this worked because the
geometry header was always included before the object header.
Differential Revision: https://developer.blender.org/D16737
Allows NLA strips to horizontally translated over each other. If a strip is dropped when translating, it'll cause the strip to shuffle into place.
---
Abstracted large conditional branch in `recalcData_nla` into it's own `nlastrip_fix_overlapping` method for increased readability. No logical changes were made.
---
[Archived Phabricator Patch](https://archive.blender.org/developer/D10102)
Pull Request: blender/blender#105532
Use raw Blender structs and mesh data rather than using the RNA API.
There isn't any benefit from using the RNA when Cycles is compiled
with Blender anyway, and a profile showed that the majority of time
was spent in Blender RNA API functions.
This gives a significant improvement in performance when ingesting
meshes. Here are some tests of the runtime of the `create_mesh`
function (in seconds):
| | Before | After |
| ------------------------- | ------ | ----- |
| Grid | 0.66 | 0.11 |
| Many realized cubes | 2.60 | 0.48 |
| Large curve to mesh setup | 4.18 | 1.14 |
Also change to resizing the arrays and filling them by index rather
than appending. This makes the parallel aspect of the logic clearer,
and makes the loops easier to parallelize in the future, and makes
it easier to have a performance benefit when an attribute like
`sharp_face` doesn't exist.
Pull Request: blender/blender#106275
Use the dot product of the normal of the two polygons connected to the
edge to calculate the edge factor.
This fixes#90641 and #102545 and ensures more predictable results for
boundary and non-manifold edges.
Co-authored-by: Germano Cavalcante <mano-wii>
Pull Request: blender/blender#105352
No functional changes.
Edges hidden by Optimal Display are hidden by edge factor Shader.
But there is not much advantage in doing this, as the number of edges
hidden by the Optimal Display is usually much higher than the number of
visible edges.
And the lines extractor does not include invisible edges due to other
factors.
So this change makes:
- Visibility test more consistent with what is actually seen.
- Smaller buffer for IBO sent to GPU
- consistency with GPU Subdivision that already considers Optimal Display
- Allows possible improvement in the "Edge Factor" extraction by making
it unnecessary to check the Optimal Display (except for optimization).
Co-authored-by: Germano Cavalcante <mano-wii>
Pull Request: blender/blender#106402
Popover menu buttons had their labels translated but not their
descriptions, although they were properly extracted.
This commit fixes that using the `TIP_()` macro.
This information is displayed in the top left of the 3D Viewport with
other text info. The units of the grid are already extracted, but they
were not translated in the drawing code.
Remove comments from `eBConstraint_Types` that
- were used long ago during a big refactor effort, but are no longer
necessary, or
- just repeated the name of the enum constant.
No functional changes.
OpenEXR has some dependecies that other other modules in Blender
requires. When disabling OpenEXR these dependecies could not match
and building blender would fail.
This PR disables the next options when `WITH_IMAGE_OPENEXR=Off`
- `WITH_OPENVDB`
- `WITH_ALEMBIC`
- `WITH_VULKAN_BACKEND`
- `WITH_CYCLES_OSL`
Additionally windows stores the IMath libraries in `IMATH_LIBRARIES`
Linux and Mac stored the IMath libraries in `IMATH_LIBRARY`. This
change will also adds `IMATH_LIBRARIES` variable to all platforms.
Pull Request: blender/blender#106209
Splitting workload dependency chains such that they
only exist within the context of a single frame.
Dependencies are required to ensure sequential
command buffer submissions execute in order,
but the additional dependencies between frames
could incur GPU timeouts, if a signal was delayed.
This could be triggered by both CPU/GPU cycles
texture updates and Viewport Compositor operations.
Should also resolve#106401
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#106443
Reduce register spill to global memory in raytrace_resolve
function. Results in a 20% uplift for this particular shader on
Apple Silicon GPUs. Contributing to 3-5% uplift for scenes
which have SSR enabled. This is achieved via reducing
memory pressure using a packed data type for the sampling
kernel.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#106231
Very sadge to see this kind of mistakes still exist in 2023 code...
While in theory this commit could be backported to (LTS) releases, would
rather only do it if/when proven it actually fixes user-facing issues.
Fixing such issues so deep in ID management code can have completely
unexpected side effects.
The framebuffer default size was only set during the first bind. This
is because the `dirty_attachments_ tag` wasn't set and thus the
framebuffer size was never passed down to the GL.
Split to `default_size_set()` to not affect other code paths that use
`size_set()`.
Adds the ability to pack UVs back into the original bounding box.
Choose UV Editor > Menu > UV > Pack Islands
Then change "Pack To" to "Original bounding box"
Face Nearest only works with individual projection, so always set the
`SCE_SNAP_PROJECT` flag in this case.
Also gray out the `Project Individual Elements` option in the UI if
`Face Nearest` is enabled.
And change the description to indicate that `Project Individual Elements`
is always enabled with the `Face Nearest` option.
(I feel a better design for this option needs to be considered).
Avoid introducing another `::modifiers` namespace for now, since it's
not clear if we'll want that long term. This just avoids a bunch of
boilerplate and makes things easier to read.
Use the node group and the properties as arguments instead of
the modifier. This may help to allow reusing the functions outside
of the modifier execution context.
This adds the select more/less operators to the weight paint mode face selection.
Just like in edit mode, press `CTRL`+`Numpad Plus/Minus` to use them.
They have also been added to the `Select` menu.
Pull Request: blender/blender#105607
This adds the select more/less operators to the weight paint mode vertex selection.
Just like in edit mode, press CTRL+Numpad Plus/Minus to use them.
They have also been added to the Select menu.
Pull Request: blender/blender#105633
When retrieving the evaluated mesh to paint on, it can be reevalauted,
where a smaller set of attributes are requested than for regular
evaluated meshes. That reevaluation should be completely removed
(see #106186), but a simple fix in the meantime is to manually
request that data.
When normalization is enabled in the Graph Editor,
the area outside the -1/1 range on the y axis isn't meaningful.
To visually represent that this patch greys out that area
just as it does with anything outside the current frame range.
Pull Request: blender/blender#106302
fast_float.h currently is only used by OBJ, STL and PLY I/O importers.
Update it to the latest release from upstream (from 3.4.0 2020 Nov to
4.0.0 2023 Mar).
No behavior changes, but they have optimized the performance a bit.
Importing a 6-level subdivided Suzanne OBJ file (330MB) goes from 3.5sec
down to 3.2sec on Win10, Ryzen 5950X, VS2022 build.
Previously, fractional scaling was detected but set an integer buffer
scale which the compositor would down-scale causing blurry output.
Now the fractional scaling interface is used when available to set the
DPI and set the internal buffers size & viewport transformation to
ensure 1:1 pixels from Blender to the Wayland output.
Tested to work with multiple monitors with mixed
fractional/non-fractional scale.
Note that this change causes a regression for when fractional scaling
is set on a compositor without support for fractional-scale-v1.
Supporting fractional scaling in both cases is possible but overly
complicated. This case already wasn't working so well - with blurry
output due to image scaling, now the DPI wont be accurate in this case
although Blender is still usable.
It's a bit easier to follow this way, and we can make better use of
const. It's also more reusable in case we have to use it elsewhere
too (for node group operators?).
Use checks for certain node types with better algorithmic complexity.
They should perform better in some edge case with a lot of nodes or
node group nesting. They're now a bit more similar to each other too.
This is the only package that warns about this type of thing, and gets in the
way of actual warnigns on build logs. This requires CMake 3.19+ to take effect,
older versions still show the warnings.
Ensure compression is enabled by using shader_read
flag only. Also ensure that MTLTexture contents
remain in optimal layout for reading after any
data modifications.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#106234
The command buffer fails to execute, the cause is unknown. It does not
appear to be related to the binary archive cache as disabling that does
not prevent the issue.
Pull Request: blender/blender#106328
The issue was caused by uninitialized offset used for the scale
variable.
Follow the rest of the usages of the operation which initialize
it explicitly. This makes it very safe and easy fix to backport
to any LTS or corrective release.
Ideally should probably initialize all members in the class
itself, to avoid such situations in the future.
Pull Request: blender/blender#106325
The cycling method for the viewer connection starts searching from the next socket
after the last current connection. If a geometry socket is is the last connected
output this caused the method to jump to the next socket after the geometry,
potentially skipping over valid data sockets that are not viewed yet.
The solution is to ignore the geometry sockets in the cycling entirely and only
consider data sockets (i.e. non-geometry sockets).
Pull Request: blender/blender#106318
This tool now only supports installing packages, it won't build any
dependency anymore. This implies that on most distributions, it wont
make a complete Blender build possible, some features will likely be
misisng.
By default, it only install basic dev environment to enable building
Blender with the precompiled libraries (which is the recommended way).
Passing the `--all` option will make it try to install all known
dependencies from distro packages. This is a development option,
regular Blender build should be done with the precompiled libraries.
Tested on Debian Testing, Arch, Fedora and Suse Tumbleweed.
With the new design, it should be fairly trivial to add more
distributions if desired, and maintenance should also be way simpler.
NOTE: side effect is that a working python3 interpreter is expected on
system running this script. In practice this should not be an issue,
since Python3 is installed by default in almost all regular desktop
linux installations.
The insert key operator allowed to insert a keyframe on all selected FCurves
and on the Active FCurve at cursor value.
But it didn't allow to insert a keyframe only on the active FCurve.
This patch adds that. It is available in the redo panel and under Key->Insert Keyframes (which can also be called with the I hotkey)
Pull Request: blender/blender#106307
This change aimed to solve the following issues:
- Possible threading issue of two tests writing to the same
file, depending on how the ctest is invoked
- Test using the release directory, and potentially leaving
temp file behind on test failure, breaking code sign on
macOS.
Pull Request: blender/blender#106311
Found together with a fix for #106043.
Edge panning (in Node Editors, Outliner and VSE) does unnecessary
updates when the view has not changed at all. This includes adding
`MOUSEMOVE` events (even if you dont move the mouse at all).
Adding `MOUSEMOVE` events results in the transform system constantly running (even if you dont move the mouse) which we certainly want to avoid.
Rectify this by only calling these updates when the view changes.
Pull Request: blender/blender#106301
The fix for #105363 (6d3ce8273a) made the transform system respect
(Frame) nodes `offsetx`/`offsety`.
Now Node Editors run the transform system even if the mouse is still (due to edge panning -- unnecessarily, see PR #106301 for fixing this). And due to the way `frame_node_prepare_for_draw` recalculates these offsets (based on
on updated positions and `node.runtime->totr` [which in turn gets rounded in `node_update_basis` -- so subpixel precision is lost there, see [1]]), this can lead to slight imprecisions/noise/jitter during transform (if we use float offsets, see the PR for more info).
So to counter this, use rounded offsets now [which will keep the whole circle stable].
NOTE: PR #106301 would fix this already for having the cursor still, but this patch still improves slight jitter when moving, so will commit separately.
[1] comment from `node_update_basis`
> /* Round the node origin because text contents are always pixel-aligned. */
Pull Request: blender/blender#106096
No user visible changes expected.
For brush assets, we need a way to store a reference to a brush in .blend files, so that the last active brush can be restored from the file. See #101908. It seems like a generally useful thing to have.
Adds a new DNA struct to store a "weak" asset reference, that is, a reference that can break under a number of circumstances, but should work reliably enough under normal usage. There's no way to reliably reference an asset currently, so this works on a "best effort" basis. It can break when assets are moved inside the asset library, asset libraries are unregistered from the Preferences, or a file is opened on a different machine with different Preferences, for example. It can also break currently if an asset library is renamed.
It contains:
- Information to identify the asset library the asset can be found in.
- A relative "identifier" (currently a relative path) for the asset within the asset library.
There's further code to resolve a weak reference to file paths and Blender library paths.
Part of #101908.
Co-authored-by: Bastien Montagne <bastien@blender.org>
Pull Request: blender/blender#105603
The goal is to solve confusion of the "All rights reserved" for licensing
code under an open-source license.
The phrase "All rights reserved" comes from a historical convention that
required this phrase for the copyright protection to apply. This convention
is no longer relevant.
However, even though the phrase has no meaning in establishing the copyright
it has not lost meaning in terms of licensing.
This change makes it so code under the Blender Foundation copyright does
not use "all rights reserved". This is also how the GPL license itself
states how to apply it to the source code:
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software ...
This change does not change copyright notice in cases when the copyright
is dual (BF and an author), or just an author of the code. It also does
mot change copyright which is inherited from NaN Holding BV as it needs
some further investigation about what is the proper way to handle it.
When hitting the "normalize" button in the graph editor, set the y extents of the view to the extents of the `FCurves`.
Previously you had to search for your curves after pressing that button.
Pull Request: blender/blender#105857
Similar to recent OBJ UV values merging commit (05a63e3705) - build
mapping of (vertex, UV) by going over the face loops directly, instead
of using BKE_mesh_uv_vert_map_get_vert and then having an additional
map on top. Provide the mapping into ready to use flat arrays, instead
of building a map and then building arrays out of that in a separate
pass.
While at it, avoid the extra cost of building all this complicated
mapping when we don't have or are not exporting UVs.
Timing tests on exporting several models into binary PLY file
(Win10, Ryzen 5950X):
- Suzanne subdivided to level 6 (2.1M verts): 0.93s -> 0.68s
- Rungholt Minecraft level (9.7M verts): 3.3s -> 2.3s
- Stanford Lucy 3D scan (14.0M verts, no UVs): 5.2s -> 1.5s
This patch replaces `dispatchThreadgroups` with `dispatchThreads` which takes care of non-uniform threadgroup bounds. This allows us to remove the bounds guards in the integrator kernel entry points.
Pull Request: blender/blender#106217
The system wayland-protocols version is too old, and xdg-activation-v1.xml
is a more recent addition than xdg-decoration-unstable-v1.xml so check for
that.
This patch fixes a MetalRT issue where viable shadow hits are discounted based on the false assumption that hits are ordered by distance. With this patch, the following unit tests now pass:
- openvdb smoke
- shadow catcher pt transparent lamp only 0.8
- shadow catcher pt transparent lamp only 1.0
Pull Request: blender/blender#106276
This is preparation for #106228, the crash does not happen in `main` currently.
The issue was `positions_for_write` might make a copy of the data if it was
shared. This operation is not thread safe on a single mesh. The solution is to
get write-access to the positions only once before threading starts.
This makes the APIs more correct and simplifies debugging, because
some debuggers can now show the enum name instead of the integer.
Pull Request: blender/blender#106268
For example
```
OIIOOutputDriver::~OIIOOutputDriver()
{
}
```
becomes
```
OIIOOutputDriver::~OIIOOutputDriver() {}
```
Saves quite some vertical space, which is especially handy for
constructors.
Pull Request: blender/blender#105594
The DPI returned by the GHOST/Wayland didn't account the buffer being
rendered at a higher (non-fractional) resolution, then scaled down.
This caused the software cursor and UI to rendered very small.
A fractional scale of 101% would show the UI just over 50% of the size
(making the UI to be close to half the scale it should have been).
Resolve by accounting for down-scaling of the buffer to it's
fractional size.
The UI needs persistent pointers to catalog paths that it can pass
around via context. It was trying to manage this in own storage, but
this didn't work. Not entirely sure why - the menus get redrawn
continuously while assets load, and the root menu rebuilds the mentioned
storage every time. Maybe the submenus redraw a bit later, or the
keyboard navigation handling still accessed data from a previous redraw
somehow.
Either way, instead of managing own catalog path storage, point into the
asset system, which already has persistent storage for the catalog
paths.
Pull Request: blender/blender#106237
Don't install libraries in blender.shared and don't generate manifest
as it's not working and not important to have a clean directory here.
Always detect MSVC_REDIST_DIR as it is used by oneAPI. The way
InstallRequiredSystemLibraries is called it already only sets some
variables and doesn't install anything by itself.
Pull Request: blender/blender#105999
This is a workaround fix for Open PGL 0.4.1 when the first volume
samples are collected in a later training iteration.
The problem is fixed in Open PGL > 0.5.0 and the workaround
can be removed after upgrading Open PGL.
The bug was found by ASAN when running the file from #105953. It's not
entirely clear what the root issue for the division by zero is, but
at least now the result is more predictable.
Pull Request: blender/blender#106165
The overall goal is to use implicit-sharing in many places in Blender
that currently do unnecessary copies. See #95845 for more details.
This commit only adds the base data structures in blenlib and uses those
in `GeometrySet` and `AnonymousAttributeID`, which used a more ad-hoc
version of implicit sharing already. #105994 lists some more places where
support for implicit sharing can be added (most notably: custom data layers).
Pull Request: blender/blender#105994
Previous fix/hack a60f651502 made it so that all 'Fake User' linked
IDs are considered as directly linked, so that some IDs (like linked
Text) references are not lost on file save becaus they are not
effectively used.
However, this created unwanted references to all linked assets data,
because an asset always has its fake user set. This ended up keeping
lots of references to sub-assets when appending from the new Essentials
node groups.
NOTE: This is adding another hack to the collection, the whole handling
of 'which unused linked data reference to keep on file save' needs to be
reworked for Blender 3.6.
This was an issue with the `operator_context`. It's a bit confusing because it
looks like every `uiLayout` has its own, but in `uiLayoutSetOperatorContext`
you can see that the `operator_context` is always set on the root layout for
some reason.
The fix is to set `INVOKE_REGION_WIN` as the operator context after it has been
set to something else (I found this to be the default by printing the operator
context before it was changed).
Pull Request: blender/blender#106213
No user visible changes expected.
With this, empty rows will be added to the tree view so that the
background box is at least a few lines high (like with UI lists). If the
view is used as a drop target, data can be dropped on these empty rows
too then.
This was requested for the Cycles light linking project.
This PR adds support for anamorphic aspect rations when using
masks. As viewport compositor doesn't support masks yet, this
has not been added yet.
Pull Request: blender/blender#106121
This PR adds support for clearing framebuffers and scissor testing.
Tweaks had to be made to VKTexture to keep track of its layout
on the device. Based on the actual call the layout can switch
to a more optimum layout.
For example during upload of a texture the texture will be converted
to a transfer destination optimized layout. When reading from the
texture it will be converted to a transfer source optimized layout.
The order of the attachments in the framebuffer follows the next rules
- When only color attachments are there the color attachments will
be placed in the slot they are defined. This way it will match
the ShaderCreateInfo binding location.
- When a stencil/depth attachment is added it will be placed
right after the color attachments. When there isn't a color
attachment it will be the first attachment.
Pull Request: blender/blender#106044
A few small refactors of the `draw_setting_widget()` function for drawing
animation channel widgets (like 'modifier mute', etc.)
- Use `const` where appropriate.
- Move some variable declarations to their actual use, to clarify their
scope and make it possible to use `const`.
- Return earlier where possible, which should improve performance as some
unnecessary code gets skipped.
No functional changes.
This PR adds pre-checks when enabling validation layers.
For validation layers to work some platforms require that
the Vulkan SDK is installed. Validation layers are activated
when running blender with `--debug-gpu`.
Sometimes we expect users to run with `--debug-gpu` for
narrowing down an issue and we cannot expect them to have
the Vulkan SDK installed.
This patch will check if the `VK_LAYER_PATH` is available
and that the configuration file of the validation layer is
present. If this isn't the case we don't activate the
requested validation layer.
Pull Request: blender/blender#105922
Calling render (for example) with an existing window open now activates
the window on Wayland. Tested to work on GNOME & KDE.
Use the xdg-activation protocol which typically brings the
window to the foreground.
Partially resolves#102985.
Clang would warn about failure to use 'override' when a single
method was added that used 'override' when none of the other methods
did.
This meant a single correct use of override caused noisy compiler
warnings (for CLANG but not GCC).
Avoid this by using 'override' where appropriate.
Improvements to packing efficiency and updating UV packing API.
* Add #pack_islands_alpaca_rotate, the fast alpaca-style packer with rotation.
* Update heuristic for sorting islands based on longest edge.
(Improves pack efficiency when rotation is enabled.)
* Add `aspect_y` to UV Packing API, to support non-square materials in the future.
Pull Request: blender/blender#105977
When all of the input meshes have no loose edges, the output won't have
any either, but finding that out for the output is much more expensive.
Copy this tag to the output mesh to save processing time when drawing.
In my test creating 1 million instances of a 16 face mesh, this changed
the time for the draw cache loose geometry extraction from 220 ms to
131 ms.
For now, only do this when the loose edges of the inputs are already
cached (primitive nodes, for example). This avoids paying the cost of
calculation when we don't know it will be necessary.
It doesn't take much time to know whether all of the curves have more
than a single point, and if that's the case, we know for sure there are
no loose edges in the mesh. This can save time when creating the mesh
draw cache. The time for finding loose geometry goes from 180 ms to
104 ms for a large molecular nodes test file.
For the single-threaded part of the curve to mesh conversion, avoid
writing to two logically separate arrays in the same loop. Instead
run the calculation on two separate threads if the output is large.
Timing for `calculate_result_offsets` when processing 1 million curves:
Before: Average: 10.4 ms, Min: 9.4 ms
After: Average: 9.2 ms, Min: 7.7 ms
Currently assigning values to IDProperties clears their UI data.
That is fixed by #106161, but that is too risky for 3.5. Instead,
work around the issue by triggering `MOD_nodes_update_interface`
function which recreates the UI data of the modifier properties.
Pull Request: blender/blender#106190
Now that mesh primitive nodes calculate their bounds in constant time,
it's worth updating the bounds eagerly when translating a geometry
since doing so should be very cheap and might save a more significant
amount of time if they're needed later.
Also slightly unify the translation functions for the different types.
Pull Request: blender/blender#106159
Previous code was using BKE_mesh_uv_vert_map_get_vert to somewhat
detect identical UV values on mesh vertices. But this was not
handling the case when separate mesh vertices still use the same UV
values (e.g. cube with all six faces mapped to whole image).
Replace usage of BKE_mesh_uv_vert_map_get_vert with a simple "unique UV
value" map, very similar to how OBJ normals are calculated for export.
Measurements on a somewhat extreme case: exporting "Rungholt" Minecraft
level from https://casual-effects.com/data time (Win10, Ryzen 5950X)
goes 2.9sec -> 2.2sec, and resulting file size 486MB -> 231MB. This
particular model has a lot of mesh faces mapping to the same places
in UV map.
On less extreme cases the timings are similar between old and new
code, with a tiny speedup in most tests I've tried.
Allow clicking the "up" and "down" arrows to increment/decrement by a
frame for Video Sequencer strip Frame Start, Strip Offset Start, and
Strip Offset End.
Pull Request: blender/blender#106117
Updated version of our monochrome Noto Emoji (variable) font with 31
new emojis that were released as part of Unicode 15.0
Pull Request: blender/blender#106142
"Rotate Normals" is a changeable operation like any other and does not
need to be hardcoded.
An advantage of exposing this modal is that the shortcut key now
appears in the header when rotating an edited mesh.
Avoid calling `restoreTransObjects`, `resetTransModal`,
`resetTransRestrictions` and `initSnapping` for each change.
Also bring `applyMouseInput` close to the rest of the code.
No functional changes.
The lack of organization in the values of the constants that indicate
the properties was prone to errors.
One error that can be noticed is that the values of
`P_ORIENT_AXIS_ORTHO` and `P_VIEW2D_EDGE_PAN` were the same.
(not really a problem though)
UV attribute refactor in 6c774feb has changed the logic from "UV data does not exist" to "there's no active UV layer". The repro mesh has a UV layer, but not UV data due to the mesh being only a point cloud.
Pull Request: blender/blender#106185
The tooltip of the map range node in the compositing section was displaying that the output value was between 0.0 and 1.0 whereas it is between To Min and To Max value so I just changed the string.
Pull Request: blender/blender#105924
This functions as a way to avoid having the context affect which node
groups are displayed. This is necessary since there is no concept of an
active operator and most node groups could be used as an operator.
It was considered to make this a more general "No Context" option for
the node editor. That still might happen eventually, but we want to
encourage users to use the modifier context since it allows the
various inspection features to work properly.
IMath is required for building with vulkan. This patch adds
dependencies to shader_builder for now.
Currently there is a difference between windows and other OS's in
which variable the library is stored. Might be because imath isn't
a direct dependecy. As this is a compilation error I did the quickest
solution and check with platform module what would be the best solution.
Pull Request: blender/blender#106180
Regression introduced at 19b63b932d
The crash happened in `gizmogroup_xform_find` because
`t->region->gizmo_map` was `nullptr`.
The `T_NO_GIZMO` flag was supposed to prevent the
`gizmogroup_xform_find` function from being called, but it was being
removed with `t->flag = t->flag & ~T_PROP_EDIT_ALL;`.
This is because 19b63b932d missed updating the maximum enum value in
`ENUM_OPERATORS`.
The fix is simply to set the correct maximum value in `ENUM_OPERATORS`.
But for more safety, `gizmogroup_xform_find` now returns early when the
region does not have `gizmo_map`.
Co-authored-by: Germano Cavalcante <germano.costa@ig.com.br>
Pull Request: blender/blender#106174
Before this, when the animation is playing and the set of cached frames
changes the timeline is out-of-date which can be confusing.
Now the cached frames are redrawn whenever the current-frame indicator is
redrawn. This fixes the issue but also causes redraws when they are not necessary.
Currently, that does not seem to be an issue,
Pull Request: blender/blender#105986
When using the Low or Medium settings on the Glare node, the generated
glare has an offset toward the lower left corner of the image. That's
because the shader erroneously has logic that assumes non-normalized
coordinates, so its offsets are in the pixel space of the original
image. To fix this, we just use a fixed 0.5 offset in the output pixel
space to evaluate at the center of pixels.
In the future, we might look into using a more advanced downsampling
scheme to avoid temporal instability, which is a new requirement due to
the viewport compositor.
Adding checks for platform capabilities involved adding functions
to multiple classes and was too involved.
Replace this with a single GHOST_System::getCapabilities() function.
This patch implements the Anti-Aliasing node by porting SMAA from
Workbench into a generic library that can be used by the realtime
compositor and potentially other users. SMAA was encapsulated in an
algorithm to prepare it for use by other nodes that require SMAA
support.
Pull Request: blender/blender#106114
Vertex paint's filter operators were not properly going through the SculptSession API.
Undo didn't work; sometimes the operators would do nothing or produce corrupted colors.
The `transform_active_color` helper function now handles all of this. It ensures a valid
SculptSession exists and executes an undo push.
Reviewed By: Hans Goudey
Pull Request: blender/blender#106136
If the variable size option of the Blur node was previously set to true
and the type of blur was later set to Fast Gaussian, variable size blur
will take effect, even though the option is not visible to the user.
This patch fixes the issue by disabling variable size blur when the blur
type is set to Fast Gaussian.
It worked until now because `<iostream>` was included by other headers
before the rotation ones. But this didn't work in all cases. This commit
make sure all rotation type headers include it.
Effectively replicate the behavior of the function in the manner
which is used for autosave file.
There might be better a solution which is cross-platform and does
not suffer from the time of check, time of use (TOCTOU) vector of
attack. This seems to be a bigger project to figure out, so until
then silence the warning: it is fine since the directory is only
used to chdir to, so worst case an external attacker can introduce
is a test failure.
It provides path to a directory suitable for storing temporary files
which satisfies the following conditions:
- The directory exists.
- The return path has trailing directory separator.
It is based on the code used in the appdir.c to get the temporary
directory.
For the C++ people: this is similar to the temp_directory_path()
from the std::filesystem.
No functional changes expected as it is a new code which is planned
to be used on other places as a followup development.
Bug introduced by c2c6707919
Fixing it by undoing the changes to the if statements
at the start of the FCurve drawing functions.
This keeps the intended behavior of the previous path, while fixing the drawing
Pull Request: blender/blender#106100
The Linux worked due to the libraries provided as a dependency
via `EXTRA_LIBS "${TEST_LIBS}"` with extra whole archive.
While on Windows and macOS the whole-archive is not needed the
dependency from the library to the blender_test is still needed.
Solves the issue when modifying asset_catalog_test.cc on macOS
does not make blender_test to be relinked.
Pull Request: blender/blender#106051
When using the slider operators in the Graph Editor
the code would try to access `FCurve.bezt` without checking that exists.
When the curve is baked that is a null pointer.
Pull Request: blender/blender#106102
Nodes inside of frames where pasted with an offset from the cursor.
Since the location of nodes is in parent space, child nodes don't need
to be offset separately.
Pull Request: blender/blender#106099
Workaround gnome-shell including uninitialized memory when pasting
from the clipboard. Where `read` would not write data into the range
return by the length.
Reading from the pipe into a power-of-two buffer
works around the problem.
It's not clear why this only impacts gnome-shell - as there is no
significant down-side to changing the buffer size, apply a workaround.
Ref !106091.
Add a Gaussian smoothing operator to supersede the current
smoothing operator in the graph editor.
Advantage over the current implementation:
* Supports modal operations
* Is independent of key density
* More options in the redo panel
* More predictable Impulse Response
Option in the redo panel to change
Filter Width: How far out on each side of a key the code checks
to average key values
Sigma: The shape of the bell curve, lower values make a sharper bell curve
reducing the smoothing effect.
Too High values will make the code behave like an average filter as the
curve in the -1/1 range will almost be flat.
On a technical note, the operator needs to store additional data when running in modal
to avoid allocating/deallocating data on every modal run.
For that reason the `tGraphSliderOp` struct has been extended with
`void *operator_data` and `void (*free_operator_data)(void *operator_data)`.
The former is the data and the latter is a function responsible for freeing that data.
Pull Request: blender/blender#105635
These often want to store a non-const reference to its owner, i.e. the
object that created them. I don't really like removing const here, but
it makes sense to enable this use case.
Initial idea was to calculate the view boundaries when finishing the
`uiBlock`, after layout code and such ran. But the panel code applies an
offset later, which breaks this. The view boundaries would be off by
something like 100px.
`.asset_generate_preview()` internally calls `UI_icon_render_id` as a
job -- as opposed to `.preview_ensure()` [which internally also calls
`UI_icon_render_id`, but not as a job] leading to crashes in background
mode.
This might be due to the fact that OpenGL context is not set up
correctly (so there might be other ways to fix this), but there seems to
be other places/comments indicating that icon handling is only for main
thread (see e.g. 13beeb5892).
And while this does not fully explain why doing this with jobs works fine
from the UI, the patch certainly fixes the crashes in background mode for
now (by not using jobs).
Pull Request: blender/blender#106046
This PR adds basic support for texture update, read back and clearing
for Vulkan. In Vulkan we need to convert each data type ourselves as
vulkan buffers are untyped. Therefore this change mostly is about data
conversions.
Considerations:
- Use a compute shader to do the conversions:
- Leads to performance regression as compute pipeline can stall
graphics pipeline
- Lead to additional memory usage as two staging buffers are needed
one to hold the CPU data, and one to hold the converted data.
- Do inline conversion when sending the data to Vulkan using `eGPUDataFormat`
- Additional CPU cycles required and not easy to optimize as it the
implementation requires many branches.
- Do inline conversion when sending the data to Vulkan (optimized for CPU)
For this solution it was chosen to implement the 3rd option as it is fast
and doesn't require additional memory what the other options do.
**Use Imath/half.h**
This patch uses `Imath/half.h` (dependency of OpenEXR) similar to
alembic. But this makes vulkan dependent of the availability of
OpenEXR. For now this isn't checked, but when we are closer to
a working Vulkan backend we have to make a decision how to cope with
this dependency.
**Missing Features**
*Framebuffer textures*
This doesn't include all possible data transformations. Some of those
transformation can only be tested after the VKFramebuffer has been
implemented. Some texture types are only available when created for a
framebuffer. These include the depth and stencil variations.
*Component format*
Is more relevant when implementing VKVertexBuffer.
*SRGB textures*
SRGB encoded textures aren't natively supported on all platforms, in
all usages and might require workarounds. This should be done in a
separate PR in a later stage when we are required to use SRGB textures.
**Test cases**
The added test cases gives an overview of the missing bits and pieces of
the patch. When the implementation/direction is accepted more test cases
can be enabled/implemented.
Some of these test cases will skip depending on the actual support of
platform the tests are running on. For example OpenGL/NVidia will skip
the next test as it doesn't support the texture format on OpenGL, although
it does support it on Vulkan.
```
[ RUN ] GPUOpenGLTest.texture_roundtrip__GPU_DATA_2_10_10_10_REV__GPU_RGB10_A2UI
[ SKIPPED ] GPUOpenGLTest.texture_roundtrip__GPU_DATA_2_10_10_10_REV__GPU_RGB10_A2UI [ RUN ] GPUVulkanTest.texture_roundtrip__GPU_DATA_2_10_10_10_REV__GPU_RGB10_A2UI
[ OK ] GPUVulkanTest.texture_roundtrip__GPU_DATA_2_10_10_10_REV__GPU_RGB10_A2UI
```
Pull Request: blender/blender#105762
In Vulkan multiple commands can be in flight simultaneously.
These commands can share resources like descriptor sets or push
constants. When between commands these resources are updated
a new version of the resources should be created.
When a resource is updated it should check the submission id of the
command buffer. If this is different than last known by the resources,
the previous resources should be freed.
If the submission id is the same than previously it has to create a
new version of the resource to not intervene with other commands that
uses the resource before the update.
When the resource wasn't updated between multiple usages in the same
submission id it could reuse the previous resource.
This PR introduces a `ResourceTracker` and a `SubmissionTracker`.
A submission tracker can check if the command buffer is submitted.
In this case all resources of the resource tracker should be freed.
Unmodified resources in the same submission can be shared.
A resource tracker will keep track of all resources that are in
flight. After the resources are used (submission + execution) have
finished the resources can be cleared.
Pull Request: blender/blender#105183
Viewport assumes that when the number of planes of the image
buffer is less or equal to 8 it is a gray scale image. In that
case it will optimize the texture to be stored as a grayscale
image on the GPU.
When using a targa file with a palette, the bitplanes were not
extracted from the actual colors, but from the number of colors
that were present in the palette.
Image buffers don't support palettes so that doesn't make sense.
This PR uses the bitdepth of the actual colors inside the palette
to identify the number of planes to use in the image buffer.
Pull Request: blender/blender#106047
Workaround gnome-shell including uninitialized memory when pasting
from the clipboard. Where `read` woud
Reading from the pipe into a power-of-two buffer
works around the problem.
It's not clear why this only impacts gnome-shell - as there is no
significant down-side to changing the buffer size, apply a workaround.
Only the text editor supported the primary clipboard & only for modal
selection. Now selecting text in the console & 3D text editing also
sets the primary clipboard under X11 & Wayland.
Notes:
- Pasting from the primary clipboard isn't yet exposed in the key-map
so in practice it's only useful for pasting text outside of Blender.
- Use skip-save option when pasting from the primary selection
so this is never used by the regular paste shortcut.
- This commit adds a primary-clipboard flag to WM_capabilities_flag() so
creating the the copy-buffer is only performed when necessary.
Node names should be properly separated for easy searching and reading
and for consistency with other (color) nodes.
This commit should only touch UI names which do not need versioning and does not break node setups or py scripts.
AABB aligned quads would defeat the "witness" accelerator when
using the xatlas packing strategy.
This change reorders the search to allow use of the "witness" technique.
This PR uses renderdoc for frame capturing when enabled.
It enabled an easier workflow for frame capturing.
- Capture GPU API calls from test cases
- Capture GPU API calls from background threads
- Capture GPU API calls from background rendering.
Renderdoc is an important GPU debugger used by the Eevee/
Viewport module. Previously we needed to change code in
order to record background rendering, that could on its own
lead to other side-effects.
The integration with renderdoc can be enabled using
`WITH_RENDERDOC=On` compiler option. `GPU_debug_capture_begin`
and `GPU_debug_capture_end` can be added to the section
of the code you want to debug. When running Blender inside
renderdoc this part will automatically be captured.
All GPU test cases are now guarded by these calls. In order
to capture the test cases you need to start the test cases
from renderdoc and the captured GPU API calls will appear
where each capture is a single test case.
Pull Request: blender/blender#105921
Happens if a scene has a PointerProperty of type collection which
is set to a collection containing rigid bodies.
The error is printed by the builder of the render pipeline graph,
which contains very minimal subset of the view layer: it includes
custom properties (which gets recursed into), but not the rigid
body simulation.
This fix is mainly suppressing the error print, without changing
the apparent behavior of the graph.
Pull Request: blender/blender#106045
Remove `enum eAnimFilterFlags` from `ED_keyframing.h`, the function
parameters that pass them around, and the code that uses them to filter
things.
Only one of the enum values was actually used, `ANIMFILTER_KEYS_LOCAL`.
It indicates whether to only consider keys on the datablock itself (when
set), or in the case of objects, also consider keys on its materials or
shapekeys (when cleared). However, this flag was *always* set, making it
possible to remove the code that handled it.
Finally there was only one function that received a `filters` parameter
that could be different across calls: it would either have value
`ANIMFILTER_KEYS_LOCAL` or `0`. However, the only flag it actually tested
for was `ANIMFILTER_KEYS_MUTED`, which was never actually set. So all of
that could be removed as well.
Just for grepping-through-history sake, these are the flags that were
removed:
- `ANIMFILTER_KEYS_LOCAL`
- `ANIMFILTER_KEYS_MUTED`
- `ANIMFILTER_KEYS_ACTIVE`
- `ANIMFILTER_KEYS_NOMAT`
- `ANIMFILTER_KEYS_NOSKEY`
Note: this is NOT about the flags defined in `ED_anim_api.h`, in `enum
eAnimFilter_Flags`. Note the different names, the one that's removed
doesn't have an `_`.
No functional changes.
Pull Request: blender/blender#106028
was assuming such cases are already handled before this function is
called, but seems to be broken on windows and linux. Do
`safe_normalize()` so the tests pass, will check the problem afterwards.
No functional changes.
A set of functions to get the bounds of a channel was created
for the `ANIM_OT_channels_view_selected` operator.
Theses functions will be used by other functions in this file,
so they need to move to the top.
This patch adds an option to the Status Bar: `Scene Duration`
This shows the duration of the current scene in frames and timecode
`Duration: <timecode> (Frame <current frame>/<total frames>)`
The timecode follows the formatting defined in the user preferences.
Pull Request: blender/blender#104882
Setting a negative active layer index was possible, causing a crash
when adding new layers (for example).
Clamp the active index when assigning from RNA.
Memory chunks that were in the same hashed bucket but had different keys
were comparing memory unnecessary.
In practice this didn't happen all that often in my tests so the
performance improvement isn't significant.
Follow up to 4f10800094.
These `ME_POLY_LOOP_PREV` are redundant, since they're similar to
the `poly_corner_prev` inline functions. They were also confusing,
since they took an index into the poly and returned an index into
the entire corner range. Instead structure code to use the function
version, and simplify some loops in the process.
Standardize naming, use spans and references for input parameters,
and improve documentation. Now the functions expect the lookups to
succeed as well, they will fail and assert otherwise.
The functions are also simple enough that it likely makes sense to keep
them all inlined
This allows adding spans, arrays, etc. directly to SculptSession, which
simplifies accessing mesh data, especially in #105938. A few files
aren't moved to C++ yes, so I had to add three C accessor functions.
Previously UI view items would support custom drop controllers (so they
could react to data being dragged over them and dropped). This is now
more generalized so the views themselves can do this as well.
Main changes:
- Support calculating a bounding box for the view, so this can be used
for recognizing mouse hovering.
- Rename "drop controller" to "drop target", this is more clear, less
abstract naming.
- Generalize drop controllers/targets. There is a new
`ui::DropTargetInterface` now.
- Add support for drop targets in the `ui::AbstractView` base class, so
custom views can use this.
Pull Request: blender/blender#105963
BLI_array_store still performed poorly for boolean arrays or any arrays
where many memory chunks had identical contents since the temporary hash
had many collisions, making lookups slow.
Resolve by ensuring duplicate chunks aren't added to the hash table.
Also increase the memory chunk size for edit-mesh undo to 64kb
which performs well with high poly meshes as it reduces the overhead of
having to manage many small memory chunks.
Notes:
- Before this change performance was quite bad (10-20x worse than v3.3).
- Performance from the test in #105046 is roughly the same as before.
- Performance of #105205 compared with v3.3 is close, even faster at
times but varies much more (likely caused by threading).
* Fix SDL not finding Xlib.h
* Link to clangSupport library for newer LLVM versions
* Add FreeBSD essential symbols to symbols_unix.map
Pull Request: blender/blender#105892
Strict compiler was generating possible-uninitialized warning.
Added an explicit initialization and asserts to solve the noisy
output and catch possible errors early on.
Pull Request: blender/blender#105990
* With the move to gitea, .gitea doesn't need to be copied into installs.
* Add .github and .gitignore in more places for future proofing.
* Deduplicate ìnstall_dir macro.
Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: blender/blender#105980
Fix#105955: Cycles crash loading multiple PNG, TIFF and other image textures
concurrently. This OpenImageIO version includes a fix for this problem.
Ref #99618
Pull Request: blender/blender#105958
Workaround for compiler issue on AMD
platforms resulting in the erroneous
discarding of valid rays in fragment
raytracing.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#105967
Eager bounds calculation for cylindrical and spherical primitive nodes,
implemented in constant time rather than as a loop over all positions.
Takes into account the segments count of the circle from which they
are constructed. Solution of the task #105551.
Pull Request: blender/blender#105743
Use XCURSOR_THEME & XCURSOR_SIZE environment variables for Wayland.
While this isn't an official part of the spec, many Wayland compositors
& applications use these variables.
These are meant to be like other low-level attributes--
hidden from the UI, at least by default. This was just
missing from the initial commit that added these
because seeing them was useful for debugging.
After remapping there is no guarantee that collections' parent pointers
are still valid, so using these to free the object cache of all the
collections' ancestors is potentially accessing invalid memory.
Further more, it is noticiably inefficient, as a same collection may be
processed many times.
So instead, introduce (and use in resync case) a new
`BKE_main_collections_object_cache_free`, which iterates over all
collections of given Main and only free their own cache.
I'm doing this because I want to work on the timeline integration for
simulation nodes caching. Also see #103343 for more info regarding moving
files to C++.
Pull Request: blender/blender#105962
Add control over how bone relation lines are drawn. Instead of always
drawing from the head of the child to the tail of the parent, give users
a choice for the parent side of the line. This can now be toggled
between the head and the tail of the bone, where the tail is Blender's
original behaviour and is retained as default value.
Pull request: blender/blender#105427
The Image node in the realtime compositor will output wrong passes if multiple passes are used at the same time. This is because images can only store a single layer, pass, and view at a time. Furthermore, they rely on operators and RNA callbacks to invalidate the cache when a different layer, pass, or view is requested. In effect, when the image node requests multiple passes at the same time without any kind of cache invalidation, wrong passes are output.
While a proper fix is to allow caching of multiple layers, passes, and views at the same time. This patch implements a temporary workaround by explicitly ensuring an up-to-date cache through a call to BKE_image_ensure_gpu_texture() when before requesting a GPU texture.
Pull Request: blender/blender#105547
The asset catalogs are used in Geometry nodes Add Node menu to
generate the hierarchy of submenus.
The assets themselves are used to generate the operator names in the
same menu, and their descriptions.
This commits enables extraction of this data by parsing the catalog
sidecar file, as well as opening each asset blend file to search for
assets.
The Node Add menu can have special submenus containing node assets.
These submenus are generated by parsing the asset blend files from
release/datafiles/assets, and the interface drawing is specific to
these menus.
This commit enables the translation of these dynamic menus, including
their names and the description of the operators.
An error message in paint mode is built out of several possible
components, depending on what is missing in the context for the
painting operation to work.
The main message was properly extracted, but not its individual
possible components.
Although such composite messages should generally not be used, in this
case I'm not sure it's worth it writing 15 different messages with all
possible combinations.
* Group bounding box, bounding cone and energy to a struct called `LightTreePrimitivesMeasure`
* Add utility functions to add primitives to nodes or buckets
* Precompute the split bucket cost to improve efficiency (about 1.4x expected)
Pull Request: blender/blender#105931
Translating an image in fullframe compositor now also translates
the backdrop image for the viewer node.
Attached gif shows the behavior. Notice how gizmo moves with correct
values with the image but the frame stays to indicate what will get
rendered.
Note: This patch is a continuation of [D12750]
(https://archive.blender.org/developer/D12750). In a previous patch,
display offset on screen was not computed correctly. This has now
been fixed.
Pull Request: blender/blender#105677
When converting a BMesh to a Mesh, the attribute would be removed if
all values were true, since BMesh stores the data in a reversed flag.
The check worked the same way for the sharp face attribute already.
No functional changes.
The code previously contained redundant and complex checks for
different snapping scenarios, which involved combinations of multiple
snapping flags and modes on each mouse interaction. This resulted in
unnecessary code duplication and overhead.
To address this issue, the code has been simplified and micro-optimized
by moving these checks to the initialization of the snapping parameters.
This results in a more streamlined and efficient codebase.
The members `align`, `project`, `peel` and `use_backface_culling`
already have a corresponding value in `TransSnap::flag`.
Keeping values that represent the same thing is error prone.
Use C++ types for more automatic memory management, simpler code,
and easier potential performance improvements. Also document each
item in the cache and access a named struct by pointer for the "poly
sorted" instead of using an identical unnamed struct.
As part of #105779, the active status of UV maps won't be stored in
CustomData anymore, so it has to be retrieved from a higher level.
The best way to do that is to retrieve it once and pass around the BMesh
custom data offset as a "key" to the data. This should also decrease
function call overhead in this code (not that it was a bottleneck).
Pull Request: blender/blender#105904
Add `index_range()` and `is_empty()` functions, rename `ranges_num()`
to `size()` (clarifying the final extra integer as an implementation
detail). Also remove the `size(index)` function which gave almost the
same assembly as `[index].size()` (https://godbolt.org/z/PYzqYs3Kr).
Push a task to `TaskPool` when more than `MIN_PRIMS_PER_THREAD` primitives are to be processed. The nodes are rearranged in a depth-first order when copied to the device.
Tested with the scene in #105550 on an Apple M1 Ultra (20 cores), about 11x speedup.
Pull Request: blender/blender#105862
Many error messages were translated when using `BKE_report()` or
`BKE_reportf()`, directly, but others were missing because they used
`WM_report()` or `WM_reportf()`.
This commit adds these two functions to the list of functions used in
the message extraction regex.
In addition, `WM_reportf()` is modified so that the format string is
translated before formatting actually occurs.
Fixed a bug where the active color wasn't being set
on imported meshes, resulting in no colors displaying
in the viewport.
This bug has been in the code for a long time. However,
the colors have been displaying correctly until recently,
so this issue wasn't previously apparent.
Also, changed custom color data name from "displayColors"
to "displayColor", to match the actual USD primvar name.
(This was a typo in the original code.)
Note that pull request
blender/blender#104542
addresses other issues in the color import code (e.g.,
converting all color primvars and not just "displayColor",
avoiding hard-coding of attribute names, handling all
iterpolation types, etc.).
However, the current commit is meant as a short term fix
to a regression, where the "displayColor" attribute does
not render in the viewport at all, until the above pull
can be merged.
Implements #102359.
Split the `MLoop` struct into two separate integer arrays called
`corner_verts` and `corner_edges`, referring to the vertex each corner
is attached to and the next edge around the face at each corner. These
arrays can be sliced to give access to the edges or vertices in a face.
Then they are often referred to as "poly_verts" or "poly_edges".
The main benefits are halving the necessary memory bandwidth when only
one array is used and simplifications from using regular integer indices
instead of a special-purpose struct.
The commit also starts a renaming from "loop" to "corner" in mesh code.
Like the other mesh struct of array refactors, forward compatibility is
kept by writing files with the older format. This will be done until 4.0
to ease the transition process.
Looking at a small portion of the patch should give a good impression
for the rest of the changes. I tried to make the changes as small as
possible so it's easy to tell the correctness from the diff. Though I
found Blender developers have been very inventive over the last decade
when finding different ways to loop over the corners in a face.
For performance, nearly every piece of code that deals with `Mesh` is
slightly impacted. Any algorithm that is memory bottle-necked should
see an improvement. For example, here is a comparison of interpolating
a vertex float attribute to face corners (Ryzen 3700x):
**Before** (Average: 3.7 ms, Min: 3.4 ms)
```
threading::parallel_for(loops.index_range(), 4096, [&](IndexRange range) {
for (const int64_t i : range) {
dst[i] = src[loops[i].v];
}
});
```
**After** (Average: 2.9 ms, Min: 2.6 ms)
```
array_utils::gather(src, corner_verts, dst);
```
That's an improvement of 28% to the average timings, and it's also a
simplification, since an index-based routine can be used instead.
For more examples using the new arrays, see the design task.
Pull Request: blender/blender#104424
133dde41bb changed how 'fake user' flag is handled with linked data.
Previous behavior was a bug/inconsistency, in that the 'directly linked'
tag would be 'over-set' and never cleared, forcing saving references to
a lot of unused linked data.
Note that ideally, 'Fake user' flag should be ignored, and the only way
to decide whether to keep or not a linked ID should be whether it's
actually used by some local data.
However, #103867 and #105687 show that this is causing issues in some cases,
where users wrongly relied on the linked data's pre-defined 'Fake user' flag
to keep their linked data in their production files, even if said data had no
real user.
While not ideal, for now we should consider 'fake user' flag for linked data
as a real usage case. A better handling of this edge-case is related to
wider designs aboud handling of 'non used' data on file save, whether
linked IDs should keep track of being explicitly or implicitly linked by
the user, etc.
Align the labels on the tabs so that when you read them, your head is tilted
towards the content, instead of away.
When tabs are drawn to the right of panels in the sidebar, the labels are read
from bottom to top, which may suggest that this tab does not belong to the area.
This change does it like this:
* Sidebar on the right: the text is read from top to bottom.
* Sidebar on the left: the text keeps reading from bottom to top.
Pull Request: blender/blender#105835
The NLA's behaviour of always forcing a full set of keys (XYZW) is now
done in both 'Combine' and 'Replace' mode (previously only the former).
This fixes the bug where quaternions could not be properly keyed in 'full
stack tweak mode' under certain conditions.
Pull Request: blender/blender#105604
The name #ensure_valid_reflection seems to indicate that the resulted
reflection must be valid, whereas in the reality it only ensure validity
for specular reflections. The new name matches the behavior better.
This function checks if the shading normal would result in an invalid reflection into the lower hemisphere; if it is the case, the function raises the shading normal just enough so that the specular reflection lies above the surface. This is a trick to prevent dark regions at grazing angles caused by normal/bump maps. However, the specular direction is not a good representation for a diffuse material, applying this function sometimes brightens the result too much and causes unexpected results. This patch applies the function to only glossy materials instead.
Pull Request: #105776
Actually both potential roots lie in the interval [0, 1], so the
function ended up checking both roots all the time.
The new implementation explains why only one of the roots is valid; it
saves two square roots and a bunch of other computations.
The `NODE_OT_link_viewer` operator has some complicated logic that was
intended to stop cycling through geometry nodes to make it work better
with nodes that have multiple geometry and data outputs (group nodes).
This logic failed when geometry was not the first socket and it would
just stop connecting data sockets altogether after the geometry socket.
The reason is that the `determine_socket_to_view` function stops looking
for already-viewed outputs after the first geometry, and then simply
reconnects that geometry.
This patch changes the behavior slightly so that, if a geometry output
is found, the node skips over all subsequent geometry outputs, but still
considers data sockets for viewing. Viewing a node with multiple geometry
outputs will connect the first geometry output it encounters and then
keep cycling through data outputs on repeated execution.
Pull Request: #105836
The Cycles light linking branch is using the tree view UI but it seemed
to use the "wrong" layout. It wasn't clear that the layout has to be
reactivated before building the view.
Make it harder to use the API wrong now by requiring the layout as
argument, so the building can ensure it's active.
The input file contains a partial cube, with two regular faces, two
loose edges and one loose vertex. This checks whether the loose vertex
for example is included into the output when exporting with UVs
(loose verts do not have UVs in Blender, so they should get (0,0) UV
in PLY).
In a previous step of the mesh writing process, the loop `totlayer` was
replaced and a temporary vector is used for layer data instead. Use this
temporary vector to find the UV sub-layers, since the vector and the
CustomData struct in the mesh don't necessarily match. Also use a
local variable for mesh loop count to make it clearer that the mesh
isn't used except at the end.
Thanks to Campbell for finding the source of this error.
Since UVs are now stored as 2D vectors in meshes, they can be copied
directly to the vertex buffers. Somewhat surprisingly, multithreading
the copying into the vertex buffer provides a good speedup-- on a CPU
with many cores at least.
Here is a test uploading two UV maps created in geometry
nodes with a 1 million quad mesh, with a Ryzen 7950x:
| | Before | After | Speedup |
| ------- | ------- | ------ | ------- |
| Average | 24.3 ms | 7.5 ms | 3.2x |
| Min | 17.6 ms | 7.0 ms | 2.5x |
I added the copying utilities to the array utils header, since the
need for them has come up in a few different places already, and the
existing function with a selection argument didn't make sense here.
Pull Request: blender/blender#105793
When deleting UV UI attributes it isn't necessary to use the higher
level C attribute API, since we already know we aren't working with
the edit mesh here.
There were logic errors and use-after-free errors with the attribute
removal function. Because the custom data layers are reallocated,
we can't reuse the name pointer after removing an attribute. And
we can't return early on the first domain to fail for the edit mode
implementation, because another domain might have the attribute.
Also reorganize some of the code to make the logic clearer: only remove
sub-attribuutes and change attribute names after actually removing the
attribute,and assert if the attribute isn't removed after it is found.
Geometry Nodes: SDF Volume nodes milestone 1
Adds initial support for SDF volume creation and manipulation.
`SDF volume` is Blender's name of an OpenVDB grid of type Level Set.
See the discussion about naming in #91668.
The new nodes are:
- Mesh to SDF Volume: Converts a mesh to an SDF Volume
- Points to SDF Volume: Converts points to an SDF Volume
- Mean Filter SDF Volume: Applies a Mean Filter to an SDF
- Offset SDF Volume: Applies an offset to an SDF
- SDF Volume Sphere: Creates an SDF Volume in the shape of a sphere
For now an experimental option `New Volume Nodes` needs to be
enabled in Blender preferences for the nodes to be visible.
See the current work plan for Volume Nodes in #103248.
Pull Request: blender/blender#105090
The crash is fixed by reverting 87fd798ae3 and
some follow up commits. While it would generally be nice to move to a more
SoA format for these things, we are not there yet and this is causing more
trouble than it's worth currently. The main difficulty is that the socket
indices are changed by many different operations which invalidates the array
too often and led to many follow up bugs.
Pull Request: blender/blender#105877
Change code fragments where `BKE_mesh_vert_coords_alloc` had been used
to temporarily copy vertex coordinates of a mesh (see #103789) and
providd pointers to the mesh's stored vertex positions instead.
This reduces memory usage and improves performance.
Pull Request: blender/blender#105756
Implement GBuffer prepass and deferred lighting (lights only).
This decouple lighting from the material shaders making them lighter,
less expensive and faster to compile.
Trying to keep a nice data flow so we could potentially use the
subpass programable blending feature on tiled GPU arch.
Not everything is covered yet and #105880 is making the GBuffer layout
a bit awkward and not easily extendable.
Pull Request: blender/blender#105868
Changed `edge->v2` to `endVert` to make it consistent with surrounding code.
Removed the unused `totedges` variable.
Currently `totpoly` is also unused, but is fixed in a separate PR.
Pull Request: blender/blender#105870
Follow connections when reading the varname attribute of a primvar
reader, and support both string and TfToken types for the varname.
A unit test is also provided.
Authored by Apple: Matt McLin
Pull Request: blender/blender#105508
This was lost in the refactor to store material indices in a generic attribute.
The attribute API still allows this, but that will be handled separately
since it's a more complex task. The existing API that already clamped
input values should still do that.
Other areas like blenkernel and Cycles clamp the material indices to be
positive so this should be consistent with them. There is still discussion
if material indices should be made impossible, but this at least avoids
crashing for the 3.5 release.
There was also an inconsistency in how sculpt mode handles material index
higher than the number of slots.
Ref #105577
Simple logic: when the repository is not found under the relative
path to the main repository's origin, enforce clone of the upstream
repository instead.
Pull Request: blender/blender#105858
This flag is moved to a different variable but the default value is still placed on the wrong variable.
This fixes the default value assignment but due to the old flag bits are in conflict with used bits in the new flag variables, versioning changes are not included.
Pull Request: blender/blender#105852
1) There was a logic error in FileBuffer where when it was trying to
add a new 64kb chunk to hold output, it was adding an empty chunk,
but making sure we have space capacity to hold 64 thousand chunks.
So that was a bit of pointless juggling to get nothing good.
2) In UV_vertex_key, instead of trying to combine three members into
a hash value, badly, by doing some ad-hoc shifts and xors, use
get_default_hash_3 instead, which combines them way more properly.
Also avoid copying the whole hash map object.
On my windows box (Ryzen 5950X, VS2022), exporting Stanford Lucy 3D
scan:
- Binary: 13.4 -> 5.4 sec
- ASCII: 29.3 -> 14.6 sec
So basically 2x faster for two tiny changes.
This PR adds support for `GPU_storagebuf_clear` and
`GPU_storagebuf_clear_zero` to the Vulkan backend. It also adds test
cases for all backends.
Pull Request: blender/blender#105487
When multiple nodes (Frame nodes included in the selection) are scaled/
rotated, the TransData location and center can get "wrong" due to the
fact that Frame nodes dont only use `locx`/`locy` for their
representation while drawing, but also `offsetx`/`offsety`.
So in order to use the "real" top-left corner in the transform system,
we have to respect `offsetx`/`offsety` when creating/flushing transform
data.
In addition to the file in the report, this patch was also tested to work
well with nested Frame nodes.
Pull Request: blender/blender#105400
Fixes:
* General:
- Was assuming that positions/normals/UVs are always `float`, and colors
are always `uchar`. But e.g. positions are sometimes doubles, or colors
are floats etc.
- Was assuming that `face` element is always just a single vertex indices
property. But some files have more arbitrary properties per-face.
* ASCII importer:
- Was assuming that file elements are always in this order: `vertex`,
`face`, `edge`. That is not necessarily the case.
- Was only handling space character as separator, but not other
whitespace e.g. tab.
- Was not checking for partially present properties (e.g. if just `nx` is
present but not `ny` and `nz`, it was still assuming whole normal is there).
* Binary importer:
- Was assuming that faces are always 1-byte list size and 4-byte indices.
- Was assuming that edge vertex indices are always 4-byte.
For the assumptions above, it often lead to either crashes, garbage data
or not detecting presence of a vertex component. E.g. binary importer was
just always reading 4 bytes for vertex indices, but if a file has 2 byte
indices then that would read too much, and then later on would start reading
garbage. ASCII importer was doing out-of-bounds reads into properties array
if some assumptions were not correct, etc.
Improvements:
- Some ply files use different property type names, e.g. `float32`,
`uint16` or `int8` instead of `float`, `ushort`, `char`; now that is
supported too.
- Handles `tristrips` element. Some files out there do not have `face` but
rather has a triangle strip, internally using -1 indices for strip restarts.
Performance:
While doing the above fixes/improvements, in order to fix some things it was
more convenient to also make them more performant :) Now it avoids splitting
each ASCII line into a vector of `std::string` objects, for example, or
reading a binary file in tiny chunks.
Generally this is now 2x-4x faster than the previous state of C++ importer.
The code has changed quite a bit to achieve both the fixes and performance:
- Instead of separate files for ASCII and Binary reading, they are now both
in `ply_import_data.cc/hh`. Reason is that all of the "find correct property
indices" logic is the same between both (and that bit was mostly missing
previously).
- Instead of using raw C++ `fstream` object and reading line by line (which
in turn reads one byte at a time) or reading field by field, now there's a
`ply_import_buffer.cc/hh` that reads in 64KB chunks and does any needed
logic for the ASCII/header part to properly split into lines. This avoids
all the mutex locking, locale lookups, C++ abstraction layers overhead
that C++ iostreams have when doing a ton of tiny reads.
Tests:
Extended test coverage with new files (comitted in svn revision 63274).
11 new "situations", in both ascii and binary forms. Additionally, now also
has a Big Endian binary file to test; BE codepath was completely untested
before.
Overall reworked the tests so that they don't do the whole "load dummy
blend file, import ply file on top, go over meshes, check them", but rather
do a simpler "run ply importer logic that fills in PlyData structure, check
that". The followup conversion to blender meshes is fairly trivial and the
tests were not really covering that in a useful way.
Pull Request: blender/blender#105842
Viewer node paths usually start with the modifier, but in pinned
node editors the tree may not be used by the object in context.
In that case the modifier part of the path should be ignored.
The viewer node is always disabled in that case.
Pull Request: blender/blender#105826
Resizing an image via the operator did not mark it dirty
(`IB_BITMAPDIRTY` is needed to pick this up as being modified, if this is
not set, no warning/option is shown on file close).
Note that using RNA would already do this correctly (since it uses
`BKE_image_scale` -- which already calls `BKE_image_mark_dirty`
internally).
Pull Request: blender/blender#105851
While **marking** an asset would update the Outliner immediately (this
due to the fact that `ED_asset_generate_preview` indirectly took care of
a refresh), **clearing** an asset would not do this.
Now be explicit about this in the Outliner listener and consider asset
notifiers there.
Pull Request: blender/blender#105287
Preview render depsgraphs are put in the depsgraph registry
concurrently with other threads. This was lacking a mutex lock
and a map value that remains unchanged when other elements of
the map are updated.
Pull Request: blender/blender#105839
This changes the maximum viewport resolution divider for Cycles to
help users get a more responsive viewport.
This is done by changing the maximum viewport resolution divider
to a divider that aims to have the largest axis of the viewport
roughly equal to 128 pixels.
Depending on the circumstances, this change can result in a few
noticeable differences:
- Users with slow hardware and a large pixel_size, or slow hardware
and a low resolution screen, may observe a higher resolution viewport
during navigation, making the scene more readable. However this comes
at the cost of reduced responsiveness.
- Users with slow hardware and a low pixel_size and high
resolution screen may observe a lower resolution viewport during
navigation, providing a more responsive viewport during navigation.
Along with that, how Cycles iterates through resolution dividers
is changed to promote quick transitions between resolution dividers.
Meaning users don't need to wait through as many iterations to get
from a low navigation resolution to a 1:1 viewport resolution.
Pull Request: blender/blender#105581
This makes it so access to macOS SDK from newer versions than our
deployment target can be detected on a buildbot via failed build.
Pull Request: blender/blender#105595
When an object has no UV layers and an anonymous UV layer is created,
the anonymous layer gets set as the default (render) layer. This is
very confusing because it then uses a hidden anonmous layer. This patch
suppresses the usage of anonymous layers for rendering.
Pull Request: blender/blender#105192
`scissor_test_set` wasn't able to parse the arguments that were
passed correctly, due to incorrect control data during functino
registration.
This patch uses the correct control data during registration and
is able to parse arguments.
Ref: #104911
Pull Request: blender/blender#105850
Auto-depth is no longer reset during consecutive touch-pad motion.
Details:
- Add wmEvent::flag, WM_EVENT_IS_CONSECUTIVE to detect consecutive
track-pad & NDOF motion events. Expose via RNA as Event.is_consecutive.
- Consecutive events are broken by button/key presses and mouse motion.
- Add `WM_event_consecutive_data_*` functions, so operators can store
data between consecutive events.
- Add `ED_view3d_autodist_last_*` functions to access the last autodist
pivot point for view operators to use.
A renaming of UI scale factors from names that imply a relationship to
monitor DPI to names that imply that they simply change "scale"
Pull Request: blender/blender#105750
the path for clang_format_paths.py changed when the submodules
moved but format.cmd was never updated for that.
the work previously done by check_submodules.cmd is now done by
make_update.py so this file can be removed.
This is an issue revealed by the recent optimization in 4d3bfb3f41 to have
CPU and GPU subdivision topology both cached.
BKE_subsurf_modifier_subdiv_descriptor_ensure is what (re)creates the
topology refiner when needed. Invalidating the topology refiner on changes
must be done before it, otherwise we end up with an incomplete Subdiv that
either does not draw or draws incorrectly.
Pull Request: blender/blender#105844
This makes it possible to use `Vector` recursively if the inline buffer
has 0 size. Any other inline buffer size does not work, because then
the type would be embedded in itself which does not make sense.
Pull Request: blender/blender#105832
Various UI code would store the `AssetHandle` in a way that turns out to
be unsafe. The file-data is part of the file browser caching system that
releases file-data when a certain maximum of items is in the cache. So
even while just iterating over the assets, earlier iterated asset
handles may become invalid. Now asset handles are really treated as
volatile, short lived objects.
For the asset-view, the fix was more involved. There we need an RNA
collection of asset-handles, because the UI list code requires that. So
we create a dummy collection and get the asset handles as needed by
index. This again meant that I had to keep the index of the collection
and the asset-list in sync, so all filtering had to be moved to the UI
list.
I tried duplicating the file-data out of the cache instead, but that
caused problems with managing the memory/ownership of the preview
images.
`AssetHandle` should be removed and replaced by `AssetRepresentation`,
but this would be an even more disruptive change (breaking API
compatibility too).
Fixes#104305, #105535.
Pull Request: #105773
These are not really about reading or writing .blend files, they are
general utilities for file-names/paths. Having to link to the
blendloader library just for these utilities is annoying.
Moved them to `BKE_blendfile.h` now, in agreement with Bastien.
Pull Request: #105825
When linking a texture directly to the material output, it's likely being
done for the purpose of previewing. In that case, bias the heuristic towards
not building a light tree, as it's likely not needed and slow on dense meshes.
While this was just a single pixel off, it was a bit notable since the
highlight wasn't centered correctly. Now retina and non-retina screens match
visually.
Adds two modes of GPU frame capture support for
enhanced debugging. GPU frame capture begin/end
allow instantaneous frame capture of all GPU commands
within the capture boundary.
GPU frame capture scopes allow several user-defined capture
regions which can wrap key parts of code. These scopes are
exposed to connected GPU tools allowing the user to manually
trigger a capture of a known scope at the desired time.
This is currently integrated with the Metal backend for
support with Xcode.
Related to #105591
Pull Request: blender/blender#105717
Fix race condition if several competing threads are inserting Metal
buffers into the MTLSafeFreeList simultaneously while a new list
chunk is being created.
Also raise the limit for an MTLSafeFreeListChunk size to optimize
for interactivity when releasing lots of memory simultaneously.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#105254
Optimized node graphs do not get cached and were
not correctly freed once their reference count reached
zero, due to being excluded from the GPUPass garbage
collection.
Also suppress Metal shader warnings, which are prevalent
during material optimization.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#105795
Metal buffer binding validation would trigger an error
when a given shader had an empty PushConstantBlock.
This patch removes the default uniform code gen if
no uniforms are present, to avoid any possible issues
with buffers being bound to a shader where the destination
data block is size zero.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#105796
Crash when selecting objects on AMD platforms running
Metal. This was caused by shader compilation warnings
being treated as errors in macOS 10.15. Wrapping
compilation failure with success check resolves error.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#105739
immDrawPixels performs significantly slower in Metal
than OpenGL. This was caused by two main factors. Firstly,
the additional overhead of tiled texture update, where all
memory needed to be kept in flight for each update, but
caused update to take a slow path. Avoiding tile update
with Metal is more efficient for both memory pressure
and GPU pipelining.
Secondly, on AMD platforms, the staging buffer used
for temporary texture data was page-faulting when
several texture updates would occur within one frame.
This is due to limitations of allocating one large contiguous
memory chunk. Using the Metal buffer pool for staging
data is more efficient.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#105794
Maximum distance of lines in screen space is limited. This limit seems
reasonable for FPS higher than 1, but UI allows to set 0.01 FPS with
soft. even lower values are possible.
This patch allows for normal operation within soft limits and labels are
still visible and quite usable within hard limits.
Pull Request: blender/blender#104849
Without assumptions of a mesh's direct ownership of its normals,
this was error prone, since normals could potentially be reallocated
when they are tagged dirty or retrieved with write access.
- Show/hide mask layers: the tooltip was confusing from a user's
perspective, because they should not be expected to know what a hide
flag is.
- Active Spline -> Active Point: likely a copy and paste error.
- Geo Nodes face is planar node: forgotten article.
- Axes, plural instead of axis for the viewport preferences. Here
there are several usages of axis or axes. Since they refer to
coordinate axes I believe they should be plural, even though the
property `mini_axis_type` is still wrong.
-----



Pull Request: blender/blender#105814
No functional changes.
This is just a micro-optimization to avoid updating `prev_point` and
calling `ED_gizmotypes_snap_3d_data_get` when snapping is not enabled.
The bug only happened in wireframe mode.
Originally the `const bool use_depth` indicated when projection should
be done on invoke.
Later it started to indicate when to snap on invoke.
But with keymap snap detection, using this `use_depth` is no longer
correct.
Implement the two cached normal accessors with C++ methods
directly. This avoids dealing with raw pointers and reduces the
amount of casting necessary.
Since normals are derived data, it's always a change to something
else that will cause them to change, like the winding order of a face
or vertex positions. So it's clearer to use tags for those things
directly. It's correct to remove the tag in one place since dirty is
the default state of a new mesh.
This validation dates back to when vertex normals were stored in
the `MVert` type (before cfa53e0fbe). Since normals
are all calculated in the same place, and aren't saved in files, this
isn't relevant anymore-- they can just be recalculated.
When creating the bounding box mesh for the viewport replacement,
copy the material from the original mesh. I'm not sure if Cycles is
meant to load materials from the original mesh or the Alembic file
itself, but either way, this should be a harmless change and fixes the
issue in the report.
Pull Request: blender/blender#105798
Create GPUNodeLinks for tiled_image and tiled_image_mapping together, to ensure they are the same texture.
See blender/blender#105661 (comment) for context and a more in-depth explanation.
Pull Request: blender/blender#105772
... or carnidal interpolation with only 2 color stops.
This was triggering an incorrect path due to missing optimisation cases.
Just fall back to the unoptimized case fixes the assert.
This was likely caused by a bad merge when doing the uniform name
patching for Metal.
This also fix the same issue for active UDIM tile overlay which wasn't
reported.
eaa87101cd made evaluated metaballs become meshes
for render engines. This exposed the normals calculated by the metaball
tessellation directly, whereas before they were recalculated later.
There are two fixes: not using the metaball tessellation normals at
all and calculating them with the standard Mesh code path instead,
or switching a define in the metaball code to use a more mesh-like
vertex normal accumulation. Since the results are very similar
(see attached renders), use the second solution, which should
be less expensive.
Pull Request: blender/blender#105799
Increase the default value for the maximum number of recently-opened
files from 10 to 20. Also change the user's preference on version bump
to this new value if their current value is exactly the old default.
Pull Request: blender/blender#105703
Move the deform curves with surface node group to last so it affects the
final generated curves consistently (though this will have a negative
performance impact), and make the generate and interpolate modifiers use
the surface mesh's rest positions.
When the height of the editor couldn't fit the sidebar tabs, they would shrink
to a size too small to read the tab label.
This change matches the behaviour with the Properties Editor navigation bar,
by introducing the following improvements:
* Avoid truncating tab labels.
* Allow scrolling when tabs don't fit.
Behaviour is similar to how scrolling works in the Properties Editor navigation
bar, supporting mouse wheel up/down and MMB, and switching tabs with
`Ctrl+Wheel Up/Down`.
Pull Request: blender/blender#105355
My PR blender/blender#104535
was committed as 88f9c55f7f and the logic was changed
while adding support for face sets, making the logic incorrect and
the warning system disfunctional.
Restore the logic from the original PR with added support for face sets,
fix const correctness issues, improve variable naming, and remove a
check for empty names, since all attribute-type layers should have
names in a valid mesh.
Fixes#105780
Previously only the icon of a file could be dragged in the list display
modes, the name label would invoke box select. This made dragging quite
finicky. I've seen this cause quite some frustration, especially when
the file browser is used as a regular editor to drag data from into
other editors.
Instead follow the Outliner (and some other file browsers like the macOS
one): Dragging on empty space invokes box select, dragging on the name
or icon invokes drag & drop of the item.
The hitbox for the dragging is the width of the string, and the full row
height. So there's no space between rows to do box-select from, it
always triggers dragging. This is based on feedback during testing.
Note that 1e9564864c and 6da512f0bc were needed to prepare this change.
Pull Request: #104830
The switch from `stroke_start` to `vertex_start` in 8c6d4aa103 forgot
to also update `iter->stroke_index_last` which also needs to use
`vertex_start`.
Pull Request: blender/blender#105797
Skip explicit binding location for samplers in OpenGL when not needed, since drivers can usually handle more sampler declarations this way (as long as they're not actually used by the shader).
Pull Request: blender/blender#105770
Skip explicit binding location for samplers in OpenGL when not needed, since drivers can usually handle more sampler declarations this way (as long as they're not actually used by the shader).
Pull Request: blender/blender#105770
The loading for the "All" asset library would include the "Current File"
library as if it were a regular asset libray on disk. Instead make sure
the latter is loaded properly first and is skipped when recursively
reading on disk libraries.
This PR fixes an error that is given when Metal API validation is enabled. The compute grid can exceed 65536 threads so `ushort` is not sufficient for `metal_grid_id [[threadgroup_position_in_grid]]`.
This PR also fixes OS version warnings ([Cycles Metal: Unguarded access to newer macOS features #105630](blender/blender#105630))
Pull Request: blender/blender#105763
The operator went through quite a bit of trouble to pass a color
attribute index to the operator, but then it always used the offset
from the first layer of the active color attribute's type.
Also remove the "copy domains temp" API function, which
generalized this more than necessary, and exposed the internals
of the custom data system a bit more than we would like.
The transformations were applied two times and the old fix was wrong because it needs to use the evaluated point, not the original one. Also I did a small code cleanup.
Pull Request: blender/blender#105202
The two removed BKE functions were at a mid-level of abstraction
that doesn't make total sense in this API. Removing them is also
helpful in the general effort to have the attribute system rely less
on `CustomData` internally.
Allow specifying a specific region to check for active button. This is
required in some circumstances, like Driver Popover.
Pull Request: blender/blender#105746
This simplifies the usage of the API and is preparation for #104478.
The `CustomData_add_layer` and `CustomData_add_layer_named` now have corresponding
`*_with_data` functions that should be used when creating the layer from existing data.
Pull Request: blender/blender#105708
This changes the Switch node so that it is implemented directly as a lazy-function,
instead of as a normal geometry node which uses `GeoNodeExecParams`. This improves
the design of the layered execution api, where different nodes can be implemented
at a proper different abstraction level. The simplest kinds of nodes are implemented
as multi-function, then there is `GeoNodeExecParams` and more specialized nodes are
implemented as lazy-function. The switch node is special in the sense that it currently
needs extra behavior in the lazy-function graph generation anyway.
`GeoNodeExecParams` can be simplified as well, because the Switch node was the only
one that used the `lazy_` methods.
We could consider adding back lazy-input functionality to normal geometry nodes
as it becomes necessary. Ideally, that could be integrated with the node declaration.
Pull Request: blender/blender#105696
Fix support for Wireframe and parametric nodes by resolving
compilation failures surrounding barycentric coordinates.
A final missing part of the Metal implementation for barycentric
coordinates was missing.
Feedback also addressed to move barycentric calculation out
of code-gen and into surface_lib.
Authored by Apple: Michael Parkin-White
This also resolves#103606.
Ref #96261
Pull Request: blender/blender#105740
Now only dynamic function parameters that use ParameterDynAlloc support
dynamically sized parameters arrays.
Add tests for both dynamic arrays that don't support resizing
(Image.pixels) and dynamic sized arguments using
(VertexGroup.add(index=[..])).
Regression in [0] which extended support for dynamic sized function
arguments.
[0]: dfb8c5974e
This adds a new set of APIs supporting the loading and saving of image
formats through OIIO. It makes use of the recent IOProxy work in OIIO
to align with the existing Blender image loading/saving machinery.
The support code here has been prototyped to work with ~7 of our image
formats so far. It includes centralized handling of `IB_test`,
`IB_mem`, and `IB_metadata` flags, which the existing code did not
handle consistently or at all depending on the format.
The PSD format (`format_psd.cc`) is included since the prior location
of the code has been restructured away. It serves as an example of how
the loading code typically flows for all the other formats.
Pull Request: blender/blender#105519
- DriverVariable.name update function passed DriverVar to
BKE_driver_invalidate_expression as a ChannelDriver.
- DriverTarget.name update function passed DriverTarget to
BKE_driver_invalidate_expression as a ChannelDriver.
- DriverVariable.type update function DriverVar accessed ChannelDriver,
clearing a flag.
This was exposed by [0] however this issue existed beforehand.
[0]: c26566ad27
In practice this probably didn't cause bugs, but it would have
caused extra copies of the UV helper layers. The layers are only
needed if we find true values. Mistake in 0fe0db63d7.
This is a non-recent regression that strangely went unreported.
It is expected that when snapping, only visible elements are considered
which does not include faces in wireframe mode.
This works like this before, and this change doesn't appear to have
been intentional.
Ref #105664
One of the advantages of separating this enum member from the others is
because mixing several members in a single one hinders debugging since
in this case the IDE does not define which enums were set.
Also separating this item makes it more readable as `SCE_SNAP_MODE_GEOM`
is not a snap mode but a combination of modes.
VKPixelBuffer is used by external render engines to allocate buffers
using the same GPU backend that Blender runs in.
In a later stage we should test what exact binding flags are needed. I
expect that it should be able to use as a transfer buffer to copy the
pixels over to a texture using transfer commands.
Pull Request: blender/blender#105741
This add the`CurvesGeometry::blend_read` and `CurvesGeometry::blend_write` methods
and uses them in the `curves_blend_read_data` and `curves_blend_write` functions.
No functional changes.
Pull Request: blender/blender#105737
The active frame is pasted always, so if multiframe is
copying the strokes don't need copy the active frame again.
Pull Request: blender/blender#105605
Implement ViewLayer.aovs.remove by adding a new RNA function to call
the internal BKE_view_layer_remove_aov.
Resolves#99259
Pull Request: blender/blender#105646
Issue was that the clamping parameters were not in
the correct order. This leads to undefined behavior
and also lead to small artifacts on other platforms.
Pull Request: blender/blender#105735
In most places where it appears in a menu, the operator would already
apply to all selected F-Curves. Now it is done consistently and explicitly
from all menu items. The default of the operator is now also set to 'all
selected', so that it also behaves like that when called from the operator
search menu.
The BMesh to Mesh conversion does some checks to the UV helper
attributes like selection to avoid copying them to the mesh if they
don't contain any meaningful data. However, it does this by looping
over all faces for every UV map, not in parallel, so it takes up a large
portion of the total time in the conversion. This commit moves that
to the existing similar checks.
On a 1 million face mesh with 3 UV maps, for me this improved the
conversion runtime by 75%, from 174ms to 99ms. Before the serial
loops took 88ms out of the total. Combining them with the existing
loop over faces only increased its runtime from 29 to 40ms.
Some add-ons choose to use the `warning` field in the `bl_info`
dictionary. This is potentially useful info, which should be shown to
the user translated.
This commit extends `dump_addon_bl_info()` from the i18n utils add-on,
to add this field to the message extraction.
The _gpu_ prefix is redundant as they are inside a namespace
and run as part of a test suite that already contain the name
gpu. (GPUOpenGLTest)
This patch also moved the texture test cases to its own
compile module.
This renames the `BKE_gpencil_*` as well as the `DNA_gpencil_types.h`
files to indicate that it's the legacy grease pencil.
Pull Request: blender/blender#105597
When a shader is bound it should outlife the pipeline. In one
test case where only the shader data was accessed it also bound
the shader. This isn't needed as the shader data should be
retrieved without binding the shader.
This change fixes the issue by not binding the GPU shader.
Patch version was increased, but the file subversion should have
been increased.
Also fixes previous incorrect patch versioning code as it didn't
add all 'version code until next subversion bump goes here.' after
version bump.
The function set bits in a bitmap for all the edge indices in a face.
With future changes to mesh topology storage though, this level
of abstraction won't be as helpful anyway.
Refactoring mesh code, it has become clear that local cleanups and
simplifications are limited by the need to keep a C public API for
mesh functions. This change makes code more obvious and makes further
refactoring much easier.
- Add a new `BKE_mesh.hh` header for a C++ only mesh API
- Introduce a new `blender::bke::mesh` namespace, documented here:
https://wiki.blender.org/wiki/Source/Objects/Mesh#Namespaces
- Move some functions to the new namespace, cleaning up their arguments
- Move code to `Array` and `float3` where necessary to use the new API
- Define existing inline mesh data access functions to the new header
- Keep some C API functions where necessary because of RNA
- Move all C++ files to use the new header, which includes the old one
In the future it may make sense to split up `BKE_mesh.hh` more, but for
now keeping the same name as the existing header keeps things simple.
Pull Request: blender/blender#105416
This is very similar to ebe8f8ce71, but applies the same
changes to conversions to non-evaluated meshes meant for original
data. The function also handles shape keys, UVs, selection history,
"scan the database" object vertex index remapping, and multires fixes.
Those operations are handled in parallel with the other conversions now.
Similar to before, the improvement is better the more attributes/data
contained in the BMesh. This time I observed an improvement of 50%
(182ms to 123ms) for a large grid mesh with many attributes, and 20%
for a large grid mesh with less data. Shape keys, selection, hiding, and
multires data should have less of a detriment to performance now too.
One remaining thing to improve is the recently added UV selection/pin
handling. This should be moved into the first single-threaded loop over
faces, or changed further.
Pull Request: blender/blender#105602
- The Math node lost the headers of its operation type menu in
ee985fa925 , because a translation context was assigned to the RNA
property, but the headers declaration was not updated to extract the
messages with matching contexts.
- The message "Group Input" had a trailing space, which can be added
after translation.
This is something we missed in #104599.
Without it, the default color isn't always set.
Thanks to user roman-13 for pointing out the problem,
and thanks to Hans Goudey for telling me the solution.
Pull Request: blender/blender#105539
Fix a regression that allowed to create several links between an
output socket and a multi input socket either by inserting
links or using the link swap feature.
This regression was caused by the link swapping feature
introduced in commit 89aae4ac82.
Pull Request: blender/blender#105631
Rename `struct ::UVPackIsland_Params` to
`class blender::geometry::UVPackIsland_Params`
Brings us closer to an "algorithm" style API.
No functional changes.
Multiple user actions performed quickly could be blocked by undo
compacting memory - if the background compacting task was not complete
when the next undo step was pushed.
Notes:
- This and recent improvements to BLI_array_Store gives over ~2x speedup
compared with 3.3x, over 10x compared with 3.4x.
A sub-surfaced cube with the modifier applied was used for testing
(~1.5 million polys), both randomized & non-randomized verts/edge/faces
were used to avoid the sub-surface memory layout biasing the results.
Tested transforming ~1/3rd of the mesh and inverting selection.
- Without compacting mesh-data in parallel, the optimizations to
BLI_array_store can give similar performance to 3.3x, however there
are still cases where performance isn't quite as good - so compact the
arrays in parallel to ensure performance is at least as good as 3.3x.
Resolves#105046.
The method of accumulating values to create a hash for each chunk has
been improved for ~16% better distribution of the resulting hashes.
Improve performance of array de-duplication, see: #105046.
Accumulating hashes with a byte/boolean array didn't include enough
information for a useful hash, creating hashes with many collisions.
This is the root cause of a performance regression since 3.3 where
mesh data (used for storing edit-mesh undo steps) was changed to store
selection in a boolean array, creating a bottleneck de-duplicating
chunks of that array for edit-mesh undo's custom-data de-duplication.
Resolve by increasing hash accumulation for arrays with smaller elements,
so each chunk of memory (a candidate for de-duplication) isn't as likely
to have hash collisions.
`char` (single byte) arrays now accumulate 22 values instead of 7, it's
taking more values into account was necessary as these are effectively
bits in the case of boolean arrays, 2-byte values accumulate 32 bytes,
4-byte elements accumulate 44 bytes, larger structs accumulate
`sizeof(type) * 7` bytes (as before).
Also ensure the accumulation read-ahead never exceeds the chunk size -
technically a fix although this would only happen when passing a small
`chunk_count` to BLI_array_store_create (in the range of 1-16) so this
didn't happen in practice.
Improve performance of array de-duplication, see: #105046.
Use uint32_t since it's sufficient for hashing, using an int64_t was
especially inefficient when allocating an int64_t for every boolean
(when compacting an array of booleans).
Improve performance of array de-duplication, see: #105046.
This is a fix for the previous commit d7c023eb25.
Before, every time the lambda was called, a copy of the BitVector was
made. This was very inefficient.
Now this has been fixed by passing the BitVector by reference (&) in
the lambda function.
In very specific cases, during intersection testing, `intersect` can
add polygons already checked as duplicates in the buffer that
corresponds to the rest of polygons that can form groups of duplicates.
As the buffer cannot have repeated indices, re-adding, even
temporarily, these duplicates can cause a buffer overflow.
While this may have some impact on performance, it's difficult to
predict these cases and thus add a buffer pad.
So the solution is to check if they are already duplicated.
Commit ea97bb1641 introducing the GHash mapping between objects and
their CollectionObject items in a Collection broke ID remapping of
collections's objects. Release builds would 'work', but debug builds
would assert in several ways when opening complex production files.
The root of the issue was a bad/missing handling of the 'duplicate case'
(several CollectionObjects pointing to a same Object).
While fixing the code was possible, it turned out to require disabling
to much safety checks. Further more, there was an opportunity to improve
efficiency of the related code in ID remapping (the pos-processing
checking for NULL and duplicates in collections objects lists).
This commit introduces a new 'dirty' tag for CollectionObject lists and
their ghash mappings.
This tag is set by the `foreach_id` callback when the `ob` pointer of a
CollectionObject is changed, and it is detected as (potentially)
breaking the consistency of that data.
This tag is then used by a new `BKE_collections_object_remove_invalids`
call, to only check and fix collections tagged as dirty, instead of all
the collections in the given Main. It replaces the previous
`BKE_collections_object_remove_nulls` and
`BKE_collections_object_remove_duplicates` functions.
The speed-up is about an order of magnitude for the clean-up code
itself, which gives 2-3 percent speed-up on resynching a complex
production file e.g.
This commit also includes some cleanups and re-organization of related
code.
Fix issues with the display of frame node labels, that made them
harder to read for people with low vision or on high dpi displays:
* Unclamp the size of text that is drawn in the frame node
so all sizes can be displayed consistently at all zoom levels
and independet of the UI scale.
* Account for the label when calculating the frame node's
bounds, so child nodes don't obscure the label.
Pull Request: blender/blender#104555
Don't expand view layer elements if element is previously used
This is similar as done for other display mode (eg. scene, library override)
Pass view_layer ID instead of scene as argument in `outliner_add_element`
Old Differential Revision: https://archive.blender.org/developer/D16661
Pull Request: blender/blender#104862
This patch enables edge panning for the operators where there was
a mismatch in behaviour between using the shortcut `G` and the
"Move" operator exposed via the menu and operator search.
Commit 19da434e9c introduced a `view2d_edge_pan` property which
was activated for the translate operators invoked when pressing G in
the default keymap.
The property is not enabled by default, to avoid it getting in the
way in some cases, so the "Move" operators exposed via the menus
didn't have edge panning. This lead to inconsistent behavior between
moving via the shortcut or via the menu.
Pull Request: blender/blender#104482
The use of wordexp(3) permits arbitrary code execution from manually-crafted
glTF files. See https://github.com/syoyo/tinygltf/issues/368 for more details.
In practice this shouldn't be an issue for Blender since the GlTF data isn't
manually crafted but from the OpenXR runtime (a bit like a driver). But
updating the library to include the fix is not a big deal anyway.
Note that the warning that required the local modification is no longer present upstream since
0bfcb4f49e
Pull Request: blender/blender#105536
Workaround for a crash when `addComputePipelineFunctionsWithDescriptor` is called *after* `newComputePipelineStateWithDescriptor` with linked functions (i.e. with MetalRT enabled). Ideally we would like to call `newComputePipelineStateWithDescriptor` (async) first so we can bail out if needed, but we can stop the crash by flipping the order when there are linked functions. However when addComputePipelineFunctionsWithDescriptor is called first it will block while it builds the pipeline, offering no way of bailing out.
Note that this only has an impact when the "MetalRT (Experimental)" option is checked.
Pull Request: blender/blender#105629
The reasoning is that the detail namespace is not to be used
outside the module itself. But one might want to use different
number types with these templates.
The `Base` suffix was chosen in order to be consistent with `MatBase`
and `Vector` naming convention.
Refactor the following functions and cover with tests
* `BKE_fcurve_calc_bounds` - used to get the `rctf` bounding box of an fcurve
* `BKE_fcurve_calc_range` - used to get only the x-range, potentially faster when not needing y extents
`get_fcurve_end_keyframes` has been replaced with `get_bounding_bezt_indices` - dealing with indices allows to iterate over that range later
### BKE_fcurve_calc_bounds
* pass in an `rctf` instead of float pointers
* extract logic to get bounds into separate functions
### BKE_fcurve_calc_range
* removed the parameter `do_min_length` it was always false, and this function shouldn't concern itself with clamping.
Calling code can do that if the return bool is false
* use function to get x bounds separated from `BKE_fcurve_calc_bounds`
Pull Request: blender/blender#105177
Archlinux faced an issue with AoT compilation: https://bugs.archlinux.org/task/77554
These were due to compiler flag strings handling going wrong when cmake
calls the custom command. It ended up moving quotes around, leading flags to
get passed to the main compiler instead of the graphics compiler and trigger
the following error: "Unrecognized build options: -ze-opt-regular-grf-kernel".
Pull Request: blender/blender#105615
* Last operator panel now works
* Added a strengh property for fairing modes
* Now works when called from a menu (added OPTYPE_DEPENDS_ON_CURSOR
to operator type flag).
The function to upload the normals uses an optimization to avoid
checking the smooth status or face normal of the triangle is part
of the same face. The smooth status needs to be initialized before
the loop for that to work.
Also do a bit of cleanup:
- Decrease variable scope
- Fix the reversed incorrect naming of `smooth`
- Retrieve mesh data at the start of the function
eb68334b58 replaced the pointer to looptris with a span
but left the variable for the number of looptris unset at zero. Fix by
using the size of the span instead.
The count wasn't clamped above zero in some newly optimized code.
Instead of adding it there, move the clamping to the field network,
similar to some other nodes. That makes it so the rest of the code
doesn't have to deal with the clamping, and should be faster in the
single-value case.
The previous API for clearing storage buffers was following the OpenGL
api. OpenGL has many options to support for data conversions, striding
and sizzling. Metal and Vulkan don't have these features and we have to
deal it ourselves.
Blender internally only uses a tiny subset for what is possible in
OpenGL. Making the current API to difficult to implement on our future
platforms as we had to implement all cases, most even not used at all.
By changing the API we make future development easier as we only need
to implement what we are actually using.
**New API**
`GPU_storagebuf_clear(GPUStorageBuf* ssbo, uint32_t clear_value)`
Related issue: #105492
Pull Request: blender/blender#105521
Clearing of clipmaps is the only place in Blender that uses non
uniform data (not all components of the cleared data to be exact
the same).
Vulkan has only the possibility to clear buffers using a single
uint32_t. There were two solutions:
- Add compute shader to Vulkan backend.
- Make Eevee-next responsible to clear the clipmaps.
When fixing this in the Vulkan backend it could lead to other issues
as the backend isn't aware what is exactly required and might overwrite
active bindings. We chose to make it a responsibility of Eevee-next
as there it is clear what is needed.
Related issue: #105492
Pull Request: blender/blender#105560
This patch re-implement the whole C rotation API into a more type
oriented C++ API. See the #104444 design task for more details about
the goals.
The list of C to C++ equivalent syntax can be found attached.
This adds `AngleRadian`, `AngleCartesian` and `AngleFraction` as
different angle types with the same interface. Each of them have
specific benefits / cons. See inline documentation for detail.
This adds `Axis` and `AxisSigned` class wrapped enums to increase type
safety with axes selection.
This adds `CartesianBasis` to represent orthonormal orientations.
Added a weight accumulation to dual-quaternions to make normalization
error proof. Creates the overhead of summing the total weight twice
(which I think is negligible) and add an extra float.
Named the dual-quaternion `DualQuaternion` to avoid naming ambiguity
with `DualQuat` which come up quite often (even with namespace).
Pull Request: blender/blender#104941
For mesh primitives, the bounds can be calculated trivially in advance
with negligible cost. In case they are needed later on, setting them
eagerly can save the calculation later on. For large meshes, this can
save tens of milliseconds before drawing.
Pull Request: blender/blender#105266
When subsampling was introduced in VSE it was disabled during
editing. Only when rendering it was enabled. This lead to
cache being different between editing and rendering. Leading
to confusion.
This PR will enabled the subsampling when editing. This way
it is more consistent.
Pull Request: blender/blender#105612
The shader libraries were not hooked up yet in cmake for windows since
when the shaderc libs landed there was no code yet that used it.
It's required now, so this change adds the missing bits.
Some checks here are really critical and should assert, but that one is
more an indication that something is not going right, though data itself
should still be mostly valid, so better warn the user with a LOG
warning, than be silent in release builds, and crash in debug ones.
Fix seam bleeding of non-manifold sections of the mesh, by copying pixels
that are covered by the brush stroke.
As manifold parts are already handled, the pixel copying solution can be
very straight forward.
* Pixels are copied from the same tile. So we don't need a mechanism that
copies and merges pixels from other tiles.
* Pixels are copied from the closest pixel that is being painted on. We
don't need to consider that that pixel can be in different areas of the
tile.
When we copy a pixel, we find the closest pixel in UV space that is being
directly influenced by a paint brush. We also look for the second closest
pixel, which is still a neighbor from the closest pixel. We can mix both
pixels together and store it in the destination. A mix factor is calculated
using the closest non manifold edge as a guidance.
The result of this step is a list of copy and mix commands that can be
executed to fix the seam bleeding for non-manifold sections of the mesh.
| Destination | Source 1 | Source 2 | Mix factor |
| ----------- | -------- | -------- | ---------- |
| 1780,1811 | 1780,1810| 1779,1810| 0.000000 |
| 1781,1811 | 1781,1810| 1782,1811| 0.168627 |
| 1828,1811 | 1828,1810| 1827,1811| 0.156863 |
| 1829,1811 | 1829,1810| 1828,1810| 0.188235 |
| 1830,1811 | 1830,1810| 1829,1810| 0.188235 |
| 1831,1811 | 1831,1810| 1830,1810| 0.188235 |
| 1832,1811 | 1832,1810| 1831,1810| 0.188235 |
| 1833,1811 | 1832,1810| 1832,1810| 0.000000 |
In the end we go over this list mix the sources and store the result at
the destination.
```
tile_buffer[destination] = mix(tile_buffer[source_1],
tile_buffer[source_2],
mix_factor);
```
**Encoding**
When using a large textures or large seam margins this table can grow
large and reduce performance as data retrieval is slower, than the
operations it has to perform. To improve the performance we encode the
table so less data retrieval needs to be done.
* first `DeltaCopyPixelCommand` is delta encoded from
`CopyPixelGroup#start_destination` and `start_source_1`. The others
are delta encoded from the previous `DeltaCopyPixelCommand`.
* For performance reasons PixelCopyGroup#pixels are ordered from
destination (left to right) for each row a new group would be created
as the delta encoding most likely doesn't fit. When pixels cannot be
delta encoded a new group will also be created.
**Compression rate**
When using Suzanne the compression rate is around 36% when using a seam
margin of 4 pixels. The compression rate may vary depending on seam
margin and model. For Suzanne the compression rate was around 36% for
various resolutions.
| Resolution | Margin | Decoded size | Encoded size | Compression |
| ---------- | ------ | ------------ | ------------ | ----------- |
| 2048x2048 | 4 px | 353.052 | 128.101 | 36% |
| 4096x4096 | 4 px | 700.140 | 255.137 | 36% |
| 8192x8192 | 4 px | 1.419.320 | 513.802 | 36% |
| 2048x2048 | 8 px | 721.084 | 193.629 | 26% |
| 4096x4096 | 8 px | 1.444.968 | 388.110 | 26% |
Pull Request: blender/blender#105336
The C4100 warning is related to unused formal parameters in functions.
Enabling it better aligns with "-Wunused-parameter" option in other
compilers.
While suppressing it with `__pragma(warning(suppress:4100))` is not the
same as using `__attribute__((__unused__))` in GCC or Clang, it is
still preferable to use it over completely hiding the warning.
This ensures consistent warning behavior across compilers and improves
code quality by addressing unused function parameters.
(Note that some warnings in Windows-specific code have already been
silenced in 7fcb262dfd)
Pull Request: blender/blender#105534
These functions will be useful to speed up the edit mode to object
mode conversion too, move them above that so they can easily be
used for that case later.
Currently a developer that starts blender with `--debug-gpu` or
runs the GPU test cases can receive an error when not the full
VulkanSDK is installed.
The VulkanSDK isn't required for normal developement and
therefore it is better to show it as a warning.
NOTE: VulkanSDK is adviced to use when developing in the Vulkan
backend as it contains tools that helps/speed up the development
and validation during development.
Pull Request: blender/blender#105599
Decorator buttons would be skipped when setting the tooltip data for all
buttons in the layout, but the duplicated data would still be marked as
used, so not freed.
Move two settings that were previously in the "View" menu of the Graph Editor into User Preferences.
It has been mentioned in the meeting by Luciano Muñoz Sessarego that it would be good to move that to the preferences so you can set it once and then forget about it.
The Settings moved are:
Only Selected Curve Keyframes
Use High Quality Display
Pull Request: blender/blender#104532
The traversable handle of a BLAS may be zero when the relevant geometry
is empty (no triangles/curves/points/...), as no BLAS is built in such cases.
It is not correct to attach a zero handle to a TLAS, so filter out such instances.
Invalid nodes are not added to the lazy-function graph. Therefore, their
outgoing links are also not added, which implies that the targets need
some default value.
Both the shader_builder and existing shader tests eventually
tested the same aspects. shader_builder is more modern and
handles more cases.
The old shader test requires a full backend in order to run
This commit replaces the old tests to just use the
shader builder for validation.
Shader builder can still be run at compile time, this is
just a convenience to have as a test case as well for CI/CD.
Ref: #105482
It is recommended to map buffers once and not each time the
mapped memory is needed. This patch will map the buffer when
created and unmap the buffer when the buffer is freed.
This patch will reduce the overhead where the Vulkan driver or
the virtual memory manager needs to be accessed.
Pull Request: blender/blender#105588
The correction bbc6bb3468 was still wrong because there it was
disregarded that `vert_ctx_len` does not necessarily indicate merges in
the same polygon.
Therefore, it is not safe to rely on `vert_ctx_len` to count possible
new polygons.
NOTE: It might be worth preempting part of the
`weld_poly_split_recursive` logic to identify what the new polygons are
in advance. But this can be left for a future refactor.
- Both success & ok were used for file reading, use the clearer name.
- Paths were single/double quoted, use double quotes for print/reports.
- Rename `path` to `filepath` / `dirpath`.
Add a filepath argument to load/save pre/post.
Also add save_post_failed and load_post_failed handlers so it's always
possible to for the pre handlers to run a matching post action.
This makes it possible to know the filepath of the blend file mean
loaded/saved as well as supporting running an action when load/save
operations fail.
When loading and saving the startup-file, the path argument is set to
an empty string.
Details:
New RNA types were added to support storing primitive values in
PointerRNA. Primitive{String/Int/Float/Boolean}RNA. These will likely
only be used in some limited cases, in the case of BKE_callback_exec it
allows strings to be included as part of the PointerRNA **pointers
argument.
Ref !104769.
Don't allow the hover of mouse to auto-raise another window while you
are entering data into a text or number input.
Pull Request: blender/blender#105446
The attribute, like the other attributes that start with `.` is not
supposed to be displayed in the spreadsheet or the attribute list
by default. This was missing from the commit that added the attribute.
Currently the shade smooth status for mesh faces is stored as part of
`MPoly::flag`. As described in #95967, this moves that information
to a separate boolean attribute. It also flips its status, so the
attribute is now called `sharp_face`, which mirrors the existing
`sharp_edge` attribute. The attribute doesn't need to be allocated
when all faces are smooth. Forward compatibility is kept until
4.0 like the other mesh refactors.
This will reduce memory bandwidth requirements for some operations,
since the array of booleans uses 12 times less memory than `MPoly`.
It also allows faces to be stored more efficiently in the future, since
the flag is now unused. It's also possible to use generic functions to
process the values. For example, finding whether there is a sharp face
is just `sharp_faces.contains(true)`.
The `shade_smooth` attribute is no longer accessible with geometry nodes.
Since there were dedicated accessor nodes for that data, that shouldn't
be a problem. That's difficult to version automatically since the named
attribute nodes could be used in arbitrary combinations.
**Implementation notes:**
- The attribute and array variables in the code use the `sharp_faces`
term, to be consistent with the user-facing "sharp faces" wording,
and to avoid requiring many renames when #101689 is implemented.
- Cycles now accesses smooth face status with the generic attribute,
to avoid overhead.
- Changing the zero-value from "smooth" to "flat" takes some care to
make sure defaults are the same.
- Versioning for the edge mode extrude node is particularly complex.
New nodes are added by versioning to propagate the attribute in its
old inverted state.
- A lot of access is still done through the `CustomData` API rather
than the attribute API because of a few functions. That can be
cleaned up easily in the future.
- In the future we would benefit from a way to store attributes as a
single value for when all faces are sharp.
Pull Request: blender/blender#104422
Node tree updates can crash if the tree contains a node group that points at an "undefined" tree type.
This can happen if the tree is linked from a library and the path is lost,
or if a custom (python) tree is used and the script is not run.
The fix is to check if the node group type is valid ("registered") and return an empty list otherwise.
Pull Request: blender/blender#105564
The first implementation based the max value on what seemed reasonable.
It was therefore limited it to 5.
I received a request from a user in the first already merged #104741
to allow a higher max value.
Thus I adjusted the max value to be the same as the max value used for
"Vertex Size", 32.
Pull Request: blender/blender#105544
Render the transparent object bounds to a low-res frame-buffer and ray-march the
bounds volume, tagging shadow tiles along the way.
The bounds volume is inflated by half a pixel as a conservative rasterization
alternative, to ensure the tiles needed by all LOD0 pixels get tagged.
The bounds are rendered with front face culling and then the fragment shader
ray-marches against the bounds volume.
Each ray-marching step size equals the world space size of the pixel at the step
depth.
The step bounding sphere radius is also sent to the shadow usage tagging library
to ensure the whole step volume is tagged.
Pull Request: blender/blender#104580
This renames the `OB_GPENCIL` object type and the `ID_GD` to `OB_GPENCIL_LEGACY` and `ID_GD_LEGACY` respectively.
There is no change for the user.
Pull Request: blender/blender#105541
With the move to Gitea the URI for line numbers changed from `$1234` to `#L1234`.
The change also removes a superfluous space character from the generated RST syntax.
When trying to use the Fill Range by Selection operator, in the
Distance from Camera Freestyle modifier, the operator fails if no
camera is active in the scene.
Before getting the data from the camera, check that it is defined, and
return otherwise.
Pull Request: blender/blender#105475
Hello, this is a small PR to check that my understanding of #102427 is correct before moving on to the rest of the issue.
This PR contains the updated UI of the `Sculpt` menu only. Other menus will be submitted for review later.
Currently exposed operators:
* Move
* Rotate
* Scale
* Box Trim (Trim Mode ="Difference")
* Lasso Trim (Trim Mode ="Difference")
* Box Add (Trim Mode ="Join")
* Lasso Add (Trim Mode ="Join")
* Line Project
* Smooth
* Surface Smooth
* ~~Scale (Could be left out?)~~
* Inflate
* Random
* Relax Topology
* Relax Face Set Boundaries
* Sharpen
* Enhance Details
* Erase Displacement
The original issue specifies `Relax Face Set Boundaries` and `Erase Displacement`. I'm not quite sure if this is done in the UI code or somewhere else.
Reviewed By: Joseph Eagar & Julian Kaspar
Pull Request: blender/blender#104718
Pick select is only meant to change a single element from a single
data-block. However, the operator worked on each object individually
rather than first finding the closest point, then processing the
selection. Change the operator to find the closest point across all
objects, then deselect if necessary, then select the closest point.
Pull Request: blender/blender#105495
Previously `SEQ_transform_single_image_check` function was used to check
if image or effect strip has only one frame of content. Now these strips
are flagged with `SEQ_SINGLE_FRAME_CONTENT`.
While previously this was implicit property of strip, benefit of having
explicit flag is that this property can be decoupled from strip length.
At a random the bf_io_ply_tests would fail in one of the fixtures.
The root of the issue was that the exporter parameters were used
uninitialized, causing the mesh to be triangulated in some of the
runs and not be triangulated in other runs.
This change makes it so PLYExportParams is always zero-initialized,
so that this solves this issue, and that adding fields to it in the
future will not re-introduce the issue.
Pull Request: blender/blender#105537
This patch implements the bicubic interpolation option in the transform
nodes. The path merely reuse the code in the shader image texture and
adds bicubic variants to the domain realization shader.
Pull Request: blender/blender#105533
Git: Add VS/VSCode litter to .gitignore
Neither regular VS nor VS Code can't seem to keep themselves from
littering in the source folders.
This change adds some common litter to .gitignore file to provide some
relief for developers using these editors/IDE's
When running unit tests or other fast completing renders, forced crashes can occur if there are any slow, outstanding PSO compilation requests (due to the `std::terminate` fall-back case in `~ShaderCache`).
This patch eliminates the need for this shutdown hack by using of the async version of `newComputePipelineStateWithDescriptor` when creating a PSO for the first time. In doing so, we are able to explicitly respond to app shutdown instead of waiting for the pipeline to finish compiling (..and then timing out and force-crashing). We still use the blocking version of `newComputePipelineStateWithDescriptor` when loading from an archive, as this can handle loading from a corrupted archive gracefully. Finally, we move `addComputePipelineFunctionsWithDescriptor` to *after* the PSO is built (as this will trigger a full blocking compile if the PSO has not yet been built, which would bring back the original issue).
Pull Request: blender/blender#105506
MTLFramebuffer's viewport was not correctly updated when
updating attachments. Behaviour modified to be consistent
with OpenGL.
Authored by Apple: Michael Parkin-White
Ref #96261
Pull Request: blender/blender#105529
This commit introduces `ConstListBaseWrapper`, to allow easy iteration over
`const ListBase *` in C++ code.
Basically `ListBaseWrapper` was renamed to `ListBaseWrapperTemplate`, and
got a new template parameter `LB`. The new `ListBaseWapper` class has `LB=ListBase`,
whereas `ConstListBaseWrapper` has `LB=const ListBase`.
Also in this commit is one use of `ConstListBaseWrapper` to make sure the
templated code is actually expanded & compiled.
Example use:
```cpp
for (const bDeformGroup *dg : ConstListBaseWrapper<bDeformGroup>(defbase)) {
...
}
```
Pull Request: blender/blender#105464
Indicating light colors by coloring the light icons.
Task: #104280
Pull Request: #105236
- Added a checkbox under overlay extra to enable/disable light coloring. Disabled by default.
- The outer ring and the sun rays are colored.
- Only the base color is shown, colors in nodes are not considered.
Since db6287873c, we added parenting (Keep Transform Without Inverse)
to the parent_set operator and exposed this in the UI in the invoke menu
of that operator.
This however never made it to the `Object` > `Parent` menu.
Since this is quite useful (and otherwise a bit hidden in the Adjust
Last Operation panel) and parent inverse can cause confusion in many
cases (see e.g. #105276 or #103969), now add this as an explicit entry
in the `Object` > `Parent` menu as well.
After ed870f87b9, panels headers displayed inside panels had their
label duplicated when translations were enabled. This is because a
string comparison was made against the original message, instead of
the translated message.
Pull Request: blender/blender#105151
- "Lines" in the sense of number of lines
- "Number" can mean "amount, count" or "index, offset"
- "Second" can be an ordinal number or a unit
- "Root": add the brush curve to the "square root falloff" sense
- "Strip" can be a sequence or a type of hair rendering
- "Constant" in the sense of a value, for the Geometry Nodes add
submenu (#105447).
Additionally, extract:
- "Press a key" from the Keymap preferences.
- "MaskLayer", upon new mask layer creation
Ref #43295, #105447
While developing a new armature draw type, I was switching between
branches and opening the same test file. It would crash Blender because
it assumed that the `else` clause could only mean `(arm->drawtype ==
ARM_OCTA)`. This is now explicitly tested for.
The result is that an armature with unknown draw type is not drawn at
all, but I prefer that over either resetting the draw type to something
valid (thus altering the blend file) or downright crashing.
This was caused by an incorrect assumption in the solver:
It tries to solve both collision and length constraints simultaneously,
using the projected movement of a point as a slide direction along the surface.
This only works if the distance of the previous curve point to the surface
is less than the allowed segment length. Otherwise the segment will
exceed the allowed length even with zero slide and NaN values are computed.
The case of larger surface distance can occur if the previous segment
solve was already stretching the current segment and then the point
moves further away. In this case we can simply clamp the segment length
without violating the contact constraint.
Pull Request #105499
This was caused by an incorrect assumption in the solver:
It tries to solve both collision and length constraints simultaneously,
using the projected movement of a point as a slide direction along the surface.
This only works if the distance of the previous curve point to the surface
is less than the allowed segment length. Otherwise the segment will
exceed the allowed length even with zero slide and NaN values are computed.
The case of larger surface distance can occur if the previous segment
solve was already stretching the current segment and then the point
moves further away. In this case we can simply clamp the segment length
without violating the contact constraint.
Fixes#105467
Pull Request #105499
Some UI functions have a "translate" argument, which if set to False
specifies that the message is not to be translated. This sometimes
means that it was already translated beforehands.
But many messages were still getting extracted, sometimes twice in
different contexts. Some featured errors because the arguments of
various functions would be concatenated, such as:
```
col.label(text=iface_("Branch: %s") % bpy.app.build_branch.decode('utf-8', 'replace'), translate=False)
```
which would get extracted as:
```
msgid "Branch: %sutf-8replace"
```
Pull Request #105417
When investigating ID user-count issues, it wasn't clear how nodes
were meant to handle user-count for ID's. Specifically that the
initfunc should _not_ increment the ID's user count.
Doing such writes leaves dangling file in the installation directory which
then is packaged as well. Not only this makes it so a random file gets
packaged for installation, it also makes notarization process to fail because
of not-so-clear reason.
The `ply_exporter_ply_data_test.SuzanneLoadPLYDataUV` fixture seems to be
unreliable and fails at random, even before this change. This makes it
hard to reliably get green light on all tests.
Pull Request #105504
Don't call recursion where it's redundant. The recursive algorithm
can carry dangerous behavior due to stack growth and overflow. The
probability is low for something like the frame nodes. But using a loop
is cheap, providing O(N = const) memory cost. A loop through the links
in a singly linked list is sufficient. The use of 2D vectors for
location mapping and other things can be separate.
Pull Request #105394
3e5ce23c99 introduced a regression in case the freed Main was part of a
list, and was supposed to be removed from it, since calling
`BLI_remlink` does _not_ clear the `prev`/`next` pointers of the removed
link.
This commit also contains a few more tweaks to recent related b3f42d8e98
commit.
Pull Request #105485
While this behavior can be useful in some cases, it can also create
issues (as in one of own recent commits, 3e5ce23c99), since it
implicetly keeps the removed linknode 'linked' to the listbase.
At least warn about it in the documentation of `BLI_remlink`.
This commit introduces a new Main boolean flag that marks is as invalid.
Higher-level file reading code does checks on this flag to abort reading
process if needed.
This is an implementation of the #105083 design task.
Given the extense of the change, I do not think this should be
considered for 3.5 and previous LTS releases.
Drivers: Introduce the Context Properties
The goal: allow accessing context dependent data, such as active scene camera
without linking to a specific scene data-block. This is useful in cases when,
for example, geometry node setup needs to be aware of the camera position.
A possible work-around without changes like this is to have some scene
evaluation hook which will update driver variables for the currently evaluating
scene. But this raises an issue of linking: it is undesirable that the asset
scene is linked to the shot file.
Surely, it is possible to have post-evaluation handler to clear the variables,
but it all starts to be quite messy. Not to mention possible threading
conflicts.
Another possibility of introducing a way to achieve the goal is to make it so
the dependency graph somehow parses the python expression where artists can
(and already are trying to) type something like:
depsgraph.scene.camera.matrix_world.col[3][0]
But this is not only tricky to implement properly and reliably, it hits two
limitations:
- Currently dependency graph can only easily resolve dependencies to a RNA
property.
- Some properties access which are valid in Python are not considered valid
RNA properties by the existing property resolution functions:
`camera.matrix_world[3][0]` is a valid RNA property, but
`camera.matrix_world.col[3][0]` is not.
Using driver variables allows to have visual feedback when the path resolution
fails, and there is no way to visualize errors in the python expression itself.
This change introduces the new variable type: Context Property. Using this
variable type makes allows to choose between Active Scene and Active View
Layer. These scene and view layer are resolved during the driver evaluation
time, based on the current dependency graph.
This allows to create a driver variable in the following configuration:
- Type: Context Property
- Context Property: Active Scene
- Path: camera.matrix_world[3][0]
The naming is a bit confusing. Tried my best to keep it clear keeping two
aspects in mind: using UI naming when possible, and follow the existing
naming.
A lot of the changes are related on making it so the required data is available
from the variable evaluation functions. It wasn't really clear what the data
would be, and the scope of the changes, so it is done together with the
functional changes.
It seems that there is some variable evaluation logic duplicated in the
`bpy_rna_driver.c`. This change does not change it. It is not really clear why
this separate code path with much more limited scope of supported target types
is even needed.
There is also a possible change in the behavior of the dependency graph: it
is now using ID of the resolved path when building driver variables. It used
to use the variable ID. In common cases they match, but when going into nested
data-blocks it is actually correct to use relation to the resolved ID. Not sure
if there was some code to ensure that, which now can be resolved. Also not sure
whether it is still needed to ensure the ID specified in the driver target is
build as well. Intuitively it is not needed.
Pull Request #105132
Currently, curves have a default offset of 1.0, while the initial (and
expected) value is 0.0. When resetting this value to its default, the
curve is now modified unexpectedly. This is most noticeable with text
objects: when resetting the offset of a new text, it will look very
broken.
Internally the value is stored with an offset of 1.0, with custom
setter and getter adding and subtracting 1.0 respectively. To give
this property a default of 0.0, we also need to add 1.0 to the initial
value upon curve creation.
Pull Request #105182
In order to properly translate UI messages, they sometimes need to be
disambiguated using translation contexts. Until now, node sockets had
no way to specify contexts and collisions occurred.
This commit adds a way to declare contexts for each socket using:
`.translation_context()`
If no context is specified, the default null context is used.
Pull Request #105195
This has the effect that the message is cut off at the end of the
first line. I copied the solution from other similar docstrings
elsewhere in the code.
As far as my regex-fu can tell, there are no other occurrences of this
in the codebase.
Issue reported by Joan Pujolar in #43295.
Pull Request #105474
**What are push constants?**
Push constants is a way to quickly provide a small amount of uniform data to shaders.
It should be much quicker than UBOs but a huge limitation is the size of data - spec
requires 128 bytes to be available for a push constant range.
**What are the challenges with push constants?**
The challenge with push constants is that the limited available size. According to
the Vulkan spec each platform should at least have 128 bytes reserved for push
constants. Current Mesa/AMD drivers supports 256 bytes, but Mesa/Intel is only 128
bytes.
**What is our solution?**
Some shaders of Blender uses more than these boundaries. When more data is needed
push constants will not be used, but the shader will be patched to use an uniform
buffer instead. This mechanism will be part of the Vulkan backend and shader
developers should not see any difference on API level.
**Known limitations**
Current state of the vulkan backend does not track resources that are in the
command queue. This patch includes some test cases that identified this issue as
well. See #104771.
Pull Request #104880
The up_axis_update/forward_axis_update was the same logic between
the two, so factor that out.
Also use the same time reporting logic in PLY as in OBJ/USD/Alembic.
When render is triggered from python and the render result is displayed
it isn't being updated as it wasn't tagged as being invalid.
Pull Request #105480
If the texture image path in the MTL is a "quoted" absolute path, the importer will fail to find the
file. It was only attempting to un-quote the path for the relative case. Now we attempt to un-quote
in all cases.
Pull Request #105478
If the texture image path in the MTL is a "quoted" absolute path, the importer will fail to find the
file. It was only attempting to un-quote the path for the relative case. Now we attempt to un-quote
in all cases.
Pull Request #105478
- Add missing braces for if statements
- Tweak variable naming to use snake case
- Use more common name for `MLoop`s of a face
- Use `std::move` when appending an array
- Use const for a few variable declarations
This commit implements three OSL microfacet closures that are needed to support
MaterialX: dielectric_bsdf, conductor_bsdf and generalized_schlick_bsdf.
Internally these map to existing microfacet closures, only the Fresnel term is
different.
Currently, we use the closure type to encode the type of microfacet distribution
(GGX/Beckmann/Sharp/MultiGGX), the lobes we're interested in
(Reflection/Refraction/both) AND the Fresnel type (None or Principled v1).
This results in the mess of dozens of options that we currently have. Since
adding Principled v2 and the MaterialX OSL closures will involve adding more
Fresnel types, this clearly doesn't scale.
But, since the earlier Fresnel rework (D17101), the Fresnel type only matters
in one place now. This allows to significantly clean up the closure type
handling. To do this, MicrofacetBsdfs now separately store their Fresnel type,
and instead of a single MicrofacetExtra we have one struct per Fresnel type
(unless no extra data is needed).
Further, instead of having one _setup() function per combination, the Fresnel
setup is also split into separate functions. This decouples the implementation
of new Fresnel terms from most of the Microfacet logic, and makes it a very
simple and clean operation.
This commit replaces the current Glass approach, where Glass is a virtual closure
that gets replaced with a Glossy and a Refractive closure, with a combined
closure that handles Fresnel after sampling the microfacet. That way, the Fresnel
term is more accurate since it accounts for the microfacet normal, not the
shading normal.
Also updates the BSDF sampling to use a 3D sampler now, since we need two
dimensions to pick the microfacet normal and then a third dimension to pick
reflection/refraction. This can also be used to get rid of the LCG in the
Principled Hair BSDF, which means we can remove it altogether once MultiGGX is
gone.
Also, "sharp" is now supported as a microfacet distribution in OSL, and 2
is supported as the "refract" argument to microfacet() in order to get glass.
Address some issues discussed in PR #104404:
- Vertex color options changed to None/sRGB/Linear, default is sRGB
to match the existing Python addon.
- Change name to "Stanford PLY" from "PLY" in the menu item.
- Default "Export UVs" to on.
- After importing vertex colors, they are set as enabled for render.
New (experimental) Stanford PLY importer and exporter written in C++.
Handles: vertices, faces, edges, vertex colors, normals, UVs. Both
binary and ASCII formats are supported.
Usually 10-20x faster than the existing Python based PLY
importer/exporter.
Additional notes compared to the previous Python addon:
- Importing point clouds with vertex colors now works
- Importing PLY files with non standard line endings
- Exporting multiple objects (previous exporter didn't take the vertex
indices into account)
- The importer has the option to merge vertices
- The exporter supports exporting loose edges and vertices along with
UV map data
This is squashed commit of PR #104404
Reviewed By: Hans Goudey, Aras Pranckevicius
Co-authored-by: Arjan van Diest
Co-authored-by: Lilith Houtjes
Co-authored-by: Bas Hendriks
Co-authored-by: Thomas Feijen
Co-authored-by: Yoran Huzen
msgfmt has a TBB dependency though bf_blenlib, now for a release build
The MSVC linker is smart enough to realize none of the TBB code is
actually used and discards it. In debug mode the linker is a bit more
conservative and doesn't, leaving msgfmt with a runtime dependency
on TBB. The problem here is, we only copy the runtime dlls during
the install phase, and msgfmt runs long long before that.
For this reason when we run msgfmt we should make sure any runtime
needs it could have are met in the path, there already is a handy
variable for that since oslc has similar requirements.
Pull Request #105048
During install all dlls should copy to the blender.shared
folder regardless if the dependency is on or off, creators
CmakeLists.txt already did this correctly, but for boost
the BOOST_POSTFIX and BOOST_DEBUG_POSTFIX variables were
not set causing the boost dll's not to be copied.
This change takes the setting of these variables out of the
WITH_BOOST block, but still guards it with a
WITH_WINDOWS_FIND_MODULES block so we don't break the build
for people building with that on.
When drawing text with multiple lines inside a frame node, depending
on the zoom level some lines would wrongly get clipped despite being
inside the clipping region.
This was caused by the clipping check in `blf_glyph_draw` not accounting
for the font’s aspect.
Pull Request #105389
Caused by b4100ed377. Image strips with only 1 frame of content do
expect any timeline frame to be translated into frame index of 0.
Check this case and return 0 explicitly.
Fix error in b4100ed377
`seq_retiming_evaluate()` returns range from 0 to 1, to which framerate
correction was applied. this is incorrect, and correction should be
applied to function input.
Unify both functions in one, with a more telling name,
to be sure of the order of the arguments. Some functional
cleanup of the using code to make it more explicit.
Pull Request #105413
When movie framerate does not match scene, content length was clamped to strip
length in scen framerate. This also caused issues with retiming which behaved in
similar way. Retiming was modified to use frame index of strip content, so even
when scene framerate is changed, retiming data is preserved in correct
proportions. This means, that handles are mapped to time in seconds rather than
to frames.
During the discussion for #101413 there was consensus that we could make
OIIO a mandatory dependency. This patch does just that.
The `idiff` testing tool remains optional.
Pull Request #105111
Similar to the previous commit, this simplifies future refactoring
to change the way edges are stored, and further differentiates
single poly variables from array pointers.
The issue was that when using the `HD_ALIGNED` handle type,
Blender would not automatically move the keyframe handles with the key.
Instead one handle would get stuck in place.
To remedy that manually move the keyframe handles in case the type is `HD_ALIGNED`
This makes it consistent with moving a key with G
Pull Request #105401
Consistently use edge draw flag instead of original index to determine if an
edge should be drawn or not.
In GPU subdivision the edge original index was used for both edge optimal
display and selection mapping to coarse edges, but they are not the same.
Now match the CPU subdivision logic and use a separate edge draw flag VBO.
For cage display, match Blender 3.3 behavior more in showing/hiding of edges
in wireframe mode. That is edges without a mapping to an original edge are
always hidden when there is no distinct cage, and drawn otherwise. This is
not ideal for e.g. the bevel modifier where it will always show some edges on
corners despite all edges being hidden by the user. But we currently have
no good information to decide if these should be hidden or not, so err on
the side of showing too much as it did before.
Fie #103706: bevel modifier edges not drawn correctly
Fix#103700: optimal display can't be turned of with GPU subdivision
Fix wrong edge display with GPU subdivision preceded by other modifiers
Pull Request #105384
Timer management code often loops over the list of timers, calling
independant callbacks that end up freeing other timers in the list. That
would result in potentail access-after-free errors, as reported in #105160.
The typical identified scenario is wmTimer calling wmJob code, which
calls some of the job's callbacks (`update` or `end` e.g.), which call
`WM_report`, which removes and add another timer.
To address this issue on a general level, the deletion of timers is now
deferred, with the public API `WM_event_remove_timer` only marking the
timer for deletion, and the private new function
`wm_window_delete_removed_timers` effectively removing and deleting all
marked timers.
This implements design task #105369.
Pull Request #105380
Window activation events on Windows-10 don't seem to be reliable as it's
possible for Alt-Tab to trigger WM_ACTIVATE on a window when switching
away from it. As detecting the keys which are held relies on a valid
active state - this meant Alt could become stuck when using Alt-Tab
to switch between windows.
Disable reading modifiers on activation for WIN32, activating the window
now clears modifiers on WIN32. This isn't ideal as held modifiers wont
be detected, re-introducing the error reported in #40059.
Previously, UBO bind locations were linearly incremented and
relied on the correct uniform location being queried. This fix
is a future requirement for EEVEE next, however, pulling forward
due to Issue #105280 highlighting a possible flaw with expected
uniform locations.
Authored by Apple: Michael Parkin-White
Ref #96261
Pull Request #105311
Intel GPUs exhibit a number of rendering artifacts.
The most substantial being incorrect resolve of reflections.
Splitting the reflections_resolve shader into two passes,
one for SSR and one for light probes ensures correct rendering
and optimal performance on this GPU.
Also resolves an artifact with ambient occlusion wherein
the pow(a, b) function causes excessive precision loss.
Using an alternative method for power calculation on these
platforms resolves the issues.
Authored by Apple: Michael Parkin-White
Ref T96261
Pull Request #105240
A bulk change, to make things moving as quickly as possible, instead of
doing per-modified-file basis.
This is pretty much direct translation of C code to C++, is not really
"proper" C++ usage. That could happen on a more case-by-cases basis.
Pull Request #105376
Metal backed requires HOST_READ texture usage flag
for irradiance grid. This was correctly in place for the
basic grid, but not for grid_prev.
Authored by Apple: Michael Parkin-White
Ref #96261
Pull Request #105312
Add overlay option for retopology, which hides the shaded mesh akin to Hidden Wire, and offsets the edit mesh overlay towards the view.
Related Task #70267
Pull Request #104599
Cleanup, try to always use const.
Many function signatures still have incorrect argument order
(constants, mutables). But this is a larger other cleanup.
Pull Request #104937
Increase the buffer sizes used for `BLI_str_format_uint64_grouped` to
prevent overflow on strings representing numbers within the uint64
range. Also creates and uses defines for all the formatted string
buffer sizes.
Pull Request #105263
This commit adds the ability to generate liboverrides of linked data at
the `BKE_blendfile_link_append` BKE level, and through the Python API
(the `BPY_library_load` context manager, aka `bpy.data.libraries.load`).
The python API was updated essentially to allow easy testing of the new
code. This commit also adds tests for the new 'override' behavior, and
for existing basic link one.
Current code only generates 'basic' overrides, without any handing of
hierarchies or dependencies, as for brush assets only the Brush ID needs
to be overridden.
That new feature does not aim at being exposed to user through the
link/append operations in its current state, as it is way too simplistic.
This change is a requirement for the Brush Asset project (#101908).
Pull Request #104746
The code of the 'Fix Deforms' operator was hard to read and inefficient, doing `O(num_vertices * num_vertex_groups)` evaluations of the mesh. It caused multiple issues and got in the way of improvements to Blender, and seems to be used very little (if ever).
It was decided in [last week's module meeting](https://devtalk.blender.org/t/2023-02-23-animation-rigging-meeting/27757#patch-review-decision-time-5) that this operator should be removed.
Pull Request #105237
Pick selection for the Curves object was not considering multi
object editing. Only the active object was considered.
This fix introduces pick selection for Curves for multi object editing.
Pull Request #105184
The toggle (for anything but float and int types) was swallowed in
bf948b2cef. Also seems ef68a37e5d discarded
`property_overridable_library_set` for bools.
Now treat the overridable toggle as a general property for all property
types.
Pull Request #105370
The map is used to, well, map localized copy of the tracks used by the
tracing thread to the original tracks in the movie clip. There seems to
be some accumulated stuff in there which is no longer used by the current
state of code.
There should be no functional changes.
Pull Request #105374
This PR removes the BKE_nlatrack_add, and adds new:
* BKE_nlatrack_insert_before
* BKE_nlatrack_insert_after
* BKE_nlatrack_new_before_and_set_active
* BKE_nlatrack_new_after_and_set_active
* BKE_nlatrack_new_head_and_set_active
* BKE_nlatrack_new_tail_and_set_active
methods to easily add new NLA tracks in relation to the existing track list.
Pull Request #104929
Under the following circumstances
* keys on 1, 3 and 5
* preview range set to 10-20
The frame channel operator would zoom into nothingness.
because no keys were found in the preview range.
(Only the `ANIM_OT_channel_view_pick` operator though)
This PR fixes it and notifies the user with a warning.
Pull Request #105179
Grease Pencil (when not in object mode) implements its own selection
opertor. This operator (`gpencil.select`) returns
`OPERATOR_PASS_THROUGH`, then falls though to `view3d.select` which can
toggle object selection (when using shift-click picking).
Removing `OPERATOR_PASS_THROUGH` would fix the object toggling, but this
was added in 62c73db734 with good reason (the tweak tool would not
work then).
Now prevent `view3d.select` from acting on Grease Pencil (when not in
object mode).
NOTE: longer term we could have grease pencil use view3d.select to avoid having to add these awkward exceptions
Pull Request #105342
Windows 11 has strange behavior with Alt-Tab.
In some cases an Alt-Press event is sent to the window immediately
after it is de-activated (both Left & Right Alt keys for some reason
even when only one is held).
This meant that:
- Modifiers could be enabled for de-activated windows
(so we can't assume de-activated windows have modifiers released).
- Releasing the modifier key would not be sent to the inactive window
causing the modifier key to be stuck.
- Button events over an inactive window are generated before activation,
so even though activation reads the correct modifier state,
the button event uses the "stuck" modifier state.
Now button & drop events on inactive windows always read the modifier
state first instead of relying on the modifier state to be cleared.
This has some advantages:
- If modifiers are held, they will be used as part of the click action.
- While modifier keys on inactive windows should be rare,
in the case this does happen - stuck keys are avoided.
So it makes sense to apply these changes for all platforms.
The current API makes more sense as part of a class, but for now, keep
consistency with the other geometry module headers and move the code
to the proper namespace, removing the `GEO_` prefix which is only meant
for C code.
Pull Request #105357
Also remove USE_WIN_ACTIVATE & USE_WIN_DEACTIVATE defines as they
were only added when changes to modifier handling failed on WIN32.
This logic has now been tested to work on all platforms.
These functions used internal values and only really make sense in
the context of the mesh validation process where they're used to remove
invalid elements from the mesh.
Note: Applies to both UV Sphere Projection and UV Cylinder Projection.
Adds a new boolean option "Preserve Seams" to UV Sphere Projection.
With "Preserve Seams" active, the Sphere projection will do a
greedy flood fill over the 3D topology, stopping at 3D boundaries
and also stopping at edges where "Mark Seam" has been used in the
3D Viewport.
During the flood fill, each face is mapped using the spherical
projection and then adjusted along the U axis so the UV map is
continuous across the shared edge.
With careful seam placement, this allows for the creation of a
spiral-cut-orange-peel unwrap, where a sphere can be unwrapped
into a single long continuous strip, wrapping multiple times around
the object.
Finally, if the flood fill process creates multiple UV Islands,
they are spaced along the `U` axis to prevent overlaps.
Pull Request #104847
With the goal of clearly differentiating between arrays and single
elements, improving consistency across Blender, and using wording
that's easier to read and say, change variable names for Mesh edges
and polygons/faces.
Common renames are the following, with some extra prefixes, etc.
- `mpoly` -> `polys`
- `mpoly`/`mp`/`p` -> `poly`
- `medge` -> `edges`
- `med`/`ed`/`e` -> `edge`
`MLoop` variables aren't affected because they will be replaced
when they're split up into to arrays in #104424.
This offers overflow checking in debug builds, avoids implicit
conversion to pointers, slicing features for future convenience,
and clarifies ownership. Also switch naming to plural like most
other arrays for further clarification.
This check is no longer needed as Campbell has removed the need to
pass around the active window. This check could potential be error-
hiding so best removed if not needed.
Pull Request #105351
This pull request adds a new tipe of resource handles (thin handles).
These are intended for cases where a resource buffer with more than one
entry for each object is needed (for example, one entry per material
slot).
While it's already possible to have multiple regular handles for the
same object, they have a non-trivial overhead in terms of uploaded
data (matrix, bounds, object info) and computation (visibility
culling).
Thin handles store an indirection buffer pointing to their "parent"
regular handle, therefore multiple thin handles can share the same
per-object data and visibility culling computation.
Thin handles can only be used in their own Pass type (PassMainThin),
so passes that don't need them don't have to pay the overhead.
This pull request also includes the update of the Workbench Next
pre-pass to use PassMainThin, which is the main reason for the
implementation of this feature.
The main change from the previous PR is that the thin handles are now
stored directly in the main resource_id_buf, to avoid wasting an extra
bind slot.
Pull Request #105261
Add specific modal keyitem for `Vert/Edge Slide` and `TrackBall`.
So they don't need to reuse modal items from other operators.
Note that there is a workround to avoid repeated keys in the status bar.
In `gesture_box_apply`, check if `exec` function returns
`OPERATOR_CANCELLED` and return 0 to prevent any undo items from being
created.
Pull Request #105065
This file has been tested on linux, other platforms may need some
tweaks, and/or dedicated files.
This is used to suppress errors with builds integrating ASAN sanitazing
tools, regarding memleaks detected in some third party libraries.
To use it, define the envvar option like that:
`LSAN_OPTIONS=print_suppressions=false:suppressions=/path/to/blender/source/tools/config/analysis/lsan.supp`
This is especially usefull when running ctest.
NOTE: Will also update https://wiki.blender.org/wiki/Tools/Tests/Setup
and https://wiki.blender.org/wiki/Tools/Debugging/ASAN_Address_Sanitizer
accordingly.
Applied for the motion tracking data data structures.
There are two advantages of doing so:
- More explicit and platform independent way of indicating that
something is legacy and is not to be accessed outside of the
versioning code.
- Simplifies conversion to C++ where having deprecated fields
triggers warning in implicitly defined assign operator.
Pull Request #105340
3e5ce23c99 introduced a regression in case the freed Main was part of a
list, and was supposed to be removed from it, since calling
`BLI_remlink` does _not_ clear the `prev`/`next` pointers of the removed
link.
This commit also contains a few more tweaks to recent related b3f42d8e98
commit.
While this behavior can be useful in some cases, it can also create
issues (as in one of own recent commits, 3e5ce23c99), since it
implicetly keeps the removed linknode 'linked' to the listbase.
At least warn about it in the documentation of `BLI_remlink`.
The active window was used by the NLA and the Graph editor however
this is not always available and not necessarily the window that
contains the area being initialized. Potentially causing the graph and
NLA spaces to be initialized with the wrong scene.
Active window access caused various awkward fixes in the past
([0], [1], [2]) which worked around the active window not being set.
Use a lookup for the window instead of accessing the active window.
Note that passing the window is an option too however this is only
used for versioning older files and is not be needed in most cases.
[0]: 20788e1747
[1]: 42f6aada98
[2]: 480e467ac9
As part of #95966, move the `ME_SEAM` flag on mesh edges
to a generic boolean attribute, called `.uv_seam`. This is the
last bit of extra information stored in mesh edges. After this
is committed we can switch to a different type for them and
have a 1/3 improvement in memory consumption.
It is also now possible to see that a mesh has no UV seams in
constant time, and like other similar refactors, interacting with
only the UV seams can be done with less memory.
The attribute name starts with a `.` to signify that the attribute,
like face sets, isn't meant to be used in arbitrary procedural
situations (with geometry nodes for example). That gives us more
freedom to change things in the future.
Pull Request #104728
This commit introduces a new Main boolean flag that marks is as invalid.
Higher-level file reading code does checks on this flag to abort reading
process if needed.
This is an implementation of the #105083 design task.
Given the extense of the change, I do not think this should be
considered for 3.5 and previous LTS releases.
GPUBatch.draw supports basic drawing methods. Although all
supported GPU backends support range based and instance based drawing.
This patch adds 2 methods to GPUBatch to add support to range based and
instance based drawing.
my_batch.draw_range(my_shader, elem_start=10, elem_count=5)
Will draw my_batch using my_shader. From the attached index buffer
elements 10-14 will be drawn.
my_batch.draw_instance_range(my_shader, instance_start=0, instance_count=10)
will draw my_batch using my_shader 10 times. Inside the vertex
shader the current instance number is held by gl_InstanceID.
Pull Request #104457
1. Changes the subdivision function to not fill in time but add 0 to fix bug #104824
2. Fixes a bug in sanitization function noticed while fixing this bug.
Pull Request #105306
Add a hash for faster look-ups on collection->gobject,
This avoids a full list lookup for every object added via Python's
CollectionObject.link as well as linking via BKE_collection_object_add_*
functions.
While the speedup is non-linear, linking & unlinking 100k objects from
Python is about 50x faster. Although unlinking all objects in order
(a best-case for linked lists) is approximately the same speed.
Ref !104553.
Update the style of the Python Console banner to "INFO" instead of
"OUTPUT".
This change makes it easier to difference user generated output from the
initial banner text.
This also has an advantage that "Copy as Script" excludes the banner.
Ref !105188.
Rewrite the logic to depend less on local variables and prefer spans
and indices over points and pointer arithmetic. Also make use of the
IndexRange type for some basic logic, correct the mesh that the
sharp edge layer was chosen from, and reduce variable scope.
The material indices from the caps were only copied if the base mesh had
a material index attribute. Fix that by copying them manually if the cap
has the attribute.
Search list's region is having its size members (winx and winy) set
to values that are one pixel too small. This causes text to look bad
as they are slightly off their pixel alignment.
See #105308 for more details and an illustration of the issue.
Pull Request #105308
Nodes are sorted based on the selection. In some cases (even depending
on processor speed, nodes can be selected and reordered, and another
operation can run before the next redraw). That gives a window where
operators mapped to the same input as selection can run with invalid
socket locations (which aren't updated after the nodes are reordered,
since they are stored in a separate array).
To fix this, move the socket locations from the node editor runtime
data to the node tree, tag them as invalid when the nodes are
reordered, and check for that status in a few more places.
A better longer term solution is not reordering nodes based on
UI status and instead storing the UI drawing order separately.
Pull Request #104420
Add check to WM_check for lack of wmWindowManager->winactive. Sets it
if there is a window and makes that one wmWindow->active as well.
Pull Request #105225
This patch fixes hanging unit tests when MetalRT is enabled. It simplifies and fixes the kernel selection logic by baking the MetalRT-specific options into `kernels_md5` rather than expanding out and testing MetalRT bit flags explicitly.
Pull Request #105270
This was backported from tmp-vulkan. When disabling the fence check
in ghost it is able to start blender. It will show a black screen
so not usable for users.
- make_update.external_script_add_origin_if_needed
returned None or an empty string. As neither where checked simply
return None.
- git_get_remote_url had an incorrect annotation.
Names such as `dummyult` and `dummyet` didn't read very well,
underscore separate these names.
Also rename some variables that used old conventions which missed
being updated (`mpr` for manipulator instead of `gz` for gizmo).
When an RNA type was registered, any existing dynamic types with the
same name were unregistered. This didn't account for built-in types
which cannot be unregistered in (most cases) allowing duplicate
operators for e.g. to be registered with the same name as existing
built-in operators (asserting with debug builds with GHash duplicates).
In practice the newly registered operator would be called unless
adding operators caused the GHash to be resized which could cause the
original operator to be used.
As registered RNA type identifiers are meant to be unique, don't allow
duplicate names in the first place. Now all dynamically registerable
RNA types prevent this situation, raising an error when scripts
attempt to register a type with an identifier matching the name of a
type that could not be removed.
Shortened in [0], increase to 1024 with the following changes:
- Use BKE_ST_MAXNAME for translation_context.
- Use OP_MAX_TYPENAME for wmOperatorType.name.
Both these limits were already used elsewhere but happened to use
RNA_DYN_DESCR_MAX (incorrectly).
[0]: f403d9a2b1
Consistent with naming from 1af62cb3bf. Keep the "coord"
naming in the "vert_coords_alloc" set of functions since they should be
removed (see #103789).
Caused by 96abaae9ac. Just keep the old argument
in the `_ex` version of the function for now. It can be removed
when the explode modifier is removed in 4.0.
Previously [D16255](https://developer.blender.org/D16255)
There is no option to adjust the edge_width like there is in the preferences for vertex_size and face_dot_size.
I only added the option for 3DView and UV/Image Editor, and limited both to a max size of 5 pixel, since the edges do not look very nice with too high values.
In the UV Editor only, there are always black outlines on the edges, I could not find a way to reduce the increasing thickness of these black outlines.
The default edge_width of 1 pixel:

Here the edge_width with a falue of 3:

And here the visible increase of the dark border of the edges and their overlap (even at the maxed size of 5):

Lastly for the 3DView the max edge_width of 5 looks like this:

Pull Request #104741
When there are no loose edges, the loose edge bitmap shouldn't be used.
That was already documented in the loose edge storage struct, but the
bit vector wasn't actually cleared.
Share the bounds cache across the input and output meshes of some
mesh operations that don't change the min and max positions: simple
subdivision, edge/face deletion, and triangulation. If the source mesh's
bounds are computed, or if the mesh is persistent, this can save
recalculation of the bounding box, which takes a few milliseconds
for large meshes.
No behavior change intended.
Many file drag & drop handlers used the icon assigned for dragging to
determine what type of data is dragged. This is fragile, for example
changing an icon would break drag & drop (!). This happened a few times,
e.g. see 3788003cda. It's also causing problems with #104830, which
changes how file browser drag data is handled.
Instead use the file extension to determine the file type.
Exiting curves edit mode (going to object mode) would not update the
screen.
The fix adds a case to `ED_object_editmode_load_free_ex` for CURVES
to make sure the function returns properly. This then correctly adds the
notifier in `ED_object_editmode_exit_ex` to update the screen.
Pull Request #105252
- "Value" in the sense of color lightness is not the same word in
Japanese as other usages. See #105113.
- "Double" as a data type vs. a value.
Also extract "Custom Color Presets" in the tracking UI.
Run clang-format as well.
Pull Request #105187
This adds some simple null checks to avoid the crash. It might still
be good to improve the error message, but also does not seem as
important as avoiding the crash. Typically, users should not run into
this issue because the assets are shipped with Blender.
Actually is impossible to filter the Grease Pencil object type in the Outliner because only Meshes, Cameras and Lights are supported. This patch adds the Grease Pencil filter that allows artists to select only this type of objects. This filter is very handy for storyboarding.
Pull Request #104473
When using multiple compositor output nodes, compositing would fail
, showing a completely black output as it doesn't respect the active
node.
This patch will equalize the implementation with the viewer nodes.
Patch created by @OmarEmaraDevFixes: #86836
Pull Request #105235
Due to an error in GPU module we fixed the memory size in the
Vulkan backend. Last week the error has been fixed in the GPU module
so we can remove the temp fixes in the Vulkan backend.
Pull Request #105244
Similar to recent issues with gl_shader_interface,
ShaderInput lists need to be sorted to ensure correct
and efficient uniform lookup by name.
Authored by Apple: Michael Parkin-White
Ref #96261
Pull Request #105239
This commit adds the default .usdz export capability.
The importer already supports usdz so no change is required other than updating the text in menu to match the updated exporter text.
On export, a .usd/a/c file has to be created first, and then converted to .usdz. A weird change of directory is required because of a quirk with the USD conversion to usdz. If an absolute filepath is passed into the `UsdUtilsCreateNewUsdzPackage` function, the usd files inside the usdz archive will have the same directory structure, i.e. if one tries to create a file at `C:\code\BlenderProjects\file.usdz`, when the usdz file is created, inside it will have the structure `\code\BlenderProjects\file.usdc`.
This is counteracted by setting the current working directory to the temporary session directory where both the usdc and usdz files are created, and just passing the file name to `UsdUtilsCreateNewUsdzPackage` without any filepath. Once the usdz file is created it is moved to the intended directory.
There is a separate `UsdUtilsCreateNewARKitUsdzPackage` capability for exporting usdz for iOS devices that will be implemented in a follow up patch as it will require some more small UI changes.
Co-authored-by: Charles Wardlaw (@CharlesWardlaw)
Co-authored-by: Sonny Campbell (@SonnyCampbell_Unity)
Co-authored-by: Bastien Montagne (@mont29)
Pull Request #105185, based on #104556.
Pull Request #105223
While some implementations of `getcwd` may return an allocated string
instead of the given char buffer in some cases, this is not the expected
behavior of the BLI wrapper. Not to mention the danger of returning a
pointer to a static char buffer...
Improve `ChangeWorkingDirectoryTest` to be more 'full check' regarding
behavior of both `BLI_current_working_dir` and `BLI_change_working_dir`.
Also move call to `BLI_threadapi_init` into proper `SetUp` method (to
have correct symmetry with the call to `BLI_threadapi_exit` in the
`TearDown` one).
Based on investigation by Charles Wardlaw (@CharlesWardlaw).
Pull Request #105220
Add `BLI_change_working_dir(path)` to change the current working directory.
This change is required for adding USDZ support to Blender. When exporting to that format, we are required to do a weird change of directory because of a quirk with the USD library's USDZ functionality. If an absolute filepath is passed into the `UsdUtilsCreateNewUsdzPackage` function, the USDZ archive will store that full path.
macOS uses `NSFileManager` through some new Mac-only wrapper functions.
Ref #99807
Pull Request #104525
Apparently `git checkout -t` is only allowed to happen for new branches.
Added a code which checks whether the branch already exists and it so
uses the `git checkout <branch>`.
Pull Request #105234
* Refactored the color filter op to have an ->exec callback.
* Added nullptr checks to the filter cache API to support
running outside of a view3d context.
* Redo panel displays the active filter type's name in the
header.
To improve mesh upload speeds and reduce the size of the scene data which allows larger scenes to be rendered.
The meshes in Cycles are currently stored as flattened meshes, where each triangle is stored as a set of 3 vertices. Unflattening writes out the vertices in a list according to the index buffer. This uses a lot of memory and for current hardware does not provide a noticeable benefit. This change unflattens the mesh by directly using the meshes vertex and index buffers directly and skips the unflattening. This change allows for larger scenes and also a reduction in the sizes of the meshes. Further it results in a decrease the amount of time it takes to upload the data to a GPU. This is especially important for when multiple GPUs are used in a single machine.
Pull Request #105173
In Edges and Edges & Faces modes, the node copied the positions once
with the other generic attributes and another time specifically just as
the positions. This is now unnecessary since positions are stored as
a generic attribute (1af62cb3bf). In a simple test this saved
2ms out of a total 12 in these modes.
e8f4010611 unified the bounds computation for the new curves
object type and the rest of the curves system used by geometry nodes.
In the process, it made bounds affected by the control point radius.
In theory that makes sense; the bounds are supposed to be the extents
of the visible geometry. But in practice the change wasn't expected,
for a few reasons:
- The radius has never affected the bounds for the legacy curve type
- The default radius of legacy curve objects is absurdly large at 1.0m
- Only the new curve object has visible radius, and only in "strip"
mode or when rendering with Cycles
Currently the bounds are only used for the "Bounding Box" geometry node
and the panel in the 3D viewport sidebar, so there isn't any incentive
to choose less intuitive behavior yet.
Long term, the correct behavior is probably to include the radius in
the bounds, but this commit postpones that change to when it works
better with the rest of the curves system.
Pull Request #105154
Writing to a bitmap from multiple threads causes races when writing to
bits within the same integer. Instead, write to a separate boolean
array while subdividing, then move that to the final mesh bit vector.
Notes:
- The final copy to the bit vector could be replaced by a generic
`copy_from(Span<bool>)` call in the future.
- Theoretically we could entirely replace the `BitVector` with an
`Array<bool>`, but 1/8 the memory use for edges is likely worth it.
Pull Request #105156
The initial subdivision context counting ended up using unnecessarily
complicated logic to count the number of final vertices. In a first pass
it added vertices for every coarse edge. Then it added the same number
of vertices for every loose edge. That adds up to the same number of
vertices for the edges, so the separation is redundant and can be
replaced with a single multiplication.
The bitmap doesn't need to be cleared then, since it isn't used now.
In a test of a mesh with 2 million faces and 3 million vertices, this
saved 2.8ms (though the whole subdivision process takes around 700ms).
Pull Request #105159
This commit adds the default .usdz export capability.
The importer already supports usdz so no change is required other than updating the text in menu to match the updated exporter text.
On export, a .usd/a/c file has to be created first, and then converted to .usdz. A weird change of directory is required because of a quirk with the USD conversion to usdz. If an absolute filepath is passed into the `UsdUtilsCreateNewUsdzPackage` function, the usd files inside the usdz archive will have the same directory structure, i.e. if one tries to create a file at `C:\code\BlenderProjects\file.usdz`, when the usdz file is created, inside it will have the structure `\code\BlenderProjects\file.usdc`.
This is counteracted by setting the current working directory to the temporary session directory where both the usdc and usdz files are created, and just passing the file name to `UsdUtilsCreateNewUsdzPackage` without any filepath. Once the usdz file is created it is moved to the intended directory.
There is a separate `UsdUtilsCreateNewARKitUsdzPackage` capability for exporting usdz for iOS devices that will be implemented in a follow up patch as it will require some more small UI changes.
Co-authored-by: Charles Wardlaw (@CharlesWardlaw)
Co-authored-by: Sonny Campbell (@SonnyCampbell_Unity)
Co-authored-by: Bastien Montagne (@mont29)
Pull Request #105185, based on #104556.
While some implementations of `getcwd` may return an allocated string
instead of the given char buffer in some cases, this is not the expected
behavior of the BLI wrapper. Not to mention the danger of returning a
pointer to a static char buffer...
Improve `ChangeWorkingDirectoryTest` to be more 'full check' regarding
behavior of both `BLI_current_working_dir` and `BLI_change_working_dir`.
Also move call to `BLI_threadapi_init` into proper `SetUp` method (to
have correct symmetry with the call to `BLI_threadapi_exit` in the
`TearDown` one).
Based on investigation by Charles Wardlaw (@CharlesWardlaw).
Pull Request #105220
GPencil 3D stroke rendering uses a geometry shader.
This is unsupported by the Metal backend, so implement
fix for this failing compilation by shifting geometry shader
logic into the Vertex shader for Metal backend.
Authored by Apple: Michael Parkin-White
Ref #96261
Pull Request #105143
Metal LineLoop emulation path does not correctly apply
when using SSBO vertex fetch mode alongside 3D line
rendering.
Patch moves line emulation above SSBO
vertex fetch setup to ensure the correct emulation
parameters are passed to the shader.
Authored by Apple: Michael Parkin-White
Ref #96261
Pull Request #105142
Resolves issue with nearest filtering on UI Icons. Note that as
Metal does not support LOD bias as a parameter on a sampler
object, the original code has been modified to perform LOD
biasing at the shader level.
As GPU_SAMPLER_ICON is not widely used, it is more
efficient to apply directly to the affected shaders, rather
than workaround passing in the sampler LOD bias as a
separate value e.g. uniform or push constant.
Original PR feedback addressed to also refactor ICON
shaders to use consistent style for single and multi
Icon rendering.
Authored by Apple: Michael Parkin-White
Ref #96261
Pull Request #105145
This remove default casses from the `switch` statements to catch where
the missing cases are.
Uncomment unimplemented cases for the sake of completeness. Improving the
overall API.
This make the format conversion lists exhaustive and documented.
This replace `validate_data_format_mtl` by the common version as they
don't differ at all now.
After 7eda9d8dda, crash occurs when operation search is called and no
active tree element is present. Add missing null check in new poll
function to fix the crash.
Pull Request #105004
For every other texture types this is expected to be implicitly
`GPU_DATA_FLOAT`. There is only one case where this is not the case.
I believe this was previously needed because the data type was
conditionning the texture creation. This is not the case anymore.
Zero-sized gizmos were not shown because GPU does not draw filled
triangles with zero area. This problem is resolved by drawing lines or
points in these degenerated cases.
Scaling is supported via computing the original and the new size, then
treat the case with zero original size separately, instead of only
computing the scale itself.
Actually applies to all `cage2d` gizmos, but not compatible when
translate flag is set.
After 49ad91b5ab, an extra visibility
toggle is being drawn for grease pencil layer in dopesheet. In this PR,
a condition is added to skip drawing of visibility toggle for GPencil
layer. Also, Grease pencil does not support pinning so restore the offset
added to channel for drawing the pin icon.
Pull Request #105080
This is a workaround for [issue #104087](blender/blender#104087). We encounter crashes when using shader binary archives on AMD, so this disables them while we investigate a proper fix. Kernels will still be cached automatically by the OS file system cache. This cache may occasionally be purged due to external factors, in which case kernels will get compiled again.
Pull Request #105186
If repository has multiple remotes with the same name of branch
checking out to the branch using simple `git checkout branch` exists
with an error: this is because there is ambiguity w.r.t which remote
to track.
Now the code explicitly provides remote to track, preferring to use
"origin" first (which is to be used for Blender style of workflow,
and Github style workflow when there is a fork available), and use
"upstream" if there is no origin.
Pull Request #105176
The preset names were translated before building the UI. This meant
that the translated name was passed to the operator responsible for
deleting the preset file, instead of the original name.
Pull Request #105155
The preset names were translated before building the UI. This meant
that the translated name was passed to the operator responsible for
deleting the preset file, instead of the original name.
Pull Request #105155
This was actually caused by two problems. The first is that the
code actually deliberately detects if nothing happened and pushed
an undo step, a bugfix for a problem that no longer exists.
The second was that SCULPT_test_location sometimes does a closest
point search instead of ray casting and didn't check the result
against the brush radius.
This might've been a merge error, the result of color mixing
was being overwritten by a simple copy of source to destination
inside of layerCopyValue_propcol.
Revert #104679. We are just too used to the old behavior, especially
the incorrect vertical clipping. Some uses rely on setting the min and
max of the clipping rect the same. Will have to revisit this later
to only correct for horizontal positioning for full hinting.
Pull Request #105157
Own Code.
In 6514bb05ea I misinterpreted the function's intended
behavior when there was already an existing active layer. The data from
the active layer is just meat to be copied, the function should always
add a new attribute.
Blender currently has 2 algorithms for merging vertices:
- `BKE_mesh_merge_verts`;
- `blender::geometry::create_merged_mesh`
`BKE_mesh_merge_verts` has a simplified algorithm to work with Array,
Mirror and Screw modifiers. It doesn't support merge results that would
create new faces. However it has shortcuts to be more efficient in
these modifiers.
`blender::geometry::create_merged_mesh` tries to predict all possible
outcomes. So it's a more complex. But it loses in performance to
`BKE_mesh_merge_verts` in some cases.
The performance comparison between these two depends on many factors.
`blender::geometry::create_merged_mesh` works with a context that has
only the affected geometry. Thus a smaller region of the mesh is read
for duplicate checking. Therefore, the smaller the affected geometry,
the more efficient the operation.
By my tests `blender::geometry::create_merged_mesh` beats
`BKE_mesh_merge_verts` when less than 20% of the geometry is affected
in worst case `MESH_MERGE_VERTS_DUMP_IF_EQUAL` or 17% in case of
`MESH_MERGE_VERTS_DUMP_IF_MAPPED` .
For cases where the entire geometry is affected, a 30% loss was noticed,
largely due to the creation of a context that represents the entire mesh.
Co-authored-by: Germano Cavalcante <germano.costa@ig.com.br>
Pull Request #105136
When using the frame channel operators from #104523
the framing would fail under the following circumstance.
* In the graph editor
* Using normalized view
* with a curve that has a y-extent of less than the focus threshold of 0.01
The issue was the the clamping code was
before the normalization multiplication.
Pull Request #105121
When using the "Frame Channel" operator in the Dope Sheet
the view would always go back to the top.
Fix it by copying the y bounds when in the Dope Sheet.
Pull Request #105123
Using spans instead of raw pointers helps to differentiate ararys from
pointers to single elements, gives bounds checking in debug builds, and
conveniently stores the number of elements in the same variable.
Also make variable naming consistent. For example, use `loops` instead
of `mloop`. The plural helps to clarify that the variable is an array.
I didn't change positions because there is a type mismatch between
C and C++ code that is ugly to manage. All remaining code can be
converted to C++, then that change will be simpler.
Pull Request #105138
This code seems to be left over from before edges, polys, and loops were
stored in CustomData. They are already copied by the CustomData copy
calls directly above, which already deal with every other layer.
Resolving builtin uniforms and uniform blocks when creating
shader interface. This maps builtin uniforms to uniforms
defined by the shader. Works the same as the OpenGL
builtin uniforms.
Pull Request #105128
When using ShaderCreateInfo with builtin uniform(blocks) there are
cases where the current implementation could not find an existing
block. The reason is that it uses name matching and name matching
requires that the shader inputs are sorted based on the name hash.
This change fixes this by first for the sorting of the shader
inputs before resolving the builtins.
Pull Request #105127
Cycles fallback display shader previously did not use viewport.
This would crash or cause the display not to show when using
GPU backends other than OpenGL, if another display shader
was unavailable.
Now use ShaderCreateInfo for Cycles fallback display.
Authored by Apple: Michael Parkin-White
Ref #96261
Pull Request #104987
This patch will give access to the physical device limits
of the device associated with the context. In vulkan each
device has different limits and the application is
responsible to match these limits as the vulkan driver
just ignores calls that don't match these limits.
Those limits are GPUBackend specific and therefore are not
added to GPU_capabilities.
Pull Request #105125
If the resolution attribute exists, it needs to be set to a non-zero
value for the newly added curves. While it might also make sense
to interpolate the value from neighbor curves, for now it's
simplest to just set it to the default value of 12.
Pull Request #105094
In curves edit mode, the "Move Texture Space" and "Scale Texture Space"
operators where shown in the "Curves > Transform" menu.
Since these are not implemented, the fix removes these operators
from the menu.
The code below has to handle the case when `sample_length` is greater
or equal to the total length already anyway, so we can just make that
a valid input. Currently, the snake hook brush for curves also makes
use of passing in larger sample lengths which current results in crashes
in debug builds.
When trying to rotate in curves edit mode using proportional editing
and connected only mode, Blender would crash.
This was because the `TransData` structs for disconnected elements
did not have the location field populated, resulting in a null pointer
access.
The fix skips these elements entirely using `TD_SKIP`.
This fixes issue [#105100](blender/blender#105100) where multi-pass renders can be incorrect due to kernels using stale specialisation constants (e.g. when rendering Pokedstudio).
This patch adds a new group of md5 hashes (`global_defines_md5`) to track whether the injected block of #defines is stale and regenerate the source string as appropriate. It also renames the existing group of md5 hashes from `source_md5` to `kernels_md5` to clarify that these refer to a specific kernel set rather than just the source (which might build an arbitrarily large number of kernel sets).
Pull Request #105103
The translation contexts module wasn't imported after c7611d61e8,
which caused an error and prevented some constraints' UI from being
displayed.
Pull Request #105095
Extend the `GRAPH_OT_paste` operator with an enum to define the value offset.
Options are:
| Option | Effect |
| ------------------- | ----------------------------------------------------------------------------- |
| No Offset | use the same key values as the copied keys |
| Cursor Value | align the leftmost key with the cursor value |
| Current Frame Value | Evaluate the curve under the cursor align the leftmost key with it |
| Right Key | Align the rightmost key with the first key that is to the right of the cursor |
| Left Key | Align the leftmost key with the first key that is to the left of the cursor |
Pull Request #104512
Before that patch, the slider operators for the Graph Editor are not easily accessible since they don't have a hotkey.
This adds the "d" hotkey for the already existing slider operator menu.
Using the popup menu means that your last used operator will always be under the cursor, so it's quick to access.
Pull Request #104530
This might've been a merge error, the result of color mixing
was being overwritten by a simple copy of source to destination
inside of layerCopyValue_propcol.
When implementing the operator to select linked vertices in weight paint mode, the new `AtomicDisjointSet` was used.
In order to keep the code consistent, and also prepare it to add things like Extending/Shrinking selection, the select linked faces logic was also updated.
It now also makes use of the `AtomicDisjointSet` by connecting all edges of each poly. In order to find connecting Faces you then have to check if edges of that poly share a connection.
Pull Request #104577
The stoke shader of grease pencil uses a geometry shader stage. Apple
devices don't support shaders with geometry shader stage. In the
OpenGL driver there was a pass-through implemented so it didn't fail.
When using the metal backend this needs to be solved more explicitly.
This change patches the grease pencil shader to support both the
backends supporting a geometry stage and those without.
Fixes#105059
Pull Request #105116
This was actually caused by two problems. The first is that the
code actually deliberately detects if nothing happened and pushed
an undo step, a bugfix for a problem that no longer exists.
The second was that SCULPT_test_location sometimes does a closest
point search instead of ray casting and didn't check the result
against the brush radius.
Complex EEVEE nodegraphs, particularly those combining
multiple principledBSDF shader nodes have a tendancy
to require a large number of simultaneous live registers
due to function call depth. In some instances, this
causes substantial performance drop and corruption if
the stack gets too large.
To mitigate this, splitting calls to closure_eval such
that only a single individual closure is evaluated in each
call reduces the number of live registers required. This
is preferred over using compound closure evaluation
functions which require a large amount of in-flight data.
Note that this is generally not more optimal, if the stack
does not spill, as there is an increased instruction count.
The specific trade-off depends on the exact architecture
in question. Hence, this is limited to AMD GPUs.
Authored by Apple: Michael Parkin-White
Ref #96261
Pull Request #104985
On the Windows platform, raise windows and give them focus as the mouse
hovers over them. This allows keyboard shortcuts for the area under the
mouse without having to click the window caption to make them active.
Pull Request #104681
66dda2b902 made an incorrect change to account for the special
case for NURBS. Instead, make the step that turns the lengths into
parameters more explicit, and pass the correct total length for each
curve, even in the cyclic case.
Pull Request #105079
This resulted in disappearing NURBS curves when joining them with other
curve types in some cases. The attribute has to be handles similarly to
the radius and resolution attributes rather than as simple generic data.
The attribute was retrieved when converting to Bezier curves when it
wasn't necessary. Instead copy it like a regular attribute if any of the
result curves are NURBS. Also fix a check for an empty span for the
attribute which was never false.
Invalid node trees (e.g. when nodes are linked in a cycle) can not be
evaluated and the viewer is not available in them. This commit just adds
some null checks to handle this case more gracefully.
Expose the color selector on each item in the list, so it's easier to see
at a glance the Bone Groups color theme and change it.
Also avoids having color widgets grayed out when not in Custom Colors mode.
Pull Request #105036
This is refering to drag & drop within Blender which is using the
drop-box system.
Previously Escape would cancel the dragging, but still pass on the event
to other event handlers, which could trigger other behavior. For example
cancelling dragging a file in a file browser dialog would also cancel
the file browser operation and close the window. Right-click didn't
cancel anything even though we usually use both Escape and right-click
as a way to cancel the operation.
Now both escape and right-click both cancel the dragging and the event
is not passed on further.
Pull Request: #104838
Do the domain check directly in the field input class to avoid the need
for another function to do it elsewhere. Also move one function to
be closer to a similar one, rename some functions, and avoid the need
for two intermediate span variables.
Erroneous cache warming case where the generated material is
identical to default material and cached shader is re-used,
resulting in case where the parent shader is identical to the
source.
Authored by Apple: Michael Parkin-White
Ref #96261
Originally caused by 6514bb05ea
More cases where the active/default color attributes were not set
correctly:
[1] Using the old Python vertex_colors API (vertex_colors.new)
[2] OBJ importer
[3] Collada importer
[4] Data Transfer layout (both standalone operator and "Generate Data
Layers" from the modifier)
Similar to 101d04f41f.
Brought over from https://archive.blender.org/developer/D16977, see
discussion there why some of the code for data transfer is not for the
genereal attribute API.
Pull Request #105020
Descriptor set locations are now determined in the
VKShaderInterface. Issues with the previous solution:
- Due to legacy code in GPU module the locations/bindings
must be the same. Using one for something else might
result in undesired lookups, incorrect resource
bindings.
- Images/Textures reuses the same namespace, that didn't
work as expected when looking up the resources via
its binding.
This refactoring is required for adding support for
push constants.
Pull Request #105073
This tools allows to change strip playback speed by manipulating
retiming handles. More handles can be added to single strip to create
variable playback speed.
This tool replaces Speed Factor property in time panel, with exception
of sound strips. Support for sound strips is still in review.
Pull Request #104523
Drawing code `paint_draw_smooth_cursor` would be called correctly, it
was just the color not being initialized.
This is usually done with `BKE_paint_init`, but in the case of curves
sculpting brushes this would create an additional (unnamed) brush which
should be avoided since the workspace toolsystem creates the "right"
brush anyways.
So this patch just does the minimal work to get the Stabilize Stroke
indicator line to draw (which is initializing the color).
Brought over from https://archive.blender.org/developer/D16793
(cherry picked from commit 612a4382c443bcd02e0bb5ffd1b1fdbb251f6e7b)
Pull Request #105021
Arrays for curve handle types were allocated even when there were no
Bezier curves. This saves 0.5ms of the total 0.9ms spent creating the
evaluated curve offsets, which happens every time the topology
of non-poly curves change.
Revert of commits that allowed non-temp Blender windows to be saved
and restored that spanned multiple monitors on the Windows platform.
This causes problems with temp windows (like Preferences & Render) that
cannot currently be fixed.
See 104956 for much more details.
This change is being redone after it was accidentally reverted.
Differential Revision: blender/blender#104956
Reviewed by Ray Molenkamp
msgfmt has a TBB dependency though bf_blenlib, now for a release build
The MSVC linker is smart enough to realize none of the TBB code is
actually used and discards it. In debug mode the linker is a bit more
conservative and doesn't, leaving msgfmt with a runtime dependency
on TBB. The problem here is, we only copy the runtime dlls during
the install phase, and msgfmt runs long long before that.
For this reason when we run msgfmt we should make sure any runtime
needs it could have are met in the path, there already is a handy
variable for that since oslc has similar requirements.
Pull Request #105048
Add mouse hover highlighting for items in UILists, in both list mode
and preview tile mode.
See 104677 for more details
Differential Revision: blender/blender#104677
Reviewed by Brecht Van Lommel
Write RNA properties backed by IDProperties with the `IDP_INT` type like
before ef68a37e5d. That keeps forward compatibility, because
earlier versions don't support the boolean type. At some point in a future
release we can remove the forward compatibility. 4.0 is a good time to
do that because forward compatibility will be broken in other ways.
This commit also adds support for reading integer arrays for boolean
property defaults, which was only half-way supported before.
Pull Request #104995
The light tree itself is disabled on the AMD GPUs due to a compiler issue.
There are couple of places where this was not fully checked:
- The `light_sample` function in the kernel.
- The light threshold during synchronization
The former one is solved as easy as just adding an ifdef block.
The latter one is solved by delaying the threshold assignment for
later on.
Pull Request #105022
This commit implements described in the #104573.
The goal is to fix the confusion of the submodule hashes change, which are not
ideal for any of the supported git-module configuration (they are either always
visible causing confusion, or silently staged and committed, also causing
confusion).
This commit replaces submodules with a checkout of addons and addons_contrib,
covered by the .gitignore, and locale and developer tools are moved to the
main repository.
This also changes the paths:
- /release/scripts are moved to the /scripts
- /source/tools are moved to the /tools
- /release/datafiles/locale is moved to /locale
This is done to avoid conflicts when using bisect, and also allow buildbot to
automatically "recover" wgen building older or newer branches/patches.
Running `make update` will initialize the local checkout to the changed
repository configuration.
Another aspect of the change is that the make update will support Github style
of remote organization (origin remote pointing to thy fork, upstream remote
pointing to the upstream blender/blender.git).
Pull Request #104755
This patch adds initial support for compute shaders to
the vulkan backend. As the development is oriented to the test-
cases we have the implementation is limited to what is used there.
It has been validated that with this patch that the following test
cases are running as expected
- `GPUVulkanTest.gpu_shader_compute_vbo`
- `GPUVulkanTest.gpu_shader_compute_ibo`
- `GPUVulkanTest.gpu_shader_compute_ssbo`
- `GPUVulkanTest.gpu_storage_buffer_create_update_read`
- `GPUVulkanTest.gpu_shader_compute_2d`
This patch includes:
- Allocating VkBuffer on device.
- Uploading data from CPU to VkBuffer.
- Binding VkBuffer as SSBO to a compute shader.
- Execute compute shader and altering VkBuffer.
- Download the VkBuffer to CPU ram.
- Validate that it worked.
- Use device only vertex buffer as SSBO
- Use device only index buffer as SSBO
- Use device only image buffers
GHOST API has been changed as the original design was created before
we even had support for compute shaders in blender. The function
`GHOST_getVulkanBackbuffer` has been separated to retrieve the command
buffer without a backbuffer (`GHOST_getVulkanCommandBuffer`). In order
to do correct command buffer processing we needed access to the queue
owned by GHOST. This is returned as part of the `GHOST_getVulkanHandles`
function.
Open topics (not considered part of this patch)
- Memory barriers & command buffer encoding
- Indirect compute dispatching
- Rest of the test cases
- Data conversions when requested data format is different than on device.
- GPUVulkanTest.gpu_shader_compute_1d is supported on AMD devices.
NVIDIA doesn't seem to support 1d textures.
Pull-request: #104518
Contributed by Yulia Kuznetcova at Apple.
NanoVDB is patched to give add address spaces required by Metal. We hope that
in the future Metal will support the generic address space.
For AMD and Intel this is currently not available since it causes a performance
regression also on scenes without volumes.
Pull Request #104837
Alternatively this could use `ASSET_LIBRARY_ALL` like
`add_node_search.cc`, but then it would need a different
method for skipping duplicate local assets.
Mandatory change for the Brush Assets project, from quick test does not
seem to break anything (more) in existing 'old' brushes...
Re. #101908.
Pull Request #105016
This adds support for cursor snapping for the new curves object.
It implements a function `transverts_from_curves_positions_create` (to separate the logic from the `Curves` object type). That function is then C wrapped by `ED_curves_transverts_create` and finally used in `ED_transverts_create_from_obedit`.
Pull Request #104967
Fixes the `-Winconsistent-missing-override` warning.
In theory the `virtual` is redundant in such case, but this is how
it is done in may other areas of USD code.
Pull Request #104977
Previously when markers were used, the newly introduced clamping code (#104516) would stop the last channel from being shown.
This patch fixes that by modifying the `v2d->tot.ymin` calculation.
This is a bit counterintuitive since the `v2d->tot` height is calculated in `action_draw.c`. But the advantage of doing it there is that it also works for the channels region.
Pull Request #104892
This does 2 things to address the ARM64 failures:
- Increases the threshold to be inline with what Cycles uses
- Disables the 2 problematic WebP variations (#105006 will track)
This adds saving and loading tests for our supported image formats.
**Saving - bf_imbuf_save.py**
There are 2 template images which are loaded anew for each file save
attempt. One is an 8-bit RGBA image and the other 32-bit. This is
required as many formats use a variety of factors to determine which of
`ibuf->rect` or `ibuf->rectfloat` to use for processing. The templates
are constructed to have alpha transparency as well as values > 1 (or
clamped to 1 for the case of the 8-bit template).
Test flow:
- Load in an appropriate template image
- Save it to the desired format with the desired set of options
- Compare against the reference image
Notes:
- 98 references are used totaling ~3.6MB
- 10-12 second test runtime
- Templates can be reconstructed with the create-templates.blend file
**Loading - bf_imbuf_load.py**
Test flow:
- Load in each of the reference images
- Save them back out as .exr
- Save additional metadata to a secondary file (alpha mode, colorspace etc)
- Compare the saved out .exr with another set of reference .exrs
- Compare the saved out file metadata with set of reference metadata
Notes:
- 98 exr references are used totaling ~10MB
- 10-12 second test runtime as well
A HTML report is not implemented. The diff output organization is very
similar to the other tests so it should be somewhat easy to do in the
future if we want.
The standard set of environment variables are implemented for both:
BLENDER_TEST_UPDATE, BLENDER_VERBOSE, and BLENDER_TEST_COLOR
Pull Request #104442
Added new function sculpt_mesh_filter_cancel in sculpt_filter_mesh.cc
for cancelling mesh filters. It currently is unused pending a
revamped modal map for mesh filter (see pull req 104718).
In the outliner, the icons for modifiers are tinted blue. This didn't
work for the geometry nodes modifier icon.
Defining the icon with the macro `DEF_ICON_MODIFIER` also
defines the appropriate theme color so it's now tinted blue
when drawn in the outliner like the other modifier icons.
Pull Request #104957
Add a per node type callback for creating node add search operations,
similar to the way link drag search is implemented (11be151d58).
Currently the searchable strings have to be separate items in the list.
In a separate step, we can look into adding invisible searchable text
to search items if that's still necessary.
Resolves#102118
Pull Request #104794
Add `BLI_change_working_dir(path)` to change the current working directory.
This change is required for adding USDZ support to Blender. When exporting to that format, we are required to do a weird change of directory because of a quirk with the USD library's USDZ functionality. If an absolute filepath is passed into the `UsdUtilsCreateNewUsdzPackage` function, the USDZ archive will store that full path.
macOS uses `NSFileManager` through some new Mac-only wrapper functions.
Ref #99807
Pull Request #104525
The check was triggering the 'this' pointer cannot be null in
well-defined C++ code
We do not check for this pointer in any other areas. If it is
needed due to possible opaque pointer cast to the check prior
to the cast.
Pull Request #104974
That way the `matrix_base` doesn't need to depend on the axis
simplifying the code.
This also fixes an issue in plane scaling gizmos with non-orthogonal
matrix.
After rBdb87e2a638f9, two contexts were missing:
- VirtualReality, to be used in an add-on
- Constraint, used in the constraints UI
The latter was actually used without being added, which caused errors.
It was reverted in rB31a640027982.
The operator's description used a format string like:
```
BLI_sprintfN(TIP_("%s %s vertex groups of the active object"),
action_str, target_str)
```
which is almost guaranteed to be impossible to properly localize to
some languages -- I know there are a couple of issues for French
already.
So instead of hoping formatting works, write all possible strings
explicitly, even if it looks stupidly verbose.
Simplify modifier sample mode didn't transfer UV parameters, now fixed.
(This is the corrected commit, previous one has multiple other commits merged.)
Pull Request #104964
This reverts commit 19222627c6.
Something went wrong here, seems like this commit merged the main branch
into the release branch, which should never be done.
Currently Metal is more stable then the OpenGL backend on apple
devices. Also the Metal backend supports more features then the
OpenGL backend. For example the viewport compositor and rendering
of production files.
This has been validated with users and studios.
This patch will default to the Metal backend when starting
Blender 3.5 for the first time or when loading factory startup. It
is still possible to switch to OpenGL via the user preferences.
It will not automatically select the Metal backend when there is
already user preferences available for Blender 3.5.
No design or functional changes. Just rename the layers for the last
two icons that were added so that they follow the naming pattern.
Also, update the layer order for another icon (was not alphabetic).
Pull Request #104954
This is a missing part of the Metal backend. Metal backend doesn't
support the bgl commands, but it was not possible to use the gpu
module to use scissor testing.
Without this change addon developers would not be able to migrate
their addons to support the Metal backend.
This patch adds:
- `gpu.state.scissor_set`
- `gpu.state.scissor_get`
- `gpu.state.scissor_test_set`
Fix#104911
Texture clamping is by default off, but for VDM textures this leads
to several artifacts.
- Clamping is done when the image is sampled and when the brush strenght
is applied.
- VDM textures have negative values that are lost due to clamping
when clamping during sampling.
This patch fixes this by changing the default clamping of newly
created textures to not clamp anymore.
Textures are mostly being used by sculpt brushes, where clamping is also
implemented on brush level.
Fix#104747
Revert of commits that allowed non-temp Blender windows to be saved
and restored that spanned multiple monitors on the Windows platform.
This causes problems with temp windows (like Preferences & Render) that
cannot currently be fixed.
See 104956 for much more detail
Differential Revision: blender/blender#104956
Reviewed by Ray Molenkamp
Regression in [0] which caused interacting with 2D gizmos not to
update 3D gizmos once the gizmo finished it's modal interaction.
This caused the cameras lens gizmo not to update when navigating using
the viewport navigation buttons.
Resolve by detecting this case and flagging other draw steps to be
updated.
[0]: fb27a9bb98
Caused by 25237d2625, when the new "template" mesh created
in the modifier started to use the proper default value for CD_ORIGINDEX
layers rather than just zero. Zero isn't correct because it refers to
the first element, not "no element". For that we need to remove the
original index mapping arrays completely. There is some gray area
about whether that is allowed too, but it's best here to just keep the
old behavior working for now.
Add the `CD_ORIGINDEX` layer to the columns potentially displayed
with the Blender debug value of 4001 from the debug menu. Also
separate the debug columns to separate functions.
In the first loop is safe to remove the current element.
The second loop can remove any element, potentially the next.
This triggers a read after freed.
Pull Request #104897
When the new UV to legacy format conversion happens, the mesh is in
the middle of being written and is an at best "complicated", at worst
invalid state. The attribute API looks at other domains and is a bit
less forgiving in that respect, and shouldn't really be used here. Use
the CustomData API instead. Also sort the layers the same way as
b642dc7bc7.
Note that the node group has its sockets names translated, while the
built-in nodes don't. So we need to use data_ for the built-in nodes
names, and the sockets of the created node groups.
Pull Request #104889
This reverts commit 68181c2560.
I merged 3.6 into 3.5 by mistake. Basically I had a PR against main,
then changed it in the last minute to be against 3.5 via the
web-interface unaware that I shouldn't do it without updating the
patch.
Original Pull Request: #104889
Note that the node group has its sockets names
translated, while the built-in nodes don't.
So we need to use data_ for the built-in nodes names,
and the sockets of the created node groups.
Pull Request #104889
When animating it is often useful to frame the Graph Editor/Dope Sheet to whatever frames are in a given channel.
This patch adds the option to frame on selected channels OR frame on whatever channel is under the cursor.
If a preview range is set it will only focus on keys in that range.
Supports FCurve and keyframe data
Frame to selected is called with
* Right click in the channel section -> Frame Selected Channels
* or in Channel → Frame Selected Channels
* or hitting . on the numpad
Frame to channel under cursor is done with
ALT + Middle Mouse Button
Co-authored-by: Christoph Lendenfeld <chris.lenden@gmail.com>
Pull Request #104523
Finding the documentation for nodes can be time consuming.
By adding the online manual to the right click context menu in the node
editor the user gets easier access to the documentation.
Can also be used by custom nodes add-ons by registering a manual-map.
Pull Request #104833
When updating a mesh, the GPU Subdivision code makes calls to
`GPU_indexbuf_bind_as_ssbo()`.
This may cause the current VAO index buffer to change due to calls from
`glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo_id_)` in
`GPU_indexbuf_bind_as_ssbo()`.
The solution is to unbind the VAO (by calling `glBindVertexArray(0)`)
before creating the index buffer IBO.
Co-authored-by: Germano Cavalcante <grmncv@gmail.com>
Pull Request #104873
Apparently, the 65bit Intel architecture is presented differently
on Linux and Windows.
Allow both variants for the command line, so that semantically the
command line argument can be seen as a lower case platform.machine.
When updating a mesh, the GPU Subdivision code makes calls to
`GPU_indexbuf_bind_as_ssbo()`.
This may cause the current VAO index buffer to change due to calls from
`glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo_id_)` in
`GPU_indexbuf_bind_as_ssbo()`.
The solution is to unbind the VAO (by calling `glBindVertexArray(0)`)
before creating the index buffer IBO.
Co-authored-by: Germano Cavalcante <grmncv@gmail.com>
Pull Request #104873
Possible values are x86_64 and arm64.
Allows to use make_update.py in a cross-compile environment, like
building x86_64 macOS Blender from Apple Silicon machine.
Pull Request #104863
In the Dope Sheet and the Timeline, it was possible to drag the view until the keyframes were completely out of view.
(Important to drag in the region with the keyframes, dragging in the channel box already did clamping)
This patch adds a clamping mechanism matching that of the channel box. That means the last channel will stick to the bottom of the view.
Co-authored-by: Christoph Lendenfeld <chris.lenden@gmail.com>
Pull Request #104516
Fix a crash when using the Euler Filter from the Graph Editor on baked curves.
The crash happened because baked curves have no bezt array.
Skipping any curves where that was missing fixes the issue.
Co-authored-by: Christoph Lendenfeld <chris.lenden@gmail.com>
Pull Request #104858
3.2 and 1.6 where used as rough equivalents to M_PI & M_PI_2, however
this raised questions about the significance of these values.
Running thousands of tests with generated euler inputs I wasn't able to
detect a difference so use M_PI & M_PI_2 instead.
Fix a crash when using the Euler Filter from the Graph Editor on baked curves.
The crash happened because baked curves have no bezt array.
Skipping any curves where that was missing fixes the issue.
Co-authored-by: Christoph Lendenfeld <chris.lenden@gmail.com>
Pull Request #104858
According to the report it is a regression since 3.2, but it is tricky
to pin-point which exact commit caused it.
The root of the issue is that under certain circumstances frame might
be read and processed twice, depending on the order in which panels and
the main area is drawn: the footage information panel skips cache, so
it it is drawn prior to the main area it leads to 2 frame reads. Opening
the Metadata panel triggers code path which forces frame to be put to
the cache, solving the double frame read.
Solution is simple: do not skip cache when acquiring image buffer for
the footage information: the same frame will be needed for the main
area as well.
Pull Request #104860
On a user level there are no expected changes, other than being able
to update submodules and libraries from a main repository at a detached
HEAD situation (which did not work before).
On the infrastructure level of things this moves us closer to ability
to use the main make_update.py for the buildbot update-code stage, and
to remove the update-code section from the pipeline_config.yaml.
The initial idea of switching make_update to the pipeline config did
not really work, causing duplicated work done on blender side and the
buildbot side. Additionally, it is not easy to switch make_update.py
to use pipeline_config.yaml because the YAML parser is not included
into default package of Python.
There will be few more steps of updates to this script before we can
actually clean-up the pipeline_config: the changes needs to be also
applied on the buildbot side to switch it to the actual make_update.
Switching buildbot to the official make_update.py allows to much more
easily apply the submodules change as per #104573.
Having a threshold well above PI would result in discontinuity in some
cases.
The discontinuity can be measured by generating euler values (both
random and interpolated rotations), then comparing the accumulated
difference.
Changing the threshold for wrapping rotations produces at least as good
or more compatible results.
This was reported as #17297 and fixed in [0], however the change was
only applied for the game-engine.
Ref !104856
[0]: ab44742cf3
This was broken even before 0649e63716 and was always expanding the
`Image`, not the movie clip (even if the source was set to
`CAM_BGIMG_SOURCE_MOVIE`)
Now the rule here seems to be to always expand unconditionally, so
remove checking the source and always expand image and movie clip.
Co-authored-by: Philipp Oeser <philipp@blender.org>
Pull Request #104815
* Repeat last operator now works for mesh filters.
* Added an iteration_count property to repeat the filter.
This is especially useful when compounded with the repeat
last operator tool.
* The mouse event history is stored for mesh filters
with more advanced user input (mostly Smooth and Relax
filters).
meson defaults to debug builds [0] unless you tell it differently, this
diff changes the options for
- epoxy
- fribidi
- harfbuzz
- wayland
- wayland_protocols
to be optimized, mesa was already optimized
[0] https://mesonbuild.com/Builtin-options.html#core-options
Pull Request #104802
Passing a `BitSpan` is generally better because then the caller is not
forced to allocate the bits with a `BitVector`. Also, the `BitSpan` can
be stored in the stack, which removes one pointer indirection compared
to accessing bits through a `BitVector &`.
This adds `BitSpan` and `MutableBitSpan`. They work essentially the same as
the normal `Span` and `MutableSpan`, but work on individual bits instead
(the smallest type `Span` can handle is one byte large).
This also splits up `BLI_bit_vector.hh` and introduces two new headers:
`BLI_bit_ref.hh` and `BLI_bit_span.hh`.
The goal here is to make working with dynamically sized bit masks more
convenient. I'm mainly working on this because I might want to use this
in #104629. It can also be used to cleanup function signatures that
currently take a reference to a `BitVector`. Like with `Span` vs. `Vector`,
it is better to pass a `BitSpan` to function than a `const BitVector &`.
Unit tests for the new code are included.
Pull Request #104671
Cycles uses the "split faces" mesh function to support sharp edges
and auto-smooth. However, 75ad8da1ea updated that
function to ignore the edges that are explicitly tagged as sharp and
only use the edge angle. Fix by taking the attribute into account too.
The custom data layer mappings from dfacaf4f40 were created
*before* the BMesh shape key layers were added, invalidating the BMesh
data offsets they stored. Fix by creating the mappings after all layers
have been created.
Clean up logic to make it more clear and formalize the way to choose
fixed node data type based on operation. This make possible to more
easily fix wrong node data type for color type and less than ops.
Pull Request #104617
Fix: The BKE_nlatrack_remove_and_free (#104752) unit test leaks a little memory. Cleaning up the rest of the track list to ensure everything is freed.
Co-authored-by: Nate Rupsis <nrupsis@gmail.com>
Pull Request #104839
This PR adds 2 new methods:
* BKE_nlatrack_remove
* BKE_nlatrack_remove_and_free
and modifies the existing `BKE_nlatrack_free` to remove the track list parameter.
This refactor splits out the removal / freeing into it's own methods, and provides a higher order method (BKE_nlatrack_remove_and_free) to conveniently call both.
Co-authored-by: Nate Rupsis <nrupsis@gmail.com>
Pull Request #104752
When appending assets it often isn't expected for the asset tags and
meta-data to be included. Add an option to the append operator to
disable appending the asset data, exposing existing internal options.
This adds the "Select More/Less" operators for Curves. Both operators use the `select_adjacent` function to (de)select adjacent points.
Pull Request #104626
Code to set the dragging data for a button was mostly duplicated, they
share it now. The followup commit also needs an easy way to reuse the
logic, which is possible now.
No longer use the existance of an image pointer inside the button, or
the the type of a button to decide if the entire button should be
draggable, or only its icon. This was rather sneaky, undocumented
behavior. Instead make this a proper option in the public UI API, and
enable it by default in specific cases to match the previous behavior.
This at least makes the behavior known and controllable in the API, and
not something that's just "secretly" done deep down in the button
handling code. I'd argue we should just use the entire button width by
default for dragging, but that would be a bigger change.
When the users click the "Mark as Asset" with the mouse hover the fake
user button, the button was not refreshed. In fact, the areas are not
listening to the "NC_ID NA_EDITED", which is the signal emitted after
an asset is marked/unmarked. Because of this, the areas aren't redrawn
(especially the ID buttons).
This little patch adds the event listening for the areas where this
problem is happening node editor and properties editor.
Pull Request #104694
After the removal of the "normal" attribute providers, we no longer
use the concept of read-only attributes. Removing this status simplifies
code, clarifies the design, and removes potentially buggy corner cases.
Pull Request #104795
The "normal" was added before fields existed because we needed a
way to expose the data to geometry nodes. It isn't really an attribute,
because it's read-only and it's derived rather than original data.
No features have relied on the "normal" attribute existing, except
for the corresponding column in the spreadsheet. However, the
column in the spreadsheet is also inconsistent, since it isn't an
attribute but looks just like the other columns. The normal is
always visible in the spreadsheet.
Pull Request #104795
* Fix#92539: Hard to read the breadcrumbs.
* Fix View Item active, hover, and text color (e.g. count numbers in the
Spreadsheet were almost unreadable).
* Fix mismatching node type colors with the default theme.
Blender Light is meant to be simply a brighter version of the default,
so screenshots and tutorials can be followed with both themes.
* Use the same outline color for widgets, so they match when aligned in a row.
* Make panels standout (not fully transparent), like in the default theme.
The active tools in `_defs_curves_sculpt` don't use names that are
exactly the same as the corresponding brush name with "builtin_brush."
at the beginning, instead they use more standard identifiers without
capitals or spaces.
The "brush_select" utility operator assumed the names matched though.
That can be fixed by manually mapping the brushes to the active tools.
Pull Request #104792
The keymap name in `WM_keymap_guess_from_context` didn't match the
name of the keymap in the Blender default keymap (`km_sculpt_curves`).
Fix by changing the utility function to match the keymap name.
Before right clicking on any tool in curves sculpt mode gave an assert,
now it shows a context menu.
Pull Request #104791
In BKE_screen_area_map_find_area_xy (find a ScrArea by 2D location),
ignore edges by using screen verts instead of totrct
Differential Revision: blender/blender#104680
Reviewed by Brecht Van Lommel
Lookup cache was not invalidated, to update attached effects position, a handle
of a input strip is touched.
To update attached effects, currently the code only does that when strip
position is changed. This is, because effect strip updating is done internally
in sequencer module code and ideally shouldn't be done at all. A TODO comment
with further explanation is added.
On the Windows platform allow Blender windows to be created that are
spread over multiple adjacent monitors.
---
On Windows we are quite feature-complete and stable for the creation and placement of multiple (non-temp) Blender windows. We correctly do so across multiple monitors no matter their arrangement, resolution, and scale.
However, there is another way that Blender could use multiple monitors - suggested by a core dev - which is to size a window so that it comprises multiple monitors. There are some advantages to this way of working because the one window remains constantly active and in focus. It also allows a single region (like a node editor) to be as large as possible.
But this way of working is not currently possible. That is because during window creation we constrain them to fit within the confines of the nearest single monitor. This has mostly been done for simplicity and safety. We don't want to restore a saved window to a position where it cannot be seen or used.
This patch addresses that. It allows windows to span multiple monitors, and does so safely by constraining the four corners of the window to be within the working area of any active monitor. This means it allows the creation of single windows as shown below in blue (left two), but does not allow the one in orange (right):

Note this has been previously (before gitea) reviewed and approved by Brecht.
Co-authored-by: Harley Acheson <harley.acheson@gmail.com>
Pull Request #104438
Avoid running out of attributes when multiple material slots use the same one.
Cleanup:
Removes the return value from drw_attributes_add_request since it shouldn't be modified afterward and it's never used.
Avoid making copies of DRW_AttributeRequest in drw_attributes_has_request.
Co-authored-by: Miguel Pozo <pragma37@gmail.com>
Pull Request #104709
Now that the UV map names are read from the evaluated mesh the names of
the anonymous layers would show up in the UV Map node and be accessible
via the python interface.
This changes the collection definition to skip anonymous layers.
Pull Request #104783
Instead of retrieving which attributes to transfer from the geometry set
which exists at a different abstraction level, get them from accessors
directly with a newer utility function. This removes boilerplate code
and makes the logic clearer for a future even more generic attribute
propagation API.
The evaluated positions cache can live longer than a specific
`CurvesGeometry`, but for only-poly curves, it pointed to the positions,
which are freed when the curves are. Instead, use the same pattern
as the evaluated offsets and don't store the positions span, just return
it when retrieving evaluated positions.
The evaluated positions cache can live longer than a specific
`CurvesGeometry`, but for only-poly curves, it pointed to the positions,
which are freed when the curves are. Instead, use the same pattern
as the evaluated offsets and don't store the positions span, just return
it when retrieving evaluated positions.
There are known bugs in HIP compiler that are causing random build failures
when making changes to the Cycles kernel. This is preventing developers from
efficiently making improvements to Cycles.
For now Cycles AMD GPU rendering is disabled in Blender 3.6 until a good
solution is found, so that ongoing work like Principled v2 is not blocked.
We hope this can be resolved later on in the 3.6 release cycle.
Ref #104786
This reverts 1116d821dc and part of 5bac672e1a.
The solution was made specifically for the 3.5 release, to avoid
breaking other cases. The previous commit addressed the problem properly
by letting the general menu code align labels where needed.
Usually in Blender, we try to align the labels of items within a menu,
if necessary by adding a blank icon for padding. This wasn't done for
menus generated from enum properties (RNA or custom property enums). Now
we do it whenever there is at least one item with an icon.
Since the menu doesn't automatically align the labels like other menus
and pulldowns in Blender, I manually made them align using the blank
icon. However the menu button would also include this blank icon now.
This is a specific fix for the 3.5 release. In the main branch I will
replace it with proper support for automatically aligning labels in such
menus.
Since the menu doesn't automatically align the labels like other menus
and pulldowns in Blender, I manually made them align using the blank
icon. However the menu button would also include this blank icon now.
This is a specific fix for the 3.5 release. In the main branch I will
replace it with proper support for automatically aligning labels in such
menus.
* BLENDER_VERSION_CYCLE set to beta
* Update pipeline_config.yaml to point to 3.5 branches and svn tags
* Update and uncomment BLENDER_VERSION in download.cmake
Usually when a menu item displays an icon, we indent all other items
with an empty icon so items align nicely. Now with more built-in asset
libraries (the new "Essentials" library), this inconsistency becomes
more apparent.
Also add a separator line between the "All" asset library and the
others, makes the menu look more organized.
The Preferences for asset libraries are becoming more than a simple name
+ path. E.g. there is now an Import Method options, and we previously
also considered a Relative Paths option (which we may still want to
add). The previous UI, while consistent with the Auto Run Python Scripts
UI isn't well suited for less than trivial cases. Using UI lists makes
the UI more scalable and follows usual list UI patterns more. There is
also more space for the path button now.
Part of #104686.
The default import method for an asset library can now be determined in
the Preferences. The Asset Browser has a new "Follow Preferences" option
for the importing. The essentials asset library still only uses "Append
(Reuse Data)".
This is part of #104686, which aims at improving the import method
selection, especially for the introduction of the new essentials library
(which doesn't support certain import methods). Further changes are
coming to improve the UI, see #104686.
Pull Request: #104688
The quick fur operator now uses the new hair system. It adds a new
curves object for every selected mesh, and adds geometry nodes
modifiers from the essentials assets that generate curves. A few
settings are exposed in the redo panel, including an option for whether
to apply the modifier to generate the initial curves so that there is
original editable data.
The point of the operator is to give people a sense of how to use the
node groups and to give a very fast way to build a basic setup for
further tweaking.
Pull Request #104764
Use the right hand side selection, as it fits the typical workflow
the best.
Arguably, the same would need to be done for the k-shortcut, but
that is another issue to be tackled. As well as making the selection
active.
Pull Request #104777
We (Dalai, Hans, Falk, Simon and me) decided that the curves edit mode
is useful enough to justify moving it out of experimental now. So far it
supports the following features:
* Various selection tools. The selections are synced with sculpt mode.
* Transform tools.
* Delete curves/points.
More functionality of the old curve edit mode will be ported over in
future releases.
This implements the delete operator in curves edit mode. The behavior
is similar to the delete operator in the edit mode of legacy curves,
i.e. it's actually dissolving and doesn't split curves. This is also
the behavior that we generally want for the hair use case.
The operator is added to the `Curves` menu and can be accessed via
the keyboard using `X` or `Del`.
Pull Request #104765
This adds a new `Curve Falloff` popover to the comb brush tool settings.
The curve control allows changing the brush weight along the curve to
e.g. affect the tip more than the root. This is a relative way to get
something like stiffness for short hair.
This functionality could potentially be added to some other brushes,
but the comb brush is the most important one, so that is added first.
I did add the buttons add the buttons to choose a curve map preset.
However, I did not add the preset dropdown, because that just adds
some unnecessary complexity in the code now and is redundant.
Pull Request #104589
This patch adds a simple operator to set values of the active
attribute for the selected element. The aim is to give simple control
over attribute values in edit mode rather than to provide the fastest
workflow for most cases. Eventually this operator might be less
important compared to more advanced attribute editing tools, but for
now, exposing a little bit of functionality is low hanging fruit and
will help to see the possibilities.
The implementation mostly consists of boilerplate to register the
necessary property types for the operator and draw their UI.
Beyond that, we just loop over selected elements and set a value.
Pull Request #104426
Caused by strips being flagged for removal, but the flag was never
cleared. As far as I can tell, this issue is not reproducible anymore,
but there may be files with this flag still set.
overlay_uniform_color_clipped was inheriting from overlay_depth_only, which doesn't
make much sense.
I've changed it to inherit from overlay_uniform_color instead, which is consistent
with other \*\_clipped variants of shaders.
Pull Request #104761
Certain material node graphs can be very expensive to run. This feature aims to produce secondary GPUPass shaders within a GPUMaterial which provide optimal runtime performance. Such optimizations include baking constant data into the shader source directly, allowing the compiler to propogate constants and perform aggressive optimization upfront.
As optimizations can result in reduction of shader editor and animation interactivity, optimized pass generation and compilation is deferred until all outstanding compilations have completed. Optimization is also delayed util a material has remained unmodified for a set period of time, to reduce excessive compilation. The original variant of the material shader is kept to maintain interactivity.
Also adding a new concept to gpu::Shader allowing assignment of a parent shader from which a shader can pull PSO descriptors and any required metadata for asynchronous shader cache warming. This enables fully asynchronous shader optimization, without runtime hitching, while also reducing runtime hitching for standard materials, by using PSO descriptors from default materials, ahead of rendering.
Further shader graph optimizations are likely also possible with this architecture. Certain scenes, such as Wanderer benefit significantly. Viewport performance for this scene is 2-3x faster on Apple-silicon based GPUs.
Authored by Apple: Michael Parkin-White
Ref T96261
Pull Request #104536
The logic for looping over imported OBJ faces and checking whether any
of them are "invalid" (duplicate vertices) was wrongly skipping
validation of the next face right after some invalid face. It
was the previously invalid face, moving the last into its place,
but then the loop was incrementing the face index and that just-moved
face was not properly validated.
Fixes#104593 - importing attached obj file (which contains some faces
that have duplicate indices). Added test coverage with a much smaller
obj file.
When the attribute doesn't exist, the node should give the default
of 12, as defined by the accessor method for `bke::CurvesGeometry`.
Pull Request #104674
This better aligns with OSX/Linux warnings.
Although `__pragma(warning(suppress:4100))` is not the same as
`__attribute__((__unused__))` in gcc (which only affects the attribute
instead of the line), it still seems to be better to use it than to
hide the warning entirely.
As described in #104171, add an operator that creates a new node group
that contain the current node group and named attribute nodes to deal
with the outputs. This saves manual work when moving a high-level
modifier to the node editor for better procedural control.
Pull Request #104546
This adds a new overlay for curves sculpt mode that displays the curves that the
user currently edits. Those may be different from the evaluated/original curves
when procedural deformations or child curves are used.
The overlay can clash with the evaluated curves when they are exactly on top of
each other. There is not much we can do about that currently. The user will have
to decide whether the overlay should be shown or not on a case-by-case basis.
Pull Request #104467
This renames `data` and `color` to `selection`. This is better because
it's actually what the corresponding buffers contain. Using this
more correct name makes sharing vertex buffers between different
gpu batches for different shaders easier.
The "current file" mode is only useful when creating new assets.
However, the far more common use case and the one that should require
fewer steps is to use existing assets.
There is a risk that this causes freezing if the file browser preview
caching does not work properly. So we'll have to keep an eye on the bug
tracker to see if this is an issue in practice.
Pull Request #104749
This patch adds an "Essentials" asset library that is bundled with Blender.
Also see #103620. At build time, the `lib/assets/publish` folder is copied
to `datafiles/assets` in the build directory.
In the UI, the "Essentials" library can be accessed like other custom asset
libraries with the exception that assets from that library cannot be linked.
The immediate impact of this is that Blender now comes with some geometry
node groups for procedural hair grooming.
Pull Request #104474
The OBJ spec (page B1-17) allows "l" entries to specify
polylines with more than 2 vertices, optionally with texture
coordinates.
Previously, only the first 2 vertices of each polyline
were read and added as loose edges, failing when texture
coordinates were present.
This adds support for proper polylines, reading but ignoring
texture coordinates.
Pull Request #104503
In 161908157d we moved all warnings
coming out of the library folder to /W0 as many of them do not follow
our code-style nor can we force them to.
When i made this change, i took `/external:templates-` to mean
"and that goes for you too, templates" and it decisively does the
opposite leading to /W3 warnings coming out of openvdb
This change removes the flag as it should have never have been added
in the first place.
Sculpt: Added vector displacement for the sculpting draw brush (area plane mapping only for now)
Vector displacement maps (VDM) provide a way to create complex displacements that can have overhangs in one brush dab.
This is unlike standard displacement with height maps that only displace in the normal direction.
Forms like ears, curled horns, etc can be created in one click if VMDs are used.
There is a checkbox on the draw brush in the texture settings "Vector Displacement" that enables/disables this feature.
Technical description: The RGB channels of a texture in a brush stroke are read and interpreted as individual vectors, that are used to offset vertices.
As of now, this is only working for the draw brush using the area plane mapping. Symmetry and radial symmetry are working.
A few things to consider when making VD-Maps:
* UVs need to stay intact for the bake mesh (e.g. voxel remeshing can't be used to create VD Meshes)
* When exporting a VD Map it should be in the file format OpenEXR (for positive and negative floating point values).
* Export resolution can be 512x512 or lower (EXR files can get very large, but VDM brushes don't need a high resolution)
And when using them:
* Inside Blender clamping needs to be unchecked on the texture
* The brush falloff should be set to constant (or nearly constant)
This patch was inspired by this [right-click-select proposal](https://blender.community/c/rightclickselect/WqWx/) Thanks for the post!
(Moved [this patch](https://archive.blender.org/developer/D17080) to here.)
Co-authored-by: Robin Hohnsbeen <robin@hohnsbeen.de>
Pull Request #104481
Curve type counts are updated eagerly but it was missing in this
node leading to a crash further down the line where the counts
were expected to be correct.
`MEM_delete()` is designed for type safe destruction and freeing, void
pointers make that impossible.
Was reviewing a patch that was trying to free a C-style custom data
pointer this way. Apparently MSVC compiles this just fine, other
compilers error out. Make sure this is a build error on all platforms
with a useful message.
The Volume property of the Maintain Volume constraint was marked as a
distance, which made it confusing--especially with non-metric units.
The volume can actually be understood as a factor of the initial
volume, so it should be dimensionless.
Additionally, the volume had a range of 0.001 to 100.0. This is wide
enough in most cases, but sometimes you may need to go orders of
magnitude higher or lower to consider vast or thin objects, and there
should be no drawback to extending the limits, provided they stay
positive.
Pull Request #104489
The proper fix (bb9eb262d4) caused compilation problems with HIP, so we're
delaying it until 3.6.
To fix the original bug report (#104586), this is a quick workaround that'll
hopefully not upset the compiler.
Pull Request #104723
A properly authored USD file will have the extent attribute authored on all prims conforming to UsdGeomBoundable.
This cached extent information is useful because it allows the 3D range of prims to be quickly understood without reading potentially large arrays of data. Note that because the shape of prims may change over time, extent attributes are always evaluated for a given timecode.
This patch introduces support for authoring extents on meshes and volumes during export to USD.
Because extents are common to multiple kinds of geometries, the main support for authoring extents has been placed in USDAbstractWriter, whose new author_extent method can operate on any prim conforming to pxr::UsdGeomBoundable. The USD library already provides us the code necessary to compute the bounds for a given prim, in pxr::UsdGeomBBoxCache::ComputeLocalBound.
Note that not all prims that are imageable are boundable, such as transforms and cameras.
For more details on extents, see https://graphics.pixar.com/usd/release/api/class_usd_geom_boundable.html#details.
Note that when new types of geometries are introduced, such as curves in https://developer.blender.org/D16545, we will need to update the USD writer for that geometry such that it calls this->author_extent.
Update on Feb 2: This patch has been updated to include a unit test to ensure authored extents are valid. This test requires new test assets that will need to be submitted via svn. The test assets are attached in the d16837_usd_test_assets.zip file. To use, unzip and merge the contents of this zip into the lib/tests/usd folder.
This unit test also addresses #104269 by validating compliance of exported USD via UsdUtils.ComplianceChecker.
Pull Request #104676
Use a MAKE wrapper for 'make deps' on Linux that ensures dependencies
are built one at a time. This is preferable because building many
dependencies at once made troubleshooting impractical and had the
downside that large deps such as LLVM would bottleneck on a single core.
This may be used for macOS, so far it's only tested on Linux.
- Correct broken link for undocumented modules.
Point to the contributing page, it seems #51062 was lost with the
GITEA task migration.
- Correct Blender Version link to the SHA1.
Matching the RNA id's to the search pattern is slow because
of the function `fnmatchcase`. This patch first checks the string
prefix without any special characters used by fnmatch,
if the `startswith` check fails, there is no need to check `fnmatchcase`.
Before the optimization, an online manual lookup took about 400ms
which is quite noticeable, with this patch applied it's under 10ms.
Ref !104581.
The internal compiler error appears to be gone. Unclear why it appeared in the
first place and why it's gone now. Just random kernel code changes causing it.
Pull Request #104719
- Rename roughness variables for more clarity - before, the SVM/OSL code would
set s and v to the linear roughness values, and the setup function would over-
write them with the distribution parameters. This actually caused a bug in the
albedo code, since it intended to use the linear roughness value, but ended up
getting the remapped value.
- Deduplicate the evaluation and sample functions. Most of their code is the
same, only the middle part is different.
- Changed albedo computation to return the sum of the intensities of the four
BSDF lobes. Previously, the code applied the inverse of the color->sigma
mapping from the paper - this returns the color specified in the node, but
for very dark hair (e.g. when using the Melanin controls) the result is
extremely low (e.g. 0.000001) despite the hair still reflecting a significant
amount of light (since the R lobe is independent of sigma). This causes issues
with the light component passes, so this change fixes#104586.
- There's quite a few computations at the start of the evaluation function that
are needed for sampling, evaluation and albedo computation, but only depend on
the view direction. Therefore, just precompute them - we still have space in
PrincipledHairExtra after all.
- Fix a tiny bug - the direction sampling code did not account for the R lobe
roughness modifier.
Pull Request #104669
In order to experiment with different storage types for `DRW_Attributes`
and for general cleanup (see #103343). Also move a curves header to C++.
Pull Request #104716
The existing logic to copy `BMesh` custom data layers to `Mesh`
attribute arrays was quite complicated, and incorrect in some cases
when the source and destinations didn't have the same layers.
The functions leave a lot to be desired in general, since they have
a lot of redundant complexity that ends up doing the same thing for
every element.
The problem in #104154 was that the "rest_position" attribute overwrote
the mesh positions since it has the same type and the positions weren't
copied. This same problem has shown up in boolean attribute conversion
in the past. Other changes fixed some specific cases but I think a
larger change is the only proper solution.
This patch adds preprocessing before looping over all elements to
find the basic information for copying the relevant layers, taking
layer names into account. The preprocessing makes the hot loops
simpler.
In a simple file with a 1 million vertex grid, I observed a 6%
improvement animation playback framerate in edit mode with a simple
geometry nodes modifier, from 5 to 5.3 FPS.
Fixes#104154, #104348
Pull Request #104421
Don't crash on nonexisting uv selection layers. Add an assert
because for now it is a bug if they don't exist. But when converting
back to Mesh it is preferable to accept in release mode, as opposed to
crashing.
Pull Request #104600
When generating a Mesh from a BMesh the uv map bool layers are not
copied if all elements are false. To suppress the copying the flag
CD_FLAG_NOCOPY is set in the layer flags. However these layers *do*
need to be copied to other BMeshes (for example undo steps). So we
need to clear them afterwards.
This commit adds the ability to import USD Shape primitives (Gprims).
They are imported as Blender Meshes using the USD API to convert, so
that they appear the same as they would in other applications. USD
Shapes are important in many workflows, particularly in gaming, where
they are used for stand-in geometry or for collision primitives.
Pull Request #104707
The issue was caused by rather recent refactor in 7dea18b3aa.
The root of the issue lies within the fact that the optical center was updated
on the Blender side after the solution was run. There was a mistake in the code
which double-corrected for the pixel aspect ratio.
Added a comment in the code about this, so that it does not look suspicious.
Pull Request #104711
`CTX_wm_operator_poll_msg_set()` is covered by the translation script
and always translates these strings. Checked with Bastien, he prefers
not having the redundancy here.
## Cleanup: Refactor NLATrack / NLAStrip Remove
This PR adds 3 new methods:
* BKE_nlatrack_remove_strip
* BKE_nlastrip_remove
* BKE_nlastrip_remove_and_free
These named BKE methods are really just replacements for BLI_remlink, but with some added checks, and enhanced readability.
Co-authored-by: Nate Rupsis <nrupsis@gmail.com>
Pull Request #104437
Send a notification and tag for an update even if the selection doesn't
exist, which is still necessary for drawing that depends on the
selection domain.
As a side effect of this change, more resolution divisions are now available.
Before this patch the possible resolution divisions were all powers of two.
Now the possible resolution divisions are the multiples of pixel_size.
This increase in possible resolution divisions is the same idea proposed in https://archive.blender.org/developer/D13590.
In that patch there were concerns that this will increase the time between a user navigating
and seeing the 1:1 render. To my knowledge this is a non-issue and there should be
little to no increase in time between those two events.
Pull Request #104450
This is needed to be able to query asset library information from an
asset. This again is relevant especially for the "All" asset library,
where you can't just directly access the library itself, which is
different for different assets.
The current design is that an asset representation is owned by exactly
one asset library, so having this pointer is perfectly compatible with
the design.
Reviewed by: Julian Eisel
This replaces `GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR` by
GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA`.
None of the usage made sense to not use the AA shader.
Scale the point size to account for the rounded shape.
Ref #104280
The scaling of area light / spot light blend was wrong because it is
calculated for pivot at the edges. The new implementation in theory
works for all `abs(pivot) <= 0.5f`, although we only have -0.5, 0, and
0.5.
- Axis constraint for box cage was only applied when there is translate
flag, now the same logic is applied regardless of the translate flag,
this means when dragging the edge, the scaling in the other axis stays
the same; when dragging the corners, it applies free-form scaling.
- Due to the existence of margin, `data->orig_mouse` does not lie
exactly on the boundary. Using that value to compute the scaling causes
the error to accumulate over distance. The new implementation uses the
original dimension of the object instead, and only uses
`data->orig_mouse` to determine the side of the original cursor relative
to the pivot.
- For circular gizmo with unsigned scaling, the gizmo only follow the
cursor exactly when the cursor stays in the original quadrant, otherwise
it's hard to handle the logic when we should clamp the scaling.
The buttons of enum context menus are of type `UI_BUT_ROW`. They
are part of the set of buttons we create underline shortcuts for in
`ui_menu_block_set_keyaccels`.
But since they weren't handled in `ui_handle_button_activate_by_type`,
pressing the underline shortcuts didn't do anyting in those cases.
Co-authored-by: Leon Schittek <leon.schittek@gmx.net>
Co-authored-by: Brecht Van Lommel <brecht@noreply.localhost>
Pull Request #104433
Currently the passepartout color is hardcoded to black. While a
sensible default for cinema, it may make less sense for other media,
whether video, print, web, etc. It greatly affects viewing conditions
of the image and should be user selectable, much like painting
programs allow.
Pull Request #104486
Don't create caps when using cyclic profile splines with two or fewer
points.
This case wasn't handled, yet, leading to invalid meshes or crashes.
Co-authored-by: Leon Schittek <leon.schittek@gmx.net>
Pull Request #104594
Vulkan has a pluggable memory allocation feature, which allows internal
driver allocations to be done by the client application provided
allocator. Vulkan uses this for more client application allocations
done inside the driver, but can also do it for more internal oriented
allocations.
VK_ALLOCATION_CALLBACKS initializes allocation callbacks for host allocations.
The macro creates a local static variable with the name vk_allocation_callbacks
that can be passed to vulkan API functions that expect
const VkAllocationCallbacks *pAllocator.
When WITH_VULKAN_GUARDEDALLOC=Off the memory allocation implemented
in the vulkan device driver is used for both internal and application
oriented memory operations.
For now this would help during the development of Vulkan backend to
detect hidden memory leaks that are hidden inside the driver part
of the stack. In a later stage we need to measure the overhead and
if this should become the default behavior.
Pull Request #104434
The GPU module has 2 different styles when reading back data from
GPU buffers. The SSBOs used a memcpy to copy the data to a
pre-allocated buffer. IndexBuf/VertBuf gave back a driver/platform
controlled pointer to the memory.
Readback is done for test cases returning mapped pointers is not safe.
For this reason we settled on using the same approach as the SSBO.
Copy the data to a caller pre-allocated buffer.
Reason why this API is currently changed is that the Vulkan API is more
strict on mapping/unmapping buffers that can lead to potential issues
down the road.
Pull Request #104571
Keep using the 3 evaluations dF_branch method for the Displacement output.
The optimized 2 evaluations method used by node_bump is now on its own macro (dF_branch_incomplete).
displacement_bump modifies the normal that nodetree_exec uses, so even with a refactor it wouldn’t be possible to re-use the computation anyway.
Using larger integer types allows for more efficient code, because we
can use the hardware better. Instead of working on individual bytes,
the code can now work on 8 bytes at a time. We don't really benefit
from this immediately but I'm planning to implement some more optimized
bit vector operations for #104629.
Pull Request #104658
Add a test to address the issue raised in #103913, where zero area
triangles could be created from polygons that have co-linear edges
but were not degenerate.
Since USD is no longer statically linked these linker tricks
are no longer needed.
Co-authored-by: Ray Molenkamp <github@lazydodo.com>
Pull Request #104627
When building a node group that's meant to be used directly in the
node editor as well as in the modifier, it's useful to be able to have
some inputs that are only meant for the node editor, like inputs that
only make sense when combined with other nodes.
In the future we might have the ability to only display certain assets
in the modifier and the node editor, but until then this simple solution
allows a bit more customization.
Pull Request #104517
During hair grooming in curves sculpt mode, it is very useful when hair strands
are prevented from intersecting with the surface mesh. Unfortunately, it also
decreases performance significantly so we don't want it to be turned on all the time.
The surface collision is used by the Comb, Pinch and Puff brushes currently.
It can be turned on or off on a per-geometry basis.
The intersection prevention quality of this patch is not perfect yet. This can
be improved over time using a better solver. Overall, perfect collision detection
at the cost of bad performance is not necessary for interactive sculpting,
because the user can fix small mistakes very quickly. Nevertheless, the quality
can probably still be improved significantly without too big slow-downs depending
on the use case. This can be done separately from this patch.
Pull Request #104469
Previously, the node used the "true" normal of every looptri. Now it uses the
"loop normals" which includes e.g. smooth faces and custom normals. The true
normal can still be used on the points by capturing it before the Distribute node.
We do intend to expose the smooth normals separately in geometry nodes as well,
but this is an important first step.
It's also necessary to generate child hair between guide hair strands that don't
have visible artifacts at face boundaries.
For perfect backward compatibility, the node still has a "Legacy Normal" option
in the side bar. Creating the exact same behavior with existing nodes isn't
really possible unfortunately because of the specifics of how the Distribute
node used to compute the normals using looptris.
Pull Request #104414
CustomData layer names should not be written except via the CusomData
api. Therefore use const char * instead of char * when referencing the
layer name.
Pull Request #104585
Avoid computing the non-derivative height twice.
The height is now computed as part of the main function, while the height at x and y offsets are still computed on a separate function.
The differentials are now computed directly at node_bump.
Co-authored-by: Miguel Pozo <pragma37@gmail.com>
Pull Request #104595
This adds a `select_lasso` and a `select_circle` function for the Curves object. It is used in the `view3d_lasso_select` and `view3d_circle_select` operator.
Co-authored-by: Falk David <falkdavid@gmx.de>
Pull Request #104560
This adds a new `select_linked` function that selects all the points
on a curve if there is at least one point already selected.
This also adds a keymap for the operator.
Co-authored-by: Falk David <falkdavid@gmx.de>
Pull Request #104569
Add `contains_group` method in python api for `NodeTree` type, cleanup
`ntreeHasTree` function, reuse `ntreeHasTree` in more place in code.
The algorithm has been changed to not recheck trees by using set.
Performance gains from avoiding already checked node trees:
Based on tests, can say that for large files with a huge number
of trees, the response speed of opening the search menu in the
node editor increased by ~200 times (for really large projects
with 16 individual groups in 6 levels of nesting). Group insert
operations are also accelerated, but this is different in some cases.
Pull Request #104465
This reverts commit aab707ab70.
A different solution to the submodule problem is being considered in #104573.
Revert to the previous behavior that developers are familiar with for now.
This just adds `threading::parallel_for` and `threading::parallel_invoke` in a few
places where it can be added trivially. The run time of the `separate_geometry`
function changes from 830 ms to 413 ms in my test file.
Pull Request #104563
Using callback functions didn't scale well as more arguments are added.
It got very confusing when to pass tehmarguments weren't always used.
Instead use a `FunctionRef` with indices for arguments. Also remove
unused edge arguments to topology mapping functions.
Adds an experimental option under "New Features" in preferences,
which enables visibility of the new Volume Nodes.
Right now this option does nothing but will be used during development.
See #103248
Pull Request #104552
Because of T95965, some attributes are stored as generic attributes
in Mesh but have special handling for the conversion to BMesh.
Expose a function to tell whether certain attribute names are handled
specially in the conversion, and refactor the error checking process
to use it. Also check for generic attributes on the face domain which
wasn't done before.
Author: Hans Goudey
Reviewed By: Joseph Eagar
Co-authored-by: Joseph Eagar <joeedh@gmail.com>
Pull Request #104567
When merging two gpencil layers, if the destination layer had a keyframe
where the source layer did not, strokes of the previous keyframe
in source layer were lost in that frame.
This happened because the merge operator was looping through
frames of the source layer and appending strokes in the
corresponding destination layer, but never completing
other frames than the ones existing in the source layer.
This patch fixes it by first adding in source layer
all frames that are in destination layer.
Co-authored-by: Amelie Fondevilla <amelie.fondevilla@les-fees-speciales.coop>
Pull Request #104558
When the sequencer is empty (i.e., there are no sequences),
we would have the deselect_all variable set to true called
ED_sequencer_deselect_all to select any existing sequences.
Ref !104453
Box-Selecting channels in the dope sheet with click-drag was no longer possible as of Blender 3.2
Due to the removal of tweak events the box select operator was always shadowed by the click operator.
Original Phabricator discussion here: https://archive.blender.org/developer/D17065
Use `WM_operator_flag_only_pass_through_on_press` on click operator to fix it
Co-authored-by: Christoph Lendenfeld <chris.lenden@gmail.com>
Pull Request #104505
(Follow on from D17043)
On AMD Navi2 devices the MetalRT checkbox was not hooked up properly and had no effect. This patch fixes it.
Co-authored-by: Michael Jones <michael_p_jones@apple.com>
Pull Request #104520
- Avoid flooding the output with every match that succeeds.
- Report patterns listed in the manual that don't match anything in
Blender.
- Disable external URL lookups, this is too slow.
Instead use a LOCAL_PREFIX (a local build of the manual)
or skip the test.
Without this, every access to "language" would warn that the enum
value didn't match a value in the enum items.
This made the bl_rna_manual_reference.py test output practically
unusable.
The generator now skips these with a warning, they will need to be
corrected in the user manual.
This caused tests/python/bl_rna_manual_reference.py to fail looking
up URL's.
Move the function for getting the language code associated with the
user manual into a utility function (from the generated
rna_manual_reference.py).
This allows other parts of Blender to create a manual URL based on the
current locale preferences and environment.
Ref !104494
Documented all functions, adding use case and side effects.
Also replace the use of shortened argument name by more meaningful ones.
Renamed `GPU_batch_instbuf_add_ex` and `GPU_batch_vertbuf_add_ex` to remove
the `ex` suffix as they are the main version used (removed the few usage
of the other version).
Renamed `GPU_batch_draw_instanced` to `GPU_batch_draw_instance_range` and
make it consistent with `GPU_batch_draw_range`.
When nodes are copied to the clipboard, they don't need their declaration.
For nodes with dynamic declaration that might depend on the node tree itself,
the declaration could not be build anyway, because the node-clipboard does
not have a node tree.
Pull Request #104432
Add a new node that groups faces inside of boundary edge regions.
This is the opposite action as the existing "Face Group Boundaries"
node. It's also the same as some of the "Initialize Face Sets"
options in sculpt mode.
Discussion in #102962 has favored "Group" for a name for these
sockets rather than "Set", so that is used here.
Pull Request #104428
Currently there's no way to assign a geometry node group from the asset
browser to an object as a modifier without first appending/linking it
manually. This patch adds a drag and drop operator that adds a new
modifier and assigns the dragged tree.
Pull Request #104430
As described in #95966, replace the `ME_EDGEDRAW` flag with a bit
vector in mesh runtime data. Currently the the flag is only ever set
to false for the "optimal display" feature of the subdivision surface
modifier. When creating an "original" mesh in the main data-base,
the flag is always supposed to be true.
The bit vector is now created by the modifier only as necessary, and
is cleared for topology-changing operations. This fixes incorrect
interpolation of the flag as noted in #104376. Generally it isn't
possible to interpolate it through topology-changing operations.
After this, only the seam status needs to be removed from edges before
we can replace them with the generic `int2` type (or something similar)
and reduce memory usage by 1/3.
Related:
- 10131a6f62
- 145839aa42
In the future `BM_ELEM_DRAW` could be removed as well. Currently it is
used and aliased by other defines in some non-obvious ways though.
Pull Request #104417
This adds a `select_box` function for the `Curves` object. It is used in the `view3d_box_select` operator.
It also adds the basic selection tools in the toolbar of Edit Mode.
Authored-by: Falk David <falkdavid@gmx.de>
Pull Request #104411
The required version numbers for various devices was hardcoded in the
UI messages. The result was that every time one of these versions was
bumped, every language team had to update the message in question.
Instead, the version numbers can be extracted, and injected into the
error messages using string formatting so that translation updates
need happen less frequently.
Pull Request #104488
`bAnimContext` had a float property called `yscale_fac` that was used to define the height of the keyframe channels.
However the property was never set, only read so there really is no need to have it in the struct.
Moreover it complicated getting the channel height because `bAnimContext` had to be passed in.
Speaking of getting the channel height. This was done with macros. I ripped them all out and replaced them with function calls.
Originally it was introduced in this patch: https://developer.blender.org/rB095c8dbe6919857ea322b213a1e240161cd7c843
Co-authored-by: Christoph Lendenfeld <chris.lenden@gmail.com>
Pull Request #104500
This is used for most Python release builds and has been reported to
give a modest 5-10% speedup (depending on the workload).
This could be enabled on macOS too but needs to be tested.
Blender was reporting that the GPU_TEXTURE_USAGE_HOST_READ wasn't set.
This is used to indicate that the textures needs to be read back to
CPU. Textures that don't need to be read back can be optimized by the
GPU backend.
Found during investigation of #104282.
- Use bpy.utils.execfile instead of importing then deleting from
sys.modules.
- Add a note for why keeping this cached in memory isn't necessary.
This has the advantage of not interfering with any scripts that import
`rna_manual_reference` as a module.
This allow to bypass all cost associated with shadow mapping.
This can be useful in certain situation, such as opening a scene on a
lower end system or just to gain performance in some situation (lookdev).
The merge with master updated the code to use the new matrix API. This
introduce some regressions.
For sunlights make sure there is enough tilemaps in orthographic mode
to cover the depth range and fix the level offset in perspective.
Implements virtual shadow mapping for EEVEE-Next primary shadow solution.
This technique aims to deliver really high precision shadowing for many
lights while keeping a relatively low cost.
The technique works by splitting each shadows in tiles that are only
allocated & updated on demand by visible surfaces and volumes.
Local lights use cubemap projection with mipmap level of detail to adapt
the resolution to the receiver distance.
Sun lights use clipmap distribution or cascade distribution (depending on
which is better) for selecting the level of detail with the distance to
the camera.
Current maximum shadow precision for local light is about 1 pixel per 0.01
degrees.
For sun light, the maximum resolution is based on the camera far clip
distance which sets the most coarse clipmap.
## Limitation:
Alpha Blended surfaces might not get correct shadowing in some corner
casses. This is to be fixed in another commit.
While resolution is greatly increase, it is still finite. It is virtually
equivalent to one 8K shadow per shadow cube face and per clipmap level.
There is no filtering present for now.
## Parameters:
Shadow Pool Size: In bytes, amount of GPU memory to dedicate to the
shadow pool (is allocated per viewport).
Shadow Scaling: Scale the shadow resolution. Base resolution should
target subpixel accuracy (within the limitation of the technique).
Related to #93220
Related to #104472
The previous change in the .gitmodules made it so the `make update`
rejects to do its thing because it now sees changes in the submodules
and rejected to update, thinking there are unstaged changes.
Ignore the submodule changes, bringing the old behavior closer to
what it was.
The meaning of the ignore option for submodules did change since our
initial Git setup was done: back then it was affecting both diff and
stage families of Git command. Unfortunately, the actual behavior did
violate what documentation was stating (the documentation was stating
that the option only affects diff family of commands). This got fixed
in Git some time after our initial setup and it was the behavior of the
commands changed, not the documentation. This lead to a situation when
we can no longer see that submodules are modified and staged, and it is
very easy to stage the submodules.
For the clarity: diff and status are both "status" family, show and
diff are "diff" family.
Hence this change: since there is no built-in zero-configuration way
of forbidding Git from staging submodules lets make it visible and
clear what the state of submodules is.
We still need to inform people to not stage submodules, for which
we can offer some configuration tips and scripts but doing so is
outside of the scope of this change at it requires some additional
research. Current goal is simple: make it visible and clear what is
going to be committed to Git.
This is a response to an increased frequency of incidents when the
submodules are getting modified and committed without authors even
noticing this (which is also a bit annoying to recover from).
Differential Revision: https://developer.blender.org/D13001
Subdivision surface efficiency relies on caching pre-computed topology
data for evaluation between frames. However, while eed45d2a23
introduced a second GPU subdiv evaluator type, it still only kept
one slot for caching this runtime data per mesh.
The result is that if the mesh is also needed on CPU, for instance
due to a modifier on a different object (e.g. shrinkwrap), the two
evaluators are used at the same time and fight over the single slot.
This causes the topology data to be discarded and recomputed twice
per frame.
Since avoiding duplicate evaluation is a complex task, this fix
simply adds a second separate cache slot for the GPU data, so that
the cost is simply running subdivision twice, not recomputing topology
twice.
To help diagnostics, I also add a message to show when GPU evaluation
is actually used to the modifier panel. Two frame counters are used
to suppress flicker in the UI panel.
Differential Revision: https://developer.blender.org/D17117
Pull Request #104441
The ear clipping method used by polyfill_2d only excluded concave ears
which meant ears exactly co-linear edges created zero area triangles
even when convex ears are available.
While polyfill_2d prioritizes performance over *pretty* results,
there is no need to pick degenerate triangles with other candidates
are available. As noted in code-comments, callers that require higher
quality tessellation should use BLI_polyfill_beautify.
Sockets after the geometry socket were ignored when cycling through
the node's output sockets. If there are multiple geometry sockets, the
behavior could still be refined probably, but this should at least make
basic non-geometry socket cycling work.
Now a single script to generate both links and release notes. It also includes
the issue ID for the LTS releases, so only the release version needs to be
specified.
Pull Request #104402
Minor change to [0], prefer calling em_setup_viewcontext,
even though there is no functional difference at the moment,
if this function ever performs additional operations than assigning
`ViewContext.em`, it would have to be manually in-lined in
`view3d_circle_select_recalc`.
[0]: 430cc9d7bf
Added missing documentation for `draw_cursor_add` and
`draw_cursor_remove` methods for `WindowManager`.
Differential Revision: https://developer.blender.org/D14860
Discard is not always treated as an explicit return and flow control can continue for required derivative calculations. This behaviour is different in Metal vs OpenGL. Adding return after discards ensures consistency in expectation as behaviour is well-defined.
Authored by Apple: Michael Parkin-White
Ref T96261
Reviewed By: fclem
Maniphest Tasks: T96261
Differential Revision: https://developer.blender.org/D17199
Host memory fallback in CUDA and HIP devices is almost identical.
We remove duplicated code and create a shared generic version that
other devices (oneAPI) will be able to use.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D17173
Straightforward port. I took the oportunity to remove some C vector
functions (ex: copy_v2_v2).
This makes some changes to DRWView to accomodate the alignement
requirements of the float4x4 type.
2023-02-06 21:25:45 +01:00
4469 changed files with 2224221 additions and 66823 deletions
* Test [daily builds](https://builder.blender.org/) to verify if the issue is already fixed.
* Test [previous versions](https://download.blender.org/release/) to find an older working version.
* For feature requests, feedback, questions or build issues, see [communication channels](https://wiki.blender.org/wiki/Communication/Contact#User_Feedback_and_Requests).
* Security vulnerabilities should be [reported privately](https://wiki.blender.org/wiki/Process/Vulnerability_Reports).
* If there are multiple bugs, make multiple bug reports.
# Disable opencollada when we don't have precompiled libs
option(WITH_OPENCOLLADA"Enable OpenCollada Support (http://www.opencollada.org)"ON)
option(WITH_IO_WAVEFRONT_OBJ"Enable Wavefront-OBJ 3D file format support (*.obj)"ON)
option(WITH_IO_PLY"Enable PLY 3D file format support (*.ply)"ON)
option(WITH_IO_STL"Enable STL 3D file format support (*.stl)"ON)
option(WITH_IO_GPENCIL"Enable grease-pencil file format IO (*.svg, *.pdf)"ON)
@@ -524,7 +521,7 @@ 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_ARCHgfx1010gfx1011gfx1012gfx1030gfx1031gfx1032gfx1034gfx1035gfx1100gfx1101gfx1102CACHESTRING"AMD HIP architectures to build binaries for")
set(CYCLES_HIP_BINARIES_ARCHgfx900gfx906gfx90cgfx902 gfx1010gfx1011gfx1012gfx1030gfx1031gfx1032gfx1034gfx1035gfx1100gfx1101gfx1102CACHESTRING"AMD HIP architectures to build binaries for")
mark_as_advanced(WITH_CYCLES_DEVICE_HIP)
mark_as_advanced(CYCLES_HIP_BINARIES_ARCH)
endif()
@@ -617,16 +614,20 @@ endif()
option(WITH_OPENGL"When off limits visibility of the opengl headers to just bf_gpu and gawain (temporary option for development purposes)"ON)
option(WITH_GPU_BUILDTIME_SHADER_BUILDER"Shader builder is a developer option enabling linting on GLSL during compilation"OFF)
option(WITH_RENDERDOC"Use Renderdoc API to capture frames"OFF)
mark_as_advanced(
WITH_OPENGL
WITH_GPU_BUILDTIME_SHADER_BUILDER
WITH_RENDERDOC
)
# Vulkan
option(WITH_VULKAN_BACKEND"Enable Vulkan as graphics backend (only for development)"OFF)
option(WITH_VULKAN_GUARDEDALLOC"Use guardedalloc for host allocations done inside Vulkan (development option)"OFF)
mark_as_advanced(
WITH_VULKAN_BACKEND
WITH_VULKAN_GUARDEDALLOC
)
# Metal
@@ -644,15 +645,15 @@ if(WIN32)
endif()
# Compiler tool-chain.
if(UNIXANDNOTAPPLE)
if(UNIX)
if(CMAKE_COMPILER_IS_GNUCC)
option(WITH_LINKER_GOLD"Use ld.gold linker which is usually faster than ld.bfd"ON)
mark_as_advanced(WITH_LINKER_GOLD)
option(WITH_LINKER_LLD"Use ld.lld linker which is usually faster than ld.gold"OFF)
@@ -14,3 +14,13 @@ The first three of them were employed by the Blender Foundation during that time
Some features (random sounds, dynamic music, playback manager, convolution and HRTFs support) were added as part of the VALS (Virtual Alliances for Learning Society) project by
- Juan Francisco Crespo Galán <dethon_5@outlook.com>
- Support for OS specific/native audio devices/backends has been added, that is PulseAudio (Linux), WASAPI (Windows) and CoreAudio (MacOS).
- New sound effects have been added, namely Modulator and Equalizer. Thanks to Marcos Perez for contributing the Equalizer.
- File stream info: if an audio file contains multiple streams you can choose which one to process instead of taking the first one (this feature is only supported by ffmpeg, not libsndfile).
- API Change: double instead of float for time values for more precise timing control.
- There have been lots of bugfixes, which are basically the majority of all changes.
- And some other minor improvements were implemented as well.
Detailed list of changes:
d4042d9 Port changes in Blender to upstream.
b60fb45 Equalizer
ab04e84 Fixes
8f0c305 Fix build error with MSVC 17.4+ ported from Blender.
ce44342 Minor documentation update.
cdcb3f4 Migrate from distuils to setuptools for python module.
21eccef Fix FindFFTW to find the float version fftw3f.
ab15e2f Bugfix: API change in new ffmpeg version.
a097be8 Clang format file added, valid from now on.
2fc9fb7 Porting bugfix from Blender upstream.
bb655b7 Bugfix: wrong sample size computation for PulseAudio.
a150495 Bugfix: Buffer did not support buffers > 2 GB.
034645c Update for ffmpeg 5.
932739c Bugfix: WASAPI hangs.
4fcd47c WASAPI: fix bug when switching the default device while there is no playback.
a16fbd2 Python API: fix to get convolution in the python API.
27ac5c1 WASAPI: always switch to default audio device.
1b03e6c Bugfix: catch exception if file cannot be read.
The fast_float library provides fast header-only implementations for the C++ from_chars
functions for `float` and `double` types. These functions convert ASCII strings representing
decimal values (e.g., `1.3e10`) into binary types. We provide exact rounding (including
@@ -28,8 +21,8 @@ struct from_chars_result {
```
It parses the character sequence [first,last) for a number. It parses floating-point numbers expecting
a locale-independent format equivalent to the C++17 from_chars function.
The resulting floating-point value is the closest floating-point values (using either float or double),
a locale-independent format equivalent to the C++17 from_chars function.
The resulting floating-point value is the closest floating-point values (using either float or double),
using the "round to even" convention for values that would otherwise fall right in-between two values.
That is, we provide exact parsing according to the IEEE standard.
@@ -47,7 +40,7 @@ Example:
``` C++
#include "fast_float/fast_float.h"
#include <iostream>
int main() {
const std::string input = "3.1416 xyz ";
double result;
@@ -60,39 +53,60 @@ int main() {
Like the C++17 standard, the `fast_float::from_chars` functions take an optional last argument of
the type `fast_float::chars_format`. It is a bitset value: we check whether
the type `fast_float::chars_format`. It is a bitset value: we check whether
`fmt & fast_float::chars_format::fixed` and `fmt & fast_float::chars_format::scientific` are set
to determine whether we allow the fixed point and scientific notation respectively.
The default is `fast_float::chars_format::general` which allows both `fixed` and `scientific`.
The library seeks to follow the C++17 (see [20.19.3](http://eel.is/c++draft/charconv.from.chars).(7.1)) specification.
The library seeks to follow the C++17 (see [20.19.3](http://eel.is/c++draft/charconv.from.chars).(7.1)) specification.
* The `from_chars` function does not skip leading white-space characters.
* [A leading `+` sign](https://en.cppreference.com/w/cpp/utility/from_chars) is forbidden.
* It is generally impossible to represent a decimal value exactly as binary floating-point number (`float` and `double` types). We seek the nearest value. We round to an even mantissa when we are in-between two binary floating-point numbers.
* It is generally impossible to represent a decimal value exactly as binary floating-point number (`float` and `double` types). We seek the nearest value. We round to an even mantissa when we are in-between two binary floating-point numbers.
Furthermore, we have the following restrictions:
* We only support `float` and `double` types at this time.
* We only support the decimal format: we do not support hexadecimal strings.
* For values that are either very large or very small (e.g., `1e9999`), we represent it using the infinity or negative infinity value.
* For values that are either very large or very small (e.g., `1e9999`), we represent it using the infinity or negative infinity value and the returned `ec` is set to `std::errc::result_out_of_range`.
We support Visual Studio, macOS, Linux, freeBSD. We support big and little endian. We support 32-bit and 64-bit systems.
We assume that the rounding mode is set to nearest (`std::fegetround() == FE_TONEAREST`).
## C++20: compile-time evaluation (constexpr)
In C++20, you may use `fast_float::from_chars` to parse strings
at compile-time, as in the following example:
```C++
// consteval forces compile-time evaluation of the function in C++20.
consteval double parse(std::string_view input) {
double result;
auto answer = fast_float::from_chars(input.data(), input.data()+input.size(), result);
if(answer.ec != std::errc()) { return -1.0; }
return result;
}
// This function should compile to a function which
// merely returns 3.1415.
constexpr double constexptest() {
return parse("3.1415 input");
}
```
## Using commas as decimal separator
The C++ standard stipulate that `from_chars` has to be locale-independent. In
particular, the decimal separator has to be the period (`.`). However,
some users still want to use the `fast_float` library with in a locale-dependent
particular, the decimal separator has to be the period (`.`). However,
some users still want to use the `fast_float` library with in a locale-dependent
manner. Using a separate function called `from_chars_advanced`, we allow the users
to pass a `parse_options` instance which contains a custom decimal separator (e.g.,
to pass a `parse_options` instance which contains a custom decimal separator (e.g.,
- Daniel Lemire, [Number Parsing at a Gigabyte per Second](https://arxiv.org/abs/2101.11408), Software: Pratice and Experience 51 (8), 2021.
## Relation With Other Work
The fast_float library is part of:
- GCC (as of version 12): the `from_chars` function in GCC relies on fast_float.
- [WebKit](https://github.com/WebKit/WebKit), the engine behind Safari (Apple's web browser)
The fastfloat algorithm is part of the [LLVM standard libraries](https://github.com/llvm/llvm-project/commit/87c016078ad72c46505461e4ff8bfa04819fe7ba).
There is a [derived implementation part of AdaCore](https://github.com/AdaCore/VSS).
The fast_float library provides a performance similar to that of the [fast_double_parser](https://github.com/lemire/fast_double_parser) library but using an updated algorithm reworked from the ground up, and while offering an API more in line with the expectations of C++ programmers. The fast_double_parser library is part of the [Microsoft LightGBM machine-learning framework](https://github.com/microsoft/LightGBM).
## References
- Daniel Lemire, [Number Parsing at a Gigabyte per Second](https://arxiv.org/abs/2101.11408), Software: Practice and Experience 51 (8), 2021.
- Noble Mushtak, Daniel Lemire, [Fast Number Parsing Without Fallback](https://arxiv.org/abs/2212.06644), Software: Practice and Experience (to appear)
## Other programming languages
- [There is an R binding](https://github.com/eddelbuettel/rcppfastfloat) called `rcppfastfloat`.
- [There is a Rust port of the fast_float library](https://github.com/aldanor/fast-float-rust/) called `fast-float-rust`.
- [There is a Java port of the fast_float library](https://github.com/wrandelshofer/FastDoubleParser) called `FastDoubleParser`.
- [There is a Java port of the fast_float library](https://github.com/wrandelshofer/FastDoubleParser) called `FastDoubleParser`. It used for important systems such as [Jackson](https://github.com/FasterXML/jackson-core).
- [There is a C# port of the fast_float library](https://github.com/CarlVerret/csFastFloat) called `csFastFloat`.
## Relation With Other Work
The fastfloat algorithm is part of the [LLVM standard libraries](https://github.com/llvm/llvm-project/commit/87c016078ad72c46505461e4ff8bfa04819fe7ba).
The fast_float library provides a performance similar to that of the [fast_double_parser](https://github.com/lemire/fast_double_parser) library but using an updated algorithm reworked from the ground up, and while offering an API more in line with the expectations of C++ programmers. The fast_double_parser library is part of the [Microsoft LightGBM machine-learning framework](https://github.com/microsoft/LightGBM).
## Users
The fast_float library is used by [Apache Arrow](https://github.com/apache/arrow/pull/8494) where it multiplied the number parsing speed by two or three times. It is also used by [Yandex ClickHouse](https://github.com/ClickHouse/ClickHouse) and by [Google Jsonnet](https://github.com/google/jsonnet).
@@ -135,14 +186,14 @@ It can parse random floating-point numbers at a speed of 1 GB/s on some systems.
# Copyright 2014 Blender Foundation. All rights reserved.
# Copyright 2014 Blender Foundation
# avoid noisy warnings
if(CMAKE_COMPILER_IS_GNUCC)
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.