The socket indices in `bNode` and their corresponding `lf::Node`
don't match exactly, because `lf::Node` does not contain the
unavailable sockets. A simple mapping from `bNodeSocket` index
to `lf::Socket` index is required for future work. For now it
only removes the need for various tempory vectors.
This adds baking support to simulation nodes.
The following features are supported:
* Bake simulation nodes of selected objects from the new "Baking" panel in the
object properties.
* Free baked/cached simulation data.
* The bake is stored on disk in a folder next to the .blend file (so it's necessary
to save before baking works).
* Baked data is detected automatically when reloading the file.
* The data stored on disk is partially deduplicated. Only duplicates that can be
detected using implicit-sharing are taken into account.
* The baked data can contain meshes, curves, pointclouds and instances.
* The simulation state is written using a combination raw binary files for the
data arrays and `.json` for meta data. Other formats besides `.json` could be
used (most code is agnostic to that), but json is the easiest to use right now and
seems to be good enough the common use cases (note that the size of the `.json`
files do not depend on how large e.g. the baked mesh is).
* During baking, there is a progress bar and it can be interrupted using escape.
Limitations:
* Volumes are not written to disk yet.
* Currently it always bakes the entire scene frame range.
* Baking subframes is supported internally, but is not exposed in the UI.
* Currently, all attributes are written, but that is likely not necessary in most
cases (e.g. selection attributes are written as well).
Pull Request: blender/blender#106937
Similar to the cache of loose edges added in 1ea169d90e,
cache the number of loose vertices and which are loose in a bit map.
This can save significant time when drawing large meshes in the
viewport, because recalculations can be avoided when the data doesn't
change, and because many geometry nodes set the loose geometry
caches eagerly when the meshes contain no loose elements.
There are two types of loose vertices:
1. Vertices not used by any edges or faces
`Mesh.loose_verts()`
2. Vertices not used by any faces (may be used by loose edges)
`Mesh.verts_no_face()`
Because both are used by Blender in various places, because the cost
is only a bit per vertex (or constant at best) and for design consistency,
we cache both types of loose elements. The bit maps will only be
allocated when they're actually used, but they are already accessed
in a few important places:
- Attribute domain interpolation
- Subdivision surface modifier
- Viewport drawing
Just skipping viewport drawing calculation after certain geometry
nodes setups can have a large impact. Here is the time taken by
viewport loose geometry extraction before and after the change:
- 4 million vertex grid node: 28 ms to 0 ms
- Large molecular nodes setup (curve to mesh node): 104 ms to 0 ms
- Realize instances with 1 million cubes: 131 ms to 0 ms
Pull Request: blender/blender#105567
The node outputs the index of the closest element to itself. See #102387
for the original design.
This is different from the Sample Nearest node in two important ways:
* It does not have a geometry input, instead the geometry is taken from the
field evaluation context.
* The node can exclude the "current" element from the search.
* The group id input can be used to build subsets of elements that only
consider each other as neighbors and ignore elements with other ids.
Pull Request: blender/blender#104619
The issue happens because the algorithm used to calculate the center of
the selection first needs to create a TransData array. In this array,
the code calculates the "mirrored" elements which can be quite slow in
dense meshes.
The solution is replace this slow algorithm used for calculating the pivot
point with the fast algorithm used to calculate the position of transform
gizmos.
Pull Request: blender/blender#107203
An operator to allow interactive text selection for 3D Text Objects.
This is from the code of Yash Dabhade (yashdabhade) for GSoC 2022
with corrections and simplifications. Also includes double-click for
word selection.
Pull Request: blender/blender#106915
When EEVEE is rendering multiple samples via
eevee_draw_scene, the command submission and in-flight
memory pressure would grow until all samples completed,
due to lack of intermediate flushing of GPU work and memory.
This patch adds a command flush and memory clear for this case
which occurs with high TAA sample counts during saving, similar
to the process in EEVEE_render_draw.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#107221
Function `WM_keymap_guess_opname()` skipped `UI_OT` operator types. In
some cases this is detremental to workflow, see #105371.
To exclude operators from getting keyboard shortcut it was suggested by
Campbell to use flag `OPTYPE_INTERNAL` or make new one.
Pull Request: blender/blender#105383
This patch contains changes needed for retiming sound strips.
`BKE_sound_set_scene_sound_pitch()` is replaced by
`BKE_sound_set_scene_sound_pitch_constant_range()` which uses new
Audaspace interface to set pitch in bulk.
This is done in `SEQ_retiming_sound_animation_data_set()` where retimed
sections are created for each strip. When strip is inside of meta
strip(s), the retimed sections of meta and actual strip are split where
they intersect and pitch is multiplied where they overlap. Each section
will have pitch value that is provided to audaspace.
Waveform overlay now represents retimed audio accurately.
Ref: #100337
Pull Request: blender/blender#105072
Whether the outputs are fields only depends on whether at least one of the
last three inputs is a field. It does not matter whether the `Value` input is
a field.
Pull Request: blender/blender#106007
Patch prefers usage of Transform Feedback for hair refinement
as opposed to compute, as vertex work can be pipelined with
existing rendering work which is in-flight.
This approach is ~20% faster depending on the scene. Note that
the current implementation only uses TF, as storage buffer support
is disabled. Though once storage buffer support is added, we should
still use the TF path.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#107166
This PR uses the VK_EXT_debug_utils extension, but it's only for labeling, so it doesn't rely on the VK_LAYER_KHRONOS_validation functionality.
The functions that do these things are loaded into the runtime as vulkan extensions.
Declare the function pointers in a struct and make them members of vk_context.
Pull Request: blender/blender#106098
This speeds up saving `070_0100.anim.blend` from the Heist project
from ~3s to ~300ms by adding PROPOVERRIDE_IGNORE in a few
places. It's not completely obvious to me when `PROPOVERRIDE_IGNORE`
should be used and when it shouldn't. Given that the same is done for
meshes already, it seems correct.
Pull Request: blender/blender#107196
Add texture usage flags for textures which are used as texture views
or require texture views for backing implementation.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#107163
Apply compilation fixes for Metal compatibility.
This includes explicit type casts, packed data types
where vec3 alignment is inconsistent, constructor replacement
with factory function.
The Metal shader generator also needs knowledge of when bound
resources are fundamental data types, so
SHADOWS_TILE_DATA_PACKED must be described as uint in
ShaderCreateInfo.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#107178
Caused by 6b8cdd5979.
Above commit introduced element tagging for boundary calculations but
only cleared them properly on all faces if the new `Preserve Seams`
option was chosen. We cannot be sure about the state of element tags
from prior operators though, so correct the culprit check to also only
be in effect if the new `Preserve Seams` option was chosen.
Pull Request: blender/blender#107161
Leverage new API call in Metal to increase the number of threads
dedicated to concurrent shader compilation. First step to improve
parallel compilation times when multiple engines are active.
Would also enable an increase in worker threads for shader
compilation jobs within the DRWManager.
Note that this is only available in the latest
version of macOS Ventura (13.3).
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#106625
The result of detecting if a quad should flip the default 0-2 split
when tessellated only used a pre-calculated normal when available,
since the method of detecting the flip was different, the check for a
concave face could change depending on the existence of polygon-normals.
In practice this meant cycles render preview could use a different
tessellation than the GPU display.
While [0] exposed the bug, it's an inherent problem with having 2
methods of detecting concave quads.
Remove is_quad_flip_v3_first_third_fast_with_normal(..) and always
use is_quad_flip_v3_first_third_fast(..), because having to calculate
the normal inline has significant overhead.
Note that "bow-tie" quads may now render with a subdivision in a
different direction although they must be very distorted with both
triangles along the 0-2 split pointing away from each other.
Thanks to @HooglyBoogly for investigating the issue.
[0]: 16fbadde36.
While this didn't cause bugs, initialize members to avoid problems
in the future.
GHOST::SystemX11
- m_keyboard_vector
- m_keycode_last_repeat_key
GHOST::Window
- m_cursorGrabInitPos
- m_userData
Generally, one does not know if the sharing info is currently shared
and should therefore be const. Better keep it const almost all the
time and only remove the constness when absolutely necessary
and the code has checked that it is valid.
The main challenge is to avoid dangling pointers. Currently, the lifetime of socket
declarations is somewhat unbounded (at least we didn't restrict it explicitly yet).
Therefore, storing non-owning pointers in it tricky. For ID pointers one could
potentially use the foreach-id iterator to update pointers in declarations as well,
but that's a bit out of scope and might not be the right solution anyway, since it's
not obvious that all node declarations are reachable from IDs stored in `bmain`.
The solution now is to use a callback that retrieves the right ID pointer when it
is used. The important thing is that the callback does not capture any potentially
dangling pointer either.
Pull Request: blender/blender#107179
When running oneAPI with AoT binaries, on hardware that's not compatible with
these, recompilation could have been missing from the kernels loading phase and
happen during execution instead.
These changes fixes it, any kernel compilation will now happen during the
kernels loading phase.
It was broken in two ways:
- bpy_bmlayercollection_iter passed PY_SSIZE_T_MIN, while
PY_SSIZE_T_MAX was needed.
- bpy_bmlayercollection_subscript_slice() contained an
off-by-one error.
Pull Request: blender/blender#107165
Completes the TODO in GHOST_SystemPathsCocoa::addToSystemRecentFiles
Also renames the filename parameter to the more appropriate filepath.
The recently opened/saved file will now also show up in:
- Blender Dock icon > Right click.
- Three finger swipe down in Open Blender i.e., App Expose
Based on a earlier contribution by @jenkm.
Pull Request: blender/blender#107174
After e45ed69349 we need to remove the existing attribute
when adding the rest position before evaluating modifiers. Also, adding
the rest position attribute was completely skipped in edit mode.
Pull Request: blender/blender#107190
The crash can occur in the following situations:
- Attempt to open a corrupted EXR file
- Attempt to save an EXR file under a non-existing directory.
The root cause is not really clear: for some reason the OpenEXE API on
the Blender side can not catch OpenEXE exceptions by a constant
reference to a std::exception, although it can by a constant reference
to an Iex::BaseExc.
This does not seem to be an issue with the OpenEXR library itself as
the idiff tool from our SVN folder catches the exceptions correctly.
It is also not caused by the symbols_apple.map as erasing it does not
make the problem go away.
It could still be some compiler/visibility flag which we were unable
to nail down yet.
The proposed solution is to add catch-all cases, mimicking the OIIO
tools. This solves the problem with the downside is that there are
no friendly error messages in the terminal. Those messages could be
brought as part of the workaround by additionally catching the
Iex::BaseExc exception. But probably nobody relies on those error
prints anyway, so added complexity in the code is likely does not
worth it.
Pull Request: blender/blender#107184
Animation: Adds a new "Parent Space" Orientation option for the Transformation Gizmo.
---
For child targets (objects, bones, etc) being able to transform in parent space is a desired feature (especially when it comes to rigging / animation).
For objects:
* with a parent, the gizmo orients to it's parents orientation
* without a parent, the gizmo orients to Global space
For Armatures:
* Child bone shows parent's space regardless if "Local Location" is set for parent bone
* For root bone **without** "Local Location" set, use the armature objects space.
* For root bone **with** "Local Location" set, use local bone space.
---
No new transformation orientation code needs to be written, we can achieve the desired results be using the existing `transform_orientations_create_from_axis`, `ED_getTransformOrientationMatrix`, and `unit_m3` methods. To do this, we check to see if the bone has a parent, if so, we use the bones pose matrix (`pose_mat`). This is done similarly for objects using the parent's object matrix (`object_to_world`).
Pull Request: blender/blender#104724
Scene.cpp and Geometry.cpp are large file it can be broken up into smaller easier to handle files. This change has been broken out from #105403 to make understanding the changes easier.
geometry.cpp is broken up into:
1. geometry.cpp
2. geometry_attributes.cpp
3. geometry_bvh.cpp
4. geometry_mesh.cpp
scene.h & scene.cpp is broken into:
1. scene.h
2. scene.cpp
3. devicescene.h
4. devicescene.cpp
Pull Request: blender/blender#107079
When a parent item was renamed, the `TreeView` was doing everything as
expected, however `AssetCatalogService::update_catalog_path` is supposed
to also update the catalog paths of all sub-catalogs [which it does --
but it does not tag sub-catalogs as having unsaved changes, resulting in
wrong saving of catalogs afterwards, meaning the parent item was saved
with the old name and a new item with the new name was created].
Now also tag sub-catalogs for having unsaved changes.
This should also go into 3.3 LTS
Pull Request: blender/blender#107121
The selection (box select, click select...) had an offset when selecting keys in the timeline.
That was because the function to get the NLA mapping ignored the timeline.
Pull Request: blender/blender#106904
The following properties were not library overrideable, but now are
* Line Thickness
* Color
* Custom Color Checkbox
Pull Request: blender/blender#106959
Currently when a baked curve is in the Graph Editor and normalization is enabled, it doesn't work.
It even throws a warning.
This patch adds the missing logic to normalize baked FCurves within a preview range.
Pull Request: blender/blender#106890
When using Xcode version 14.3 on Apple Silicon hardware a number of
regression tests fails. This change fixes this problem.
The root cause comes to the floating point contraction. It was already
disabled for GCC on Linux, but not for Clang on neither of Linux or
macOS.
Also corrected the comment about Clang default, as it as set to on
somewhere in 2021.
Pull Request: blender/blender#107136
Occlusion query buffers not being cleared to zero resulted in
erroneoues selection in certain situations.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#107135
Shader source requires explicit conversions and shader address
space qualifers in certain places in order to compile for Metal.
We also require constructors for a number of default struct types.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#106219
This patch adds several tools and options to the weight paint mode of Grease Pencil.
* Blur tool: smooths out vertex weights, by calculating a gaussian blur of adjacent vertices.
* Average tool: painting the average weight from all weights under the brush.
* Smear tool: smudges weights by grabbing the weights under the brush and 'dragging' them.
* With the + and - icons in the toolbar, the user can easily switch between adding and subtracting weight while drawing weights.
* With shortcut `D` you can toggle between these two.
* The auto-normalize options ensures that all bone-deforming vertex groups add up to 1.0 while weight painting.
* With `Ctrl-F` a radial control for weight is invoked (in addition to the radial controls for brush size and strength).
* With `Ctrl-RMB` the user can sample the weight. This sets the brush Weight from the weight under the cursor.
* When painting weights in vertex groups for bones, the user can quickly switch to another vertex group by clicking on a bone with `Ctrl-LMB`.
For this to work, follow these steps:
* Select the armature and switch to Pose Mode.
* Select your Grease Pencil object and switch immediately to Weight Paint Mode.
* Select a bone in the armature with `Ctrl-LMB`. The corresponding vertex group is automatically activated.
Pull Request: blender/blender#106663
This patch implements the ID Mask node for the realtime compositor.
The node can be implemented as a GPU shader operation when the
anti-aliasing option is disabled, which is something we should do when
the evaluator allows nodes be executed as both standard and GPU shader
operations.
Pull Request: blender/blender#106593
`make format` uses autopep8 to format Python, using a list of paths
specified in `tools/utils_maintenance/autopep8_format_paths.py`. The
scripts folder used to be a submodule inside release, but it is now at
the root of the blender repo.
This commit adds `scripts` to the list of paths to format.
Ref !107143
The comment didn't really make sense, since the removed code did the
same thing as the CustomData function anyway, and that's already done
in `mesh_init_data`.
Some callers that access the extension operated on the end of the path
even when there was no extension. Using this avoids having to assign
the end of the string using a separate check.
The file extension was copied into a buffer without checking it's size.
While large extensions aren't typical, some callers used small fixed
size buffers so an unusually named file could crash.
Runtime this information is stored in the active_color_attribute and
default_color_attribute strings on the mesh, however when saving it
is still saved in the old format with flags on the CustomData layers.
When converting from the strings to the layers not all flags were
properly cleared from the CustomData layers, leading to multiple
layers having the CD_FLAG_COLOR_ACTIVE/RENDER flag.
Implicit sharing means attribute ownership is shared between geometry
data-blocks, and the sharing happens automatically. So it's unnecessary
to choose whether to enable it when copying a mesh.
The typical order is vertex, edge, face(polygon), corner(loop), but in
these three functions polys and loops were reversed. Also use more
typical "num" variable names rather than "len"
Create a "nomain" mesh when converting intermediate representations
to a Mesh, meaning those areas don't have to know about data-block
names or the main database, and also that the boilerplate of adding
attributes individually can be avoided. The attribute arrays aren't
copied here, so the performance should be unaffected.
The nodes for inverting a color are named simply Invert, which begs the question: invert what?
This patch changes the naming for the node in Shading, Texture and Compositing nodes to *Invert Color*
This matches the naming of other color dedicated nodes like Separate Color or Combine Color
Pull Request: blender/blender#106750
Do not show asset metadata "description", "license", "copyright", or
"author" if they are empty AND read-only, since they can't be edited
and contain no useful information to show.
Pull Request: blender/blender#105812
Small fixes to recent file operations changes. FileOperations enum
starting with zero results in bad behavior with EnumPropertyItem. Typo
fix.
Pull Request: blender/blender#107138
Avoid copying the selected edges if all edges are selected, and
parallelize gathering the selection otherwise. Also use `int2` instead
of `std::pair`.
In simple test file I observed an approximate 10% FPS improvement,
though in real world cases the impact is probably much smaller.
Using the new HIP SDK 5.5 that includes a fix for the compiler bug.
This also enables the light tree.
For Linux the binaries are still disabled. ROCm 5.5 is planned to
include the same fix but not released yet. When that happens we
should be able to enable Linux as well.
Ref #104786Fix#104085
Pull Request: blender/blender#107098
Caused by uninitialized `ToolSettings` `GpPaint` [which was later
accessed in `BKE_gpencil_palette_ensure`].
Not 100% sure why `ToolSettings` `GpPaint` is properly initialized in a
default startup fille, but for some files, this was not the case (as in
the report)
See 22462fed00 for a similar commit.
Now initialize `ToolSettings` `GpPaint` (alongside `GpVertexPaint`) when
entering grease pencil vertex paint mode.
Should probably go into LTS releases as well.
Pull Request: blender/blender#107131
Muting a VSE channel does not mute the sound, this is caused by lack
of depsgraph updates for sound when mute state changed for the channel.
Now fixed.
Caused by ad146bd17a
Pull Request: blender/blender#107116
The dpcpp folder grew from 200M to 500M with the last update
due to lld being enabled and having 5 different copies in the bin
folder. We do not need to ship lld so it can be safely removed.
However previous harvest cleaned up the build folder before copying
the libs to their final destination in output, this will no longer
work, since we actually do need lld to build embree.
So copy to the full build folder to output first, then remove the
binaries we do not need. Embree will use the binaries in the build
folder so it will be unaffected by this.
Before the add node search refactor and link-drag-search, nodes were
filtered out based on whether they worked with the active render
engine. For example, the Principled Hair BSDF node doesn't work with
EEVEE, so it isn't displayed in the UI. While we might want to relax
this in the future, we have no better way to show that they don't work
right now, so it's best to keep that behavior.
The filtering is implemented with a new node type callback, mainly
to reduce the boilerplate of implementing many node search callbacks
otherwise. It's also relatively clear this way I think. The only
downside is that now there are three poll functions.
I didn't port the "eevee_cycles_shader_nodes_poll" to the new
searches, since I don't understand the purpose of it.
Pull Request: blender/blender#106829
The resolution of the driver value RNA path was using the wrong
property (it was forced to be referenced relative to the ID).
Pull Request: blender/blender#107129
Change the "displist to mesh" conversion to use the edge calculation
function used everywhere else, to allow removing the old code. This
changes edge vertex and corner edge indices, requiring a test update,
but the visual result should be the same.
Add the ability to retrieve implicit sharing info directly from the
C++ attribute API, which simplifies memory usage and performance
optimizations making use of it. This commit uses the additions to
the API to avoid copies in a few places:
- The "rest_position" attribute in the mesh modifier stack
- Instance on Points node
- Instances to points node
- Mesh to points node
- Points to vertices node
Many files are affected because in order to include the new information
in the API's returned data, I had to switch a bunch of types from
`VArray` to `AttributeReader`. This generally makes sense anyway, since
it allows retrieving the domain, which wasn't possible before in some
cases. I overloaded the `*` deference operator for some syntactic sugar
to avoid the (very ugly) `.varray` that would be necessary otherwise.
Pull Request: blender/blender#107059
Caused by 2eeec49640.
Above commit would early out when falling through the specialized
greasepencil selection operator to view3d_select_exec. But in order to
select posebones in grease pencil weightpaint mode, we still have to
continue with view3d_select_exec.
Now check this special case [with convenient
`BKE_object_pose_armature_get_with_wpaint_check`] and DONT early out in
that case.
Should go into 3.3 LTS as well.
Pull Request: blender/blender#107076
When a node input is connected to a group node input that is unlinked
and is of a different type, no implicit conversion takes place, so the
value is unexpected.
This patch fixes that by considering the types of both sockets and do
implicit conversion if necessary.
Reverts dcb2821292 but handles
the linker error by relying on target_link_libraries deduplication.
Reverts 18a15bafe8 but handles
blender_test linking after dependency change by passing
lib to target_link_libraries itself.
Closes#107033
While replacing the extension with an empty string works,
it required a redundant string-size argument which took a dummy
value in some cases. Avoid having to pass in a redundant string size by
adding a function that strips the extension.
The internal utility get_sequence_len would make it's filename
argument absolute so as to scan it's directory for files.
Perform this on the directory instead so the filename can be const.
Finding the extension included hidden files (starting with a '.'),
now finding the extension matches Python's `os.path.splitext` behavior
which has the advantate a hidden file is not considered one long
extension - with an empty name part.
Also update code to use BLI_path_extension in cases which previously
in-lined this logic.
BLI_path_frame_get path argument is now const,
it was being manipulated unnecessarily.
This adds new movement types TEXT_BEGIN and TEXT_END to allow
FONT_OT_move and FONT_OT_move_select operators move the text
cursor (caret) to the top and bottom of the text.
Pull Request: blender/blender#106196
During createOffscreenContext with VK backend enabled wl_surface
was not stored in the context's user data. This resulted in nullptr
dereference later on during disposeContext. Added a line that sets
user data and additionally added nullptr checks in disposeContext.
Ref !107057.
Updated Embree 4 library with GPU support is required for it to be
compiled - compatiblity with Embree 3 and Embree 4 without GPU support
is maintained.
Enabling hardware raytracing is an opt-in user setting for now.
Pull Request: blender/blender#106266
This allows toggling of text styles of selected text and at the current
mouse cursor position if nothing is selected.
Pull Request: blender/blender#107048
Use the attribute API for domain and type interpolation instead of doing
it manually. I observed a 3.8x improvement in curve selection mode and
an 18x improvement in point selection mode.
Adds a submenu to the File Browser selected item context menu that
allows opening the item or viewing the location in an OS browsing
window. On Win32 also allows other actions like editing, searching,
opening command prompt, etc.
Pull Request: blender/blender#104531
This reverts commit df096eab77.
There is a corner case for when WITH_CYCLES_ONEAPI_BINARIES is set to on
and later turned off during config, in case there is no ocloc.
This happens when the collection's item type doesn't have a
'nameproperty' to index with. For debug builds we error out with an
assert, since in general this shouldn't happen. For release builds
Python will report item not found.
Pull Request: blender/blender#107086
We don't use the callbacks that create virtual arrays from the custom data
anymore, they just add extra indirection. The only non-obvious case was
the crease attribute which had a setter function. Replace that with an
attribute validator like the other similar attributes.
Pull Request: blender/blender#107088
A solution for an older bug was causing it.
Added a special case to avoid an extra relation for context
variables as they do not change during the dependency graph
evaluation,
Pull Request: blender/blender#107082
Make the `remove_if` function for `Vector`, `VectorSet`, `Set`, and `Map` return the number of elements it removed.
Pull Request: blender/blender#107069
- Avoid unnecessary topology tag
- Copy from offsets in one line
- Comment formatting
- Avoid describing future changes in comment, let the code stand on its own
* Make the drawing smoother/anti-aliased.
* We use the alpha to blend between the background and the zone color.
* If alpha is 100% we then get to see the dotted background again
* Change zone corner radius to match nodes/layout.
If we want to set the background transparent again we need to do:
```
- immUniformThemeColorBlend(TH_BACK, TH_NODE_ZONE_SIMULATION, zone_color[3]);
+ immUniformThemeColor(TH_NODE_ZONE_SIMULATION);
```
For the design behind some of those change see #106810
Pull Request: #107043
Update the RNA and DNA documentation for two bone matrices:
- `PoseBone.matrix_channel` (`bPoseChannel::chan_mat` in DNA) contains
the evaluated loc/rot/scale channels, including constraints and drivers.
- `PoseBone.matrix` (`bPoseChannel::pose_mat` in DNA) contains the same
transform, but then expressed in the armature object space.
No functional changes, just clarifications in comments / tooltips.
While embedded IDs are usually considered as private local data of their
owner ID, some areas of code, like the depsgraph, can consider them as
regular IDs in some aspects.
So when swapping IDs, also properly 'counter-swap' their potential
embedded IDs, such that the pointers to the embedded IDs remain as before
swapping, even though the data of the embedded IDs is swapped.
The main target of this change is memfile undo code. There, newly read
IDs are swapped with their oldder version, so that the old address
contains the new data. This allows to avoid rebuilding some of the
depsgraph. Doing the same thing for embedded IDs should reduce even
further the needs for depsgrah rebuilds on undo steps.
This commit also gives more control over the remapping of 'self' ID
pointers inside themselves.
Pull Request: blender/blender#107044
- Split out WM_init_splash_on_startup(..) which performs startup checks.
- WM_init_splash(..) now shows the splash (ignoring preferences).
- Avoid calling BLI_exists on an empty string (in some cases).
Recent failures requiring investigation have exposed some shortcomings
that this addresses:
- When creating the diff image for offline comparison, use a higher
threshold to prevent idiff from printing more output which will often
contradict the primary failure output just above it (very confusing)
- For metadata failures, make sure these get printed so it's obvious
what kind of failure we're dealing with
Pull Request: blender/blender#107058
After 17800e0c03, the oneAPI kernels library was still able to find sycl6.dll but that wasn't reliable.
We fix this by moving the oneAPI kernels library also into blender.shared.
Pull Request: blender/blender#106894
Due to floating point differences between importance sampling and
texture evaluation, disagreeing on whether or not a ray lies within
the sun disc.
* Use the same input values for geographical_to_direction() in
sky_radiance_nishita() and kernel_data.background.sun.
* The mathematical operations in pdf_uniform_cone() were adjusted to
match sky_radiance_nishita().
Pull Request: blender/blender#106764
This is the first step for refactoring the lightcache system.
Each probe instance (as in `Object`) will now store its own baked data.
The data is currently stored in uncompressed readable format.
This introduces two new operators for baking to avoid confusion with
the previous light baking pipeline. These do nothing other than
creating empty caches that will be populated by EEVEE later on.
The DNA storage is made to be able to include multiple caches
in case of baked simulation over time but it isn't yet supported.
I prefer to keep the implementation simple for now as the long term
goals for this feature are uncertain.
There is still a type flag (`LightProbeObjectCache.cache_type`) that
will be used for versioning.
The naming convention of structs is a bit weird but that's all I
found in order to avoid interfering with the old scene light cache
that is still used by (old) EEVEE.
Related task #106449.
Pull Request: blender/blender#106808
For non-object parents (so bones & vertices), the parent is now also
explicitly checked for animation. In other words: having an animated
parent will cause the transform of the child to be written to Alembic/USD
on every frame (as if it is animated itself).
Copying a simulation zone should keep the 1:1 pairing intact (see `remap_pairing` functions)
- When copying a simulation input node on its own, unpair it to avoid ambiguity. Only the old simulation input node is paired to the output.
- When copying a simulation output node on its own, no special action is needed - the node gets a new ID and nothing is paired with it.
- When copying both input and output, remap the `output_node_id` property of the simulation input node, so that it is paired with the output copy.
There are a couple of places where copies happen:
* Node tree copy
* Duplicate nodes
* Group Separate (copies nodes from the group tree into another tree)
* Clipboard (both copy to clipboard and paste into node tree)
* Shader node tree branch copy for execution
These copy operators do mostly the same thing, but in slightly different ways, which makes the code incompatible (e.g. using a `Map<const bNode *, bNode *> node_map` vs. `Map<bNode *, bNode *> node_map`). That's why there are 3 `remap_pairing` implementations.
Dynamic node declarations are problematic:
Copying nodes invokes `nodeDeclarationEnsure` to generate declarations for new nodes. It does not, however, change the socket lists. If a dynamic declaration for a node copy alters the sockets (in this case: remove all because the node is unpaired), the subsequent `update_socket_declarations` will crash because it expects sockets to match the declaration.
At the end of operators there is usually a `BKE_ntree_update_main` or similar, which invokes `update_node_declaration_and_sockets`. This method _does_ update the socket lists as well (see #106732), but only if a node is tagged for a respective update.
The solution here is to use `update_node_declaration_and_sockets` for dynamic declarations instead of just `build_node_declaration_dynamic`.
Pull Request: blender/blender#106812
Do not read IDs from types flagged as 'no undo', whether they are local
or linked.
This should have no effect currently, since all 'no undo' ID types
currently are supposedly only local data anyways (Screen, WindowManager
and WorkSpace).
These IDs kept their address, but their content has been replaced
(re-read from the memfile undo step). Add an ID tag to identify them.
As a further cleanup, systematically tag these IDs for despgraph COW,
since their data is effectively modified (though in practice all of
these IDs are expected to already have other update tags anyway).
No change in behavior is expected from this commit.
This should not have much effective consequences with current code, but
fixes potential missed remappings for e.g. some nodetree pointers in the
node editor, or the `parent` pointer of collections to a scene's master
collection.
Implements #95966, as the final step of #95965.
This commit changes the storage of mesh edge vertex indices from the
`MEdge` type to the generic `int2` attribute type. This follows the
general design for geometry and the attribute system, where the data
storage type and the usage semantics are separated.
The main benefit of the change is reduced memory usage-- the
requirements of storing mesh edges is reduced by 1/3. For example,
this saves 8MB on a 1 million vertex grid. This also gives performance
benefits to any memory-bound mesh processing algorithm that uses edges.
Another benefit is that all of the edge's vertex indices are
contiguous. In a few cases, it's helpful to process all of them as
`Span<int>` rather than `Span<int2>`. Similarly, the type is more
likely to match a generic format used by a library, or code that
shouldn't know about specific Blender `Mesh` types.
Various Notes:
- The `.edge_verts` name is used to reflect a mapping between domains,
similar to `.corner_verts`, etc. The period means that it the data
shouldn't change arbitrarily by the user or procedural operations.
- `edge[0]` is now used instead of `edge.v1`
- Signed integers are used instead of unsigned to reduce the mixing
of signed-ness, which can be error prone.
- All of the previously used core mesh data types (`MVert`, `MEdge`,
`MLoop`, `MPoly` are now deprecated. Only generic types are used).
- The `vec2i` DNA type is used in the few C files where necessary.
Pull Request: blender/blender#106638
Animation data (including drivers) on inactive view layers now work. The
removal of such view layers was too optimistic; they are now kept
around. The bases are still removed, mostly for safety sake and to keep
the changes to a minimum.
`scene_remove_unused_view_layers()` has been renamed to
`scene_minimize_unused_view_layers()` to reflect its new functionality.
For compatibility with assumptions in other areas of the code, the
function still ensures the input view layer is at index 0.
This also introduces a new function
`BKE_view_layer_free_object_content(view_layer)`, which is a subset of
the functionality of `BKE_view_layer_free()`.
Having a type defined allows the compiler to help with type safety. For
example we can use it in switches to trigger a warning when a new object
type is added but not covered by the switch yet (but probably should).
Currently, when using the python api for offscreen drawing, the
default background will always be rendered into the GPUOffScreen's
framebuffer, rendering the alpha channel essentially useless and
making it difficult to separate objects from the background.
This patch allows offscreen drawing of a 3d view with transparent
background by exposing an optional parameter to the python api,
enabling, for example, compositing the result over another image.
The new parameter to draw_view3d() is optional, with the default
value matching the previous behavior, so this change is fully
Pull Request: blender/blender#105748
Previously, there was a "main" and "tmp" buffer and the final
result was expected to be in the "main" buffer. Now the two buffers
are called a and b and the final result can be in either of those.
This can improve performance especially if the number of iterations is low.
Pull Request: blender/blender#106860
`PyObject_GetBuffer` was used without checking that it was successful.
This could cause the code to access an incompatible or uninitialized
`Py_buffer`.
Add the missing checks, and clears the raised `PyExc_BufferError`
to silently fall back to accessing the PyObject as a sequence.
Using a "//" prefix resolves to the root directory which isn't a good
default as it typically doesn't have write permissions.
Only set the name and let the file selector pick a directory to use
(matches how saving from the text editor works).
Add WM_window_pixels_read & WM_window_pixels_read_sample that
use front-buffer pixel reading when supported.
Note that direct access to reading from the front-buffer is still needed
for writing thumbnails - where redrawing can cause problems
(see code-comments).
Expand on why front-buffer support is always disabled on Wayland &
why viewport orbit around selection offset correction isn't used for
perspective views.
Bezier curve position evaluation expects the handle position attributes
to exist and doesn't handle the case where they don't. Swith to using
a utility function to evaluate each curve type so Bezier evaluation can
stop early in that case.
Fixes a bug introduced in b0b9e746fa.
The volume transformation matrix is multiplied in the wrong order
which means the grid scale is applied on the translation.
Default settings changed for Sculpt mode's
Paint Brush, Smear Brush, and Smear Brush.
~~This includes updates of PR review #105691.~~
Updated to only include commits relevant to this PR.
Reviewed by: Joseph Eagar & Julian Kaspar
Pull Request: #105759
commit 7aa5e65dcbda862dcb17ecfc6727eb241a12c316
Merge: c08a9ec19f 7c9e493da55
Author: Joseph Eagar <joeedh@gmail.com>
Date: Sun Apr 16 15:11:53 2023 -0700
Merge branch 'main' of https://projects.blender.org/ChengduLittleA/blender into ChengduLittleA-main
commit 7c9e493da55a4adbfa2415b711e6d0daa2720ad9
Author: YimingWu <xp8110@outlook.com>
Date: Fri Mar 31 17:46:32 2023 +0800
Fix#106358: Handles null evaluated object when entering sculpting workspace.
The setup where everything in the scene is invisible/not enabled could
trigger a crash when switched to sculpting workspace, triggered when
opening the file.
This patch handles such situation.
Changed the menu operators:
Expand Mask by Topology (hotkey Shift A)
Expand Mask by Normals (hotkey Shift Alt A)
Expand Face Set by Topology (hotkey Shift W)
Expand Active Face Set (hotkey Shift Alt W)
so that their hotkeys would appear in their menu entries.
Resolves#104023
Co-authored-by: DisquietingFridge <30654622+DisquietingFridge@users.noreply.github.com>
Pull Request: #104568
Rebased for main instead of sculpt-dev
Decompose most of the nesting in the code to make the code
more consistent along the line of program execution.
Mainly achieved through:
- Remove redundant else
- Invert condition
- Add temporary variable to redistribute and name conditions
Pull Request: blender/blender#105509
This adds an WM_capabilities_flag to indicate that a platform
implements support for copying and pasting images using a shared
clipboard.
Pull Request: blender/blender#106990
A few fixes included here:
- Use `reserve` properly to add space after the first mesh
- Add to the end of the UVs array instead of replacing it for every mesh
Also, a cleanup/simplification:
- Split face size and face vertex loops, they are independent
Pull Request: blender/blender#106967
- Use off-screen drawing when reading from the front-buffer isn't
supported.
- Add a capabilities flag for reading the front-buffer which is always
disabled on WAYLAND.
- Add GPU_offscreen_read_pixels_region, used for reading a sub-region of
an off-screen buffer - use for color-picking a single pixel.
Orbit around selection didn't work well in orthographic views,
potentially causing viewport offset to drift during navigation
to the point content would be outside the far clipping range.
Resolve by aligning the view offset depth with the dynamic offset
being orbited around.
Currently the Textures used for offscreen rendering don't have
the `GPU_TEXTURE_USAGE_HOST_READ` flag. But some cases it is
needed. This PR adds a parameter when creating an offscreen
buffer.
Other solution could be to add this flag to all textures, but
we chose not to do this as that reduces the amount of fine-tuning
options for Metal/Vulkan backends. GPU can store textures
differently based on its actual usage.
This option isn't available in the python API as we don't expect
add-on developers to fine-tune texture usages to this extent.
For convenience `GPU_TEXTURE_USAGE_ATTACHMENT` is by default
always added.
Pull Request: blender/blender#106899
Cleaned up sculpt code to store lists of `PBVHNodes` with
`blender::Vector` instead of simple pointer arrays. This is much
simpler and eliminates memory leaks caused by forgetting to free
the result of `BKE_pbvh_search_gather`.
Notes:
* `BKE_pbvh_search_gather` is now `blender::pbvh::search_gather`.
* `FilterCache` and `ExpandCache` have ownership over their .nodes
members; as a result they're no longer pure C structs and
are allocated with `MEM_new`/`MEM_delete`.
* The word 'totnode' no longer occurs anywhere in
`source/blender/editors/sculpt_paint`
Todo (not for this PR): create a new properly C++ task API for sculpt
(with lambdas) and use it for brushes.
Pull Request: blender/blender#106884
Re-organize ID tags in a more logical way, and keep their values
strictly increasing, splitting the free available ones in-between the
main groups (to avoid having to edit all tags values when adding a new
one).
Note that shuffling around these ID tags values should not be an issue
anymore, all of these are strictly run-time, and fully cleared in write
code when writing into a .blend file.
This also lead to the second cleanup, which is removing some asserts on
ID tag values in readcode, these are useless since the tag is cleared on
write.
Embedded IDs did not benefit from any of the recent optimizations
(especially for undo case) when writing regular IDs (cleaning up of some
pure runtime data that would generate a lot of fake 'changed on undo'
status).
Now factor out of `write_file_handle` this part of the code generating
temp ID copy with cleaned-up data for writing, and expose it in BLO API
such that IDs owning embedded ones can also use it.
Code there was fairly naive and simple, missing some ID pointers,
sometimes improperly accessing non-ID data as IDs (usual dear Outliner
tree element usages of its 'ID' pointer...).
And code was especially quite severely broken in case these UI ID
usages were processed in a non-readonly context (i.e. if some of these
ID pointers were expected to be modified).
Code has been updated following existing very similar code in
`lib_link_workspace_layout_restore` from `readfile.cc`.
Code re-reading new ID pointers addresses inside readfile process would
not ensure that the 'ID' pointer of the outliner's treestore element is
actually a real ID pointer, and not a 'fake' one.
Probably harmless in practice, though this could have potentially been
the cause of extremely random rare crashes or corruption...
The build seems to complain without this, though theoretically it isn't
meant to be necessary. Though keeping them defined can potentially
avoid quadratic lookups too.
Similar to 7eee378ecc, this change decreases memory usage and
improves performance when copying curves and meshes without changing
their topology. The same change used for custom data layers is applied
to face and curve offset indices, which aren't stored as a custom data
layer.
The implicit sharing info for the offsets is stored in the mesh and
curve runtime structs, since it doesn't need to be written to files
directly. When changing the offsets pointer directly, the sharing info
must be updated accordingly. To make that easier, a few utility
functions take care of common operations like making an array mutable,
resizing an array, and creating sharing info for allocated data.
This commit also clarifies the intention to not allocate the offsets
at all when there are no curves/faces. That slightly complicates some
of the logic, but there's no reason for the single `0` integer to be
allocated.
Pull Request: blender/blender#106907
This commits adds some new, specific flags to further control ID
remapping process (like and option to skip user refcounting completely).
It also adds a new function to do 'raw' remapping, without any extra
post-processing, depsgraph tagging, etc. This is not used currently, but
will soon be needed by readfile post-processing code changes.
There is also some small cleanups and reorganization in that area of code,
the main noticeable change being the switch from a short to an int for
the flags controlling remapping code (using short here does not give
any benefit, and makes it harder to switch to integers when it becomes
necessary).
No change in behaviors are expected from this commit.
This type will be used to store mesh edges in #106638, but it could
be used for anything else too. This commit adds support for:
- The new type in the Python API
- Editing the type in the edit mode "Attribute Set" operator
- Rendering the type in EEVEE and Cycles for all geometry types
- Geometry nodes attribute interpolation and mixing
- Viewing the type in the spreadsheet and using row filters
The attribute uses the `blender::int2` type in most code, and
the `vec2i` DNA type in C code when necessary. The enum names
are based on `INT32_2D` for consistency with `INT8` and `INT32`.
Pull Request: blender/blender#106677
The extrude node resizes an existing mesh, but doesn't initialize new
data for most non-generic data types like shape keys or freestyle tags,
or custom normals. The split edges node doesn't process some
similar vertex data too.
In the future this data can become generic attributes, or it can be
supported in the nodes anyway. But now the new data is un-initialized
after being allocated.
Fixes#106926
When hitting normalize in the Graph Editor, it would frame the y-extents of the visible part of the FCurves.
Now, when a preview range is set, it frames the part of the FCurves in the preview range.
Pull Request: blender/blender#106888
Note, at the moment it is using the last login as a criteria to
whether the person should be listed (comparing it to 2 years past).
However anyone who hasn't logged in in gitea yet shows as last login 1970.
To run this you need to install all the required python packages and
generate a token with scope "read:org" or "admin:org".
See:
infrastructure/blender-projects-platform#55
`BKE_mesh_nomain_to_mesh` expects the object's data to be the mesh.
Also, the curve to mesh conversion can return a null pointer, so use
an empty mesh in that case. Thanks to Falk David for finding these.
This is the case e.g. of the `parent` collection pointer of collections
children of a scene's master collection, or some nodetree pointers in
the UI data (node editor).
Right now handling of this new flag is exactly the same as in owning
embedded case, the distiction between both usages will happen in future
commits.
This commit is expected to have no behavioral change at all.
The built-in brush identifier didn't match the enum name causing
brush assignment not to update the tool-system (clearing the tool).
Resolve by using generate_from_enum_ex(..) to avoid each brush
definition having to manually duplicate enum definitions.
Expose the full enum including separators and section titles,
useful for the tool system so it's possible to read separators
from brush enums (not part of this commit).
Also avoid using a dict as a default argument. While it didn't cause
problems - in general it's bad practice and worth avoiding as any
modifications produce strange behavior.
A buffer is a technical term most often referred to using the metaphor
of a "clipboard" in applications. However, the "clipboard" is usually
the system clipboard, used to carry data accross applications. To
avoid confusion, this replaces "clipboard" by "internal clipboard"
when not dealing with the system clipboard.
In addition, a few places still used the "[copy/paste] buffer"
terminology, so they are replaced with "internal clipboard as well.
The replacement from "[copy/paste] buffer" to "clipboard" was
undertaken in previous commits da6d6f99a8, 14b60c3a1c. This
commit should tackle the remaining occurrences.
Pull Request: blender/blender#106060
Adds "quick tooltips" to quickly see the name of a tab in the Properties
editor. (See patch for visuals.)
From own experience users are often confused about the name of the different
tabs, and I always found the delay to see it in the tooltip annoying. These
quick tooltips have been introduced for the toolshelf and solve this issue
nicely here. There is still a delay so that simple mouse movements won't
trigger the tooltips, but they show up a lot faster than normal tooltips now.
This may have the side-effect that icon only enum-item buttons will show the
enum name when there is no RNA property description. Previously we wouldn't
show this, even if available.
Pull Request: blender/blender#106906
This revision moves the vertex color reading and writing in the USD import and export functions over to the new Mesh Attributes API. I have removed anything else (new features or unnecessary changes) that was present in the prior patches to focus only on this task.
On the import side, I've introduced a class method named read_custom_data. In this function is the call-out for reading mesh colors. As requested, this function is intended to be the starting point for future Attribute reads, with methods like the new read_color_data* methods being called when a USD primvar matches a specific heuristic. UVs will (in the future, not in this revision) also need to be processed here. In a later patch, any primvars that do not match a heuristic can be imported as generic Attributes. There is a matching function on the export side, write_custom_data.
Attached is a .blend file for testing. The plane has five Color Attributes. The colors should be visibly the same when exported and re-imported.
I have also enabled color attribute imports by default. I believe it would be counter intuitive for most users for this feature to be off-- it means that at some point, a person round-tripping with default settings will lose data.
Pull Request: blender/blender#105347
Vulkan uses IMath. IMath on windows requires an option to indicate
it is used as dll file. This option wasn't set for the GPU module.
Thanks to Kazashi Yoshioka for mentioning this.
Pull Request: blender/blender#106932
Previous fix to resolve GPU hang which could occur in the
Metal backend caused additional flickering to occur as
as side effect, due to removal of required execution
dependencies in certain places.
This patch resolves both problems by only removing the
GPU hang dependency stall when additional synchronization
primitives are used along-side the global sync primitive.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#106914
Changes to [0] which worked as intended but used confusing naming.
- The note on using -1 for the active layer causes an assertion.
- The doc-string was above the wrong function.
- The meaning of the `_n()` suffix was flipped,
where the `layer_index_n` refers to an absolute index across all
layer types which is done internally for an index calculated from the
`layer` argument, not the argument it's self which is a UV index.
Rename BM_uv_map_get_offsets_n to BM_uv_map_get_offsets_from_layer.
[0]: 412b6a8f65
Apply the changes suggested at #103782
It includes:
- Draw dot at the origin the active gizmo
- Hide other gizmos while dragging (except the move arrows)
Other changes:
- Draw shadow for the move and scale circle gizmos (while transforming)
Pull Request: blender/blender#104624
Some properties may have the pointer stored in the gizmo structure
itself.
Reading from the struct directly is useful for cases where the value is
accessed frequently but not often required by the caller.
A disadvantage is that the property may not be saved in the file.
If there is not enough space for the Color Picker either above or below
the launching button, adjust the position to fit instead of clipping.
Pull Request: blender/blender#106122
Similar to e35f971da1. We aren't meant to rely on the
zero-initiatialization on creation anyway. I observed a small (a few
percent) decrease in minimum runtime in the geometry nodes points node.
The position attribute has special meaning for point clouds, and
meshes and curves have access methods for the attribute as well.
This saves boilerplate and gives more consistency between types.
The OSL GPU services implementation of noise intrinsics was missing the
overloads for derivatives and therefore OptiX pipeline creation would fail if
those were referenced.
This integrates the new implicit-sharing system (from fbcddfcd68)
with `CustomData`. Now the potentially long arrays referenced by custom
data layers can be shared between different systems but most importantly
between different geometries. This makes e.g. copying a mesh much cheaper
because none of the attributes has to be copied. Only when an attribute
is modified does it have to be copied.
Also see the original design task: #95845.
This reduces memory and improves performance by avoiding unnecessary
data copies. For example, the used memory after loading a highly
subdivided mesh is reduced from 2.4GB to 1.79GB. This is about 25%
less which is the expected amount because in `main` there are 4 copies
of the data:
1. The original data which is allocated when the file is loaded.
2. The copy for the depsgraph allocated during depsgraph evaluation.
3. The copy for the undo system allocated when the first undo step is
created right after loading the file.
4. GPU buffers allocated for drawing.
This patch only gets rid of copy number 2 for the depsgraph. In theory
the other copies can be removed as part of follow up PRs as well though.
-----
The patch has three main components:
* Slightly modified `CustomData` API to make it work better with implicit
sharing:
* `CD_REFERENCE` and `CD_DUPLICATE` have been removed because they are
meaningless when implicit-sharing is used.
* `CD_ASSIGN` has been removed as well because it's not an allocation
type anyway. The functionality of using existing arrays as custom
data layers has not been removed though.
* This can still be done with `CustomData_add_layer_with_data` which
also has a new argument that allows passing in information about
whether the array is shared.
* `CD_FLAG_NOFREE` has been removed because it's no longer necessary. It
only existed because of `CD_REFERENCE`.
* `CustomData_copy` and `CustomData_merge` have been split up into a
functions that do copy the actual attribute values and those that do
not. The latter functions now have the `_layout` suffix
(e.g. `CustomData_copy_layout`).
* Changes in `customdata.cc` to make it actually use implicit-sharing.
* Changes in various other files to adapt to the changes in `BKE_customdata.h`.
Pull Request: blender/blender#106228
This function was not exposed outside of internal GPU module.
Renaming `draw::Texture::depth()` to `is_depth` for consistency
and removing the ambiguity.
Some functions changed slightly for this non beta release.
No functional changes though as we didn't use what was removed.
Pull Request: blender/blender#106861
The fast_float is an external library, so move it to the
system includes which has less strict compiler flags applied.
This matches how other IO module use this library as well.
Pull Request: blender/blender#106892
When WITH_CYCLES_DEBUG is set to ON the following errors are
printed to the console:
E0412 15:51:22.588564 7996345 sync.cpp:737] Unknown pass Guiding Color
E0412 15:51:22.588605 7996345 sync.cpp:737] Unknown pass Guiding Probability
E0412 15:51:22.588613 7996345 sync.cpp:737] Unknown pass Guiding Average Roughness
This change fixes this by treating the guiding passes the same
way as all other passes, solving the errors and making it possible
to visualize guiding passes in the viewport later on.
Pull Request: blender/blender#106863
This PR reverts the breaking part of the #106535. This part doesn't seem
to be required to fix the HD4400-HD5500 issue.
Might also fix#106844.
Pull Request: blender/blender#106887
Changes to viewport state to resolve texture paint color
selection introduced a side effect wherein the correct
attachment size of a framebuffer was reset. This size is
needed when scissor regions are disabled to return the
state to its correct default. When this default was wrong,
certain operators would have incorrect offsets.
To maintain consistency with the OpenGL backend, the
Metal backend independently tracks the raw attachment
size using default_width/height. This will also reset to zero
when attachments are all removed, unlike other state which
may be retained.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#106857
After double clicking a file, user can click on a different app and
Blender will lose focus. Then it stays on splash screen. So fetch any
window instead of relying on active one to open the file.
pull request #106769
This reverts commit 4fe2685615.
Always use the preferred_scale requested by the compositor as this
did not work so well in the intended use case (where the low resolution
monitor text was scaled down and difficult to see).
After discussion with @ZedDB, revert this change since there are cases
where either functionality might be preferred - to ensure Blender's UI
is visible on a low resolution mirrored projector for e.g.
Changing the behavior of the preferred scale makes most sense in the
compositor, instead of controlling it on a per-application basis.
GCC did not support mold when support was initially added,
since then GCC has been updated to add support, removing the need
to point to a binary directory containing an alternative `ld` command.
Support for MOLD_BIN CMake option has been kept as mold may be installed
to standard location.
Use names:
- `tool_settings` instead of `ts`.
- `props` instead of `op` / `prop` / `op_props`
As Python may reference operators, don't confuse the operator
properties with an instance of the operator.
In both cases these names were already used for most scripts.
I cleaned up the cube brush tip code quite a bit; more remains
to be done. There is a new function to initialize cube
tip matrices, SCULPT_cube_tip_init. It's currently only
used by the paint brush, I'll need to do a bit of testing
before using it for clay strips and multiplane scrape.
Note: SCULPT_cube_tip_init uses the brush local matrix code
to avoid code duplication (and to take advantage of the debouncing
that is done there).
Nodes with names separated by a slash / can
not be searched by their initials.
This commit adds the slash character to
the list of separators for this type of
fuzzy search.
Pull Request: blender/blender#106838
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
To avoid unpaired simulation inputs or outputs, whenever deleting such
nodes the respective paired node should be deleted as well. A simple
utility function selects paired nodes before the delete operator removes
them.
This does not affect API methods, which still remove only individual
nodes. The feature is primarily a workflow improvement.
Resolves#105728
Pull Request: blender/blender#106597
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.
Simulation input and output nodes are currently added individually, but they always need to exist as pair. This PR modifies the _Add Node_ menu so that a single menu entry adds and input and output node together.
The `NODE_OT_add_node` operator currently adds just a single node type. A new variant of this operator is added which adds a _simulation zone_ with origin + target node instead. This requires some modification of the `NodeAddOperator` base class, moving the `node_type` property into the final implementation. Unlike the `NODE_OT_add_node` operator, the `NODE_OT_add_simulation_zone` adds 2 different node types.
After adding the two nodes, a reference needs to be added to "pair" them: Input node ("origin") stores the UID of the output node ("target") in its `output_node_id` property. So far this was detected automatically when adding an input, but this method is not very robust (e.g. it depends on order of adding nodes and adding multiple pairs can be tricky).
Now the pairing is done explicitly through an API function `node_geo_simulation_input_pair_with_output`. The `NODE_OT_add_simulation_zone` operator performs pairing of the input/output nodes after adding them. The function is accessible through RNA, so an operator may be added if necessary to allow users to fix unpaired nodes.
In addition to pairing the two nodes, the operator also positions them at a comfortable distance, as well as adding a default link between the two Geometry sockets for convenience.
Resolves#105727
Pull Request: blender/blender#106557
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
Avoid creating a lazy function for the `Simulation Input` node if the `output_node_id` is invalid. This can happen when e.g. the output node is deleted without also deleting the input node. The lazy function assumes a valid output ID and will crash if the output node does not exist.
Pull Request: blender/blender#106585
To prepare for OIDN2 with GPU support, some of the code that was exclusive to the OptiXDenoiser is being moved to the DenoiserGPU superclass.
Co-authored-by: Stefan Werner <stefan.werner@intel.com>
Pull Request: blender/blender#106496
Any errors from calling `bpy.ops.render.render(write_still=True)` would
be suppressed, making it impossible to know what went wrong.
Now the operator now reports errors when run via `exec` which mainly
occurs when the operator is called from scripts.
Interactively rendering via `invoke` is left as-is since users can see
the error in the UI and showing a popup error is disruptive.
The assets are required to build proper Blender release, so they can not be
skipped from packing.
The packing ignores the `working` directory as it seems to be big and sounds
that it is not needed for the release.
The assets are bundled under the `release/datafiles/assets` folder in the
blender sources. This is where they will reside after switch to the Git LFS.
Pull Request: blender/blender#106536
Use the latest Wayland version, resolves inverted track-pad scroll
direction #104272 by adding support for physical scroll direction.
Updates to GHOST/Wayland have already been made.
The "reverse map" of corners to faces and points to curves is the same
for meshes and curves now. Move it to the offset indices header to
reflect this.
This unification can go further in the future, but I'd rather wait
until the design is clearer for now.
Pull Request: blender/blender#106570
Similar to 4bcd59d644. This probably got worse recently with
the generic attribute refactors for `Mesh`, but the final performance is
probably much better than older versions too.
Timings extracting attributes from a 16 million vertex grid (seconds):
- Corner float attribute: 0.72 -> 0.19
- Face float attribute: 0.60 -> 0.07
- UV map: 3.18 -> 0.05
Implements #95967.
Currently the `MPoly` struct is 12 bytes, and stores the index of a
face's first corner and the number of corners/verts/edges. Polygons
and corners are always created in order by Blender, meaning each
face's corners will be after the previous face's corners. We can take
advantage of this fact and eliminate the redundancy in mesh face
storage by only storing a single integer corner offset for each face.
The size of the face is then encoded by the offset of the next face.
The size of a single integer is 4 bytes, so this reduces memory
usage by 3 times.
The same method is used for `CurvesGeometry`, so Blender already has
an abstraction to simplify using these offsets called `OffsetIndices`.
This class is used to easily retrieve a range of corner indices for
each face. This also gives the opportunity for sharing some logic with
curves.
Another benefit of the change is that the offsets and sizes stored in
`MPoly` can no longer disagree with each other. Storing faces in the
order of their corners can simplify some code too.
Face/polygon variables now use the `IndexRange` type, which comes with
quite a few utilities that can simplify code.
Some:
- The offset integer array has to be one longer than the face count to
avoid a branch for every face, which means the data is no longer part
of the mesh's `CustomData`.
- We lose the ability to "reference" an original mesh's offset array
until more reusable CoW from #104478 is committed. That will be added
in a separate commit.
- Since they aren't part of `CustomData`, poly offsets often have to be
copied manually.
- To simplify using `OffsetIndices` in many places, some functions and
structs in headers were moved to only compile in C++.
- All meshes created by Blender use the same order for faces and face
corners, but just in case, meshes with mismatched order are fixed by
versioning code.
- `MeshPolygon.totloop` is no longer editable in RNA. This API break is
necessary here unfortunately. It should be worth it in 3.6, since
that's the best way to allow loading meshes from 4.0, which is
important for an LTS version.
Pull Request: blender/blender#105938
`PLATFORM_BUNDLED_LIBRARIES` was installing right next to the blender
executable rather than the `blender.shared` folder,
`PLATFORM_BUNDLED_LIBRARIES` wasn't used very much on windows, just
by the ONEAPI code which likely wasn't aware this plumbing was
still missing.
This diff adds support for using `PLATFORM_BUNDLED_LIBRARIES` on
windows in both debug and release configurations.
You can differentiate between a .dll being installed for debug/release
or all configurations, by prefixing the library with either `DEBUG`,
`RELEASE` or `All`, if no prefix is given `ALL` is assumed.
Pull Request: blender/blender#106348
When accessing UVmaps from python in BMesh, the UVmap name/index was ignored
and the active UVmap always used. This fixes this by passing the layer index
to the underlying CustomData function.
Pull Request: blender/blender#106537
This was only used in a single place, multires baking, where it's simple
to just retrieve the looptris from the temporary `Mesh` that we already
create to simplify accessing normals. This allows removing a bunch of
complexity from `DerivedMesh`, to help progress towards its complete
removal at some point in the future.
Also use `Span` more instead of raw pointers in multires baking,
and pass around the spans instead of the low-resolution DerivedMesh.
Caused by 16fbadde36. The first mistake was passing a pointer
to a poly to what was meant to be the pointer to the start of the array.
Use Span instead to avoid that confusion. The second was a logic error
in CCGDerivedMesh's lazy initialization of corner data. The data was
copied when the mesh is created so it wasn't initialized.
This PR adds debug information inside the spir-v assembly to enable
step-by-step debugging of Shaders using renderdoc. The debugging
information can be fairly large so are only generated when used
with the `--debug-gpu-renderdoc` feature.
During debugging shader optimizations are turned off.
Pull Request: blender/blender#106546
Regression caused by 98bfa8d458
The `XRAY_ENABLED(v3d)` check was lost during a modification to
`transform_snap_context_project_view3d_mixed_impl` function.
This caused vertex snapping in solid shading to jump between visible
and occluded faces.
Pull Request: blender/blender#106495
This patch refactors the texture samples code by mainly splitting the
eGPUSamplerState enum into multiple smaller enums and packing them
inside a GPUSamplerState struct. This was done because many members of
the enum were mutually exclusive, which was worked around during setting
up the samplers in the various backends, and additionally made the API
confusing, like the GPU_texture_wrap_mode function, which had two
mutually exclusive parameters.
The new structure also improved and clarified the backend sampler cache,
reducing the cache size from 514 samplers to just 130 samplers, which
also slightly improved the initialization time. Further, the
GPU_SAMPLER_MAX signal value was naturally incorporated into the
structure using the GPU_SAMPLER_STATE_TYPE_INTERNAL type.
The only expected functional change is in the realtime compositor, which
now supports per-axis repetition control, utilizing new API functions
for that purpose.
This patch is loosely based on an older patch D14366 by Ethan Hall.
Pull Request: blender/blender#105642
Related to #106535 where a similar fix was done for OpenGL. A small
cleanup that might reduce the complexity during GLSL shader compilation.
Pull Request: blender/blender#106538
Renderdoc requires all calls/updates to originate from the same
context. It also doesn't support multithreading. For now we
enable main context workaround.
The renderdoc integration used to be behind the `--debug-gpu`
command line option. When using `--debug-gpu` outside renderdoc
error messages where displayed that aren't relevant.
This PR adds a specific command line option for the renderdoc
integration. This option will also enable `--debug-gpu`.
Pull Request: blender/blender#106541
This was the case with hidden faces and `Sync Selection` turned ON.
Caused by 8f543a73ab.
Since 8f543a73ab, the UV element map
respects the hidden state of geometry, but stitching [which also
respected this on its own even prior to the culprit commit in its
calculation of connectivity] did this differently [it only skipped
hidden geo when UV_SYNC_SELECTION was OFF -- even though UVs would not
be visible which is probably the real error here, I believe there is
this principle that we "dont act on stuff we dont see"].
To fix this, also skip hidden geo (even with UV_SYNC_SELECTION = ON) in
the stitch calculation of connectivity, just as
`BM_uv_element_map_create` does it.
Should go into 3.3 LTS as well.
Pull Request: blender/blender#106493
Depending on newer API's could cause build failure for existing
builds using wayland-protocols outside of Blender's 'lib' directory.
Now the existence of the most recent XML file is checked on each CMake
execution, resetting the cache when not found so the protocols in
`../lib/linux_x86_64_glibc_228/` will be used instead.
The function which collects files to process in add-on extraction
returned only files that did not start with '_', in the case where the
add-on was a module in a directory. This excluded __init__.py, which
may very well contain UI code, so an exception is added for this case.
This change currently allows the extraction of 42 new messages.
Logic for the recently included fractional scaling support [0] was
difficult to reason about as it depended on two different callbacks
one that listened to a preferred scale, another that tracked which
physical displays the window overlapped.
Checking if fractional scaling was in used depended on the order
the callbacks ran - which is undefined.
In practice - mixing non-fractional and fractional displays would
flicker when the window was moved between monitors.
Resolve this problem with the following changes:
- When the fractional-scale manager is supported,
only respond to the scale from it's preferred_scale callback.
- When no fractional-scale manager is available,
set the scale based on the scale of overlapping outputs.
- Add support for postponing the buffers commit call to prevent
flickering when changing the windows scale.
Other changes:
- Use a lock before setting the pending frame state from
wp_fractional_scale_handle_preferred_scale.
- Ensure pending actions that themselves trigger pending actions
run in the time gwl_window_pending_actions_handle is called.
- Rename GWL_Window::scale -> GWL_WindowFrame::buffer_scale.
[0]: cde99075e8
Depend on fractional-scale when searching for wayland-protocols
This will impact builders that don't use Blender's `../lib/` and
have wayland-protocols older than v1.31.
For some reason, lattice modifier always depend on self object transform.
This fix just move extra dependencies in to if case statement, also some
cleaning of this code area.
Pull Request: blender/blender#105293
Caused by the changes in the submodules configuration.
Can no longer rely on the `git submodule` command to
show list of external references to be packed.
Needs to be backported to 3.5.1.
Pull Request: blender/blender#106502
This happens even though there is only one user.
The Outliner only implements this `Make Single User` for worlds
(`singleuser_world_fn`) and actions (`singleuser_action_fn`) [it is
questionable if the whole functionality could be removed really, but
this is for another report] and it uses `id_single_user` to do so --
this function does not check if we even have more than one user though,
so data gets duplicated resulting in duplicate worlds or actions even if
they only have one user and shouldnt be touched.
Now let `id_single_user` check usercount and only act if we have more
than one real users.
Pull Request: blender/blender#105991
pgettext_tip incorrectly imported as iface_ instead of importing
pgettext_iface. These leads to incorrectly translated attribute text
shown when the user elects to translate only tooltips.
Pull Request: blender/blender#106507
Caused by filebrowser calling space `refresh` function. The intention of
refresh function was mainly to hide channels when view type is changed.
Unhiding channels when view is changed back seems logical, but this
causes issues when region is too thin, which results in hiding side
panel, which is more important.
When creating nodes by dragging a link, it can be convenient to
transfer values from input socket. For reference values, like images,
this may be necessary to avoid unnecessary data-block users. This
patch starts adding such a system. At this moment this only makes sense
for one node (Image Input), but this can be extended to work with other
reference types, different non-reference types and support auto-casting
(if a float is transferred to the Integer Input node).
See task: blender/blender#102854
Original patch: https://archive.blender.org/developer/D16735
Pull Request: blender/blender#105972
Previously the only way to control the subtype was to remove the group
input or output and create it again. This commit adds a dropdown to
change an existing socket, for supported socket types.
Based on a patch by Angus Stanton: https://developer.blender.org/D15715
It was necessary to fix the UI code slightly; the layout's context
wasn't being used in calls to an operator's enum items callback.
Pull Request: blender/blender#105614
The potential optimization in the normal edit modifier when flipping
faces isn't worth the "API impurity" and complexity introduced by
adding poly normal editing as part of the API. This change simplifies
future changes to the ownership of poly normals with a shared cache,
which can prevent recomputing poly normals completely.
Vertex positions and faces aren't changed, so most caches shouldn't
need to be tagged. This removes unnecessary re-computation of bounds,
triangulation, loose edges, etc.
Pull Request: blender/blender#106250
Make it a native Cycles light option instead of counter-acting the inverse
area calculation in Hydra.
Differential Revision: https://developer.blender.org/D16838
HdRenderDelegate got a change with the interface, adding gpuSupported. It
currently is just a dummy implementation without checking for anything
GPU-related.
Differential Revision: https://developer.blender.org/D17207
The problem is that `set_geometry()` otherwise ends up implicitly
casting `Geometry*` to bool. In Blender this worked because the
geometry header was always included before the object header.
Differential Revision: https://developer.blender.org/D16737
Allows NLA strips to horizontally translated over each other. If a strip is dropped when translating, it'll cause the strip to shuffle into place.
---
Abstracted large conditional branch in `recalcData_nla` into it's own `nlastrip_fix_overlapping` method for increased readability. No logical changes were made.
---
[Archived Phabricator Patch](https://archive.blender.org/developer/D10102)
Pull Request: blender/blender#105532
Use raw Blender structs and mesh data rather than using the RNA API.
There isn't any benefit from using the RNA when Cycles is compiled
with Blender anyway, and a profile showed that the majority of time
was spent in Blender RNA API functions.
This gives a significant improvement in performance when ingesting
meshes. Here are some tests of the runtime of the `create_mesh`
function (in seconds):
| | Before | After |
| ------------------------- | ------ | ----- |
| Grid | 0.66 | 0.11 |
| Many realized cubes | 2.60 | 0.48 |
| Large curve to mesh setup | 4.18 | 1.14 |
Also change to resizing the arrays and filling them by index rather
than appending. This makes the parallel aspect of the logic clearer,
and makes the loops easier to parallelize in the future, and makes
it easier to have a performance benefit when an attribute like
`sharp_face` doesn't exist.
Pull Request: blender/blender#106275
Use the dot product of the normal of the two polygons connected to the
edge to calculate the edge factor.
This fixes#90641 and #102545 and ensures more predictable results for
boundary and non-manifold edges.
Co-authored-by: Germano Cavalcante <mano-wii>
Pull Request: blender/blender#105352
No functional changes.
Edges hidden by Optimal Display are hidden by edge factor Shader.
But there is not much advantage in doing this, as the number of edges
hidden by the Optimal Display is usually much higher than the number of
visible edges.
And the lines extractor does not include invisible edges due to other
factors.
So this change makes:
- Visibility test more consistent with what is actually seen.
- Smaller buffer for IBO sent to GPU
- consistency with GPU Subdivision that already considers Optimal Display
- Allows possible improvement in the "Edge Factor" extraction by making
it unnecessary to check the Optimal Display (except for optimization).
Co-authored-by: Germano Cavalcante <mano-wii>
Pull Request: blender/blender#106402
Popover menu buttons had their labels translated but not their
descriptions, although they were properly extracted.
This commit fixes that using the `TIP_()` macro.
This information is displayed in the top left of the 3D Viewport with
other text info. The units of the grid are already extracted, but they
were not translated in the drawing code.
Remove comments from `eBConstraint_Types` that
- were used long ago during a big refactor effort, but are no longer
necessary, or
- just repeated the name of the enum constant.
No functional changes.
OpenEXR has some dependecies that other other modules in Blender
requires. When disabling OpenEXR these dependecies could not match
and building blender would fail.
This PR disables the next options when `WITH_IMAGE_OPENEXR=Off`
- `WITH_OPENVDB`
- `WITH_ALEMBIC`
- `WITH_VULKAN_BACKEND`
- `WITH_CYCLES_OSL`
Additionally windows stores the IMath libraries in `IMATH_LIBRARIES`
Linux and Mac stored the IMath libraries in `IMATH_LIBRARY`. This
change will also adds `IMATH_LIBRARIES` variable to all platforms.
Pull Request: blender/blender#106209
Splitting workload dependency chains such that they
only exist within the context of a single frame.
Dependencies are required to ensure sequential
command buffer submissions execute in order,
but the additional dependencies between frames
could incur GPU timeouts, if a signal was delayed.
This could be triggered by both CPU/GPU cycles
texture updates and Viewport Compositor operations.
Should also resolve#106401
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#106443
Reduce register spill to global memory in raytrace_resolve
function. Results in a 20% uplift for this particular shader on
Apple Silicon GPUs. Contributing to 3-5% uplift for scenes
which have SSR enabled. This is achieved via reducing
memory pressure using a packed data type for the sampling
kernel.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#106231
Very sadge to see this kind of mistakes still exist in 2023 code...
While in theory this commit could be backported to (LTS) releases, would
rather only do it if/when proven it actually fixes user-facing issues.
Fixing such issues so deep in ID management code can have completely
unexpected side effects.
The framebuffer default size was only set during the first bind. This
is because the `dirty_attachments_ tag` wasn't set and thus the
framebuffer size was never passed down to the GL.
Split to `default_size_set()` to not affect other code paths that use
`size_set()`.
Adds the ability to pack UVs back into the original bounding box.
Choose UV Editor > Menu > UV > Pack Islands
Then change "Pack To" to "Original bounding box"
Face Nearest only works with individual projection, so always set the
`SCE_SNAP_PROJECT` flag in this case.
Also gray out the `Project Individual Elements` option in the UI if
`Face Nearest` is enabled.
And change the description to indicate that `Project Individual Elements`
is always enabled with the `Face Nearest` option.
(I feel a better design for this option needs to be considered).
Avoid introducing another `::modifiers` namespace for now, since it's
not clear if we'll want that long term. This just avoids a bunch of
boilerplate and makes things easier to read.
Use the node group and the properties as arguments instead of
the modifier. This may help to allow reusing the functions outside
of the modifier execution context.
This adds the select more/less operators to the weight paint mode face selection.
Just like in edit mode, press `CTRL`+`Numpad Plus/Minus` to use them.
They have also been added to the `Select` menu.
Pull Request: blender/blender#105607
This adds the select more/less operators to the weight paint mode vertex selection.
Just like in edit mode, press CTRL+Numpad Plus/Minus to use them.
They have also been added to the Select menu.
Pull Request: blender/blender#105633
When retrieving the evaluated mesh to paint on, it can be reevalauted,
where a smaller set of attributes are requested than for regular
evaluated meshes. That reevaluation should be completely removed
(see #106186), but a simple fix in the meantime is to manually
request that data.
When normalization is enabled in the Graph Editor,
the area outside the -1/1 range on the y axis isn't meaningful.
To visually represent that this patch greys out that area
just as it does with anything outside the current frame range.
Pull Request: blender/blender#106302
fast_float.h currently is only used by OBJ, STL and PLY I/O importers.
Update it to the latest release from upstream (from 3.4.0 2020 Nov to
4.0.0 2023 Mar).
No behavior changes, but they have optimized the performance a bit.
Importing a 6-level subdivided Suzanne OBJ file (330MB) goes from 3.5sec
down to 3.2sec on Win10, Ryzen 5950X, VS2022 build.
Previously, fractional scaling was detected but set an integer buffer
scale which the compositor would down-scale causing blurry output.
Now the fractional scaling interface is used when available to set the
DPI and set the internal buffers size & viewport transformation to
ensure 1:1 pixels from Blender to the Wayland output.
Tested to work with multiple monitors with mixed
fractional/non-fractional scale.
Note that this change causes a regression for when fractional scaling
is set on a compositor without support for fractional-scale-v1.
Supporting fractional scaling in both cases is possible but overly
complicated. This case already wasn't working so well - with blurry
output due to image scaling, now the DPI wont be accurate in this case
although Blender is still usable.
It's a bit easier to follow this way, and we can make better use of
const. It's also more reusable in case we have to use it elsewhere
too (for node group operators?).
Use checks for certain node types with better algorithmic complexity.
They should perform better in some edge case with a lot of nodes or
node group nesting. They're now a bit more similar to each other too.
This is the only package that warns about this type of thing, and gets in the
way of actual warnigns on build logs. This requires CMake 3.19+ to take effect,
older versions still show the warnings.
Ensure compression is enabled by using shader_read
flag only. Also ensure that MTLTexture contents
remain in optimal layout for reading after any
data modifications.
Authored by Apple: Michael Parkin-White
Pull Request: blender/blender#106234
The command buffer fails to execute, the cause is unknown. It does not
appear to be related to the binary archive cache as disabling that does
not prevent the issue.
Pull Request: blender/blender#106328
The issue was caused by uninitialized offset used for the scale
variable.
Follow the rest of the usages of the operation which initialize
it explicitly. This makes it very safe and easy fix to backport
to any LTS or corrective release.
Ideally should probably initialize all members in the class
itself, to avoid such situations in the future.
Pull Request: blender/blender#106325
The cycling method for the viewer connection starts searching from the next socket
after the last current connection. If a geometry socket is is the last connected
output this caused the method to jump to the next socket after the geometry,
potentially skipping over valid data sockets that are not viewed yet.
The solution is to ignore the geometry sockets in the cycling entirely and only
consider data sockets (i.e. non-geometry sockets).
Pull Request: blender/blender#106318
This tool now only supports installing packages, it won't build any
dependency anymore. This implies that on most distributions, it wont
make a complete Blender build possible, some features will likely be
misisng.
By default, it only install basic dev environment to enable building
Blender with the precompiled libraries (which is the recommended way).
Passing the `--all` option will make it try to install all known
dependencies from distro packages. This is a development option,
regular Blender build should be done with the precompiled libraries.
Tested on Debian Testing, Arch, Fedora and Suse Tumbleweed.
With the new design, it should be fairly trivial to add more
distributions if desired, and maintenance should also be way simpler.
NOTE: side effect is that a working python3 interpreter is expected on
system running this script. In practice this should not be an issue,
since Python3 is installed by default in almost all regular desktop
linux installations.
The insert key operator allowed to insert a keyframe on all selected FCurves
and on the Active FCurve at cursor value.
But it didn't allow to insert a keyframe only on the active FCurve.
This patch adds that. It is available in the redo panel and under Key->Insert Keyframes (which can also be called with the I hotkey)
Pull Request: blender/blender#106307
This change aimed to solve the following issues:
- Possible threading issue of two tests writing to the same
file, depending on how the ctest is invoked
- Test using the release directory, and potentially leaving
temp file behind on test failure, breaking code sign on
macOS.
Pull Request: blender/blender#106311
Found together with a fix for #106043.
Edge panning (in Node Editors, Outliner and VSE) does unnecessary
updates when the view has not changed at all. This includes adding
`MOUSEMOVE` events (even if you dont move the mouse at all).
Adding `MOUSEMOVE` events results in the transform system constantly running (even if you dont move the mouse) which we certainly want to avoid.
Rectify this by only calling these updates when the view changes.
Pull Request: blender/blender#106301
The fix for #105363 (6d3ce8273a) made the transform system respect
(Frame) nodes `offsetx`/`offsety`.
Now Node Editors run the transform system even if the mouse is still (due to edge panning -- unnecessarily, see PR #106301 for fixing this). And due to the way `frame_node_prepare_for_draw` recalculates these offsets (based on
on updated positions and `node.runtime->totr` [which in turn gets rounded in `node_update_basis` -- so subpixel precision is lost there, see [1]]), this can lead to slight imprecisions/noise/jitter during transform (if we use float offsets, see the PR for more info).
So to counter this, use rounded offsets now [which will keep the whole circle stable].
NOTE: PR #106301 would fix this already for having the cursor still, but this patch still improves slight jitter when moving, so will commit separately.
[1] comment from `node_update_basis`
> /* Round the node origin because text contents are always pixel-aligned. */
Pull Request: blender/blender#106096
No user visible changes expected.
For brush assets, we need a way to store a reference to a brush in .blend files, so that the last active brush can be restored from the file. See #101908. It seems like a generally useful thing to have.
Adds a new DNA struct to store a "weak" asset reference, that is, a reference that can break under a number of circumstances, but should work reliably enough under normal usage. There's no way to reliably reference an asset currently, so this works on a "best effort" basis. It can break when assets are moved inside the asset library, asset libraries are unregistered from the Preferences, or a file is opened on a different machine with different Preferences, for example. It can also break currently if an asset library is renamed.
It contains:
- Information to identify the asset library the asset can be found in.
- A relative "identifier" (currently a relative path) for the asset within the asset library.
There's further code to resolve a weak reference to file paths and Blender library paths.
Part of #101908.
Co-authored-by: Bastien Montagne <bastien@blender.org>
Pull Request: blender/blender#105603
The goal is to solve confusion of the "All rights reserved" for licensing
code under an open-source license.
The phrase "All rights reserved" comes from a historical convention that
required this phrase for the copyright protection to apply. This convention
is no longer relevant.
However, even though the phrase has no meaning in establishing the copyright
it has not lost meaning in terms of licensing.
This change makes it so code under the Blender Foundation copyright does
not use "all rights reserved". This is also how the GPL license itself
states how to apply it to the source code:
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software ...
This change does not change copyright notice in cases when the copyright
is dual (BF and an author), or just an author of the code. It also does
mot change copyright which is inherited from NaN Holding BV as it needs
some further investigation about what is the proper way to handle it.
When hitting the "normalize" button in the graph editor, set the y extents of the view to the extents of the `FCurves`.
Previously you had to search for your curves after pressing that button.
Pull Request: blender/blender#105857
Similar to recent OBJ UV values merging commit (05a63e3705) - build
mapping of (vertex, UV) by going over the face loops directly, instead
of using BKE_mesh_uv_vert_map_get_vert and then having an additional
map on top. Provide the mapping into ready to use flat arrays, instead
of building a map and then building arrays out of that in a separate
pass.
While at it, avoid the extra cost of building all this complicated
mapping when we don't have or are not exporting UVs.
Timing tests on exporting several models into binary PLY file
(Win10, Ryzen 5950X):
- Suzanne subdivided to level 6 (2.1M verts): 0.93s -> 0.68s
- Rungholt Minecraft level (9.7M verts): 3.3s -> 2.3s
- Stanford Lucy 3D scan (14.0M verts, no UVs): 5.2s -> 1.5s
This patch replaces `dispatchThreadgroups` with `dispatchThreads` which takes care of non-uniform threadgroup bounds. This allows us to remove the bounds guards in the integrator kernel entry points.
Pull Request: blender/blender#106217
The system wayland-protocols version is too old, and xdg-activation-v1.xml
is a more recent addition than xdg-decoration-unstable-v1.xml so check for
that.
This patch fixes a MetalRT issue where viable shadow hits are discounted based on the false assumption that hits are ordered by distance. With this patch, the following unit tests now pass:
- openvdb smoke
- shadow catcher pt transparent lamp only 0.8
- shadow catcher pt transparent lamp only 1.0
Pull Request: blender/blender#106276
This is preparation for #106228, the crash does not happen in `main` currently.
The issue was `positions_for_write` might make a copy of the data if it was
shared. This operation is not thread safe on a single mesh. The solution is to
get write-access to the positions only once before threading starts.
This makes the APIs more correct and simplifies debugging, because
some debuggers can now show the enum name instead of the integer.
Pull Request: blender/blender#106268
For example
```
OIIOOutputDriver::~OIIOOutputDriver()
{
}
```
becomes
```
OIIOOutputDriver::~OIIOOutputDriver() {}
```
Saves quite some vertical space, which is especially handy for
constructors.
Pull Request: blender/blender#105594
The DPI returned by the GHOST/Wayland didn't account the buffer being
rendered at a higher (non-fractional) resolution, then scaled down.
This caused the software cursor and UI to rendered very small.
A fractional scale of 101% would show the UI just over 50% of the size
(making the UI to be close to half the scale it should have been).
Resolve by accounting for down-scaling of the buffer to it's
fractional size.
The UI needs persistent pointers to catalog paths that it can pass
around via context. It was trying to manage this in own storage, but
this didn't work. Not entirely sure why - the menus get redrawn
continuously while assets load, and the root menu rebuilds the mentioned
storage every time. Maybe the submenus redraw a bit later, or the
keyboard navigation handling still accessed data from a previous redraw
somehow.
Either way, instead of managing own catalog path storage, point into the
asset system, which already has persistent storage for the catalog
paths.
Pull Request: blender/blender#106237
Don't install libraries in blender.shared and don't generate manifest
as it's not working and not important to have a clean directory here.
Always detect MSVC_REDIST_DIR as it is used by oneAPI. The way
InstallRequiredSystemLibraries is called it already only sets some
variables and doesn't install anything by itself.
Pull Request: blender/blender#105999
This is a workaround fix for Open PGL 0.4.1 when the first volume
samples are collected in a later training iteration.
The problem is fixed in Open PGL > 0.5.0 and the workaround
can be removed after upgrading Open PGL.
The bug was found by ASAN when running the file from #105953. It's not
entirely clear what the root issue for the division by zero is, but
at least now the result is more predictable.
Pull Request: blender/blender#106165
The overall goal is to use implicit-sharing in many places in Blender
that currently do unnecessary copies. See #95845 for more details.
This commit only adds the base data structures in blenlib and uses those
in `GeometrySet` and `AnonymousAttributeID`, which used a more ad-hoc
version of implicit sharing already. #105994 lists some more places where
support for implicit sharing can be added (most notably: custom data layers).
Pull Request: blender/blender#105994
The most important part of this change is that the simulation
state at a specific point in time is more self contained now.
This way, only the modifier has to deal with finding the old/new
simulation states and not every simulation individually.
Furthermore, this also includes some simple cache invalidation
when the user changes something that might affect the result.
Previous fix/hack a60f651502 made it so that all 'Fake User' linked
IDs are considered as directly linked, so that some IDs (like linked
Text) references are not lost on file save becaus they are not
effectively used.
However, this created unwanted references to all linked assets data,
because an asset always has its fake user set. This ended up keeping
lots of references to sub-assets when appending from the new Essentials
node groups.
NOTE: This is adding another hack to the collection, the whole handling
of 'which unused linked data reference to keep on file save' needs to be
reworked for Blender 3.6.
This was an issue with the `operator_context`. It's a bit confusing because it
looks like every `uiLayout` has its own, but in `uiLayoutSetOperatorContext`
you can see that the `operator_context` is always set on the root layout for
some reason.
The fix is to set `INVOKE_REGION_WIN` as the operator context after it has been
set to something else (I found this to be the default by printing the operator
context before it was changed).
Pull Request: blender/blender#106213
No user visible changes expected.
With this, empty rows will be added to the tree view so that the
background box is at least a few lines high (like with UI lists). If the
view is used as a drop target, data can be dropped on these empty rows
too then.
This was requested for the Cycles light linking project.
This PR adds support for anamorphic aspect rations when using
masks. As viewport compositor doesn't support masks yet, this
has not been added yet.
Pull Request: blender/blender#106121
This PR adds support for clearing framebuffers and scissor testing.
Tweaks had to be made to VKTexture to keep track of its layout
on the device. Based on the actual call the layout can switch
to a more optimum layout.
For example during upload of a texture the texture will be converted
to a transfer destination optimized layout. When reading from the
texture it will be converted to a transfer source optimized layout.
The order of the attachments in the framebuffer follows the next rules
- When only color attachments are there the color attachments will
be placed in the slot they are defined. This way it will match
the ShaderCreateInfo binding location.
- When a stencil/depth attachment is added it will be placed
right after the color attachments. When there isn't a color
attachment it will be the first attachment.
Pull Request: blender/blender#106044
A few small refactors of the `draw_setting_widget()` function for drawing
animation channel widgets (like 'modifier mute', etc.)
- Use `const` where appropriate.
- Move some variable declarations to their actual use, to clarify their
scope and make it possible to use `const`.
- Return earlier where possible, which should improve performance as some
unnecessary code gets skipped.
No functional changes.
This PR adds pre-checks when enabling validation layers.
For validation layers to work some platforms require that
the Vulkan SDK is installed. Validation layers are activated
when running blender with `--debug-gpu`.
Sometimes we expect users to run with `--debug-gpu` for
narrowing down an issue and we cannot expect them to have
the Vulkan SDK installed.
This patch will check if the `VK_LAYER_PATH` is available
and that the configuration file of the validation layer is
present. If this isn't the case we don't activate the
requested validation layer.
Pull Request: blender/blender#105922
Calling render (for example) with an existing window open now activates
the window on Wayland. Tested to work on GNOME & KDE.
Use the xdg-activation protocol which typically brings the
window to the foreground.
Partially resolves#102985.
Clang would warn about failure to use 'override' when a single
method was added that used 'override' when none of the other methods
did.
This meant a single correct use of override caused noisy compiler
warnings (for CLANG but not GCC).
Avoid this by using 'override' where appropriate.
Improvements to packing efficiency and updating UV packing API.
* Add #pack_islands_alpaca_rotate, the fast alpaca-style packer with rotation.
* Update heuristic for sorting islands based on longest edge.
(Improves pack efficiency when rotation is enabled.)
* Add `aspect_y` to UV Packing API, to support non-square materials in the future.
Pull Request: blender/blender#105977
When all of the input meshes have no loose edges, the output won't have
any either, but finding that out for the output is much more expensive.
Copy this tag to the output mesh to save processing time when drawing.
In my test creating 1 million instances of a 16 face mesh, this changed
the time for the draw cache loose geometry extraction from 220 ms to
131 ms.
For now, only do this when the loose edges of the inputs are already
cached (primitive nodes, for example). This avoids paying the cost of
calculation when we don't know it will be necessary.
It doesn't take much time to know whether all of the curves have more
than a single point, and if that's the case, we know for sure there are
no loose edges in the mesh. This can save time when creating the mesh
draw cache. The time for finding loose geometry goes from 180 ms to
104 ms for a large molecular nodes test file.
For the single-threaded part of the curve to mesh conversion, avoid
writing to two logically separate arrays in the same loop. Instead
run the calculation on two separate threads if the output is large.
Timing for `calculate_result_offsets` when processing 1 million curves:
Before: Average: 10.4 ms, Min: 9.4 ms
After: Average: 9.2 ms, Min: 7.7 ms
Currently assigning values to IDProperties clears their UI data.
That is fixed by #106161, but that is too risky for 3.5. Instead,
work around the issue by triggering `MOD_nodes_update_interface`
function which recreates the UI data of the modifier properties.
Pull Request: blender/blender#106190
Now that mesh primitive nodes calculate their bounds in constant time,
it's worth updating the bounds eagerly when translating a geometry
since doing so should be very cheap and might save a more significant
amount of time if they're needed later.
Also slightly unify the translation functions for the different types.
Pull Request: blender/blender#106159
Previous code was using BKE_mesh_uv_vert_map_get_vert to somewhat
detect identical UV values on mesh vertices. But this was not
handling the case when separate mesh vertices still use the same UV
values (e.g. cube with all six faces mapped to whole image).
Replace usage of BKE_mesh_uv_vert_map_get_vert with a simple "unique UV
value" map, very similar to how OBJ normals are calculated for export.
Measurements on a somewhat extreme case: exporting "Rungholt" Minecraft
level from https://casual-effects.com/data time (Win10, Ryzen 5950X)
goes 2.9sec -> 2.2sec, and resulting file size 486MB -> 231MB. This
particular model has a lot of mesh faces mapping to the same places
in UV map.
On less extreme cases the timings are similar between old and new
code, with a tiny speedup in most tests I've tried.
Allow clicking the "up" and "down" arrows to increment/decrement by a
frame for Video Sequencer strip Frame Start, Strip Offset Start, and
Strip Offset End.
Pull Request: blender/blender#106117
Updated version of our monochrome Noto Emoji (variable) font with 31
new emojis that were released as part of Unicode 15.0
Pull Request: blender/blender#106142
"Rotate Normals" is a changeable operation like any other and does not
need to be hardcoded.
An advantage of exposing this modal is that the shortcut key now
appears in the header when rotating an edited mesh.
Avoid calling `restoreTransObjects`, `resetTransModal`,
`resetTransRestrictions` and `initSnapping` for each change.
Also bring `applyMouseInput` close to the rest of the code.
No functional changes.
The lack of organization in the values of the constants that indicate
the properties was prone to errors.
One error that can be noticed is that the values of
`P_ORIENT_AXIS_ORTHO` and `P_VIEW2D_EDGE_PAN` were the same.
(not really a problem though)
UV attribute refactor in 6c774feb has changed the logic from "UV data does not exist" to "there's no active UV layer". The repro mesh has a UV layer, but not UV data due to the mesh being only a point cloud.
Pull Request: blender/blender#106185
- Use dynamic declarations to build simulation node sockets
- Fixes in some node code for futher use of dynamic declarations
- Copying, freeing, reading, and writing of simulation state array
- Add simulation state items with link drag operator
The new sockets won't do anything yet, only geometry sockets are
supported, and there is no way to remove sockets yet.
Previously, the code tried to keep node groups working even if some of
their input/output sockets had undefined type. This caused some
complexity with no benefit because not all places outside of this file
would handle the case correctly. Now node groups with undefined
interface sockets are disabled and have to be fixed manually before
they work again.
Undefined interface sockets are mostly caused by invalid Python
API usage and incomplete forward compatibility (e.g. when newer
versions introduce new socket types that the older version does
not know).
Avoid utility function call that would query the file system, this was a
bottleneck. The path joining was also problematic. See patch for more
details.
Differential Revision: https://developer.blender.org/D16768
Reviewed by: Jacques Lucke
Expands Color Mix nodes with new Exclusion mode.
Similar to Difference but produces less contrast.
Requested by Pierre Schiller @3D_director and
@OmarSquircleArt on twitter.
Differential Revision: https://developer.blender.org/D16543
Materials without connections to the output node would crash with OSL
in OptiX, since the Cycles `OSLCompiler` generates an empty shader
group reference for them, which resulted in the OptiX device
implementation setting an empty SBT entry for the corresponding direct
callables, which then crashed when calling those direct callables was
attempted in `osl_eval_nodes`. This fixes that by setting the SBT entries
for empty shader groups to a dummy direct callable that does nothing.
Switching viewport denoising causes kernels to be reloaded with a new
feature mask, which would destroy the existing OptiX pipelines. But OSL
kernels were not reloaded as well, leaving the shading pipeline
uninitialized and therefore causing an error when it is later attempted to
execute it. This fixes that by ensuring OSL kernels are always reloaded
when the normal kernels are too.
Restrict the condition under which paint cursors read use the cursor
location from the the operating-system.
This caused a glitch when dragging UI elements in painting context
popup. Since the paint cursor would display using mouse motion
which was clamped to the window center - an internal detail of hidden
cursor grabbing.
Now only read the cursor coordinates when clamped to a region which
is used for the transform cursor to stay visible even when the cursor
wraps around.
Recent reverting of changes to cursor grabbing intended to match
Blender 3.3 release. This is the case for 3.4x branch, however there is
an additional change to grabbing on WIN32 by Germano [0] which is a
significant improvement on old grabbing logic for Windows.
So instead of matching 3.3x behavior, restore logic that keeps
the cursor centered while grabbing & hidden.
This re-introduces T102792 issue displaying the paint-brush while
dragging buttons, this will have to be solved separately.
Re-apply [1] & [2], revert [3] & [4].
[4]: a3a9459050
[0]: 9fd6dae793
[1]: 4cac8025f0
[2]: 230744d6fd
[3]: 0240b89599
The paint cursor was continuously set which meant hiding the cursor
while interacting with buttons would immediately show it again.
This exposed cursor warping.
Small roundoff errors during UV editing can sometimes occur, most likely
due to so-called "catastrophic cancellation".
Here we set a tolerance around zero when using Constrain-To-Bounds and UV Scaling.
The tolerance is set at one quarter of a texel, on a 65536 x 65536 texture.
TODO: If this fix holds, we should formalize the tolerance into the UV editing
subsystem, perhaps as a helper function, and investigate where else it needs
to be applied.
Differential Revision: https://developer.blender.org/D16702
When migrating to the new packing API, pin_unselected was not
implemented correctly.
Regression from rB143e74c0b8eb, rBe3075f3cf7ce, rB0ce18561bc82.
Differential Revision: https://developer.blender.org/D16788
Reviewed By: Campbell Barton
Duplicated in blender-v3.4-release as rB3dcd9992676a
Upon conversion, the newly-created UV map with default name "UVMap"
should be translated.
Reviewed By: mont29
Maniphest Tasks: T103183
Differential Revision: https://developer.blender.org/D16775
Replace ../lib/linux_centos7_x86_64 with ../lib/linux_x86_64_glibc_228,
built with Rocky8 Linux, compatible with the VFX platform CY2023,
see: T99618.
- Update build-bot configuration.
- Remove unnecessary check for Blosc, this is part of OpenVDB lib now.
- Remove WITH_CXX11_ABI, always use new C++11 ABI now
- Replace centos7 by glibc_228 everywhere
Note that existing builds with cached paths pointing to
"../lib/linux_centos7_x86_64" will need to be updated.
Includes contributions by Brecht.
Attributes are unifying around a name-based API, and we would like to
be able to move away from CustomData in the future. This patch moves
the identification of active and fallback (render) color attributes
to strings on the mesh from flags on CustomDataLayer. This also
removes some ugliness used to retrieve these attributes and maintain
the active status.
The design is described more here: T98366
The patch keeps forward compatibility working until 4.0 with
the same method as the mesh struct of array refactors (T95965).
The strings are allowed to not correspond to an attribute, to allow
setting the active/default attribute independently of actually filling
its data. When applying a modifier, if the strings don't match an
attribute, they will be removed.
The realize instances / join node and join operator take the names from
the first / active input mesh. While other heuristics may be helpful
(and could be a future improvement), just using the first is simple
and predictable.
Differential Revision: https://developer.blender.org/D15169
If the resulting geometry from applying a geometry nodes modifier
contains no mesh, give an error message. This gives people something to
search and makes the behavior more purposeful.
Also remove the `modifyMesh` implementation from the geometry nodes
modifier, since it isn't necessary anymore. And remove the existing
"Modifier returned error, skipping apply" message which was cryptic
and redundant if applying returns an actual error message.
Resolves T103229
Differential Revision: https://developer.blender.org/D16782
This patch allows skipping the automatic insertion of nodes on top of
links when the transform operator ends. When putting nodes into small
spaces this often gets in the way and wastes time. Now, when holding
`alt`, this is turned off.
The header text is also improved to add this shortcut and to remove
the Dx and Dy values and improve the formatting a bit.
Making this functionality optional might allow us to use it in more
places in the future, like for the nodes added by link-drag-search.
Differential Revision: https://developer.blender.org/D16230
The function was highly related to the apply modifier operator,
and only used once. This was too specific to be in the blenkernel,
especially in a mesh conversion file.
This was missing some paths setup in the environment, ctest
normally sets this up before running the tests from the CLI
but that does not help the IDE all that much.
After switching over to using start_frame / end_frame, scaling an NLA strip didn't scale the strip, it just repeated the action.
Now withing the NLA transform code, we look for TFM_TIME_EXTEND / TFM_TIME_SCALE transform mode, and handle the update to strip scale accordingly
Note: Still unstable. Simulation resets when playback stops bug.
Since the "Run" behavior can basically be implemented with the switch
node already, it's just adding unnecessary complexity to the interface
now, when it's use case isn't clear. We decided to remove it for now,
and only consider it later as a possible convenience feature, rather
than an essential part of the design.
Also, the simulation nodes are now considered "side effect nodes"
for the evaluator, meaning they are *always* evaluated, even if they
aren't needed because of switch nodes, etc. This was the best way
we thought of to make simulations run consistently even through
situations like that.
These aren't theoretically necessary, since you can just created them
as regular outputs. Maybe we will eventually add them back for
convenience, but that's not clear.
Since this is theoretically redundant with simulating a float
with the delta time value, we decided to remove it for now to
make the whole interface simpler.
- Cache is accessed with a string identifier, allowing multiple sockets in the future
- Cache is meant to be stored in a simple array, not sparsely like before
- Persistent cache and temporary "last run" cache are separated more clearly
- Use a "Time Point" class instead of integers, to maybe clarify adding subframe support in the future
- Use a different "sim" namespace (not sure if that will last)
- The value from the last frame is moved, to avoid a copy when no persistent cache is used
I don't think this works now, at least I haven't tested it.
This is a temporary option anyway, the caches will be controlled in a
more unified place at the object or scene level. But for now the name
can be a bit better anyway.
It's the output node that decides whether to requiest the values
from the nodes inside the simulation, so it makes more sense
for it to be there. This is part of a general effort to have less
redundancy in the options.
* 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.
option(WITH_CYCLES_DEVICE_HIP"Enable Cycles AMD HIP support"ON)
option(WITH_CYCLES_HIP_BINARIES"Build Cycles AMD HIP binaries"OFF)
set(CYCLES_HIP_BINARIES_ARCHgfx900gfx906gfx90cgfx902gfx1010gfx1011gfx1012gfx1030gfx1031gfx1032gfx1034gfx1035gfx1100gfx1101gfx1102CACHESTRING"AMD HIP architectures to build binaries for")
# Radeon VII (gfx906) not currently working with HIP SDK, so left out of the list.
set(CYCLES_HIP_BINARIES_ARCHgfx900gfx90cgfx902gfx1010gfx1011gfx1012gfx1030gfx1031gfx1032gfx1034gfx1035gfx1100gfx1101gfx1102CACHESTRING"AMD HIP architectures to build binaries for")
mark_as_advanced(WITH_CYCLES_DEVICE_HIP)
mark_as_advanced(CYCLES_HIP_BINARIES_ARCH)
endif()
@@ -648,15 +646,15 @@ if(WIN32)
endif()
# Compiler tool-chain.
if(UNIXANDNOTAPPLE)
if(UNIX)
if(CMAKE_COMPILER_IS_GNUCC)
option(WITH_LINKER_GOLD"Use ld.gold linker which is usually faster than ld.bfd"ON)
mark_as_advanced(WITH_LINKER_GOLD)
option(WITH_LINKER_LLD"Use ld.lld linker which is usually faster than ld.gold"OFF)
@@ -14,3 +14,13 @@ The first three of them were employed by the Blender Foundation during that time
Some features (random sounds, dynamic music, playback manager, convolution and HRTFs support) were added as part of the VALS (Virtual Alliances for Learning Society) project by
- Juan Francisco Crespo Galán <dethon_5@outlook.com>
- Support for OS specific/native audio devices/backends has been added, that is PulseAudio (Linux), WASAPI (Windows) and CoreAudio (MacOS).
- New sound effects have been added, namely Modulator and Equalizer. Thanks to Marcos Perez for contributing the Equalizer.
- File stream info: if an audio file contains multiple streams you can choose which one to process instead of taking the first one (this feature is only supported by ffmpeg, not libsndfile).
- API Change: double instead of float for time values for more precise timing control.
- There have been lots of bugfixes, which are basically the majority of all changes.
- And some other minor improvements were implemented as well.
Detailed list of changes:
d4042d9 Port changes in Blender to upstream.
b60fb45 Equalizer
ab04e84 Fixes
8f0c305 Fix build error with MSVC 17.4+ ported from Blender.
ce44342 Minor documentation update.
cdcb3f4 Migrate from distuils to setuptools for python module.
21eccef Fix FindFFTW to find the float version fftw3f.
ab15e2f Bugfix: API change in new ffmpeg version.
a097be8 Clang format file added, valid from now on.
2fc9fb7 Porting bugfix from Blender upstream.
bb655b7 Bugfix: wrong sample size computation for PulseAudio.
a150495 Bugfix: Buffer did not support buffers > 2 GB.
034645c Update for ffmpeg 5.
932739c Bugfix: WASAPI hangs.
4fcd47c WASAPI: fix bug when switching the default device while there is no playback.
a16fbd2 Python API: fix to get convolution in the python API.
27ac5c1 WASAPI: always switch to default audio device.
1b03e6c Bugfix: catch exception if file cannot be read.
The fast_float library provides fast header-only implementations for the C++ from_chars
functions for `float` and `double` types. These functions convert ASCII strings representing
decimal values (e.g., `1.3e10`) into binary types. We provide exact rounding (including
@@ -28,8 +21,8 @@ struct from_chars_result {
```
It parses the character sequence [first,last) for a number. It parses floating-point numbers expecting
a locale-independent format equivalent to the C++17 from_chars function.
The resulting floating-point value is the closest floating-point values (using either float or double),
a locale-independent format equivalent to the C++17 from_chars function.
The resulting floating-point value is the closest floating-point values (using either float or double),
using the "round to even" convention for values that would otherwise fall right in-between two values.
That is, we provide exact parsing according to the IEEE standard.
@@ -47,7 +40,7 @@ Example:
``` C++
#include "fast_float/fast_float.h"
#include <iostream>
int main() {
const std::string input = "3.1416 xyz ";
double result;
@@ -60,39 +53,60 @@ int main() {
Like the C++17 standard, the `fast_float::from_chars` functions take an optional last argument of
the type `fast_float::chars_format`. It is a bitset value: we check whether
the type `fast_float::chars_format`. It is a bitset value: we check whether
`fmt & fast_float::chars_format::fixed` and `fmt & fast_float::chars_format::scientific` are set
to determine whether we allow the fixed point and scientific notation respectively.
The default is `fast_float::chars_format::general` which allows both `fixed` and `scientific`.
The library seeks to follow the C++17 (see [20.19.3](http://eel.is/c++draft/charconv.from.chars).(7.1)) specification.
The library seeks to follow the C++17 (see [20.19.3](http://eel.is/c++draft/charconv.from.chars).(7.1)) specification.
* The `from_chars` function does not skip leading white-space characters.
* [A leading `+` sign](https://en.cppreference.com/w/cpp/utility/from_chars) is forbidden.
* It is generally impossible to represent a decimal value exactly as binary floating-point number (`float` and `double` types). We seek the nearest value. We round to an even mantissa when we are in-between two binary floating-point numbers.
* It is generally impossible to represent a decimal value exactly as binary floating-point number (`float` and `double` types). We seek the nearest value. We round to an even mantissa when we are in-between two binary floating-point numbers.
Furthermore, we have the following restrictions:
* We only support `float` and `double` types at this time.
* We only support the decimal format: we do not support hexadecimal strings.
* For values that are either very large or very small (e.g., `1e9999`), we represent it using the infinity or negative infinity value.
* For values that are either very large or very small (e.g., `1e9999`), we represent it using the infinity or negative infinity value and the returned `ec` is set to `std::errc::result_out_of_range`.
We support Visual Studio, macOS, Linux, freeBSD. We support big and little endian. We support 32-bit and 64-bit systems.
We assume that the rounding mode is set to nearest (`std::fegetround() == FE_TONEAREST`).
## C++20: compile-time evaluation (constexpr)
In C++20, you may use `fast_float::from_chars` to parse strings
at compile-time, as in the following example:
```C++
// consteval forces compile-time evaluation of the function in C++20.
consteval double parse(std::string_view input) {
double result;
auto answer = fast_float::from_chars(input.data(), input.data()+input.size(), result);
if(answer.ec != std::errc()) { return -1.0; }
return result;
}
// This function should compile to a function which
// merely returns 3.1415.
constexpr double constexptest() {
return parse("3.1415 input");
}
```
## Using commas as decimal separator
The C++ standard stipulate that `from_chars` has to be locale-independent. In
particular, the decimal separator has to be the period (`.`). However,
some users still want to use the `fast_float` library with in a locale-dependent
particular, the decimal separator has to be the period (`.`). However,
some users still want to use the `fast_float` library with in a locale-dependent
manner. Using a separate function called `from_chars_advanced`, we allow the users
to pass a `parse_options` instance which contains a custom decimal separator (e.g.,
to pass a `parse_options` instance which contains a custom decimal separator (e.g.,
- Daniel Lemire, [Number Parsing at a Gigabyte per Second](https://arxiv.org/abs/2101.11408), Software: Pratice and Experience 51 (8), 2021.
## Relation With Other Work
The fast_float library is part of:
- GCC (as of version 12): the `from_chars` function in GCC relies on fast_float.
- [WebKit](https://github.com/WebKit/WebKit), the engine behind Safari (Apple's web browser)
The fastfloat algorithm is part of the [LLVM standard libraries](https://github.com/llvm/llvm-project/commit/87c016078ad72c46505461e4ff8bfa04819fe7ba).
There is a [derived implementation part of AdaCore](https://github.com/AdaCore/VSS).
The fast_float library provides a performance similar to that of the [fast_double_parser](https://github.com/lemire/fast_double_parser) library but using an updated algorithm reworked from the ground up, and while offering an API more in line with the expectations of C++ programmers. The fast_double_parser library is part of the [Microsoft LightGBM machine-learning framework](https://github.com/microsoft/LightGBM).
## References
- Daniel Lemire, [Number Parsing at a Gigabyte per Second](https://arxiv.org/abs/2101.11408), Software: Practice and Experience 51 (8), 2021.
- Noble Mushtak, Daniel Lemire, [Fast Number Parsing Without Fallback](https://arxiv.org/abs/2212.06644), Software: Practice and Experience (to appear)
## Other programming languages
- [There is an R binding](https://github.com/eddelbuettel/rcppfastfloat) called `rcppfastfloat`.
- [There is a Rust port of the fast_float library](https://github.com/aldanor/fast-float-rust/) called `fast-float-rust`.
- [There is a Java port of the fast_float library](https://github.com/wrandelshofer/FastDoubleParser) called `FastDoubleParser`.
- [There is a Java port of the fast_float library](https://github.com/wrandelshofer/FastDoubleParser) called `FastDoubleParser`. It used for important systems such as [Jackson](https://github.com/FasterXML/jackson-core).
- [There is a C# port of the fast_float library](https://github.com/CarlVerret/csFastFloat) called `csFastFloat`.
## Relation With Other Work
The fastfloat algorithm is part of the [LLVM standard libraries](https://github.com/llvm/llvm-project/commit/87c016078ad72c46505461e4ff8bfa04819fe7ba).
The fast_float library provides a performance similar to that of the [fast_double_parser](https://github.com/lemire/fast_double_parser) library but using an updated algorithm reworked from the ground up, and while offering an API more in line with the expectations of C++ programmers. The fast_double_parser library is part of the [Microsoft LightGBM machine-learning framework](https://github.com/microsoft/LightGBM).
## Users
The fast_float library is used by [Apache Arrow](https://github.com/apache/arrow/pull/8494) where it multiplied the number parsing speed by two or three times. It is also used by [Yandex ClickHouse](https://github.com/ClickHouse/ClickHouse) and by [Google Jsonnet](https://github.com/google/jsonnet).
@@ -135,14 +186,14 @@ It can parse random floating-point numbers at a speed of 1 GB/s on some systems.
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.