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 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
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
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)
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
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
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.
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
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
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
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
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.
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
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 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 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).
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.
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
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
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
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
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
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
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
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
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
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.
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.
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.
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
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
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
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
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 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 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
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
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.
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
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
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
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
Rename `struct ::UVPackIsland_Params` to
`class blender::geometry::UVPackIsland_Params`
Brings us closer to an "algorithm" style API.
No functional changes.
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
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
* 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 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
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.
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
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
- 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
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
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
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
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.
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.
Fixes#105467
Pull Request #105499
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
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
**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.
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
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.
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
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
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
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
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
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.
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
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 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).
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.
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
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
* 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.
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
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.
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.
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
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.
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
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
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
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.
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
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
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
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
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
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
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).
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
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.
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
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
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.
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
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
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
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
* 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
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
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.
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
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
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
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.
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.
* 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.
@@ -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.
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.